Commit b0de17ef by Steven Bosscher

postreload-gcse.c (insert_expr_in_table): Replace BLOCK_NUM with BLOCK_FOR_INSN.

	* 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.

From-SVN: r155586
parent a8685e15
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> 2010-01-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42438 PR tree-optimization/42438
......
...@@ -470,7 +470,7 @@ attempt_change (rtx new_addr, rtx inc_reg) ...@@ -470,7 +470,7 @@ attempt_change (rtx new_addr, rtx inc_reg)
passes are for. The two cases where we have an inc insn will be passes are for. The two cases where we have an inc insn will be
handled mov free. */ 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; rtx mov_insn = NULL;
int regno; int regno;
rtx mem = *mem_insn.mem_loc; rtx mem = *mem_insn.mem_loc;
...@@ -746,7 +746,7 @@ get_next_ref (int regno, basic_block bb, rtx *next_array) ...@@ -746,7 +746,7 @@ get_next_ref (int regno, basic_block bb, rtx *next_array)
rtx insn = next_array[regno]; rtx insn = next_array[regno];
/* Lazy about cleaning out the next_arrays. */ /* 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; next_array[regno] = NULL;
insn = NULL; insn = NULL;
...@@ -969,7 +969,7 @@ static bool ...@@ -969,7 +969,7 @@ static bool
find_inc (bool first_try) find_inc (bool first_try)
{ {
rtx insn; rtx insn;
basic_block bb = BASIC_BLOCK (BLOCK_NUM (mem_insn.insn)); basic_block bb = BLOCK_FOR_INSN (mem_insn.insn);
rtx other_insn; rtx other_insn;
df_ref *def_rec; df_ref *def_rec;
...@@ -986,7 +986,7 @@ find_inc (bool first_try) ...@@ -986,7 +986,7 @@ find_inc (bool first_try)
/* Find the next use that is an inc. */ /* Find the next use that is an inc. */
insn = get_next_ref (REGNO (mem_insn.reg0), 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); reg_next_inc_use);
if (!insn) if (!insn)
return false; return false;
...@@ -1042,7 +1042,7 @@ find_inc (bool first_try) ...@@ -1042,7 +1042,7 @@ find_inc (bool first_try)
/* Make sure that there is no insn that assigns to inc_insn.res /* Make sure that there is no insn that assigns to inc_insn.res
between the mem_insn and the inc_insn. */ between the mem_insn and the inc_insn. */
rtx other_insn = get_next_ref (REGNO (inc_insn.reg_res), 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); reg_next_def);
if (other_insn != inc_insn.insn) if (other_insn != inc_insn.insn)
{ {
...@@ -1053,7 +1053,7 @@ find_inc (bool first_try) ...@@ -1053,7 +1053,7 @@ find_inc (bool first_try)
} }
other_insn = get_next_ref (REGNO (inc_insn.reg_res), 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); reg_next_use);
if (other_insn if (other_insn
&& (other_insn != inc_insn.insn) && (other_insn != inc_insn.insn)
......
...@@ -499,8 +499,6 @@ extern bitmap_obstack reg_obstack; ...@@ -499,8 +499,6 @@ extern bitmap_obstack reg_obstack;
/* The two blocks that are always in the cfg. */ /* The two blocks that are always in the cfg. */
#define NUM_FIXED_BLOCKS (2) #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) #define set_block_for_insn(INSN, BB) (BLOCK_FOR_INSN (INSN) = BB)
extern void compute_bb_for_insn (void); extern void compute_bb_for_insn (void);
......
...@@ -730,7 +730,7 @@ compute_local_properties (sbitmap *transp, sbitmap *comp, sbitmap *antloc, ...@@ -730,7 +730,7 @@ compute_local_properties (sbitmap *transp, sbitmap *comp, sbitmap *antloc,
if (antloc) if (antloc)
for (occr = expr->antic_occr; occr != NULL; occr = occr->next) 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 /* While we're scanning the table, this is a good place to
initialize this. */ initialize this. */
...@@ -742,7 +742,7 @@ compute_local_properties (sbitmap *transp, sbitmap *comp, sbitmap *antloc, ...@@ -742,7 +742,7 @@ compute_local_properties (sbitmap *transp, sbitmap *comp, sbitmap *antloc,
if (comp) if (comp)
for (occr = expr->avail_occr; occr != NULL; occr = occr->next) 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 /* While we're scanning the table, this is a good place to
initialize this. */ initialize this. */
...@@ -1162,7 +1162,8 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, ...@@ -1162,7 +1162,8 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p,
{ {
antic_occr = cur_expr->antic_occr; 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; antic_occr = NULL;
if (antic_occr) if (antic_occr)
...@@ -1186,7 +1187,8 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p, ...@@ -1186,7 +1187,8 @@ insert_expr_in_table (rtx x, enum machine_mode mode, rtx insn, int antic_p,
{ {
avail_occr = cur_expr->avail_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. /* Found another instance of the expression in the same basic block.
Prefer this occurrence to the currently recorded one. We want Prefer this occurrence to the currently recorded one. We want
...@@ -1259,7 +1261,8 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table_d *table) ...@@ -1259,7 +1261,8 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table_d *table)
/* Now record the occurrence. */ /* Now record the occurrence. */
cur_occr = cur_expr->avail_occr; 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. /* Found another instance of the expression in the same basic block.
Prefer this occurrence to the currently recorded one. We want Prefer this occurrence to the currently recorded one. We want
...@@ -1592,7 +1595,7 @@ canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx unused1 ATTRIBUTE_UNUSED ...@@ -1592,7 +1595,7 @@ canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx unused1 ATTRIBUTE_UNUSED
dest_addr = get_addr (XEXP (dest, 0)); dest_addr = get_addr (XEXP (dest, 0));
dest_addr = canon_rtx (dest_addr); dest_addr = canon_rtx (dest_addr);
insn = (rtx) v_insn; insn = (rtx) v_insn;
bb = BLOCK_NUM (insn); bb = BLOCK_FOR_INSN (insn)->index;
canon_modify_mem_list[bb] = canon_modify_mem_list[bb] =
alloc_EXPR_LIST (VOIDmode, dest_addr, canon_modify_mem_list[bb]); alloc_EXPR_LIST (VOIDmode, dest_addr, canon_modify_mem_list[bb]);
...@@ -1607,7 +1610,7 @@ canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx unused1 ATTRIBUTE_UNUSED ...@@ -1607,7 +1610,7 @@ canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx unused1 ATTRIBUTE_UNUSED
static void static void
record_last_mem_set_info (rtx insn) 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 /* load_killed_in_block_p will handle the case of calls clobbering
everything. */ everything. */
...@@ -2335,7 +2338,8 @@ find_avail_set (int regno, rtx insn) ...@@ -2335,7 +2338,8 @@ find_avail_set (int regno, rtx insn)
which contains INSN. */ which contains INSN. */
while (set) 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; break;
set = next_set (regno, set); set = next_set (regno, set);
} }
...@@ -3728,7 +3732,7 @@ pre_insert_copy_insn (struct expr *expr, rtx insn) ...@@ -3728,7 +3732,7 @@ pre_insert_copy_insn (struct expr *expr, rtx insn)
if (dump_file) if (dump_file)
fprintf (dump_file, fprintf (dump_file,
"PRE: bb %d, insn %d, copy expression %d in insn %d to reg %d\n", "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); INSN_UID (insn), regno);
} }
......
...@@ -1553,7 +1553,8 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target, ...@@ -1553,7 +1553,8 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
/* First, look to see if we put a constant in a register. */ /* First, look to see if we put a constant in a register. */
prev_insn = prev_nonnote_insn (if_info->cond_earliest); prev_insn = prev_nonnote_insn (if_info->cond_earliest);
if (prev_insn 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) && INSN_P (prev_insn)
&& GET_CODE (PATTERN (prev_insn)) == SET) && GET_CODE (PATTERN (prev_insn)) == SET)
{ {
...@@ -1810,7 +1811,7 @@ noce_try_abs (struct noce_if_info *if_info) ...@@ -1810,7 +1811,7 @@ noce_try_abs (struct noce_if_info *if_info)
{ {
rtx set, insn = prev_nonnote_insn (earliest); rtx set, insn = prev_nonnote_insn (earliest);
if (insn if (insn
&& BLOCK_NUM (insn) == BLOCK_NUM (earliest) && BLOCK_FOR_INSN (insn) == BLOCK_FOR_INSN (earliest)
&& (set = single_set (insn)) && (set = single_set (insn))
&& rtx_equal_p (SET_DEST (set), c)) && rtx_equal_p (SET_DEST (set), c))
{ {
...@@ -2291,7 +2292,7 @@ noce_process_if_block (struct noce_if_info *if_info) ...@@ -2291,7 +2292,7 @@ noce_process_if_block (struct noce_if_info *if_info)
COND_EARLIEST to JUMP. Make sure the relevant data is still COND_EARLIEST to JUMP. Make sure the relevant data is still
intact. */ intact. */
if (! insn_b 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) || !NONJUMP_INSN_P (insn_b)
|| (set_b = single_set (insn_b)) == NULL_RTX || (set_b = single_set (insn_b)) == NULL_RTX
|| ! rtx_equal_p (x, SET_DEST (set_b)) || ! rtx_equal_p (x, SET_DEST (set_b))
......
...@@ -363,7 +363,8 @@ insert_expr_in_table (rtx x, rtx insn) ...@@ -363,7 +363,8 @@ insert_expr_in_table (rtx x, rtx insn)
/* Search for another occurrence in the same basic block. */ /* Search for another occurrence in the same basic block. */
avail_occr = cur_expr->avail_occr; 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 /* If an occurrence isn't found, save a pointer to the end of
the list. */ the list. */
......
...@@ -1296,6 +1296,11 @@ extern int *rgn_bb_table; ...@@ -1296,6 +1296,11 @@ extern int *rgn_bb_table;
extern int *block_to_bb; extern int *block_to_bb;
extern int *containing_rgn; 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_NR_BLOCKS(rgn) (rgn_table[rgn].rgn_nr_blocks)
#define RGN_BLOCKS(rgn) (rgn_table[rgn].rgn_blocks) #define RGN_BLOCKS(rgn) (rgn_table[rgn].rgn_blocks)
#define RGN_DONT_CALC_DEPS(rgn) (rgn_table[rgn].dont_calc_deps) #define RGN_DONT_CALC_DEPS(rgn) (rgn_table[rgn].dont_calc_deps)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment