38 bool RequireFPUpdate)
const {
51 BuildMI(MBB, MBBI, dl, TII.get(VE::STSri))
55 BuildMI(MBB, MBBI, dl, TII.get(VE::STSri))
59 BuildMI(MBB, MBBI, dl, TII.get(VE::STSri))
63 BuildMI(MBB, MBBI, dl, TII.get(VE::STSri))
67 BuildMI(MBB, MBBI, dl, TII.get(VE::ORri), VE::SX9)
76 bool RequireFPUpdate)
const {
89 BuildMI(MBB, MBBI, dl, TII.get(VE::ORri), VE::SX11)
92 BuildMI(MBB, MBBI, dl, TII.get(VE::LDSri), VE::SX16)
95 BuildMI(MBB, MBBI, dl, TII.get(VE::LDSri), VE::SX15)
98 BuildMI(MBB, MBBI, dl, TII.get(VE::LDSri), VE::SX10)
101 BuildMI(MBB, MBBI, dl, TII.get(VE::LDSri), VE::SX9)
109 int NumBytes)
const {
114 if (NumBytes >= -64 && NumBytes < 63) {
115 BuildMI(MBB, MBBI, dl, TII.get(VE::ADXri), VE::SX11)
126 BuildMI(MBB, MBBI, dl, TII.get(VE::LEAzzi), VE::SX13)
127 .addImm(
LO32(NumBytes));
128 BuildMI(MBB, MBBI, dl, TII.get(VE::ANDrm0), VE::SX13)
131 BuildMI(MBB, MBBI, dl, TII.get(VE::LEASLrri), VE::SX11)
139 int NumBytes)
const {
170 BuildMI(MBB, MBBI, dl, TII.get(VE::EXTEND_STACK));
171 BuildMI(MBB, MBBI, dl, TII.get(VE::EXTEND_STACK_GUARD));
176 assert(&MF.
front() == &MBB &&
"Shrink-wrapping not yet supported");
187 bool NeedsStackRealignment = RegInfo.needsStackRealignment(MF);
197 "stack re-alignment, but LLVM couldn't handle it " 198 "(probably because it has a dynamic alloca).");
201 int NumBytes = (int)MFI.getStackSize();
216 NumBytes += MFI.getMaxCallFrameSize();
224 if (MFI.getMaxAlignment() > 0) {
225 NumBytes =
alignTo(NumBytes, MFI.getMaxAlignment());
229 MFI.setStackSize(NumBytes);
235 emitSPAdjustment(MF, MBB, MBBI, -NumBytes);
238 emitSPExtend(MF, MBB, MBBI, -NumBytes);
240 unsigned regFP = RegInfo.getDwarfRegNum(VE::SX9,
true);
245 BuildMI(MBB, MBBI, dl, TII.
get(TargetOpcode::CFI_INSTRUCTION))
246 .addCFIIndex(CFIIndex);
250 BuildMI(MBB, MBBI, dl, TII.
get(TargetOpcode::CFI_INSTRUCTION))
251 .addCFIIndex(CFIIndex);
260 if (MI.
getOpcode() == VE::ADJCALLSTACKDOWN)
264 emitSPAdjustment(MF, MBB, I, Size);
299 unsigned &FrameReg)
const {
324 assert(isLeafProc(MF) &&
"TODO implement for non-leaf procs");
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
DILocation * get() const
Get the underlying DILocation.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
static int64_t LO32(int64_t imm)
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
VEFrameLowering(const VESubtarget &ST)
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst)
const VERegisterInfo * getRegisterInfo() const override
void emitPrologueInsns(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, int NumBytes, bool RequireFPUpdate) const
virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
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.
static int64_t HI32(int64_t imm)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const HexagonInstrInfo * TII
const VEInstrInfo * getInstrInfo() const override
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
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.
void emitEpilogueInsns(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, int NumBytes, bool RequireFPUpdate) const
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const override
getFrameIndexReference - This method should return the base register and offset used to reference a f...
iterator getLastNonDebugInstr()
Returns an iterator to the last non-debug instruction in the basic block, or end().
virtual const TargetInstrInfo * getInstrInfo() const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
This file declares the machine register scavenger class.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
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 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.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const MachineBasicBlock & front() const
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
This struct is a compact representation of a valid (non-zero power of two) alignment.
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Information about stack frame layout on the target.
bool isPhysRegUsed(unsigned PhysReg) const
Return true if the specified register is modified or read in this function.
int getAdjustedFrameSize(int stackSize) const
Given a actual stack size as determined by FrameInfo, this function returns adjusted framesize which ...
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool needsStackRealignment(const MachineFunction &MF) const
True if storage within the function requires the stack pointer to be aligned more than the normal cal...
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...
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
bool hasCalls() const
Return true if the current function has any function calls.