summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c104
1 files changed, 31 insertions, 73 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 91457eb2455..6b580d7439c 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -92,8 +92,7 @@ gimple_assign_rhs_to_tree (gimple stmt)
&& gimple_location (stmt) != EXPR_LOCATION (t))
|| (gimple_block (stmt)
&& currently_expanding_to_rtl
- && EXPR_P (t)
- && gimple_block (stmt) != TREE_BLOCK (t)))
+ && EXPR_P (t)))
t = copy_node (t);
}
else
@@ -101,8 +100,6 @@ gimple_assign_rhs_to_tree (gimple stmt)
if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (t))
SET_EXPR_LOCATION (t, gimple_location (stmt));
- if (gimple_block (stmt) && currently_expanding_to_rtl && EXPR_P (t))
- TREE_BLOCK (t) = gimple_block (stmt);
return t;
}
@@ -1831,8 +1828,7 @@ expand_gimple_cond (basic_block bb, gimple stmt)
last2 = last = get_last_insn ();
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
- set_curr_insn_source_location (gimple_location (stmt));
- set_curr_insn_block (gimple_block (stmt));
+ set_curr_insn_location (gimple_location (stmt));
/* These flags have no purpose in RTL land. */
true_edge->flags &= ~EDGE_TRUE_VALUE;
@@ -1845,13 +1841,8 @@ expand_gimple_cond (basic_block bb, gimple stmt)
jumpif_1 (code, op0, op1, label_rtx_for_bb (true_edge->dest),
true_edge->probability);
maybe_dump_rtl_for_gimple_stmt (stmt, last);
- if (true_edge->goto_locus)
- {
- set_curr_insn_source_location (true_edge->goto_locus);
- set_curr_insn_block (true_edge->goto_block);
- true_edge->goto_locus = curr_insn_locator ();
- }
- true_edge->goto_block = NULL;
+ if (!IS_UNKNOWN_LOCATION (true_edge->goto_locus))
+ set_curr_insn_location (true_edge->goto_locus);
false_edge->flags |= EDGE_FALLTHRU;
maybe_cleanup_end_of_block (false_edge, last);
return NULL;
@@ -1861,13 +1852,8 @@ expand_gimple_cond (basic_block bb, gimple stmt)
jumpifnot_1 (code, op0, op1, label_rtx_for_bb (false_edge->dest),
false_edge->probability);
maybe_dump_rtl_for_gimple_stmt (stmt, last);
- if (false_edge->goto_locus)
- {
- set_curr_insn_source_location (false_edge->goto_locus);
- set_curr_insn_block (false_edge->goto_block);
- false_edge->goto_locus = curr_insn_locator ();
- }
- false_edge->goto_block = NULL;
+ if (!IS_UNKNOWN_LOCATION (false_edge->goto_locus))
+ set_curr_insn_location (false_edge->goto_locus);
true_edge->flags |= EDGE_FALLTHRU;
maybe_cleanup_end_of_block (true_edge, last);
return NULL;
@@ -1876,13 +1862,8 @@ expand_gimple_cond (basic_block bb, gimple stmt)
jumpif_1 (code, op0, op1, label_rtx_for_bb (true_edge->dest),
true_edge->probability);
last = get_last_insn ();
- if (false_edge->goto_locus)
- {
- set_curr_insn_source_location (false_edge->goto_locus);
- set_curr_insn_block (false_edge->goto_block);
- false_edge->goto_locus = curr_insn_locator ();
- }
- false_edge->goto_block = NULL;
+ if (!IS_UNKNOWN_LOCATION (false_edge->goto_locus))
+ set_curr_insn_location (false_edge->goto_locus);
emit_jump (label_rtx_for_bb (false_edge->dest));
BB_END (bb) = last;
@@ -1907,13 +1888,11 @@ expand_gimple_cond (basic_block bb, gimple stmt)
maybe_dump_rtl_for_gimple_stmt (stmt, last2);
- if (true_edge->goto_locus)
+ if (!IS_UNKNOWN_LOCATION (true_edge->goto_locus))
{
- set_curr_insn_source_location (true_edge->goto_locus);
- set_curr_insn_block (true_edge->goto_block);
- true_edge->goto_locus = curr_insn_locator ();
+ set_curr_insn_location (true_edge->goto_locus);
+ true_edge->goto_locus = curr_insn_location ();
}
- true_edge->goto_block = NULL;
return new_bb;
}
@@ -2013,7 +1992,6 @@ expand_call_stmt (gimple stmt)
CALL_FROM_THUNK_P (exp) = gimple_call_from_thunk_p (stmt);
CALL_EXPR_VA_ARG_PACK (exp) = gimple_call_va_arg_pack_p (stmt);
SET_EXPR_LOCATION (exp, gimple_location (stmt));
- TREE_BLOCK (exp) = gimple_block (stmt);
/* Ensure RTL is created for debug args. */
if (decl && DECL_HAS_DEBUG_ARGS_P (decl))
@@ -2048,8 +2026,7 @@ expand_gimple_stmt_1 (gimple stmt)
{
tree op0;
- set_curr_insn_source_location (gimple_location (stmt));
- set_curr_insn_block (gimple_block (stmt));
+ set_curr_insn_location (gimple_location (stmt));
switch (gimple_code (stmt))
{
@@ -3793,8 +3770,7 @@ expand_gimple_basic_block (basic_block bb)
tree op;
gimple def;
- location_t sloc = get_curr_insn_source_location ();
- tree sblock = get_curr_insn_block ();
+ location_t sloc = curr_insn_location ();
/* Look for SSA names that have their last use here (TERed
names always have only one real use). */
@@ -3827,8 +3803,7 @@ expand_gimple_basic_block (basic_block bb)
rtx val;
enum machine_mode mode;
- set_curr_insn_source_location (gimple_location (def));
- set_curr_insn_block (gimple_block (def));
+ set_curr_insn_location (gimple_location (def));
DECL_ARTIFICIAL (vexpr) = 1;
TREE_TYPE (vexpr) = TREE_TYPE (value);
@@ -3855,8 +3830,7 @@ expand_gimple_basic_block (basic_block bb)
}
}
}
- set_curr_insn_source_location (sloc);
- set_curr_insn_block (sblock);
+ set_curr_insn_location (sloc);
}
currently_expanding_gimple_stmt = stmt;
@@ -3871,8 +3845,7 @@ expand_gimple_basic_block (basic_block bb)
}
else if (gimple_debug_bind_p (stmt))
{
- location_t sloc = get_curr_insn_source_location ();
- tree sblock = get_curr_insn_block ();
+ location_t sloc = curr_insn_location ();
gimple_stmt_iterator nsi = gsi;
for (;;)
@@ -3894,8 +3867,7 @@ expand_gimple_basic_block (basic_block bb)
last = get_last_insn ();
- set_curr_insn_source_location (gimple_location (stmt));
- set_curr_insn_block (gimple_block (stmt));
+ set_curr_insn_location (gimple_location (stmt));
if (DECL_P (var))
mode = DECL_MODE (var);
@@ -3933,13 +3905,11 @@ expand_gimple_basic_block (basic_block bb)
break;
}
- set_curr_insn_source_location (sloc);
- set_curr_insn_block (sblock);
+ set_curr_insn_location (sloc);
}
else if (gimple_debug_source_bind_p (stmt))
{
- location_t sloc = get_curr_insn_source_location ();
- tree sblock = get_curr_insn_block ();
+ location_t sloc = curr_insn_location ();
tree var = gimple_debug_source_bind_get_var (stmt);
tree value = gimple_debug_source_bind_get_value (stmt);
rtx val;
@@ -3947,8 +3917,7 @@ expand_gimple_basic_block (basic_block bb)
last = get_last_insn ();
- set_curr_insn_source_location (gimple_location (stmt));
- set_curr_insn_block (gimple_block (stmt));
+ set_curr_insn_location (gimple_location (stmt));
mode = DECL_MODE (var);
@@ -3966,8 +3935,7 @@ expand_gimple_basic_block (basic_block bb)
PAT_VAR_LOCATION_LOC (val) = (rtx)value;
}
- set_curr_insn_source_location (sloc);
- set_curr_insn_block (sblock);
+ set_curr_insn_location (sloc);
}
else
{
@@ -4008,13 +3976,8 @@ expand_gimple_basic_block (basic_block bb)
/* Expand implicit goto and convert goto_locus. */
FOR_EACH_EDGE (e, ei, bb->succs)
{
- if (e->goto_locus && e->goto_block)
- {
- set_curr_insn_source_location (e->goto_locus);
- set_curr_insn_block (e->goto_block);
- e->goto_locus = curr_insn_locator ();
- }
- e->goto_block = NULL;
+ if (!IS_UNKNOWN_LOCATION (e->goto_locus))
+ set_curr_insn_location (e->goto_locus);
if ((e->flags & EDGE_FALLTHRU) && e->dest != bb->next_bb)
{
emit_jump (label_rtx_for_bb (e->dest));
@@ -4134,12 +4097,9 @@ construct_exit_block (void)
/* Make sure the locus is set to the end of the function, so that
epilogue line numbers and warnings are set properly. */
- if (cfun->function_end_locus != UNKNOWN_LOCATION)
+ if (!IS_UNKNOWN_LOCATION (cfun->function_end_locus))
input_location = cfun->function_end_locus;
- /* The following insns belong to the top scope. */
- set_curr_insn_block (DECL_INITIAL (current_function_decl));
-
/* Generate rtl for function exit. */
expand_function_end ();
@@ -4357,20 +4317,19 @@ gimple_expand_cfg (void)
rtl_profile_for_bb (ENTRY_BLOCK_PTR);
- insn_locators_alloc ();
+ insn_locations_init ();
if (!DECL_IS_BUILTIN (current_function_decl))
{
/* Eventually, all FEs should explicitly set function_start_locus. */
- if (cfun->function_start_locus == UNKNOWN_LOCATION)
- set_curr_insn_source_location
+ if (IS_UNKNOWN_LOCATION (cfun->function_start_locus))
+ set_curr_insn_location
(DECL_SOURCE_LOCATION (current_function_decl));
else
- set_curr_insn_source_location (cfun->function_start_locus);
+ set_curr_insn_location (cfun->function_start_locus);
}
else
- set_curr_insn_source_location (UNKNOWN_LOCATION);
- set_curr_insn_block (DECL_INITIAL (current_function_decl));
- prologue_locator = curr_insn_locator ();
+ set_curr_insn_location (UNKNOWN_LOCATION);
+ prologue_location = curr_insn_location ();
#ifdef INSN_SCHEDULING
init_sched_attrs ();
@@ -4551,8 +4510,7 @@ gimple_expand_cfg (void)
free_histograms ();
construct_exit_block ();
- set_curr_insn_block (DECL_INITIAL (current_function_decl));
- insn_locators_finalize ();
+ insn_locations_finalize ();
/* Zap the tree EH table. */
set_eh_throw_stmt_table (cfun, NULL);