44 assert(&MF.
front() == &MBB &&
"Shrink-wrapping not yet supported");
54 uint64_t StackSize = MFI->getStackSize();
56 uint64_t NumBytes = 0;
59 uint64_t FrameSize = StackSize - 2;
65 MFI->setOffsetAdjustment(-NumBytes);
68 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::PUSH16r))
72 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::MOV16rr), MSP430::FP)
78 I->addLiveIn(MSP430::FP);
84 while (MBBI != MBB.
end() && (MBBI->getOpcode() == MSP430::PUSH16r))
87 if (MBBI != MBB.
end())
88 DL = MBBI->getDebugLoc();
116 unsigned RetOpcode = MBBI->getOpcode();
121 case MSP430::RETI:
break;
129 uint64_t NumBytes = 0;
133 uint64_t FrameSize = StackSize - 2;
134 NumBytes = FrameSize - CSSize;
137 BuildMI(MBB, MBBI, DL, TII.
get(MSP430::POP16r), MSP430::FP);
139 NumBytes = StackSize - CSSize;
142 while (MBBI != MBB.
begin()) {
144 unsigned Opc = PI->getOpcode();
145 if (Opc != MSP430::POP16r && !PI->isTerminator())
150 DL = MBBI->getDebugLoc();
184 const std::vector<CalleeSavedInfo> &CSI,
190 if (MI != MBB.
end()) DL = MI->getDebugLoc();
197 for (
unsigned i = CSI.size(); i != 0; --i) {
198 unsigned Reg = CSI[i-1].getReg();
201 BuildMI(MBB, MI, DL, TII.
get(MSP430::PUSH16r))
210 const std::vector<CalleeSavedInfo> &CSI,
216 if (MI != MBB.
end()) DL = MI->getDebugLoc();
221 for (
unsigned i = 0, e = CSI.size(); i != e; ++i)
222 BuildMI(MBB, MI, DL, TII.
get(MSP430::POP16r), CSI[i].getReg());
245 Amount = (Amount+StackAlign-1)/StackAlign*StackAlign;
248 if (Old->
getOpcode() == TII.getCallFrameSetupOpcode()) {
253 assert(Old->
getOpcode() == TII.getCallFrameDestroyOpcode());
271 }
else if (I->getOpcode() == TII.getCallFrameDestroyOpcode()) {
274 if (uint64_t CalleeAmt = I->getOperand(1).getImm()) {
297 "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
getParent - Return the MachineFunction containing this basic block.
MSP430MachineFunctionInfo - This class is derived from MachineFunction and contains private MSP430 ta...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
void addLiveIn(unsigned Reg)
Adds the specified register as a live in.
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.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
DILocation * get() const
Get the underlying DILocation.
const HexagonInstrInfo * TII
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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
addImm - Add a new immediate operand.
const MachineBasicBlock & front() const
int getObjectIndexBegin() const
Return the minimum frame object index.
iterator getLastNonDebugInstr()
getLastNonDebugInstr - returns an iterator to the last non-debug instruction in the basic block...
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
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...
bundle_iterator< MachineInstr, instr_iterator > iterator
unsigned getCalleeSavedFrameSize() const
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.
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
BuildMI - Builder interface.
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.
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.
MachineFrameInfo * getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
void eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
eliminateCallFramePseudoInstr - This method is called during prolog/epilog code insertion to eliminat...
virtual const TargetInstrInfo * getInstrInfo() const
BasicBlockListType::iterator iterator