9#ifndef LLVM_CODEGEN_STACKMAPS_H
10#define LLVM_CODEGEN_STACKMAPS_H
30class TargetRegisterInfo;
86 unsigned getMetaIdx(
unsigned Pos = 0)
const {
88 return (HasDef ? 1 : 0) + Pos;
91 const MachineOperand &getMetaOper(
unsigned Pos)
const {
92 return MI->getOperand(getMetaIdx(Pos));
99 bool hasDef()
const {
return HasDef; }
123 return MI->getOperand(getMetaIdx(
NArgPos)).getImm();
167 enum { IDPos, NBytesPos, NCallArgsPos, CallTargetPos, MetaEnd };
171 enum { CCOffset = 1, FlagsOffset = 3, NumDeoptOperandsOffset = 5 };
175 NumDefs =
MI->getNumDefs();
179 unsigned getIDPos()
const {
return NumDefs + IDPos; }
190 return MI->getOperand(NumDefs + NCallArgsPos).getImm() + MetaEnd + NumDefs;
201 return getVarIdx() + NumDeoptOperandsOffset;
209 return MI->getOperand(NumDefs + NBytesPos).getImm();
214 return MI->getOperand(NumDefs + CallTargetPos);
294 using OpType =
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp };
360 static const char *WSMP;
380 LiveOutReg createLiveOutReg(
unsigned Reg,
394 void recordStackMapOpers(
const MCSymbol &L,
398 bool recordResult =
false);
413 void debug() { print(
dbgs()); }
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.
MachineOperand class - Representation of each machine instruction operand.
MI-level patchpoint operands.
uint32_t getNumCallArgs() const
Return the number of call arguments.
LLVM_ABI PatchPointOpers(const MachineInstr *MI)
LLVM_ABI unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
unsigned getArgIdx() const
uint64_t getID() const
Return the ID for the given patchpoint.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given patchpoint should emit.
CallingConv::ID getCallingConv() const
Returns the calling convention.
const MachineOperand & getCallTarget() const
Returns the target of the underlying call.
unsigned getStackMapStartIdx() const
Get the index at which stack map locations will be recorded.
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
Wrapper class representing virtual and physical registers.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
MI-level stackmap operands.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given stackmap should emit.
uint64_t getID() const
Return the ID for the given stackmap.
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
static LLVM_ABI unsigned getNextMetaArgIdx(const MachineInstr *MI, unsigned CurIdx)
Get index of next meta operand.
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp } OpType
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
MapVector< const MCSymbol *, FunctionInfo > FnInfoMap
SmallVector< Location, 8 > LocationVec
LLVM_ABI void recordStatepoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a statepoint instruction.
std::vector< CallsiteInfo > CallsiteInfoList
LLVM_ABI void recordPatchPoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
FnInfoMap & getFnInfos()
Get function info.
CallsiteInfoList & getCSInfos()
Get call site info.
LLVM_ABI void recordStackMap(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
MI-level Statepoint operands.
StatepointOpers(const MachineInstr *MI)
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given statepoint should emit.
unsigned getIDPos() const
Get index of statepoint ID operand.
CallingConv::ID getCallingConv() const
Return the calling convention.
unsigned getCCIdx() const
Get index of Calling Convention operand.
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.
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.
unsigned getNumDeoptArgsIdx() const
Get index of Number Deopt Arguments operand.
unsigned getNBytesPos() const
Get index of Num Patch Bytes operand.
uint64_t getNumDeoptArgs() const
uint64_t getFlags() const
Return the statepoint flags.
unsigned getFlagsIdx() const
Get index of Flags operand.
uint64_t getID() const
Return the ID for the given statepoint.
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,...
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...
The instances of the Type class are immutable: once they are created, they are never changed.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ AnyReg
OBSOLETED - Used for stack based JavaScript calls.
This is an optimization pass for GlobalISel generic memory operations.
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.
CallsiteInfo(const MCExpr *CSOffsetExpr, uint64_t ID, LocationVec &&Locations, LiveOutVec &&LiveOuts)
const MCExpr * CSOffsetExpr
FunctionInfo(uint64_t StackSize)
LiveOutReg(uint16_t Reg, uint16_t DwarfRegNum, uint16_t Size)
Location(LocationType Type, uint16_t Size, uint16_t Reg, int32_t Offset)