summaryrefslogtreecommitdiff
path: root/gcc/local-alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/local-alloc.c')
-rw-r--r--gcc/local-alloc.c74
1 files changed, 36 insertions, 38 deletions
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
index e2c00bf8dec..b93102bfe98 100644
--- a/gcc/local-alloc.c
+++ b/gcc/local-alloc.c
@@ -19,7 +19,6 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-
/* Allocation of hard register numbers to pseudo registers is done in
two passes. In this pass we consider only regs that are born and
die once within one basic block. We do this one basic block at a
@@ -49,7 +48,7 @@ Boston, MA 02111-1307, USA. */
Tying is represented with "quantity numbers".
A non-tied register is given a new quantity number.
Tied registers have the same quantity number.
-
+
We have provision to exempt registers, even when they are contained
within the block, that can be tied to others that are not contained in it.
This is so that global_alloc could process them both and tie them then.
@@ -177,7 +176,6 @@ static short *qty_phys_num_copy_sugg;
static short *qty_phys_num_sugg;
-
/* If (REG N) has been assigned a quantity number, is a register number
of another register assigned the same quantity number, or -1 for the
end of the chain. qty->first_reg point to the head of this chain. */
@@ -344,9 +342,9 @@ local_alloc ()
reg_qty = (int *) xmalloc (max_regno * sizeof (int));
reg_offset = (char *) xmalloc (max_regno * sizeof (char));
- reg_next_in_qty = (int *) xmalloc(max_regno * sizeof (int));
+ reg_next_in_qty = (int *) xmalloc (max_regno * sizeof (int));
- /* Allocate the reg_renumber array */
+ /* Allocate the reg_renumber array. */
allocate_reg_info (max_regno, FALSE, TRUE);
/* Determine which pseudo-registers can be allocated by local-alloc.
@@ -598,7 +596,7 @@ memref_referenced_p (memref, x)
return 1;
return memref_referenced_p (memref, SET_SRC (x));
-
+
default:
break;
}
@@ -837,7 +835,7 @@ update_equiv_regs ()
a register used only in one basic block from a MEM. If so, and the
MEM remains unchanged for the life of the register, add a REG_EQUIV
note. */
-
+
note = find_reg_note (insn, REG_EQUIV, NULL_RTX);
if (note == 0 && REG_BASIC_BLOCK (regno) >= 0
@@ -861,8 +859,7 @@ update_equiv_regs ()
&& (GET_CODE (XEXP (XEXP (XEXP (note, 0), 0), 0))
== LABEL_REF)))
recorded_label_ref = 1;
-
-
+
reg_equiv_replacement[regno] = XEXP (note, 0);
/* Don't mess with things live during setjmp. */
@@ -944,7 +941,7 @@ update_equiv_regs ()
/* reg_equiv_replace[REGNO] gets set only when
REG_N_REFS[REGNO] is 2, i.e. the register is set
once and used once. (If it were only set, but not used,
- flow would have deleted the setting insns.) Hence
+ flow would have deleted the setting insns.) Hence
there can only be one insn in reg_equiv_init_insns. */
equiv_insn = XEXP (reg_equiv_init_insns[regno], 0);
@@ -1147,7 +1144,7 @@ block_alloc (b)
continue;
/* Likewise if each alternative has some operand that
- must match operand zero. In that case, skip any
+ must match operand zero. In that case, skip any
operand that doesn't list operand 0 since we know that
the operand always conflicts with operand 0. We
ignore commutatity in this case to keep things simple. */
@@ -1172,7 +1169,7 @@ block_alloc (b)
priority to an equivalence found from that insn. */
int may_save_copy
= (r1 == recog_data.operand[i] && must_match_0 >= 0);
-
+
if (GET_CODE (r1) == REG || GET_CODE (r1) == SUBREG)
win = combine_regs (r1, r0, may_save_copy,
insn_number, insn, 0);
@@ -1275,7 +1272,7 @@ block_alloc (b)
&& GET_CODE (XEXP (link, 0)) == REG)
wipe_dead_reg (XEXP (link, 0), 1);
- /* If this is an insn that has a REG_RETVAL note pointing at a
+ /* If this is an insn that has a REG_RETVAL note pointing at a
CLOBBER insn, we have reached the end of a REG_NO_CONFLICT
block, so clear any register number that combined within it. */
if ((note = find_reg_note (insn, REG_RETVAL, NULL_RTX)) != 0
@@ -1299,7 +1296,7 @@ block_alloc (b)
/* Now every register that is local to this basic block
should have been given a quantity, or else -1 meaning ignore it.
- Every quantity should have a known birth and death.
+ Every quantity should have a known birth and death.
Order the qtys so we assign them registers in order of the
number of suggested registers they need so we allocate those with
@@ -1351,8 +1348,8 @@ block_alloc (b)
qty[q].phys_reg = -1;
}
- /* Order the qtys so we assign them registers in order of
- decreasing length of life. Normally call qsort, but if we
+ /* Order the qtys so we assign them registers in order of
+ decreasing length of life. Normally call qsort, but if we
have only a very small number of quantities, sort them ourselves. */
for (i = 0; i < next_qty; i++)
@@ -1405,7 +1402,7 @@ block_alloc (b)
The purpose behind extending the lifetime of this qty is to
discourage the register allocator from creating false
dependencies.
-
+
The adjustment value is choosen to indicate that this qty
conflicts with all the qtys in the instructions immediately
before and after the lifetime of this qty.
@@ -1434,15 +1431,14 @@ block_alloc (b)
&& !optimize_size
&& !SMALL_REGISTER_CLASSES)
{
-
- qty[q].phys_reg = find_free_reg (qty[q].min_class,
+ qty[q].phys_reg = find_free_reg (qty[q].min_class,
qty[q].mode, q, 0, 0,
fake_birth, fake_death);
if (qty[q].phys_reg >= 0)
continue;
}
#endif
- qty[q].phys_reg = find_free_reg (qty[q].min_class,
+ qty[q].phys_reg = find_free_reg (qty[q].min_class,
qty[q].mode, q, 0, 0,
qty[q].birth, qty[q].death);
if (qty[q].phys_reg >= 0)
@@ -1513,7 +1509,7 @@ qty_compare_1 (q1p, q2p)
const PTR q1p;
const PTR q2p;
{
- register int q1 = *(const int *)q1p, q2 = *(const int *)q2p;
+ register int q1 = *(const int *) q1p, q2 = *(const int *) q2p;
register int tem = QTY_CMP_PRI (q2) - QTY_CMP_PRI (q1);
if (tem != 0)
@@ -1544,7 +1540,7 @@ qty_sugg_compare (q1, q2)
if (tem != 0)
return tem;
-
+
return QTY_CMP_PRI (q2) - QTY_CMP_PRI (q1);
}
@@ -1553,7 +1549,7 @@ qty_sugg_compare_1 (q1p, q2p)
const PTR q1p;
const PTR q2p;
{
- register int q1 = *(const int *)q1p, q2 = *(const int *)q2p;
+ register int q1 = *(const int *) q1p, q2 = *(const int *) q2p;
register int tem = QTY_CMP_SUGG (q1) - QTY_CMP_SUGG (q2);
if (tem != 0)
@@ -1590,10 +1586,9 @@ qty_sugg_compare_1 (q1p, q2p)
MAY_SAVE_COPYCOPY is non-zero if this insn is simply copying USEDREG to
SETREG or if the input and output must share a register.
In that case, we record a hard reg suggestion in QTY_PHYS_COPY_SUGG.
-
+
There are elaborate checks for the validity of combining. */
-
static int
combine_regs (usedreg, setreg, may_save_copy, insn_number, insn, already_dead)
rtx usedreg, setreg;
@@ -1837,7 +1832,7 @@ reg_is_born (reg, birth)
int birth;
{
register int regno;
-
+
if (GET_CODE (reg) == SUBREG)
regno = REGNO (SUBREG_REG (reg)) + SUBREG_WORD (reg);
else
@@ -1878,7 +1873,7 @@ wipe_dead_reg (reg, output_p)
/* If this insn has multiple results,
and the dead reg is used in one of the results,
extend its life to after this insn,
- so it won't get allocated together with any other result of this insn.
+ so it won't get allocated together with any other result of this insn.
It is unsafe to use !single_set here since it will ignore an unused
output. Just because an output is unused does not mean the compiler
@@ -1916,7 +1911,7 @@ wipe_dead_reg (reg, output_p)
not to happen). */
if (output_p)
post_mark_life (regno, GET_MODE (reg), 1,
- 2 * this_insn_number, 2 * this_insn_number+ 1);
+ 2 * this_insn_number, 2 * this_insn_number + 1);
}
else if (reg_qty[regno] >= 0)
@@ -1928,7 +1923,7 @@ wipe_dead_reg (reg, output_p)
(but actually we test only the first of the block for holding MODE)
and still free between insn BORN_INDEX and insn DEAD_INDEX,
and return the number of the first of them.
- Return -1 if such a block cannot be found.
+ Return -1 if such a block cannot be found.
If QTYNO crosses calls, insist on a register preserved by calls,
unless ACCEPT_CALL_CLOBBERED is nonzero.
@@ -1947,7 +1942,8 @@ find_free_reg (class, mode, qtyno, accept_call_clobbered, just_try_suggested,
{
register int i, ins;
#ifdef HARD_REG_SET
- register /* Declare it register if it's a scalar. */
+ /* Declare it register if it's a scalar. */
+ register
#endif
HARD_REG_SET used, first_used;
#ifdef ELIMINABLE_REGS
@@ -1986,7 +1982,7 @@ find_free_reg (class, mode, qtyno, accept_call_clobbered, just_try_suggested,
This is true of any register that can be eliminated. */
#ifdef ELIMINABLE_REGS
- for (i = 0; i < (int)(sizeof eliminables / sizeof eliminables[0]); i++)
+ for (i = 0; i < (int) (sizeof eliminables / sizeof eliminables[0]); i++)
SET_HARD_REG_BIT (used, eliminables[i].from);
#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
/* If FRAME_POINTER_REGNUM is not a real register, then protect the one
@@ -2048,17 +2044,17 @@ find_free_reg (class, mode, qtyno, accept_call_clobbered, just_try_suggested,
return regno;
}
#ifndef REG_ALLOC_ORDER
- i += j; /* Skip starting points we know will lose */
+ /* Skip starting points we know will lose. */
+ i += j;
#endif
}
}
fail:
-
/* If we are just trying suggested register, we have just tried copy-
suggested registers, and there are arithmetic-suggested registers,
try them. */
-
+
/* If it would be profitable to allocate a call-clobbered register
and save and restore it around calls, do that. */
if (just_try_suggested && qty_phys_num_copy_sugg[qtyno] != 0
@@ -2078,7 +2074,8 @@ find_free_reg (class, mode, qtyno, accept_call_clobbered, just_try_suggested,
&& flag_caller_saves
&& ! just_try_suggested
&& qty[qtyno].n_calls_crossed != 0
- && CALLER_SAVE_PROFITABLE (qty[qtyno].n_refs, qty[qtyno].n_calls_crossed))
+ && CALLER_SAVE_PROFITABLE (qty[qtyno].n_refs,
+ qty[qtyno].n_calls_crossed))
{
i = find_free_reg (class, mode, qtyno, 1, 0, born_index, dead_index);
if (i >= 0)
@@ -2119,7 +2116,8 @@ post_mark_life (regno, mode, life, birth, death)
{
register int j = HARD_REGNO_NREGS (regno, mode);
#ifdef HARD_REG_SET
- register /* Declare it register if it's a scalar. */
+ /* Declare it register if it's a scalar. */
+ register
#endif
HARD_REG_SET this_reg;
@@ -2183,7 +2181,7 @@ no_conflict_p (insn, r0, r1)
if (! find_reg_note (p, REG_NO_CONFLICT, r1))
return 0;
}
-
+
return ok;
}
@@ -2193,7 +2191,7 @@ no_conflict_p (insn, r0, r1)
static int
requires_inout (p)
- const char *p;
+ const char *p;
{
char c;
int found_zero = 0;