From 8942ee0fbfe5361a71c51401933efd1938725dec Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 19 Aug 2014 19:19:13 +0000 Subject: Make tablejump_p accept a rtx_jump_table_data ** 2014-08-19 David Malcolm * rtl.h (tablejump_p): Strengthen third param from rtx * to rtx_jump_table_data **. * cfgbuild.c (make_edges): Introduce local "table", using it in place of "tmp" for jump table data. (find_bb_boundaries): Strengthen local "table" from rtx to rtx_jump_table_data *. * cfgcleanup.c (merge_blocks_move_successor_nojumps): Likewise. (outgoing_edges_match): Likewise for locals "table1" and "table2". (try_crossjump_to_edge): Likewise. * cfgrtl.c (try_redirect_by_replacing_jump): Likewise for local "table". (patch_jump_insn): Introduce local "table", using it in place of "tmp" for jump table data. (force_nonfallthru_and_redirect): Introduce local "table", so that call to tablejump_p can receive an rtx_jump_table_data **. Update logic around the call to overwrite "note" appropriately if tablejump_p returns non-zero. (get_last_bb_insn): Introduce local "table", using it in place of "tmp" for jump table data. * dwarf2cfi.c (create_trace_edges): Likewise. * config/arm/arm.c (get_jump_table_size): Strengthen param "insn" from rtx to rtx_jump_table_data *. (create_fix_barrier): Strengthen local "tmp" from rtx to rtx_jump_table_data *. (arm_reorg): Likewise for local "table". * config/s390/s390.c (s390_chunkify_start): Likewise. * config/spu/spu.c (spu_emit_branch_hint): Likewise. * jump.c (delete_related_insns): Strengthen local "lab_next" from rtx to rtx_jump_table_data *. * rtlanal.c (tablejump_p): Strengthen param "tablep" from rtx * to rtx_jump_table_data **. Add a checked cast when writing through the pointer: we know there that local "table" is non-NULL and that JUMP_TABLE_DATA_P (table) holds. (label_is_jump_target_p): Introduce local "table", using it in place of "tmp" for jump table data. From-SVN: r214184 --- gcc/cfgrtl.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'gcc/cfgrtl.c') diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 2ff75223089..5babdf9d15f 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1099,7 +1099,8 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout) else { rtx target_label = block_label (target); - rtx barrier, label, table; + rtx barrier, label; + rtx_jump_table_data *table; emit_jump_insn_after_noloc (gen_jump (target_label), insn); JUMP_LABEL (BB_END (src)) = target_label; @@ -1172,9 +1173,10 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout) static bool patch_jump_insn (rtx insn, rtx old_label, basic_block new_bb) { + rtx_jump_table_data *table; rtx tmp; /* Recognize a tablejump and adjust all matching cases. */ - if (tablejump_p (insn, NULL, &tmp)) + if (tablejump_p (insn, NULL, &table)) { rtvec vec; int j; @@ -1182,10 +1184,10 @@ patch_jump_insn (rtx insn, rtx old_label, basic_block new_bb) if (new_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) return false; - if (GET_CODE (PATTERN (tmp)) == ADDR_VEC) - vec = XVEC (PATTERN (tmp), 0); + if (GET_CODE (PATTERN (table)) == ADDR_VEC) + vec = XVEC (PATTERN (table), 0); else - vec = XVEC (PATTERN (tmp), 1); + vec = XVEC (PATTERN (table), 1); for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j) if (XEXP (RTVEC_ELT (vec, j), 0) == old_label) @@ -1607,7 +1609,10 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label) /* If the old block ended with a tablejump, skip its table by searching forward from there. Otherwise start searching forward from the last instruction of the old block. */ - if (!tablejump_p (BB_END (e->src), NULL, ¬e)) + rtx_jump_table_data *table; + if (tablejump_p (BB_END (e->src), NULL, &table)) + note = table; + else note = BB_END (e->src); note = NEXT_INSN (note); @@ -2234,12 +2239,13 @@ update_br_prob_note (basic_block bb) rtx get_last_bb_insn (basic_block bb) { + rtx_jump_table_data *table; rtx tmp; rtx end = BB_END (bb); /* Include any jump table following the basic block. */ - if (tablejump_p (end, NULL, &tmp)) - end = tmp; + if (tablejump_p (end, NULL, &table)) + end = table; /* Include any barriers that may follow the basic block. */ tmp = next_nonnote_insn_bb (end); -- cgit v1.2.1