summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-14 02:28:46 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2006-04-14 02:28:46 +0000
commitd14dbec5476797990d0d4d5b487822d0a2b4853c (patch)
tree17efbc0a6f42d3bc2e77211baecf71bc557f15d4
parent0dbb8bc6321c906387966206ce7b9048a0b37d48 (diff)
downloadgcc-d14dbec5476797990d0d4d5b487822d0a2b4853c.tar.gz
* basic-block.h (REG_BASIC_BLOCK): Use VEC instead of VARRAY.
* flow.c (reg_n_info): Change the type to VEC(reg_info_p,heap) *. * regclass.c (allocate_reg_info, free_reg_info): Use VEC instead of VARRAY. * regs.h (reg_info_p): New. (REG_N_REFS, REG_FREQ, REG_N_SETS, REG_N_DEATHS, REG_N_CALLS_CROSSED, REG_N_THROWING_CALLS_CROSSED, REG_LIVE_LENGTH, REGNO_FIRST_UID, REGNO_LAST_UID): Use VEC instead of VARRAY. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112942 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/basic-block.h3
-rw-r--r--gcc/flow.c2
-rw-r--r--gcc/regclass.c24
-rw-r--r--gcc/regs.h27
5 files changed, 53 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 08b8f29f941..9baf93ddca7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2006-04-14 Kazu Hirata <kazu@codesourcery.com>
+
+ * basic-block.h (REG_BASIC_BLOCK): Use VEC instead of VARRAY.
+ * flow.c (reg_n_info): Change the type to
+ VEC(reg_info_p,heap) *.
+ * regclass.c (allocate_reg_info, free_reg_info): Use VEC
+ instead of VARRAY.
+ * regs.h (reg_info_p): New.
+ (REG_N_REFS, REG_FREQ, REG_N_SETS, REG_N_DEATHS,
+ REG_N_CALLS_CROSSED, REG_N_THROWING_CALLS_CROSSED,
+ REG_LIVE_LENGTH, REGNO_FIRST_UID, REGNO_LAST_UID): Use VEC
+ instead of VARRAY.
+
2006-04-13 Eric Botcazou <ebotcazou@adacore.com>
* params.def (PARAM_MAX_SCHED_READY_INSNS): New parameter,
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 14c22e35466..1d41a00c631 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -460,7 +460,8 @@ extern bitmap_obstack reg_obstack;
#define REG_BLOCK_UNKNOWN -1
#define REG_BLOCK_GLOBAL -2
-#define REG_BASIC_BLOCK(N) (VARRAY_REG (reg_n_info, N)->basic_block)
+#define REG_BASIC_BLOCK(N) \
+ (VEC_index (reg_info_p, reg_n_info, N)->basic_block)
/* Stuff for recording basic block info. */
diff --git a/gcc/flow.c b/gcc/flow.c
index 64d40925429..4913102a8f5 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -182,7 +182,7 @@ int max_regno;
/* Indexed by n, giving various register information */
-varray_type reg_n_info;
+VEC(reg_info_p,heap) *reg_n_info;
/* Regset of regs live when calls to `setjmp'-like functions happen. */
/* ??? Does this exist only for the setjmp-clobbered warning message? */
diff --git a/gcc/regclass.c b/gcc/regclass.c
index 1f1e6c24166..8a0bab19026 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -2176,13 +2176,28 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p)
if (!reg_n_info)
{
- VARRAY_REG_INIT (reg_n_info, regno_allocated, "reg_n_info");
+ reg_n_info = VEC_alloc (reg_info_p, heap, regno_allocated);
+ VEC_safe_grow (reg_info_p, heap, reg_n_info, regno_allocated);
+ memset (VEC_address (reg_info_p, reg_n_info), 0,
+ sizeof (reg_info_p) * regno_allocated);
renumber = xmalloc (size_renumber);
reg_pref_buffer = XNEWVEC (struct reg_pref, regno_allocated);
}
else
{
- VARRAY_GROW (reg_n_info, regno_allocated);
+ size_t old_length = VEC_length (reg_info_p, reg_n_info);
+ if (old_length < regno_allocated)
+ {
+ reg_info_p *addr;
+ VEC_safe_grow (reg_info_p, heap, reg_n_info, regno_allocated);
+ addr = VEC_address (reg_info_p, reg_n_info);
+ memset (&addr[old_length], 0,
+ sizeof (reg_info_p) * (regno_allocated - old_length));
+ }
+ else if (regno_allocated < old_length)
+ {
+ VEC_truncate (reg_info_p, reg_n_info, regno_allocated);
+ }
if (new_p) /* If we're zapping everything, no need to realloc. */
{
@@ -2238,7 +2253,8 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p)
for (i = min_index+local_min; i <= max; i++)
{
- VARRAY_REG (reg_n_info, i) = &reg_data->data[i-min_index];
+ VEC_replace (reg_info_p, reg_n_info, i,
+ &reg_data->data[i-min_index]);
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
renumber[i] = -1;
reg_pref_buffer[i].prefclass = (char) NO_REGS;
@@ -2265,7 +2281,7 @@ free_reg_info (void)
struct reg_info_data *reg_data;
struct reg_info_data *reg_next;
- VARRAY_FREE (reg_n_info);
+ VEC_free (reg_info_p, heap, reg_n_info);
for (reg_data = reg_info_head; reg_data; reg_data = reg_next)
{
reg_next = reg_data->next;
diff --git a/gcc/regs.h b/gcc/regs.h
index d29e0e1aace..ee074b9ed1b 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -65,15 +65,20 @@ typedef struct reg_info_def
int basic_block; /* # of basic blocks (REG n) is used in */
} reg_info;
-extern varray_type reg_n_info;
+typedef reg_info *reg_info_p;
+
+DEF_VEC_P(reg_info_p);
+DEF_VEC_ALLOC_P(reg_info_p,heap);
+
+extern VEC(reg_info_p,heap) *reg_n_info;
/* Indexed by n, gives number of times (REG n) is used or set. */
-#define REG_N_REFS(N) (VARRAY_REG (reg_n_info, N)->refs)
+#define REG_N_REFS(N) (VEC_index (reg_info_p, reg_n_info, N)->refs)
/* Estimate frequency of references to register N. */
-#define REG_FREQ(N) (VARRAY_REG (reg_n_info, N)->freq)
+#define REG_FREQ(N) (VEC_index (reg_info_p, reg_n_info, N)->freq)
/* The weights for each insn varries from 0 to REG_FREQ_BASE.
This constant does not need to be high, as in infrequently executed
@@ -97,7 +102,7 @@ extern varray_type reg_n_info;
??? both regscan and flow allocate space for this. We should settle
on just copy. */
-#define REG_N_SETS(N) (VARRAY_REG (reg_n_info, N)->sets)
+#define REG_N_SETS(N) (VEC_index (reg_info_p, reg_n_info, N)->sets)
/* Indexed by N, gives number of insns in which register N dies.
Note that if register N is live around loops, it can die
@@ -105,7 +110,7 @@ extern varray_type reg_n_info;
So this is only a reliable indicator of how many regions of life there are
for registers that are contained in one basic block. */
-#define REG_N_DEATHS(N) (VARRAY_REG (reg_n_info, N)->deaths)
+#define REG_N_DEATHS(N) (VEC_index (reg_info_p, reg_n_info, N)->deaths)
/* Get the number of consecutive words required to hold pseudo-reg N. */
@@ -124,13 +129,14 @@ extern varray_type reg_n_info;
/* Indexed by N, gives number of CALL_INSNS across which (REG n) is live. */
-#define REG_N_CALLS_CROSSED(N) (VARRAY_REG (reg_n_info, N)->calls_crossed)
+#define REG_N_CALLS_CROSSED(N) \
+ (VEC_index (reg_info_p, reg_n_info, N)->calls_crossed)
/* Indexed by N, gives number of CALL_INSNS that may throw, across which
(REG n) is live. */
#define REG_N_THROWING_CALLS_CROSSED(N) \
- (VARRAY_REG (reg_n_info, N)->throw_calls_crossed)
+ (VEC_index (reg_info_p, reg_n_info, N)->throw_calls_crossed)
/* Total number of instructions at which (REG n) is live.
The larger this is, the less priority (REG n) gets for
@@ -147,7 +153,8 @@ extern varray_type reg_n_info;
is not required. global.c makes an allocno for this but does
not try to assign a hard register to it. */
-#define REG_LIVE_LENGTH(N) (VARRAY_REG (reg_n_info, N)->live_length)
+#define REG_LIVE_LENGTH(N) \
+ (VEC_index (reg_info_p, reg_n_info, N)->live_length)
/* Vector of substitutions of register numbers,
used to map pseudo regs into hardware regs.
@@ -182,7 +189,7 @@ extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
It is sometimes adjusted for subsequent changes during loop,
but not adjusted by cse even if cse invalidates it. */
-#define REGNO_FIRST_UID(N) (VARRAY_REG (reg_n_info, N)->first_uid)
+#define REGNO_FIRST_UID(N) (VEC_index (reg_info_p, reg_n_info, N)->first_uid)
/* Vector indexed by regno; gives uid of last insn using that reg.
This is computed by reg_scan for use by cse and loop.
@@ -190,7 +197,7 @@ extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
but not adjusted by cse even if cse invalidates it.
This is harmless since cse won't scan through a loop end. */
-#define REGNO_LAST_UID(N) (VARRAY_REG (reg_n_info, N)->last_uid)
+#define REGNO_LAST_UID(N) (VEC_index (reg_info_p, reg_n_info, N)->last_uid)
/* List made of EXPR_LIST rtx's which gives pairs of pseudo registers
that have to go in the same hard reg. */