aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2001-04-09 15:17:08 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2001-04-09 15:17:08 +0000
commitccbaf064ff496fbf0ace8bf2b38a3047b4ad497b (patch)
treefeaa93448a535cf85103922cb480ccacbcbb26ee
parenta13d4ebfc3445a9a349b8ee4cf39b712a96e0a93 (diff)
downloadgcc-ccbaf064ff496fbf0ace8bf2b38a3047b4ad497b.zip
gcc-ccbaf064ff496fbf0ace8bf2b38a3047b4ad497b.tar.gz
gcc-ccbaf064ff496fbf0ace8bf2b38a3047b4ad497b.tar.bz2
basic-block.h (set_new_block_for_insns): New Prototype.
2001-04-09 Andrew MacLeod <amacleod@redhat.com> * basic-block.h (set_new_block_for_insns): New Prototype. (set_block_num): Delete prototype. * flow.c (set_block_num): Remove obsolete function. (set_block_for_new_insns): Set BB for single or multiple insns. * gcse.c (handle_avail_expr): Use set_block_for_new_insns. (process_insn_end_bb): Use set_block_for_new_insns or set_block_for_insn instead of set_block_num. (pre_insert_copy_insn): Use set_block_for_new_insns. (update_ld_motion_stores): Use set_block_for_new_insns. (insert_insn_start_bb): Use set_block_for_new_insns. (replace_store_insn): Use set_block_for_new_insns. From-SVN: r41208
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/basic-block.h2
-rw-r--r--gcc/flow.c33
-rw-r--r--gcc/gcse.c19
4 files changed, 51 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 88d17f1..4478e29 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,18 @@
2001-04-09 Andrew MacLeod <amacleod@redhat.com>
+
+ * basic-block.h (set_new_block_for_insns): New Prototype.
+ (set_block_num): Delete prototype.
+ * flow.c (set_block_num): Remove obsolete function.
+ (set_block_for_new_insns): Set BB for single or multiple insns.
+ * gcse.c (handle_avail_expr): Use set_block_for_new_insns.
+ (process_insn_end_bb): Use set_block_for_new_insns or
+ set_block_for_insn instead of set_block_num.
+ (pre_insert_copy_insn): Use set_block_for_new_insns.
+ (update_ld_motion_stores): Use set_block_for_new_insns.
+ (insert_insn_start_bb): Use set_block_for_new_insns.
+ (replace_store_insn): Use set_block_for_new_insns.
+
+2001-04-09 Andrew MacLeod <amacleod@redhat.com>
Jeff Law <law@redhat.com>
* alias.c (get_addr): Externalize.
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 58f6aa1..f3911c8 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -236,7 +236,7 @@ extern varray_type basic_block_for_insn;
extern void compute_bb_for_insn PARAMS ((int));
extern void update_bb_for_insn PARAMS ((basic_block));
extern void set_block_for_insn PARAMS ((rtx, basic_block));
-extern void set_block_num PARAMS ((rtx, int));
+extern void set_block_for_new_insns PARAMS ((rtx, basic_block));
extern void free_basic_block_vars PARAMS ((int));
diff --git a/gcc/flow.c b/gcc/flow.c
index 607ecb6..7736d85 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -6697,15 +6697,38 @@ set_block_for_insn (insn, bb)
VARRAY_BB (basic_block_for_insn, uid) = bb;
}
-/* Record INSN's block number as BB. */
-/* ??? This has got to go. */
+/* When a new insn has been inserted into an existing block, it will
+ sometimes emit more than a single insn. This routine will set the
+ block number for the specified insn, and look backwards in the insn
+ chain to see if there are any other uninitialized insns immediately
+ previous to this one, and set the block number for them too. */
void
-set_block_num (insn, bb)
+set_block_for_new_insns (insn, bb)
rtx insn;
- int bb;
+ basic_block bb;
{
- set_block_for_insn (insn, BASIC_BLOCK (bb));
+ set_block_for_insn (insn, bb);
+
+ /* We dont scan to set the block to 0 since this is the default value.
+ If we did, we'd end up scanning/setting the entire prologue block
+ everytime we insert an insn into it. */
+ if (bb->index == 0)
+ return;
+
+ /* Scan the previous instructions setting the block number until we find
+ an instruction that has the block number set, or we find a note
+ of any kind. */
+ for (insn = PREV_INSN (insn); insn != NULL_RTX; insn = PREV_INSN (insn))
+ {
+ if (GET_CODE (insn) == NOTE)
+ break;
+ if ((size_t)INSN_UID (insn) >= basic_block_for_insn->num_elements
+ || BLOCK_NUM (insn) == 0)
+ set_block_for_insn (insn, bb);
+ else
+ break;
+ }
}
/* Verify the CFG consistency. This function check some CFG invariants and
diff --git a/gcc/gcse.c b/gcc/gcse.c
index f8dc557..4c96cf9 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -3549,7 +3549,7 @@ handle_avail_expr (insn, expr)
insn_computes_expr);
/* Keep block number table up to date. */
- set_block_num (new_insn, BLOCK_NUM (insn_computes_expr));
+ set_block_for_new_insns (new_insn, BLOCK_FOR_INSN (insn_computes_expr));
/* Keep register set table up to date. */
record_one_set (REGNO (to), new_insn);
@@ -4808,7 +4808,7 @@ insert_insn_end_bb (expr, bb, pre)
{
rtx insn = XVECEXP (pat, 0, i);
- set_block_num (insn, bb);
+ set_block_for_insn (insn, BASIC_BLOCK (bb));
if (INSN_P (insn))
add_label_notes (PATTERN (insn), new_insn);
@@ -4818,7 +4818,7 @@ insert_insn_end_bb (expr, bb, pre)
else
{
add_label_notes (SET_SRC (pat), new_insn);
- set_block_num (new_insn, bb);
+ set_block_for_new_insns (new_insn, BASIC_BLOCK (bb));
/* Keep register set table up to date. */
record_one_set (regno, new_insn);
@@ -4942,7 +4942,7 @@ pre_insert_copy_insn (expr, insn)
insn);
/* Keep block number table up to date. */
- set_block_num (new_insn, bb);
+ set_block_for_new_insns (new_insn, BASIC_BLOCK (bb));
/* Keep register set table up to date. */
record_one_set (regno, new_insn);
@@ -6367,7 +6367,7 @@ update_ld_motion_stores (expr)
copy = gen_move_insn ( reg, SET_SRC (pat));
i = emit_insn_before (copy, insn);
record_one_set (REGNO (reg), i);
- set_block_num (i, BLOCK_NUM (insn));
+ set_block_for_new_insns (i, BLOCK_FOR_INSN (insn));
SET_SRC (pat) = reg;
/* un-recognize this pattern since it's probably different now. */
@@ -6877,11 +6877,8 @@ insert_insn_start_bb (insn, bb)
if (prev == BLOCK_END (bb))
BLOCK_END (bb) = insn;
- while (insn != prev)
- {
- set_block_num (insn, bb);
- insn = PREV_INSN (insn);
- }
+
+ set_block_for_new_insns (insn, BASIC_BLOCK (bb));
if (gcse_file)
{
@@ -6971,7 +6968,7 @@ replace_store_insn (reg, del, bb)
insn = gen_move_insn (reg, SET_SRC (PATTERN (del)));
insn = emit_insn_after (insn, del);
- set_block_num (insn, bb);
+ set_block_for_new_insns (insn, BASIC_BLOCK (bb));
if (gcse_file)
{