From 592a16fca09f8a595037e8b693f698a95390c899 Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Tue, 5 Nov 2013 21:57:45 +0000 Subject: [PATCH] rtlanal.c (tablejump_p): Expect a JUMP_TABLE_DATA to always follow immediately after a label for a... * rtlanal.c (tablejump_p): Expect a JUMP_TABLE_DATA to always follow immediately after a label for a tablejump pattern. * config/arm/arm.c (is_jump_table): Remove. (create_fix_barrier): Use tablejump_p instead. (arm_reorg): Likewise. (thumb1_output_casesi): Expect JUMP_TABLE_DATA to always be NEXT_INSN. (thumb2_output_casesi): Likewise. * config/aarch64/aarch64.c (aarch64_output_casesi): Likewise. * config/sh/sh.md (casesi_worker_1, casesi_worker_2, casesi_shift_media, casesi_load_media): Likewise. * config/iq2000/iq2000.md: Likewise (in anonymous define_insn). * config/microblaze/microblaze.md: Likewise. From-SVN: r204424 --- gcc/ChangeLog | 17 +++++++++++++++++ gcc/config/aarch64/aarch64.c | 2 +- gcc/config/arm/arm.c | 28 ++++------------------------ gcc/config/iq2000/iq2000.md | 5 ++--- gcc/config/microblaze/microblaze.md | 5 ++--- gcc/config/sh/sh.md | 8 ++++---- gcc/rtlanal.c | 3 +-- 7 files changed, 31 insertions(+), 37 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 66de2f9..2727156 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2013-11-05 Steven Bosscher + + + * rtlanal.c (tablejump_p): Expect a JUMP_TABLE_DATA to always follow + immediately after a label for a tablejump pattern. + + * config/arm/arm.c (is_jump_table): Remove. + (create_fix_barrier): Use tablejump_p instead. + (arm_reorg): Likewise. + (thumb1_output_casesi): Expect JUMP_TABLE_DATA to always be NEXT_INSN. + (thumb2_output_casesi): Likewise. + * config/aarch64/aarch64.c (aarch64_output_casesi): Likewise. + * config/sh/sh.md (casesi_worker_1, casesi_worker_2, + casesi_shift_media, casesi_load_media): Likewise. + * config/iq2000/iq2000.md: Likewise (in anonymous define_insn). + * config/microblaze/microblaze.md: Likewise. + 2013-11-05 Tobias Burnus * doc/invoke.texi (-Wdate-time): Document. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 83d0c66..30c8eb0 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -4329,7 +4329,7 @@ aarch64_output_casesi (rtx *operands) { char buf[100]; char label[100]; - rtx diff_vec = PATTERN (next_active_insn (operands[2])); + rtx diff_vec = PATTERN (NEXT_INSN (operands[2])); int index; static const char *const patterns[4][2] = { diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 23dfc0e..7757e86 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -95,13 +95,11 @@ static bool arm_print_operand_punct_valid_p (unsigned char code); static const char *fp_const_from_val (REAL_VALUE_TYPE *); static arm_cc get_arm_condition_code (rtx); static HOST_WIDE_INT int_log2 (HOST_WIDE_INT); -static rtx is_jump_table (rtx); static const char *output_multi_immediate (rtx *, const char *, const char *, int, HOST_WIDE_INT); static const char *shift_op (rtx, HOST_WIDE_INT *); static struct machine_function *arm_init_machine_status (void); static void thumb_exit (FILE *, int); -static rtx is_jump_table (rtx); static HOST_WIDE_INT get_jump_table_size (rtx); static Mnode *move_minipool_fix_forward_ref (Mnode *, Mnode *, HOST_WIDE_INT); static Mnode *add_minipool_forward_ref (Mfix *); @@ -15468,23 +15466,6 @@ Mfix * minipool_fix_tail; /* The fix entry for the current minipool, once it has been placed. */ Mfix * minipool_barrier; -/* Determines if INSN is the start of a jump table. Returns the end - of the TABLE or NULL_RTX. */ -static rtx -is_jump_table (rtx insn) -{ - rtx table; - - if (jump_to_label_p (insn) - && ((table = next_active_insn (JUMP_LABEL (insn))) - == next_active_insn (insn)) - && table != NULL - && JUMP_TABLE_DATA_P (table)) - return table; - - return NULL_RTX; -} - #ifndef JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION 0 #endif @@ -16093,8 +16074,7 @@ create_fix_barrier (Mfix *fix, HOST_WIDE_INT max_address) count += get_attr_length (from); /* If there is a jump table, add its length. */ - tmp = is_jump_table (from); - if (tmp != NULL) + if (tablejump_p (from, NULL, &tmp)) { count += get_jump_table_size (tmp); @@ -16700,7 +16680,7 @@ arm_reorg (void) /* If the insn is a vector jump, add the size of the table and skip the table. */ - if ((table = is_jump_table (insn)) != NULL) + if (tablejump_p (insn, NULL, &table)) { address += get_jump_table_size (table); insn = table; @@ -28610,7 +28590,7 @@ arm_output_iwmmxt_tinsr (rtx *operands) const char * thumb1_output_casesi (rtx *operands) { - rtx diff_vec = PATTERN (next_active_insn (operands[0])); + rtx diff_vec = PATTERN (NEXT_INSN (operands[0])); gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC); @@ -28633,7 +28613,7 @@ thumb1_output_casesi (rtx *operands) const char * thumb2_output_casesi (rtx *operands) { - rtx diff_vec = PATTERN (next_active_insn (operands[2])); + rtx diff_vec = PATTERN (NEXT_INSN (operands[2])); gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC); diff --git a/gcc/config/iq2000/iq2000.md b/gcc/config/iq2000/iq2000.md index 9e61cdd..7a516c1 100644 --- a/gcc/config/iq2000/iq2000.md +++ b/gcc/config/iq2000/iq2000.md @@ -1398,9 +1398,8 @@ (plus:SI (match_operand:SI 0 "register_operand" "d") (label_ref:SI (match_operand 1 "" "")))) (use (label_ref:SI (match_dup 1)))] - "!(Pmode == DImode) && next_active_insn (insn) != 0 - && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC - && PREV_INSN (next_active_insn (insn)) == operands[1]" + "!(Pmode == DImode) && NEXT_INSN (operands[1]) != 0 + && GET_CODE (PATTERN (NEXT_INSN (operands[1]))) == ADDR_DIFF_VEC" "* { return \"j\\t%0\"; diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md index 40d2739..8a526f1 100644 --- a/gcc/config/microblaze/microblaze.md +++ b/gcc/config/microblaze/microblaze.md @@ -1798,9 +1798,8 @@ (plus:SI (match_operand:SI 0 "register_operand" "d") (label_ref:SI (match_operand 1 "" "")))) (use (label_ref:SI (match_dup 1)))] - "next_active_insn (insn) != 0 - && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC - && PREV_INSN (next_active_insn (insn)) == operands[1] + "NEXT_INSN (operands[1]) != 0 + && GET_CODE (PATTERN (NEXT_INSN (operands[1]))) == ADDR_DIFF_VEC && flag_pic" { output_asm_insn ("addk\t%0,%0,r20",operands); diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index b8109e6..364226b 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -10827,7 +10827,7 @@ label: (clobber (match_scratch:SI 3 "=X,1"))] "TARGET_SH1" { - rtx diff_vec = PATTERN (next_active_insn (operands[2])); + rtx diff_vec = PATTERN (NEXT_INSN (operands[2])); gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC); @@ -10861,7 +10861,7 @@ label: (clobber (match_operand:SI 4 "" "=X,1"))] "TARGET_SH2 && reload_completed && flag_pic" { - rtx diff_vec = PATTERN (next_active_insn (operands[2])); + rtx diff_vec = PATTERN (NEXT_INSN (operands[2])); gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC); switch (GET_MODE (diff_vec)) @@ -10899,7 +10899,7 @@ label: UNSPEC_CASESI)))] "TARGET_SHMEDIA" { - rtx diff_vec = PATTERN (next_active_insn (operands[2])); + rtx diff_vec = PATTERN (NEXT_INSN (operands[2])); gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC); @@ -10926,7 +10926,7 @@ label: (label_ref:DI (match_operand 3 "" ""))] UNSPEC_CASESI)))] "TARGET_SHMEDIA" { - rtx diff_vec = PATTERN (next_active_insn (operands[3])); + rtx diff_vec = PATTERN (NEXT_INSN (operands[3])); gcc_assert (GET_CODE (diff_vec) == ADDR_DIFF_VEC); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 9769b69..b9f3e2b 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -2742,10 +2742,9 @@ tablejump_p (const_rtx insn, rtx *labelp, rtx *tablep) label = JUMP_LABEL (insn); if (label != NULL_RTX && !ANY_RETURN_P (label) - && (table = next_active_insn (label)) != NULL_RTX + && (table = NEXT_INSN (label)) != NULL_RTX && JUMP_TABLE_DATA_P (table)) { - gcc_assert (table == NEXT_INSN (label)); if (labelp) *labelp = label; if (tablep) -- 2.7.4