10 #ifndef LLVM_CODEGEN_STACKMAPS_H
11 #define LLVM_CODEGEN_STACKMAPS_H
54 bool hasDef()
const {
return HasDef; }
57 assert(Pos <
MetaEnd &&
"Meta operand index out of range.");
58 return (HasDef ? 1 : 0) + Pos;
98 enum { IDPos, NBytesPos, NCallArgsPos, CallTargetPos, MetaEnd };
102 enum { CCOffset = 1, FlagsOffset = 3, NumVMSArgsOffset = 5 };
147 : Type(Type), Size(Size), Reg(Reg), Offset(Offset) {}
158 : Reg(Reg), DwarfRegNum(DwarfRegNum), Size(Size) {}
191 static const char *WSMP;
197 struct CallsiteInfo {
198 const MCExpr *CSOffsetExpr;
200 LocationVec Locations;
202 CallsiteInfo() : CSOffsetExpr(nullptr),
ID(0) {}
203 CallsiteInfo(
const MCExpr *CSOffsetExpr, uint64_t
ID,
204 LocationVec &&Locations, LiveOutVec &&LiveOuts)
205 : CSOffsetExpr(CSOffsetExpr), ID(ID), Locations(std::move(Locations)),
206 LiveOuts(std::move(LiveOuts)) {}
209 typedef std::vector<CallsiteInfo> CallsiteInfoList;
212 CallsiteInfoList CSInfos;
213 ConstantPool ConstPool;
214 FnStackSizeMap FnStackSize;
219 LiveOutVec &LiveOuts)
const;
222 LiveOutReg createLiveOutReg(
unsigned Reg,
223 const TargetRegisterInfo *TRI)
const;
227 LiveOutVec parseRegisterLiveOutMask(
const uint32_t *Mask)
const;
234 void recordStackMapOpers(
const MachineInstr &
MI, uint64_t
ID,
237 bool recordResult =
false);
240 void emitStackmapHeader(MCStreamer &OS);
243 void emitFunctionFrameRecords(MCStreamer &OS);
246 void emitConstantPoolEntries(MCStreamer &OS);
249 void emitCallsiteEntries(MCStreamer &OS);
251 void print(raw_ostream &OS);
252 void debug() { print(
dbgs()); }
unsigned short DwarfRegNum
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)
Base class for the full range of assembler expressions which are needed for parsing.
Reg
All possible values of the reg field in the ModR/M byte.
PatchPointOpers(const MachineInstr *MI)
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...
const MachineOperand & getOperand(unsigned i) const
LiveOutReg(unsigned short Reg, unsigned short DwarfRegNum, unsigned short Size)
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.
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.
Representation of each machine instruction.
const MachineOperand & getMetaOper(unsigned Pos)
StackMaps(AsmPrinter &AP)
MI-level Statepoint operands.
unsigned getVarIdx() const
Get starting index of non call related arguments (calling convention, statepoint flags, vm state and gc state).
unsigned getMetaIdx(unsigned Pos=0) const
const MachineOperand * const_mop_iterator
uint64_t getID() const
Return the ID for the given statepoint.