28 void LanaiFrameLowering::determineFrameLayout(
MachineFunction &MF)
const {
36 unsigned StackAlign = LRI->needsStackRealignment(MF) ? MFI.
getMaxAlignment()
45 MaxCallFrameSize =
alignTo(MaxCallFrameSize, StackAlign);
52 FrameSize += MaxCallFrameSize;
55 FrameSize =
alignTo(FrameSize, StackAlign);
64 void LanaiFrameLowering::replaceAdjDynAllocPseudo(
MachineFunction &MF)
const {
72 while (MBBI != MBB->end()) {
79 BuildMI(*MBB, MI, DL, LII.get(Lanai::ADD_I_LO), Dst)
94 assert(&MF.
front() == &MBB &&
"Shrink-wrapping not yet supported");
106 determineFrameLayout(MF);
110 unsigned StackSize = MFI.getStackSize();
114 BuildMI(MBB, MBBI, DL, LII.get(Lanai::SW_RI))
130 if (StackSize != 0) {
131 BuildMI(MBB, MBBI, DL, LII.get(Lanai::SUB_I_LO), Lanai::SP)
138 if (MFI.hasVarSizedObjects())
139 replaceAdjDynAllocPseudo(MF);
187 BuildMI(MBB, MBBI, DL, LII.get(Lanai::ADD_I_LO), Lanai::SP)
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
This class represents lattice values for constants.
const LanaiInstrInfo * getInstrInfo() const override
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned getReg() const
getReg - Returns the register number.
bool adjustsStack() const
Return true if this function adjusts the stack – e.g., when calling another function.
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
bool hasBasePointer(const MachineFunction &MF) const
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
iterator getLastNonDebugInstr()
Returns an iterator to the last non-debug instruction in the basic block, or end().
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void setStackSize(uint64_t Size)
Set the size of the stack.
unsigned getMaxAlignment() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
const MachineBasicBlock & front() const
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
virtual bool hasReservedCallFrame(const MachineFunction &MF) const
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.
const LanaiSubtarget & STI
unsigned getBaseRegister() const
Iterator for intrusive lists based on ilist_node.
unsigned getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call...
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
static unsigned makePreOp(unsigned AluOp)
Representation of each machine instruction.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
void setMaxCallFrameSize(unsigned S)
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineOperand & getOperand(unsigned i) const
const LanaiRegisterInfo * getRegisterInfo() const override
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...