THe final localized spilling patches. See the ChangeLog for details.

From-SVN: r23374
This commit is contained in:
Bernd Schmidt 1998-10-27 22:38:40 +00:00 committed by Jeff Law
parent e6e174e560
commit 03acd8f806
4 changed files with 789 additions and 1020 deletions

View File

@ -1,3 +1,122 @@
Tue Oct 27 23:32:34 1998 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* reload.h (struct insn_chain): Add need_operand_change element.
* reload1.c (new_insn_chain): Clear it.
(calculate_needs_all_insns): Set it; don't overload need_reload.
(reload_as_needed): Use it.
* reload.c (find_reloads_address): Use BASE_REG_CLASS instead of
reload_address_base_reg_class throughout. Similar for INDEX_REG_CLASS
and reload_address_index_reg_class.
(find_reloads_address_1): Likewise.
* reload.h (reload_address_base_reg_class,
reload_address_index_reg_class): Don't declare.
* reload1.c (reg_old_renumber, pseudo_previous_regs,
pseudo_forbidden_regs, bad_spill_regs_global): New static variables.
(used_spill_regs): Now static.
(reload_address_base_reg_class, reload_address_index_reg_class,
regs_explicitly_used, counted_for_groups, counted_for_nongroups,
basic_block_needs, max_needs, group_size, group_mode, max_groups,
max_nongroups, max_needs_insn, max_groups_insn, max_nongroups_insn,
forbidden_regs):
Deleted variables.
(init_reload): Delete code to compute base/index reg classes.
(reload): Delete variable J.
Delete code to manage basic_block_needs.
Don't compute regs_explicitly_used.
Allocate, initialize and free reg_old_renumber, pseudo_forbidden_regs,
pseudo_previous_regs.
Initialize bad_spill_regs_global.
Don't call order_regs_for_reload here.
Don't initialize spill_reg_order and n_spills.
Don't forbid explicitly used regs to be used for spill regs.
Change main loop to infinite loop, with explicit break statements.
Make SOMETHING_CHANGED variable local to that loop.
Don't initialize max_needs, max_groups, max_nongroups, max_needs_insn,
max_groups_insn, max_nongroups_insn, group_size, group_mode.
Make sure spilled_speudos is cleared before calling spill_hard_reg or
new_spill_reg.
Don't call dump_needs.
Delete code to reset potential_reload_regs.
Delete code to terminate loop conditional on the global needs variables
showing no further needs.
(calculate_needs_all_insns): Return void. All callers changed.
Initialize somehing_needs_elimination here, not in reload.
Delete avoid_return_reg kludge.
(calculate_needs): Lose AVOID_RETURN_REG and GLOBAL args, return void.
All callers changed.
Initialize the group_mode and group_size elements of the arg CHAIN.
Delete code to manage basic_block_needs.
Operate on elements of CHAIN instead of global variables.
Delete avoid_return_reg kludge.
(find_tworeg_group): Lose GLOBAL arg, take CHAIN arg, return void.
All callers changed.
Operate on elements of CHAIN instead of global variables.
Delete special SMALL_REGISTER_CLASSES code.
Delete spill_failure code; now in new_spill_reg.
(find_group): Lose GLOBAL arg, take CHAIN arg, return void.
All callers changed.
Operate on elements of CHAIN instead of global variables.
(maybe_mark_pseudo_spilled): New static function.
(find_reload_regs): Lose GLOBAL arg, take CHAIN arg, return void.
All callers changed.
Operate on elements of CHAIN instead of global variables.
Call order_regs_for_reload here, not in reload.
Initialize spill_reg_order and n_spills.
Simplify test whether an asm insn is involved.
Delete spill_failure code; now in new_spill_reg.
Call maybe_mark_pseudo_spilled for everything marked as live in
CHAIN. Merge CHAIN's used_spill_regs into the global variable
used_spill_regs.
(dump_needs): Take CHAIN arg. No longer static, to prevent the
compiler from optimizing this function (now unused) away.
Operate on elements of CHAIN instead of global variables.
(possible_group_p): Lose MAX_GROUPS arg, take CHAIN arg. All callers
changed.
Operate on elements of CHAIN instead of global variables.
(count_possible_groups): Lose GROUP_SIZE, GROUP_MODE, MAX_GROUPS args,
take CHAIN arg. All callers changed.
Operate on elements of CHAIN instead of global variables.
(new_spill_reg): Lose MAX_NEEDS, MAX_NONGROUPS, GLOBAL args, take
CHAIN, NONGROUP args. Return void. All callers changed.
Verify caller isn't trying to spill a pseudo.
Simplify test for illegal reg, just use bad_spill_regs.
Generate better error messages.
Operate on elements of CHAIN instead of global variables.
Mark spilled register in CHAIN's used_spill_regs element.
Don't call spill_hard_reg.
(spill_hard_reg): Lose GLOBAL arg, return void. All callers changed.
Mark spilled hard regs in bad_spill_regs_global.
Mark affected pseudos in spilled_pseudos, but don't spill them.
(ior_hard_reg_set): New static function.
(finish_spills): Return int. All callers changed.
Compute spill_reg_order, n_spills and spill_regs here. Also update
regs_ever_live for regs used as spills.
For every pseudo in spilled_pseudos, spill it and mark the previous
hard reg it had in pseudo_previous_regs. Compute which hard regs
arseudo): New static function.
(order_regs_for_reload): Take CHAIN arg. All callers changed.
Initialize bad_spill_regs from bad_spill_regs_global, then merge any
hard registers explicitly used across the current insn into the set.
Compute hard_reg_n_uses taking only pseudos live across this insn
into account.
Tweak sorting of potential_reload_regs.
(compare_spill_regs): Delete function.
(reload_as_needed): Don't sort the spill_regs array, it's computed
in proper order in finish_spills.
Delete avoid_return_reg kludge.
Delete code to manage basic_block_needs.
(allocate_reload_reg): Minor speed/readability tweaks.
Operate on elements of CHAIN instead of global variables.
(choose_reload_regs): Lose AVOID_RETURN_REG arg. All callers changed.
Delete avoid_return_reg kludge.
Initialize reload_reg_used from CHAIN's used_spill_regs element.
Delete unused label FAIL.
(reload_combine): Replce reload_address_index_reg_class with
INDEX_REGS.
Don't use used_spill_regs to determine information about lifetime of
hard regs.
Tue Oct 27 13:15:02 1998 Nick Clifton <nickc@cygnus.com>
* toplev.c (display_help): Ignore empty target specific

