Commit 64e3a413 by Kazu Hirata Committed by Jeff Law

* local-alloc.c: Fix formatting.

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