]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jump.c (tablejump_p): New.
authorJan Hubicka <jh@suse.cz>
Sat, 16 Nov 2002 01:55:47 +0000 (02:55 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 16 Nov 2002 01:55:47 +0000 (01:55 +0000)
* jump.c (tablejump_p): New.
* cfgcleanup.c (try_optimize_cfg): Do not merge blocks across tablejump.
* rtl.h (tablejump_p): Declare.

From-SVN: r59149

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/jump.c
gcc/rtl.h

index 81f01aaf4766df6de855684c6e92a027ea277a6d..14d7d323696f621a71761b16f5b72a440ad49bed 100644 (file)
@@ -1,3 +1,9 @@
+Sat Nov 16 02:54:29 CET 2002  Jan Hubicka  <jh@suse.cz>
+
+       * jump.c (tablejump_p): New.
+       * cfgcleanup.c (try_optimize_cfg): Do not merge blocks across tablejump.
+       * rtl.h (tablejump_p): Declare.
+
 2002-11-16  Graham Stott  <graham.stott@btinternet.com>
 
        * flow.c (life_analysis): Update LABEL_NUSES before purging
index 32ae77a3be6398703f46d6987671d9989fc8e9fc..12be4f523c6eb124dc7760b3c3de3e6f3d51da6f 100644 (file)
@@ -1638,7 +1638,8 @@ try_optimize_cfg (mode)
                     /* If the jump insn has side effects,
                        we can't kill the edge.  */
                     && (GET_CODE (b->end) != JUMP_INSN
-                        || onlyjump_p (b->end))
+                        || (onlyjump_p (b->end)
+                            && !tablejump_p (b->end)))
                     && merge_blocks (s, b, c, mode))
                changed_here = true;
 
index 1a26b5924b931d4fb2e1a6e4886ba435f8a35041..14baeed32cfbc03901d0c0aa64be4663d25c2552 100644 (file)
@@ -1076,6 +1076,21 @@ simplejump_p (insn)
          && GET_CODE (SET_DEST (PATTERN (insn))) == PC
          && GET_CODE (SET_SRC (PATTERN (insn))) == LABEL_REF);
 }
+/* Return 1 if INSN is an tablejump.  */
+
+int
+tablejump_p (insn)
+     rtx insn;
+{
+  rtx table;
+  return (GET_CODE (insn) == JUMP_INSN
+         && JUMP_LABEL (insn)
+         && NEXT_INSN (JUMP_LABEL (insn))
+         && (table = next_active_insn (JUMP_LABEL (insn)))
+         && GET_CODE (table) == JUMP_INSN
+         && (GET_CODE (PATTERN (table)) == ADDR_VEC
+             || GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC));
+}
 
 /* Return nonzero if INSN is a (possibly) conditional jump
    and nothing more.
index 63b9f5812a449e8f42ec964569ed624c2be8a211..388d38102844291421ab6af445ced09dd3f903e0 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1804,6 +1804,7 @@ extern rtx pc_set                 PARAMS ((rtx));
 extern rtx condjump_label              PARAMS ((rtx));
 extern int simplejump_p                        PARAMS ((rtx));
 extern int returnjump_p                        PARAMS ((rtx));
+extern int tablejump_p                 PARAMS ((rtx));
 extern int onlyjump_p                  PARAMS ((rtx));
 extern int only_sets_cc0_p             PARAMS ((rtx));
 extern int sets_cc0_p                  PARAMS ((rtx));