basic-block.h (reg_set_iterator): New.

* basic-block.h (reg_set_iterator): New.
	(EXECUTE_IF_SET_IN_REG_SET): Make it iterator style.
	(EXECUTE_IF_AND_COMPL_IN_REG_SET): Likewise.
	(EXECUTE_IF_AND_IN_REG_SET): Likewise.
	* caller-save.c (save_call_clobbered_regs): Adjust to the new
	style.
	* cfgcleanup.c (thread_jump): Likewise.
	* cfgrtl.c (safe_insert_insn_on_edge): Likewise.
	* conflict.c (conflict_graph_compute): Likewise.
	* flow.c (verify_local_live_at_start, update_life_info,
	initialize_uninitialized_subregs, propagate_one_insn,
	init_propagate_block_info, free_propagate_block_info,
	propagate_block, dump_regset): Likewise.
	* global.c (global_conflicts): Likewise.
	* graph.c (start_bb): Likewise.
	* local-alloc.c (update_equiv_regs): Likewise.
	* loop.c (load_mems): Likewise.
	* reload1.c (compute_use_by_pseudos, order_regs_for_reload,
	find_reg, finish_spills): Likewise.
	* resource.c (mark_target_live_regs): Likewise.
	* sched-deps.c (sched_analyze_insn): Likewise.
	* sched-rgn.c (sched-rgn.c): Likewise.
	* config/frv/frv.c (frv_ifcvt_modify_tests): Likewise.

From-SVN: r89226
This commit is contained in:
Kazu Hirata 2004-10-18 15:11:31 +00:00 committed by Kazu Hirata
parent 2ddfd02523
commit a204196782
16 changed files with 278 additions and 241 deletions

View File

@ -1,3 +1,29 @@
2004-10-18 Kazu Hirata <kazu@cs.umass.edu>
* basic-block.h (reg_set_iterator): New.
(EXECUTE_IF_SET_IN_REG_SET): Make it iterator style.
(EXECUTE_IF_AND_COMPL_IN_REG_SET): Likewise.
(EXECUTE_IF_AND_IN_REG_SET): Likewise.
* caller-save.c (save_call_clobbered_regs): Adjust to the new
style.
* cfgcleanup.c (thread_jump): Likewise.
* cfgrtl.c (safe_insert_insn_on_edge): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* flow.c (verify_local_live_at_start, update_life_info,
initialize_uninitialized_subregs, propagate_one_insn,
init_propagate_block_info, free_propagate_block_info,
propagate_block, dump_regset): Likewise.
* global.c (global_conflicts): Likewise.
* graph.c (start_bb): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* loop.c (load_mems): Likewise.
* reload1.c (compute_use_by_pseudos, order_regs_for_reload,
find_reg, finish_spills): Likewise.
* resource.c (mark_target_live_regs): Likewise.
* sched-deps.c (sched_analyze_insn): Likewise.
* sched-rgn.c (sched-rgn.c): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests): Likewise.
2004-10-18 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.md (addqi_1_slp): Test for incdec_operand

View File

@ -83,46 +83,24 @@ do { \
reg_set_to_hard_reg_set (&TO, FROM); \
} while (0)
typedef bitmap_iterator reg_set_iterator;
/* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the
register number and executing CODE for all registers that are set. */
#define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, CODE) \
do \
{ \
bitmap_iterator bi; \
\
EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, bi) \
{ \
CODE; \
} \
} while (0)
#define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, RSI) \
EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, RSI)
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
REGNUM to the register number and executing CODE for all registers that are
set in the first regset and not set in the second. */
#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
do \
{ \
bitmap_iterator bi; \
\
EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, bi) \
{ \
CODE; \
} \
} while (0)
#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET, MIN, REGNUM, RSI) \
EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET, MIN, REGNUM, RSI)
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
REGNUM to the register number and executing CODE for all registers that are
set in both regsets. */
#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, CODE) \
do \
{ \
bitmap_iterator bi; \
\
EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, bi) \
{ \
CODE; \
} \
} while (0)
#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \
EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI) \
/* Allocate a register set with oballoc. */
#define OBSTACK_ALLOC_REG_SET(OBSTACK) BITMAP_OBSTACK_ALLOC (OBSTACK)

View File

