diff options
author | Jan Hubicka <jh@suse.cz> | 2001-09-16 20:21:30 +0000 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2001-09-16 20:21:30 +0000 |
commit | 3c030e88e793d2aff78a76e9df248bc029c9048c (patch) | |
tree | 3f3b141a9f45004a367eed069d691638b036e04f /gcc/cfg.c | |
parent | 345894b43fd5709b3990ff7897ed2b941d62742c (diff) | |
download | gcc-3c030e88e793d2aff78a76e9df248bc029c9048c.zip gcc-3c030e88e793d2aff78a76e9df248bc029c9048c.tar.gz gcc-3c030e88e793d2aff78a76e9df248bc029c9048c.tar.bz2 |
basic-block.h (free_bb_for_insn): Declare.
* basic-block.h (free_bb_for_insn): Declare.
* bb-reorder.c (label_for_bb): Use block_label.
(emit_jump_to_block_after): Remove.
(insert_intra_1): Do not update block_for_insn.
(insert_inter_bb_scope_notes): Likewise; update bb->end
* cfg.c (free_bb_for_insn): New.
(try_rediret_by_replacing_jump): Avoid set_block_for_new_insns call.
(force_nonfallthru_and_redirect): Likewise; do not update BB boundaries.
(commit_one_edge_insertion): Likewise.
(commit_one_edge_insertion): Do not update BB boundary.
(commit_edge_insertions): Do not call compute_bb_for_insn.
* cfgbuild.c (find_basic_blocks): Do not free basic_block_for_insn.
* cfgcleanup.c (merge_blocks_move_predecessor): Use reorder_insns_nobb.
(merge_blocks_move_successor_nojumps): Likewise.
(try_crossjump_to_edge): Do not update block_for_insn.
* combine.c (combine_instructions): Remove compute_bb_for_insn call.
* df.c (df_pattern_emit_later): Do not update BB boundary.
(df_jump_pattern_emit_after): Likewise.
(df_insn_move_before): Use emit_insn_before.
* emit-rtl.c (try_split): Emit after trial to get bb boundary updated
properly.
(add_insn_after, add_insn_before, emit_insns_after): Update BB
boundaries and basic_block_for_insn.
(reorder_insns_nobb): Rename from reorder_insns.
(reorder_insns): New.
(emit_block_insn_before, emit_block_insn_after): Kill.
* flow.c (check_function_return_warnings): Do not call
compute_bb_for_insn; Do not free basic_block_for_insn.
(attempt_auto_inc): Do not update basic_block_for_insn.
* function.c (emit_return_into_block): Likewise;
do not update BB boundaries.
* gcse.c (handle_avail_expr): Do not update basic_block_for_insn.
(insert_insn_end_bb): Use emit_insn_before; Likewise.
(pre_insert_copy_insn): Likewise.
(update_ld_motion_notes): Likewise.
(insert_insn_start_bb): Likewise.
(replace_store_insn): Likewise.
* ifcvt.c (noce_process_if_block): Likewise.
(if_convert): Do not call compute_bb_for_insn.
* lcm.c (optimize_mode_switching): Do not update BB boundaries.
Use emit_insn_before and emit_insn_after.
* recog.c (split_all_insns): Do not update BB boundaries;
Do not call compute_bb_for_insn.
(peephole2_optimize): Do not update BB boundaries.
* reg-stack.c (emit_pop_insn): Use emit_insn_after and
emit_insn_before.
(emit_swap_insn): Likewise.
(convert_regs_1): Likewise.
* reload1.c (reload): Call compute_bb_for_insn.
* rtl.h (reorder_insns_nobb): Declare.
* ssa.c (rename_equivalent_regs): Use emit_insn_before.
* toplev.c (rest_of_compilation): Call free_bb_for_insn
at places CFG is invalidated; do not call compute_bb_for_insn.
* cfg.c (expunge_block): Invalidate BB structure.
* (merge_blocks_nomove): Update properly BLOCK_FOR_INSN
array.
* cfg.c (verify_flow_info): Verify the basic_block_for_insn array.
From-SVN: r45647
Diffstat (limited to 'gcc/cfg.c')
-rw-r--r-- | gcc/cfg.c | 61 |
1 files changed, 33 insertions, 28 deletions
@@ -451,6 +451,9 @@ expunge_block (b) x->index = i; } + /* Invalidate data to make bughunting easier. */ + memset (b, 0, sizeof (*b)); + b->index = -3; basic_block_info->num_elements--; n_basic_blocks--; } @@ -552,6 +555,16 @@ compute_bb_for_insn (max) } } +/* Release the basic_block_for_insn array. */ + +void +free_bb_for_insn () +{ + if (basic_block_for_insn) + VARRAY_FREE (basic_block_for_insn); + basic_block_for_insn = 0; +} + /* Update insns block within BB. */ void @@ -933,7 +946,7 @@ merge_blocks_nomove (a, b) } #endif - a_end = prev; + a_end = PREV_INSN (del_first); } else if (GET_CODE (NEXT_INSN (a_end)) == BARRIER) del_first = NEXT_INSN (a_end); @@ -960,13 +973,14 @@ merge_blocks_nomove (a, b) /* Reassociate the insns of B with A. */ if (!b_empty) { + rtx x = a_end; if (basic_block_for_insn) { - BLOCK_FOR_INSN (b_head) = a; - while (b_head != b_end) + BLOCK_FOR_INSN (x) = a; + while (x != b_end) { - b_head = NEXT_INSN (b_head); - BLOCK_FOR_INSN (b_head) = a; + x = NEXT_INSN (x); + BLOCK_FOR_INSN (x) = a; } } a_end = b_end; @@ -1061,8 +1075,6 @@ try_redirect_by_replacing_jump (e, target) src->end = emit_jump_insn_before (gen_jump (target_label), kill_from); JUMP_LABEL (src->end) = target_label; LABEL_NUSES (target_label)++; - if (basic_block_for_insn) - set_block_for_new_insns (src->end, src); if (rtl_dump_file) fprintf (rtl_dump_file, "Replacing insn %i by jump %i\n", INSN_UID (insn), INSN_UID (src->end)); @@ -1279,11 +1291,9 @@ force_nonfallthru_and_redirect (e, target) jump_block = e->src; e->flags &= ~EDGE_FALLTHRU; label = block_label (target); - jump_block->end = emit_jump_insn_after (gen_jump (label), jump_block->end); + emit_jump_insn_after (gen_jump (label), jump_block->end); JUMP_LABEL (jump_block->end) = label; LABEL_NUSES (label)++; - if (basic_block_for_insn) - set_block_for_new_insns (jump_block->end, jump_block); emit_barrier_after (jump_block->end); redirect_edge_succ_nodup (e, target); @@ -1641,28 +1651,13 @@ commit_one_edge_insertion (e) /* Now that we've found the spot, do the insertion. */ - /* Set the new block number for these insns, if structure is allocated. */ - if (basic_block_for_insn) - { - rtx i; - for (i = insns; i != NULL_RTX; i = NEXT_INSN (i)) - set_block_for_insn (i, bb); - } - if (before) { emit_insns_before (insns, before); - if (before == bb->head) - bb->head = insns; - last = prev_nonnote_insn (before); } else - { - last = emit_insns_after (insns, after); - if (after == bb->end) - bb->end = last; - } + last = emit_insns_after (insns, after); if (returnjump_p (last)) { @@ -1679,7 +1674,6 @@ commit_one_edge_insertion (e) e->flags &= ~EDGE_FALLTHRU; emit_barrier_after (last); - bb->end = last; if (before) flow_delete_insn (before); @@ -1696,7 +1690,6 @@ commit_edge_insertions () { int i; basic_block bb; - compute_bb_for_insn (get_max_uid ()); #ifdef ENABLE_CHECKING verify_flow_info (); @@ -2171,6 +2164,18 @@ verify_flow_info () edge_checksum[e->dest->index + 2] -= (size_t) e; e = e->pred_next; } + for (x = bb->head; x != NEXT_INSN (bb->end); x = NEXT_INSN (x)) + if (basic_block_for_insn && BLOCK_FOR_INSN (x) != bb) + { + debug_rtx (x); + if (! BLOCK_FOR_INSN (x)) + error ("Insn %d is inside basic block %d but block_for_insn is NULL", + INSN_UID (x), bb->index); + else + error ("Insn %d is inside basic block %d but block_for_insn is %i", + INSN_UID (x), bb->index, BLOCK_FOR_INSN (x)->index); + err = 1; + } /* OK pointers are correct. Now check the header of basic block. It ought to contain optional CODE_LABEL followed |