Pull in r303257 from upstream llvm trunk (by Krzysztof Parzyszek)
[PPC] Properly update register save area offsets The variables MinGPR/MinG8R were not updated properly when resetting the offsets, which in the included testcase lead to saving the CR register in the same location as R30. This fixes another issue reported in PR26519. Differential Revision: https://reviews.llvm.org/D33017 Reported by: Mark Millard PR: 206990 MFC after: 3 days
This commit is contained in:
parent
f92f6763f1
commit
9280c37786
@ -1775,32 +1775,37 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF,
|
||||
// Check whether the frame pointer register is allocated. If so, make sure it
|
||||
// is spilled to the correct offset.
|
||||
if (needsFP(MF)) {
|
||||
HasGPSaveArea = true;
|
||||
|
||||
int FI = PFI->getFramePointerSaveIndex();
|
||||
assert(FI && "No Frame Pointer Save Slot!");
|
||||
|
||||
MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI));
|
||||
// FP is R31/X31, so no need to update MinGPR/MinG8R.
|
||||
HasGPSaveArea = true;
|
||||
}
|
||||
|
||||
if (PFI->usesPICBase()) {
|
||||
HasGPSaveArea = true;
|
||||
|
||||
int FI = PFI->getPICBasePointerSaveIndex();
|
||||
assert(FI && "No PIC Base Pointer Save Slot!");
|
||||
|
||||
MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI));
|
||||
|
||||
MinGPR = std::min<unsigned>(MinGPR, PPC::R30);
|
||||
HasGPSaveArea = true;
|
||||
}
|
||||
|
||||
const PPCRegisterInfo *RegInfo =
|
||||
static_cast<const PPCRegisterInfo *>(Subtarget.getRegisterInfo());
|
||||
if (RegInfo->hasBasePointer(MF)) {
|
||||
HasGPSaveArea = true;
|
||||
|
||||
int FI = PFI->getBasePointerSaveIndex();
|
||||
assert(FI && "No Base Pointer Save Slot!");
|
||||
|
||||
MFI.setObjectOffset(FI, LowerBound + MFI.getObjectOffset(FI));
|
||||
|
||||
unsigned BP = RegInfo->getBaseRegister(MF);
|
||||
if (PPC::G8RCRegClass.contains(BP)) {
|
||||
MinG8R = std::min<unsigned>(MinG8R, BP);
|
||||
HasG8SaveArea = true;
|
||||
} else if (PPC::GPRCRegClass.contains(BP)) {
|
||||
MinGPR = std::min<unsigned>(MinGPR, BP);
|
||||
HasGPSaveArea = true;
|
||||
}
|
||||
}
|
||||
|
||||
// General register save area starts right below the Floating-point
|
||||
|
Loading…
Reference in New Issue
Block a user