[PATCH] Allow the register scavenger to spill multiple registers
Hal Finkel
hfinkel at anl.gov
Tue Mar 26 08:10:33 PDT 2013
----- Original Message -----
> From: "Richard Sandiford" <rdsandiford at googlemail.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "Commit Messages and Patches for LLVM" <llvm-commits at cs.uiuc.edu>, "Jakob Stoklund Olesen" <stoklund at 2pi.dk>
> Sent: Tuesday, March 26, 2013 6:40:05 AM
> Subject: Re: [PATCH] Allow the register scavenger to spill multiple registers
>
> Hal Finkel <hfinkel-uKDnm65ik8M at public.gmane.org> writes:
> > Please review the attached patch which lets the register scavenger
> > make
> > use of multiple spill slots in order to guarantee that it will be
> > able
> > to provide multiple registers simultaneously. I intend to use this
> > capability in the PowerPC backend to handle spills where we need
> > two
> > registers (one for indexing and one for transfer) without keeping
> > an
> > extra reserved register.
>
> This might have been discussed already, sorry, but: this patch seems
> to
> change the behaviour for targets that use something other than a
> frame
> index as scavenging spill space. (E.g. Thumb 1 uses r12, MIPS16 uses
> t0.)
> Those targets never called setScavengingFrameIndex() and instead left
> the ScavengingFrameIndex as -1. They used saveScavengerRegister to
> do
> the saving and restoring.
Ack, you're right! I'll reorder the check later today to allow the old behavior.
Thanks!
-Hal
>
> Targets that don't register a frame index now hit the assert:
>
> assert(SI < Scavenged.size() &&
> "Scavenger slots are live, unable to scavenge another
> register!");
>
> before saveScavengerRegister() is called.
>
> FWIW, a simple hack like calling addScavengingFrameIndex(-1) doesn't
> work
> because:
>
> @@ -631,9 +633,11 @@ void
> PEI::calculateFrameObjectOffsets(MachineFunction &Fn) {
> // stack pointer.
> if (RS && (!TFI.hasFP(Fn) || RegInfo->needsStackRealignment(Fn) ||
> !RegInfo->useFPForScavengingIndex(Fn))) {
> - int SFI = RS->getScavengingFrameIndex();
> - if (SFI >= 0)
> - AdjustStackOffset(MFI, SFI, StackGrowsDown, Offset, MaxAlign);
> + SmallVector<int, 2> SFIs;
> + RS->getScavengingFrameIndices(SFIs);
> + for (SmallVector<int, 2>::iterator I = SFIs.begin(),
> + IE = SFIs.end(); I != IE; ++I)
> + AdjustStackOffset(MFI, *I, StackGrowsDown, Offset, MaxAlign);
> }
>
> if (!TFI.targetHandlesStackFrameRounding()) {
>
> assumes every index is valid.
>
> Richard
>
More information about the llvm-commits
mailing list