diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2017-08-06 17:48:37 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2017-08-06 17:48:37 +0200 |
commit | cc8a9b8755bf92899be8a936b1a1229e06e942fd (patch) | |
tree | 6a040fac1a20a1c23878b0d8898689c8bbb5b634 /gcc/config | |
parent | 9fba2943f1e76245fda610fdb295b7077a5e799d (diff) | |
download | gcc-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/config')
-rw-r--r-- | gcc/config/alpha/alpha.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 |