LLVM: lib/Target/X86/X86MachineFunctionInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
14#define LLVM_LIB_TARGET_X86_X86MACHINEFUNCTIONINFO_H
15
22#include
23
24namespace llvm {
25
27
28class X86MachineFunctionInfo;
29
30namespace yaml {
38
48
54}
55
56
57
59 virtual void anchor();
60
61
62
63
64
65 bool ForceFramePointer = false;
66
67
68
69
70
71 signed char RestoreBasePointerOffset = 0;
72
73
74
76
77
78
79 unsigned CalleeSavedFrameSize = 0;
80
81
82
83
84 unsigned BytesToPopOnReturn = 0;
85
86
87 int ReturnAddrIndex = 0;
88
89
90 int FrameAddrIndex = 0;
91
92
93
94 int TailCallReturnAddrDelta = 0;
95
96
97
98
100
101
102
103
105
106
107 int VarArgsFrameIndex = 0;
108
109 int RegSaveFrameIndex = 0;
110
111 unsigned VarArgsGPOffset = 0;
112
113 unsigned VarArgsFPOffset = 0;
114
115
116 unsigned ArgumentStackSize = 0;
117
118 unsigned NumLocalDynamics = 0;
119
120
121 bool HasPushSequences = false;
122
123
124
125 bool HasSEHFramePtrSave = false;
126
127
128
129 int SEHFramePtrSaveIndex = 0;
130
131
133
134
135
136 bool IsSplitCSR = false;
137
138
139 bool UsesRedZone = false;
140
141
142 bool HasDynAlloca = false;
143
144
145 bool HasPreallocatedCall = false;
146
147
148
149
150 bool HasSwiftAsyncContext = false;
151
152
153 bool PadForPush2Pop2 = false;
154
155
156 std::set CandidatesForPush2Pop2;
157
158
159
160
161 bool HasCFIAdjustCfa = false;
162
164
165 std::optional SwiftAsyncContextFrameIdx;
166
167
168
172
173
174 bool FPClobberedByCall = false;
175 bool BPClobberedByCall = false;
176 bool FPClobberedByInvoke = false;
177 bool BPClobberedByInvoke = false;
178
179private:
180
181
183
184public:
187
189
193 const override;
194
196
199
202
206 RestoreBasePointerOffset = -CalleeSavedFrameSize;
207 }
209
212 return WinEHXMMSlotInfo; }
213
218
221
222 int getRAIndex() const { return ReturnAddrIndex; }
223 void setRAIndex(int Index) { ReturnAddrIndex = Index; }
224
225 int getFAIndex() const { return FrameAddrIndex; }
226 void setFAIndex(int Index) { FrameAddrIndex = Index; }
227
230
233
236
239
242
245
248
251
254
257
260
264 "mixed model is not supported");
265 AMXProgModel = Model;
266 }
267
269 return ForwardedMustTailRegParms;
270 }
271
274
277
280
283
286
289
291 return CandidatesForPush2Pop2.find(Reg) != CandidatesForPush2Pop2.end();
292 }
294 CandidatesForPush2Pop2.insert(Reg);
295 }
297 return CandidatesForPush2Pop2.size();
298 }
299
302
305
307 return SwiftAsyncContextFrameIdx;
308 }
310
312 auto Insert = PreallocatedIds.insert({CS, PreallocatedIds.size()});
313 if (Insert.second) {
314 PreallocatedStackSizes.push_back(0);
315 PreallocatedArgOffsets.emplace_back();
316 }
317 return Insert.first->second;
318 }
319
321 PreallocatedStackSizes[Id] = StackSize;
322 }
323
325 assert(PreallocatedStackSizes[Id] != 0 && "stack size not set");
326 return PreallocatedStackSizes[Id];
327 }
328
330 PreallocatedArgOffsets[Id].assign(AO.begin(), AO.end());
331 }
332
334 assert(!PreallocatedArgOffsets[Id].empty() && "arg offsets not set");
335 return PreallocatedArgOffsets[Id];
336 }
337
340
343
346
349};
350
351}
352
353#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Representation of each machine instruction.
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetSubtargetInfo - Generic base class for all target subtargets.
LLVM Value Representation.
X86MachineFunctionInfo - This class is derived from MachineFunction and contains private X86 target-s...
Definition X86MachineFunctionInfo.h:58
void setBytesToPopOnReturn(unsigned bytes)
Definition X86MachineFunctionInfo.h:220
bool getForceFramePointer() const
Definition X86MachineFunctionInfo.h:197
void setFAIndex(int Index)
Definition X86MachineFunctionInfo.h:226
bool hasDynAlloca() const
Definition X86MachineFunctionInfo.h:278
void setHasCFIAdjustCfa(bool v)
Definition X86MachineFunctionInfo.h:301
void setPadForPush2Pop2(bool V)
Definition X86MachineFunctionInfo.h:288
const DenseMap< int, unsigned > & getWinEHXMMSlotInfo() const
Definition X86MachineFunctionInfo.h:211
void setAMXProgModel(AMXProgModelEnum Model)
Definition X86MachineFunctionInfo.h:262
void setBPClobberedByCall(bool C)
Definition X86MachineFunctionInfo.h:342
void setSwiftAsyncContextFrameIdx(int v)
Definition X86MachineFunctionInfo.h:309
void setFPClobberedByCall(bool C)
Definition X86MachineFunctionInfo.h:339
unsigned getVarArgsGPOffset() const
Definition X86MachineFunctionInfo.h:243
bool isCandidateForPush2Pop2(Register Reg) const
Definition X86MachineFunctionInfo.h:290
bool getBPClobberedByInvoke() const
Definition X86MachineFunctionInfo.h:347
unsigned getArgumentStackSize() const
Definition X86MachineFunctionInfo.h:249
X86MachineFunctionInfo(const X86MachineFunctionInfo &)=default
int getRegSaveFrameIndex() const
Definition X86MachineFunctionInfo.h:240
ArrayRef< size_t > getPreallocatedArgOffsets(const size_t Id)
Definition X86MachineFunctionInfo.h:333
void setHasSwiftAsyncContext(bool v)
Definition X86MachineFunctionInfo.h:285
Register getSRetReturnReg() const
Definition X86MachineFunctionInfo.h:231
void setIsSplitCSR(bool s)
Definition X86MachineFunctionInfo.h:273
void setVarArgsGPOffset(unsigned Offset)
Definition X86MachineFunctionInfo.h:244
void setRegSaveFrameIndex(int Idx)
Definition X86MachineFunctionInfo.h:241
bool getFPClobberedByCall() const
Definition X86MachineFunctionInfo.h:338
void setForceFramePointer(bool forceFP)
Definition X86MachineFunctionInfo.h:198
Register getGlobalBaseReg() const
Definition X86MachineFunctionInfo.h:234
void setSRetReturnReg(Register Reg)
Definition X86MachineFunctionInfo.h:232
unsigned getVarArgsFPOffset() const
Definition X86MachineFunctionInfo.h:246
void setHasDynAlloca(bool v)
Definition X86MachineFunctionInfo.h:279
int getRestoreBasePointerOffset() const
Definition X86MachineFunctionInfo.h:208
void setArgumentStackSize(unsigned size)
Definition X86MachineFunctionInfo.h:250
X86MachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)
Definition X86MachineFunctionInfo.h:186
X86MachineFunctionInfo()=default
void setPreallocatedArgOffsets(size_t Id, ArrayRef< size_t > AO)
Definition X86MachineFunctionInfo.h:329
void setRestoreBasePointer(unsigned CalleeSavedFrameSize)
Definition X86MachineFunctionInfo.h:205
int getFAIndex() const
Definition X86MachineFunctionInfo.h:225
int getSEHFramePtrSaveIndex() const
Definition X86MachineFunctionInfo.h:258
SmallVectorImpl< ForwardedRegister > & getForwardedMustTailRegParms()
Definition X86MachineFunctionInfo.h:268
void setTCReturnAddrDelta(int delta)
Definition X86MachineFunctionInfo.h:229
bool hasCFIAdjustCfa() const
Definition X86MachineFunctionInfo.h:300
int getVarArgsFrameIndex() const
Definition X86MachineFunctionInfo.h:237
int getTCReturnAddrDelta() const
Definition X86MachineFunctionInfo.h:228
void setRestoreBasePointer(const MachineFunction *MF)
std::optional< int > getSwiftAsyncContextFrameIdx() const
Definition X86MachineFunctionInfo.h:306
bool getHasSEHFramePtrSave() const
Definition X86MachineFunctionInfo.h:255
void setHasPreallocatedCall(bool v)
Definition X86MachineFunctionInfo.h:282
void incNumLocalDynamicTLSAccesses()
Definition X86MachineFunctionInfo.h:253
size_t getPreallocatedStackSize(const size_t Id)
Definition X86MachineFunctionInfo.h:324
void setGlobalBaseReg(Register Reg)
Definition X86MachineFunctionInfo.h:235
unsigned getNumLocalDynamicTLSAccesses() const
Definition X86MachineFunctionInfo.h:252
void setPreallocatedStackSize(size_t Id, size_t StackSize)
Definition X86MachineFunctionInfo.h:320
void setVarArgsFrameIndex(int Idx)
Definition X86MachineFunctionInfo.h:238
DenseMap< int, unsigned > & getWinEHXMMSlotInfo()
Definition X86MachineFunctionInfo.h:210
bool getBPClobberedByCall() const
Definition X86MachineFunctionInfo.h:341
void setBPClobberedByInvoke(bool C)
Definition X86MachineFunctionInfo.h:348
void setUsesRedZone(bool V)
Definition X86MachineFunctionInfo.h:276
bool hasPreallocatedCall() const
Definition X86MachineFunctionInfo.h:281
void setFPClobberedByInvoke(bool C)
Definition X86MachineFunctionInfo.h:345
int getRAIndex() const
Definition X86MachineFunctionInfo.h:222
bool hasSwiftAsyncContext() const
Definition X86MachineFunctionInfo.h:284
void setHasSEHFramePtrSave(bool V)
Definition X86MachineFunctionInfo.h:256
bool getRestoreBasePointer() const
Definition X86MachineFunctionInfo.h:203
MachineInstr * getStackPtrSaveMI() const
Definition X86MachineFunctionInfo.h:304
size_t getNumCandidatesForPush2Pop2() const
Definition X86MachineFunctionInfo.h:296
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
bool getFPClobberedByInvoke() const
Definition X86MachineFunctionInfo.h:344
void initializeBaseYamlFields(const yaml::X86MachineFunctionInfo &YamlMFI)
unsigned getBytesToPopOnReturn() const
Definition X86MachineFunctionInfo.h:219
AMXProgModelEnum getAMXProgModel() const
Definition X86MachineFunctionInfo.h:261
void setVarArgsFPOffset(unsigned Offset)
Definition X86MachineFunctionInfo.h:247
void addCandidateForPush2Pop2(Register Reg)
Definition X86MachineFunctionInfo.h:293
unsigned getCalleeSavedFrameSize() const
Definition X86MachineFunctionInfo.h:214
bool getHasPushSequences() const
Definition X86MachineFunctionInfo.h:200
bool padForPush2Pop2() const
Definition X86MachineFunctionInfo.h:287
void setStackPtrSaveMI(MachineInstr *MI)
Definition X86MachineFunctionInfo.h:303
bool getUsesRedZone() const
Definition X86MachineFunctionInfo.h:275
void setCalleeSavedFrameSize(unsigned bytes)
Definition X86MachineFunctionInfo.h:217
void setRAIndex(int Index)
Definition X86MachineFunctionInfo.h:223
bool isSplitCSR() const
Definition X86MachineFunctionInfo.h:272
void setSEHFramePtrSaveIndex(int Index)
Definition X86MachineFunctionInfo.h:259
size_t getPreallocatedIdForCallSite(const Value *CS)
Definition X86MachineFunctionInfo.h:311
void setHasPushSequences(bool HasPush)
Definition X86MachineFunctionInfo.h:201
void enumCase(T &Val, StringRef Str, const T ConstVal)
void mapOptional(StringRef Key, T &Val)
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
AMXProgModelEnum
Definition X86MachineFunctionInfo.h:26
@ ManagedRA
Definition X86MachineFunctionInfo.h:26
@ DirectReg
Definition X86MachineFunctionInfo.h:26
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.
static void mapping(IO &YamlIO, X86MachineFunctionInfo &MFI)
Definition X86MachineFunctionInfo.h:50
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
static void enumeration(IO &YamlIO, AMXProgModelEnum &Value)
Definition X86MachineFunctionInfo.h:32
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
~X86MachineFunctionInfo() override=default
AMXProgModelEnum AMXProgModel
Definition X86MachineFunctionInfo.h:40
void mappingImpl(yaml::IO &YamlIO) override
X86MachineFunctionInfo()=default