diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-17 02:31:56 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-17 02:31:56 +0000 |
commit | b3d6de8978fd2208885e98b19a91c9d29c170af5 (patch) | |
tree | 94c8895c6dde3b282518d4c9951067cd0ac517fd /gcc/flow.c | |
parent | 5e7d465f337d9d419b2528ad819390067caeca95 (diff) | |
download | gcc-b3d6de8978fd2208885e98b19a91c9d29c170af5.tar.gz |
Revert "Basic block renumbering removal", and two followup patches.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53537 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/flow.c')
-rw-r--r-- | gcc/flow.c | 97 |
1 files changed, 54 insertions, 43 deletions
diff --git a/gcc/flow.c b/gcc/flow.c index c78877d23ce..8a9a9db1a45 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -575,7 +575,7 @@ verify_local_live_at_start (new_live_at_start, bb) { fprintf (rtl_dump_file, "live_at_start mismatch in bb %d, aborting\nNew:\n", - bb->sindex); + bb->index); debug_bitmap_file (rtl_dump_file, new_live_at_start); fputs ("Old:\n", rtl_dump_file); dump_bb (bb, rtl_dump_file); @@ -656,7 +656,6 @@ update_life_info (blocks, extent, prop_flags) for ( ; ; ) { int changed = 0; - basic_block bb; calculate_global_regs_live (blocks, blocks, prop_flags & (PROP_SCAN_DEAD_CODE @@ -668,8 +667,9 @@ update_life_info (blocks, extent, prop_flags) /* Removing dead code may allow the CFG to be simplified which in turn may allow for further dead code detection / removal. */ - FOR_ALL_BB_REVERSE (bb) + for (i = n_basic_blocks - 1; i >= 0; --i) { + basic_block bb = BASIC_BLOCK (i); COPY_REG_SET (tmp, bb->global_live_at_end); changed |= propagate_block (bb, tmp, NULL, NULL, @@ -718,10 +718,10 @@ update_life_info (blocks, extent, prop_flags) } else { - basic_block bb; - - FOR_ALL_BB_REVERSE (bb) + for (i = n_basic_blocks - 1; i >= 0; --i) { + basic_block bb = BASIC_BLOCK (i); + COPY_REG_SET (tmp, bb->global_live_at_end); propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags); @@ -775,16 +775,16 @@ update_life_info_in_dirty_blocks (extent, prop_flags) enum update_life_extent extent; int prop_flags; { - sbitmap update_life_blocks = sbitmap_alloc (last_basic_block); + sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks); + int block_num; int n = 0; - basic_block bb; int retval = 0; sbitmap_zero (update_life_blocks); - FOR_ALL_BB (bb) - if (bb->flags & BB_DIRTY) + for (block_num = 0; block_num < n_basic_blocks; block_num++) + if (BASIC_BLOCK (block_num)->flags & BB_DIRTY) { - SET_BIT (update_life_blocks, bb->sindex); + SET_BIT (update_life_blocks, block_num); n++; } @@ -810,8 +810,7 @@ free_basic_block_vars (keep_head_end_p) clear_edges (); VARRAY_FREE (basic_block_info); } - num_basic_blocks = 0; - last_basic_block = 0; + n_basic_blocks = 0; ENTRY_BLOCK_PTR->aux = NULL; ENTRY_BLOCK_PTR->global_live_at_end = NULL; @@ -826,12 +825,14 @@ int delete_noop_moves (f) rtx f ATTRIBUTE_UNUSED; { + int i; rtx insn, next; basic_block bb; int nnoops = 0; - FOR_ALL_BB (bb) + for (i = 0; i < n_basic_blocks; i++) { + bb = BASIC_BLOCK (i); for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = next) { next = NEXT_INSN (insn); @@ -1078,7 +1079,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) sbitmap blocks_in, blocks_out; int flags; { - basic_block *queue, *qhead, *qtail, *qend, bb; + basic_block *queue, *qhead, *qtail, *qend; regset tmp, new_live_at_end, call_used; regset_head tmp_head, call_used_head; regset_head new_live_at_end_head; @@ -1087,8 +1088,10 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) /* Some passes used to forget clear aux field of basic block causing sick behaviour here. */ #ifdef ENABLE_CHECKING - FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) - if (bb->aux) + if (ENTRY_BLOCK_PTR->aux || EXIT_BLOCK_PTR->aux) + abort (); + for (i = 0; i < n_basic_blocks; i++) + if (BASIC_BLOCK (i)->aux) abort (); #endif @@ -1104,28 +1107,31 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) /* Create a worklist. Allocate an extra slot for ENTRY_BLOCK, and one because the `head == tail' style test for an empty queue doesn't work with a full queue. */ - queue = (basic_block *) xmalloc ((num_basic_blocks + 2) * sizeof (*queue)); + queue = (basic_block *) xmalloc ((n_basic_blocks + 2) * sizeof (*queue)); qtail = queue; - qhead = qend = queue + num_basic_blocks + 2; + qhead = qend = queue + n_basic_blocks + 2; /* Queue the blocks set in the initial mask. Do this in reverse block number order so that we are more likely for the first round to do useful work. We use AUX non-null to flag that the block is queued. */ if (blocks_in) { - FOR_ALL_BB (bb) - if (TEST_BIT (blocks_in, bb->sindex)) - { - *--qhead = bb; - bb->aux = bb; - } - else - bb->aux = NULL; + /* Clear out the garbage that might be hanging out in bb->aux. */ + for (i = n_basic_blocks - 1; i >= 0; --i) + BASIC_BLOCK (i)->aux = NULL; + + EXECUTE_IF_SET_IN_SBITMAP (blocks_in, 0, i, + { + basic_block bb = BASIC_BLOCK (i); + *--qhead = bb; + bb->aux = bb; + }); } else { - FOR_ALL_BB (bb) + for (i = 0; i < n_basic_blocks; ++i) { + basic_block bb = BASIC_BLOCK (i); *--qhead = bb; bb->aux = bb; } @@ -1301,7 +1307,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) /* Let our caller know that BB changed enough to require its death notes updated. */ if (blocks_out) - SET_BIT (blocks_out, bb->sindex); + SET_BIT (blocks_out, bb->index); if (! rescan) { @@ -1357,15 +1363,16 @@ calculate_global_regs_live (blocks_in, blocks_out, flags) { EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i, { - bb = BASIC_BLOCK (i); + basic_block bb = BASIC_BLOCK (i); FREE_REG_SET (bb->local_set); FREE_REG_SET (bb->cond_local_set); }); } else { - FOR_ALL_BB (bb) + for (i = n_basic_blocks - 1; i >= 0; --i) { + basic_block bb = BASIC_BLOCK (i); FREE_REG_SET (bb->local_set); FREE_REG_SET (bb->cond_local_set); } @@ -1491,10 +1498,12 @@ initialize_uninitialized_subregs () void allocate_bb_life_data () { - basic_block bb; + int i; - FOR_ALL_BB (bb) + for (i = 0; i < n_basic_blocks; i++) { + basic_block bb = BASIC_BLOCK (i); + bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); } @@ -2333,14 +2342,14 @@ int regno_uninitialized (regno) unsigned int regno; { - if (num_basic_blocks == 0 + if (n_basic_blocks == 0 || (regno < FIRST_PSEUDO_REGISTER && (global_regs[regno] || fixed_regs[regno] || FUNCTION_ARG_REGNO_P (regno)))) return 0; - return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno); + return REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno); } /* 1 if register REGNO was alive at a place where `setjmp' was called @@ -2351,11 +2360,11 @@ int regno_clobbered_at_setjmp (regno) int regno; { - if (num_basic_blocks == 0) + if (n_basic_blocks == 0) return 0; return ((REG_N_SETS (regno) > 1 - || REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno)) + || REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno)) && REGNO_REG_SET_P (regs_live_at_setjmp, regno)); } @@ -2710,7 +2719,7 @@ mark_set_1 (pbi, code, reg, cond, insn, flags) | PROP_DEATH_NOTES | PROP_AUTOINC)) { rtx y; - int blocknum = pbi->bb->sindex; + int blocknum = pbi->bb->index; y = NULL_RTX; if (flags & (PROP_LOG_LINKS | PROP_AUTOINC)) @@ -3567,7 +3576,7 @@ mark_used_reg (pbi, reg, cond, insn) { /* Keep track of which basic block each reg appears in. */ - int blocknum = pbi->bb->sindex; + int blocknum = pbi->bb->index; if (REG_BASIC_BLOCK (regno_first) == REG_BLOCK_UNKNOWN) REG_BASIC_BLOCK (regno_first) = blocknum; else if (REG_BASIC_BLOCK (regno_first) != blocknum) @@ -4237,16 +4246,18 @@ count_or_remove_death_notes (blocks, kill) sbitmap blocks; int kill; { - int count = 0; - basic_block bb; + int i, count = 0; - FOR_ALL_BB_REVERSE (bb) + for (i = n_basic_blocks - 1; i >= 0; --i) { + basic_block bb; rtx insn; - if (blocks && ! TEST_BIT (blocks, bb->sindex)) + if (blocks && ! TEST_BIT (blocks, i)) continue; + bb = BASIC_BLOCK (i); + for (insn = bb->head;; insn = NEXT_INSN (insn)) { if (INSN_P (insn)) |