diff options
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 643ff20..c8d446f 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; } |