@ -410,6 +410,7 @@ save_call_clobbered_regs (void)
{
int regno;
HARD_REG_SET hard_regs_to_save;
reg_set_iterator rsi;
/* Use the register life information in CHAIN to compute which
regs are live during the call. */
@ -425,22 +426,22 @@ save_call_clobbered_regs (void)
/* Look through all live pseudos, mark their hard registers
and choose proper mode for saving. */
EXECUTE_IF_SET_IN_REG_SET
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, regno,
{
int r = reg_renumber[regno];
int nregs;
enum machine_mode mode;
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, regno, rsi)
{
int r = reg_renumber[regno];
int nregs;
enum machine_mode mode;
gcc_assert (r >= 0);
nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (regno)];
mode = HARD_REGNO_CALLER_SAVE_MODE
(r, nregs, PSEUDO_REGNO_MODE (regno));
if (GET_MODE_BITSIZE (mode)
> GET_MODE_BITSIZE (save_mode[r]))
save_mode[r] = mode;
while (nregs-- > 0)
SET_HARD_REG_BIT (hard_regs_to_save, r + nregs);
});
gcc_assert (r >= 0);
nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (regno)];
mode = HARD_REGNO_CALLER_SAVE_MODE
(r, nregs, PSEUDO_REGNO_MODE (regno));
if (GET_MODE_BITSIZE (mode)
> GET_MODE_BITSIZE (save_mode[r]))
save_mode[r] = mode;
while (nregs-- > 0)
SET_HARD_REG_BIT (hard_regs_to_save, r + nregs);
}
/* Record all registers set in this call insn. These don't need
to be saved. N.B. the call insn might set a subreg of a

View File

@ -282,6 +282,7 @@ thread_jump (int mode, edge e, basic_block b)
int i;
regset nonequal;
bool failed = false;
reg_set_iterator rsi;
if (BB_FLAGS (b) & BB_NONTHREADABLE_BLOCK)
return NULL;
@ -396,7 +397,8 @@ thread_jump (int mode, edge e, basic_block b)
if (mode & CLEANUP_UPDATE_LIFE)
AND_REG_SET (nonequal, b->global_live_at_end);
EXECUTE_IF_SET_IN_REG_SET (nonequal, 0, i, goto failed_exit;);
EXECUTE_IF_SET_IN_REG_SET (nonequal, 0, i, rsi)
goto failed_exit;
BITMAP_XFREE (nonequal);
cselib_finish ();

View File

@ -1465,6 +1465,7 @@ safe_insert_insn_on_edge (rtx insn, edge e)
rtx save_regs = NULL_RTX;
int regno, noccmode;
enum machine_mode mode;
reg_set_iterator rsi;
#ifdef AVOID_CCMODE_COPIES
noccmode = true;
@ -1478,7 +1479,7 @@ safe_insert_insn_on_edge (rtx insn, edge e)
bitmap_operation (killed, killed, e->dest->global_live_at_start,
BITMAP_AND);
EXECUTE_IF_SET_IN_REG_SET (killed, 0, regno,
EXECUTE_IF_SET_IN_REG_SET (killed, 0, regno, rsi)
{
mode = regno < FIRST_PSEUDO_REGISTER
? reg_raw_mode[regno]
@ -1494,7 +1495,7 @@ safe_insert_insn_on_edge (rtx insn, edge e)
gen_reg_rtx (mode),
gen_raw_REG (mode, regno)),
save_regs);
});
}
if (save_regs)
{

View File

@ -6679,6 +6679,7 @@ frv_ifcvt_modify_tests (ce_if_block_t *ce_info, rtx *p_true, rtx *p_false)
enum reg_class cr_class;
int cc_first;
int cc_last;
reg_set_iterator rsi;
/* Make sure we are only dealing with hard registers. Also honor the
-mno-cond-exec switch, and -mno-nested-cond-exec switches if
@ -6735,11 +6736,11 @@ frv_ifcvt_modify_tests (ce_if_block_t *ce_info, rtx *p_true, rtx *p_false)
/* Remove anything live at the beginning of the join block from being
available for allocation. */
EXECUTE_IF_SET_IN_REG_SET (join_bb->global_live_at_start, 0, regno,
{
if (regno < FIRST_PSEUDO_REGISTER)
CLEAR_HARD_REG_BIT (tmp_reg->regs, regno);
});
EXECUTE_IF_SET_IN_REG_SET (join_bb->global_live_at_start, 0, regno, rsi)
{
if (regno < FIRST_PSEUDO_REGISTER)
CLEAR_HARD_REG_BIT (tmp_reg->regs, regno);
}
}
/* Add in all of the blocks in multiple &&/|| blocks to be scanned. */
@ -6779,11 +6780,11 @@ frv_ifcvt_modify_tests (ce_if_block_t *ce_info, rtx *p_true, rtx *p_false)
/* Anything live at the beginning of the block is obviously unavailable
for allocation. */
EXECUTE_IF_SET_IN_REG_SET (bb[j]->global_live_at_start, 0, regno,
{
if (regno < FIRST_PSEUDO_REGISTER)
CLEAR_HARD_REG_BIT (tmp_reg->regs, regno);
});
EXECUTE_IF_SET_IN_REG_SET (bb[j]->global_live_at_start, 0, regno, rsi)
{
if (regno < FIRST_PSEUDO_REGISTER)
CLEAR_HARD_REG_BIT (tmp_reg->regs, regno);
}
/* Loop through the insns in the block. */
for (;;)

