summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-03 13:13:03 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-03 13:13:03 +0000
commit90bd219d592763880997f95fe5f2243d4b7b3570 (patch)
tree637750849d7de92afc2bfea49d5fe684aeb3e776 /gcc
parent951311d4f27cabdda81edf28000d4b4d33588703 (diff)
downloadgcc-90bd219d592763880997f95fe5f2243d4b7b3570.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155586 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/auto-inc-dec.c12
-rw-r--r--gcc/basic-block.h2
-rw-r--r--gcc/gcse.c22
-rw-r--r--gcc/ifcvt.c7
-rw-r--r--gcc/postreload-gcse.c3
-rw-r--r--gcc/sched-int.h5
7 files changed, 44 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8065b245164..01769cc1c8a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+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
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 830fc5e09f0..7d48f4227c1 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -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
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;
@@ -746,7 +746,7 @@ get_next_ref (int regno, basic_block bb, rtx *next_array)
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;
@@ -969,7 +969,7 @@ static bool
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;
@@ -986,7 +986,7 @@ find_inc (bool first_try)
/* 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;
@@ -1042,7 +1042,7 @@ find_inc (bool first_try)
/* 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)
{
@@ -1053,7 +1053,7 @@ find_inc (bool first_try)
}
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)
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 3d9b6727cf9..89156114036 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -499,8 +499,6 @@ extern bitmap_obstack reg_obstack;
/* 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);
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 8be10cdbb3a..77ac28e58d1 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -730,7 +730,7 @@ compute_local_properties (sbitmap *transp, sbitmap *comp, sbitmap *antloc,
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. */
@@ -742,7 +742,7 @@ compute_local_properties (sbitmap *transp, sbitmap *comp, sbitmap *antloc,
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. */
@@ -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;
- 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)
@@ -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;
- 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
@@ -1259,7 +1261,8 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table_d *table)
/* 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
@@ -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 = 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]);
@@ -1607,7 +1610,7 @@ canon_list_insert (rtx dest ATTRIBUTE_UNUSED, const_rtx unused1 ATTRIBUTE_UNUSED
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. */
@@ -2335,7 +2338,8 @@ find_avail_set (int regno, rtx insn)
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);
}
@@ -3728,7 +3732,7 @@ pre_insert_copy_insn (struct expr *expr, rtx insn)
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);
}
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 348c0cca8bf..9efd27d999f 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -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. */
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)
{
@@ -1810,7 +1811,7 @@ noce_try_abs (struct noce_if_info *if_info)
{
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))
{
@@ -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
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))
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index d7c8878c496..dcd95eb71f8 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -363,7 +363,8 @@ insert_expr_in_table (rtx x, rtx insn)
/* 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. */
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 0d3a855690e..c3b463e76a1 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -1296,6 +1296,11 @@ extern int *rgn_bb_table;
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)