LLVM: include/llvm/CodeGen/StackMaps.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_CODEGEN_STACKMAPS_H
10#define LLVM_CODEGEN_STACKMAPS_H
11
18#include
19#include
20#include
21#include
22
23namespace llvm {
24
31
32
33
34
35
37public:
38
40
41private:
43
44public:
46
47
49
50
52 return MI->getOperand(NBytesPos).getImm();
53 }
54
55
56
61};
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
78public:
79
81
82private:
84 bool HasDef;
85
86 unsigned getMetaIdx(unsigned Pos = 0) const {
87 assert(Pos < MetaEnd && "Meta operand index out of range.");
88 return (HasDef ? 1 : 0) + Pos;
89 }
90
91 const MachineOperand &getMetaOper(unsigned Pos) const {
92 return MI->getOperand(getMetaIdx(Pos));
93 }
94
95public:
97
99 bool hasDef() const { return HasDef; }
100
101
103
104
106 return getMetaOper(NBytesPos).getImm();
107 }
108
109
113
114
116 return getMetaOper(CCPos).getImm();
117 }
118
120
121
123 return MI->getOperand(getMetaIdx(NArgPos)).getImm();
124 }
125
126
127
131
132
133
139
140
142};
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
160
161
162
163
164
165
166
167 enum { IDPos, NBytesPos, NCallArgsPos, CallTargetPos, MetaEnd };
168
169
170
171 enum { CCOffset = 1, FlagsOffset = 3, NumDeoptOperandsOffset = 5 };
172
173public:
175 NumDefs = MI->getNumDefs();
176 }
177
178
179 unsigned getIDPos() const { return NumDefs + IDPos; }
180
181
182 unsigned getNBytesPos() const { return NumDefs + NBytesPos; }
183
184
186
187
188
190 return MI->getOperand(NumDefs + NCallArgsPos).getImm() + MetaEnd + NumDefs;
191 }
192
193
195
196
198
199
201 return getVarIdx() + NumDeoptOperandsOffset;
202 }
203
204
205 uint64_t getID() const { return MI->getOperand(NumDefs + IDPos).getImm(); }
206
207
209 return MI->getOperand(NumDefs + NBytesPos).getImm();
210 }
211
212
214 return MI->getOperand(NumDefs + CallTargetPos);
215 }
216
217
219 return MI->getOperand(getCCIdx()).getImm();
220 }
221
222
224
228
229
231
232
234
235
237
238
240
241
242
243
246
247
248
250
251
252
254
255private:
257 unsigned NumDefs;
258};
259
261public:
280
290
291
292
293
294 using OpType = enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp };
295
297
298
299
301 unsigned CurIdx);
302
304 CSInfos.clear();
305 ConstPool.clear();
306 FnInfos.clear();
307 }
308
312
320
333
336
337
338
339
341
342
344
345
347
348
349
350
352
353
355
356
358
359private:
360 static const char *WSMP;
361
366
371
372
373
378
379
380 LiveOutReg createLiveOutReg(unsigned Reg,
382
383
384
386
387
388
389
390
391
392
393
394 void recordStackMapOpers(const MCSymbol &L,
398 bool recordResult = false);
399
400
401 void emitStackmapHeader(MCStreamer &OS);
402
403
404 void emitFunctionFrameRecords(MCStreamer &OS);
405
406
407 void emitConstantPoolEntries(MCStreamer &OS);
408
409
410 void emitCallsiteEntries(MCStreamer &OS);
411
414};
415
416}
417
418#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Register const TargetRegisterInfo * TRI
This file implements a map that provides insertion order iteration.
This file defines the SmallVector class.
This class is intended to be used as a driving class for all asm writers.
Base class for the full range of assembler expressions which are needed for parsing.
Streaming machine code generation interface.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Representation of each machine instruction.
const MachineOperand * const_mop_iterator
MachineOperand class - Representation of each machine instruction operand.
This class implements a map that also provides access to all stored values in a deterministic order.
uint32_t getNumCallArgs() const
Return the number of call arguments.
Definition StackMaps.h:122
LLVM_ABI PatchPointOpers(const MachineInstr *MI)
LLVM_ABI unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
unsigned getArgIdx() const
Definition StackMaps.h:119
uint64_t getID() const
Return the ID for the given patchpoint.
Definition StackMaps.h:102
@ IDPos
Definition StackMaps.h:80
@ CCPos
Definition StackMaps.h:80
@ MetaEnd
Definition StackMaps.h:80
@ NBytesPos
Definition StackMaps.h:80
@ TargetPos
Definition StackMaps.h:80
@ NArgPos
Definition StackMaps.h:80
bool isAnyReg() const
Definition StackMaps.h:98
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given patchpoint should emit.
Definition StackMaps.h:105
CallingConv::ID getCallingConv() const
Returns the calling convention.
Definition StackMaps.h:115
const MachineOperand & getCallTarget() const
Returns the target of the underlying call.
Definition StackMaps.h:110
unsigned getStackMapStartIdx() const
Get the index at which stack map locations will be recorded.
Definition StackMaps.h:134
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
Definition StackMaps.h:128
bool hasDef() const
Definition StackMaps.h:99
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.
LLVM_ABI StackMapOpers(const MachineInstr *MI)
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given stackmap should emit.
Definition StackMaps.h:51
uint64_t getID() const
Return the ID for the given stackmap.
Definition StackMaps.h:48
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
Definition StackMaps.h:57
@ IDPos
Definition StackMaps.h:39
@ NBytesPos
Definition StackMaps.h:39
static LLVM_ABI unsigned getNextMetaArgIdx(const MachineInstr *MI, unsigned CurIdx)
Get index of next meta operand.
LLVM_ABI StackMaps(AsmPrinter &AP)
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp } OpType
Definition StackMaps.h:294
LLVM_ABI void serializeToStackMapSection()
If there is any stack map data, create a stack map section and serialize the map info into it.
SmallVector< LiveOutReg, 8 > LiveOutVec
Definition StackMaps.h:310
MapVector< uint64_t, uint64_t > ConstantPool
Definition StackMaps.h:311
MapVector< const MCSymbol *, FunctionInfo > FnInfoMap
Definition StackMaps.h:334
SmallVector< Location, 8 > LocationVec
Definition StackMaps.h:309
LLVM_ABI void recordStatepoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a statepoint instruction.
std::vector< CallsiteInfo > CallsiteInfoList
Definition StackMaps.h:335
LLVM_ABI void recordPatchPoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
FnInfoMap & getFnInfos()
Get function info.
Definition StackMaps.h:357
void reset()
Definition StackMaps.h:303
CallsiteInfoList & getCSInfos()
Get call site info.
Definition StackMaps.h:354
LLVM_ABI void recordStackMap(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
StatepointOpers(const MachineInstr *MI)
Definition StackMaps.h:174
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given statepoint should emit.
Definition StackMaps.h:208
unsigned getIDPos() const
Get index of statepoint ID operand.
Definition StackMaps.h:179
CallingConv::ID getCallingConv() const
Return the calling convention.
Definition StackMaps.h:218
unsigned getCCIdx() const
Get index of Calling Convention operand.
Definition StackMaps.h:194
LLVM_ABI unsigned getGCPointerMap(SmallVectorImpl< std::pair< unsigned, unsigned > > &GCMap)
Get vector of base/derived pairs from statepoint.
unsigned getNCallArgsPos() const
Get index of Num Call Arguments operand.
Definition StackMaps.h:185
LLVM_ABI unsigned getNumAllocaIdx()
Get index of number of gc allocas.
LLVM_ABI unsigned getNumGcMapEntriesIdx()
Get index of number of gc map entries.
LLVM_ABI int getFirstGCPtrIdx()
Get index of first GC pointer operand of -1 if there are none.
const MachineOperand & getCallTarget() const
Return the target of the underlying call.
Definition StackMaps.h:213
unsigned getNumDeoptArgsIdx() const
Get index of Number Deopt Arguments operand.
Definition StackMaps.h:200
unsigned getNBytesPos() const
Get index of Num Patch Bytes operand.
Definition StackMaps.h:182
uint64_t getNumDeoptArgs() const
Definition StackMaps.h:225
uint64_t getFlags() const
Return the statepoint flags.
Definition StackMaps.h:223
unsigned getFlagsIdx() const
Get index of Flags operand.
Definition StackMaps.h:197
uint64_t getID() const
Return the ID for the given statepoint.
Definition StackMaps.h:205
LLVM_ABI bool isFoldableReg(Register Reg) const
Return true if Reg is used only in operands which can be folded to stack usage.
unsigned getVarIdx() const
Get starting index of non call related arguments (calling convention, statepoint flags,...
Definition StackMaps.h:189
LLVM_ABI unsigned getNumGCPtrIdx()
Get index of number of GC pointers.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ AnyReg
OBSOLETED - Used for stack based JavaScript calls.
This is an optimization pass for GlobalISel generic memory operations.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
LiveOutVec LiveOuts
Definition StackMaps.h:325
uint64_t ID
Definition StackMaps.h:323
CallsiteInfo(const MCExpr *CSOffsetExpr, uint64_t ID, LocationVec &&Locations, LiveOutVec &&LiveOuts)
Definition StackMaps.h:328
const MCExpr * CSOffsetExpr
Definition StackMaps.h:322
LocationVec Locations
Definition StackMaps.h:324
uint64_t RecordCount
Definition StackMaps.h:315
uint64_t StackSize
Definition StackMaps.h:314
FunctionInfo(uint64_t StackSize)
Definition StackMaps.h:318
uint16_t Reg
Definition StackMaps.h:282
uint16_t Size
Definition StackMaps.h:284
LiveOutReg(uint16_t Reg, uint16_t DwarfRegNum, uint16_t Size)
Definition StackMaps.h:287
uint16_t DwarfRegNum
Definition StackMaps.h:283
Location(LocationType Type, uint16_t Size, uint16_t Reg, int32_t Offset)
Definition StackMaps.h:277
int32_t Offset
Definition StackMaps.h:274
uint16_t Reg
Definition StackMaps.h:273
uint16_t Size
Definition StackMaps.h:272
LocationType Type
Definition StackMaps.h:271
LocationType
Definition StackMaps.h:263
@ Register
Definition StackMaps.h:265
@ ConstantIndex
Definition StackMaps.h:269
@ Direct
Definition StackMaps.h:266
@ Indirect
Definition StackMaps.h:267
@ Constant
Definition StackMaps.h:268
@ Unprocessed
Definition StackMaps.h:264