View File

@ -446,6 +446,8 @@ conflict_graph_compute (regset regs, partition p)
/* Are we interested in this insn? */
if (INSN_P (insn))
{
reg_set_iterator rsi;
/* Determine which regs are set in this insn. Since
we're in SSA form, if a reg is set here it isn't set
anywhere else, so this insn is where the reg is born. */
@ -459,20 +461,22 @@ conflict_graph_compute (regset regs, partition p)
/* For every reg born here, add a conflict with every other
reg live coming into this insn. */
EXECUTE_IF_SET_IN_REG_SET
(born, FIRST_PSEUDO_REGISTER, born_reg,
{
EXECUTE_IF_SET_IN_REG_SET
(live, FIRST_PSEUDO_REGISTER, live_reg,
{
/* Build the conflict graph in terms of canonical
regnos. */
int b = partition_find (p, born_reg);
int l = partition_find (p, live_reg);
(born, FIRST_PSEUDO_REGISTER, born_reg, rsi)
{
reg_set_iterator rsj;
if (b != l)
conflict_graph_add (graph, b, l);
});
});
EXECUTE_IF_SET_IN_REG_SET
(live, FIRST_PSEUDO_REGISTER, live_reg, rsj)
{
/* Build the conflict graph in terms of canonical
regnos. */
int b = partition_find (p, born_reg);
int l = partition_find (p, live_reg);
if (b != l)
conflict_graph_add (graph, b, l);
}
}
/* Morgan's algorithm checks the operands of the insn
and adds them to the set of live regs. Instead, we

View File

@ -521,11 +521,12 @@ verify_local_live_at_start (regset new_live_at_start, basic_block bb)
else
{
int i;
reg_set_iterator rsi;
/* Find the set of changed registers. */
XOR_REG_SET (new_live_at_start, bb->global_live_at_start);
EXECUTE_IF_SET_IN_REG_SET (new_live_at_start, 0, i,
EXECUTE_IF_SET_IN_REG_SET (new_live_at_start, 0, i, rsi)
{
/* No registers should die. */
if (REGNO_REG_SET_P (bb->global_live_at_start, i))
@ -540,7 +541,7 @@ verify_local_live_at_start (regset new_live_at_start, basic_block bb)
}
/* Verify that the now-live register is wider than word_mode. */
verify_wide_reg (i, bb);
});
}
}
}
@ -680,13 +681,15 @@ update_life_info (sbitmap blocks, enum update_life_extent extent, int prop_flags
if (prop_flags & PROP_REG_INFO)
{
reg_set_iterator rsi;
/* The only pseudos that are live at the beginning of the function
are those that were not set anywhere in the function. local-alloc
doesn't know how to handle these correctly, so mark them as not
local to any one basic block. */
EXECUTE_IF_SET_IN_REG_SET (ENTRY_BLOCK_PTR->global_live_at_end,
FIRST_PSEUDO_REGISTER, i,
{ REG_BASIC_BLOCK (i) = REG_BLOCK_GLOBAL; });
FIRST_PSEUDO_REGISTER, i, rsi)
REG_BASIC_BLOCK (i) = REG_BLOCK_GLOBAL;
/* We have a problem with any pseudoreg that lives across the setjmp.
ANSI says that if a user variable does not change in value between
@ -697,14 +700,14 @@ update_life_info (sbitmap blocks, enum update_life_extent extent, int prop_flags
that hard reg where this pseudo is dead, thus clobbering the pseudo.
Conclusion: such a pseudo must not go in a hard reg. */
EXECUTE_IF_SET_IN_REG_SET (regs_live_at_setjmp,
FIRST_PSEUDO_REGISTER, i,
{
if (regno_reg_rtx[i] != 0)
{
REG_LIVE_LENGTH (i) = -1;
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
}
});
FIRST_PSEUDO_REGISTER, i, rsi)
{
if (regno_reg_rtx[i] != 0)
{
REG_LIVE_LENGTH (i) = -1;
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
}
}
}
if (reg_deaths)
{
@ -1369,8 +1372,9 @@ initialize_uninitialized_subregs (void)
{
basic_block bb = e->dest;
regset map = bb->global_live_at_start;
EXECUTE_IF_SET_IN_REG_SET (map,
FIRST_PSEUDO_REGISTER, reg,
reg_set_iterator rsi;
EXECUTE_IF_SET_IN_REG_SET (map, FIRST_PSEUDO_REGISTER, reg, rsi)
{
int uid = REGNO_FIRST_UID (reg);
rtx i;
@ -1398,7 +1402,7 @@ initialize_uninitialized_subregs (void)
did_something = 1;
}
}
});
}
}
if (did_something)
@ -1671,8 +1675,11 @@ propagate_one_insn (struct propagate_block_info *pbi, rtx insn)
record this for them. */
if (CALL_P (insn) && (flags & PROP_REG_INFO))
EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i,
{ REG_N_CALLS_CROSSED (i)++; });
{
reg_set_iterator rsi;
EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i, rsi)
REG_N_CALLS_CROSSED (i)++;
}
/* Record sets. Do this even for dead instructions, since they
would have killed the values if they hadn't been deleted. */
@ -1878,6 +1885,8 @@ init_propagate_block_info (basic_block bb, regset live, regset local_set,
= gen_rtx_fmt_ee (inv_cond,
GET_MODE (cond_true), XEXP (cond_true, 0),
XEXP (cond_true, 1));
reg_set_iterator rsi;
if (GET_CODE (XEXP (set_src, 1)) == PC)
{
rtx t = cond_false;
@ -1888,25 +1897,24 @@ init_propagate_block_info (basic_block bb, regset live, regset local_set,
SET_REGNO_REG_SET (pbi->reg_cond_reg, REGNO (reg));
/* For each such register, mark it conditionally dead. */
EXECUTE_IF_SET_IN_REG_SET
(diff, 0, i,
{
struct reg_cond_life_info *rcli;
rtx cond;
EXECUTE_IF_SET_IN_REG_SET (diff, 0, i, rsi)
{
struct reg_cond_life_info *rcli;
rtx cond;
rcli = xmalloc (sizeof (*rcli));
rcli = xmalloc (sizeof (*rcli));
if (REGNO_REG_SET_P (bb_true->global_live_at_start, i))
cond = cond_false;
else
cond = cond_true;
rcli->condition = cond;
rcli->stores = const0_rtx;
rcli->orig_condition = cond;
if (REGNO_REG_SET_P (bb_true->global_live_at_start, i))
cond = cond_false;
else
cond = cond_true;
rcli->condition = cond;
rcli->stores = const0_rtx;
rcli->orig_condition = cond;
splay_tree_insert (pbi->reg_cond_dead, i,
(splay_tree_value) rcli);
});
splay_tree_insert (pbi->reg_cond_dead, i,
(splay_tree_value) rcli);
}
}
}
@ -1966,11 +1974,13 @@ free_propagate_block_info (struct propagate_block_info *pbi)
{
int num = pbi->insn_num;
int i;
reg_set_iterator rsi;
EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i,
{ REG_LIVE_LENGTH (i) += num - reg_deaths[i];
reg_deaths[i] = 0;
});
EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i, rsi)
{
REG_LIVE_LENGTH (i) += num - reg_deaths[i];
reg_deaths[i] = 0;
}
}
if (pbi->reg_next_use)
free (pbi->reg_next_use);
@ -2009,11 +2019,12 @@ propagate_block (basic_block bb, regset live, regset local_set,
if (flags & PROP_REG_INFO)
{
int i;
reg_set_iterator rsi;
/* Process the regs live at the end of the block.
Mark them as not local to any one basic block. */
EXECUTE_IF_SET_IN_REG_SET (live, 0, i,
{ REG_BASIC_BLOCK (i) = REG_BLOCK_GLOBAL; });
EXECUTE_IF_SET_IN_REG_SET (live, 0, i, rsi)
REG_BASIC_BLOCK (i) = REG_BLOCK_GLOBAL;
}
/* Scan the block an insn at a time from end to beginning. */
@ -4135,19 +4146,21 @@ void
dump_regset (regset r, FILE *outf)
{
int i;
reg_set_iterator rsi;
if (r == NULL)
{
fputs (" (nil)", outf);
return;
}
EXECUTE_IF_SET_IN_REG_SET (r, 0, i,
EXECUTE_IF_SET_IN_REG_SET (r, 0, i, rsi)
{
fprintf (outf, " %d", i);
if (i < FIRST_PSEUDO_REGISTER)
fprintf (outf, " [%s]",
reg_names[i]);
});
}
}
/* Print a human-readable representation of R on the standard error

View File

@ -700,20 +700,20 @@ global_conflicts (void)
{
regset old = b->global_live_at_start;
int ax = 0;
reg_set_iterator rsi;
REG_SET_TO_HARD_REG_SET (hard_regs_live, old);
EXECUTE_IF_SET_IN_REG_SET (old, FIRST_PSEUDO_REGISTER, i,
{
int a = reg_allocno[i];
if (a >= 0)
{
SET_ALLOCNO_LIVE (a);
block_start_allocnos[ax++] = a;
}
else if ((a = reg_renumber[i]) >= 0)
mark_reg_live_nc
(a, PSEUDO_REGNO_MODE (i));
});
EXECUTE_IF_SET_IN_REG_SET (old, FIRST_PSEUDO_REGISTER, i, rsi)
{
int a = reg_allocno[i];
if (a >= 0)
{
SET_ALLOCNO_LIVE (a);
block_start_allocnos[ax++] = a;
}
else if ((a = reg_renumber[i]) >= 0)
mark_reg_live_nc (a, PSEUDO_REGNO_MODE (i));
}
/* Record that each allocno now live conflicts with each hard reg
now live.

View File

@ -66,6 +66,10 @@ graph: { title: \"%s\"\nfolding: 1\nhidden: 2\nnode: { title: \"%s.0\" }\n",
static void
start_bb (FILE *fp, int bb)
{
#if 0
reg_set_iterator rsi;
#endif
switch (graph_dump_format)
{
case vcg:
@ -83,13 +87,12 @@ label: \"basic block %d",
/* Print the live-at-start register list. */
fputc ('\n', fp);
EXECUTE_IF_SET_IN_REG_SET (basic_block_live_at_start[bb], 0, i,
{
fprintf (fp, " %d", i);
if (i < FIRST_PSEUDO_REGISTER)
fprintf (fp, " [%s]",
reg_names[i]);
});
EXECUTE_IF_SET_IN_REG_SET (basic_block_live_at_start[bb], 0, i, rsi)
{
fprintf (fp, " %d", i);
if (i < FIRST_PSEUDO_REGISTER)
fprintf (fp, " [%s]", reg_names[i]);
}
#endif
switch (graph_dump_format)

