LLVM 24.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
41
42/// Information about stack frame layout on the target. It holds the direction
43/// of stack growth, the known stack alignment on entry to each function, and
44/// the offset to the locals area.
45///
46/// The offset to the local area is the offset from the stack pointer on
47/// function entry to the first location where function data (local variables,
48/// spill locations) can be stored.
50public:
52 StackGrowsUp, // Adding to the stack increases the stack address
53 StackGrowsDown // Adding to the stack decreases the stack address
54 };
55
56 // Maps a callee saved register to a stack slot with a fixed offset.
57 struct SpillSlot {
58 unsigned Reg;
59 int64_t Offset; // Offset relative to stack pointer on function entry.
60 };
61
63 // The frame base may be either a register (the default), the CFA with an
64 // offset, or a WebAssembly-specific location description.
67 unsigned Kind; // Wasm local, global, or value stack
68 unsigned Index;
69 };
70 union {
71 // Used with FrameBaseKind::Register.
72 unsigned Reg;
73 // Used with FrameBaseKind::CFA.
74 int64_t Offset;
76 } Location;
77 };
78
79private:
80 StackDirection StackDir;
81 Align StackAlignment;
82 Align TransientStackAlignment;
83 int LocalAreaOffset;
84 bool StackRealignable;
85public:
87 Align TransAl = Align(1), bool StackReal = true)
88 : StackDir(D), StackAlignment(StackAl), TransientStackAlignment(TransAl),
89 LocalAreaOffset(LAO), StackRealignable(StackReal) {}
90
92
93 // These methods return information that describes the abstract stack layout
94 // of the target machine.
95
96 /// getStackGrowthDirection - Return the direction the stack grows
97 ///
98 StackDirection getStackGrowthDirection() const { return StackDir; }
99
100 /// getStackAlignment - This method returns the number of bytes to which the
101 /// stack pointer must be aligned on entry to a function. Typically, this
102 /// is the largest alignment for any data object in the target.
103 ///
104 unsigned getStackAlignment() const { return StackAlignment.value(); }
105 /// getStackAlignment - This method returns the number of bytes to which the
106 /// stack pointer must be aligned on entry to a function. Typically, this
107 /// is the largest alignment for any data object in the target.
108 ///
109 Align getStackAlign() const { return StackAlignment; }
110
111 /// getStackThreshold - Return the maximum stack size
112 ///
113 virtual uint64_t getStackThreshold() const { return UINT_MAX; }
114
115 /// alignSPAdjust - This method aligns the stack adjustment to the correct
116 /// alignment.
117 ///
118 int alignSPAdjust(int SPAdj) const {
119 if (SPAdj < 0) {
120 SPAdj = -alignTo(-SPAdj, StackAlignment);
121 } else {
122 SPAdj = alignTo(SPAdj, StackAlignment);
123 }
124 return SPAdj;
125 }
126
127 /// getTransientStackAlignment - This method returns the number of bytes to
128 /// which the stack pointer must be aligned at all times, even between
129 /// calls.
130 ///
131 Align getTransientStackAlign() const { return TransientStackAlignment; }
132
133 /// isStackRealignable - This method returns whether the stack can be
134 /// realigned.
135 bool isStackRealignable() const {
136 return StackRealignable;
137 }
138
139 /// This method returns whether or not it is safe for an object with the
140 /// given stack id to be bundled into the local area.
141 virtual bool isStackIdSafeForLocalArea(unsigned StackId) const {
142 return true;
143 }
144
145 /// getOffsetOfLocalArea - This method returns the offset of the local area
146 /// from the stack pointer on entrance to a function.
147 ///
148 int getOffsetOfLocalArea() const { return LocalAreaOffset; }
149
150 /// Control the placement of special register scavenging spill slots when
151 /// allocating a stack frame.
152 ///
153 /// If this returns true, the frame indexes used by the RegScavenger will be
154 /// allocated closest to the incoming stack pointer.
155 virtual bool allocateScavengingFrameIndexesNearIncomingSP(
156 const MachineFunction &MF) const;
157
158 /// assignCalleeSavedSpillSlots - Allows target to override spill slot
159 /// assignment logic. If implemented, assignCalleeSavedSpillSlots() should
160 /// assign frame slots to all CSI entries and return true. If this method
161 /// returns false, spill slots will be assigned using generic implementation.
162 /// assignCalleeSavedSpillSlots() may add, delete or rearrange elements of
163 /// CSI.
164 virtual bool
166 const TargetRegisterInfo *TRI,
167 std::vector<CalleeSavedInfo> &CSI) const {
168 return false;
169 }
170
171 /// getCalleeSavedSpillSlots - This method returns a pointer to an array of
172 /// pairs, that contains an entry for each callee saved register that must be
173 /// spilled to a particular stack location if it is spilled.
174 ///
175 /// Each entry in this array contains a <register,offset> pair, indicating the
176 /// fixed offset from the incoming stack pointer that each register should be
177 /// spilled at. If a register is not listed here, the code generator is
178 /// allowed to spill it anywhere it chooses.
179 ///
180 virtual const SpillSlot *
181 getCalleeSavedSpillSlots(unsigned &NumEntries) const {
182 NumEntries = 0;
183 return nullptr;
184 }
185
186 /// targetHandlesStackFrameRounding - Returns true if the target is
187 /// responsible for rounding up the stack frame (probably at emitPrologue
188 /// time).
189 virtual bool targetHandlesStackFrameRounding() const {
190 return false;
191 }
192
193 /// Returns true if the target will correctly handle shrink wrapping.
194 virtual bool enableShrinkWrapping(const MachineFunction &MF) const {
195 return false;
196 }
197
198 /// Returns true if the stack slot holes in the fixed and callee-save stack
199 /// area should be used when allocating other stack locations to reduce stack
200 /// size.
201 virtual bool enableStackSlotScavenging(const MachineFunction &MF) const {
202 return false;
203 }
204
205 /// Returns true if the target can safely skip saving callee-saved registers
206 /// for noreturn nounwind functions.
207 virtual bool enableCalleeSaveSkip(const MachineFunction &MF) const;
208
209 /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
210 /// the function.
212 MachineBasicBlock &MBB) const = 0;
214 MachineBasicBlock &MBB) const = 0;
215
216 /// emitZeroCallUsedRegs - Zeros out call used registers.
217 virtual void emitZeroCallUsedRegs(BitVector RegsToZero,
219 RegScavenger *RS) const {}
220
221 /// With basic block sections, emit callee saved frame moves for basic blocks
222 /// that are in a different section.
223 virtual void
226
227 /// Returns true if we may need to fix the unwind information for the
228 /// function.
229 virtual bool enableCFIFixup(const MachineFunction &MF) const;
230
231 /// enableFullCFIFixup - Returns true if we may need to fix the unwind
232 /// information such that it is accurate for *every* instruction in the
233 /// function (e.g. if the function has an async unwind table).
234 virtual bool enableFullCFIFixup(const MachineFunction &MF) const {
235 return enableCFIFixup(MF);
236 };
237
238 /// Emit CFI instructions that recreate the state of the unwind information
239 /// upon function entry.
241
242 /// Replace a StackProbe stub (if any) with the actual probe code inline
244 MachineBasicBlock &PrologueMBB) const {}
245
246 /// Does the stack probe function call return with a modified stack pointer?
247 virtual bool stackProbeFunctionModifiesSP() const { return false; }
248
249 /// Adjust the prologue to have the function use segmented stacks. This works
250 /// by adding a check even before the "normal" function prologue.
252 MachineBasicBlock &PrologueMBB) const {}
253
254 /// Adjust the prologue to add Erlang Run-Time System (ERTS) specific code in
255 /// the assembly prologue to explicitly handle the stack.
257 MachineBasicBlock &PrologueMBB) const {}
258
259 /// spillCalleeSavedRegisters - Issues instruction(s) to spill all callee
260 /// saved registers and returns true if it isn't possible / profitable to do
261 /// so by issuing a series of store instructions via
262 /// storeRegToStackSlot(). Returns false otherwise.
269
270 /// spillCalleeSavedRegister - Default implementation for spilling a single
271 /// callee saved register.
272 void spillCalleeSavedRegister(MachineBasicBlock &SaveBlock,
274 const CalleeSavedInfo &CS,
275 const TargetInstrInfo *TII,
276 const TargetRegisterInfo *TRI) const;
277
278 /// restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee
279 /// saved registers and returns true if it isn't possible / profitable to do
280 /// so by issuing a series of load instructions via loadRegToStackSlot().
281 /// If it returns true, and any of the registers in CSI is not restored,
282 /// it sets the corresponding Restored flag in CSI to false.
283 /// Returns false otherwise.
284 virtual bool
291
292 // restoreCalleeSavedRegister - Default implementation for restoring a single
293 // callee saved register. Should be called in reverse order. Can insert
294 // multiple instructions.
295 void restoreCalleeSavedRegister(MachineBasicBlock &MBB,
297 const CalleeSavedInfo &CS,
298 const TargetInstrInfo *TII,
299 const TargetRegisterInfo *TRI) const;
300
301 /// hasFP - Return true if the specified function should have a dedicated
302 /// frame pointer register. For most targets this is true only if the function
303 /// has variable sized allocas or if frame pointer elimination is disabled.
304 /// For all targets, this is false if the function has the naked attribute
305 /// since there is no prologue to set up the frame pointer.
306 bool hasFP(const MachineFunction &MF) const {
307 return !MF.getFunction().hasFnAttribute(Attribute::Naked) && hasFPImpl(MF);
308 }
309
310 /// hasReservedCallFrame - Under normal circumstances, when a frame pointer is
311 /// not required, we reserve argument space for call sites in the function
312 /// immediately on entry to the current function. This eliminates the need for
313 /// add/sub sp brackets around call sites. Returns true if the call frame is
314 /// included as part of the stack frame.
315 virtual bool hasReservedCallFrame(const MachineFunction &MF) const {
316 return !hasFP(MF);
317 }
318
319 /// canSimplifyCallFramePseudos - When possible, it's best to simplify the
320 /// call frame pseudo ops before doing frame index elimination. This is
321 /// possible only when frame index references between the pseudos won't
322 /// need adjusting for the call frame adjustments. Normally, that's true
323 /// if the function has a reserved call frame or a frame pointer. Some
324 /// targets (Thumb2, for example) may have more complicated criteria,
325 /// however, and can override this behavior.
326 virtual bool canSimplifyCallFramePseudos(const MachineFunction &MF) const {
327 return hasReservedCallFrame(MF) || hasFP(MF);
328 }
329
330 // needsFrameIndexResolution - Do we need to perform FI resolution for
331 // this function. Normally, this is required only when the function
332 // has any stack objects. However, targets may want to override this.
333 virtual bool needsFrameIndexResolution(const MachineFunction &MF) const;
334
335 /// getFrameIndexReference - This method should return the base register
336 /// and offset used to reference a frame index location. The offset is
337 /// returned directly, and the base register is returned via FrameReg.
338 virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,
339 Register &FrameReg) const;
340
341 /// Same as \c getFrameIndexReference, except that the stack pointer (as
342 /// opposed to the frame pointer) will be the preferred value for \p
343 /// FrameReg. This is generally used for emitting statepoint or EH tables that
344 /// use offsets from RSP. If \p IgnoreSPUpdates is true, the returned
345 /// offset is only guaranteed to be valid with respect to the value of SP at
346 /// the end of the prologue.
347 virtual StackOffset
349 Register &FrameReg,
350 bool IgnoreSPUpdates) const {
351 // Always safe to dispatch to getFrameIndexReference.
352 return getFrameIndexReference(MF, FI, FrameReg);
353 }
354
355 /// getNonLocalFrameIndexReference - This method returns the offset used to
356 /// reference a frame index location. The offset can be from either FP/BP/SP
357 /// based on which base register is returned by llvm.localaddress.
359 int FI) const {
360 // By default, dispatch to getFrameIndexReference. Interested targets can
361 // override this.
362 Register FrameReg;
363 return getFrameIndexReference(MF, FI, FrameReg);
364 }
365
366 /// getFrameIndexReferenceFromSP - This method returns the offset from the
367 /// stack pointer to the slot of the specified index. This function serves to
368 /// provide a comparable offset from a single reference point (the value of
369 /// the stack-pointer at function entry) that can be used for analysis.
370 virtual StackOffset getFrameIndexReferenceFromSP(const MachineFunction &MF,
371 int FI) const;
372
373 /// Return the list of registers which must be preserved by the function: the
374 /// value on exit must be the same as the value on entry. A register from this
375 /// list does may not need to be saved / reloaded if the function did not use
376 /// it.
377 const MCPhysReg *getMustPreserveRegisters(const MachineFunction &MF) const;
378
379 /// This method determines which of the registers reported by
380 /// getMustPreserveRegisters() must be saved in prolog and reloaded in epilog
381 /// regardless of whether or not they were modified by the function.
382 void determineUncondPrologCalleeSaves(MachineFunction &MF,
383 const MCPhysReg *CSRegs,
384 BitVector &UncondPrologCSRs) const;
385
386 /// Returns the callee-saved registers as computed by determineCalleeSaves
387 /// in the BitVector \p SavedRegs.
388 virtual void getCalleeSaves(const MachineFunction &MF,
389 BitVector &SavedRegs) const;
390
391 /// This method determines which of the registers reported by
392 /// TargetRegisterInfo::getCalleeSavedRegs() should actually get saved.
393 /// The default implementation checks populates the \p SavedRegs bitset with
394 /// all registers which are modified in the function, targets may override
395 /// this function to save additional registers.
396 /// This method also sets up the register scavenger ensuring there is a free
397 /// register or a frameindex available.
398 /// This method should not be called by any passes outside of PEI, because
399 /// it may change state passed in by \p MF and \p RS. The preferred
400 /// interface outside PEI is getCalleeSaves.
401 virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
402 RegScavenger *RS = nullptr) const;
403
404 /// processFunctionBeforeFrameFinalized - This method is called immediately
405 /// before the specified function's frame layout (MF.getFrameInfo()) is
406 /// finalized. Once the frame is finalized, MO_FrameIndex operands are
407 /// replaced with direct constants. This method is optional.
408 ///
410 RegScavenger *RS = nullptr) const {
411 }
412
413 /// processFunctionBeforeFrameIndicesReplaced - This method is called
414 /// immediately before MO_FrameIndex operands are eliminated, but after the
415 /// frame is finalized. This method is optional.
416 virtual void
419
420 virtual unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const {
421 reportFatalUsageError("WinEH not implemented for this target");
422 }
423
424 /// This method is called during prolog/epilog code insertion to eliminate
425 /// call frame setup and destroy pseudo instructions (but only if the Target
426 /// is using them). It is responsible for eliminating these instructions,
427 /// replacing them with concrete instructions. This method need only be
428 /// implemented if using call frame setup/destroy pseudo instructions.
429 /// Returns an iterator pointing to the instruction after the replaced one.
434 llvm_unreachable("Call Frame Pseudo Instructions do not exist on this "
435 "target!");
436 }
437
438
439 /// Order the symbols in the local stack frame.
440 /// The list of objects that we want to order is in \p objectsToAllocate as
441 /// indices into the MachineFrameInfo. The array can be reordered in any way
442 /// upon return. The contents of the array, however, may not be modified (i.e.
443 /// only their order may be changed).
444 /// By default, just maintain the original order.
445 virtual void
447 SmallVectorImpl<int> &objectsToAllocate) const {
448 }
449
450 /// Check whether or not the given \p MBB can be used as a prologue
451 /// for the target.
452 /// The prologue will be inserted first in this basic block.
453 /// This method is used by the shrink-wrapping pass to decide if
454 /// \p MBB will be correctly handled by the target.
455 /// As soon as the target enable shrink-wrapping without overriding
456 /// this method, we assume that each basic block is a valid
457 /// prologue.
458 virtual bool canUseAsPrologue(const MachineBasicBlock &MBB) const {
459 return true;
460 }
461
462 /// Check whether or not the given \p MBB can be used as a epilogue
463 /// for the target.
464 /// The epilogue will be inserted before the first terminator of that block.
465 /// This method is used by the shrink-wrapping pass to decide if
466 /// \p MBB will be correctly handled by the target.
467 /// As soon as the target enable shrink-wrapping without overriding
468 /// this method, we assume that each basic block is a valid
469 /// epilogue.
470 virtual bool canUseAsEpilogue(const MachineBasicBlock &MBB) const {
471 return true;
472 }
473
474 /// Returns the StackID that scalable vectors should be associated with.
478
480 switch (ID) {
481 default:
482 return false;
485 return true;
486 }
487 }
488
489 /// Check if given function is safe for not having callee saved registers.
490 /// This is used when interprocedural register allocation is enabled.
491 static bool isSafeForNoCSROpt(const Function &F);
492
493 /// Check if the no-CSR optimisation is profitable for the given function.
494 virtual bool isProfitableForNoCSROpt(const Function &F) const {
495 return true;
496 }
497
498 /// Return initial CFA offset value i.e. the one valid at the beginning of the
499 /// function (before any stack operations).
500 virtual int getInitialCFAOffset(const MachineFunction &MF) const;
501
502 /// Return initial CFA register value i.e. the one valid at the beginning of
503 /// the function (before any stack operations).
504 virtual Register getInitialCFARegister(const MachineFunction &MF) const;
505
506 /// Return the frame base information to be encoded in the DWARF subprogram
507 /// debug info.
508 virtual DwarfFrameBase getDwarfFrameBase(const MachineFunction &MF) const;
509
510 /// If frame pointer or base pointer is clobbered by an instruction, we should
511 /// spill/restore it around that instruction.
512 virtual void spillFPBP(MachineFunction &MF) const {}
513
514 /// This method is called at the end of prolog/epilog code insertion, so
515 /// targets can emit remarks based on the final frame layout.
516 virtual void emitRemarks(const MachineFunction &MF,
518
519protected:
520 virtual bool hasFPImpl(const MachineFunction &MF) const = 0;
521};
522
523} // End llvm namespace
524
525#endif
static int alignTo(int Num, int PowOf2)
unsigned uint64_t
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:727
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...
virtual void emitZeroCallUsedRegs(BitVector RegsToZero, MachineBasicBlock &MBB, RegScavenger *RS) const
emitZeroCallUsedRegs - Zeros out call used registers.
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 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.
This is an optimization pass for GlobalISel generic memory operations.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
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