* 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
+Sun Sep 16 21:59:46 CEST 2001 Jan hubicka <jh@suse.cz>
+
+ * 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.
+
2001-09-16 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.h (_cpp_lex_token): Update prototype.
#define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0)
extern void compute_bb_for_insn PARAMS ((int));
+extern void free_bb_for_insn PARAMS ((void));
extern void update_bb_for_insn PARAMS ((basic_block));
extern void set_block_for_insn PARAMS ((rtx, basic_block));
extern void set_block_for_new_insns PARAMS ((rtx, basic_block));
static void make_reorder_chain PARAMS ((void));
static basic_block make_reorder_chain_1 PARAMS ((basic_block, basic_block));
static rtx label_for_bb PARAMS ((basic_block));
-static rtx emit_jump_to_block_after PARAMS ((basic_block, rtx));
static void fixup_reorder_chain PARAMS ((void));
static void relate_bbs_with_scopes PARAMS ((scope));
static scope make_new_scope PARAMS ((int, rtx));
fprintf (rtl_dump_file, "Emitting label for block %d\n",
bb->index);
- label = emit_label_before (gen_label_rtx (), label);
- if (bb->head == RBI (bb)->eff_head)
+ label = block_label (bb);
+ if (bb->head == PREV_INSN (RBI (bb)->eff_head))
RBI (bb)->eff_head = label;
- bb->head = label;
- if (basic_block_for_insn)
- set_block_for_insn (label, bb);
}
return label;
}
-/* Emit a jump to BB after insn AFTER. */
-
-static rtx
-emit_jump_to_block_after (bb, after)
- basic_block bb;
- rtx after;
-{
- rtx jump;
-
- if (bb != EXIT_BLOCK_PTR)
- {
- rtx label = label_for_bb (bb);
- jump = emit_jump_insn_after (gen_jump (label), after);
- JUMP_LABEL (jump) = label;
- LABEL_NUSES (label) += 1;
- if (basic_block_for_insn)
- set_block_for_new_insns (jump, bb);
-
- if (rtl_dump_file)
- fprintf (rtl_dump_file, "Emitting jump to block %d\n",
- bb->index);
- }
- else
- {
-#ifdef HAVE_return
- if (! HAVE_return)
- abort ();
- jump = emit_jump_insn_after (gen_return (), after);
- if (basic_block_for_insn)
- set_block_for_new_insns (jump, bb);
-
- if (rtl_dump_file)
- fprintf (rtl_dump_file, "Emitting return\n");
-#else
- abort ();
-#endif
- }
-
- return jump;
-}
-
-
/* Given a reorder chain, rearrange the code to match. */
static void
{
*ip = emit_note_after (NOTE_INSN_BLOCK_BEG, *ip);
NOTE_BLOCK (*ip) = NOTE_BLOCK (s->note_beg);
- if (basic_block_for_insn)
- set_block_for_insn (*ip, bb);
}
for (p = s->inner; p; p = p->next)
{
*ip = emit_note_after (NOTE_INSN_BLOCK_END, *ip);
NOTE_BLOCK (*ip) = NOTE_BLOCK (s->note_end);
- if (basic_block_for_insn)
- set_block_for_insn (*ip, bb);
}
}
/* Close scopes. */
if (bb1)
{
+ rtx end = bb1->end;
+
scope s = RBI (bb1)->scope;
ip = RBI (bb1)->eff_end;
while (s != com)
{
ip = emit_note_after (NOTE_INSN_BLOCK_END, ip);
NOTE_BLOCK (ip) = NOTE_BLOCK (s->note_end);
- if (basic_block_for_insn)
- set_block_for_insn (ip, bb1);
}
s = s->outer;
}
+ /* Emitting note may move the end of basic block to unwanted place. */
+ bb1->end = end;
}
/* Open scopes. */
{
ip = emit_note_before (NOTE_INSN_BLOCK_BEG, ip);
NOTE_BLOCK (ip) = NOTE_BLOCK (s->note_beg);
- if (basic_block_for_insn)
- set_block_for_insn (ip, bb2);
}
s = s->outer;
}
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--;
}
}
}
+/* 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
}
#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);
/* 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;
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));
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);
/* 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))
{
e->flags &= ~EDGE_FALLTHRU;
emit_barrier_after (last);
- bb->end = last;
if (before)
flow_delete_insn (before);
{
int i;
basic_block bb;
- compute_bb_for_insn (get_max_uid ());
#ifdef ENABLE_CHECKING
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
int max_uid;
timevar_push (TV_CFG);
- if (basic_block_for_insn)
- VARRAY_FREE (basic_block_for_insn);
basic_block_for_insn = 0;
/* Flush out existing data. */
/* Scramble the insn chain. */
if (a->end != PREV_INSN (b->head))
- reorder_insns (a->head, a->end, PREV_INSN (b->head));
+ reorder_insns_nobb (a->head, a->end, PREV_INSN (b->head));
if (rtl_dump_file)
{
squeeze_notes (&b->head, &b->end);
/* Scramble the insn chain. */
- reorder_insns (b->head, b->end, a->end);
+ reorder_insns_nobb (b->head, b->end, a->end);
/* Now blocks A and B are contiguous. Merge them. */
merge_blocks_nomove (a, b);
src1->end = emit_jump_insn_before (gen_jump (label), newpos1);
JUMP_LABEL (src1->end) = label;
LABEL_NUSES (label)++;
- if (basic_block_for_insn)
- set_block_for_new_insns (src1->end, src1);
/* Delete the now unreachable instructions. */
flow_delete_insn_chain (newpos1, last);
if (need_refresh)
{
- compute_bb_for_insn (get_max_uid ());
update_life_info (refresh_blocks, UPDATE_LIFE_GLOBAL_RM_NOTES,
PROP_DEATH_NOTES);
}
if (ret_insn == insn)
return ret_insn;
- if (bb->end == insn)
- bb->end = ret_insn;
-
df_insns_modify (df, bb, NEXT_INSN (insn), ret_insn);
return ret_insn;
}
if (ret_insn == insn)
return ret_insn;
- if (bb->end == insn)
- bb->end = ret_insn;
-
df_insns_modify (df, bb, NEXT_INSN (insn), ret_insn);
return ret_insn;
}
/* ???? Perhaps all the insns moved should be stored on a list
which df_analyse removes when it recalculates data flow. */
- return emit_block_insn_before (insn, before_insn, before_bb);
+ return emit_insn_before (insn, before_insn);
}
\f
/* Functions to query dataflow information. */
if (GET_CODE (XVECEXP (seq, 0, i)) == INSN)
mark_label_nuses (PATTERN (XVECEXP (seq, 0, i)));
- tem = emit_insn_after (seq, before);
+ tem = emit_insn_after (seq, trial);
delete_insn (trial);
if (has_barrier)
rtx insn, after;
{
rtx next = NEXT_INSN (after);
+ basic_block bb;
if (optimize && INSN_DELETED_P (after))
abort ();
abort ();
}
+ if (basic_block_for_insn
+ && (unsigned int)INSN_UID (after) < basic_block_for_insn->num_elements
+ && (bb = BLOCK_FOR_INSN (after)))
+ {
+ set_block_for_insn (insn, bb);
+ /* Should not happen as first in the BB is always
+ eigther NOTE or LABEL. */
+ if (bb->end == after
+ /* Avoid clobbering of structure when creating new BB. */
+ && GET_CODE (insn) != BARRIER
+ && (GET_CODE (insn) != NOTE
+ || NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK))
+ bb->end = insn;
+ }
+
NEXT_INSN (after) = insn;
if (GET_CODE (after) == INSN && GET_CODE (PATTERN (after)) == SEQUENCE)
{
rtx insn, before;
{
rtx prev = PREV_INSN (before);
+ basic_block bb;
if (optimize && INSN_DELETED_P (before))
abort ();
abort ();
}
+ if (basic_block_for_insn
+ && (unsigned int)INSN_UID (before) < basic_block_for_insn->num_elements
+ && (bb = BLOCK_FOR_INSN (before)))
+ {
+ set_block_for_insn (insn, bb);
+ /* Should not happen as first in the BB is always
+ eigther NOTE or LABEl. */
+ if (bb->head == insn
+ /* Avoid clobbering of structure when creating new BB. */
+ && GET_CODE (insn) != BARRIER
+ && (GET_CODE (insn) != NOTE
+ || NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK))
+ abort ();
+ }
+
PREV_INSN (before) = insn;
if (GET_CODE (before) == INSN && GET_CODE (PATTERN (before)) == SEQUENCE)
PREV_INSN (XVECEXP (PATTERN (before), 0, 0)) = insn;
called after delay-slot filling has been done. */
void
-reorder_insns (from, to, after)
+reorder_insns_nobb (from, to, after)
rtx from, to, after;
{
/* Splice this bunch out of where it is now. */
last_insn = to;
}
+/* Same as function above, but take care to update BB boundaries. */
+void
+reorder_insns (from, to, after)
+ rtx from, to, after;
+{
+ rtx prev = PREV_INSN (from);
+ basic_block bb, bb2;
+
+ reorder_insns_nobb (from, to, after);
+
+ if (basic_block_for_insn
+ && (unsigned int)INSN_UID (after) < basic_block_for_insn->num_elements
+ && (bb = BLOCK_FOR_INSN (after)))
+ {
+ rtx x;
+
+ if (basic_block_for_insn
+ && (unsigned int)INSN_UID (from) < basic_block_for_insn->num_elements
+ && (bb2 = BLOCK_FOR_INSN (from)))
+ {
+ if (bb2->end == to)
+ bb2->end = prev;
+ }
+
+ if (bb->end == after)
+ bb->end = to;
+
+ for (x = from; x != NEXT_INSN (to); x = NEXT_INSN (x))
+ set_block_for_insn (x, bb);
+ }
+}
+
/* Return the line note insn preceding INSN. */
static rtx
return insn;
}
-/* Similar to emit_insn_before, but update basic block boundaries as well. */
-
-rtx
-emit_block_insn_before (pattern, before, block)
- rtx pattern, before;
- basic_block block;
-{
- rtx prev = PREV_INSN (before);
- rtx r = emit_insn_before (pattern, before);
- if (block && block->head == before)
- block->head = NEXT_INSN (prev);
- return r;
-}
-
/* Make an instruction with body PATTERN and code JUMP_INSN
and output it before the instruction BEFORE. */
insn);
}
-/* Similar to emit_insn_after, but update basic block boundaries as well. */
-
-rtx
-emit_block_insn_after (pattern, after, block)
- rtx pattern, after;
- basic_block block;
-{
- rtx r = emit_insn_after (pattern, after);
- if (block && block->end == after)
- block->end = r;
- return r;
-}
-
/* Make an insn of code JUMP_INSN with body PATTERN
and output it after the insn AFTER. */
{
register rtx last;
register rtx after_after;
+ basic_block bb;
if (!after)
abort ();
if (!first)
return first;
- for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
- continue;
+ if (basic_block_for_insn
+ && (unsigned int)INSN_UID (after) < basic_block_for_insn->num_elements
+ && (bb = BLOCK_FOR_INSN (after)))
+ {
+ for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
+ set_block_for_insn (last, bb);
+ set_block_for_insn (last, bb);
+ if (bb->end == after)
+ bb->end = last;
+ }
+ else
+ for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
+ continue;
after_after = NEXT_INSN (after);
{
/* Recompute insn->block mapping, since the initial mapping is
set before we delete unreachable blocks. */
- compute_bb_for_insn (max_uid);
-
if (BLOCK_FOR_INSN (cfun->x_clobber_return_insn) != NULL)
warning ("control reaches end of non-void function");
}
free_basic_block_vars (keep_head_end_p)
int keep_head_end_p;
{
- if (basic_block_for_insn)
- {
- VARRAY_FREE (basic_block_for_insn);
- basic_block_for_insn = NULL;
- }
-
if (! keep_head_end_p)
{
if (basic_block_info)
insns = get_insns ();
end_sequence ();
- if (basic_block_for_insn)
- for (temp = insns; temp; temp = NEXT_INSN (temp))
- set_block_for_insn (temp, pbi->bb);
-
/* If we can't make the auto-inc, or can't make the
replacement into Y, exit. There's no point in making
the change below if we can't do the auto-inc and doing
end = emit_jump_insn_after (gen_return (), bb->end);
if (line_note)
emit_line_note_after (NOTE_SOURCE_FILE (line_note),
- NOTE_LINE_NUMBER (line_note), bb->end);
-
- while (1)
- {
- set_block_for_insn (p, bb);
- if (p == bb->end)
- break;
- p = PREV_INSN (p);
- }
- bb->end = end;
+ NOTE_LINE_NUMBER (line_note), PREV_INSN (bb->end));
}
#endif /* HAVE_return */
i = PREV_INSN (insn);
newinsn = emit_insn_before (seq, insn);
- /* Update the UID to basic block map. */
- for (i = NEXT_INSN (i); i != insn; i = NEXT_INSN (i))
- set_block_for_insn (i, bb);
-
/* Retain a map of the epilogue insns. Used in life analysis to
avoid getting rid of sibcall epilogue insns. */
record_insns (GET_CODE (seq) == SEQUENCE
SET_DEST (expr_set)),
insn_computes_expr);
- /* Keep block number table up to date. */
- 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);
}
#endif
/* FIXME: What if something in cc0/jump uses value set in new insn? */
- new_insn = emit_block_insn_before (pat, insn, bb);
+ new_insn = emit_insn_before (pat, insn);
}
/* Likewise if the last insn is a call, as will happen in the presence
|| NOTE_INSN_BASIC_BLOCK_P (insn))
insn = NEXT_INSN (insn);
- new_insn = emit_block_insn_before (pat, insn, bb);
+ new_insn = emit_insn_before (pat, insn);
}
else
- {
- new_insn = emit_insn_after (pat, insn);
- bb->end = new_insn;
- }
+ new_insn = emit_insn_after (pat, insn);
/* Keep block number table up to date.
Note, PAT could be a multiple insn sequence, we have to make
for (i = 0; i < XVECLEN (pat, 0); i++)
{
rtx insn = XVECEXP (pat, 0, i);
-
- set_block_for_insn (insn, bb);
if (INSN_P (insn))
add_label_notes (PATTERN (insn), new_insn);
else
{
add_label_notes (SET_SRC (pat), new_insn);
- set_block_for_new_insns (new_insn, bb);
/* Keep register set table up to date. */
record_one_set (regno, new_insn);
int indx = expr->bitmap_index;
rtx set = single_set (insn);
rtx new_insn;
- basic_block bb = BLOCK_FOR_INSN (insn);
if (!set)
abort ();
new_insn = emit_insn_after (gen_move_insn (reg, SET_DEST (set)), insn);
- /* Keep block number table up to date. */
- set_block_for_new_insns (new_insn, bb);
-
/* Keep register set table up to date. */
record_one_set (regno, new_insn);
- if (insn == bb->end)
- bb->end = new_insn;
gcse_create_count++;
copy = gen_move_insn ( reg, SET_SRC (pat));
new = emit_insn_before (copy, insn);
record_one_set (REGNO (reg), new);
- set_block_for_new_insns (new, BLOCK_FOR_INSN (insn));
SET_SRC (pat) = reg;
/* un-recognize this pattern since it's probably different now. */
insn = emit_insn_after (insn, prev);
- if (prev == bb->end)
- bb->end = insn;
-
- set_block_for_new_insns (insn, bb);
-
if (gcse_file)
{
fprintf (gcse_file, "STORE_MOTION insert store at start of BB %d:\n",
insn = gen_move_insn (reg, SET_SRC (PATTERN (del)));
insn = emit_insn_after (insn, del);
- set_block_for_new_insns (insn, bb);
if (gcse_file)
{
fprintf(gcse_file, "\n");
}
- if (bb->end == del)
- bb->end = insn;
-
- if (bb->head == del)
- bb->head = insn;
-
delete_insn (del);
}
&& GET_CODE (insn) != CODE_LABEL
/* Don't emit a NOTE if it would end up before a BARRIER. */
&& GET_CODE (NEXT_INSN (insn)) != BARRIER))
- emit_note_after (NOTE_INSN_DELETED, BLOCK_END (n_basic_blocks - 1));
+ {
+ emit_note_after (NOTE_INSN_DELETED, BLOCK_END (n_basic_blocks - 1));
+ /* Make insn to appear outside BB. */
+ BLOCK_END (n_basic_blocks - 1) = PREV_INSN (BLOCK_END (n_basic_blocks - 1));
+ }
/* Compute INSN_REG_WEIGHT for all blocks. We must do this before
removing death notes. */
insn_b = gen_sequence ();
end_sequence ();
- test_bb->end = emit_insn_after (insn_b, test_bb->end);
+ emit_insn_after (insn_b, test_bb->end);
}
/* Merge the blocks! */
if (rtl_dump_file)
fflush (rtl_dump_file);
- /* Rebuild basic_block_for_insn for update_life_info and for gcse. */
- compute_bb_for_insn (get_max_uid ());
-
/* Rebuild life info for basic blocks that require it. */
if (num_removed_blocks && life_data_ok)
{
the case of EH edges, EH entry points also start
in normal mode, so a similar reasoning applies. */
else if (GET_CODE (src_bb->end) == INSN)
- src_bb->end = emit_insn_after (mode_set, src_bb->end);
+ emit_insn_after (mode_set, src_bb->end);
else
abort ();
bb_info[j][src_bb->index].computing = mode;
if (GET_CODE (eg->src->end) == JUMP_INSN)
emit_insn_before (mode_set, eg->src->end);
else if (GET_CODE (eg->src->end) == INSN)
- eg->src->end = emit_insn_after (mode_set, eg->src->end);
+ emit_insn_after (mode_set, eg->src->end);
else
abort ();
}
if (GET_CODE (ptr->insn_ptr) == NOTE
&& (NOTE_LINE_NUMBER (ptr->insn_ptr)
== NOTE_INSN_BASIC_BLOCK))
- emit_block_insn_after (mode_set, ptr->insn_ptr,
- BASIC_BLOCK (ptr->bbnum));
+ emit_insn_after (mode_set, ptr->insn_ptr);
else
- emit_block_insn_before (mode_set, ptr->insn_ptr,
- BASIC_BLOCK (ptr->bbnum));
+ emit_insn_before (mode_set, ptr->insn_ptr);
}
free (ptr);
last = split_insn (insn);
if (last)
{
+ /* The split sequence may include barrier, but the
+ BB boundary we are interested in will be set to previous
+ one. */
+
+ while (GET_CODE (last) == BARRIER)
+ last = PREV_INSN (last);
SET_BIT (blocks, i);
changed = 1;
- if (insn == bb->end)
- bb->end = last;
insn = last;
}
if (changed)
{
- compute_bb_for_insn (get_max_uid ());
for (i = 0; i < n_basic_blocks; i++)
find_sub_basic_blocks (BASIC_BLOCK (i));
}
i -= MAX_INSNS_PER_PEEP2 + 1;
/* Replace the old sequence with the new. */
+ try = emit_insn_after (try, peep2_insn_data[i].insn);
flow_delete_insn_chain (insn, peep2_insn_data[i].insn);
- try = emit_insn_after (try, prev);
-
- /* Adjust the basic block boundaries. */
- if (peep2_insn_data[i].insn == bb->end)
- bb->end = try;
- if (insn == bb->head)
- bb->head = NEXT_INSN (prev);
#ifdef HAVE_conditional_execution
/* With conditional execution, we cannot back up the
FP_MODE_REG (FIRST_STACK_REG, DFmode));
if (where == EMIT_AFTER)
- pop_insn = emit_block_insn_after (pop_rtx, insn, current_block);
+ pop_insn = emit_insn_after (pop_rtx, insn);
else
- pop_insn = emit_block_insn_before (pop_rtx, insn, current_block);
+ pop_insn = emit_insn_before (pop_rtx, insn);
REG_NOTES (pop_insn)
= gen_rtx_EXPR_LIST (REG_DEAD, FP_MODE_REG (FIRST_STACK_REG, DFmode),
FP_MODE_REG (FIRST_STACK_REG, XFmode));
if (i1)
- emit_block_insn_after (swap_rtx, i1, current_block);
+ emit_insn_after (swap_rtx, i1);
else if (current_block)
- emit_block_insn_before (swap_rtx, current_block->head, current_block);
+ emit_insn_before (swap_rtx, current_block->head);
else
emit_insn_before (swap_rtx, insn);
}
set = gen_rtx_SET (VOIDmode, FP_MODE_REG (reg, SFmode),
nan);
- insn = emit_block_insn_after (set, insn, block);
+ insn = emit_insn_after (set, insn);
subst_stack_regs (insn, ®stack);
}
}
/* Free all the insn_chain structures at once. */
obstack_free (&reload_obstack, reload_startobj);
unused_insn_chains = 0;
+ compute_bb_for_insn (get_max_uid ());
fixup_abnormal_edges ();
return failure;
extern void mark_user_reg PARAMS ((rtx));
extern void reset_used_flags PARAMS ((rtx));
extern void reorder_insns PARAMS ((rtx, rtx, rtx));
+extern void reorder_insns_nobb PARAMS ((rtx, rtx, rtx));
extern int get_max_uid PARAMS ((void));
extern int in_sequence_p PARAMS ((void));
extern void force_next_line_note PARAMS ((void));
PATTERN (insn) = XVECEXP (s, 0, slen-1);
for (i = 0; i < slen - 1; i++)
- emit_block_insn_before (XVECEXP (s, 0, i), insn, b);
+ emit_insn_before (XVECEXP (s, 0, i), insn);
}
}
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (CLEANUP_PRE_SIBCALL | CLEANUP_PRE_LOOP);
optimize = saved_optimize;
+
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
}
current_function_nothrow = nothrow_function_p ();
rebuild_jump_labels (insns);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP);
+
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
copy_loop_headers (insns);
purge_line_number_notes (insns);
timevar_pop (TV_FROM_SSA);
ggc_collect ();
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
}
timevar_push (TV_JUMP);
if_convert (0);
timevar_pop (TV_IFCVT);
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
/* Try to identify useless null pointer tests and delete them. */
if (flag_delete_null_pointer_checks)
delete_null_pointer_checks (insns);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
timevar_pop (TV_JUMP);
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
}
/* Run this after jump optmizations remove all the unreachable code
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
delete_null_pointer_checks (insns);
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
timevar_pop (TV_JUMP);
}
save_cfj = flag_cse_follow_jumps;
flag_cse_skip_blocks = flag_cse_follow_jumps = 0;
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
/* If -fexpensive-optimizations, re-run CSE to clean up things done
by gcse. */
if (flag_expensive_optimizations)
delete_trivially_dead_insns (insns, max_reg_num (), 0);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
timevar_pop (TV_JUMP);
if (flag_expensive_optimizations)
{
timevar_push (TV_LOOP);
open_dump_file (DFI_loop, decl);
+ free_bb_for_insn ();
if (flag_rerun_loop_opt)
{
timevar_pop (TV_JUMP);
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
reg_scan (insns, max_reg_num (), 0);
tem = cse_main (insns, max_reg_num (), 1, rtl_dump_file);
rebuild_jump_labels (insns);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (CLEANUP_EXPENSIVE);
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
timevar_pop (TV_JUMP);
}
}
verify_flow_info ();
#endif
- compute_bb_for_insn (get_max_uid ());
-
/* If optimizing, then go ahead and split insns now. */
if (optimize > 0)
split_all_insns (0);
reg_to_stack (insns, rtl_dump_file);
- close_dump_file (DFI_stack, print_rtl, insns);
+ close_dump_file (DFI_stack, print_rtl_with_bb, insns);
timevar_pop (TV_REG_STACK);
ggc_collect ();
}
compute_alignments ();
+ /* CFG is no longer maitained up-to-date. */
+ free_bb_for_insn ();
+
/* If a machine dependent reorganization is needed, call it. */
#ifdef MACHINE_DEPENDENT_REORG
timevar_push (TV_MACH_DEP);
ggc_collect ();
#endif
- /* CFG no longer kept up to date. */
-
purge_line_number_notes (insns);
cleanup_barriers ();