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))
71 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::MOV16rr), MSP430::FP)
77 I->addLiveIn(MSP430::FP);
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;
136 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::POP16r), MSP430::FP);
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();
158 TII.
get(MSP430::MOV16rr), MSP430::SP).addReg(MSP430::FP);
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 const 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());
244 Amount = (Amount+StackAlign-1)/StackAlign*StackAlign;
247 if (Old.
getOpcode() == TII.getCallFrameSetupOpcode()) {
272 }
else if (I->getOpcode() == TII.getCallFrameDestroyOpcode()) {
275 if (uint64_t CalleeAmt = I->getOperand(1).getImm()) {
299 "Slot for FP register must be last in order to be found!");
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
MSP430MachineFunctionInfo - This class is derived from MachineFunction and contains private MSP430 ta...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
void setIsDead(bool Val=true)
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
DILocation * get() const
Get the underlying DILocation.
const HexagonInstrInfo * TII
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
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...
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
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...
const MachineBasicBlock & front() const
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().
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
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.
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...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
unsigned getCalleeSavedFrameSize() const
void addLiveIn(MCPhysReg PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
const MachineOperand & getOperand(unsigned i) 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...
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...
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
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.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
Representation of each machine instruction.
void setCalleeSavedFrameSize(unsigned bytes)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
virtual const TargetInstrInfo * getInstrInfo() const