20
20
#include < vector>
21
21
22
22
namespace 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 ;
27
27
28
28
namespace TargetStackID {
29
29
enum Value {
@@ -45,8 +45,8 @@ enum Value {
45
45
class TargetFrameLowering {
46
46
public:
47
47
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
50
50
};
51
51
52
52
// Maps a callee saved register to a stack slot with a fixed offset.
@@ -78,6 +78,7 @@ class TargetFrameLowering {
78
78
Align TransientStackAlignment;
79
79
int LocalAreaOffset;
80
80
bool StackRealignable;
81
+
81
82
public:
82
83
TargetFrameLowering (StackDirection D, Align StackAl, int LAO,
83
84
Align TransAl = Align(1 ), bool StackReal = true )
@@ -128,9 +129,7 @@ class TargetFrameLowering {
128
129
129
130
// / isStackRealignable - This method returns whether the stack can be
130
131
// / realigned.
131
- bool isStackRealignable () const {
132
- return StackRealignable;
133
- }
132
+ bool isStackRealignable () const { return StackRealignable; }
134
133
135
134
// / This method returns whether or not it is safe for an object with the
136
135
// / given stack id to be bundled into the local area.
@@ -148,8 +147,8 @@ class TargetFrameLowering {
148
147
// /
149
148
// / If this returns true, the frame indexes used by the RegScavenger will be
150
149
// / 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 ;
153
152
154
153
// / assignCalleeSavedSpillSlots - Allows target to override spill slot
155
154
// / assignment logic. If implemented, assignCalleeSavedSpillSlots() should
@@ -190,9 +189,7 @@ class TargetFrameLowering {
190
189
// / targetHandlesStackFrameRounding - Returns true if the target is
191
190
// / responsible for rounding up the stack frame (probably at emitPrologue
192
191
// / time).
193
- virtual bool targetHandlesStackFrameRounding () const {
194
- return false ;
195
- }
192
+ virtual bool targetHandlesStackFrameRounding () const { return false ; }
196
193
197
194
// / Returns true if the target will correctly handle shrink wrapping.
198
195
virtual bool enableShrinkWrapping (const MachineFunction &MF) const {
@@ -229,10 +226,16 @@ class TargetFrameLowering {
229
226
230
227
// / Returns true if we may need to fix the unwind information for the
231
228
// / 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
+ };
233
236
234
237
// / Emit CFI instructions that recreate the state of the unwind information
235
- // / upon fucntion entry.
238
+ // / upon function entry.
236
239
virtual void resetCFIToInitialState (MachineBasicBlock &MBB) const {}
237
240
238
241
// / Replace a StackProbe stub (if any) with the actual probe code inline
@@ -352,7 +355,7 @@ class TargetFrameLowering {
352
355
// / Returns the callee-saved registers as computed by determineCalleeSaves
353
356
// / in the BitVector \p SavedRegs.
354
357
virtual void getCalleeSaves (const MachineFunction &MF,
355
- BitVector &SavedRegs) const ;
358
+ BitVector &SavedRegs) const ;
356
359
357
360
// / This method determines which of the registers reported by
358
361
// / TargetRegisterInfo::getCalleeSavedRegs() should actually get saved.
@@ -372,9 +375,9 @@ class TargetFrameLowering {
372
375
// / finalized. Once the frame is finalized, MO_FrameIndex operands are
373
376
// / replaced with direct constants. This method is optional.
374
377
// /
375
- virtual void processFunctionBeforeFrameFinalized (MachineFunction &MF,
376
- RegScavenger *RS = nullptr ) const {
377
- }
378
+ virtual void
379
+ processFunctionBeforeFrameFinalized (MachineFunction &MF,
380
+ RegScavenger *RS = nullptr ) const { }
378
381
379
382
// / processFunctionBeforeFrameIndicesReplaced - This method is called
380
383
// / immediately before MO_FrameIndex operands are eliminated, but after the
@@ -394,14 +397,12 @@ class TargetFrameLowering {
394
397
// / implemented if using call frame setup/destroy pseudo instructions.
395
398
// / Returns an iterator pointing to the instruction after the replaced one.
396
399
virtual MachineBasicBlock::iterator
397
- eliminateCallFramePseudoInstr (MachineFunction &MF,
398
- MachineBasicBlock &MBB,
400
+ eliminateCallFramePseudoInstr (MachineFunction &MF, MachineBasicBlock &MBB,
399
401
MachineBasicBlock::iterator MI) const {
400
402
llvm_unreachable (" Call Frame Pseudo Instructions do not exist on this "
401
403
" target!" );
402
404
}
403
405
404
-
405
406
// / Order the symbols in the local stack frame.
406
407
// / The list of objects that we want to order is in \p objectsToAllocate as
407
408
// / indices into the MachineFrameInfo. The array can be reordered in any way
@@ -410,8 +411,7 @@ class TargetFrameLowering {
410
411
// / By default, just maintain the original order.
411
412
virtual void
412
413
orderFrameObjects (const MachineFunction &MF,
413
- SmallVectorImpl<int > &objectsToAllocate) const {
414
- }
414
+ SmallVectorImpl<int > &objectsToAllocate) const {}
415
415
416
416
// / Check whether or not the given \p MBB can be used as a prologue
417
417
// / for the target.
@@ -457,9 +457,7 @@ class TargetFrameLowering {
457
457
static bool isSafeForNoCSROpt (const Function &F);
458
458
459
459
// / 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 ; }
463
461
464
462
// / Return initial CFA offset value i.e. the one valid at the beginning of the
465
463
// / function (before any stack operations).
@@ -486,6 +484,6 @@ class TargetFrameLowering {
486
484
virtual bool hasFPImpl (const MachineFunction &MF) const = 0;
487
485
};
488
486
489
- } // End llvm namespace
487
+ } // namespace llvm
490
488
491
489
#endif
0 commit comments