aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2019-08-13 11:04:52 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2019-08-13 11:04:52 +0000
commit3010ee5514a16902c1c31fd8afbbd0285d0134c0 (patch)
treea86ebb4ea1de27932e3f5b6d6b3446334d6e4f1e /gcc/rtlanal.c
parentfb802d91461a2d65e9618abb6298c6ca7d39e7d7 (diff)
downloadgcc-3010ee5514a16902c1c31fd8afbbd0285d0134c0.zip
gcc-3010ee5514a16902c1c31fd8afbbd0285d0134c0.tar.gz
gcc-3010ee5514a16902c1c31fd8afbbd0285d0134c0.tar.bz2
Handle casesi dispatch tablejumps in create_trace_edges (as well)
* rtlanal.c (tablejump_casesi_pattern): New function, to determine if a tablejump insn is a casesi dispatcher. Extracted from patch_jump_insn. * rtl.h (tablejump_casesi_pattern): Declare. * cfgrtl.c (patch_jump_insn): Use it. * dwarf2cfi.c (create_trace_edges): Use it. testsuite/ * gnat.dg/casesi.ad[bs], test_casesi.adb: New test. From-SVN: r274377
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r--gcc/rtlanal.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 268a387..3c5a64e 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -3272,6 +3272,23 @@ tablejump_p (const rtx_insn *insn, rtx_insn **labelp,
return true;
}
+/* For INSN known to satisfy tablejump_p, determine if it actually is a
+ CASESI. Return the insn pattern if so, NULL_RTX otherwise. */
+
+rtx
+tablejump_casesi_pattern (const rtx_insn *insn)
+{
+ rtx tmp;
+
+ if ((tmp = single_set (insn)) != NULL
+ && SET_DEST (tmp) == pc_rtx
+ && GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
+ && GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
+ return tmp;
+
+ return NULL_RTX;
+}
+
/* A subroutine of computed_jump_p, return 1 if X contains a REG or MEM or
constant that is not in the constant pool and not in the condition
of an IF_THEN_ELSE. */