reorg.c: Fix formatting.

2000-10-18  Kazu Hirata  <kazu@hxi.com>

	* reorg.c: Fix formatting.

From-SVN: r36926
This commit is contained in:
Kazu Hirata 2000-10-18 04:41:35 +00:00 committed by Kazu Hirata
parent b054460b55
commit f27e6bb249
2 changed files with 92 additions and 94 deletions

View File

@ -4,6 +4,8 @@
expander that is used when not optimizing. Output a tab after
each assembly insns.
* reorg.c: Fix formatting.
2000-10-17 Joern Rennecke <amylaar@redhat.co.uk>
* reload1.c (move2add_note_store): Check for simple

View File

@ -56,7 +56,7 @@ Boston, MA 02111-1307, USA. */
is taken.
The HP-PA always has a branch delay slot. For unconditional branches
its effects can be annulled when the branch is taken. The effects
its effects can be annulled when the branch is taken. The effects
of the delay slot in a conditional branch can be nullified for forward
taken branches, or for untaken backward branches. This means
we can hoist insns from the fall-through path for forward branches or
@ -140,7 +140,6 @@ Boston, MA 02111-1307, USA. */
#include "insn-attr.h"
#include "resource.h"
#ifdef DELAY_SLOTS
#define obstack_chunk_alloc xmalloc
@ -353,7 +352,7 @@ find_end_label ()
|| GET_CODE (PATTERN (insn)) == CLOBBER)))
insn = PREV_INSN (insn);
/* When a target threads its epilogue we might already have a
/* When a target threads its epilogue we might already have a
suitable return insn. If so put a label before it for the
end_of_function_label. */
if (GET_CODE (insn) == BARRIER
@ -387,27 +386,27 @@ find_end_label ()
{
insn = PREV_INSN (insn);
/* Put the label before an USE insns that may proceed the
/* Put the label before an USE insns that may proceed the
RETURN insn. */
while (GET_CODE (insn) == USE)
while (GET_CODE (insn) == USE)
insn = PREV_INSN (insn);
emit_label_after (end_of_function_label, insn);
emit_label_after (end_of_function_label, insn);
}
else
{
/* Otherwise, make a new label and emit a RETURN and BARRIER,
/* Otherwise, make a new label and emit a RETURN and BARRIER,
if needed. */
emit_label (end_of_function_label);
emit_label (end_of_function_label);
#ifdef HAVE_return
if (HAVE_return)
if (HAVE_return)
{
/* The return we make may have delay slots too. */
rtx insn = gen_return ();
insn = emit_jump_insn (insn);
emit_barrier ();
if (num_delay_slots (insn) > 0)
obstack_ptr_grow (&unfilled_slots_obstack, insn);
if (num_delay_slots (insn) > 0)
obstack_ptr_grow (&unfilled_slots_obstack, insn);
}
#endif
}
@ -451,7 +450,7 @@ emit_delay_sequence (insn, list, length)
rtx delay_insn = copy_rtx (insn);
/* If INSN is followed by a BARRIER, delete the BARRIER since it will only
confuse further processing. Update LAST in case it was the last insn.
confuse further processing. Update LAST in case it was the last insn.
We will put the BARRIER back in later. */
if (NEXT_INSN (insn) && GET_CODE (NEXT_INSN (insn)) == BARRIER)
{
@ -520,7 +519,7 @@ emit_delay_sequence (insn, list, length)
if (NEXT_INSN (seq_insn) && GET_CODE (NEXT_INSN (seq_insn)) == INSN
&& GET_CODE (PATTERN (NEXT_INSN (seq_insn))) == SEQUENCE)
PREV_INSN (XVECEXP (PATTERN (NEXT_INSN (seq_insn)), 0, 0)) = seq_insn;
/* If there used to be a BARRIER, put it back. */
if (had_barrier)
emit_barrier_after (seq_insn);
@ -554,7 +553,7 @@ add_to_delay_list (insn, delay_list)
XEXP (delay_list, 1) = add_to_delay_list (insn, XEXP (delay_list, 1));
return delay_list;
}
}
/* Delete INSN from the delay slot of the insn that it is in, which may
produce an insn with no delay slots. Return the new insn. */
@ -792,7 +791,6 @@ optimize_skip (insn)
}
#endif
/* Encode and return branch direction and prediction information for
INSN assuming it will jump to LABEL.
@ -816,15 +814,15 @@ get_jump_flags (insn, label)
&& INSN_UID (insn) <= max_uid
&& label != 0
&& INSN_UID (label) <= max_uid)
flags
flags
= (uid_to_ruid[INSN_UID (label)] > uid_to_ruid[INSN_UID (insn)])
? ATTR_FLAG_forward : ATTR_FLAG_backward;
/* No valid direction information. */
else
flags = 0;
/* If insn is a conditional branch call mostly_true_jump to get
determine the branch prediction.
determine the branch prediction.
Non conditional branches are predicted as very likely taken. */
if (GET_CODE (insn) == JUMP_INSN
@ -835,21 +833,21 @@ get_jump_flags (insn, label)
prediction = mostly_true_jump (insn, get_branch_condition (insn, label));
switch (prediction)
{
case 2:
flags |= (ATTR_FLAG_very_likely | ATTR_FLAG_likely);
break;
case 1:
flags |= ATTR_FLAG_likely;
break;
case 0:
flags |= ATTR_FLAG_unlikely;
break;
case -1:
flags |= (ATTR_FLAG_very_unlikely | ATTR_FLAG_unlikely);
break;
case 2:
flags |= (ATTR_FLAG_very_likely | ATTR_FLAG_likely);
break;
case 1:
flags |= ATTR_FLAG_likely;
break;
case 0:
flags |= ATTR_FLAG_unlikely;
break;
case -1:
flags |= (ATTR_FLAG_very_unlikely | ATTR_FLAG_unlikely);
break;
default:
abort();
default:
abort ();
}
}
else
@ -882,7 +880,7 @@ rare_destination (insn)
case CODE_LABEL:
return 0;
case BARRIER:
/* A BARRIER can either be after a JUMP_INSN or a CALL_INSN. We
/* A BARRIER can either be after a JUMP_INSN or a CALL_INSN. We
don't scan past JUMP_INSNs, so any barrier we find here must
have been after a CALL_INSN and hence mean the call doesn't
return. */
@ -932,13 +930,13 @@ mostly_true_jump (jump_insn, condition)
int prob = INTVAL (XEXP (note, 0));
if (prob >= REG_BR_PROB_BASE * 9 / 10)
return 2;
return 2;
else if (prob >= REG_BR_PROB_BASE / 2)
return 1;
return 1;
else if (prob >= REG_BR_PROB_BASE / 10)
return 0;
return 0;
else
return -1;
return -1;
}
/* ??? Ought to use estimate_probability instead. */
@ -956,7 +954,7 @@ mostly_true_jump (jump_insn, condition)
{
/* If this is the test of a loop, it is very likely true. We scan
backwards from the target label. If we find a NOTE_INSN_LOOP_BEG
before the next real insn, we assume the branch is to the top of
before the next real insn, we assume the branch is to the top of
the loop. */
for (insn = PREV_INSN (target_label);
insn && GET_CODE (insn) == NOTE;
@ -992,7 +990,7 @@ mostly_true_jump (jump_insn, condition)
return 2;
}
/* If we couldn't figure out what this jump was, assume it won't be
/* If we couldn't figure out what this jump was, assume it won't be
taken. This should be rare. */
if (condition == 0)
return 0;
@ -1012,7 +1010,7 @@ mostly_true_jump (jump_insn, condition)
case LE:
case LT:
if (XEXP (condition, 1) == const0_rtx)
return 0;
return 0;
break;
case GE:
case GT:
@ -1045,7 +1043,7 @@ get_branch_condition (insn, target)
{
rtx pat = PATTERN (insn);
rtx src;
if (condjump_in_parallel_p (insn))
pat = XVECEXP (pat, 0, 0);
@ -1135,7 +1133,7 @@ redirect_with_delay_slots_safe_p (jump, newlabel, seq)
? eligible_for_annul_true (jump, i - 1,
XVECEXP (pat, 0, i), flags) :
#endif
eligible_for_delay (jump, i -1, XVECEXP (pat, 0, i), flags)))
eligible_for_delay (jump, i - 1, XVECEXP (pat, 0, i), flags)))
break;
return (i == XVECLEN (pat, 0));
@ -1188,18 +1186,17 @@ check_annul_list_true_false (annul_true_p, delay_list)
if (delay_list)
{
for (temp = delay_list; temp; temp = XEXP (temp, 1))
{
rtx trial = XEXP (temp, 0);
if ((annul_true_p && INSN_FROM_TARGET_P (trial))
{
rtx trial = XEXP (temp, 0);
if ((annul_true_p && INSN_FROM_TARGET_P (trial))
|| (!annul_true_p && !INSN_FROM_TARGET_P (trial)))
return 0;
}
}
}
return 1;
}
/* INSN branches to an insn whose pattern SEQ is a SEQUENCE. Given that
the condition tested by INSN is CONDITION and the resources shown in
@ -1255,10 +1252,10 @@ steal_delay_list_from_target (insn, condition, seq, delay_list,
moving the instructions in the delay slots.
We can not steal the delay list if one of the instructions in the
current delay_list modifies the condition codes and the jump in the
current delay_list modifies the condition codes and the jump in the
sequence is a conditional jump. We can not do this because we can
not change the direction of the jump because the condition codes
will effect the direction of the jump in the sequence. */
will effect the direction of the jump in the sequence. */
CLEAR_RESOURCE (&cc_set);
for (temp = delay_list; temp; temp = XEXP (temp, 1))
@ -1267,7 +1264,7 @@ steal_delay_list_from_target (insn, condition, seq, delay_list,
mark_set_resources (trial, &cc_set, 0, MARK_SRC_DEST_CALL);
if (insn_references_resource_p (XVECEXP (seq , 0, 0), &cc_set, 0))
return delay_list;
return delay_list;
}
if (XVECLEN (seq, 0) - 1 > slots_remaining
@ -1347,13 +1344,13 @@ steal_delay_list_from_target (insn, condition, seq, delay_list,
return delay_list;
}
/* Similar to steal_delay_list_from_target except that SEQ is on the
/* Similar to steal_delay_list_from_target except that SEQ is on the
fallthrough path of INSN. Here we only do something if the delay insn
of SEQ is an unconditional branch. In that case we steal its delay slot
for INSN since unconditional branches are much easier to fill. */
static rtx
steal_delay_list_from_fallthrough (insn, condition, seq,
steal_delay_list_from_fallthrough (insn, condition, seq,
delay_list, sets, needed, other_needed,
slots_to_fill, pslots_filled, pannul_p)
rtx insn, condition;
@ -1426,7 +1423,6 @@ steal_delay_list_from_fallthrough (insn, condition, seq,
*pannul_p = 1;
return delay_list;
}
/* Try merging insns starting at THREAD which match exactly the insns in
INSN's delay list.
@ -1464,9 +1460,9 @@ try_merge_delay_insns (insn, thread)
will essentially disable this optimization. This method is somewhat of
a kludge, but I don't see a better way.) */
if (! annul_p)
for (i = 1 ; i < num_slots ; i++)
for (i = 1 ; i < num_slots; i++)
if (XVECEXP (PATTERN (insn), 0, i))
mark_referenced_resources (XVECEXP (PATTERN (insn), 0, i), &needed, 1);
mark_referenced_resources (XVECEXP (PATTERN (insn), 0, i), &needed, 1);
for (trial = thread; !stop_search_p (trial, 1); trial = next_trial)
{
@ -1571,8 +1567,8 @@ try_merge_delay_insns (insn, thread)
{
/* Keep track of the set/referenced resources for the delay
slots of any trial insns we encounter. */
mark_set_resources (dtrial, &set, 0, MARK_SRC_DEST_CALL);
mark_referenced_resources (dtrial, &needed, 1);
mark_set_resources (dtrial, &set, 0, MARK_SRC_DEST_CALL);
mark_referenced_resources (dtrial, &needed, 1);
}
}
}
@ -1666,17 +1662,17 @@ redundant_insn (insn, target, delay_list)
return 0;
/* Stop for an INSN or JUMP_INSN with delayed effects and its delay
slots because it is difficult to track its resource needs
slots because it is difficult to track its resource needs
correctly. */
#ifdef INSN_SETS_ARE_DELAYED
if (INSN_SETS_ARE_DELAYED (XVECEXP (pat, 0, 0)))
return 0;
return 0;
#endif
#ifdef INSN_REFERENCES_ARE_DELAYED
if (INSN_REFERENCES_ARE_DELAYED (XVECEXP (pat, 0, 0)))
return 0;
return 0;
#endif
/* See if any of the insns in the delay slot match, updating
@ -1771,12 +1767,12 @@ redundant_insn (insn, target, delay_list)
#ifdef INSN_SETS_ARE_DELAYED
if (INSN_SETS_ARE_DELAYED (XVECEXP (pat, 0, 0)))
return 0;
return 0;
#endif
#ifdef INSN_REFERENCES_ARE_DELAYED
if (INSN_REFERENCES_ARE_DELAYED (XVECEXP (pat, 0, 0)))
return 0;
return 0;
#endif
/* See if any of the insns in the delay slot match, updating
@ -1804,8 +1800,7 @@ redundant_insn (insn, target, delay_list)
return 0;
}
/* If the insn requiring the delay slot conflicts with INSN, we
/* If the insn requiring the delay slot conflicts with INSN, we
must stop. */
if (insn_sets_resource_p (XVECEXP (pat, 0, 0), &needed, 1))
return 0;
@ -1886,7 +1881,7 @@ update_block (insn, where)
rtx insn;
rtx where;
{
/* Ignore if this was in a delay slot and it came from the target of
/* Ignore if this was in a delay slot and it came from the target of
a branch. */
if (INSN_FROM_TARGET_P (insn))
return;
@ -2046,7 +2041,7 @@ fill_simple_delay_slots (non_jumps_p)
|| (GET_CODE (insn) == JUMP_INSN && non_jumps_p)
|| (GET_CODE (insn) != JUMP_INSN && ! non_jumps_p))
continue;
/* It may have been that this insn used to need delay slots, but
now doesn't; ignore in that case. This can happen, for example,
on the HP PA RISC, where the number of delay slots depends on
@ -2082,7 +2077,7 @@ fill_simple_delay_slots (non_jumps_p)
insn must exist when it is subsequently scanned.
This is tried on each insn with delay slots as some machines
have insns which perform calls, but are not represented as
have insns which perform calls, but are not represented as
CALL_INSNs. */
slots_filled = 0;
@ -2134,7 +2129,7 @@ fill_simple_delay_slots (non_jumps_p)
forward in execution sequence), it must not need or set any resources
that were set by later insns and must not set any resources that
are needed for those insns.
The delay slot insn itself sets resources unless it is a call
(in which case the called routine, not the insn itself, is doing
the setting). */
@ -2158,7 +2153,7 @@ fill_simple_delay_slots (non_jumps_p)
if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
continue;
/* Check for resource conflict first, to avoid unnecessary
/* Check for resource conflict first, to avoid unnecessary
splitting. */
if (! insn_references_resource_p (trial, &set, 1)
&& ! insn_sets_resource_p (trial, &set, 1)
@ -2200,7 +2195,7 @@ fill_simple_delay_slots (non_jumps_p)
#if defined(ANNUL_IFFALSE_SLOTS) || defined(ANNUL_IFTRUE_SLOTS)
if (slots_filled != slots_to_fill
&& delay_list == 0
&& GET_CODE (insn) == JUMP_INSN
&& GET_CODE (insn) == JUMP_INSN
&& (condjump_p (insn) || condjump_in_parallel_p (insn)))
{
delay_list = optimize_skip (insn);
@ -2223,10 +2218,10 @@ fill_simple_delay_slots (non_jumps_p)
fill_eager_delay_slots anyways, it was just deleted. */
if (slots_filled != slots_to_fill
&& (GET_CODE (insn) != JUMP_INSN
&& (GET_CODE (insn) != JUMP_INSN
|| ((condjump_p (insn) || condjump_in_parallel_p (insn))
&& ! simplejump_p (insn)
&& JUMP_LABEL (insn) != 0)))
&& ! simplejump_p (insn)
&& JUMP_LABEL (insn) != 0)))
{
rtx target = 0;
int maybe_never = 0;
@ -2241,7 +2236,7 @@ fill_simple_delay_slots (non_jumps_p)
mark_referenced_resources (insn, &needed, 1);
maybe_never = 1;
}
else
else
{
mark_set_resources (insn, &set, 0, MARK_SRC_DEST_CALL);
mark_referenced_resources (insn, &needed, 1);
@ -2283,7 +2278,7 @@ fill_simple_delay_slots (non_jumps_p)
break;
else if (JUMP_LABEL (trial_delay) != target)
{
rtx ninsn =
rtx ninsn =
next_active_insn (JUMP_LABEL (trial_delay));
mark_target_live_regs (get_insns (), ninsn,
@ -2338,7 +2333,7 @@ fill_simple_delay_slots (non_jumps_p)
/* If there are slots left to fill and our search was stopped by an
unconditional branch, try the insn at the branch target. We can
redirect the branch if it works.
redirect the branch if it works.
Don't do this if the insn at the branch target is a branch. */
if (slots_to_fill != slots_filled
@ -2367,7 +2362,7 @@ fill_simple_delay_slots (non_jumps_p)
else
new_label = find_end_label ();
delay_list
delay_list
= add_to_delay_list (copy_rtx (next_trial), delay_list);
slots_filled++;
reorg_redirect_jump (trial, new_label);
@ -2405,7 +2400,7 @@ fill_simple_delay_slots (non_jumps_p)
#ifdef DELAY_SLOTS_FOR_EPILOGUE
/* See if the epilogue needs any delay slots. Try to fill them if so.
The only thing we can do is scan backwards from the end of the
The only thing we can do is scan backwards from the end of the
function. If we did this in a previous pass, it is incorrect to do it
again. */
if (current_function_epilogue_delay_list)
@ -2439,7 +2434,7 @@ fill_simple_delay_slots (non_jumps_p)
SET_HARD_REG_BIT (needed.regs, STACK_POINTER_REGNUM);
#ifdef EPILOGUE_USES
for (i = 0; i <FIRST_PSEUDO_REGISTER; i++)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
if (EPILOGUE_USES (i))
SET_HARD_REG_BIT (needed.regs, i);
@ -2548,7 +2543,7 @@ fill_slots_from_thread (insn, condition, thread, opposite_thread, likely,
/* If our thread is the end of subroutine, we can't get any delay
insns from that. */
if (thread == 0)
return delay_list;
return delay_list;
/* If this is an unconditional branch, nothing is needed at the
opposite thread. Otherwise, compute what is needed there. */
@ -3122,7 +3117,7 @@ relax_delay_slots (first)
continue;
}
}
/* If this is an unconditional jump and the previous insn is a
conditional jump, try reversing the condition of the previous
insn and swapping our targets. The next pass might be able to
@ -3221,7 +3216,7 @@ relax_delay_slots (first)
if (trial == 0 && target_label != 0)
trial = find_end_label ();
if (trial != target_label
if (trial != target_label
&& redirect_with_delay_slots_safe_p (delay_insn, trial, insn))
{
reorg_redirect_jump (delay_insn, trial);
@ -3243,10 +3238,10 @@ relax_delay_slots (first)
tmp = find_end_label ();
/* Insert the special USE insn and update dataflow info. */
update_block (trial, tmp);
update_block (trial, tmp);
/* Now emit a label before the special USE insn, and
redirect our jump to the new label. */
redirect our jump to the new label. */
target_label = get_label_before (PREV_INSN (tmp));
reorg_redirect_jump (delay_insn, target_label);
next = insn;
@ -3266,7 +3261,7 @@ relax_delay_slots (first)
if (target_label == 0)
target_label = find_end_label ();
if (redirect_with_delay_slots_safe_p (delay_insn, target_label,
if (redirect_with_delay_slots_safe_p (delay_insn, target_label,
insn))
{
reorg_redirect_jump (delay_insn, target_label);
@ -3413,7 +3408,7 @@ make_return_insns (first)
real_return_label = get_label_before (insn);
break;
}
/* Show an extra usage of REAL_RETURN_LABEL so it won't go away if it
was equal to END_OF_FUNCTION_LABEL. */
LABEL_NUSES (real_return_label)++;
@ -3471,7 +3466,8 @@ make_return_insns (first)
? eligible_for_annul_true (jump_insn, i - 1,
XVECEXP (pat, 0, i), flags) :
#endif
eligible_for_delay (jump_insn, i -1, XVECEXP (pat, 0, i), flags)))
eligible_for_delay (jump_insn, i - 1,
XVECEXP (pat, 0, i), flags)))
break;
}
else
@ -3535,7 +3531,7 @@ dbr_schedule (first, file)
flag_no_peephole = old_flag_no_peephole;
#endif
/* If the current function has no insns other than the prologue and
/* If the current function has no insns other than the prologue and
epilogue, then do not try to fill any delay slots. */
if (n_basic_blocks == 0)
return;
@ -3554,7 +3550,7 @@ dbr_schedule (first, file)
uid_to_ruid = (int *) xmalloc ((max_uid + 1) * sizeof (int));
for (i = 0, insn = first; insn; i++, insn = NEXT_INSN (insn))
uid_to_ruid[INSN_UID (insn)] = i;
/* Initialize the list of insns that need filling. */
if (unfilled_firstobj == 0)
{
@ -3574,12 +3570,12 @@ dbr_schedule (first, file)
&& (GET_CODE (PATTERN (insn)) == ADDR_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC))
continue;
if (num_delay_slots (insn) > 0)
obstack_ptr_grow (&unfilled_slots_obstack, insn);
/* Ensure all jumps go to the last of a set of consecutive labels. */
if (GET_CODE (insn) == JUMP_INSN
if (GET_CODE (insn) == JUMP_INSN
&& (condjump_p (insn) || condjump_in_parallel_p (insn))
&& JUMP_LABEL (insn) != 0
&& ((target = prev_label (next_active_insn (JUMP_LABEL (insn))))
@ -3690,7 +3686,7 @@ dbr_schedule (first, file)
else
total_delay_slots[j]++;
}
else if (num_delay_slots (insn) > 0)
else if (num_delay_slots (insn) > 0)
total_delay_slots[0]++;
}
}
@ -3735,7 +3731,7 @@ dbr_schedule (first, file)
int pred_flags;
if (GET_CODE (insn) == INSN)
{
{
rtx pat = PATTERN (insn);
if (GET_CODE (pat) == SEQUENCE)