2020#include < vector>
2121
2222namespace llvm {
23- class BitVector ;
24- class CalleeSavedInfo ;
25- class MachineFunction ;
26- class RegScavenger ;
23+ class BitVector ;
24+ class CalleeSavedInfo ;
25+ class MachineFunction ;
26+ class RegScavenger ;
2727
2828namespace TargetStackID {
2929enum Value {
@@ -45,8 +45,8 @@ enum Value {
4545class TargetFrameLowering {
4646public:
4747 enum StackDirection {
48- StackGrowsUp, // Adding to the stack increases the stack address
49- StackGrowsDown // Adding to the stack decreases the stack address
48+ StackGrowsUp, // Adding to the stack increases the stack address
49+ StackGrowsDown // Adding to the stack decreases the stack address
5050 };
5151
5252 // Maps a callee saved register to a stack slot with a fixed offset.
@@ -78,6 +78,7 @@ class TargetFrameLowering {
7878 Align TransientStackAlignment;
7979 int LocalAreaOffset;
8080 bool StackRealignable;
81+
8182public:
8283 TargetFrameLowering (StackDirection D, Align StackAl, int LAO,
8384 Align TransAl = Align(1 ), bool StackReal = true )
@@ -128,9 +129,7 @@ class TargetFrameLowering {
128129
129130 // / isStackRealignable - This method returns whether the stack can be
130131 // / realigned.
131- bool isStackRealignable () const {
132- return StackRealignable;
133- }
132+ bool isStackRealignable () const { return StackRealignable; }
134133
135134 // / This method returns whether or not it is safe for an object with the
136135 // / given stack id to be bundled into the local area.
@@ -148,8 +147,8 @@ class TargetFrameLowering {
148147 // /
149148 // / If this returns true, the frame indexes used by the RegScavenger will be
150149 // / allocated closest to the incoming stack pointer.
151- virtual bool allocateScavengingFrameIndexesNearIncomingSP (
152- const MachineFunction &MF) const ;
150+ virtual bool
151+ allocateScavengingFrameIndexesNearIncomingSP ( const MachineFunction &MF) const ;
153152
154153 // / assignCalleeSavedSpillSlots - Allows target to override spill slot
155154 // / assignment logic. If implemented, assignCalleeSavedSpillSlots() should
@@ -190,9 +189,7 @@ class TargetFrameLowering {
190189 // / targetHandlesStackFrameRounding - Returns true if the target is
191190 // / responsible for rounding up the stack frame (probably at emitPrologue
192191 // / time).
193- virtual bool targetHandlesStackFrameRounding () const {
194- return false ;
195- }
192+ virtual bool targetHandlesStackFrameRounding () const { return false ; }
196193
197194 // / Returns true if the target will correctly handle shrink wrapping.
198195 virtual bool enableShrinkWrapping (const MachineFunction &MF) const {
@@ -229,10 +226,16 @@ class TargetFrameLowering {
229226
230227 // / Returns true if we may need to fix the unwind information for the
231228 // / function.
232- virtual bool enableCFIFixup (MachineFunction &MF) const ;
229+ virtual bool enableCFIFixup (const MachineFunction &MF) const ;
230+
231+ // / enableBlockLevelCFIFixup - Returns true if we may need to fix up the
232+ // / function at a basic block level (e.g. for async unwind tables).
233+ virtual bool enableBlockLevelCFIFixup (const MachineFunction &MF) const {
234+ return enableCFIFixup (MF);
235+ };
233236
234237 // / Emit CFI instructions that recreate the state of the unwind information
235- // / upon fucntion entry.
238+ // / upon function entry.
236239 virtual void resetCFIToInitialState (MachineBasicBlock &MBB) const {}
237240
238241 // / Replace a StackProbe stub (if any) with the actual probe code inline
@@ -352,7 +355,7 @@ class TargetFrameLowering {
352355 // / Returns the callee-saved registers as computed by determineCalleeSaves
353356 // / in the BitVector \p SavedRegs.
354357 virtual void getCalleeSaves (const MachineFunction &MF,
355- BitVector &SavedRegs) const ;
358+ BitVector &SavedRegs) const ;
356359
357360 // / This method determines which of the registers reported by
358361 // / TargetRegisterInfo::getCalleeSavedRegs() should actually get saved.
@@ -372,9 +375,9 @@ class TargetFrameLowering {
372375 // / finalized. Once the frame is finalized, MO_FrameIndex operands are
373376 // / replaced with direct constants. This method is optional.
374377 // /
375- virtual void processFunctionBeforeFrameFinalized (MachineFunction &MF,
376- RegScavenger *RS = nullptr ) const {
377- }
378+ virtual void
379+ processFunctionBeforeFrameFinalized (MachineFunction &MF,
380+ RegScavenger *RS = nullptr ) const { }
378381
379382 // / processFunctionBeforeFrameIndicesReplaced - This method is called
380383 // / immediately before MO_FrameIndex operands are eliminated, but after the
@@ -394,14 +397,12 @@ class TargetFrameLowering {
394397 // / implemented if using call frame setup/destroy pseudo instructions.
395398 // / Returns an iterator pointing to the instruction after the replaced one.
396399 virtual MachineBasicBlock::iterator
397- eliminateCallFramePseudoInstr (MachineFunction &MF,
398- MachineBasicBlock &MBB,
400+ eliminateCallFramePseudoInstr (MachineFunction &MF, MachineBasicBlock &MBB,
399401 MachineBasicBlock::iterator MI) const {
400402 llvm_unreachable (" Call Frame Pseudo Instructions do not exist on this "
401403 " target!" );
402404 }
403405
404-
405406 // / Order the symbols in the local stack frame.
406407 // / The list of objects that we want to order is in \p objectsToAllocate as
407408 // / indices into the MachineFrameInfo. The array can be reordered in any way
@@ -410,8 +411,7 @@ class TargetFrameLowering {
410411 // / By default, just maintain the original order.
411412 virtual void
412413 orderFrameObjects (const MachineFunction &MF,
413- SmallVectorImpl<int > &objectsToAllocate) const {
414- }
414+ SmallVectorImpl<int > &objectsToAllocate) const {}
415415
416416 // / Check whether or not the given \p MBB can be used as a prologue
417417 // / for the target.
@@ -457,9 +457,7 @@ class TargetFrameLowering {
457457 static bool isSafeForNoCSROpt (const Function &F);
458458
459459 // / Check if the no-CSR optimisation is profitable for the given function.
460- virtual bool isProfitableForNoCSROpt (const Function &F) const {
461- return true ;
462- }
460+ virtual bool isProfitableForNoCSROpt (const Function &F) const { return true ; }
463461
464462 // / Return initial CFA offset value i.e. the one valid at the beginning of the
465463 // / function (before any stack operations).
@@ -486,6 +484,6 @@ class TargetFrameLowering {
486484 virtual bool hasFPImpl (const MachineFunction &MF) const = 0;
487485};
488486
489- } // End llvm namespace
487+ } // namespace llvm
490488
491489#endif
0 commit comments