aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2017-08-06 17:48:37 +0200
committerUros Bizjak <uros@gcc.gnu.org>2017-08-06 17:48:37 +0200
commitcc8a9b8755bf92899be8a936b1a1229e06e942fd (patch)
tree6a040fac1a20a1c23878b0d8898689c8bbb5b634 /gcc
parent9fba2943f1e76245fda610fdb295b7077a5e799d (diff)
downloadgcc-cc8a9b8755bf92899be8a936b1a1229e06e942fd.zip
gcc-cc8a9b8755bf92899be8a936b1a1229e06e942fd.tar.gz
gcc-cc8a9b8755bf92899be8a936b1a1229e06e942fd.tar.bz2
alpha.c (alpha_reorg): If trap is the last active insn in the function, emit NOP after the insn.
* config/alpha/alpha.c (alpha_reorg): If trap is the last active insn in the function, emit NOP after the insn. From-SVN: r250901
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/alpha/alpha.c19
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 51ed7c9..4ed00a2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-08-06 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.c (alpha_reorg): If trap is the last active
+ insn in the function, emit NOP after the insn.
+
2017-08-06 Tom de Vries <tom@codesourcery.com>
* omp-expand.c (expand_oacc_for): Add missing edge probability for tile
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 9f5dae2..341ec20 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -9456,6 +9456,25 @@ And in the noreturn case:
if (current_function_has_exception_handlers ())
alpha_pad_function_end ();
+
+ /* CALL_PAL that implements trap insn, updates program counter to point
+ after the insn. In case trap is the last insn in the function,
+ emit NOP to guarantee that PC remains inside function boundaries.
+ This workaround is needed to get reliable backtraces. */
+
+ rtx_insn *insn = prev_active_insn (get_last_insn ());
+
+ if (insn && NONJUMP_INSN_P (insn))
+ {
+ rtx pat = PATTERN (insn);
+ if (GET_CODE (pat) == PARALLEL)
+ {
+ rtx vec = XVECEXP (pat, 0, 0);
+ if (GET_CODE (vec) == TRAP_IF
+ && XEXP (vec, 0) == const1_rtx)
+ emit_insn_after (gen_unop (), insn);
+ }
+ }
}
static void