9#ifndef LLVM_CODEGEN_STACKMAPS_H
10#define LLVM_CODEGEN_STACKMAPS_H
29class 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);
293 using OpType =
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp };
361 static const char *WSMP;
381 LiveOutReg createLiveOutReg(
unsigned Reg,
395 void recordStackMapOpers(
const MCSymbol &L,
399 bool recordResult =
false);
414 void debug() { print(
dbgs()); }
unsigned const TargetRegisterInfo * TRI
This file implements a map that provides insertion order iteration.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
PatchPointOpers(const MachineInstr *MI)
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 unsigned getNextMetaArgIdx(const MachineInstr *MI, unsigned CurIdx)
Get index of next meta operand.
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp } OpType
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
void recordStatepoint(const MCSymbol &L, const MachineInstr &MI)
Generate a stackmap record for a statepoint instruction.
std::vector< CallsiteInfo > CallsiteInfoList
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.
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.
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.
unsigned getNumAllocaIdx()
Get index of number of gc allocas.
unsigned getNumGcMapEntriesIdx()
Get index of number of gc map entries.
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.
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,...
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.
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)