2014-08-21 David Malcolm <dmalcolm@redhat.com>
+ * basic-block.h (flow_find_cross_jump): Strengthen params 3 and 4
+ "f1" and "f2" from rtx * to rtx_insn **.
+ (flow_find_head_matching_sequence): Likewise.
+
+ * cfgcleanup.c (try_simplify_condjump): Strengthen local
+ "cbranch_insn" from rtx to rtx_insn *.
+ (thread_jump): Likewise for local "insn".
+ (try_forward_edges): Likewise for local "last".
+ (merge_blocks_move_predecessor_nojumps): Likewise for local "barrier".
+ (merge_blocks_move_successor_nojumps): Likewise for locals "barrier",
+ "real_b_end".
+ (can_replace_by): Likewise for params "i1", "i2".
+ (old_insns_match_p): Likewise.
+ (merge_notes): Likewise.
+ (walk_to_nondebug_insn): Likewise for param "i1".
+ (flow_find_cross_jump): Strengthen params "f1" and "f2" from rtx *
+ to rtx_insn **. Strengthen locals "i1", "i2", "last1", "last2",
+ "afterlast1", "afterlast2" from rtx to rtx_insn *.
+ (flow_find_head_matching_sequence): Strengthen params "f1" and
+ "f2" from rtx * to rtx_insn **. Strengthen locals "i1", "i2",
+ "last1", "last2", "beforelast1", "beforelast2" from rtx to
+ rtx_insn *.
+ (outgoing_edges_match): Likewise for locals "last1", "last2".
+ (try_crossjump_to_edge): Likewise for local "insn".
+ Replace call to for_each_rtx with for_each_rtx_in_insn.
+
+ (try_crossjump_to_edge): Likewise for locals "newpos1", "newpos2".
+ (try_head_merge_bb): Likewise for locals "e0_last_head_, "jump",
+ "e0_last", "e_last", "head", "curr", "insn". Strengthen locals
+ "headptr", "currptr", "nextptr" from rtx * to rtx_insn **.
+ (try_optimize_cfg): Strengthen local "last" from rtx to
+ rtx_insn *.
+ (delete_dead_jumptables): Likewise for locals "insn", "next",
+ "label".
+
+ * ifcvt.c (cond_exec_process_if_block): Likewise for locals
+ "rtx then_last_head", "rtx else_last_head", "rtx then_first_tail",
+ "rtx else_first_tail", to reflect the basic-block.h changes above.
+
+2014-08-21 David Malcolm <dmalcolm@redhat.com>
+
* cfgbuild.c (make_edges): Strengthen local "insn" from rtx to
rtx_insn *.
(purge_dead_tablejump_edges): Likewise.
static bool try_crossjump_to_edge (int, edge, edge, enum replace_direction);
static bool try_crossjump_bb (int, basic_block);
static bool outgoing_edges_match (int, basic_block, basic_block);
-static enum replace_direction old_insns_match_p (int, rtx, rtx);
+static enum replace_direction old_insns_match_p (int, rtx_insn *, rtx_insn *);
static void merge_blocks_move_predecessor_nojumps (basic_block, basic_block);
static void merge_blocks_move_successor_nojumps (basic_block, basic_block);
{
basic_block jump_block, jump_dest_block, cbranch_dest_block;
edge cbranch_jump_edge, cbranch_fallthru_edge;
- rtx cbranch_insn;
+ rtx_insn *cbranch_insn;
/* Verify that there are exactly two successors. */
if (EDGE_COUNT (cbranch_block->succs) != 2)
static edge
thread_jump (edge e, basic_block b)
{
- rtx set1, set2, cond1, cond2, insn;
+ rtx set1, set2, cond1, cond2;
+ rtx_insn *insn;
enum rtx_code code1, code2, reversed_code2;
bool reverse1 = false;
unsigned i;
if (LOCATION_LOCUS (new_locus) != UNKNOWN_LOCATION)
locus = new_locus;
- rtx last = BB_END (target);
+ rtx_insn *last = BB_END (target);
if (DEBUG_INSN_P (last))
last = prev_nondebug_insn (last);
if (last && INSN_P (last))
static void
merge_blocks_move_predecessor_nojumps (basic_block a, basic_block b)
{
- rtx barrier;
+ rtx_insn *barrier;
/* If we are partitioning hot/cold basic blocks, we don't want to
mess up unconditional or indirect jumps that cross between hot
static void
merge_blocks_move_successor_nojumps (basic_block a, basic_block b)
{
- rtx barrier, real_b_end;
+ rtx_insn *barrier, *real_b_end;
rtx label;
rtx_jump_table_data *table;
- dir_both if both are the case. */
static enum replace_direction
-can_replace_by (rtx i1, rtx i2)
+can_replace_by (rtx_insn *i1, rtx_insn *i2)
{
rtx s1, s2, d1, d2, src1, src2, note1, note2;
bool c1, c2;
- dir_both if both are the case. */
static enum replace_direction
-old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2)
+old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx_insn *i1, rtx_insn *i2)
{
rtx p1, p2;
flow_find_head_matching_sequence, ensure the notes match. */
static void
-merge_notes (rtx i1, rtx i2)
+merge_notes (rtx_insn *i1, rtx_insn *i2)
{
/* If the merged insns have different REG_EQUAL notes, then
remove them. */
DID_FALLTHRU. Otherwise, stops at the head of the bb. */
static void
-walk_to_nondebug_insn (rtx *i1, basic_block *bb1, bool follow_fallthru,
+walk_to_nondebug_insn (rtx_insn **i1, basic_block *bb1, bool follow_fallthru,
bool *did_fallthru)
{
edge fallthru;
store the head of the blocks in *F1 and *F2. */
int
-flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx *f1, rtx *f2,
- enum replace_direction *dir_p)
+flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx_insn **f1,
+ rtx_insn **f2, enum replace_direction *dir_p)
{
- rtx i1, i2, last1, last2, afterlast1, afterlast2;
+ rtx_insn *i1, *i2, *last1, *last2, *afterlast1, *afterlast2;
int ninsns = 0;
enum replace_direction dir, last_dir, afterlast_dir;
bool follow_fallthru, did_fallthru;
need to be compared for equivalence, which we'll do below. */
i1 = BB_END (bb1);
- last1 = afterlast1 = last2 = afterlast2 = NULL_RTX;
+ last1 = afterlast1 = last2 = afterlast2 = NULL;
if (onlyjump_p (i1)
|| (returnjump_p (i1) && !side_effects_p (PATTERN (i1))))
{
non-zero, only count active insns. */
int
-flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx *f1,
- rtx *f2, int stop_after)
+flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx_insn **f1,
+ rtx_insn **f2, int stop_after)
{
- rtx i1, i2, last1, last2, beforelast1, beforelast2;
+ rtx_insn *i1, *i2, *last1, *last2, *beforelast1, *beforelast2;
int ninsns = 0;
edge e;
edge_iterator ei;
i1 = BB_HEAD (bb1);
i2 = BB_HEAD (bb2);
- last1 = beforelast1 = last2 = beforelast2 = NULL_RTX;
+ last1 = beforelast1 = last2 = beforelast2 = NULL;
while (true)
{
stop when we see the NOTE_INSN_BASIC_BLOCK, as old_insns_match_p
handles that case specially. old_insns_match_p does not handle
other types of instruction notes. */
- rtx last1 = BB_END (bb1);
- rtx last2 = BB_END (bb2);
+ rtx_insn *last1 = BB_END (bb1);
+ rtx_insn *last2 = BB_END (bb2);
while (!NOTE_INSN_BASIC_BLOCK_P (last1) &&
(DEBUG_INSN_P (last1) || NOTE_P (last1)))
last1 = PREV_INSN (last1);
basic_block src1 = e1->src, src2 = e2->src;
basic_block redirect_to, redirect_from, to_remove;
basic_block osrc1, osrc2, redirect_edges_to, tmp;
- rtx newpos1, newpos2;
+ rtx_insn *newpos1, *newpos2;
edge s;
edge_iterator ei;
- newpos1 = newpos2 = NULL_RTX;
+ newpos1 = newpos2 = NULL;
/* If we have partitioned hot/cold basic blocks, it is a bad idea
to try this optimization.
SWAP (basic_block, osrc1, osrc2);
SWAP (basic_block, src1, src2);
SWAP (edge, e1, e2);
- SWAP (rtx, newpos1, newpos2);
+ SWAP (rtx_insn *, newpos1, newpos2);
#undef SWAP
}
&& label1 != label2)
{
replace_label_data rr;
- rtx insn;
+ rtx_insn *insn;
/* Replace references to LABEL1 with LABEL2. */
rr.r1 = label1;
a block whose end is a tablejump, the tablejump referenced
from the instruction is deleted too. */
if (insn != BB_END (osrc1))
- for_each_rtx (&insn, replace_label, &rr);
+ for_each_rtx_in_insn (&insn, replace_label, &rr);
}
}
}
basic_block final_dest_bb = NULL;
int max_match = INT_MAX;
edge e0;
- rtx *headptr, *currptr, *nextptr;
+ rtx_insn **headptr, **currptr, **nextptr;
bool changed, moveall;
unsigned ix;
- rtx e0_last_head, cond, move_before;
+ rtx_insn *e0_last_head;
+ rtx cond, move_before;
unsigned nedges = EDGE_COUNT (bb->succs);
- rtx jump = BB_END (bb);
+ rtx_insn *jump = BB_END (bb);
regset live, live_union;
/* Nothing to do if there is not at least two outgoing edges. */
}
e0 = EDGE_SUCC (bb, 0);
- e0_last_head = NULL_RTX;
+ e0_last_head = NULL;
changed = false;
for (ix = 1; ix < nedges; ix++)
{
edge e = EDGE_SUCC (bb, ix);
- rtx e0_last, e_last;
+ rtx_insn *e0_last, *e_last;
int nmatch;
nmatch = flow_find_head_matching_sequence (e0->dest, e->dest,
live = BITMAP_ALLOC (NULL);
live_union = BITMAP_ALLOC (NULL);
- currptr = XNEWVEC (rtx, nedges);
- headptr = XNEWVEC (rtx, nedges);
- nextptr = XNEWVEC (rtx, nedges);
+ currptr = XNEWVEC (rtx_insn *, nedges);
+ headptr = XNEWVEC (rtx_insn *, nedges);
+ nextptr = XNEWVEC (rtx_insn *, nedges);
for (ix = 0; ix < nedges; ix++)
{
int j;
basic_block merge_bb = EDGE_SUCC (bb, ix)->dest;
- rtx head = BB_HEAD (merge_bb);
+ rtx_insn *head = BB_HEAD (merge_bb);
while (!NONDEBUG_INSN_P (head))
head = NEXT_INSN (head);
break;
for (ix = 0; ix < nedges; ix++)
{
- rtx curr = currptr[ix];
+ rtx_insn *curr = currptr[ix];
do
curr = NEXT_INSN (curr);
while (!NONDEBUG_INSN_P (curr));
if (!moveall)
for (ix = 0; ix < nedges; ix++)
{
- rtx curr = currptr[ix];
+ rtx_insn *curr = currptr[ix];
do
curr = NEXT_INSN (curr);
while (!NONDEBUG_INSN_P (curr));
static bool
trivially_empty_bb_p (basic_block bb)
{
- rtx insn = BB_END (bb);
+ rtx_insn *insn = BB_END (bb);
while (1)
{
}
else
{
- rtx last = get_last_bb_insn (b);
+ rtx_insn *last = get_last_bb_insn (b);
if (last && BARRIER_P (last))
FOR_EACH_EDGE (e, ei, b->preds)
if ((e->flags & EDGE_FALLTHRU))
between two adjacent basic blocks. */
FOR_EACH_BB_FN (bb, cfun)
{
- rtx insn, next;
+ rtx_insn *insn, *next;
for (insn = NEXT_INSN (BB_END (bb));
insn && !NOTE_INSN_BASIC_BLOCK_P (insn);
&& LABEL_NUSES (insn) == LABEL_PRESERVE_P (insn)
&& JUMP_TABLE_DATA_P (next))
{
- rtx label = insn, jump = next;
+ rtx_insn *label = insn, *jump = next;
if (dump_file)
fprintf (dump_file, "Dead jumptable %i removed\n",