summaryrefslogtreecommitdiff
path: root/gcc/global.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-22 20:52:39 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-22 20:52:39 +0000
commita2c6f0b7da35eadcfafa42e5ad04647c2696fbb4 (patch)
tree9e698cb3b5286c709642b8db45a05193e856c5fc /gcc/global.c
parent0e37e3f07660892f3666527aedcb58c6b7cb5d37 (diff)
downloadgcc-a2c6f0b7da35eadcfafa42e5ad04647c2696fbb4.tar.gz
gcc/
* regs.h (end_hard_regno): New function. (END_HARD_REGNO, END_REGNO): New macros. (add_to_hard_reg_set): New function. (remove_from_hard_reg_set): Likewise. (in_hard_reg_set_p): Likewise. (overlaps_hard_reg_set_p): Likewise. * bt-load.c (find_btr_reference): Use overlaps_hard_reg_set_p. (note_btr_set): Use END_HARD_REGNO. * caller-save.c (setup_save_areas): Use end_hard_regno. (mark_set_regs): Use END_HARD_REGNO. (add_stored_regs): Use end_hard_regno. (mark_referenced_regs): Use add_to_hard_reg_set. * combine.c (update_table_tick): Use END_REGNO. (record_value_for_reg): Likewise. (record_dead_and_set_regs): Likewise. (get_last_value_validate): Likewise. (use_crosses_set_p): Likewise. (reg_dead_at_p_1): Likewise. (reg_dead_at_p): Likewise. (mark_used_regs_combine): Use add_to_hard_reg_set. (move_deaths): Use END_HARD_REGNO. (reg_bitfield_target_p): Use end_hard_regno. (distribute_notes): Use END_HARD_REGNO. * cse.c (mention_regs): Use END_REGNO. (insert): Use add_to_hard_reg_set. (invalidate): Use END_HARD_REGNO. (invalidate_for_call): Likewise. (exp_equiv_p): Use END_REGNO. (cse_insn): Likewise. * cselib.c (cselib_invalidate_regno): Use end_hard_regno. * df-problems.c (df_urec_mark_reg_change): Use END_HARD_REGNO. * df-scan.c (df_ref_record): Use END_HARD_REGNO. * function.c (keep_stack_depressed): Use end_hard_regno. * global.c (global_alloc): Use end_hard_regno. (global_conflicts): Use add_to_hard_reg_set instead of mark_reg_live_nc. (find_reg): Likewise. (mark_reg_store): Likewise. (mark_reg_conflicts): Likewise. (mark_reg_death): Use remove_from_hard_reg_set. (mark_reg_live_nc): Delete. (set_preference): Use end_hard_regno. * local-alloc.c (mark_life): Use add_to_hard_reg_set and remove_from_hard_reg_set. (post_mark_life): Use add_to_hard_reg_set. * mode-switching.c (reg_dies): Use remove_from_hard_reg_set. (reg_becomes_live): Use add_to_hard_reg_set. * recog.c (reg_fits_class_p): Use in_hard_reg_set_p. (peep2_find_free_register): Use add_to_hard_reg_set. * reg-stack.c (convert_regs_exit): Use END_HARD_REGNO. * regclass.c (record_reg_classes): Use in_hard_reg_set_p. * regrename.c (note_sets): Use add_to_hard_reg_set. (clear_dead_regs): Use remove_from_hard_reg_set. (regrename_optimize): Use add_to_hard_reg_set. (find_oldest_value_reg): Use in_hard_reg_set_p. * reload.c (push_reload): Use in_hard_reg_set_p and end_hard_regno. (hard_reg_set_here_p): Use end_hard_regno. (decompose): Likewise. (reg_overlap_mentioned_for_reload_p): Use END_HARD_REGNO. (find_equiv_reg): Use in_hard_reg_set_p and end_hard_regno. * reload1.c (compute_use_by_pseudos): Use add_to_hard_reg_set. (mark_home_live): Use end_hard_regno. (spill_hard_reg): Likewise. (clear_reload_reg_in_use): Likewise. * reorg.c (delete_prior_computation): Use END_REGNO. * resource.c (update_live_status): Use END_HARD_REGNO. (mark_referenced_resources): Use add_to_hard_reg_set. (mark_set_resources): Likewise. (mark_target_live_regs): Likewise. Use remove_from_hard_reg_set. * rtlanal.c (refers_to_regno_p): Use END_REGNO. (reg_overlap_mentioned_p): Likewise. (dead_or_set_p): Likewise. Use an exclusive upper loop bound. (covers_regno_no_parallel_p): Use END_REGNO. (find_regno_note): Likewise. (find_reg_fusage): Use END_HARD_REGNO. * stmt.c (decl_overlaps_hard_reg_set_p): Use overlaps_hard_reg_set_p. * var-tracking.c (emit_note_insn_var_location): Use end_hard_regno. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124961 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/global.c')
-rw-r--r--gcc/global.c60
1 files changed, 17 insertions, 43 deletions
diff --git a/gcc/global.c b/gcc/global.c
index fd947607533..a3da8a28d60 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -306,7 +306,6 @@ static void mark_reg_store (rtx, rtx, void *);
static void mark_reg_clobber (rtx, rtx, void *);
static void mark_reg_conflicts (rtx);
static void mark_reg_death (rtx);
-static void mark_reg_live_nc (int, enum machine_mode);
static void set_preference (rtx, rtx);
static void dump_conflicts (FILE *);
static void reg_becomes_live (rtx, rtx, void *);
@@ -529,7 +528,7 @@ global_alloc (void)
if (reg_renumber[i] >= 0)
{
int regno = reg_renumber[i];
- int endregno = regno + hard_regno_nregs[regno][PSEUDO_REGNO_MODE (i)];
+ int endregno = end_hard_regno (PSEUDO_REGNO_MODE (i), regno);
int j;
for (j = regno; j < endregno; j++)
@@ -737,7 +736,7 @@ global_conflicts (void)
block_start_allocnos[ax++] = a;
}
else if ((a = reg_renumber[i]) >= 0)
- mark_reg_live_nc (a, PSEUDO_REGNO_MODE (i));
+ add_to_hard_reg_set (&hard_regs_live, PSEUDO_REGNO_MODE (i), a);
}
/* Record that each allocno now live conflicts with each hard reg
@@ -1132,7 +1131,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
|| ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)))
{
int j;
- int lim = regno + hard_regno_nregs[regno][mode];
+ int lim = end_hard_regno (mode, regno);
for (j = regno + 1;
(j < lim
&& ! TEST_HARD_REG_BIT (used, j));
@@ -1177,7 +1176,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
REGNO_REG_CLASS (i))))
{
int j;
- int lim = i + hard_regno_nregs[i][mode];
+ int lim = end_hard_regno (mode, i);
for (j = i + 1;
(j < lim
&& ! TEST_HARD_REG_BIT (used, j)
@@ -1213,7 +1212,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
REGNO_REG_CLASS (i))))
{
int j;
- int lim = i + hard_regno_nregs[i][mode];
+ int lim = end_hard_regno (mode, i);
for (j = i + 1;
(j < lim
&& ! TEST_HARD_REG_BIT (used, j)
@@ -1339,7 +1338,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
{
int r = reg_renumber[k];
int endregno
- = r + hard_regno_nregs[r][PSEUDO_REGNO_MODE (k)];
+ = end_hard_regno (PSEUDO_REGNO_MODE (k), r);
if (regno >= r && regno < endregno)
{
@@ -1374,7 +1373,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
/* Make a set of the hard regs being allocated. */
CLEAR_HARD_REG_SET (this_reg);
- lim = best_reg + hard_regno_nregs[best_reg][mode];
+ lim = end_hard_regno (mode, best_reg);
for (j = best_reg; j < lim; j++)
{
SET_HARD_REG_BIT (this_reg, j);
@@ -1555,7 +1554,7 @@ mark_reg_store (rtx reg, rtx setter, void *data ATTRIBUTE_UNUSED)
/* Handle hardware regs (and pseudos allocated to hard regs). */
if (regno < FIRST_PSEUDO_REGISTER && ! fixed_regs[regno])
{
- int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
+ int last = end_hard_regno (GET_MODE (reg), regno);
while (regno < last)
{
record_one_conflict (regno);
@@ -1604,7 +1603,7 @@ mark_reg_conflicts (rtx reg)
/* Handle hardware regs (and pseudos allocated to hard regs). */
if (regno < FIRST_PSEUDO_REGISTER && ! fixed_regs[regno])
{
- int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
+ int last = end_hard_regno (GET_MODE (reg), regno);
while (regno < last)
{
record_one_conflict (regno);
@@ -1635,32 +1634,9 @@ mark_reg_death (rtx reg)
/* Handle hardware regs (and pseudos allocated to hard regs). */
if (regno < FIRST_PSEUDO_REGISTER && ! fixed_regs[regno])
- {
- /* Pseudo regs already assigned hardware regs are treated
- almost the same as explicit hardware regs. */
- int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
- while (regno < last)
- {
- CLEAR_HARD_REG_BIT (hard_regs_live, regno);
- regno++;
- }
- }
-}
-
-/* Mark hard reg REGNO as currently live, assuming machine mode MODE
- for the value stored in it. MODE determines how many consecutive
- registers are actually in use. Do not record conflicts;
- it is assumed that the caller will do that. */
-
-static void
-mark_reg_live_nc (int regno, enum machine_mode mode)
-{
- int last = regno + hard_regno_nregs[regno][mode];
- while (regno < last)
- {
- SET_HARD_REG_BIT (hard_regs_live, regno);
- regno++;
- }
+ /* Pseudo regs already assigned hardware regs are treated
+ almost the same as explicit hardware regs. */
+ remove_from_hard_reg_set (&hard_regs_live, GET_MODE (reg), regno);
}
/* Try to set a preference for an allocno to a hard register.
@@ -1675,7 +1651,7 @@ mark_reg_live_nc (int regno, enum machine_mode mode)
static void
set_preference (rtx dest, rtx src)
{
- unsigned int src_regno, dest_regno;
+ unsigned int src_regno, dest_regno, end_regno;
/* Amount to add to the hard regno for SRC, or subtract from that for DEST,
to compensate for subregs in SRC or DEST. */
int offset = 0;
@@ -1747,9 +1723,8 @@ set_preference (rtx dest, rtx src)
SET_REGBIT (hard_reg_preferences,
reg_allocno[src_regno], dest_regno);
- for (i = dest_regno;
- i < dest_regno + hard_regno_nregs[dest_regno][GET_MODE (dest)];
- i++)
+ end_regno = end_hard_regno (GET_MODE (dest), dest_regno);
+ for (i = dest_regno; i < end_regno; i++)
SET_REGBIT (hard_reg_full_preferences, reg_allocno[src_regno], i);
}
}
@@ -1766,9 +1741,8 @@ set_preference (rtx dest, rtx src)
SET_REGBIT (hard_reg_preferences,
reg_allocno[dest_regno], src_regno);
- for (i = src_regno;
- i < src_regno + hard_regno_nregs[src_regno][GET_MODE (src)];
- i++)
+ end_regno = end_hard_regno (GET_MODE (src), src_regno);
+ for (i = src_regno; i < end_regno; i++)
SET_REGBIT (hard_reg_full_preferences, reg_allocno[dest_regno], i);
}
}