+2010-01-03 Steven Bosscher <steven@gcc.gnu.org>
+
+ * postreload-gcse.c (insert_expr_in_table): Replace BLOCK_NUM
+ with BLOCK_FOR_INSN.
+ * auto-inc-dec.c (attempt_change, get_next_ref, find_inc): Likewise.
+ * ifcvt.c (noce_get_alt_condition, noce_try_abs,
+ noce_process_if_block): Likewise.
+ * gcse.c (compute_local_properties, insert_expr_in_table,
+ insert_set_in_table, canon_list_insert, find_avail_set,
+ pre_insert_copy_insn): Likewise.
+
+ * basic-block.h (BLOCK_NUM): Move from here...
+ * sched-int.h (BLOCK_NUM): ... to here to localize it in the scheduler.
+
2010-01-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42438
passes are for. The two cases where we have an inc insn will be
handled mov free. */
- basic_block bb = BASIC_BLOCK (BLOCK_NUM (mem_insn.insn));
+ basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
rtx mov_insn = NULL;
int regno;
rtx mem = *mem_insn.mem_loc;
rtx insn = next_array[regno];
/* Lazy about cleaning out the next_arrays. */
- if (insn && BASIC_BLOCK (BLOCK_NUM (insn)) != bb)
+ if (insn && BLOCK_FOR_INSN (insn) != bb)
{
next_array[regno] = NULL;
insn = NULL;
find_inc (bool first_try)
{
rtx insn;
- basic_block bb = BASIC_BLOCK (BLOCK_NUM (mem_insn.insn));
+ basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
rtx other_insn;
df_ref *def_rec;
/* Find the next use that is an inc. */
insn = get_next_ref (REGNO (mem_insn.reg0),
- BASIC_BLOCK (BLOCK_NUM (mem_insn.insn)),
+ BLOCK_FOR_INSN (mem_insn.insn),
reg_next_inc_use);
if (!insn)
return false;
/* Make sure that there is no insn that assigns to inc_insn.res
between the mem_insn and the inc_insn. */
rtx other_insn = get_next_ref (REGNO (inc_insn.reg_res),
- BASIC_BLOCK (BLOCK_NUM (mem_insn.insn)),
+ BLOCK_FOR_INSN (mem_insn.insn),
reg_next_def);
if (other_insn != inc_insn.insn)
{
}
other_insn = get_next_ref (REGNO (inc_insn.reg_res),
- BASIC_BLOCK (BLOCK_NUM (mem_insn.insn)),
+ BLOCK_FOR_INSN (mem_insn.insn),
reg_next_use);
if (other_insn
&& (other_insn != inc_insn.insn)
/* The two blocks that are always in the cfg. */
#define NUM_FIXED_BLOCKS (2)
-
-#define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0)
#define set_block_for_insn(INSN, BB) (BLOCK_FOR_INSN (INSN) = BB)
extern void compute_bb_for_insn (void);
if (antloc)
for (occr = expr->antic_occr; occr != NULL; occr = occr->next)
{
- SET_BIT (antloc[BLOCK_NUM (occr->insn)], indx);
+ SET_BIT (antloc[BLOCK_FOR_INSN (occr->insn)->index], indx);
/* While we're scanning the table, this is a good place to
initialize this. */
if (comp)
for (occr = expr->avail_occr; occr != NULL; occr = occr->next)
{
- SET_BIT (comp[BLOCK_NUM (occr->insn)], indx);
+ SET_BIT (comp[BLOCK_FOR_INSN (occr->insn)->index], indx);
/* While we're scanning the table, this is a good place to
initialize this. */
{
antic_occr = cur_expr->antic_occr;
- if (antic_occr && BLOCK_NUM (antic_occr->insn) != BLOCK_NUM (insn))
+ if (antic_occr
+ && BLOCK_FOR_INSN (antic_occr->insn) != BLOCK_FOR_INSN (insn))
antic_occr = NULL;
if (antic_occr)
{
avail_occr = cur_expr->avail_occr;
- if (avail_occr && BLOCK_NUM (avail_occr->insn) == BLOCK_NUM (insn))
+ if (avail_occr
+ && BLOCK_FOR_INSN (avail_occr->insn) == BLOCK_FOR_INSN (insn))
{
/* Found another instance of the expression in the same basic block.
Prefer this occurrence to the currently recorded one. We want
/* Now record the occurrence. */
cur_occr = cur_expr->avail_occr;
- if (cur_occr && BLOCK_NUM (cur_occr->insn) == BLOCK_NUM (insn))
+ if (cur_occr
+ && BLOCK_FOR_INSN (cur_occr->insn) == BLOCK_FOR_INSN (insn))
{
/* Found another instance of the expression in the same basic block.
Prefer this occurrence to the currently recorded one. We want
dest_addr = get_addr (XEXP (dest, 0));
dest_addr = canon_rtx (dest_addr);
insn = (rtx) v_insn;
- bb = BLOCK_NUM (insn);
+ bb = BLOCK_FOR_INSN (insn)->index;
canon_modify_mem_list[bb] =
alloc_EXPR_LIST (VOIDmode, dest_addr, canon_modify_mem_list[bb]);
static void
record_last_mem_set_info (rtx insn)
{
- int bb = BLOCK_NUM (insn);
+ int bb = BLOCK_FOR_INSN (insn)->index;
/* load_killed_in_block_p will handle the case of calls clobbering
everything. */
which contains INSN. */
while (set)
{
- if (TEST_BIT (cprop_avin[BLOCK_NUM (insn)], set->bitmap_index))
+ if (TEST_BIT (cprop_avin[BLOCK_FOR_INSN (insn)->index],
+ set->bitmap_index))
break;
set = next_set (regno, set);
}
if (dump_file)
fprintf (dump_file,
"PRE: bb %d, insn %d, copy expression %d in insn %d to reg %d\n",
- BLOCK_NUM (insn), INSN_UID (new_insn), indx,
+ BLOCK_FOR_INSN (insn)->index, INSN_UID (new_insn), indx,
INSN_UID (insn), regno);
}
/* First, look to see if we put a constant in a register. */
prev_insn = prev_nonnote_insn (if_info->cond_earliest);
if (prev_insn
- && BLOCK_NUM (prev_insn) == BLOCK_NUM (if_info->cond_earliest)
+ && BLOCK_FOR_INSN (prev_insn)
+ == BLOCK_FOR_INSN (if_info->cond_earliest)
&& INSN_P (prev_insn)
&& GET_CODE (PATTERN (prev_insn)) == SET)
{
{
rtx set, insn = prev_nonnote_insn (earliest);
if (insn
- && BLOCK_NUM (insn) == BLOCK_NUM (earliest)
+ && BLOCK_FOR_INSN (insn) == BLOCK_FOR_INSN (earliest)
&& (set = single_set (insn))
&& rtx_equal_p (SET_DEST (set), c))
{
COND_EARLIEST to JUMP. Make sure the relevant data is still
intact. */
if (! insn_b
- || BLOCK_NUM (insn_b) != BLOCK_NUM (if_info->cond_earliest)
+ || BLOCK_FOR_INSN (insn_b) != BLOCK_FOR_INSN (if_info->cond_earliest)
|| !NONJUMP_INSN_P (insn_b)
|| (set_b = single_set (insn_b)) == NULL_RTX
|| ! rtx_equal_p (x, SET_DEST (set_b))
/* Search for another occurrence in the same basic block. */
avail_occr = cur_expr->avail_occr;
- while (avail_occr && BLOCK_NUM (avail_occr->insn) != BLOCK_NUM (insn))
+ while (avail_occr
+ && BLOCK_FOR_INSN (avail_occr->insn) != BLOCK_FOR_INSN (insn))
{
/* If an occurrence isn't found, save a pointer to the end of
the list. */
extern int *block_to_bb;
extern int *containing_rgn;
+/* Often used short-hand in the scheduler. The rest of the compiler uses
+ BLOCK_FOR_INSN(INSN) and an indirect reference to get the basic block
+ number ("index"). For historical reasons, the scheduler does not. */
+#define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0)
+
#define RGN_NR_BLOCKS(rgn) (rgn_table[rgn].rgn_nr_blocks)
#define RGN_BLOCKS(rgn) (rgn_table[rgn].rgn_blocks)
#define RGN_DONT_CALC_DEPS(rgn) (rgn_table[rgn].dont_calc_deps)