+2014-09-15 Trevor Saunders <tsaunders@mozilla.com>
+
+ * cfgrtl.c, combine.c, config/arc/arc.c, config/mcore/mcore.c,
+ config/rs6000/rs6000.c, config/sh/sh.c, cprop.c, dwarf2out.c,
+ emit-rtl.c, final.c, function.c, gcse.c, jump.c, reg-stack.c,
+ reload1.c, reorg.c, resource.c, sel-sched-ir.c: Replace INSN_DELETED_P
+ macro with statically checked member functions.
+ * rtl.h (rtx_insn::deleted): New method.
+ (rtx_insn::set_deleted): Likewise.
+ (rtx_insn::set_undeleted): Likewise.
+ (INSN_DELETED_P): Remove.
+
2014-09-15 Trevor Saunders <tsaunders@mozilla.com>
* config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Assign the
if (really_delete)
{
/* If this insn has already been deleted, something is very wrong. */
- gcc_assert (!INSN_DELETED_P (insn));
+ gcc_assert (!insn->deleted ());
if (INSN_P (insn))
df_insn_delete (insn);
remove_insn (insn);
- INSN_DELETED_P (insn) = 1;
+ insn->set_deleted ();
}
/* If deleting a jump, decrement the use count of the label. Deleting
else
delete_insn (current);
- if (clear_bb && !INSN_DELETED_P (current))
+ if (clear_bb && !current->deleted ())
set_block_for_insn (current, NULL);
if (current == start)
if (GET_CODE (PATTERN (insn)) != USE)
{
/* We're not deleting it, we're moving it. */
- INSN_DELETED_P (insn) = 0;
+ insn->set_undeleted ();
SET_PREV_INSN (insn) = NULL_RTX;
SET_NEXT_INSN (insn) = NULL_RTX;
continue;
while (last_combined_insn
- && INSN_DELETED_P (last_combined_insn))
+ && last_combined_insn->deleted ())
last_combined_insn = PREV_INSN (last_combined_insn);
if (last_combined_insn == NULL_RTX
|| BARRIER_P (last_combined_insn)
rtx_insn *delay = final_sequence->insn (1);
/* For TARGET_PAD_RETURN we might have grabbed the delay insn. */
- if (INSN_DELETED_P (delay))
+ if (delay->deleted ())
return;
if (JUMP_P (jump) && INSN_ANNULLED_BRANCH_P (jump))
fputs (INSN_FROM_TARGET_P (delay) ? ".d"
{
rtx insn = XVECEXP (PATTERN (seq_insn), 0, 1);
- if (!INSN_DELETED_P (insn)
+ if (!as_a<rtx_insn *> (insn)->deleted ()
&& INSN_ANNULLED_BRANCH_P (jump)
&& (TARGET_AT_DBR_CONDEXEC || INSN_FROM_TARGET_P (insn)))
{
return 0;
/* Do not do this if we have a filled delay slot. */
if (get_attr_delay_slot_filled (branch) == DELAY_SLOT_FILLED_YES
- && !INSN_DELETED_P (NEXT_INSN (branch)))
+ && !NEXT_INSN (branch)->deleted ())
return 0;
note = find_reg_note (branch, REG_BR_PROB, 0);
return (!note
rtx save_pred = current_insn_predicate;
final_scan_insn (prev, asm_out_file, optimize, 1, NULL);
cfun->machine->force_short_suffix = -1;
- INSN_DELETED_P (prev) = 1;
+ prev->set_deleted ();
current_output_insn = insn;
current_insn_predicate = save_pred;
}
final_sequence = 0;
final_scan_insn (seq->insn (1), asm_out_file, optimize, 1, & seen);
final_scan_insn (seq->insn (0), asm_out_file, optimize, 1, & seen);
- INSN_DELETED_P (seq->insn (1)) = 1;
+ seq->insn (1)->set_deleted ();
return "";
}
}
{
rtx_insn *newinsn;
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
/* Try to form a conditional variant of the instruction and emit it. */
{
final_scan_insn (final_sequence->insn (1),
asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (final_sequence->insn (1)) = 1;
+ final_sequence->insn (1)->set_deleted ();
}
else
output_asm_insn ("nop", 0);
{
final_scan_insn (final_sequence->insn (1),
asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (final_sequence->insn (1)) = 1;
+ final_sequence->insn (1)->set_deleted ();
}
else
output_asm_insn ("nop", 0);
df_insn_delete (insn);
remove_insn (insn);
- INSN_DELETED_P (insn) = 1;
+ insn->set_deleted ();
}
/* Dump the swap table to DUMP_FILE. */
{
final_scan_insn (seq->insn (1), asm_out_file, optimize, 1, NULL);
- INSN_DELETED_P (seq->insn (1)) = 1;
+ seq->insn (1)->set_deleted ();
}
const char *
rtx dest;
/* First, check if we already have an instruction that satisfies our need. */
- if (prev && NONJUMP_INSN_P (prev) && ! INSN_DELETED_P (prev))
+ if (prev && NONJUMP_INSN_P (prev) && ! prev->deleted ())
{
if (INSN_CODE (prev) == CODE_FOR_indirect_jump_scratch)
return prev;
{
enum rtx_code code;
- if (INSN_DELETED_P (scan))
+ if (scan->deleted ())
continue;
code = GET_CODE (scan);
if (code == CODE_LABEL || code == JUMP_INSN)
{
enum rtx_code code;
- if (INSN_DELETED_P (scan))
+ if (scan->deleted ())
continue;
code = GET_CODE (scan);
if (INSN_P (scan))
for (insn = first; insn; insn = NEXT_INSN (insn))
if (! INSN_P (insn))
continue;
- else if (INSN_DELETED_P (insn))
+ else if (insn->deleted ())
{
/* Shorten_branches would split this instruction again,
so transform it into a note. */
}
for (rtx insn = LABEL_REFS (lab); insn; insn = LABEL_REFS (insn))
- INSN_DELETED_P (insn) = 1;
+ as_a<rtx_insn *> (insn)->set_deleted ();
/* Mark constants in a window. */
for (insn = NEXT_INSN (as_a <rtx_insn *> (x)); insn; insn = NEXT_INSN (insn))
nothing, since the table will not be used.
(cf gcc.c-torture/compile/990801-1.c). */
if (GET_CODE (x) == MINUS
- && GET_CODE (XEXP (x, 0)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (x, 0), 0)) == CODE_LABEL
- && INSN_DELETED_P (XEXP (XEXP (x, 0), 0)))
- return true;
+ && GET_CODE (XEXP (x, 0)) == LABEL_REF)
+ {
+ rtx_code_label *label
+ = dyn_cast<rtx_code_label *> (XEXP (XEXP (x, 0), 0));
+ if (label && label->deleted ())
+ return true;
+ }
output_addr_const (file, x);
return true;
print_rtl (dump_file, src);
fprintf (dump_file, "\n");
}
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
return 1;
}
}
break;
}
}
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
break;
}
while (i < reg_use_count);
/* ??? Need to be careful w.r.t. mods done to INSN.
Don't call mark_oprs_set if we turned the
insn into a NOTE, or deleted the insn. */
- if (! NOTE_P (insn) && ! INSN_DELETED_P (insn))
+ if (! NOTE_P (insn) && ! insn->deleted ())
mark_oprs_set (insn);
}
}
represent source-level labels which were explicitly declared by
the user. This really shouldn't be happening though, so catch
it if it ever does happen. */
- gcc_assert (!INSN_DELETED_P (insn));
+ gcc_assert (!as_a<rtx_insn *> (insn)->deleted ());
ASM_GENERATE_INTERNAL_LABEL (label, "L", CODE_LABEL_NUMBER (insn));
add_AT_lbl_id (lbl_die, DW_AT_low_pc, label);
next_note = NEXT_INSN (loc_note);
if (! next_note
- || INSN_DELETED_P (next_note)
+ || next_note->deleted ()
|| ! NOTE_P (next_note)
|| (NOTE_KIND (next_note) != NOTE_INSN_VAR_LOCATION
&& NOTE_KIND (next_note) != NOTE_INSN_CALL_ARG_LOCATION))
We can't use next_active_insn here since AFTER may be a note.
Ignore deleted insns, which can be occur if not optimizing. */
for (tem = NEXT_INSN (before); tem != after; tem = NEXT_INSN (tem))
- if (! INSN_DELETED_P (tem) && INSN_P (tem))
+ if (! tem->deleted () && INSN_P (tem))
tem = try_split (PATTERN (tem), tem, 1);
/* Return either the first or the last insn, depending on which was
{
rtx_insn *next = NEXT_INSN (after);
- gcc_assert (!optimize || !INSN_DELETED_P (after));
+ gcc_assert (!optimize || !after->deleted ());
link_insn_into_chain (insn, after, next);
{
rtx_insn *prev = PREV_INSN (before);
- gcc_assert (!optimize || !INSN_DELETED_P (before));
+ gcc_assert (!optimize || !before->deleted ());
link_insn_into_chain (insn, prev, before);
if (NOTE_P (insn) || BARRIER_P (insn)
|| LABEL_P (insn) || DEBUG_INSN_P (insn))
continue;
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
body = PATTERN (insn);
/* Ignore deleted insns. These can occur when we split insns (due to a
template of "#") while not optimizing. */
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
return NEXT_INSN (insn);
switch (GET_CODE (insn))
else
instantiate_virtual_regs_in_insn (insn);
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
instantiate_virtual_regs_in_rtx (®_NOTES (insn));
continue;
/* Don't handle this one if it's a redundant one. */
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
continue;
/* Or if the expression doesn't reach the deleted one. */
handled by other optimizers using better algorithms. */
FOR_BB_INSNS (bb, insn)
{
- gcc_assert (! INSN_DELETED_P (insn));
+ gcc_assert (! insn->deleted ());
if (NONDEBUG_INSN_P (insn))
mark_jump_label (PATTERN (insn), insn, 0);
}
rtx_insn *prev_nonjump_insn = NULL;
for (insn = f; insn; insn = NEXT_INSN (insn))
{
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
;
else if (LABEL_P (insn))
prev_nonjump_insn = NULL;
break;
LABEL_REF_LABEL (x) = label;
- if (! insn || ! INSN_DELETED_P (insn))
+ if (! insn || ! insn->deleted ())
++LABEL_NUSES (label);
if (insn)
ADDR_DIFF_VEC. Don't set the JUMP_LABEL of a vector. */
case ADDR_VEC:
case ADDR_DIFF_VEC:
- if (! INSN_DELETED_P (insn))
+ if (! insn->deleted ())
{
int eltnum = code == ADDR_DIFF_VEC ? 1 : 0;
rtx note;
rtx_insn *next = NEXT_INSN (insn), *prev = PREV_INSN (insn);
- while (next && INSN_DELETED_P (next))
+ while (next && next->deleted ())
next = NEXT_INSN (next);
/* This insn is already deleted => return first following nondeleted. */
- if (INSN_DELETED_P (insn))
+ if (insn->deleted ())
return next;
delete_insn (insn);
{
rtx_insn *p;
- for (p = next && INSN_DELETED_P (next) ? NEXT_INSN (next) : next;
+ for (p = next && next->deleted () ? NEXT_INSN (next) : next;
p && NOTE_P (p);
p = NEXT_INSN (p))
if (NOTE_KIND (p) == NOTE_INSN_CALL_ARG_LOCATION)
for (i = 0; i < len; i++)
if (LABEL_NUSES (XEXP (RTVEC_ELT (labels, i), 0)) == 0)
delete_related_insns (XEXP (RTVEC_ELT (labels, i), 0));
- while (next && INSN_DELETED_P (next))
+ while (next && next->deleted ())
next = NEXT_INSN (next);
return next;
}
if (LABEL_NUSES (XEXP (note, 0)) == 0)
delete_related_insns (XEXP (note, 0));
- while (prev && (INSN_DELETED_P (prev) || NOTE_P (prev)))
+ while (prev && (prev->deleted () || NOTE_P (prev)))
prev = PREV_INSN (prev);
/* If INSN was a label and a dispatch table follows it,
if (code == NOTE)
next = NEXT_INSN (next);
/* Keep going past other deleted labels to delete what follows. */
- else if (code == CODE_LABEL && INSN_DELETED_P (next))
+ else if (code == CODE_LABEL && next->deleted ())
next = NEXT_INSN (next);
/* Keep the (use (insn))s created by dbr_schedule, which needs
them in order to track liveness relative to a previous
but I see no clean and sure alternative way
to find the first insn after INSN that is not now deleted.
I hope this works. */
- while (next && INSN_DELETED_P (next))
+ while (next && next->deleted ())
next = NEXT_INSN (next);
return next;
}
if (!NOTE_P (insn))
{
- INSN_DELETED_P (insn) = 1;
+ insn->set_deleted();
/* Patch this insn out of the chain. */
/* We don't do this all at once, because we
/* subst_stack_regs_pat may have deleted a no-op insn. If so, any
REG_UNUSED will already have been dealt with, so just return. */
- if (NOTE_P (insn) || INSN_DELETED_P (insn))
+ if (NOTE_P (insn) || insn->deleted ())
return control_flow_insn_deleted;
/* If this a noreturn call, we can't insert pop insns after it.
/* It is possible that this reload has been only used to set another reload
we eliminated earlier and thus deleted this instruction too. */
- if (INSN_DELETED_P (output_reload_insn))
+ if (output_reload_insn->deleted ())
return;
/* Get the raw pseudo-register referred to. */
rtx note, next;
/* Show that this copy of the insn isn't deleted. */
- INSN_DELETED_P (tem) = 0;
+ tem->set_undeleted ();
/* Unlink insn from its original place, and re-emit it into
the sequence. */
update_block (dtrial, thread);
new_rtx = delete_from_delay_slot (dtrial);
- if (INSN_DELETED_P (thread))
+ if (thread->deleted ())
thread = new_rtx;
INSN_FROM_TARGET_P (next_to_match) = 0;
}
update_block (merged_insns->insn (), thread);
new_rtx = delete_from_delay_slot (merged_insns->insn ());
- if (INSN_DELETED_P (thread))
+ if (thread->deleted ())
thread = new_rtx;
}
else
insn = unfilled_slots_base[i];
if (insn == 0
- || INSN_DELETED_P (insn)
+ || insn->deleted ()
|| (NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == SEQUENCE)
|| (JUMP_P (insn) && non_jumps_p)
insn = unfilled_slots_base[i];
if (insn == 0
- || INSN_DELETED_P (insn)
+ || insn->deleted ()
|| !JUMP_P (insn)
|| ! (condjump_p (insn) || condjump_in_parallel_p (insn)))
continue;
memset (total_annul_slots, 0, sizeof total_annul_slots);
for (insn = first; insn; insn = NEXT_INSN (insn))
{
- if (! INSN_DELETED_P (insn)
+ if (! insn->deleted ()
&& NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) != USE
&& GET_CODE (PATTERN (insn)) != CLOBBER)
information, we can get it from there unless the insn at the
start of the basic block has been deleted. */
if (tinfo && tinfo->block != -1
- && ! INSN_DELETED_P (BB_HEAD (BASIC_BLOCK_FOR_FN (cfun,
- tinfo->block))))
+ && ! BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, tinfo->block))->deleted ())
b = tinfo->block;
}
class GTY(()) rtx_insn : public rtx_def
{
+public:
/* No extra fields, but adds the invariant:
(INSN_P (X)
i.e. we have an rtx that has an INSN_UID field and can be part of
a linked list of insns.
*/
+
+ /* Returns true if this insn has been deleted. */
+
+ bool deleted () const { return volatil; }
+
+ /* Mark this insn as deleted. */
+
+ void set_deleted () { volatil = true; }
+
+ /* Mark this insn as not deleted. */
+
+ void set_undeleted () { volatil = false; }
};
/* Subclasses of rtx_insn. */
(RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
-/* 1 if RTX is an insn that has been deleted. */
-#define INSN_DELETED_P(RTX) \
- (RTL_INSN_CHAIN_FLAG_CHECK ("INSN_DELETED_P", (RTX))->volatil)
-
/* 1 if JUMP RTX is a crossing jump. */
#define CROSSING_JUMP_P(RTX) \
(RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump)
sel_remove_insn (nop, false, full_tidying);
/* We'll recycle this nop. */
- INSN_DELETED_P (nop) = 0;
+ nop->set_undeleted ();
if (nop_pool.n == nop_pool.s)
nop_pool.v = XRESIZEVEC (rtx_insn *, nop_pool.v,
/* The insn may come from the transformation cache, which may hold already
deleted insns, so mark it as not deleted. */
- INSN_DELETED_P (insn) = 0;
+ insn->set_undeleted ();
add_insn_after (insn, after, BLOCK_FOR_INSN (insn));
CODE_LABEL into a NOTE. */
/* ??? This seems completely and utterly wrong. Certainly it's
not true for NOTE_INSN_DELETED_LABEL, but I disbelieve proper
- functioning even with INSN_DELETED_P and friends. */
+ functioning even with rtx_insn::deleted and friends. */
tmp = x;
switch (GET_CODE (tmp))
case LABEL_REF:
tmp = LABEL_REF_LABEL (tmp);
- gcc_assert (!INSN_DELETED_P (tmp));
+ gcc_assert (!as_a<rtx_insn *> (tmp)->deleted ());
gcc_assert (!NOTE_P (tmp)
|| NOTE_KIND (tmp) != NOTE_INSN_DELETED);
break;