mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Have getCalleeSavedRegs take a non-null MachineFunction all the
time. The target independent code was passing in one all the time and targets weren't checking validity before using. Update a few calls to pass in a MachineFunction where necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1ed57f698d
commit
5233c26b6b
@ -425,7 +425,7 @@ public:
|
||||
/// closest to the incoming stack pointer if stack grows down, and vice versa.
|
||||
///
|
||||
virtual const MCPhysReg*
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const = 0;
|
||||
getCalleeSavedRegs(const MachineFunction *MF) const = 0;
|
||||
|
||||
/// getCallPreservedMask - Return a mask of call-preserved registers for the
|
||||
/// given calling convention on the current sub-target. The mask should
|
||||
|
@ -36,8 +36,7 @@ public:
|
||||
bool isReservedReg(const MachineFunction &MF, unsigned Reg) const;
|
||||
|
||||
/// Code Generation virtual methods...
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
|
||||
|
||||
unsigned getCSRFirstUseCost() const override {
|
||||
|
@ -63,8 +63,6 @@ ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||
const MCPhysReg *RegList =
|
||||
STI.isTargetDarwin() ? CSR_iOS_SaveList : CSR_AAPCS_SaveList;
|
||||
|
||||
if (!MF) return RegList;
|
||||
|
||||
const Function *F = MF->getFunction();
|
||||
if (F->getCallingConv() == CallingConv::GHC) {
|
||||
// GHC set of callee saved regs is empty as all those regs are
|
||||
|
@ -100,8 +100,7 @@ protected:
|
||||
|
||||
public:
|
||||
/// Code Generation virtual methods...
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
|
||||
const uint32_t *getNoPreservedMask() const;
|
||||
|
||||
|
@ -336,7 +336,7 @@ void Thumb1FrameLowering::emitEpilogue(MachineFunction &MF,
|
||||
int NumBytes = (int)MFI->getStackSize();
|
||||
assert((unsigned)NumBytes >= ArgRegsSaveSize &&
|
||||
"ArgRegsSaveSize is included in NumBytes");
|
||||
const MCPhysReg *CSRegs = RegInfo->getCalleeSavedRegs();
|
||||
const MCPhysReg *CSRegs = RegInfo->getCalleeSavedRegs(&MF);
|
||||
unsigned FramePtr = RegInfo->getFrameRegister(MF);
|
||||
|
||||
if (!AFI->hasStackFrame()) {
|
||||
|
@ -25,8 +25,7 @@ struct BPFRegisterInfo : public BPFGenRegisterInfo {
|
||||
|
||||
BPFRegisterInfo();
|
||||
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
|
||||
BitVector getReservedRegs(const MachineFunction &MF) const override;
|
||||
|
||||
|
@ -46,8 +46,7 @@ struct HexagonRegisterInfo : public HexagonGenRegisterInfo {
|
||||
HexagonRegisterInfo();
|
||||
|
||||
/// Code Generation virtual methods...
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
|
||||
const TargetRegisterClass* const*
|
||||
getCalleeSavedRegClasses(const MachineFunction *MF = nullptr) const;
|
||||
|
@ -389,7 +389,9 @@ static bool IsLoopN(MachineInstr *MI) {
|
||||
/// callee-saved register.
|
||||
static bool DoesModifyCalleeSavedReg(MachineInstr *MI,
|
||||
const TargetRegisterInfo *TRI) {
|
||||
for (const MCPhysReg *CSR = TRI->getCalleeSavedRegs(); *CSR; ++CSR) {
|
||||
for (const MCPhysReg *CSR =
|
||||
TRI->getCalleeSavedRegs(MI->getParent()->getParent());
|
||||
*CSR; ++CSR) {
|
||||
unsigned CalleeSavedReg = *CSR;
|
||||
if (MI->modifiesRegister(CalleeSavedReg, TRI))
|
||||
return true;
|
||||
|
@ -26,8 +26,7 @@ public:
|
||||
MSP430RegisterInfo();
|
||||
|
||||
/// Code Generation virtual methods...
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
|
||||
BitVector getReservedRegs(const MachineFunction &MF) const override;
|
||||
const TargetRegisterClass*
|
||||
|
@ -321,7 +321,8 @@ void RegDefsUses::setCallerSaved(const MachineInstr &MI) {
|
||||
CallerSavedRegs.reset(Mips::ZERO);
|
||||
CallerSavedRegs.reset(Mips::ZERO_64);
|
||||
|
||||
for (const MCPhysReg *R = TRI.getCalleeSavedRegs(); *R; ++R)
|
||||
for (const MCPhysReg *R = TRI.getCalleeSavedRegs(MI.getParent()->getParent());
|
||||
*R; ++R)
|
||||
for (MCRegAliasIterator AI(*R, &TRI, true); AI.isValid(); ++AI)
|
||||
CallerSavedRegs.reset(*AI);
|
||||
|
||||
|
@ -47,8 +47,7 @@ public:
|
||||
|
||||
unsigned getRegPressureLimit(const TargetRegisterClass *RC,
|
||||
MachineFunction &MF) const override;
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
|
||||
static const uint32_t *getMips16RetHelperMask();
|
||||
|
||||
|
@ -78,7 +78,7 @@ NVPTXRegisterInfo::NVPTXRegisterInfo() : NVPTXGenRegisterInfo(0) {}
|
||||
|
||||
/// NVPTX Callee Saved Registers
|
||||
const MCPhysReg *
|
||||
NVPTXRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||
NVPTXRegisterInfo::getCalleeSavedRegs(const MachineFunction *) const {
|
||||
static const MCPhysReg CalleeSavedRegs[] = { 0 };
|
||||
return CalleeSavedRegs;
|
||||
}
|
||||
|
@ -35,8 +35,7 @@ public:
|
||||
//------------------------------------------------------
|
||||
|
||||
// NVPTX callee saved registers
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
|
||||
BitVector getReservedRegs(const MachineFunction &MF) const override;
|
||||
|
||||
|
@ -31,8 +31,7 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo {
|
||||
SparcRegisterInfo(SparcSubtarget &st);
|
||||
|
||||
/// Code Generation virtual methods...
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF =nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
const uint32_t* getCallPreservedMask(CallingConv::ID CC) const override;
|
||||
|
||||
const uint32_t* getRTCallPreservedMask(CallingConv::ID CC) const;
|
||||
|
@ -43,8 +43,7 @@ public:
|
||||
bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override {
|
||||
return true;
|
||||
}
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = nullptr) const
|
||||
override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
const uint32_t *getCallPreservedMask(CallingConv::ID CC) const override;
|
||||
BitVector getReservedRegs(const MachineFunction &MF) const override;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
||||
|
@ -208,8 +208,8 @@ bool XCoreRegisterInfo::needsFrameMoves(const MachineFunction &MF) {
|
||||
MF.getFunction()->needsUnwindTableEntry();
|
||||
}
|
||||
|
||||
const MCPhysReg* XCoreRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
|
||||
const {
|
||||
const MCPhysReg *
|
||||
XCoreRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||
// The callee saved registers LR & FP are explicitly handled during
|
||||
// emitPrologue & emitEpilogue and related functions.
|
||||
static const MCPhysReg CalleeSavedRegs[] = {
|
||||
|
@ -29,8 +29,7 @@ public:
|
||||
|
||||
/// Code Generation virtual methods...
|
||||
|
||||
const MCPhysReg *
|
||||
getCalleeSavedRegs(const MachineFunction *MF =nullptr) const override;
|
||||
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
||||
|
||||
BitVector getReservedRegs(const MachineFunction &MF) const override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user