aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-03-28 21:19:23 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-03-28 21:19:23 +0000
commitc82fee88dc9758441101e2d92d327f202504b120 (patch)
tree5546780c03b01934b934347daf34220cf6414108 /gcc
parente45425ecf8afa3ce7cbae97f267538c7d1e5650c (diff)
downloadgcc-c82fee88dc9758441101e2d92d327f202504b120.zip
gcc-c82fee88dc9758441101e2d92d327f202504b120.tar.gz
gcc-c82fee88dc9758441101e2d92d327f202504b120.tar.bz2
cfgexpand.c (expand_gimple_cond): Always set the source location and block before expanding the statement.
* cfgexpand.c (expand_gimple_cond): Always set the source location and block before expanding the statement. (expand_gimple_stmt_1): Likewise. Set them here... (expand_gimple_stmt): ...and not here. Tidy. * cfglayout.c (curr_insn_locator): Return 0 if the current location is unknown. From-SVN: r171629
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cfgexpand.c38
-rw-r--r--gcc/cfglayout.c2
3 files changed, 24 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 23e3da5..6af0e4c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2011-03-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * cfgexpand.c (expand_gimple_cond): Always set the source location and
+ block before expanding the statement.
+ (expand_gimple_stmt_1): Likewise. Set them here...
+ (expand_gimple_stmt): ...and not here. Tidy.
+ * cfglayout.c (curr_insn_locator): Return 0 if the current location is
+ unknown.
+
2011-03-28 Steven Bosscher <steven@gcc.gnu.org>
* Makefile.in: New rule for cprop.o.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index ebe0a03..da40aae 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1745,11 +1745,8 @@ expand_gimple_cond (basic_block bb, gimple stmt)
last2 = last = get_last_insn ();
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
- if (gimple_has_location (stmt))
- {
- set_curr_insn_source_location (gimple_location (stmt));
- set_curr_insn_block (gimple_block (stmt));
- }
+ set_curr_insn_source_location (gimple_location (stmt));
+ set_curr_insn_block (gimple_block (stmt));
/* These flags have no purpose in RTL land. */
true_edge->flags &= ~EDGE_TRUE_VALUE;
@@ -1896,6 +1893,10 @@ static void
expand_gimple_stmt_1 (gimple stmt)
{
tree op0;
+
+ set_curr_insn_source_location (gimple_location (stmt));
+ set_curr_insn_block (gimple_block (stmt));
+
switch (gimple_code (stmt))
{
case GIMPLE_GOTO:
@@ -2052,32 +2053,21 @@ expand_gimple_stmt_1 (gimple stmt)
static rtx
expand_gimple_stmt (gimple stmt)
{
- int lp_nr = 0;
- rtx last = NULL;
location_t saved_location = input_location;
+ rtx last = get_last_insn ();
+ int lp_nr;
- last = get_last_insn ();
-
- /* If this is an expression of some kind and it has an associated line
- number, then emit the line number before expanding the expression.
-
- We need to save and restore the file and line information so that
- errors discovered during expansion are emitted with the right
- information. It would be better of the diagnostic routines
- used the file/line information embedded in the tree nodes rather
- than globals. */
gcc_assert (cfun);
+ /* We need to save and restore the current source location so that errors
+ discovered during expansion are emitted with the right location. But
+ it would be better if the diagnostic routines used the source location
+ embedded in the tree nodes rather than globals. */
if (gimple_has_location (stmt))
- {
- input_location = gimple_location (stmt);
- set_curr_insn_source_location (input_location);
-
- /* Record where the insns produced belong. */
- set_curr_insn_block (gimple_block (stmt));
- }
+ input_location = gimple_location (stmt);
expand_gimple_stmt_1 (stmt);
+
/* Free any temporaries used to evaluate this statement. */
free_temp_slots ();
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 05aed22..4646636 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -323,7 +323,7 @@ get_curr_insn_block (void)
int
curr_insn_locator (void)
{
- if (curr_rtl_loc == -1)
+ if (curr_rtl_loc == -1 || curr_location == UNKNOWN_LOCATION)
return 0;
if (last_block != curr_block)
{