diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-08-22 17:08:24 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2014-08-22 17:08:24 +0000 |
commit | e6ae24bcee323d2adf4f8591a49a344b71e18dad (patch) | |
tree | 19860f9d0a83d43b95605eaf297098b71da98e91 /gcc/ifcvt.c | |
parent | da76d746a2652ecac3576986c206d2809333f1b4 (diff) | |
download | gcc-e6ae24bcee323d2adf4f8591a49a344b71e18dad.zip gcc-e6ae24bcee323d2adf4f8591a49a344b71e18dad.tar.gz gcc-e6ae24bcee323d2adf4f8591a49a344b71e18dad.tar.bz2 |
ifcvt.c: Use rtx_insn
gcc/
* ifcvt.c (count_bb_insns): Strengthen local "insn" from rtx to
rtx_insn *.
(cheap_bb_rtx_cost_p): Likewise.
(first_active_insn): Likewise for return type and local "insn".
(last_active_insn): Likewise for return type and locals "insn",
"head".
(struct noce_if_info): Likewise for fields "jump", "insn_a",
"insn_b".
(end_ifcvt_sequence): Likewise for return type and locals "insn",
"seq".
(noce_try_move): Likewise for local "seq".
(noce_try_store_flag): Likewise.
(noce_try_store_flag_constants): Likewise.
(noce_try_addcc): Likewise.
(noce_try_store_flag_mask): Likewise.
(noce_try_cmove): Likewise.
(noce_try_minmax): Likewise.
(noce_try_abs): Likewise.
(noce_try_sign_mask): Likewise.
(noce_try_bitop): Likewise.
(noce_can_store_speculate_p): Likewise for local "insn".
(noce_process_if_block): Likewise for locals "insn_a", "insn_b",
seq".
(check_cond_move_block): Likewise for local "insn".
(cond_move_convert_if_block): Likewise.
(cond_move_process_if_block): Likewise for locals "seq",
"loc_insn".
(noce_find_if_block): Likewise for local "jump".
(merge_if_block): Likewise for local "last".
(block_jumps_and_fallthru_p): Likewise for locals "insn", "end".
(find_cond_trap): Likewise for locals "trap", "jump", "newjump".
(block_has_only_trap): Likewise for return type and local "trap".
(find_if_case_1): Likewise for local "jump".
(dead_or_predicable): Likewise for locals "head", "end", "jump",
"insn".
From-SVN: r214335
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r-- | gcc/ifcvt.c | 136 |
1 files changed, 78 insertions, 58 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index c1894bb..4034b78 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -85,8 +85,8 @@ static int cond_exec_changed_p; /* Forward references. */ static int count_bb_insns (const_basic_block); static bool cheap_bb_rtx_cost_p (const_basic_block, int, int); -static rtx first_active_insn (basic_block); -static rtx last_active_insn (basic_block, int); +static rtx_insn *first_active_insn (basic_block); +static rtx_insn *last_active_insn (basic_block, int); static rtx find_active_insn_before (basic_block, rtx); static rtx find_active_insn_after (basic_block, rtx); static basic_block block_fallthru (basic_block); @@ -105,7 +105,7 @@ static int find_if_case_2 (basic_block, edge, edge); static int dead_or_predicable (basic_block, basic_block, basic_block, edge, int); static void noce_emit_move_insn (rtx, rtx); -static rtx block_has_only_trap (basic_block); +static rtx_insn *block_has_only_trap (basic_block); /* Count the number of non-jump active insns in BB. */ @@ -113,7 +113,7 @@ static int count_bb_insns (const_basic_block bb) { int count = 0; - rtx insn = BB_HEAD (bb); + rtx_insn *insn = BB_HEAD (bb); while (1) { @@ -140,7 +140,7 @@ static bool cheap_bb_rtx_cost_p (const_basic_block bb, int scale, int max_cost) { int count = 0; - rtx insn = BB_HEAD (bb); + rtx_insn *insn = BB_HEAD (bb); bool speed = optimize_bb_for_speed_p (bb); /* Set scale to REG_BR_PROB_BASE to void the identical scaling @@ -203,38 +203,38 @@ cheap_bb_rtx_cost_p (const_basic_block bb, int scale, int max_cost) /* Return the first non-jump active insn in the basic block. */ -static rtx +static rtx_insn * first_active_insn (basic_block bb) { - rtx insn = BB_HEAD (bb); + rtx_insn *insn = BB_HEAD (bb); if (LABEL_P (insn)) { if (insn == BB_END (bb)) - return NULL_RTX; + return NULL; insn = NEXT_INSN (insn); } while (NOTE_P (insn) || DEBUG_INSN_P (insn)) { if (insn == BB_END (bb)) - return NULL_RTX; + return NULL; insn = NEXT_INSN (insn); } if (JUMP_P (insn)) - return NULL_RTX; + return NULL; return insn; } /* Return the last non-jump active (non-jump) insn in the basic block. */ -static rtx +static rtx_insn * last_active_insn (basic_block bb, int skip_use_p) { - rtx insn = BB_END (bb); - rtx head = BB_HEAD (bb); + rtx_insn *insn = BB_END (bb); + rtx_insn *head = BB_HEAD (bb); while (NOTE_P (insn) || JUMP_P (insn) @@ -244,12 +244,12 @@ last_active_insn (basic_block bb, int skip_use_p) && GET_CODE (PATTERN (insn)) == USE)) { if (insn == head) - return NULL_RTX; + return NULL; insn = PREV_INSN (insn); } if (LABEL_P (insn)) - return NULL_RTX; + return NULL; return insn; } @@ -777,7 +777,7 @@ struct noce_if_info basic_block test_bb, then_bb, else_bb, join_bb; /* The jump that ends TEST_BB. */ - rtx jump; + rtx_insn *jump; /* The jump condition. */ rtx cond; @@ -791,7 +791,7 @@ struct noce_if_info COND_EARLIEST, or NULL_RTX. In the former case, the insn operands are still valid, as if INSN_B was moved down below the jump. */ - rtx insn_a, insn_b; + rtx_insn *insn_a, *insn_b; /* The SET_SRC of INSN_A and INSN_B. */ rtx a, b; @@ -1004,11 +1004,11 @@ noce_emit_move_insn (rtx x, rtx y) that are instructions are unshared, recognizable non-jump insns. On failure, this function returns a NULL_RTX. */ -static rtx +static rtx_insn * end_ifcvt_sequence (struct noce_if_info *if_info) { - rtx insn; - rtx seq = get_insns (); + rtx_insn *insn; + rtx_insn *seq = get_insns (); set_used_flags (if_info->x); set_used_flags (if_info->cond); @@ -1024,7 +1024,7 @@ end_ifcvt_sequence (struct noce_if_info *if_info) for (insn = seq; insn; insn = NEXT_INSN (insn)) if (JUMP_P (insn) || recog_memoized (insn) == -1) - return NULL_RTX; + return NULL; return seq; } @@ -1037,7 +1037,8 @@ noce_try_move (struct noce_if_info *if_info) { rtx cond = if_info->cond; enum rtx_code code = GET_CODE (cond); - rtx y, seq; + rtx y; + rtx_insn *seq; if (code != NE && code != EQ) return FALSE; @@ -1087,7 +1088,8 @@ static int noce_try_store_flag (struct noce_if_info *if_info) { int reversep; - rtx target, seq; + rtx target; + rtx_insn *seq; if (CONST_INT_P (if_info->b) && INTVAL (if_info->b) == STORE_FLAG_VALUE @@ -1130,7 +1132,8 @@ noce_try_store_flag (struct noce_if_info *if_info) static int noce_try_store_flag_constants (struct noce_if_info *if_info) { - rtx target, seq; + rtx target; + rtx_insn *seq; int reversep; HOST_WIDE_INT itrue, ifalse, diff, tmp; int normalize, can_reverse; @@ -1260,7 +1263,8 @@ noce_try_store_flag_constants (struct noce_if_info *if_info) static int noce_try_addcc (struct noce_if_info *if_info) { - rtx target, seq; + rtx target; + rtx_insn *seq; int subtract, normalize; if (GET_CODE (if_info->a) == PLUS @@ -1350,7 +1354,8 @@ noce_try_addcc (struct noce_if_info *if_info) static int noce_try_store_flag_mask (struct noce_if_info *if_info) { - rtx target, seq; + rtx target; + rtx_insn *seq; int reversep; reversep = 0; @@ -1510,7 +1515,8 @@ static int noce_try_cmove (struct noce_if_info *if_info) { enum rtx_code code; - rtx target, seq; + rtx target; + rtx_insn *seq; if ((CONSTANT_P (if_info->a) || register_operand (if_info->a, VOIDmode)) && (CONSTANT_P (if_info->b) || register_operand (if_info->b, VOIDmode))) @@ -1900,7 +1906,8 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target, static int noce_try_minmax (struct noce_if_info *if_info) { - rtx cond, earliest, target, seq; + rtx cond, earliest, target; + rtx_insn *seq; enum rtx_code code, op; int unsignedp; @@ -1995,7 +2002,8 @@ noce_try_minmax (struct noce_if_info *if_info) static int noce_try_abs (struct noce_if_info *if_info) { - rtx cond, earliest, target, seq, a, b, c; + rtx cond, earliest, target, a, b, c; + rtx_insn *seq; int negate; bool one_cmpl = false; @@ -2140,7 +2148,8 @@ noce_try_abs (struct noce_if_info *if_info) static int noce_try_sign_mask (struct noce_if_info *if_info) { - rtx cond, t, m, c, seq; + rtx cond, t, m, c; + rtx_insn *seq; enum machine_mode mode; enum rtx_code code; bool t_unconditional; @@ -2218,7 +2227,8 @@ noce_try_sign_mask (struct noce_if_info *if_info) static int noce_try_bitop (struct noce_if_info *if_info) { - rtx cond, x, a, result, seq; + rtx cond, x, a, result; + rtx_insn *seq; enum machine_mode mode; enum rtx_code code; int bitnum; @@ -2453,7 +2463,7 @@ noce_can_store_speculate_p (basic_block top_bb, const_rtx mem) dominator != NULL; dominator = get_immediate_dominator (CDI_POST_DOMINATORS, dominator)) { - rtx insn; + rtx_insn *insn; FOR_BB_INSNS (dominator, insn) { @@ -2490,7 +2500,7 @@ noce_process_if_block (struct noce_if_info *if_info) basic_block join_bb = if_info->join_bb; /* JOIN */ rtx jump = if_info->jump; rtx cond = if_info->cond; - rtx insn_a, insn_b; + rtx_insn *insn_a, *insn_b; rtx set_a, set_b; rtx orig_x, x, a, b; @@ -2557,7 +2567,10 @@ noce_process_if_block (struct noce_if_info *if_info) || reg_overlap_mentioned_p (x, cond) || reg_overlap_mentioned_p (x, a) || modified_between_p (x, insn_b, jump)) - insn_b = set_b = NULL_RTX; + { + insn_b = NULL; + set_b = NULL_RTX; + } } /* If x has side effects then only the if-then-else form is safe to @@ -2626,7 +2639,7 @@ noce_process_if_block (struct noce_if_info *if_info) if ((note = find_reg_note (insn_b, REG_EQUAL, NULL_RTX)) != 0) remove_note (insn_b, note); - insn_b = NULL_RTX; + insn_b = NULL; } /* If we have "x = b; if (...) x = a;", and x has side-effects, then x must be executed twice. */ @@ -2693,7 +2706,8 @@ noce_process_if_block (struct noce_if_info *if_info) if (!else_bb && set_b) { - insn_b = set_b = NULL_RTX; + insn_b = NULL; + set_b = NULL_RTX; b = orig_x; goto retry; } @@ -2705,7 +2719,7 @@ noce_process_if_block (struct noce_if_info *if_info) /* If we used a temporary, fix it up now. */ if (orig_x != x) { - rtx seq; + rtx_insn *seq; start_sequence (); noce_emit_move_insn (orig_x, x); @@ -2755,7 +2769,7 @@ check_cond_move_block (basic_block bb, vec<rtx> *regs, rtx cond) { - rtx insn; + rtx_insn *insn; /* We can only handle simple jumps at the end of the basic block. It is almost impossible to update the CFG otherwise. */ @@ -2836,7 +2850,8 @@ cond_move_convert_if_block (struct noce_if_info *if_infop, bool else_block_p) { enum rtx_code code; - rtx insn, cond_arg0, cond_arg1; + rtx_insn *insn; + rtx cond_arg0, cond_arg1; code = GET_CODE (cond); cond_arg0 = XEXP (cond, 0); @@ -2900,7 +2915,7 @@ cond_move_process_if_block (struct noce_if_info *if_info) basic_block join_bb = if_info->join_bb; rtx jump = if_info->jump; rtx cond = if_info->cond; - rtx seq, loc_insn; + rtx_insn *seq, *loc_insn; rtx reg; int c; vec<rtx> then_regs = vNULL; @@ -3027,7 +3042,8 @@ noce_find_if_block (basic_block test_bb, edge then_edge, edge else_edge, { basic_block then_bb, else_bb, join_bb; bool then_else_reversed = false; - rtx jump, cond; + rtx_insn *jump; + rtx cond; rtx cond_earliest; struct noce_if_info if_info; @@ -3223,7 +3239,7 @@ merge_if_block (struct ce_if_block * ce_info) if (! join_bb) { - rtx last = BB_END (combo_bb); + rtx_insn *last = BB_END (combo_bb); /* The outgoing edge for the current COMBO block should already be correct. Verify this. */ @@ -3378,8 +3394,8 @@ block_jumps_and_fallthru_p (basic_block cur_bb, basic_block target_bb) edge cur_edge; int fallthru_p = FALSE; int jump_p = FALSE; - rtx insn; - rtx end; + rtx_insn *insn; + rtx_insn *end; int n_insns = 0; edge_iterator ei; @@ -3681,7 +3697,8 @@ find_cond_trap (basic_block test_bb, edge then_edge, edge else_edge) basic_block then_bb = then_edge->dest; basic_block else_bb = else_edge->dest; basic_block other_bb, trap_bb; - rtx trap, jump, cond, cond_earliest, seq; + rtx_insn *trap, *jump; + rtx cond, cond_earliest, seq; enum rtx_code code; /* Locate the block with the trap instruction. */ @@ -3751,7 +3768,8 @@ find_cond_trap (basic_block test_bb, edge then_edge, edge else_edge) single_succ_edge (test_bb)->flags |= EDGE_FALLTHRU; else if (trap_bb == then_bb) { - rtx lab, newjump; + rtx lab; + rtx_insn *newjump; lab = JUMP_LABEL (jump); newjump = emit_jump_insn_after (gen_jump (lab), jump); @@ -3774,25 +3792,25 @@ find_cond_trap (basic_block test_bb, edge then_edge, edge else_edge) /* Subroutine of find_cond_trap: if BB contains only a trap insn, return it. */ -static rtx +static rtx_insn * block_has_only_trap (basic_block bb) { - rtx trap; + rtx_insn *trap; /* We're not the exit block. */ if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) - return NULL_RTX; + return NULL; /* The block must have no successors. */ if (EDGE_COUNT (bb->succs) > 0) - return NULL_RTX; + return NULL; /* The only instruction in the THEN block must be the trap. */ trap = first_active_insn (bb); if (! (trap == BB_END (bb) && GET_CODE (PATTERN (trap)) == TRAP_IF && TRAP_CONDITION (PATTERN (trap)) == const_true_rtx)) - return NULL_RTX; + return NULL; return trap; } @@ -3940,7 +3958,7 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge) if (else_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) { - rtx jump = BB_END (else_edge->src); + rtx_insn *jump = BB_END (else_edge->src); gcc_assert (JUMP_P (jump)); else_target = JUMP_LABEL (jump); } @@ -4115,7 +4133,8 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, basic_block other_bb, edge dest_edge, int reversep) { basic_block new_dest = dest_edge->dest; - rtx head, end, jump, earliest = NULL_RTX, old_dest; + rtx_insn *head, *end, *jump; + rtx earliest = NULL_RTX, old_dest; bitmap merge_set = NULL; /* Number of pending changes. */ int n_validated_changes = 0; @@ -4145,7 +4164,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, { if (head == end) { - head = end = NULL_RTX; + head = end = NULL; goto no_body; } head = NEXT_INSN (head); @@ -4159,7 +4178,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, return FALSE; if (head == end) { - head = end = NULL_RTX; + head = end = NULL; goto no_body; } end = PREV_INSN (end); @@ -4171,7 +4190,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, can lead to one of the paths of the branch having wrong unwind info. */ if (epilogue_completed) { - rtx insn = head; + rtx_insn *insn = head; while (1) { if (INSN_P (insn) && RTX_FRAME_RELATED_P (insn)) @@ -4232,7 +4251,8 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, /* Try the NCE path if the CE path did not result in any changes. */ if (n_validated_changes == 0) { - rtx cond, insn; + rtx cond; + rtx_insn *insn; regset live; bool success; @@ -4369,7 +4389,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, /* Move the insns out of MERGE_BB to before the branch. */ if (head != NULL) { - rtx insn; + rtx_insn *insn; if (end == BB_END (merge_bb)) SET_BB_END (merge_bb) = PREV_INSN (head); |