summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-23 09:53:59 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-23 09:53:59 +0000
commit6a06c82438d4ebb3d39a6ad64287bfdc9bc528ae (patch)
tree73715f3e80c7a5aadb6e7e43c6f8e8edf3c74809 /gcc/cfgexpand.c
parentf8c24a13fb2699bb92000a1eed9ccca634e02347 (diff)
downloadgcc-6a06c82438d4ebb3d39a6ad64287bfdc9bc528ae.tar.gz
* 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@124061 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index b0ea1fcd419..490532af662 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1265,8 +1265,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. */
@@ -1281,7 +1281,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 (EXPR_LOCUS (then_exp))
- emit_line_note (*(EXPR_LOCUS (then_exp)));
+ set_curr_insn_source_location (*(EXPR_LOCUS (then_exp)));
return NULL;
}
if (TREE_CODE (else_exp) == GOTO_EXPR && IS_EMPTY_STMT (then_exp))
@@ -1290,7 +1290,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 (EXPR_LOCUS (else_exp))
- emit_line_note (*(EXPR_LOCUS (else_exp)));
+ set_curr_insn_source_location (*(EXPR_LOCUS (else_exp)));
return NULL;
}
gcc_assert (TREE_CODE (then_exp) == GOTO_EXPR
@@ -1322,7 +1322,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt)
maybe_dump_rtl_for_tree_stmt (stmt, last2);
if (EXPR_LOCUS (else_exp))
- emit_line_note (*(EXPR_LOCUS (else_exp)));
+ set_curr_insn_source_location (*(EXPR_LOCUS (else_exp)));
return new_bb;
}
@@ -1610,6 +1610,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. */
@@ -1634,7 +1647,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 ();
@@ -1762,8 +1775,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 ();
@@ -1810,6 +1831,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;
@@ -1840,8 +1863,6 @@ tree_expand_cfg (void)
more CONCATs anywhere. */
generating_concat_p = 0;
- finalize_block_changes ();
-
if (dump_file)
{
fprintf (dump_file,
@@ -1872,6 +1893,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;
}