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
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,
218 RegScavenger *RS) const {}
219
220 /// With basic block sections, emit callee saved frame moves for basic blocks
221 /// that are in a different section.
222 virtual void
225
226 /// Returns true if we may need to fix the unwind information for the
227 /// function.
228 virtual bool enableCFIFixup(const MachineFunction &MF) const;
229
230 /// enableFullCFIFixup - Returns true if we may need to fix the unwind
231 /// information such that it is accurate for *every* instruction in the
232 /// function (e.g. if the function has an async unwind table).
233 virtual bool enableFullCFIFixup(const MachineFunction &MF) const {
234 return enableCFIFixup(MF);
235 };
236
237 /// Emit CFI instructions that recreate the state of the unwind information
238 /// upon function entry.
240
241 /// Replace a StackProbe stub (if any) with the actual probe code inline
243 MachineBasicBlock &PrologueMBB) const {}
244
245 /// Does the stack probe function call return with a modified stack pointer?
246 virtual bool stackProbeFunctionModifiesSP() const { return false; }
247
248 /// Adjust the prologue to have the function use segmented stacks. This works
249 /// by adding a check even before the "normal" function prologue.
251 MachineBasicBlock &PrologueMBB) const {}
252
253 /// Adjust the prologue to add Erlang Run-Time System (ERTS) specific code in
254 /// the assembly prologue to explicitly handle the stack.
256 MachineBasicBlock &PrologueMBB) const {}
257
258 /// spillCalleeSavedRegisters - Issues instruction(s) to spill all callee
259 /// saved registers and returns true if it isn't possible / profitable to do
260 /// so by issuing a series of store instructions via
261 /// storeRegToStackSlot(). Returns false otherwise.
268
269 /// spillCalleeSavedRegister - Default implementation for spilling a single
270 /// callee saved register.
271 void spillCalleeSavedRegister(MachineBasicBlock &SaveBlock,
273 const CalleeSavedInfo &CS,
274 const TargetInstrInfo *TII,
275 const TargetRegisterInfo *TRI) const;
276
277 /// restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee
278 /// saved registers and returns true if it isn't possible / profitable to do
279 /// so by issuing a series of load instructions via loadRegToStackSlot().
280 /// If it returns true, and any of the registers in CSI is not restored,
281 /// it sets the corresponding Restored flag in CSI to false.
282 /// Returns false otherwise.
283 virtual bool
290
291 // restoreCalleeSavedRegister - Default implementation for restoring a single
292 // callee saved register. Should be called in reverse order. Can insert
293 // multiple instructions.
294 void restoreCalleeSavedRegister(MachineBasicBlock &MBB,
296 const CalleeSavedInfo &CS,
297 const TargetInstrInfo *TII,
298 const TargetRegisterInfo *TRI) const;
299
300 /// hasFP - Return true if the specified function should have a dedicated
301 /// frame pointer register. For most targets this is true only if the function
302 /// has variable sized allocas or if frame pointer elimination is disabled.
303 /// For all targets, this is false if the function has the naked attribute
304 /// since there is no prologue to set up the frame pointer.
305 bool hasFP(const MachineFunction &MF) const {
306 return !MF.getFunction().hasFnAttribute(Attribute::Naked) && hasFPImpl(MF);
307 }
308
309 /// hasReservedCallFrame - Under normal circumstances, when a frame pointer is
310 /// not required, we reserve argument space for call sites in the function
311 /// immediately on entry to the current function. This eliminates the need for
312 /// add/sub sp brackets around call sites. Returns true if the call frame is
313 /// included as part of the stack frame.
314 virtual bool hasReservedCallFrame(const MachineFunction &MF) const {
315 return !hasFP(MF);
316 }
317
318 /// canSimplifyCallFramePseudos - When possible, it's best to simplify the
319 /// call frame pseudo ops before doing frame index elimination. This is
320 /// possible only when frame index references between the pseudos won't
321 /// need adjusting for the call frame adjustments. Normally, that's true
322 /// if the function has a reserved call frame or a frame pointer. Some
323 /// targets (Thumb2, for example) may have more complicated criteria,
324 /// however, and can override this behavior.
325 virtual bool canSimplifyCallFramePseudos(const MachineFunction &MF) const {
326 return hasReservedCallFrame(MF) || hasFP(MF);
327 }
328
329 // needsFrameIndexResolution - Do we need to perform FI resolution for
330 // this function. Normally, this is required only when the function
331 // has any stack objects. However, targets may want to override this.
332 virtual bool needsFrameIndexResolution(const MachineFunction &MF) const;
333
334 /// getFrameIndexReference - This method should return the base register
335 /// and offset used to reference a frame index location. The offset is
336 /// returned directly, and the base register is returned via FrameReg.
337 virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,
338 Register &FrameReg) const;
339
340 /// Same as \c getFrameIndexReference, except that the stack pointer (as
341 /// opposed to the frame pointer) will be the preferred value for \p
342 /// FrameReg. This is generally used for emitting statepoint or EH tables that
343 /// use offsets from RSP. If \p IgnoreSPUpdates is true, the returned
344 /// offset is only guaranteed to be valid with respect to the value of SP at
345 /// the end of the prologue.
346 virtual StackOffset
348 Register &FrameReg,
349 bool IgnoreSPUpdates) const {
350 // Always safe to dispatch to getFrameIndexReference.
351 return getFrameIndexReference(MF, FI, FrameReg);
352 }
353
354 /// getNonLocalFrameIndexReference - This method returns the offset used to
355 /// reference a frame index location. The offset can be from either FP/BP/SP
356 /// based on which base register is returned by llvm.localaddress.
358 int FI) const {
359 // By default, dispatch to getFrameIndexReference. Interested targets can
360 // override this.
361 Register FrameReg;
362 return getFrameIndexReference(MF, FI, FrameReg);
363 }
364
365 /// getFrameIndexReferenceFromSP - This method returns the offset from the
366 /// stack pointer to the slot of the specified index. This function serves to
367 /// provide a comparable offset from a single reference point (the value of
368 /// the stack-pointer at function entry) that can be used for analysis.
369 virtual StackOffset getFrameIndexReferenceFromSP(const MachineFunction &MF,
370 int FI) const;
371
372 /// Return the list of registers which must be preserved by the function: the
373 /// value on exit must be the same as the value on entry. A register from this
374 /// list does may not need to be saved / reloaded if the function did not use
375 /// it.
376 const MCPhysReg *getMustPreserveRegisters(const MachineFunction &MF) const;
377
378 /// This method determines which of the registers reported by
379 /// getMustPreserveRegisters() must be saved in prolog and reloaded in epilog
380 /// regardless of whether or not they were modified by the function.
381 void determineUncondPrologCalleeSaves(MachineFunction &MF,
382 const MCPhysReg *CSRegs,
383 BitVector &UncondPrologCSRs) const;
384
385 /// Returns the callee-saved registers as computed by determineCalleeSaves
386 /// in the BitVector \p SavedRegs.
387 virtual void getCalleeSaves(const MachineFunction &MF,
388 BitVector &SavedRegs) const;
389
390 /// This method determines which of the registers reported by
391 /// TargetRegisterInfo::getCalleeSavedRegs() should actually get saved.
392 /// The default implementation checks populates the \p SavedRegs bitset with
393 /// all registers which are modified in the function, targets may override
394 /// this function to save additional registers.
395 /// This method also sets up the register scavenger ensuring there is a free
396 /// register or a frameindex available.
397 /// This method should not be called by any passes outside of PEI, because
398 /// it may change state passed in by \p MF and \p RS. The preferred
399 /// interface outside PEI is getCalleeSaves.
400 virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
401 RegScavenger *RS = nullptr) const;
402
403 /// processFunctionBeforeFrameFinalized - This method is called immediately
404 /// before the specified function's frame layout (MF.getFrameInfo()) is
405 /// finalized. Once the frame is finalized, MO_FrameIndex operands are
406 /// replaced with direct constants. This method is optional.
407 ///
409 RegScavenger *RS = nullptr) const {
410 }
411
412 /// processFunctionBeforeFrameIndicesReplaced - This method is called
413 /// immediately before MO_FrameIndex operands are eliminated, but after the
414 /// frame is finalized. This method is optional.
415 virtual void
418
419 virtual unsigned getWinEHParentFrameOffset(const MachineFunction &MF) const {
420 reportFatalUsageError("WinEH not implemented for this target");
421 }
422
423 /// This method is called during prolog/epilog code insertion to eliminate
424 /// call frame setup and destroy pseudo instructions (but only if the Target
425 /// is using them). It is responsible for eliminating these instructions,
426 /// replacing them with concrete instructions. This method need only be
427 /// implemented if using call frame setup/destroy pseudo instructions.
428 /// Returns an iterator pointing to the instruction after the replaced one.
433 llvm_unreachable("Call Frame Pseudo Instructions do not exist on this "
434 "target!");
435 }
436
437
438 /// Order the symbols in the local stack frame.
439 /// The list of objects that we want to order is in \p objectsToAllocate as
440 /// indices into the MachineFrameInfo. The array can be reordered in any way
441 /// upon return. The contents of the array, however, may not be modified (i.e.
442 /// only their order may be changed).
443 /// By default, just maintain the original order.
444 virtual void
446 SmallVectorImpl<int> &objectsToAllocate) const {
447 }
448
449 /// Check whether or not the given \p MBB can be used as a prologue
450 /// for the target.
451 /// The prologue will be inserted first in this basic block.
452 /// This method is used by the shrink-wrapping pass to decide if
453 /// \p MBB will be correctly handled by the target.
454 /// As soon as the target enable shrink-wrapping without overriding
455 /// this method, we assume that each basic block is a valid
456 /// prologue.
457 virtual bool canUseAsPrologue(const MachineBasicBlock &MBB) const {
458 return true;
459 }
460
461 /// Check whether or not the given \p MBB can be used as a epilogue
462 /// for the target.
463 /// The epilogue will be inserted before the first terminator of that block.
464 /// This method is used by the shrink-wrapping pass to decide if
465 /// \p MBB will be correctly handled by the target.
466 /// As soon as the target enable shrink-wrapping without overriding
467 /// this method, we assume that each basic block is a valid
468 /// epilogue.
469 virtual bool canUseAsEpilogue(const MachineBasicBlock &MBB) const {
470 return true;
471 }
472
473 /// Returns the StackID that scalable vectors should be associated with.
477
479 switch (ID) {
480 default:
481 return false;
484 return true;
485 }
486 }
487
488 /// Check if given function is safe for not having callee saved registers.
489 /// This is used when interprocedural register allocation is enabled.
490 static bool isSafeForNoCSROpt(const Function &F);
491
492 /// Check if the no-CSR optimisation is profitable for the given function.
493 virtual bool isProfitableForNoCSROpt(const Function &F) const {
494 return true;
495 }
496
497 /// Return initial CFA offset value i.e. the one valid at the beginning of the
498 /// function (before any stack operations).
499 virtual int getInitialCFAOffset(const MachineFunction &MF) const;
500
501 /// Return initial CFA register value i.e. the one valid at the beginning of
502 /// the function (before any stack operations).
503 virtual Register getInitialCFARegister(const MachineFunction &MF) const;
504
505 /// Return the frame base information to be encoded in the DWARF subprogram
506 /// debug info.
507 virtual DwarfFrameBase getDwarfFrameBase(const MachineFunction &MF) const;
508
509 /// If frame pointer or base pointer is clobbered by an instruction, we should
510 /// spill/restore it around that instruction.
511 virtual void spillFPBP(MachineFunction &MF) const {}
512
513 /// This method is called at the end of prolog/epilog code insertion, so
514 /// targets can emit remarks based on the final frame layout.
515 virtual void emitRemarks(const MachineFunction &MF,
517
518protected:
519 virtual bool hasFPImpl(const MachineFunction &MF) const = 0;
520};
521
522} // End llvm namespace
523
524#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: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