mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
ArrayRef'ize restoreCalleeSavedRegisters. NFCI.
restoreCalleeSavedRegisters can mutate the contents of the CalleeSavedInfos, so use a MutableArrayRef.
This commit is contained in:
parent
56f370d717
commit
f478403d71
@ -224,9 +224,10 @@ public:
|
||||
/// If it returns true, and any of the registers in CSI is not restored,
|
||||
/// it sets the corresponding Restored flag in CSI to false.
|
||||
/// Returns false otherwise.
|
||||
virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
virtual bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
return false;
|
||||
}
|
||||
|
@ -2257,8 +2257,7 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters(
|
||||
|
||||
bool AArch64FrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
|
||||
DebugLoc DL;
|
||||
|
@ -52,9 +52,10 @@ public:
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
/// Can this function use the red zone for local allocations.
|
||||
|
@ -118,7 +118,7 @@ static void insertCSRSaves(MachineBasicBlock &SaveBlock,
|
||||
|
||||
/// Insert restore code for the callee-saved registers used in the function.
|
||||
static void insertCSRRestores(MachineBasicBlock &RestoreBlock,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
LiveIntervals *LIS) {
|
||||
MachineFunction &MF = *RestoreBlock.getParent();
|
||||
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
|
||||
|
@ -417,7 +417,7 @@ bool ARCFrameLowering::spillCalleeSavedRegisters(
|
||||
|
||||
bool ARCFrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI, const TargetRegisterInfo *TRI) const {
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
LLVM_DEBUG(dbgs() << "Restore callee saved registers: "
|
||||
<< MBB.getParent()->getName() << "\n");
|
||||
// There are routines for saving at least 3 registers (r13 to r15, etc.)
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
void processFunctionBeforeFrameFinalized(MachineFunction &MF,
|
||||
|
@ -1046,7 +1046,7 @@ void ARMFrameLowering::emitPushInst(MachineBasicBlock &MBB,
|
||||
|
||||
void ARMFrameLowering::emitPopInst(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
unsigned LdmOpc, unsigned LdrOpc,
|
||||
bool isVarArg, bool NoGap,
|
||||
bool (*Func)(unsigned, bool),
|
||||
@ -1451,10 +1451,9 @@ bool ARMFrameLowering::spillCalleeSavedRegisters(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ARMFrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool ARMFrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
if (CSI.empty())
|
||||
return false;
|
||||
|
||||
|
@ -36,9 +36,10 @@ public:
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool keepFramePointer(const MachineFunction &MF) const override;
|
||||
@ -77,7 +78,7 @@ private:
|
||||
unsigned StrOpc, bool NoGap, bool (*Func)(unsigned, bool),
|
||||
unsigned NumAlignedDPRCS2Regs, unsigned MIFlags = 0) const;
|
||||
void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, unsigned LdmOpc,
|
||||
unsigned LdrOpc, bool isVarArg, bool NoGap,
|
||||
bool (*Func)(unsigned, bool),
|
||||
unsigned NumAlignedDPRCS2Regs) const;
|
||||
|
@ -925,11 +925,9 @@ bool Thumb1FrameLowering::spillCalleeSavedRegisters(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Thumb1FrameLowering::
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool Thumb1FrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
if (CSI.empty())
|
||||
return false;
|
||||
|
||||
|
@ -29,9 +29,10 @@ public:
|
||||
MachineBasicBlock::iterator MI,
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool hasReservedCallFrame(const MachineFunction &MF) const override;
|
||||
|
@ -273,8 +273,7 @@ bool AVRFrameLowering::spillCalleeSavedRegisters(
|
||||
|
||||
bool AVRFrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
if (CSI.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
bool hasReservedCallFrame(const MachineFunction &MF) const override;
|
||||
bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override;
|
||||
|
@ -51,8 +51,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI, std::vector<CalleeSavedInfo> &CSI,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override {
|
||||
return true;
|
||||
}
|
||||
|
@ -200,11 +200,9 @@ bool MSP430FrameLowering::spillCalleeSavedRegisters(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
MSP430FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool MSP430FrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
if (CSI.empty())
|
||||
return false;
|
||||
|
||||
|
@ -38,9 +38,10 @@ public:
|
||||
MachineBasicBlock::iterator MI,
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool hasFP(const MachineFunction &MF) const override;
|
||||
|
@ -135,10 +135,9 @@ bool Mips16FrameLowering::spillCalleeSavedRegisters(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mips16FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool Mips16FrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
//
|
||||
// Registers RA,S0,S1 are the callee saved registers and they will be restored
|
||||
// with the restore instruction during emitEpilogue.
|
||||
|
@ -30,9 +30,10 @@ public:
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool hasReservedCallFrame(const MachineFunction &MF) const override;
|
||||
|
@ -2283,11 +2283,9 @@ static bool isCalleeSavedCR(unsigned Reg) {
|
||||
return PPC::CR2 == Reg || Reg == PPC::CR3 || Reg == PPC::CR4;
|
||||
}
|
||||
|
||||
bool
|
||||
PPCFrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool PPCFrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
MachineFunction *MF = MBB.getParent();
|
||||
const PPCInstrInfo &TII = *Subtarget.getInstrInfo();
|
||||
PPCFunctionInfo *FI = MF->getInfo<PPCFunctionInfo>();
|
||||
|
@ -127,9 +127,10 @@ public:
|
||||
eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const override;
|
||||
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
/// targetHandlesStackFrameRounding - Returns true if the target is
|
||||
|
@ -691,7 +691,7 @@ bool RISCVFrameLowering::spillCalleeSavedRegisters(
|
||||
|
||||
bool RISCVFrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI, const TargetRegisterInfo *TRI) const {
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
if (CSI.empty())
|
||||
return true;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
// Get the first stack adjustment amount for SplitSPAdjust.
|
||||
|
@ -255,11 +255,9 @@ bool SystemZFrameLowering::spillCalleeSavedRegisters(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SystemZFrameLowering::
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool SystemZFrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
if (CSI.empty())
|
||||
return false;
|
||||
|
||||
|
@ -34,11 +34,11 @@ public:
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MBBII,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const
|
||||
override;
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
void processFunctionBeforeFrameFinalized(MachineFunction &MF,
|
||||
RegScavenger *RS) const override;
|
||||
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
||||
|
@ -2351,10 +2351,9 @@ void X86FrameLowering::emitCatchRetReturnValue(MachineBasicBlock &MBB,
|
||||
CatchRetTarget->setHasAddressTaken();
|
||||
}
|
||||
|
||||
bool X86FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const {
|
||||
bool X86FrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
if (CSI.empty())
|
||||
return false;
|
||||
|
||||
|
@ -86,9 +86,10 @@ public:
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
bool hasFP(const MachineFunction &MF) const override;
|
||||
|
@ -445,25 +445,22 @@ bool XCoreFrameLowering::spillCalleeSavedRegisters(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XCoreFrameLowering::
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
const TargetRegisterInfo *TRI) const{
|
||||
bool XCoreFrameLowering::restoreCalleeSavedRegisters(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const {
|
||||
MachineFunction *MF = MBB.getParent();
|
||||
const TargetInstrInfo &TII = *MF->getSubtarget().getInstrInfo();
|
||||
bool AtStart = MI == MBB.begin();
|
||||
MachineBasicBlock::iterator BeforeI = MI;
|
||||
if (!AtStart)
|
||||
--BeforeI;
|
||||
for (std::vector<CalleeSavedInfo>::const_iterator it = CSI.begin();
|
||||
it != CSI.end(); ++it) {
|
||||
unsigned Reg = it->getReg();
|
||||
for (const CalleeSavedInfo &CSR : CSI) {
|
||||
unsigned Reg = CSR.getReg();
|
||||
assert(Reg != XCore::LR && !(Reg == XCore::R10 && hasFP(*MF)) &&
|
||||
"LR & FP are always handled in emitEpilogue");
|
||||
|
||||
const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(Reg);
|
||||
TII.loadRegFromStackSlot(MBB, MI, Reg, it->getFrameIdx(), RC, TRI);
|
||||
TII.loadRegFromStackSlot(MBB, MI, Reg, CSR.getFrameIdx(), RC, TRI);
|
||||
assert(MI != MBB.begin() &&
|
||||
"loadRegFromStackSlot didn't insert any code!");
|
||||
// Insert in reverse order. loadRegFromStackSlot can insert multiple
|
||||
|
@ -36,9 +36,10 @@ namespace llvm {
|
||||
MachineBasicBlock::iterator MI,
|
||||
ArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
bool
|
||||
restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
std::vector<CalleeSavedInfo> &CSI,
|
||||
MutableArrayRef<CalleeSavedInfo> CSI,
|
||||
const TargetRegisterInfo *TRI) const override;
|
||||
|
||||
MachineBasicBlock::iterator
|
||||
|
Loading…
Reference in New Issue
Block a user