LLVM 23.0.0git
TargetFrameLowering.h
Go to the documentation of this file.
1//===-- llvm/CodeGen/TargetFrameLowering.h ----------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Interface to describe the layout of a stack frame on the target machine.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CODEGEN_TARGETFRAMELOWERING_H
14#define LLVM_CODEGEN_TARGETFRAMELOWERING_H
15
16#include "llvm/ADT/BitVector.h"
22#include <vector>
23
24namespace llvm {
25 class BitVector;
26 class CalleeSavedInfo;
27 class MachineFunction;
28 class RegScavenger;
29
40
41/// Information about stack frame layout on the target. It holds the direction
42/// of stack growth, the known stack alignment on entry to each function, and
43/// the offset to the locals area.
44///
45/// The offset to the local area is the offset from the stack pointer on
46/// function entry to the first location where function data (local variables,
47/// spill locations) can be stored.
49public:
51 StackGrowsUp, // Adding to the stack increases the stack address
52 StackGrowsDown // Adding to the stack decreases the stack address
53 };
54
55 // Maps a callee saved register to a stack slot with a fixed offset.
56 struct SpillSlot {
57 unsigned Reg;
58 int64_t Offset; // Offset relative to stack pointer on function entry.
59 };
60
62 // The frame base may be either a register (the default), the CFA with an
63 // offset, or a WebAssembly-specific location description.
66 unsigned Kind; // Wasm local, global, or value stack
67 unsigned Index;
68 };
69 union {
70 // Used with FrameBaseKind::Register.
71 unsigned Reg;
72 // Used with FrameBaseKind::CFA.
73 int64_t Offset;
75 } Location;
76 };
77
78private:
79 StackDirection StackDir;
80 Align StackAlignment;
81 Align TransientStackAlignment;
82 int LocalAreaOffset;
83 bool StackRealignable;
84public:
86 Align TransAl = Align(1), bool StackReal = true)
87 : StackDir(D), StackAlignment(StackAl), TransientStackAlignment(TransAl),
88 LocalAreaOffset(LAO), StackRealignable(StackReal) {}
89
91
92 // These methods return information that describes the abstract stack layout
93 // of the target machine.
94
95 /// getStackGrowthDirection - Return the direction the stack grows
96 ///
97 StackDirection getStackGrowthDirection() const { return StackDir; }
98
99 /// getStackAlignment - This method returns the number of bytes to which the
100 /// stack pointer must be aligned on entry to a function. Typically, this
101 /// is the largest alignment for any data object in the target.
102 ///
103 unsigned getStackAlignment() const { return StackAlignment.value(); }
104 /// getStackAlignment - This method returns the number of bytes to which the
105 /// stack pointer must be aligned on entry to a function. Typically, this
106 /// is the largest alignment for any data object in the target.
107 ///
108 Align getStackAlign() const { return StackAlignment; }
109
110 /// getStackThreshold - Return the maximum stack size
111 ///
112 virtual uint64_t getStackThreshold() const { return UINT_MAX; }
113
114 /// alignSPAdjust - This method aligns the stack adjustment to the correct
115 /// alignment.
116 ///
117 int alignSPAdjust(int SPAdj) const {
118 if (SPAdj < 0) {
119 SPAdj = -alignTo(-SPAdj, StackAlignment);
120 } else {
121 SPAdj = alignTo(SPAdj, StackAlignment);
122 }
123 return SPAdj;
124 }
125
126 /// getTransientStackAlignment - This method returns the number of bytes to
127 /// which the stack pointer must be aligned at all times, even between
128 /// calls.
129 ///
130 Align getTransientStackAlign() const { return TransientStackAlignment; }
131
132 /// isStackRealignable - This method returns whether the stack can be
133 /// realigned.
134 bool isStackRealignable() const {
135 return StackRealignable;
136 }
137
138 /// This method returns whether or not it is safe for an object with the
139 /// given stack id to be bundled into the local area.
140 virtual bool isStackIdSafeForLocalArea(unsigned StackId) const {
141 return true;
142 }
143
144 /// getOffsetOfLocalArea - This method returns the offset of the local area
145 /// from the stack pointer on entrance to a function.
146 ///
147 int getOffsetOfLocalArea() const { return LocalAreaOffset; }
148
149 /// Control the placement of special register scavenging spill slots when
150 /// allocating a stack frame.
151 ///
152 /// If this returns true, the frame indexes used by the RegScavenger will be
153 /// allocated closest to the incoming stack pointer.
154 virtual bool allocateScavengingFrameIndexesNearIncomingSP(
155 const MachineFunction &MF) const;
156
157 /// assignCalleeSavedSpillSlots - Allows target to override spill slot
158 /// assignment logic. If implemented, assignCalleeSavedSpillSlots() should
159 /// assign frame slots to all CSI entries and return true. If this method
160 /// returns false, spill slots will be assigned using generic implementation.
161 /// assignCalleeSavedSpillSlots() may add, delete or rearrange elements of
162 /// CSI.
163 virtual bool
165 const TargetRegisterInfo *TRI,
166 std::vector<CalleeSavedInfo> &CSI) const {
167 return false;
168 }
169
170 /// getCalleeSavedSpillSlots - This method returns a pointer to an array of
171 /// pairs, that contains an entry for each callee saved register that must be
172 /// spilled to a particular stack location if it is spilled.
173 ///
174 /// Each entry in this array contains a <register,offset> pair, indicating the
175 /// fixed offset from the incoming stack pointer that each register should be
176 /// spilled at. If a register is not listed here, the code generator is
177 /// allowed to spill it anywhere it chooses.
178 ///
179 virtual const SpillSlot *
180 getCalleeSavedSpillSlots(unsigned &NumEntries) const {
181 NumEntries = 0;
182 return nullptr;
183 }
184
185 /// targetHandlesStackFrameRounding - Returns true if the target is
186 /// responsible for rounding up the stack frame (probably at emitPrologue
187 /// time).
188 virtual bool targetHandlesStackFrameRounding() const {
189 return false;
190 }
191
192 /// Returns true if the target will correctly handle shrink wrapping.
193 virtual bool enableShrinkWrapping(const MachineFunction &MF) const {
194 return false;
195 }
196
197 /// Returns true if the stack slot holes in the fixed and callee-save stack
198 /// area should be used when allocating other stack locations to reduce stack
199 /// size.
200 virtual bool enableStackSlotScavenging(const MachineFunction &MF) const {
201 return false;
202 }
203
204 /// Returns true if the target can safely skip saving callee-saved registers
205 /// for noreturn nounwind functions.
206 virtual bool enableCalleeSaveSkip(const MachineFunction &MF) const;
207
208 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
209 /// the function.
211 MachineBasicBlock &MBB) const = 0;
213 MachineBasicBlock &MBB) const = 0;
214
215 /// emitZeroCallUsedRegs - Zeros out call used registers.
216 virtual void emitZeroCallUsedRegs(BitVector RegsToZero,
217 MachineBasicBlock &MBB) const {}
218
219 /// With basic block sections, emit callee saved frame moves for basic blocks
220 /// that are in a different section.
221 virtual void
224
225 /// Returns true if we may need to fix the unwind information for the
226 /// function.
227 virtual bool enableCFIFixup(const MachineFunction &MF) const;
228
229 /// enableFullCFIFixup - Returns true if we may need to fix the unwind
230 /// information such that it is accurate for *every* instruction in the
231 /// function (e.g. if the function has an async unwind table).
232 virtual bool enableFullCFIFixup(const MachineFunction &MF) const {
233 return enableCFIFixup(MF);
234 };
235
236 /// Emit CFI instructions that recreate the state of the unwind information
237 /// upon function entry.
239
240 /// Replace a StackProbe stub (if any) with the actual probe code inline
242 MachineBasicBlock &PrologueMBB) const {}
243
244 /// Does the stack probe function call return with a modified stack pointer?
245 virtual bool stackProbeFunctionModifiesSP() const { return false; }
246
247 /// Adjust the prologue to have the function use segmented stacks. This works
248 /// by adding a check even before the "normal" function prologue.
250 MachineBasicBlock &PrologueMBB) const {}
251
252 /// Adjust the prologue to add Erlang Run-Time System (ERTS) specific code in
253 /// the assembly prologue to explicitly handle the stack.
255 MachineBasicBlock &PrologueMBB) const {}
256
257 /// spillCalleeSavedRegisters - Issues instruction(s) to spill all callee
258 /// saved registers and returns true if it isn't possible / profitable to do
259 /// so by issuing a series of store instructions via
260 /// storeRegToStackSlot(). Returns false otherwise.
267
268 /// spillCalleeSavedRegister - Default implementation for spilling a single
269 /// callee saved register.
270 void spillCalleeSavedRegister(MachineBasicBlock &SaveBlock,
272 const CalleeSavedInfo &CS,
273 const TargetInstrInfo *TII,
274 const TargetRegisterInfo *TRI) const;
275
276 /// restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee
277 /// saved registers and returns true if it isn't possible / profitable to do
278 /// so by issuing a series of load instructions via loadRegToStackSlot().
279 /// If it returns true, and any of the registers in CSI is not restored,
280 /// it sets the corresponding Restored flag in CSI to false.
281 /// Returns false otherwise.
282 virtual bool
289
290 // restoreCalleeSavedRegister - Default implementation for restoring a single
291 // callee saved register. Should be called in reverse order. Can insert
292 // multiple instructions.
293 void restoreCalleeSavedRegister(MachineBasicBlock &MBB,
295 const CalleeSavedInfo &CS,
296 const TargetInstrInfo *TII,
297 const TargetRegisterInfo *TRI) const;
298
299 /// hasFP - Return true if the specified function should have a dedicated
300 /// frame pointer register. For most targets this is true only if the function
301 /// has variable sized allocas or if frame pointer elimination is disabled.
302 /// For all targets, this is false if the function has the naked attribute
303 /// since there is no prologue to set up the frame pointer.
304 bool hasFP(const MachineFunction &MF) const {
305 return !MF.getFunction().hasFnAttribute(Attribute::Naked) && hasFPImpl(MF);
306 }
307
308 /// hasReservedCallFrame - Under normal circumstances, when a frame pointer is
309 /// not required, we reserve argument space for call sites in the function
310 /// immediately on entry to the current function. This eliminates the need for
311 /// add/sub sp brackets around call sites. Returns true if the call frame is
312 /// included as part of the stack frame.
313 virtual bool hasReservedCallFrame(const MachineFunction &MF) const {
314 return !hasFP(MF);
315 }
316
317 /// canSimplifyCallFramePseudos - When possible, it's best to simplify the
318 /// call frame pseudo ops before doing frame index elimination. This is
319 /// possible only when frame index references between the pseudos won't
320 /// need adjusting for the call frame adjustments. Normally, that's true
321 /// if the function has a reserved call frame or a frame pointer. Some
322 /// targets (Thumb2, for example) may have more complicated criteria,
323 /// however, and can override this behavior.
324 virtual bool canSimplifyCallFramePseudos(const MachineFunction &MF) const {
325 return hasReservedCallFrame(MF) || hasFP(MF);
326 }
327
328 // needsFrameIndexResolution - Do we need to perform FI resolution for
329 // this function. Normally, this is required only when the function
330 // has any stack objects. However, targets may want to override this.
331 virtual bool needsFrameIndexResolution(const MachineFunction &MF) const;
332
333 /// getFrameIndexReference - This method should return the base register
334 /// and offset used to reference a frame index location. The offset is
335 /// returned directly, and the base register is returned via FrameReg.
336 virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,
337 Register &FrameReg) const;
338
339 /// Same as \c getFrameIndexReference, except that the stack pointer (as
340 /// opposed to the frame pointer) will be the preferred value for \p
341 /// FrameReg. This is generally used for emitting statepoint or EH tables that
342 /// use offsets from RSP. If \p IgnoreSPUpdates is true, the returned
343 /// offset is only guaranteed to be valid with respect to the value of SP at
344 /// the end of the prologue.
345 virtual StackOffset
347 Register &FrameReg,
348 bool IgnoreSPUpdates) const {
349 // Always safe to dispatch to getFrameIndexReference.
350 return getFrameIndexReference(MF, FI, FrameReg);
351 }
352
353 /// getNonLocalFrameIndexReference - This method returns the offset used to
354 /// reference a frame index location. The offset can be from either FP/BP/SP
355 /// based on which base register is returned by llvm.localaddress.
357 int FI) const {
358 // By default, dispatch to getFrameIndexReference. Interested targets can
359 // override this.
360 Register FrameReg;
361 return getFrameIndexReference(MF, FI, FrameReg);
362 }
363
364 /// getFrameIndexReferenceFromSP - This method returns the offset from the
365 /// stack pointer to the slot of the specified index. This function serves to
366 /// provide a comparable offset from a single reference point (the value of
367 /// the stack-pointer at function entry) that can be used for analysis.
368 virtual StackOffset getFrameIndexReferenceFromSP(const MachineFunction &MF,
369 int FI) const;
370
371 /// Returns the callee-saved registers as computed by determineCalleeSaves
372 /// in the BitVector \p SavedRegs.
373 virtual void getCalleeSaves(const MachineFunction &MF,
374 BitVector &SavedRegs) const;
375
376 /// This method determines which of the registers reported by
377 /// TargetRegisterInfo::getCalleeSavedRegs() should actually get saved.
378 /// The default implementation checks populates the \p SavedRegs bitset with
379 /// all registers which are modified in the function, targets may override
380 /// this function to save additional registers.
381 /// This method also sets up the register scavenger ensuring there is a free
382 /// register or a frameindex available.
383 /// This method should not be called by any passes outside of PEI, because
384 /// it may change state passed in by \p MF and \p RS. The preferred
385 /// interface outside PEI is getCalleeSaves.
386 virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
387 RegScavenger *RS = nullptr) const;
388
389 /// processFunctionBeforeFrameFinalized - This method is called immediately
390 /// before the specified function's frame layout (MF.getFrameInfo()) is
391 /// finalized. Once the frame is finalized, MO_FrameIndex operands are
392 /// replaced with direct constants. This method is optional.
393 ///
395 RegScavenger *RS = nullptr) const {
396 }
397
398 /// processFunctionBeforeFrameIndicesReplaced - This method is called
399 /// immediately before MO_FrameIndex operands are eliminated, but after the
400 /// frame is finalized. This method is optional.
401 virtual void
404
405 virtual unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const {
406 reportFatalUsageError("WinEH not implemented for this target");
407 }
408
409 /// This method is called during prolog/epilog code insertion to eliminate
410 /// call frame setup and destroy pseudo instructions (but only if the Target
411 /// is using them). It is responsible for eliminating these instructions,
412 /// replacing them with concrete instructions. This method need only be
413 /// implemented if using call frame setup/destroy pseudo instructions.
414 /// Returns an iterator pointing to the instruction after the replaced one.
419 llvm_unreachable("Call Frame Pseudo Instructions do not exist on this "
420 "target!");
421 }
422
423
424 /// Order the symbols in the local stack frame.
425 /// The list of objects that we want to order is in \p objectsToAllocate as
426 /// indices into the MachineFrameInfo. The array can be reordered in any way
427 /// upon return. The contents of the array, however, may not be modified (i.e.
428 /// only their order may be changed).
429 /// By default, just maintain the original order.
430 virtual void
432 SmallVectorImpl<int> &objectsToAllocate) const {
433 }
434
435 /// Check whether or not the given \p MBB can be used as a prologue
436 /// for the target.
437 /// The prologue will be inserted first in this basic block.
438 /// This method is used by the shrink-wrapping pass to decide if
439 /// \p MBB will be correctly handled by the target.
440 /// As soon as the target enable shrink-wrapping without overriding
441 /// this method, we assume that each basic block is a valid
442 /// prologue.
443 virtual bool canUseAsPrologue(const MachineBasicBlock &MBB) const {
444 return true;
445 }
446
447 /// Check whether or not the given \p MBB can be used as a epilogue
448 /// for the target.
449 /// The epilogue will be inserted before the first terminator of that block.
450 /// This method is used by the shrink-wrapping pass to decide if
451 /// \p MBB will be correctly handled by the target.
452 /// As soon as the target enable shrink-wrapping without overriding
453 /// this method, we assume that each basic block is a valid
454 /// epilogue.
455 virtual bool canUseAsEpilogue(const MachineBasicBlock &MBB) const {
456 return true;
457 }
458
459 /// Returns the StackID that scalable vectors should be associated with.
463
465 switch (ID) {
466 default:
467 return false;
470 return true;
471 }
472 }
473
474 /// Check if given function is safe for not having callee saved registers.
475 /// This is used when interprocedural register allocation is enabled.
476 static bool isSafeForNoCSROpt(const Function &F);
477
478 /// Check if the no-CSR optimisation is profitable for the given function.
479 virtual bool isProfitableForNoCSROpt(const Function &F) const {
480 return true;
481 }
482
483 /// Return initial CFA offset value i.e. the one valid at the beginning of the
484 /// function (before any stack operations).
485 virtual int getInitialCFAOffset(const MachineFunction &MF) const;
486
487 /// Return initial CFA register value i.e. the one valid at the beginning of
488 /// the function (before any stack operations).
489 virtual Register getInitialCFARegister(const MachineFunction &MF) const;
490
491 /// Return the frame base information to be encoded in the DWARF subprogram
492 /// debug info.
493 virtual DwarfFrameBase getDwarfFrameBase(const MachineFunction &MF) const;
494
495 /// If frame pointer or base pointer is clobbered by an instruction, we should
496 /// spill/restore it around that instruction.
497 virtual void spillFPBP(MachineFunction &MF) const {}
498
499 /// This method is called at the end of prolog/epilog code insertion, so
500 /// targets can emit remarks based on the final frame layout.
501 virtual void emitRemarks(const MachineFunction &MF,
503
504protected:
505 virtual bool hasFPImpl(const MachineFunction &MF) const = 0;
506};
507
508} // End llvm namespace
509
510#endif
static int alignTo(int Num, int PowOf2)
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator MBBI
This file implements the BitVector class.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_ABI
Definition Compiler.h:215
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition MD5.cpp:54
===- MachineOptimizationRemarkEmitter.h - Opt Diagnostics -*- C++ -*-—===//
Register const TargetRegisterInfo * TRI
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition Function.cpp:723
MachineInstrBundleIterator< MachineInstr > iterator
Function & getFunction()
Return the LLVM function that this machine code represents.
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:294
Wrapper class representing virtual and physical registers.
Definition Register.h:20
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StackOffset holds a fixed and a scalable offset in bytes.
Definition TypeSize.h:30
virtual void spillFPBP(MachineFunction &MF) const
If frame pointer or base pointer is clobbered by an instruction, we should spill/restore it around th...
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
virtual void emitCalleeSavedFrameMovesFullCFA(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const
With basic block sections, emit callee saved frame moves for basic blocks that are in a different sec...
bool hasFP(const MachineFunction &MF) const
hasFP - Return true if the specified function should have a dedicated frame pointer register.
virtual void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const =0
virtual const SpillSlot * getCalleeSavedSpillSlots(unsigned &NumEntries) const
getCalleeSavedSpillSlots - This method returns a pointer to an array of pairs, that contains an entry...
virtual bool hasReservedCallFrame(const MachineFunction &MF) const
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
virtual bool enableStackSlotScavenging(const MachineFunction &MF) const
Returns true if the stack slot holes in the fixed and callee-save stack area should be used when allo...
Align getTransientStackAlign() const
getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must ...
virtual uint64_t getStackThreshold() const
getStackThreshold - Return the maximum stack size
virtual void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS=nullptr) const
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
virtual bool enableShrinkWrapping(const MachineFunction &MF) const
Returns true if the target will correctly handle shrink wrapping.
virtual void inlineStackProbe(MachineFunction &MF, MachineBasicBlock &PrologueMBB) const
Replace a StackProbe stub (if any) with the actual probe code inline.
virtual void orderFrameObjects(const MachineFunction &MF, SmallVectorImpl< int > &objectsToAllocate) const
Order the symbols in the local stack frame.
virtual bool isStackIdSafeForLocalArea(unsigned StackId) const
This method returns whether or not it is safe for an object with the given stack id to be bundled int...
virtual void adjustForHiPEPrologue(MachineFunction &MF, MachineBasicBlock &PrologueMBB) const
Adjust the prologue to add Erlang Run-Time System (ERTS) specific code in the assembly prologue to ex...
virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, ArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
virtual bool stackProbeFunctionModifiesSP() const
Does the stack probe function call return with a modified stack pointer?
bool isStackRealignable() const
isStackRealignable - This method returns whether the stack can be realigned.
virtual TargetStackID::Value getStackIDForScalableVectors() const
Returns the StackID that scalable vectors should be associated with.
int getOffsetOfLocalArea() const
getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on ent...
TargetFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1), bool StackReal=true)
virtual bool isSupportedStackID(TargetStackID::Value ID) const
virtual MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
virtual StackOffset getNonLocalFrameIndexReference(const MachineFunction &MF, int FI) const
getNonLocalFrameIndexReference - This method returns the offset used to reference a frame index locat...
virtual bool assignCalleeSavedSpillSlots(MachineFunction &MF, const TargetRegisterInfo *TRI, std::vector< CalleeSavedInfo > &CSI) const
assignCalleeSavedSpillSlots - Allows target to override spill slot assignment logic.
virtual void processFunctionBeforeFrameIndicesReplaced(MachineFunction &MF, RegScavenger *RS=nullptr) const
processFunctionBeforeFrameIndicesReplaced - This method is called immediately before MO_FrameIndex op...
virtual StackOffset getFrameIndexReferencePreferSP(const MachineFunction &MF, int FI, Register &FrameReg, bool IgnoreSPUpdates) const
Same as getFrameIndexReference, except that the stack pointer (as opposed to the frame pointer) will ...
virtual bool isProfitableForNoCSROpt(const Function &F) const
Check if the no-CSR optimisation is profitable for the given function.
virtual bool enableFullCFIFixup(const MachineFunction &MF) const
enableFullCFIFixup - Returns true if we may need to fix the unwind information such that it is accura...
StackDirection getStackGrowthDirection() const
getStackGrowthDirection - Return the direction the stack grows
virtual bool canUseAsEpilogue(const MachineBasicBlock &MBB) const
Check whether or not the given MBB can be used as a epilogue for the target.
virtual void adjustForSegmentedStacks(MachineFunction &MF, MachineBasicBlock &PrologueMBB) const
Adjust the prologue to have the function use segmented stacks.
virtual bool canUseAsPrologue(const MachineBasicBlock &MBB) const
Check whether or not the given MBB can be used as a prologue for the target.
int alignSPAdjust(int SPAdj) const
alignSPAdjust - This method aligns the stack adjustment to the correct alignment.
virtual void resetCFIToInitialState(MachineBasicBlock &MBB) const
Emit CFI instructions that recreate the state of the unwind information upon function entry.
virtual bool canSimplifyCallFramePseudos(const MachineFunction &MF) const
canSimplifyCallFramePseudos - When possible, it's best to simplify the call frame pseudo ops before d...
virtual bool hasFPImpl(const MachineFunction &MF) const =0
virtual void emitZeroCallUsedRegs(BitVector RegsToZero, MachineBasicBlock &MBB) const
emitZeroCallUsedRegs - Zeros out call used registers.
virtual void emitRemarks(const MachineFunction &MF, MachineOptimizationRemarkEmitter *ORE) const
This method is called at the end of prolog/epilog code insertion, so targets can emit remarks based o...
virtual bool enableCFIFixup(const MachineFunction &MF) const
Returns true if we may need to fix the unwind information for the function.
virtual bool targetHandlesStackFrameRounding() const
targetHandlesStackFrameRounding - Returns true if the target is responsible for rounding up the stack...
virtual unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const
virtual void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const =0
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, MutableArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const
getFrameIndexReference - This method should return the base register and offset used to reference a f...
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Definition Error.cpp:177
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39