/* Perform instruction reorganizations for delay slot filling.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
Hacked by Michael Tiemann (tiemann@cygnus.com).
static int
insn_references_resource_p (insn, res, include_delayed_effects)
- register rtx insn;
- register struct resources *res;
+ rtx insn;
+ struct resources *res;
int include_delayed_effects;
{
struct resources insn_res;
static int
insn_sets_resource_p (insn, res, include_delayed_effects)
- register rtx insn;
- register struct resources *res;
+ rtx insn;
+ struct resources *res;
int include_delayed_effects;
{
struct resources insn_sets;
rtx list;
int length;
{
- register int i = 1;
- register rtx li;
+ int i = 1;
+ rtx li;
int had_barrier = 0;
/* Allocate the rtvec to hold the insns and the SEQUENCE. */
for (li = list; li; li = XEXP (li, 1), i++)
{
rtx tem = XEXP (li, 0);
- rtx note;
+ rtx note, next;
/* Show that this copy of the insn isn't deleted. */
INSN_DELETED_P (tem) = 0;
PREV_INSN (tem) = XVECEXP (seq, 0, i - 1);
NEXT_INSN (XVECEXP (seq, 0, i - 1)) = tem;
- /* Remove any REG_DEAD notes because we can't rely on them now
- that the insn has been moved. */
- for (note = REG_NOTES (tem); note; note = XEXP (note, 1))
- if (REG_NOTE_KIND (note) == REG_DEAD)
- XEXP (note, 0) = const0_rtx;
+ for (note = REG_NOTES (tem); note; note = next)
+ {
+ next = XEXP (note, 1);
+ switch (REG_NOTE_KIND (note))
+ {
+ case REG_DEAD:
+ /* Remove any REG_DEAD notes because we can't rely on them now
+ that the insn has been moved. */
+ remove_note (tem, note);
+ break;
+
+ case REG_LABEL:
+ /* Keep the label reference count up to date. */
+ LABEL_NUSES (XEXP (note, 0)) ++;
+ break;
+
+ default:
+ break;
+ }
+ }
}
NEXT_INSN (XVECEXP (seq, 0, length)) = NEXT_INSN (seq_insn);
if (GET_CODE (trial) == NOTE)
trial = prev_nonnote_insn (trial);
if (sets_cc0_p (PATTERN (trial)) != 1
- || FIND_REG_INC_NOTE (trial, 0))
+ || FIND_REG_INC_NOTE (trial, NULL_RTX))
return;
if (PREV_INSN (NEXT_INSN (trial)) == trial)
delete_related_insns (trial);
static rtx
optimize_skip (insn)
- register rtx insn;
+ rtx insn;
{
- register rtx trial = next_nonnote_insn (insn);
+ rtx trial = next_nonnote_insn (insn);
rtx next_trial = next_active_insn (trial);
rtx delay_list = 0;
rtx target_label;
fill_simple_delay_slots (non_jumps_p)
int non_jumps_p;
{
- register rtx insn, pat, trial, next_trial;
- register int i;
+ rtx insn, pat, trial, next_trial;
+ int i;
int num_unfilled_slots = unfilled_slots_next - unfilled_slots_base;
struct resources needed, set;
int slots_to_fill, slots_filled;
int i = 2;
- try {
+ try {
f();
i = 3;
} catch (...) {}
-
+
return i;
Even though `i' is a local variable, we must be sure not
starting point of this thread. */
if (own_thread)
{
+ rtx note;
+
update_block (trial, thread);
if (trial == thread)
{
if (new_thread == trial)
new_thread = thread;
}
+
+ /* We are moving this insn, not deleting it. We must
+ temporarily increment the use count on any referenced
+ label lest it be deleted by delete_related_insns. */
+ note = find_reg_note (trial, REG_LABEL, 0);
+ if (note)
+ LABEL_NUSES (XEXP (note, 0))++;
+
delete_related_insns (trial);
+
+ if (note)
+ LABEL_NUSES (XEXP (note, 0))--;
}
else
new_thread = next_active_insn (trial);
static void
fill_eager_delay_slots ()
{
- register rtx insn;
- register int i;
+ rtx insn;
+ int i;
int num_unfilled_slots = unfilled_slots_next - unfilled_slots_base;
for (i = 0; i < num_unfilled_slots; i++)
relax_delay_slots (first)
rtx first;
{
- register rtx insn, next, pat;
- register rtx trial, delay_insn, target_label;
+ rtx insn, next, pat;
+ rtx trial, delay_insn, target_label;
/* Look at every JUMP_INSN and see if we can improve it. */
for (insn = first; insn; insn = next)
if (file)
{
- register int i, j, need_comma;
+ int i, j, need_comma;
int total_delay_slots[MAX_DELAY_HISTOGRAM + 1];
int total_annul_slots[MAX_DELAY_HISTOGRAM + 1];