summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-28 08:20:08 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-28 08:20:08 +0000
commit375c1c8af9bf76d2c619e056ff3d9c94e28039aa (patch)
tree9fd420c1917b17a0fa1e409f993e1a80d266278e /gcc/cfgexpand.c
parente996e8f12337f7038e1ca36708a93b91a85e7adb (diff)
downloadgcc-375c1c8af9bf76d2c619e056ff3d9c94e28039aa.tar.gz
* config/alpha/alpha.c (alpha_output_mi_thunk_osf): Use
insn_locators_alloc instead of insn_locators_initialize; call reset_block_changes. * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise. * config/sh/sh.c (sparc_output_mi_thunk): Likewise. * config/is64/ia64.c (ia64_output_mi_thunk): Likewise. * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise. * config/score/score.c (th_output_mi_thunk): Likewise. * config/mips/mips.c (mips_output_mi_thunk): Likewise. * cfglyaout.c (set_curr_insn_source_location, set_curr_insn_block): tolerate uninitialized locator info. Re-apply: * function.c (init_function_start): Don't init line number info. (expand_function_end): Update. (reset_block_changes, record_block_change, finalize_block_changes, check_block_change, free_block_changes): Kill. * function.h (reset_block_changes, record_block_change, finalize_block_changes, check_block_change, free_block_changes): Remove prototypes. (struct function): Remove ib_boundaries_block. * emit-rtl.c (make_insn_raw, make_jump_insn_raw, make_call_insn_raw): Use curr_insn_locator to initialize locator. (emit_line_note): Remove. * cfgexpand.c (expand_gimple_cond_expr): Update. (construct_exit_block): Likewise. (tree_expand_cfg): Initialize/finalize locators. * expr.c (expand_expr_real): Update. * cfglayout.c (line_locators_locs, line_locators_lines, file_locators_locs, file_locators_files): Remove. (set_block_levels): Move to cfgexpand.c. (insn_locators_initialize): Remove. (pass_insn_locators_initialize): Remove. (locations_locators_locs, locations_locators_vals): New static vars. (curr_location, last_location, curr_block, last_block, curr_rtl_loc): Likewise. (insn_locators_alloc, insn_locators_finalize, set_curr_insn_source_location, set_curr_insn_block, curr_insn_locator): New functions. (locator_location): New. (locator_line, locator_file): Rewrite. * rtl.h (emit_line_note): Kill. (insn_locators_alloc, insn_locators_finalize, set_curr_insn_source_location, set_curr_insn_block, curr_insn_locator): Declare. * tree-inline.c (initialize_cfun): Do not initialize ib_boundaries_block. * passes.c (pass_insn_locators_initialize): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124258 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c46
1 files changed, 35 insertions, 11 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 643ff207108..c8d446f12bd 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1297,8 +1297,8 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
if (EXPR_LOCUS (stmt))
{
- emit_line_note (*(EXPR_LOCUS (stmt)));
- record_block_change (TREE_BLOCK (stmt));
+ set_curr_insn_source_location (*(EXPR_LOCUS (stmt)));
+ set_curr_insn_block (TREE_BLOCK (stmt));
}
/* These flags have no purpose in RTL land. */
@@ -1313,7 +1313,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
add_reg_br_prob_note (last, true_edge->probability);
maybe_dump_rtl_for_tree_stmt (stmt, last);
if (true_edge->goto_locus)
- emit_line_note (*true_edge->goto_locus);
+ set_curr_insn_source_location (*true_edge->goto_locus);
false_edge->flags |= EDGE_FALLTHRU;
return NULL;
}
@@ -1323,7 +1323,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
add_reg_br_prob_note (last, false_edge->probability);
maybe_dump_rtl_for_tree_stmt (stmt, last);
if (false_edge->goto_locus)
- emit_line_note (*false_edge->goto_locus);
+ set_curr_insn_source_location (*false_edge->goto_locus);
true_edge->flags |= EDGE_FALLTHRU;
return NULL;
}
@@ -1354,7 +1354,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
maybe_dump_rtl_for_tree_stmt (stmt, last2);
if (false_edge->goto_locus)
- emit_line_note (*false_edge->goto_locus);
+ set_curr_insn_source_location (*false_edge->goto_locus);
return new_bb;
}
@@ -1608,7 +1608,7 @@ expand_gimple_basic_block (basic_block bb)
{
emit_jump (label_rtx_for_bb (e->dest));
if (e->goto_locus)
- emit_line_note (*e->goto_locus);
+ set_curr_insn_source_location (*e->goto_locus);
e->flags &= ~EDGE_FALLTHRU;
}
@@ -1679,6 +1679,19 @@ construct_init_block (void)
return init_block;
}
+/* For each lexical block, set BLOCK_NUMBER to the depth at which it is
+ found in the block tree. */
+
+static void
+set_block_levels (tree block, int level)
+{
+ while (block)
+ {
+ BLOCK_NUMBER (block) = level;
+ set_block_levels (BLOCK_SUBBLOCKS (block), level + 1);
+ block = BLOCK_CHAIN (block);
+ }
+}
/* Create a block containing landing pads and similar stuff. */
@@ -1703,7 +1716,7 @@ construct_exit_block (void)
input_location = cfun->function_end_locus;
/* The following insns belong to the top scope. */
- record_block_change (DECL_INITIAL (current_function_decl));
+ set_curr_insn_block (DECL_INITIAL (current_function_decl));
/* Generate rtl for function exit. */
expand_function_end ();
@@ -1831,8 +1844,16 @@ tree_expand_cfg (void)
/* Some backends want to know that we are expanding to RTL. */
currently_expanding_to_rtl = 1;
- /* Prepare the rtl middle end to start recording block changes. */
- reset_block_changes ();
+ insn_locators_alloc ();
+ if (!DECL_BUILT_IN (current_function_decl))
+ set_curr_insn_source_location (DECL_SOURCE_LOCATION (current_function_decl));
+ set_curr_insn_block (DECL_INITIAL (current_function_decl));
+ prologue_locator = curr_insn_locator ();
+
+ /* Make sure first insn is a note even if we don't want linenums.
+ This makes sure the first insn will never be deleted.
+ Also, final expects a note to appear there. */
+ emit_note (NOTE_INSN_DELETED);
/* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */
discover_nonconstant_array_refs ();
@@ -1879,6 +1900,8 @@ tree_expand_cfg (void)
bb = expand_gimple_basic_block (bb);
construct_exit_block ();
+ set_curr_insn_block (DECL_INITIAL (current_function_decl));
+ insn_locators_finalize ();
/* We're done expanding trees to RTL. */
currently_expanding_to_rtl = 0;
@@ -1909,8 +1932,6 @@ tree_expand_cfg (void)
more CONCATs anywhere. */
generating_concat_p = 0;
- finalize_block_changes ();
-
if (dump_file)
{
fprintf (dump_file,
@@ -1941,6 +1962,9 @@ tree_expand_cfg (void)
return_label = NULL;
naked_return_label = NULL;
free_histograms ();
+ /* Tag the blocks with a depth number so that change_scope can find
+ the common parent easily. */
+ set_block_levels (DECL_INITIAL (cfun->decl), 0);
return 0;
}