llvm.org GIT mirror llvm / 5233c26
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 Eric Christopher 5 years ago
17 changed file(s) with 20 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
424424 /// closest to the incoming stack pointer if stack grows down, and vice versa.
425425 ///
426426 virtual const MCPhysReg*
427 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const = 0;
427 getCalleeSavedRegs(const MachineFunction *MF) const = 0;
428428
429429 /// getCallPreservedMask - Return a mask of call-preserved registers for the
430430 /// given calling convention on the current sub-target. The mask should
3535 bool isReservedReg(const MachineFunction &MF, unsigned Reg) const;
3636
3737 /// Code Generation virtual methods...
38 const MCPhysReg *
39 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
38 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
4039 const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
4140
4241 unsigned getCSRFirstUseCost() const override {
6262 const MCPhysReg *RegList =
6363 STI.isTargetDarwin() ? CSR_iOS_SaveList : CSR_AAPCS_SaveList;
6464
65 if (!MF) return RegList;
66
6765 const Function *F = MF->getFunction();
6866 if (F->getCallingConv() == CallingConv::GHC) {
6967 // GHC set of callee saved regs is empty as all those regs are
9999
100100 public:
101101 /// Code Generation virtual methods...
102 const MCPhysReg *
103 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
102 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
104103 const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
105104 const uint32_t *getNoPreservedMask() const;
106105
335335 int NumBytes = (int)MFI->getStackSize();
336336 assert((unsigned)NumBytes >= ArgRegsSaveSize &&
337337 "ArgRegsSaveSize is included in NumBytes");
338 const MCPhysReg *CSRegs = RegInfo->getCalleeSavedRegs();
338 const MCPhysReg *CSRegs = RegInfo->getCalleeSavedRegs(&MF);
339339 unsigned FramePtr = RegInfo->getFrameRegister(MF);
340340
341341 if (!AFI->hasStackFrame()) {
2424
2525 BPFRegisterInfo();
2626
27 const MCPhysReg *
28 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
27 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
2928
3029 BitVector getReservedRegs(const MachineFunction &MF) const override;
3130
4545 HexagonRegisterInfo();
4646
4747 /// Code Generation virtual methods...
48 const MCPhysReg *
49 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
48 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
5049
5150 const TargetRegisterClass* const*
5251 getCalleeSavedRegClasses(const MachineFunction *MF = nullptr) const;
388388 /// callee-saved register.
389389 static bool DoesModifyCalleeSavedReg(MachineInstr *MI,
390390 const TargetRegisterInfo *TRI) {
391 for (const MCPhysReg *CSR = TRI->getCalleeSavedRegs(); *CSR; ++CSR) {
391 for (const MCPhysReg *CSR =
392 TRI->getCalleeSavedRegs(MI->getParent()->getParent());
393 *CSR; ++CSR) {
392394 unsigned CalleeSavedReg = *CSR;
393395 if (MI->modifiesRegister(CalleeSavedReg, TRI))
394396 return true;
2525 MSP430RegisterInfo();
2626
2727 /// Code Generation virtual methods...
28 const MCPhysReg *
29 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
28 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
3029
3130 BitVector getReservedRegs(const MachineFunction &MF) const override;
3231 const TargetRegisterClass*
320320 CallerSavedRegs.reset(Mips::ZERO);
321321 CallerSavedRegs.reset(Mips::ZERO_64);
322322
323 for (const MCPhysReg *R = TRI.getCalleeSavedRegs(); *R; ++R)
323 for (const MCPhysReg *R = TRI.getCalleeSavedRegs(MI.getParent()->getParent());
324 *R; ++R)
324325 for (MCRegAliasIterator AI(*R, &TRI, true); AI.isValid(); ++AI)
325326 CallerSavedRegs.reset(*AI);
326327
4646
4747 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
4848 MachineFunction &MF) const override;
49 const MCPhysReg *
50 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
49 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
5150 const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
5251 static const uint32_t *getMips16RetHelperMask();
5352
7777
7878 /// NVPTX Callee Saved Registers
7979 const MCPhysReg *
80 NVPTXRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
80 NVPTXRegisterInfo::getCalleeSavedRegs(const MachineFunction *) const {
8181 static const MCPhysReg CalleeSavedRegs[] = { 0 };
8282 return CalleeSavedRegs;
8383 }
3434 //------------------------------------------------------
3535
3636 // NVPTX callee saved registers
37 const MCPhysReg *
38 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
37 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
3938
4039 BitVector getReservedRegs(const MachineFunction &MF) const override;
4140
3030 SparcRegisterInfo(SparcSubtarget &st);
3131
3232 /// Code Generation virtual methods...
33 const MCPhysReg *
34 getCalleeSavedRegs(const MachineFunction *MF =nullptr) const override;
33 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
3534 const uint32_t* getCallPreservedMask(CallingConv::ID CC) const override;
3635
3736 const uint32_t* getRTCallPreservedMask(CallingConv::ID CC) const;
4242 bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override {
4343 return true;
4444 }
45 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = nullptr) const
46 override;
45 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
4746 const uint32_t *getCallPreservedMask(CallingConv::ID CC) const override;
4847 BitVector getReservedRegs(const MachineFunction &MF) const override;
4948 void eliminateFrameIndex(MachineBasicBlock::iterator MI,
207207 MF.getFunction()->needsUnwindTableEntry();
208208 }
209209
210 const MCPhysReg* XCoreRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
211 const {
210 const MCPhysReg *
211 XCoreRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
212212 // The callee saved registers LR & FP are explicitly handled during
213213 // emitPrologue & emitEpilogue and related functions.
214214 static const MCPhysReg CalleeSavedRegs[] = {
2828
2929 /// Code Generation virtual methods...
3030
31 const MCPhysReg *
32 getCalleeSavedRegs(const MachineFunction *MF =nullptr) const override;
31 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
3332
3433 BitVector getReservedRegs(const MachineFunction &MF) const override;
3534