View File

@ -1128,14 +1128,17 @@ update_equiv_regs (void)
}
}
else
EXECUTE_IF_SET_IN_REG_SET (&cleared_regs, 0, j,
{
FOR_EACH_BB (bb)
{
CLEAR_REGNO_REG_SET (bb->global_live_at_start, j);
CLEAR_REGNO_REG_SET (bb->global_live_at_end, j);
}
});
{
reg_set_iterator rsi;
EXECUTE_IF_SET_IN_REG_SET (&cleared_regs, 0, j, rsi)
{
FOR_EACH_BB (bb)
{
CLEAR_REGNO_REG_SET (bb->global_live_at_start, j);
CLEAR_REGNO_REG_SET (bb->global_live_at_end, j);
}
}
}
}
/* Clean up. */

View File

@ -11242,6 +11242,7 @@ load_mems (const struct loop *loop)
rtx best = mem;
int j;
struct elt_loc_list *const_equiv = 0;
reg_set_iterator rsi;
if (e)
{
@ -11320,17 +11321,17 @@ load_mems (const struct loop *loop)
data flow, and enables {basic,general}_induction_var to find
more bivs/givs. */
EXECUTE_IF_SET_IN_REG_SET
(&load_copies, FIRST_PSEUDO_REGISTER, j,
{
try_copy_prop (loop, reg, j);
});
(&load_copies, FIRST_PSEUDO_REGISTER, j, rsi)
{
try_copy_prop (loop, reg, j);
}
CLEAR_REG_SET (&load_copies);
EXECUTE_IF_SET_IN_REG_SET
(&store_copies, FIRST_PSEUDO_REGISTER, j,
{
try_swap_copy_prop (loop, reg, j);
});
(&store_copies, FIRST_PSEUDO_REGISTER, j, rsi)
{
try_swap_copy_prop (loop, reg, j);
}
CLEAR_REG_SET (&store_copies);
}
}

