From e56df1a96bbf45aff92f0062388bfd1083a1a1d8 Mon Sep 17 00:00:00 2001 From: kazu Date: Sat, 23 Dec 2006 22:10:10 +0000 Subject: [PATCH] * Makefile.in (final.o): Depend on vecprim.h. * final.c: Include vecprim.h. (insn_addresses_): Change the type to VEC(int,heap)*. * insn-addr.h (INSN_ADDRESSES_DEFN): Remove. (INSN_ADDRESSES, INSN_ADDRESSES_ALLOC, INSN_ADDRESSES_SIZE, INSN_ADDRESSES_NEW): Use VEC instead of VARRAY. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120177 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/Makefile.in | 2 +- gcc/final.c | 3 ++- gcc/insn-addr.h | 60 ++++++++++++++++++++++++++++++++++++--------------------- 4 files changed, 48 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 198e877eb82..01e740ff6f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -4,6 +4,13 @@ * doc/invoke.texi (-fforce-mem): Remove. * opts.c (common_handle_option): Don't handle OPT_fforce_mem. + * Makefile.in (final.o): Depend on vecprim.h. + * final.c: Include vecprim.h. + (insn_addresses_): Change the type to VEC(int,heap)*. + * insn-addr.h (INSN_ADDRESSES_DEFN): Remove. + (INSN_ADDRESSES, INSN_ADDRESSES_ALLOC, INSN_ADDRESSES_SIZE, + INSN_ADDRESSES_NEW): Use VEC instead of VARRAY. + 2006-12-23 Marcin Dalecki * cgraphunit.c (cgraph_optimize): Fixed obvious thinko in memory diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 087992d88a9..632bf0950bd 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2593,7 +2593,7 @@ final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ insn-config.h $(INSN_ATTR_H) $(FUNCTION_H) output.h hard-reg-set.h \ except.h debug.h xcoffout.h toplev.h reload.h dwarf2out.h tree-pass.h \ $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) $(CFGLAYOUT_H) dbxout.h \ - $(TIMEVAR_H) $(CGRAPH_H) $(COVERAGE_H) $(REAL_H) + $(TIMEVAR_H) $(CGRAPH_H) $(COVERAGE_H) $(REAL_H) vecprim.h recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(FUNCTION_H) $(BASIC_BLOCK_H) $(REGS_H) $(RECOG_H) $(EXPR_H) \ $(FLAGS_H) insn-config.h $(INSN_ATTR_H) toplev.h output.h reload.h \ diff --git a/gcc/final.c b/gcc/final.c index ac81cdcfe6d..bd96444ea48 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -76,6 +76,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "timevar.h" #include "cgraph.h" #include "coverage.h" +#include "vecprim.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" /* Needed for external data @@ -320,7 +321,7 @@ dbr_sequence_length (void) static int *insn_lengths; -varray_type insn_addresses_; +VEC(int,heap) *insn_addresses_; /* Max uid for which the above arrays are valid. */ static int insn_lengths_max_uid; diff --git a/gcc/insn-addr.h b/gcc/insn-addr.h index 457980e44fe..baa3cdadcae 100644 --- a/gcc/insn-addr.h +++ b/gcc/insn-addr.h @@ -19,32 +19,48 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GCC_INSN_ADDR_H -#define GCC_INSN_ADDR_H +#define GCC_INSN_ADDR_H -#include "varray.h" +#include "vecprim.h" -extern GTY(()) varray_type insn_addresses_; +extern VEC(int,heap) *insn_addresses_; extern int insn_current_address; -#define INSN_ADDRESSES_DEFN() varray_type insn_addresses_ -#define INSN_ADDRESSES(id) VARRAY_INT (insn_addresses_, (id)) -#define INSN_ADDRESSES_ALLOC(size) \ - VARRAY_INT_INIT (insn_addresses_, (size), "insn_addresses") -#define INSN_ADDRESSES_FREE() (insn_addresses_ = 0) +#define INSN_ADDRESSES(id) (*&(VEC_address (int, insn_addresses_) [id])) +#define INSN_ADDRESSES_ALLOC(size) \ + do \ + { \ + insn_addresses_ = VEC_alloc (int, heap, size); \ + VEC_safe_grow (int, heap, insn_addresses_, size); \ + memset (VEC_address (int, insn_addresses_), \ + 0, sizeof (int) * size); \ + } \ + while (0) +#define INSN_ADDRESSES_FREE() (VEC_free (int, heap, insn_addresses_)) #define INSN_ADDRESSES_SET_P() (insn_addresses_ != 0) -#define INSN_ADDRESSES_SIZE() VARRAY_SIZE (insn_addresses_) -#define INSN_ADDRESSES_NEW(insn, addr) do \ - { \ - unsigned insn_uid__ = INSN_UID ((insn)); \ - int insn_addr__ = (addr); \ - \ - if (INSN_ADDRESSES_SET_P ()) \ - { \ - if (INSN_ADDRESSES_SIZE () <= insn_uid__) \ - VARRAY_GROW (insn_addresses_, insn_uid__ + 1); \ - INSN_ADDRESSES (insn_uid__) = insn_addr__; \ - } \ - } \ -while (0) +#define INSN_ADDRESSES_SIZE() (VEC_length (int, insn_addresses_)) + +static inline void +insn_addresses_new (rtx insn, int insn_addr) +{ + unsigned insn_uid = INSN_UID ((insn)); + + if (INSN_ADDRESSES_SET_P ()) + { + size_t size = INSN_ADDRESSES_SIZE (); + if (size <= insn_uid) + { + int *p; + VEC_safe_grow (int, heap, insn_addresses_, insn_uid + 1); + p = VEC_address (int, insn_addresses_); + memset (&p[size], + 0, sizeof (int) * (insn_uid + 1 - size)); + } + INSN_ADDRESSES (insn_uid) = insn_addr; + } +} + +#define INSN_ADDRESSES_NEW(insn, addr) \ + (insn_addresses_new (insn, addr)) #endif /* ! GCC_INSN_ADDR_H */ -- 2.11.4.GIT