mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-14 13:57:51 +00:00
[SystemZ] Fix caller-allocated save slot FIXME
Get rid of some old code (and associated FIXME) for handling the caller-allocated register save area. No behavioural change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52f5a65f84
commit
52c28b07f0
@ -18,15 +18,10 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
SystemZFrameLowering::SystemZFrameLowering(const SystemZTargetMachine &tm,
|
namespace {
|
||||||
const SystemZSubtarget &sti)
|
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8,
|
|
||||||
-SystemZMC::CallFrameSize),
|
|
||||||
TM(tm),
|
|
||||||
STI(sti) {
|
|
||||||
// The ABI-defined register save slots, relative to the incoming stack
|
// The ABI-defined register save slots, relative to the incoming stack
|
||||||
// pointer.
|
// pointer.
|
||||||
static const unsigned SpillOffsetTable[][2] = {
|
static const TargetFrameLowering::SpillSlot SpillOffsetTable[] = {
|
||||||
{ SystemZ::R2D, 0x10 },
|
{ SystemZ::R2D, 0x10 },
|
||||||
{ SystemZ::R3D, 0x18 },
|
{ SystemZ::R3D, 0x18 },
|
||||||
{ SystemZ::R4D, 0x20 },
|
{ SystemZ::R4D, 0x20 },
|
||||||
@ -46,11 +41,23 @@ SystemZFrameLowering::SystemZFrameLowering(const SystemZTargetMachine &tm,
|
|||||||
{ SystemZ::F4D, 0x90 },
|
{ SystemZ::F4D, 0x90 },
|
||||||
{ SystemZ::F6D, 0x98 }
|
{ SystemZ::F6D, 0x98 }
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemZFrameLowering::SystemZFrameLowering(const SystemZTargetMachine &tm,
|
||||||
|
const SystemZSubtarget &sti)
|
||||||
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8,
|
||||||
|
-SystemZMC::CallFrameSize, 8),
|
||||||
|
TM(tm), STI(sti) {
|
||||||
// Create a mapping from register number to save slot offset.
|
// Create a mapping from register number to save slot offset.
|
||||||
RegSpillOffsets.grow(SystemZ::NUM_TARGET_REGS);
|
RegSpillOffsets.grow(SystemZ::NUM_TARGET_REGS);
|
||||||
for (unsigned I = 0, E = array_lengthof(SpillOffsetTable); I != E; ++I)
|
for (unsigned I = 0, E = array_lengthof(SpillOffsetTable); I != E; ++I)
|
||||||
RegSpillOffsets[SpillOffsetTable[I][0]] = SpillOffsetTable[I][1];
|
RegSpillOffsets[SpillOffsetTable[I].Reg] = SpillOffsetTable[I].Offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TargetFrameLowering::SpillSlot *
|
||||||
|
SystemZFrameLowering::getCalleeSavedSpillSlots(unsigned &NumEntries) const {
|
||||||
|
NumEntries = array_lengthof(SpillOffsetTable);
|
||||||
|
return SpillOffsetTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemZFrameLowering::
|
void SystemZFrameLowering::
|
||||||
@ -127,14 +134,12 @@ spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|||||||
DebugLoc DL = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
DebugLoc DL = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
||||||
|
|
||||||
// Scan the call-saved GPRs and find the bounds of the register spill area.
|
// Scan the call-saved GPRs and find the bounds of the register spill area.
|
||||||
unsigned SavedGPRFrameSize = 0;
|
|
||||||
unsigned LowGPR = 0;
|
unsigned LowGPR = 0;
|
||||||
unsigned HighGPR = SystemZ::R15D;
|
unsigned HighGPR = SystemZ::R15D;
|
||||||
unsigned StartOffset = -1U;
|
unsigned StartOffset = -1U;
|
||||||
for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
|
for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
|
||||||
unsigned Reg = CSI[I].getReg();
|
unsigned Reg = CSI[I].getReg();
|
||||||
if (SystemZ::GR64BitRegClass.contains(Reg)) {
|
if (SystemZ::GR64BitRegClass.contains(Reg)) {
|
||||||
SavedGPRFrameSize += 8;
|
|
||||||
unsigned Offset = RegSpillOffsets[Reg];
|
unsigned Offset = RegSpillOffsets[Reg];
|
||||||
assert(Offset && "Unexpected GPR save");
|
assert(Offset && "Unexpected GPR save");
|
||||||
if (StartOffset > Offset) {
|
if (StartOffset > Offset) {
|
||||||
@ -144,9 +149,7 @@ spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save information about the range and location of the call-saved
|
// Save the range of call-saved registers, for use by the epilogue inserter.
|
||||||
// registers, for use by the epilogue inserter.
|
|
||||||
ZFI->setSavedGPRFrameSize(SavedGPRFrameSize);
|
|
||||||
ZFI->setLowSavedGPR(LowGPR);
|
ZFI->setLowSavedGPR(LowGPR);
|
||||||
ZFI->setHighSavedGPR(HighGPR);
|
ZFI->setHighSavedGPR(HighGPR);
|
||||||
|
|
||||||
@ -449,11 +452,6 @@ int SystemZFrameLowering::getFrameIndexOffset(const MachineFunction &MF,
|
|||||||
// offset is therefore negative.
|
// offset is therefore negative.
|
||||||
int64_t Offset = (MFFrame->getObjectOffset(FI) +
|
int64_t Offset = (MFFrame->getObjectOffset(FI) +
|
||||||
MFFrame->getOffsetAdjustment());
|
MFFrame->getOffsetAdjustment());
|
||||||
if (FI >= 0)
|
|
||||||
// Non-fixed objects are allocated below the incoming stack pointer.
|
|
||||||
// Account for the space at the top of the frame that we choose not
|
|
||||||
// to allocate.
|
|
||||||
Offset += getUnallocatedTopBytes(MF);
|
|
||||||
|
|
||||||
// Make the offset relative to the incoming stack pointer.
|
// Make the offset relative to the incoming stack pointer.
|
||||||
Offset -= getOffsetOfLocalArea();
|
Offset -= getOffsetOfLocalArea();
|
||||||
@ -464,11 +462,6 @@ int SystemZFrameLowering::getFrameIndexOffset(const MachineFunction &MF,
|
|||||||
return Offset;
|
return Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t SystemZFrameLowering::
|
|
||||||
getUnallocatedTopBytes(const MachineFunction &MF) const {
|
|
||||||
return MF.getInfo<SystemZMachineFunctionInfo>()->getSavedGPRFrameSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t SystemZFrameLowering::
|
uint64_t SystemZFrameLowering::
|
||||||
getAllocatedStackSize(const MachineFunction &MF) const {
|
getAllocatedStackSize(const MachineFunction &MF) const {
|
||||||
const MachineFrameInfo *MFFrame = MF.getFrameInfo();
|
const MachineFrameInfo *MFFrame = MF.getFrameInfo();
|
||||||
@ -476,9 +469,6 @@ getAllocatedStackSize(const MachineFunction &MF) const {
|
|||||||
// Start with the size of the local variables and spill slots.
|
// Start with the size of the local variables and spill slots.
|
||||||
uint64_t StackSize = MFFrame->getStackSize();
|
uint64_t StackSize = MFFrame->getStackSize();
|
||||||
|
|
||||||
// Remove any bytes that we choose not to allocate.
|
|
||||||
StackSize -= getUnallocatedTopBytes(MF);
|
|
||||||
|
|
||||||
// Include space for an emergency spill slot, if one might be needed.
|
// Include space for an emergency spill slot, if one might be needed.
|
||||||
StackSize += getEmergencySpillSlotSize(MF);
|
StackSize += getEmergencySpillSlotSize(MF);
|
||||||
|
|
||||||
|
@ -29,7 +29,9 @@ public:
|
|||||||
SystemZFrameLowering(const SystemZTargetMachine &tm,
|
SystemZFrameLowering(const SystemZTargetMachine &tm,
|
||||||
const SystemZSubtarget &sti);
|
const SystemZSubtarget &sti);
|
||||||
|
|
||||||
// Override FrameLowering.
|
// Override TargetFrameLowering.
|
||||||
|
virtual const SpillSlot *getCalleeSavedSpillSlots(unsigned &NumEntries) const
|
||||||
|
LLVM_OVERRIDE;
|
||||||
virtual void
|
virtual void
|
||||||
processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||||
RegScavenger *RS) const LLVM_OVERRIDE;
|
RegScavenger *RS) const LLVM_OVERRIDE;
|
||||||
@ -59,16 +61,6 @@ public:
|
|||||||
MachineBasicBlock::iterator MI) const
|
MachineBasicBlock::iterator MI) const
|
||||||
LLVM_OVERRIDE;
|
LLVM_OVERRIDE;
|
||||||
|
|
||||||
// The target-independent code automatically allocates save slots for
|
|
||||||
// call-saved GPRs. However, we don't need those slots for SystemZ,
|
|
||||||
// because the ABI sets aside GPR save slots in the caller-allocated part
|
|
||||||
// of the frame. Since the target-independent code puts this unneeded
|
|
||||||
// area at the top of the callee-allocated part of frame, we choose not
|
|
||||||
// to allocate it and adjust the offsets accordingly. Return the
|
|
||||||
// size of this unallocated area.
|
|
||||||
// FIXME: seems a bit hackish.
|
|
||||||
uint64_t getUnallocatedTopBytes(const MachineFunction &MF) const;
|
|
||||||
|
|
||||||
// Return the number of bytes in the callee-allocated part of the frame.
|
// Return the number of bytes in the callee-allocated part of the frame.
|
||||||
uint64_t getAllocatedStackSize(const MachineFunction &MF) const;
|
uint64_t getAllocatedStackSize(const MachineFunction &MF) const;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class SystemZMachineFunctionInfo : public MachineFunctionInfo {
|
class SystemZMachineFunctionInfo : public MachineFunctionInfo {
|
||||||
unsigned SavedGPRFrameSize;
|
|
||||||
unsigned LowSavedGPR;
|
unsigned LowSavedGPR;
|
||||||
unsigned HighSavedGPR;
|
unsigned HighSavedGPR;
|
||||||
unsigned VarArgsFirstGPR;
|
unsigned VarArgsFirstGPR;
|
||||||
@ -26,14 +25,8 @@ class SystemZMachineFunctionInfo : public MachineFunctionInfo {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SystemZMachineFunctionInfo(MachineFunction &MF)
|
explicit SystemZMachineFunctionInfo(MachineFunction &MF)
|
||||||
: SavedGPRFrameSize(0), LowSavedGPR(0), HighSavedGPR(0), VarArgsFirstGPR(0),
|
: LowSavedGPR(0), HighSavedGPR(0), VarArgsFirstGPR(0), VarArgsFirstFPR(0),
|
||||||
VarArgsFirstFPR(0), VarArgsFrameIndex(0), RegSaveFrameIndex(0),
|
VarArgsFrameIndex(0), RegSaveFrameIndex(0), ManipulatesSP(false) {}
|
||||||
ManipulatesSP(false) {}
|
|
||||||
|
|
||||||
// Get and set the number of bytes allocated by generic code to store
|
|
||||||
// call-saved GPRs.
|
|
||||||
unsigned getSavedGPRFrameSize() const { return SavedGPRFrameSize; }
|
|
||||||
void setSavedGPRFrameSize(unsigned bytes) { SavedGPRFrameSize = bytes; }
|
|
||||||
|
|
||||||
// Get and set the first call-saved GPR that should be saved and restored
|
// Get and set the first call-saved GPR that should be saved and restored
|
||||||
// by this function. This is 0 if no GPRs need to be saved or restored.
|
// by this function. This is 0 if no GPRs need to be saved or restored.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user