10 #ifndef LLVM_CODEGEN_STACKMAPS_H
11 #define LLVM_CODEGEN_STACKMAPS_H
79 unsigned getMetaIdx(
unsigned Pos = 0)
const {
81 return (HasDef ? 1 : 0) + Pos;
84 const MachineOperand &getMetaOper(
unsigned Pos)
const {
92 bool hasDef()
const {
return HasDef; }
149 enum { IDPos, NBytesPos, NCallArgsPos, CallTargetPos, MetaEnd };
153 enum { CCOffset = 1, FlagsOffset = 3, NumVMSArgsOffset = 5 };
198 : Type(Type), Size(Size), Reg(Reg), Offset(Offset) {}
209 : Reg(Reg), DwarfRegNum(DwarfRegNum), Size(Size) {}
242 static const char *WSMP;
247 struct FunctionInfo {
249 uint64_t RecordCount;
250 FunctionInfo() : StackSize(0), RecordCount(1) {}
251 explicit FunctionInfo(uint64_t StackSize) : StackSize(StackSize), RecordCount(1) {}
254 struct CallsiteInfo {
255 const MCExpr *CSOffsetExpr;
257 LocationVec Locations;
259 CallsiteInfo() : CSOffsetExpr(nullptr),
ID(0) {}
260 CallsiteInfo(
const MCExpr *CSOffsetExpr, uint64_t
ID,
261 LocationVec &&Locations, LiveOutVec &&LiveOuts)
262 : CSOffsetExpr(CSOffsetExpr), ID(ID), Locations(std::move(Locations)),
263 LiveOuts(std::move(LiveOuts)) {}
266 typedef MapVector<const MCSymbol *, FunctionInfo> FnInfoMap;
267 typedef std::vector<CallsiteInfo> CallsiteInfoList;
270 CallsiteInfoList CSInfos;
271 ConstantPool ConstPool;
277 LiveOutVec &LiveOuts)
const;
280 LiveOutReg createLiveOutReg(
unsigned Reg,
281 const TargetRegisterInfo *TRI)
const;
285 LiveOutVec parseRegisterLiveOutMask(
const uint32_t *
Mask)
const;
292 void recordStackMapOpers(
const MachineInstr &
MI, uint64_t
ID,
295 bool recordResult =
false);
298 void emitStackmapHeader(MCStreamer &OS);
301 void emitFunctionFrameRecords(MCStreamer &OS);
304 void emitConstantPoolEntries(MCStreamer &OS);
307 void emitCallsiteEntries(MCStreamer &OS);
309 void print(raw_ostream &OS);
310 void debug() { print(
dbgs()); }
unsigned short DwarfRegNum
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given patchpoint should emit.
StatepointOpers(const MachineInstr *MI)
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
Location(LocationType Type, unsigned Size, unsigned Reg, int64_t Offset)
Reg
All possible values of the reg field in the ModR/M byte.
PatchPointOpers(const MachineInstr *MI)
uint64_t getID() const
Return the ID for the given stackmap.
unsigned getArgIdx() const
void recordStatepoint(const MachineInstr &MI)
Generate a stackmap record for a statepoint instruction.
The instances of the Type class are immutable: once they are created, they are never changed...
CallingConv::ID getCallingConv() const
Returns the calling convention.
const MachineOperand & getOperand(unsigned i) const
LiveOutReg(unsigned short Reg, unsigned short DwarfRegNum, unsigned short Size)
const MachineOperand & getCallTarget() const
Returns the target of the underlying call.
This class is intended to be used as a driving class for all asm writers.
const MachineOperand & getCallTarget() const
Returns the target of the underlying call.
MI-level patchpoint operands.
unsigned getStackMapStartIdx() const
Get the index at which stack map locations will be recorded.
void recordPatchPoint(const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
void serializeToStackMapSection()
If there is any stack map data, create a stack map section and serialize the map info into it...
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given statepoint should emit.
StackMapOpers(const MachineInstr *MI)
MachineOperand class - Representation of each machine instruction operand.
unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void recordStackMap(const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
uint32_t getNumPatchBytes() const
Return the number of patchable bytes the given stackmap should emit.
Representation of each machine instruction.
MI-level stackmap operands.
StackMaps(AsmPrinter &AP)
uint32_t getNumCallArgs() const
Return the number of call arguments.
MI-level Statepoint operands.
unsigned getVarIdx() const
Get the operand index of the variable list of non-argument operands.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
uint64_t getID() const
Return the ID for the given patchpoint.
unsigned getVarIdx() const
Get starting index of non call related arguments (calling convention, statepoint flags, vm state and gc state).
const MachineOperand * const_mop_iterator
uint64_t getID() const
Return the ID for the given statepoint.