Commit e6ae24bc by David Malcolm Committed by David Malcolm

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