View File

@ -523,28 +523,28 @@ void
compute_use_by_pseudos (HARD_REG_SET *to, regset from)
{
unsigned int regno;
reg_set_iterator rsi;
EXECUTE_IF_SET_IN_REG_SET
(from, FIRST_PSEUDO_REGISTER, regno,
{
int r = reg_renumber[regno];
int nregs;
EXECUTE_IF_SET_IN_REG_SET (from, FIRST_PSEUDO_REGISTER, regno, rsi)
{
int r = reg_renumber[regno];
int nregs;
if (r < 0)
{
/* reload_combine uses the information from
BASIC_BLOCK->global_live_at_start, which might still
contain registers that have not actually been allocated
since they have an equivalence. */
gcc_assert (reload_completed);
}
else
{
nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (regno)];
while (nregs-- > 0)
SET_HARD_REG_BIT (*to, r + nregs);
}
});
if (r < 0)
{
/* reload_combine uses the information from
BASIC_BLOCK->global_live_at_start, which might still
contain registers that have not actually been allocated
since they have an equivalence. */
gcc_assert (reload_completed);
}
else
{
nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (regno)];
while (nregs-- > 0)
SET_HARD_REG_BIT (*to, r + nregs);
}
}
}
/* Replace all pseudos found in LOC with their corresponding
@ -1593,6 +1593,7 @@ order_regs_for_reload (struct insn_chain *chain)
int i;
HARD_REG_SET used_by_pseudos;
HARD_REG_SET used_by_pseudos2;
reg_set_iterator rsi;
COPY_HARD_REG_SET (bad_spill_regs, fixed_reg_set);
@ -1613,15 +1614,15 @@ order_regs_for_reload (struct insn_chain *chain)
CLEAR_REG_SET (&pseudos_counted);
EXECUTE_IF_SET_IN_REG_SET
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, i,
{
count_pseudo (i);
});
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, i, rsi)
{
count_pseudo (i);
}
EXECUTE_IF_SET_IN_REG_SET
(&chain->dead_or_set, FIRST_PSEUDO_REGISTER, i,
{
count_pseudo (i);
});
(&chain->dead_or_set, FIRST_PSEUDO_REGISTER, i, rsi)
{
count_pseudo (i);
}
CLEAR_REG_SET (&pseudos_counted);
}
@ -1667,6 +1668,7 @@ find_reg (struct insn_chain *chain, int order)
int k;
HARD_REG_SET not_usable;
HARD_REG_SET used_by_other_reload;
reg_set_iterator rsi;
COPY_HARD_REG_SET (not_usable, bad_spill_regs);
IOR_HARD_REG_SET (not_usable, bad_spill_regs_global);
@ -1735,16 +1737,16 @@ find_reg (struct insn_chain *chain, int order)
rl->regno = best_reg;
EXECUTE_IF_SET_IN_REG_SET
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, j,
{
count_spilled_pseudo (best_reg, rl->nregs, j);
});
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, j, rsi)
{
count_spilled_pseudo (best_reg, rl->nregs, j);
}
EXECUTE_IF_SET_IN_REG_SET
(&chain->dead_or_set, FIRST_PSEUDO_REGISTER, j,
{
count_spilled_pseudo (best_reg, rl->nregs, j);
});
(&chain->dead_or_set, FIRST_PSEUDO_REGISTER, j, rsi)
{
count_spilled_pseudo (best_reg, rl->nregs, j);
}
for (i = 0; i < rl->nregs; i++)
{
@ -3552,6 +3554,7 @@ finish_spills (int global)
struct insn_chain *chain;
int something_changed = 0;
int i;
reg_set_iterator rsi;
/* Build the spill_regs array for the function. */
/* If there are some registers still to eliminate and one of the spill regs
@ -3578,20 +3581,19 @@ finish_spills (int global)
else
spill_reg_order[i] = -1;
EXECUTE_IF_SET_IN_REG_SET
(&spilled_pseudos, FIRST_PSEUDO_REGISTER, i,
{
/* Record the current hard register the pseudo is allocated to in
pseudo_previous_regs so we avoid reallocating it to the same
hard reg in a later pass. */
gcc_assert (reg_renumber[i] >= 0);
EXECUTE_IF_SET_IN_REG_SET (&spilled_pseudos, FIRST_PSEUDO_REGISTER, i, rsi)
{
/* Record the current hard register the pseudo is allocated to in
pseudo_previous_regs so we avoid reallocating it to the same
hard reg in a later pass. */
gcc_assert (reg_renumber[i] >= 0);
SET_HARD_REG_BIT (pseudo_previous_regs[i], reg_renumber[i]);
/* Mark it as no longer having a hard register home. */
reg_renumber[i] = -1;
/* We will need to scan everything again. */
something_changed = 1;
});
SET_HARD_REG_BIT (pseudo_previous_regs[i], reg_renumber[i]);
/* Mark it as no longer having a hard register home. */
reg_renumber[i] = -1;
/* We will need to scan everything again. */
something_changed = 1;
}
/* Retry global register allocation if possible. */
if (global)
@ -3603,17 +3605,17 @@ finish_spills (int global)
for (chain = insns_need_reload; chain; chain = chain->next_need_reload)
{
EXECUTE_IF_SET_IN_REG_SET
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, i,
{
ior_hard_reg_set (pseudo_forbidden_regs + i,
&chain->used_spill_regs);
});
(&chain->live_throughout, FIRST_PSEUDO_REGISTER, i, rsi)
{
ior_hard_reg_set (pseudo_forbidden_regs + i,
&chain->used_spill_regs);
}
EXECUTE_IF_SET_IN_REG_SET
(&chain->dead_or_set, FIRST_PSEUDO_REGISTER, i,
{
ior_hard_reg_set (pseudo_forbidden_regs + i,
&chain->used_spill_regs);
});
(&chain->dead_or_set, FIRST_PSEUDO_REGISTER, i, rsi)
{
ior_hard_reg_set (pseudo_forbidden_regs + i,
&chain->used_spill_regs);
}
}
/* Retry allocating the spilled pseudos. For each reg, merge the

View File

@ -971,6 +971,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
unsigned int j;
unsigned int regno;
rtx start_insn, stop_insn;
reg_set_iterator rsi;
/* Compute hard regs live at start of block -- this is the real hard regs
marked live, plus live pseudo regs that have been renumbered to
@ -978,19 +979,17 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
EXECUTE_IF_SET_IN_REG_SET
(regs_live, FIRST_PSEUDO_REGISTER, i,
{
if (reg_renumber[i] >= 0)
{
regno = reg_renumber[i];
for (j = regno;
j < regno + hard_regno_nregs[regno]
[PSEUDO_REGNO_MODE (i)];
j++)
SET_HARD_REG_BIT (current_live_regs, j);
}
});
EXECUTE_IF_SET_IN_REG_SET (regs_live, FIRST_PSEUDO_REGISTER, i, rsi)
{
if (reg_renumber[i] >= 0)
{
regno = reg_renumber[i];
for (j = regno;
j < regno + hard_regno_nregs[regno][PSEUDO_REGNO_MODE (i)];
j++)
SET_HARD_REG_BIT (current_live_regs, j);
}
}
/* Get starting and ending insn, handling the case where each might
be a SEQUENCE. */

