From 15e5c7dd0950b28e88c12feebf9c7ebdda1a564b Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 16 Nov 2002 02:55:47 +0100 Subject: [PATCH] jump.c (tablejump_p): New. * 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 | 6 ++++++ gcc/cfgcleanup.c | 3 ++- gcc/jump.c | 15 +++++++++++++++ gcc/rtl.h | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 81f01aaf4766..14d7d323696f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Sat Nov 16 02:54:29 CET 2002 Jan Hubicka + + * 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 * flow.c (life_analysis): Update LABEL_NUSES before purging diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 32ae77a3be63..12be4f523c6e 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -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; diff --git a/gcc/jump.c b/gcc/jump.c index 1a26b5924b93..14baeed32cfb 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -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. diff --git a/gcc/rtl.h b/gcc/rtl.h index 63b9f5812a44..388d38102844 100644 --- 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)); -- 2.47.2