rtx note;
bool really_delete = true;
- if (GET_CODE (insn) == CODE_LABEL)
+ if (LABEL_P (insn))
{
/* Some labels can't be directly removed from the INSN chain, as they
might be references via variables, constant pool etc.
/* If deleting a jump, decrement the use count of the label. Deleting
the label itself should happen in the normal course of block merging. */
- if (GET_CODE (insn) == JUMP_INSN
+ if (JUMP_P (insn)
&& JUMP_LABEL (insn)
- && GET_CODE (JUMP_LABEL (insn)) == CODE_LABEL)
+ && LABEL_P (JUMP_LABEL (insn)))
LABEL_NUSES (JUMP_LABEL (insn))--;
/* Also if deleting an insn that references a label. */
else
{
while ((note = find_reg_note (insn, REG_LABEL, NULL_RTX)) != NULL_RTX
- && GET_CODE (XEXP (note, 0)) == CODE_LABEL)
+ && LABEL_P (XEXP (note, 0)))
{
LABEL_NUSES (XEXP (note, 0))--;
remove_note (insn, note);
}
}
- if (GET_CODE (insn) == JUMP_INSN
+ if (JUMP_P (insn)
&& (GET_CODE (PATTERN (insn)) == ADDR_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC))
{
/* When deleting code in bulk (e.g. removing many unreachable
blocks) we can delete a label that's a target of the vector
before deleting the vector itself. */
- if (GET_CODE (label) != NOTE)
+ if (!NOTE_P (label))
LABEL_NUSES (label)--;
}
}
while (1)
{
next = NEXT_INSN (start);
- if (GET_CODE (start) == NOTE && !can_delete_note_p (start))
+ if (NOTE_P (start) && !can_delete_note_p (start))
;
else
next = delete_insn (start);
rtx after;
- if (GET_CODE (head) == CODE_LABEL)
+ if (LABEL_P (head))
after = head;
else
{
if (!head && !end)
head = end = bb_note
= emit_note_after (NOTE_INSN_BASIC_BLOCK, get_last_insn ());
- else if (GET_CODE (head) == CODE_LABEL && end)
+ else if (LABEL_P (head) && end)
{
bb_note = emit_note_after (NOTE_INSN_BASIC_BLOCK, head);
if (head == end)
for (insn = PREV_INSN (BB_HEAD (b)); insn; insn = PREV_INSN (insn))
{
- if (GET_CODE (insn) != NOTE)
+ if (!NOTE_P (insn))
break;
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION
|| NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_CONT)
insn = BB_HEAD (b);
- if (GET_CODE (insn) == CODE_LABEL)
+ if (LABEL_P (insn))
maybe_remove_eh_handler (insn);
/* Include any jump table following the basic block. */
/* Include any barrier that may follow the basic block. */
tmp = next_nonnote_insn (end);
- if (tmp && GET_CODE (tmp) == BARRIER)
+ if (tmp && BARRIER_P (tmp))
end = tmp;
/* Selectively delete the entire chain. */
{
rtx insn;
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (GET_CODE (insn) != BARRIER)
+ if (!BARRIER_P (insn))
BLOCK_FOR_INSN (insn) = NULL;
}
for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
{
- if (GET_CODE (insn) != BARRIER)
+ if (!BARRIER_P (insn))
set_block_for_insn (insn, bb);
if (insn == BB_END (bb))
break;
int b_empty = 0;
/* If there was a CODE_LABEL beginning B, delete it. */
- if (GET_CODE (b_head) == CODE_LABEL)
+ if (LABEL_P (b_head))
{
/* Detect basic blocks with nothing but a label. This can happen
in particular at the end of a function. */
}
/* If there was a jump out of A, delete it. */
- if (GET_CODE (a_end) == JUMP_INSN)
+ if (JUMP_P (a_end))
{
rtx prev;
for (prev = PREV_INSN (a_end); ; prev = PREV_INSN (prev))
- if (GET_CODE (prev) != NOTE
+ if (!NOTE_P (prev)
|| NOTE_LINE_NUMBER (prev) == NOTE_INSN_BASIC_BLOCK
|| prev == BB_HEAD (a))
break;
a_end = PREV_INSN (del_first);
}
- else if (GET_CODE (NEXT_INSN (a_end)) == BARRIER)
+ else if (BARRIER_P (NEXT_INSN (a_end)))
del_first = NEXT_INSN (a_end);
/* Delete everything marked above as well as crap that might be
&& a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR
/* If the jump insn has side effects,
we can't kill the edge. */
- && (GET_CODE (BB_END (a)) != JUMP_INSN
+ && (!JUMP_P (BB_END (a))
|| (reload_completed
? simplejump_p (BB_END (a)) : onlyjump_p (BB_END (a)))));
}
if (block == EXIT_BLOCK_PTR)
return NULL_RTX;
- if (GET_CODE (BB_HEAD (block)) != CODE_LABEL)
+ if (!LABEL_P (BB_HEAD (block)))
{
BB_HEAD (block) = emit_label_before (gen_label_rtx (), BB_HEAD (block));
}
/* Remove barriers but keep jumptables. */
while (insn)
{
- if (GET_CODE (insn) == BARRIER)
+ if (BARRIER_P (insn))
{
if (PREV_INSN (insn))
NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
if (NEXT_INSN (insn))
PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
}
- if (GET_CODE (insn) == CODE_LABEL)
+ if (LABEL_P (insn))
break;
insn = NEXT_INSN (insn);
}
delete_insn_chain (label, table);
barrier = next_nonnote_insn (BB_END (src));
- if (!barrier || GET_CODE (barrier) != BARRIER)
+ if (!barrier || !BARRIER_P (barrier))
emit_barrier_after (BB_END (src));
else
{
/* We don't want a block to end on a line-number note since that has
the potential of changing the code between -g and not -g. */
- while (GET_CODE (BB_END (e->src)) == NOTE
+ while (NOTE_P (BB_END (e->src))
&& NOTE_LINE_NUMBER (BB_END (e->src)) >= 0)
delete_insn (BB_END (e->src));
{
rtx last = insn;
- for (insn = NEXT_INSN (insn); insn && GET_CODE (insn) == NOTE
+ for (insn = NEXT_INSN (insn); insn && NOTE_P (insn)
&& NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK;
insn = NEXT_INSN (insn))
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
/* We can only redirect non-fallthru edges of jump insn. */
if (e->flags & EDGE_FALLTHRU)
return NULL;
- else if (GET_CODE (insn) != JUMP_INSN)
+ else if (!JUMP_P (insn))
return NULL;
/* Recognize a tablejump and adjust all matching cases. */
for (bb_note = BB_HEAD (jump_block);
bb_note && bb_note != NEXT_INSN (BB_END (jump_block));
bb_note = NEXT_INSN (bb_note))
- if (GET_CODE (bb_note) == NOTE
+ if (NOTE_P (bb_note)
&& NOTE_LINE_NUMBER (bb_note) == NOTE_INSN_BASIC_BLOCK)
break;
new_note = emit_note_after (NOTE_INSN_UNLIKELY_EXECUTED_CODE,
NOTE_BASIC_BLOCK (new_note) = jump_block;
jump_block->partition = COLD_PARTITION;
}
- if (GET_CODE (BB_END (jump_block)) == JUMP_INSN
+ if (JUMP_P (BB_END (jump_block))
&& !any_condjump_p (BB_END (jump_block))
&& jump_block->succ->crossing_edge )
REG_NOTES (BB_END (jump_block)) = gen_rtx_EXPR_LIST
If block B consisted only of this single jump, turn it into a deleted
note. */
q = BB_END (b);
- if (GET_CODE (q) == JUMP_INSN
+ if (JUMP_P (q)
&& onlyjump_p (q)
&& (any_uncondjump_p (q)
|| (b->succ == e && e->succ_next == NULL)))
/* We don't want a block to end on a line-number note since that has
the potential of changing the code between -g and not -g. */
- while (GET_CODE (q) == NOTE && NOTE_LINE_NUMBER (q) >= 0)
+ while (NOTE_P (q) && NOTE_LINE_NUMBER (q) >= 0)
q = PREV_INSN (q);
}
for (insn = BB_END (bb1); insn != BB_HEAD (bb2) && count >= 0;
insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == NOTE)
+ if (NOTE_P (insn))
{
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
count++;
if (edge_in->dest != EXIT_BLOCK_PTR
&& PREV_INSN (BB_HEAD (edge_in->dest))
- && GET_CODE (PREV_INSN (BB_HEAD (edge_in->dest))) == NOTE
+ && NOTE_P (PREV_INSN (BB_HEAD (edge_in->dest)))
&& (NOTE_LINE_NUMBER (PREV_INSN (BB_HEAD (edge_in->dest)))
== NOTE_INSN_LOOP_BEG)
&& !back_edge_of_syntactic_loop_p (edge_in->dest, edge_in->src))
{
before = NEXT_INSN (BB_END (edge_in->src));
if (before
- && GET_CODE (before) == NOTE
+ && NOTE_P (before)
&& NOTE_LINE_NUMBER (before) == NOTE_INSN_LOOP_END)
before = NEXT_INSN (before);
bb = create_basic_block (before, NULL, edge_in->src);
its return value. */
if (watch_calls && (e->flags & EDGE_FALLTHRU) && !e->dest->pred->pred_next
&& e->src != ENTRY_BLOCK_PTR
- && GET_CODE (BB_END (e->src)) == CALL_INSN)
+ && CALL_P (BB_END (e->src)))
{
rtx next = next_nonnote_insn (BB_END (e->src));
/* Get the location correct wrt a code label, and "nice" wrt
a basic block note, and before everything else. */
tmp = BB_HEAD (bb);
- if (GET_CODE (tmp) == CODE_LABEL)
+ if (LABEL_P (tmp))
tmp = NEXT_INSN (tmp);
if (NOTE_INSN_BASIC_BLOCK_P (tmp))
tmp = NEXT_INSN (tmp);
if (tmp
- && GET_CODE (tmp) == NOTE
+ && NOTE_P (tmp)
&& NOTE_LINE_NUMBER (tmp) == NOTE_INSN_UNLIKELY_EXECUTED_CODE)
tmp = NEXT_INSN (tmp);
if (tmp == BB_HEAD (bb))
We know this block has a single successor, so we can just emit
the queued insns before the jump. */
- if (GET_CODE (BB_END (bb)) == JUMP_INSN)
+ if (JUMP_P (BB_END (bb)))
for (before = BB_END (bb);
- GET_CODE (PREV_INSN (before)) == NOTE
+ NOTE_P (PREV_INSN (before))
&& NOTE_LINE_NUMBER (PREV_INSN (before)) ==
NOTE_INSN_LOOP_BEG; before = PREV_INSN (before))
;
bb_note = NULL_RTX;
for (cur_insn = BB_HEAD (bb); cur_insn != NEXT_INSN (BB_END (bb));
cur_insn = NEXT_INSN (cur_insn))
- if (GET_CODE (cur_insn) == NOTE
+ if (NOTE_P (cur_insn)
&& NOTE_LINE_NUMBER (cur_insn) == NOTE_INSN_BASIC_BLOCK)
{
bb_note = cur_insn;
new_note = emit_note_after (NOTE_INSN_UNLIKELY_EXECUTED_CODE,
bb_note);
NOTE_BASIC_BLOCK (new_note) = bb;
- if (GET_CODE (BB_END (bb)) == JUMP_INSN
+ if (JUMP_P (BB_END (bb))
&& !any_condjump_p (BB_END (bb))
&& bb->succ->crossing_edge )
REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
if (before)
delete_insn (before);
}
- else if (GET_CODE (last) == JUMP_INSN)
+ else if (JUMP_P (last))
abort ();
/* Mark the basic block for find_sub_basic_blocks. */
}
if (in_bb_p[INSN_UID (tmp_rtx)] == NOT_IN_BB
- && GET_CODE (tmp_rtx) != NOTE
- && GET_CODE (tmp_rtx) != BARRIER)
+ && !NOTE_P (tmp_rtx)
+ && !BARRIER_P (tmp_rtx))
fprintf (outf, ";; Insn is not within a basic block\n");
else if (in_bb_p[INSN_UID (tmp_rtx)] == IN_MULTIPLE_BB)
fprintf (outf, ";; Insn is in multiple basic blocks\n");
update_br_prob_note (basic_block bb)
{
rtx note;
- if (GET_CODE (BB_END (bb)) != JUMP_INSN)
+ if (!JUMP_P (BB_END (bb)))
return;
note = find_reg_note (BB_END (bb), REG_BR_PROB, NULL_RTX);
if (!note || INTVAL (XEXP (note, 0)) == BRANCH_EDGE (bb)->probability)
err = 1;
}
if (n_branch
- && (GET_CODE (BB_END (bb)) != JUMP_INSN
+ && (!JUMP_P (BB_END (bb))
|| (n_branch > 1 && (any_uncondjump_p (BB_END (bb))
|| any_condjump_p (BB_END (bb))))))
{
error ("Wrong amount of branch edges after conditional jump %i", bb->index);
err = 1;
}
- if (n_call && GET_CODE (BB_END (bb)) != CALL_INSN)
+ if (n_call && !CALL_P (BB_END (bb)))
{
error ("Call edges for non-call insn in bb %i", bb->index);
err = 1;
}
if (n_abnormal
- && (GET_CODE (BB_END (bb)) != CALL_INSN && n_call != n_abnormal)
- && (GET_CODE (BB_END (bb)) != JUMP_INSN
+ && (!CALL_P (BB_END (bb)) && n_call != n_abnormal)
+ && (!JUMP_P (BB_END (bb))
|| any_condjump_p (BB_END (bb))
|| any_uncondjump_p (BB_END (bb))))
{
block. It ought to contain optional CODE_LABEL followed
by NOTE_BASIC_BLOCK. */
x = BB_HEAD (bb);
- if (GET_CODE (x) == CODE_LABEL)
+ if (LABEL_P (x))
{
if (BB_END (bb) == x)
{
rtx insn;
/* Ensure existence of barrier in BB with no fallthru edges. */
- for (insn = BB_END (bb); !insn || GET_CODE (insn) != BARRIER;
+ for (insn = BB_END (bb); !insn || !BARRIER_P (insn);
insn = NEXT_INSN (insn))
if (!insn
- || (GET_CODE (insn) == NOTE
+ || (NOTE_P (insn)
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_BASIC_BLOCK))
{
error ("missing barrier after block %i", bb->index);
else
for (insn = NEXT_INSN (BB_END (e->src)); insn != BB_HEAD (e->dest);
insn = NEXT_INSN (insn))
- if (GET_CODE (insn) == BARRIER
+ if (BARRIER_P (insn)
#ifndef CASE_DROPS_THROUGH
|| INSN_P (insn)
#else
case CODE_LABEL:
/* An addr_vec is placed outside any basic block. */
if (NEXT_INSN (x)
- && GET_CODE (NEXT_INSN (x)) == JUMP_INSN
+ && JUMP_P (NEXT_INSN (x))
&& (GET_CODE (PATTERN (NEXT_INSN (x))) == ADDR_DIFF_VEC
|| GET_CODE (PATTERN (NEXT_INSN (x))) == ADDR_VEC))
x = NEXT_INSN (x);
}
if (INSN_P (x)
- && GET_CODE (x) == JUMP_INSN
+ && JUMP_P (x)
&& returnjump_p (x) && ! condjump_p (x)
- && ! (NEXT_INSN (x) && GET_CODE (NEXT_INSN (x)) == BARRIER))
+ && ! (NEXT_INSN (x) && BARRIER_P (NEXT_INSN (x))))
fatal_insn ("return not followed by barrier", x);
if (curr_bb && x == BB_END (curr_bb))
curr_bb = NULL;
bool purged = false;
/* If this instruction cannot trap, remove REG_EH_REGION notes. */
- if (GET_CODE (insn) == INSN
+ if (NONJUMP_INSN_P (insn)
&& (note = find_reg_note (insn, REG_EH_REGION, NULL)))
{
rtx eqnote;
}
else if (e->flags & EDGE_ABNORMAL_CALL)
{
- if (GET_CODE (BB_END (bb)) == CALL_INSN
+ if (CALL_P (BB_END (bb))
&& (! (note = find_reg_note (insn, REG_EH_REGION, NULL))
|| INTVAL (XEXP (note, 0)) >= 0))
continue;
purged = true;
}
- if (GET_CODE (insn) == JUMP_INSN)
+ if (JUMP_P (insn))
{
rtx note;
edge b,f;
return purged;
}
- else if (GET_CODE (insn) == CALL_INSN && SIBLING_CALL_P (insn))
+ else if (CALL_P (insn) && SIBLING_CALL_P (insn))
{
/* First, there should not be any EH or ABCALL edges resulting
from non-local gotos and the like. If there were, we shouldn't
if (e->flags & EDGE_FALLTHRU)
{
/* Redirect any branch edges unified with the fallthru one. */
- if (GET_CODE (BB_END (src)) == JUMP_INSN
+ if (JUMP_P (BB_END (src))
&& label_is_jump_target_p (BB_HEAD (e->dest),
BB_END (src)))
{
insn = bb->rbi->footer;
while (insn)
{
- if (GET_CODE (insn) == BARRIER)
+ if (BARRIER_P (insn))
{
if (PREV_INSN (insn))
NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
if (NEXT_INSN (insn))
PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
}
- if (GET_CODE (insn) == CODE_LABEL)
+ if (LABEL_P (insn))
break;
insn = NEXT_INSN (insn);
}
&& a != ENTRY_BLOCK_PTR && b != EXIT_BLOCK_PTR
/* If the jump insn has side effects,
we can't kill the edge. */
- && (GET_CODE (BB_END (a)) != JUMP_INSN
+ && (!JUMP_P (BB_END (a))
|| (reload_completed
? simplejump_p (BB_END (a)) : onlyjump_p (BB_END (a)))));
}
#endif
/* If there was a CODE_LABEL beginning B, delete it. */
- if (GET_CODE (BB_HEAD (b)) == CODE_LABEL)
+ if (LABEL_P (BB_HEAD (b)))
delete_insn (BB_HEAD (b));
/* We should have fallthru edge in a, or we can do dummy redirection to get
it cleaned up. */
- if (GET_CODE (BB_END (a)) == JUMP_INSN)
+ if (JUMP_P (BB_END (a)))
try_redirect_by_replacing_jump (a->succ, b, true);
- if (GET_CODE (BB_END (a)) == JUMP_INSN)
+ if (JUMP_P (BB_END (a)))
abort ();
/* Possible line number notes should appear in between. */
{
rtx insn = BB_END (bb);
- while (GET_CODE (insn) != CALL_INSN
+ while (!CALL_P (insn)
&& insn != BB_HEAD (bb)
&& keep_with_call_p (insn))
insn = PREV_INSN (insn);
- return (GET_CODE (insn) == CALL_INSN);
+ return (CALL_P (insn));
}
/* Return 1 if BB ends with a conditional branch, 0 otherwise. */
if (!INSN_P (insn))
return false;
- if ((GET_CODE (insn) == CALL_INSN
+ if ((CALL_P (insn)
&& !SIBLING_CALL_P (insn)
&& !find_reg_note (insn, REG_NORETURN, NULL)
&& !find_reg_note (insn, REG_ALWAYS_RETURN, NULL)
/* Don't split the block between a call and an insn that should
remain in the same block as the call. */
- if (GET_CODE (insn) == CALL_INSN)
+ if (CALL_P (insn))
while (split_at_insn != BB_END (bb)
&& keep_with_call_p (NEXT_INSN (split_at_insn)))
split_at_insn = NEXT_INSN (split_at_insn);