43 assert(&MF.
front() == &MBB &&
"Shrink-wrapping not yet supported");
53 uint64_t StackSize = MFI.getStackSize();
55 uint64_t NumBytes = 0;
58 uint64_t FrameSize = StackSize - 2;
64 MFI.setOffsetAdjustment(-NumBytes);
67 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::PUSH16r))
83 while (MBBI != MBB.
end() && (MBBI->getOpcode() == MSP430::PUSH16r))
86 if (MBBI != MBB.
end())
87 DL = MBBI->getDebugLoc();
99 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::SUB16ri), MSP430::SP)
100 .addReg(MSP430::SP).
addImm(NumBytes);
115 unsigned RetOpcode = MBBI->getOpcode();
120 case MSP430::RETI:
break;
128 uint64_t NumBytes = 0;
132 uint64_t FrameSize = StackSize - 2;
133 NumBytes = FrameSize - CSSize;
138 NumBytes = StackSize - CSSize;
141 while (MBBI != MBB.
begin()) {
143 unsigned Opc = PI->getOpcode();
144 if (Opc != MSP430::POP16r && !PI->isTerminator())
149 DL = MBBI->getDebugLoc();
162 TII.
get(MSP430::SUB16ri), MSP430::SP)
163 .addReg(MSP430::SP).
addImm(CSSize);
171 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::ADD16ri), MSP430::SP)
172 .addReg(MSP430::SP).
addImm(NumBytes);
183 const std::vector<CalleeSavedInfo> &CSI,
189 if (MI != MBB.
end()) DL = MI->getDebugLoc();
196 for (
unsigned i = CSI.size(); i != 0; --i) {
197 unsigned Reg = CSI[i-1].getReg();
200 BuildMI(MBB, MI, DL, TII.
get(MSP430::PUSH16r))
209 std::vector<CalleeSavedInfo> &CSI,
215 if (MI != MBB.
end()) DL = MI->getDebugLoc();
220 for (
unsigned i = 0, e = CSI.size(); i != e; ++i)
221 BuildMI(MBB, MI, DL, TII.
get(MSP430::POP16r), CSI[i].getReg());
239 uint64_t Amount = TII.getFrameSize(Old);
244 Amount = (Amount+StackAlign-1)/StackAlign*StackAlign;
247 if (Old.
getOpcode() == TII.getCallFrameSetupOpcode()) {
271 }
else if (I->getOpcode() == TII.getCallFrameDestroyOpcode()) {
298 "Slot for FP register must be last in order to be found!");
DILocation * get() const
Get the underlying DILocation.
MSP430MachineFunctionInfo - This class is derived from MachineFunction and contains private MSP430 ta...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
This class represents lattice values for constants.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned const TargetRegisterInfo * TRI
void setIsDead(bool Val=true)
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
const HexagonInstrInfo * TII
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.
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...
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
int getObjectIndexBegin() const
Return the minimum frame object index.
iterator getLastNonDebugInstr()
Returns an iterator to the last non-debug instruction in the basic block, or end().
virtual const TargetInstrInfo * getInstrInfo() const
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
TargetInstrInfo - Interface to description of machine instruction set.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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...
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS=nullptr) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const MachineBasicBlock & front() 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.
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Iterator for intrusive lists based on ilist_node.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
int64_t getFramePoppedByCallee(const MachineInstr &I) const
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
void setCalleeSavedFrameSize(unsigned bytes)
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
unsigned getCalleeSavedFrameSize() const
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MachineOperand & getOperand(unsigned i) const
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...