View File

@ -822,6 +822,7 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
RTX_CODE code = GET_CODE (x);
rtx link;
int i;
reg_set_iterator rsi;
if (code == COND_EXEC)
{
@ -895,14 +896,14 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
(*current_sched_info->compute_jump_reg_dependencies)
(insn, &deps->reg_conditional_sets, &tmp_uses, &tmp_sets);
/* Make latency of jump equal to 0 by using anti-dependence. */
EXECUTE_IF_SET_IN_REG_SET (&tmp_uses, 0, i,
EXECUTE_IF_SET_IN_REG_SET (&tmp_uses, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list (insn, reg_last->sets, REG_DEP_ANTI);
add_dependence_list (insn, reg_last->clobbers, REG_DEP_ANTI);
reg_last->uses_length++;
reg_last->uses = alloc_INSN_LIST (insn, reg_last->uses);
});
}
IOR_REG_SET (reg_pending_sets, &tmp_sets);
CLEAR_REG_SET (&tmp_uses);
@ -975,7 +976,7 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
real, so we use anti-dependence here. */
if (GET_CODE (PATTERN (insn)) == COND_EXEC)
{
EXECUTE_IF_SET_IN_REG_SET (&deps->reg_last_in_use, 0, i,
EXECUTE_IF_SET_IN_REG_SET (&deps->reg_last_in_use, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list (insn, reg_last->uses, REG_DEP_ANTI);
@ -985,11 +986,11 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
add_dependence_list
(insn, reg_last->clobbers,
reg_pending_barrier == TRUE_BARRIER ? 0 : REG_DEP_ANTI);
});
}
}
else
{
EXECUTE_IF_SET_IN_REG_SET (&deps->reg_last_in_use, 0, i,
EXECUTE_IF_SET_IN_REG_SET (&deps->reg_last_in_use, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list_and_free (insn, &reg_last->uses,
@ -1002,7 +1003,7 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
reg_pending_barrier == TRUE_BARRIER ? 0 : REG_DEP_ANTI);
reg_last->uses_length = 0;
reg_last->clobbers_length = 0;
});
}
}
for (i = 0; i < deps->max_reg; i++)
@ -1022,23 +1023,23 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
of the lists. */
if (GET_CODE (PATTERN (insn)) == COND_EXEC)
{
EXECUTE_IF_SET_IN_REG_SET (reg_pending_uses, 0, i,
EXECUTE_IF_SET_IN_REG_SET (reg_pending_uses, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list (insn, reg_last->sets, 0);
add_dependence_list (insn, reg_last->clobbers, 0);
reg_last->uses = alloc_INSN_LIST (insn, reg_last->uses);
reg_last->uses_length++;
});
EXECUTE_IF_SET_IN_REG_SET (reg_pending_clobbers, 0, i,
}
EXECUTE_IF_SET_IN_REG_SET (reg_pending_clobbers, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list (insn, reg_last->sets, REG_DEP_OUTPUT);
add_dependence_list (insn, reg_last->uses, REG_DEP_ANTI);
reg_last->clobbers = alloc_INSN_LIST (insn, reg_last->clobbers);
reg_last->clobbers_length++;
});
EXECUTE_IF_SET_IN_REG_SET (reg_pending_sets, 0, i,
}
EXECUTE_IF_SET_IN_REG_SET (reg_pending_sets, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list (insn, reg_last->sets, REG_DEP_OUTPUT);
@ -1046,19 +1047,19 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
add_dependence_list (insn, reg_last->uses, REG_DEP_ANTI);
reg_last->sets = alloc_INSN_LIST (insn, reg_last->sets);
SET_REGNO_REG_SET (&deps->reg_conditional_sets, i);
});
}
}
else
{
EXECUTE_IF_SET_IN_REG_SET (reg_pending_uses, 0, i,
EXECUTE_IF_SET_IN_REG_SET (reg_pending_uses, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list (insn, reg_last->sets, 0);
add_dependence_list (insn, reg_last->clobbers, 0);
reg_last->uses_length++;
reg_last->uses = alloc_INSN_LIST (insn, reg_last->uses);
});
EXECUTE_IF_SET_IN_REG_SET (reg_pending_clobbers, 0, i,
}
EXECUTE_IF_SET_IN_REG_SET (reg_pending_clobbers, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
if (reg_last->uses_length > MAX_PENDING_LIST_LENGTH
@ -1081,8 +1082,8 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
}
reg_last->clobbers_length++;
reg_last->clobbers = alloc_INSN_LIST (insn, reg_last->clobbers);
});
EXECUTE_IF_SET_IN_REG_SET (reg_pending_sets, 0, i,
}
EXECUTE_IF_SET_IN_REG_SET (reg_pending_sets, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
add_dependence_list_and_free (insn, &reg_last->sets,
@ -1095,7 +1096,7 @@ sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
reg_last->uses_length = 0;
reg_last->clobbers_length = 0;
CLEAR_REGNO_REG_SET (&deps->reg_conditional_sets, i);
});
}
}
IOR_REG_SET (&deps->reg_last_in_use, reg_pending_uses);
@ -1461,6 +1462,7 @@ void
free_deps (struct deps *deps)
{
int i;
reg_set_iterator rsi;
free_INSN_LIST_list (&deps->pending_read_insns);
free_EXPR_LIST_list (&deps->pending_read_mems);
@ -1471,7 +1473,7 @@ free_deps (struct deps *deps)
/* Without the EXECUTE_IF_SET, this loop is executed max_reg * nr_regions
times. For a testcase with 42000 regs and 8000 small basic blocks,
this loop accounted for nearly 60% (84 sec) of the total -O2 runtime. */
EXECUTE_IF_SET_IN_REG_SET (&deps->reg_last_in_use, 0, i,
EXECUTE_IF_SET_IN_REG_SET (&deps->reg_last_in_use, 0, i, rsi)
{
struct deps_reg *reg_last = &deps->reg_last[i];
if (reg_last->uses)
@ -1480,7 +1482,7 @@ free_deps (struct deps *deps)
free_INSN_LIST_list (&reg_last->sets);
if (reg_last->clobbers)
free_INSN_LIST_list (&reg_last->clobbers);
});
}
CLEAR_REG_SET (&deps->reg_last_in_use);
CLEAR_REG_SET (&deps->reg_conditional_sets);

