37 assert(&MF.
front() == &MBB &&
"Shrink-wrapping not yet supported");
43 uint64_t StackSize = MFI->getStackSize();
46 if (StackSize == 0 && !MFI->adjustsStack())
return;
53 TII.
makeFrame(Mips::SP, StackSize, MBB, MBBI);
59 .addCFIIndex(CFIIndex);
61 const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
64 const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
66 for (std::vector<CalleeSavedInfo>::const_iterator
I = CSI.begin(),
67 E = CSI.end();
I != E; ++
I) {
68 int64_t Offset = MFI->getObjectOffset(
I->getFrameIdx());
69 unsigned Reg =
I->getReg();
74 .addCFIIndex(CFIIndex);
78 BuildMI(MBB, MBBI, dl, TII.get(Mips::MoveR3216), Mips::S0)
96 BuildMI(MBB, MBBI, dl, TII.get(Mips::Move32R16), Mips::SP)
107 const std::vector<CalleeSavedInfo> &CSI,
117 for (
unsigned i = 0, e = CSI.size(); i != e; ++i) {
123 unsigned Reg = CSI[i].getReg();
124 bool IsRAAndRetAddrIsTaken = (Reg == Mips::RA)
126 if (!IsRAAndRetAddrIsTaken)
135 const std::vector<CalleeSavedInfo> &CSI,
163 bool SaveS2 = Reserved[Mips::S2];
165 SavedRegs.
set(Mips::S2);
167 SavedRegs.
set(Mips::S0);
Mips16FrameLowering(const MipsSubtarget &STI)
const MachineFunction * getParent() const
getParent - Return the MachineFunction containing this basic block.
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
const MipsFrameLowering * createMips16FrameLowering(const MipsSubtarget &ST)
Create MipsFrameLowering objects.
const MipsSubtarget & STI
void makeFrame(unsigned SP, int64_t FrameSize, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
const MipsInstrInfo * getInstrInfo() const override
void addLiveIn(unsigned Reg)
Adds the specified register as a live in.
bool isReturnAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
static MCCFIInstruction createDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...
const HexagonInstrInfo * TII
Reg
All possible values of the reg field in the ModR/M byte.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
const MachineBasicBlock & front() const
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
unsigned LLVM_ATTRIBUTE_UNUSED_RESULT addFrameInst(const MCCFIInstruction &Inst)
BitVector getReservedRegs(const MachineFunction &MF) const override
iterator getLastNonDebugInstr()
getLastNonDebugInstr - returns an iterator to the last non-debug instruction in the basic block...
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
void restoreFrame(unsigned SP, int64_t FrameSize, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
bundle_iterator< MachineInstr, instr_iterator > iterator
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
BuildMI - Builder interface.
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const MipsRegisterInfo & getRegisterInfo() const override
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
const MCContext & getContext() const
unsigned getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call...
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MCRegisterInfo * getRegisterInfo() const
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required, we reserve argument space for call sites in the function immediately on entry to the current function.
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
MachineModuleInfo & getMMI() const
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
MachineModuleInfo - This class contains meta information specific to a module.