aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-07-08 21:37:33 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-07-08 21:37:33 +0000
commit079e0f619684ff63b32e0fa02f460f57e271e3b4 (patch)
treeff17df21be3c5b5b770cb74f641aa2ca99793d01 /gcc
parentc83faba13da6d67e6784b3781419cd0605700daf (diff)
downloadgcc-079e0f619684ff63b32e0fa02f460f57e271e3b4.zip
gcc-079e0f619684ff63b32e0fa02f460f57e271e3b4.tar.gz
gcc-079e0f619684ff63b32e0fa02f460f57e271e3b4.tar.bz2
emit-rtl.c (set_insn_locations): New function moved from...
* emit-rtl.c (set_insn_locations): New function moved from... * function.c (set_insn_locations): ...here. * ira-emit.c (emit_moves): Propagate location of the first instruction to the inserted move instructions. * reg-stack.c (compensate_edge): Set the location if the sequence is inserted on the edge. * rtl.h (set_insn_locations): Declare. From-SVN: r273247
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/emit-rtl.c12
-rw-r--r--gcc/function.c13
-rw-r--r--gcc/ira-emit.c4
-rw-r--r--gcc/reg-stack.c1
-rw-r--r--gcc/rtl.h1
6 files changed, 28 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index db0cf7e..d0d3494 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2019-07-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * emit-rtl.c (set_insn_locations): New function moved from...
+ * function.c (set_insn_locations): ...here.
+ * ira-emit.c (emit_moves): Propagate location of the first instruction
+ to the inserted move instructions.
+ * reg-stack.c (compensate_edge): Set the location if the sequence is
+ inserted on the edge.
+ * rtl.h (set_insn_locations): Declare.
+
2019-07-08 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.c (rs6000_machine_from_flags): Ignore
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index e265fa6..f60f2e2 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -6582,6 +6582,18 @@ curr_insn_location (void)
return curr_location;
}
+/* Set the location of the insn chain starting at INSN to LOC. */
+void
+set_insn_locations (rtx_insn *insn, location_t loc)
+{
+ while (insn)
+ {
+ if (INSN_P (insn))
+ INSN_LOCATION (insn) = loc;
+ insn = NEXT_INSN (insn);
+ }
+}
+
/* Return lexical scope block insn belongs to. */
tree
insn_scope (const rtx_insn *insn)
diff --git a/gcc/function.c b/gcc/function.c
index a957679..0bce4ec 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5244,19 +5244,6 @@ use_return_register (void)
diddle_return_value (do_use_return_reg, NULL);
}
-/* Set the location of the insn chain starting at INSN to LOC. */
-
-static void
-set_insn_locations (rtx_insn *insn, int loc)
-{
- while (insn != NULL)
- {
- if (INSN_P (insn))
- INSN_LOCATION (insn) = loc;
- insn = NEXT_INSN (insn);
- }
-}
-
/* Generate RTL for the end of the current function. */
void
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index 51bf9c8..c42acad 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -1011,6 +1011,10 @@ emit_moves (void)
tmp = NEXT_INSN (tmp);
if (NOTE_INSN_BASIC_BLOCK_P (tmp))
tmp = NEXT_INSN (tmp);
+ /* Propagate the location of the current first instruction to the
+ moves so that they don't inherit a random location. */
+ if (tmp != NULL_RTX && INSN_P (tmp))
+ set_insn_locations (insns, INSN_LOCATION (tmp));
if (tmp == BB_HEAD (bb))
emit_insn_before (insns, tmp);
else if (tmp != NULL_RTX)
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 5576630..710f14a 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -2929,6 +2929,7 @@ compensate_edge (edge e)
seq = get_insns ();
end_sequence ();
+ set_insn_locations (seq, e->goto_locus);
insert_insn_on_edge (seq, e);
return true;
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 31fba82..a4fde4e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -4338,6 +4338,7 @@ extern void insn_locations_init (void);
extern void insn_locations_finalize (void);
extern void set_curr_insn_location (location_t);
extern location_t curr_insn_location (void);
+extern void set_insn_locations (rtx_insn *, location_t);
/* rtl-error.c */
extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *)