This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] insn-addr.h: Use VEC instead of VARRAY.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 23 Dec 2006 14:10:18 -0800
- Subject: [patch] insn-addr.h: Use VEC instead of VARRAY.
Hi,
Attached is a patch to use VEC instead of VARRAY.
Tested on i686-pc-linux-gnu. Committed as preapproved.
Kazu Hirata
2006-12-23 Kazu Hirata <kazu@codesourcery.com>
* 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.
Index: Makefile.in
===================================================================
*** Makefile.in (revision 120165)
--- Makefile.in (working copy)
***************
*** 2593,2599 ****
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)
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 \
--- 2593,2599 ----
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) 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 \
Index: final.c
===================================================================
*** final.c (revision 120165)
--- final.c (working copy)
***************
*** 76,81 ****
--- 76,82 ----
#include "timevar.h"
#include "cgraph.h"
#include "coverage.h"
+ #include "vecprim.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h" /* Needed for external data
***************
*** 320,326 ****
static int *insn_lengths;
! varray_type insn_addresses_;
/* Max uid for which the above arrays are valid. */
static int insn_lengths_max_uid;
--- 321,327 ----
static int *insn_lengths;
! VEC(int,heap) *insn_addresses_;
/* Max uid for which the above arrays are valid. */
static int insn_lengths_max_uid;
Index: insn-addr.h
===================================================================
*** insn-addr.h (revision 120165)
--- insn-addr.h (working copy)
***************
*** 19,50 ****
02110-1301, USA. */
#ifndef GCC_INSN_ADDR_H
! #define GCC_INSN_ADDR_H
! #include "varray.h"
! extern GTY(()) varray_type 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_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)
#endif /* ! GCC_INSN_ADDR_H */
--- 19,66 ----
02110-1301, USA. */
#ifndef GCC_INSN_ADDR_H
! #define GCC_INSN_ADDR_H
! #include "vecprim.h"
! extern VEC(int,heap) *insn_addresses_;
extern int insn_current_address;
! #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() (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 */