View File

@ -4623,7 +4623,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
return 0;
/* If we do not have one of the cases above, we must do the reload. */
push_reload (ad, NULL_RTX, loc, NULL_PTR, reload_address_base_reg_class,
push_reload (ad, NULL_RTX, loc, NULL_PTR, BASE_REG_CLASS,
GET_MODE (ad), VOIDmode, 0, 0, opnum, type);
return 1;
}
@ -4712,7 +4712,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
/* Must use TEM here, not AD, since it is the one that will
have any subexpressions reloaded, if needed. */
push_reload (tem, NULL_RTX, loc, NULL_PTR,
reload_address_base_reg_class, GET_MODE (tem),
BASE_REG_CLASS, GET_MODE (tem),
VOIDmode, 0,
0, opnum, type);
return 1;
@ -4745,15 +4745,15 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
/* Reload the displacement into an index reg.
We assume the frame pointer or arg pointer is a base reg. */
find_reloads_address_part (XEXP (ad, 1), &XEXP (ad, 1),
reload_address_index_reg_class,
GET_MODE (ad), opnum, type, ind_levels);
INDEX_REG_CLASS, GET_MODE (ad), opnum,
type, ind_levels);
}
else
{
/* If the sum of two regs is not necessarily valid,
reload the sum into a base reg.
That will at least work. */
find_reloads_address_part (ad, loc, reload_address_base_reg_class,
find_reloads_address_part (ad, loc, BASE_REG_CLASS,
Pmode, opnum, type, ind_levels);
}
return 1;
@ -4804,8 +4804,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
plus_constant (XEXP (XEXP (ad, 0), 0),
INTVAL (XEXP (ad, 1))),
XEXP (XEXP (ad, 0), 1));
find_reloads_address_part (XEXP (ad, 0), &XEXP (ad, 0),
reload_address_base_reg_class,
find_reloads_address_part (XEXP (ad, 0), &XEXP (ad, 0), BASE_REG_CLASS,
GET_MODE (ad), opnum, type, ind_levels);
find_reloads_address_1 (mode, XEXP (ad, 1), 1, &XEXP (ad, 1), opnum,
type, 0, insn);
@ -4829,8 +4828,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
XEXP (XEXP (ad, 0), 0),
plus_constant (XEXP (XEXP (ad, 0), 1),
INTVAL (XEXP (ad, 1))));
find_reloads_address_part (XEXP (ad, 1), &XEXP (ad, 1),
reload_address_base_reg_class,
find_reloads_address_part (XEXP (ad, 1), &XEXP (ad, 1), BASE_REG_CLASS,
GET_MODE (ad), opnum, type, ind_levels);
find_reloads_address_1 (mode, XEXP (ad, 0), 1, &XEXP (ad, 0), opnum,
type, 0, insn);
@ -4874,8 +4872,7 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
loc = &XEXP (*memrefloc, 0);
}
find_reloads_address_part (ad, loc, reload_address_base_reg_class,
Pmode, opnum, type,
find_reloads_address_part (ad, loc, BASE_REG_CLASS, Pmode, opnum, type,
ind_levels);
return 1;
}
@ -5287,9 +5284,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
x = XEXP (x, 0);
reloadnum
= push_reload (x, x, loc, loc,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), GET_MODE (x), 0, 0,
opnum, RELOAD_OTHER);
}
@ -5297,9 +5292,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
{
reloadnum
= push_reload (x, NULL_RTX, loc, NULL_PTR,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), GET_MODE (x), 0, 0,
opnum, type);
reload_inc[reloadnum]
@ -5345,9 +5338,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
opnum, type, ind_levels, insn);
reloadnum = push_reload (x, NULL_RTX, loc, NULL_PTR,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
reload_inc[reloadnum]
= find_inc_amount (PATTERN (this_insn), XEXP (x, 0));
@ -5376,8 +5367,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
find_reloads_address (GET_MODE (x), loc, XEXP (x, 0), &XEXP (x, 0),
opnum, ADDR_TYPE (type), ind_levels, insn);
push_reload (*loc, NULL_RTX, loc, NULL_PTR,
(context ? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
return 1;
@ -5387,10 +5377,8 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
if (reg_equiv_constant[regno] != 0)
{
find_reloads_address_part (reg_equiv_constant[regno], loc,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
find_reloads_address_part (reg_equiv_constant[regno], loc,
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), opnum, type, ind_levels);
return 1;
}
@ -5400,9 +5388,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
if (reg_equiv_mem[regno] != 0)
{
push_reload (reg_equiv_mem[regno], NULL_RTX, loc, NULL_PTR,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
return 1;
}
@ -5430,9 +5416,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
: REGNO_MODE_OK_FOR_BASE_P (regno, mode))))
{
push_reload (x, NULL_RTX, loc, NULL_PTR,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
return 1;
}
@ -5444,9 +5428,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
if (regno_clobbered_p (regno, this_insn))
{
push_reload (x, NULL_RTX, loc, NULL_PTR,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
return 1;
}
@ -5467,9 +5449,7 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
: REGNO_MODE_OK_FOR_BASE_P (regno, mode)))
{
push_reload (x, NULL_RTX, loc, NULL_PTR,
(context
? reload_address_index_reg_class
: reload_address_base_reg_class),
(context ? INDEX_REG_CLASS : BASE_REG_CLASS),
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
return 1;
}
@ -5478,9 +5458,8 @@ find_reloads_address_1 (mode, x, context, loc, opnum, type, ind_levels, insn)
is larger than the class size, then reload the whole SUBREG. */
else
{
enum reg_class class = (context
? reload_address_index_reg_class
: reload_address_base_reg_class);
enum reg_class class = (context ? INDEX_REG_CLASS
: BASE_REG_CLASS);
if (CLASS_MAX_NREGS (class, GET_MODE (SUBREG_REG (x)))
> reg_class_size[class])
{

View File

@ -50,8 +50,6 @@ extern int memory_move_secondary_cost PROTO ((enum machine_mode, enum reg_class,
/* Maximum number of reloads we can need. */
#define MAX_RELOADS (2 * MAX_RECOG_OPERANDS * (MAX_REGS_PER_ADDRESS + 1))
extern enum reg_class reload_address_base_reg_class;
extern enum reg_class reload_address_index_reg_class;
extern rtx reload_in[MAX_RELOADS];
extern rtx reload_out[MAX_RELOADS];
extern rtx reload_in_reg[MAX_RELOADS];
@ -205,6 +203,9 @@ struct insn_chain
/* Nonzero if find_reloads said the insn requires reloading. */
unsigned int need_reload:1;
/* Nonzero if find_reloads needs to be run during reload_as_needed to
perform modifications on any operands. */
unsigned int need_operand_change:1;
/* Nonzero if eliminate_regs_in_insn said it requires eliminations. */
unsigned int need_elim:1;
/* Nonzero if this insn was inserted by perform_caller_saves. */

File diff suppressed because it is too large Load Diff