View File

@ -1987,6 +1987,7 @@ propagate_deps (int bb, struct deps *pred_deps)
{
struct deps *succ_deps;
int reg;
reg_set_iterator rsi;
/* Only bbs "below" bb, in the same region, are interesting. */
if (e->dest == EXIT_BLOCK_PTR
@ -1997,7 +1998,7 @@ propagate_deps (int bb, struct deps *pred_deps)
succ_deps = bb_deps + BLOCK_TO_BB (e->dest->index);
/* The reg_last lists are inherited by successor. */
EXECUTE_IF_SET_IN_REG_SET (&pred_deps->reg_last_in_use, 0, reg,
EXECUTE_IF_SET_IN_REG_SET (&pred_deps->reg_last_in_use, 0, reg, rsi)
{
struct deps_reg *pred_rl = &pred_deps->reg_last[reg];
struct deps_reg *succ_rl = &succ_deps->reg_last[reg];
@ -2008,7 +2009,7 @@ propagate_deps (int bb, struct deps *pred_deps)
succ_rl->clobbers);
succ_rl->uses_length += pred_rl->uses_length;
succ_rl->clobbers_length += pred_rl->clobbers_length;
});
}
IOR_REG_SET (&succ_deps->reg_last_in_use, &pred_deps->reg_last_in_use);
/* Mem read/write lists are inherited by successor. */