42 return new NVPTXPrologEpilogPass();
51 bool Modified =
false;
53 calculateFrameObjectOffsets(MF);
72 if (!
I->empty() &&
I->back().isReturn())
82 bool StackGrowsDown, int64_t &Offset,
92 MaxAlign = std::max(MaxAlign, Align);
95 Offset = (Offset + Align - 1) / Align * Align;
98 DEBUG(
dbgs() <<
"alloc FI(" << FrameIdx <<
") at SP[" << -Offset <<
"]\n");
101 DEBUG(
dbgs() <<
"alloc FI(" << FrameIdx <<
") at SP[" << Offset <<
"]\n");
108 NVPTXPrologEpilogPass::calculateFrameObjectOffsets(
MachineFunction &Fn) {
112 bool StackGrowsDown =
123 LocalAreaOffset = -LocalAreaOffset;
124 assert(LocalAreaOffset >= 0
125 &&
"Local area offset should be in direction of stack growth");
126 int64_t Offset = LocalAreaOffset;
135 if (StackGrowsDown) {
145 if (FixedOff > Offset) Offset = FixedOff;
162 Offset = (Offset + Align - 1) / Align * Align;
164 DEBUG(
dbgs() <<
"Local frame base offset: " << Offset <<
"\n");
169 int64_t FIOffset = (StackGrowsDown ? -Offset : Offset) + Entry.second;
170 DEBUG(
dbgs() <<
"alloc FI(" << Entry.first <<
") at SP[" <<
177 MaxAlign = std::max(Align, MaxAlign);
217 StackAlign = std::max(StackAlign, MaxAlign);
218 unsigned AlignMask = StackAlign - 1;
219 Offset = (Offset + AlignMask) & ~uint64_t(AlignMask);
223 int64_t StackSize = Offset - LocalAreaOffset;
unsigned getStackAlignment() const
bool adjustsStack() const
MachineFunctionPass * createNVPTXPrologEpilogPass()
bool isObjectPreAllocated(int ObjectIdx) const
unsigned getMaxAlignment() const
virtual bool targetHandlesStackFrameRounding() const
int64_t getLocalFrameSize() const
getLocalFrameSize - Get the size of the local object blob.
Abstract Stack Frame Information.
ID
LLVM Calling Convention Representation.
unsigned getNumOperands() const
int getObjectIndexBegin() const
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
unsigned getLocalFrameMaxAlign() const
unsigned getTransientStackAlignment() const
bundle_iterator< MachineInstr, instr_iterator > iterator
virtual bool needsStackRealignment(const MachineFunction &MF) const
bool getUseLocalStackAllocationBlock()
void setStackSize(uint64_t Size)
const MachineOperand & getOperand(unsigned i) const
static void AdjustStackOffset(MachineFrameInfo *MFI, int FrameIdx, bool StackGrowsDown, int64_t &Offset, unsigned &MaxAlign)
AdjustStackOffset - Helper function used to adjust the stack frame offset.
virtual const TargetFrameLowering * getFrameLowering() const
virtual bool hasReservedCallFrame(const MachineFunction &MF) const
int64_t getObjectOffset(int ObjectIdx) const
bool isDeadObjectIndex(int ObjectIdx) const
int64_t getLocalFrameObjectCount()
virtual void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const =0
unsigned getObjectAlignment(int ObjectIdx) const
getObjectAlignment - Return the alignment of the specified stack object.
int getOffsetOfLocalArea() const
unsigned getMaxCallFrameSize() const
MachineFrameInfo * getFrameInfo()
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(DefaultAlign), cl::values(clEnumValN(DefaultAlign,"arm-default-align","Generate unaligned accesses only on hardware/OS ""combinations that are known to support them"), clEnumValN(StrictAlign,"arm-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"arm-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
StackDirection getStackGrowthDirection() const
virtual void emitPrologue(MachineFunction &MF) const =0
const TargetMachine & getTarget() const
virtual const TargetRegisterInfo * getRegisterInfo() const
bool hasVarSizedObjects() const
virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=NULL) const =0
BasicBlockListType::iterator iterator
void setObjectOffset(int ObjectIdx, int64_t SPOffset)
std::pair< int, int64_t > getLocalFrameObjectMap(int i)
getLocalFrameObjectMap - Get the local offset mapping for a for an object
int getObjectIndexEnd() const
int64_t getObjectSize(int ObjectIdx) const