10 #ifndef LLVM_CODEGEN_STACKMAPS_H
11 #define LLVM_CODEGEN_STACKMAPS_H
30 class TargetRegisterInfo;
86 unsigned getMetaIdx(
unsigned Pos = 0)
const {
88 return (HasDef ? 1 : 0) + Pos;
91 const MachineOperand &getMetaOper(
unsigned Pos)
const {
99 bool hasDef()
const {
return HasDef; }
212 : Type(Type), Size(Size), Reg(Reg), Offset(Offset) {}
223 : Reg(Reg), DwarfRegNum(DwarfRegNum), Size(Size) {}
229 using OpType =
enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp };
256 static const char *WSMP;
262 struct FunctionInfo {
263 uint64_t StackSize = 0;
264 uint64_t RecordCount = 1;
266 FunctionInfo() =
default;
267 explicit FunctionInfo(uint64_t StackSize) : StackSize(StackSize) {}
270 struct CallsiteInfo {
271 const MCExpr *CSOffsetExpr =
nullptr;
273 LocationVec Locations;
276 CallsiteInfo() =
default;
277 CallsiteInfo(
const MCExpr *CSOffsetExpr, uint64_t
ID,
278 LocationVec &&Locations, LiveOutVec &&LiveOuts)
279 : CSOffsetExpr(CSOffsetExpr), ID(ID), Locations(std::move(Locations)),
280 LiveOuts(std::move(LiveOuts)) {}
283 using FnInfoMap = MapVector<const MCSymbol *, FunctionInfo>;
284 using CallsiteInfoList = std::vector<CallsiteInfo>;
287 CallsiteInfoList CSInfos;
288 ConstantPool ConstPool;
294 LiveOutVec &LiveOuts)
const;
297 LiveOutReg createLiveOutReg(
unsigned Reg,
298 const TargetRegisterInfo *TRI)
const;
302 LiveOutVec parseRegisterLiveOutMask(
const uint32_t *
Mask)
const;
309 void recordStackMapOpers(
const MachineInstr &
MI, uint64_t
ID,
312 bool recordResult =
false);
315 void emitStackmapHeader(MCStreamer &OS);
318 void emitFunctionFrameRecords(MCStreamer &OS);
321 void emitConstantPoolEntries(MCStreamer &OS);
324 void emitCallsiteEntries(MCStreamer &OS);
326 void print(raw_ostream &OS);
327 void debug() { print(
dbgs()); }
332 #endif // LLVM_CODEGEN_STACKMAPS_H
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...
const MachineOperand * const_mop_iterator
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.
enum{DirectMemRefOp, IndirectMemRefOp, ConstantOp} OpType
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).
uint64_t getID() const
Return the ID for the given statepoint.