Go to the documentation of this file.
9 #ifndef LLVM_CODEGEN_STACKMAPS_H
10 #define LLVM_CODEGEN_STACKMAPS_H
29 class TargetRegisterInfo;
85 unsigned getMetaIdx(
unsigned Pos = 0)
const {
87 return (HasDef ? 1 : 0) + Pos;
90 const MachineOperand &getMetaOper(
unsigned Pos)
const {
91 return MI->getOperand(getMetaIdx(Pos));
98 bool hasDef()
const {
return HasDef; }
122 return MI->getOperand(getMetaIdx(
NArgPos)).getImm();
166 enum { IDPos, NBytesPos, NCallArgsPos, CallTargetPos, MetaEnd };
170 enum { CCOffset = 1, FlagsOffset = 3, NumDeoptOperandsOffset = 5 };
174 NumDefs =
MI->getNumDefs();
178 unsigned getIDPos()
const {
return NumDefs + IDPos; }
189 return MI->getOperand(NumDefs + NCallArgsPos).getImm() + MetaEnd + NumDefs;
200 return getVarIdx() + NumDeoptOperandsOffset;
208 return MI->getOperand(NumDefs + NBytesPos).getImm();
213 return MI->getOperand(NumDefs + CallTargetPos);
286 using OpType =
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp };
354 static const char *WSMP;
374 LiveOutReg createLiveOutReg(
unsigned Reg,
388 void recordStackMapOpers(
const MCSymbol &L,
392 bool recordResult =
false);
398 void emitFunctionFrameRecords(
MCStreamer &OS);
407 void debug() { print(
dbgs()); }
412 #endif // LLVM_CODEGEN_STACKMAPS_H
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp } OpType
uint32_t getNumCallArgs() const
Return the number of call arguments.
This is an optimization pass for GlobalISel generic memory operations.
CallsiteInfo(const MCExpr *CSOffsetExpr, uint64_t ID, LocationVec &&Locations, LiveOutVec &&LiveOuts)
MI-level stackmap operands.
Location(LocationType Type, unsigned Size, unsigned Reg, int64_t Offset)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void recordStatepoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a statepoint instruction.
Reg
All possible values of the reg field in the ModR/M byte.
StatepointOpers(const MachineInstr *MI)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned getNumGcMapEntriesIdx()
Get index of number of gc map entries.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given statepoint should emit.
CallsiteInfoList & getCSInfos()
Get call site info.
const MachineOperand & getCallTarget() const
Returns the target of the underlying call.
MI-level patchpoint operands.
unsigned const TargetRegisterInfo * TRI
uint64_t getID() const
Return the ID for the given patchpoint.
void recordStackMap(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Streaming machine code generation interface.
unsigned getNumDeoptArgsIdx() const
Get index of Number Deopt Arguments operand.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given stackmap should emit.
const MachineOperand & getCallTarget() const
Return the target of the underlying call.
CallingConv::ID getCallingConv() const
Return the calling convention.
unsigned getGCPointerMap(SmallVectorImpl< std::pair< unsigned, unsigned >> &GCMap)
Get vector of base/derived pairs from statepoint.
MachineOperand class - Representation of each machine instruction operand.
FunctionInfo(uint64_t StackSize)
unsigned getVarIdx() const
Get starting index of non call related arguments (calling convention, statepoint flags,...
StackMaps(AsmPrinter &AP)
PatchPointOpers(const MachineInstr *MI)
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned getFlagsIdx() const
Get index of Flags operand.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
LiveOutReg(unsigned short Reg, unsigned short DwarfRegNum, unsigned short Size)
unsigned getNBytesPos() const
Get index of Num Patch Bytes operand.
unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
unsigned getNumAllocaIdx()
Get index of number of gc allocas.
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given patchpoint should emit.
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
Representation of each machine instruction.
void serializeToStackMapSection()
If there is any stack map data, create a stack map section and serialize the map info into it.
unsigned getIDPos() const
Get index of statepoint ID operand.
SmallVector< LiveOutReg, 8 > LiveOutVec
MapVector< const MCSymbol *, FunctionInfo > FnInfoMap
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned getNCallArgsPos() const
Get index of Num Call Arguments operand.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
FnInfoMap & getFnInfos()
Get function info.
CallingConv::ID getCallingConv() const
Returns the calling convention.
static unsigned getNextMetaArgIdx(const MachineInstr *MI, unsigned CurIdx)
Get index of next meta operand.
unsigned getStackMapStartIdx() const
Get the index at which stack map locations will be recorded.
unsigned short DwarfRegNum
uint64_t getFlags() const
Return the statepoint flags.
uint64_t getID() const
Return the ID for the given stackmap.
StackMapOpers(const MachineInstr *MI)
unsigned getCCIdx() const
Get index of Calling Convention operand.
int getFirstGCPtrIdx()
Get index of first GC pointer operand of -1 if there are none.
MI-level Statepoint operands.
unsigned getArgIdx() const
void recordPatchPoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
This class is intended to be used as a driving class for all asm writers.
uint64_t getNumDeoptArgs() const
const MCExpr * CSOffsetExpr
std::vector< CallsiteInfo > CallsiteInfoList
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
uint64_t getID() const
Return the ID for the given statepoint.
SmallVector< Location, 8 > LocationVec
Base class for the full range of assembler expressions which are needed for parsing.
unsigned getNumGCPtrIdx()
Get index of number of GC pointers.