Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/include/llvm/CodeGen/StackMaps.h
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | public: | ||||
// OpParser. | // OpParser. | ||||
typedef enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp } OpType; | typedef enum { DirectMemRefOp, IndirectMemRefOp, ConstantOp } OpType; | ||||
StackMaps(AsmPrinter &AP); | StackMaps(AsmPrinter &AP); | ||||
void reset() { | void reset() { | ||||
CSInfos.clear(); | CSInfos.clear(); | ||||
ConstPool.clear(); | ConstPool.clear(); | ||||
FnStackSize.clear(); | FnInfos.clear(); | ||||
} | } | ||||
/// \brief Generate a stackmap record for a stackmap instruction. | /// \brief Generate a stackmap record for a stackmap instruction. | ||||
/// | /// | ||||
/// MI must be a raw STACKMAP, not a PATCHPOINT. | /// MI must be a raw STACKMAP, not a PATCHPOINT. | ||||
void recordStackMap(const MachineInstr &MI); | void recordStackMap(const MachineInstr &MI); | ||||
/// \brief Generate a stackmap record for a patchpoint instruction. | /// \brief Generate a stackmap record for a patchpoint instruction. | ||||
void recordPatchPoint(const MachineInstr &MI); | void recordPatchPoint(const MachineInstr &MI); | ||||
/// \brief Generate a stackmap record for a statepoint instruction. | /// \brief Generate a stackmap record for a statepoint instruction. | ||||
void recordStatepoint(const MachineInstr &MI); | void recordStatepoint(const MachineInstr &MI); | ||||
/// If there is any stack map data, create a stack map section and serialize | /// If there is any stack map data, create a stack map section and serialize | ||||
/// the map info into it. This clears the stack map data structures | /// the map info into it. This clears the stack map data structures | ||||
/// afterwards. | /// afterwards. | ||||
void serializeToStackMapSection(); | void serializeToStackMapSection(); | ||||
private: | private: | ||||
static const char *WSMP; | static const char *WSMP; | ||||
typedef SmallVector<Location, 8> LocationVec; | typedef SmallVector<Location, 8> LocationVec; | ||||
typedef SmallVector<LiveOutReg, 8> LiveOutVec; | typedef SmallVector<LiveOutReg, 8> LiveOutVec; | ||||
typedef MapVector<uint64_t, uint64_t> ConstantPool; | typedef MapVector<uint64_t, uint64_t> ConstantPool; | ||||
typedef MapVector<const MCSymbol *, uint64_t> FnStackSizeMap; | |||||
struct FunctionInfo { | |||||
uint64_t StackSize; | |||||
uint64_t RecordCount; | |||||
FunctionInfo() : StackSize(0), RecordCount(1) {} | |||||
explicit FunctionInfo(uint64_t StackSize) : StackSize(StackSize), RecordCount(1) {} | |||||
}; | |||||
struct CallsiteInfo { | struct CallsiteInfo { | ||||
const MCExpr *CSOffsetExpr; | const MCExpr *CSOffsetExpr; | ||||
uint64_t ID; | uint64_t ID; | ||||
LocationVec Locations; | LocationVec Locations; | ||||
LiveOutVec LiveOuts; | LiveOutVec LiveOuts; | ||||
CallsiteInfo() : CSOffsetExpr(nullptr), ID(0) {} | CallsiteInfo() : CSOffsetExpr(nullptr), ID(0) {} | ||||
CallsiteInfo(const MCExpr *CSOffsetExpr, uint64_t ID, | CallsiteInfo(const MCExpr *CSOffsetExpr, uint64_t ID, | ||||
LocationVec &&Locations, LiveOutVec &&LiveOuts) | LocationVec &&Locations, LiveOutVec &&LiveOuts) | ||||
: CSOffsetExpr(CSOffsetExpr), ID(ID), Locations(std::move(Locations)), | : CSOffsetExpr(CSOffsetExpr), ID(ID), Locations(std::move(Locations)), | ||||
LiveOuts(std::move(LiveOuts)) {} | LiveOuts(std::move(LiveOuts)) {} | ||||
}; | }; | ||||
typedef MapVector<const MCSymbol *, FunctionInfo> FnInfoMap; | |||||
typedef std::vector<CallsiteInfo> CallsiteInfoList; | typedef std::vector<CallsiteInfo> CallsiteInfoList; | ||||
AsmPrinter &AP; | AsmPrinter &AP; | ||||
CallsiteInfoList CSInfos; | CallsiteInfoList CSInfos; | ||||
ConstantPool ConstPool; | ConstantPool ConstPool; | ||||
FnStackSizeMap FnStackSize; | FnInfoMap FnInfos; | ||||
MachineInstr::const_mop_iterator | MachineInstr::const_mop_iterator | ||||
parseOperand(MachineInstr::const_mop_iterator MOI, | parseOperand(MachineInstr::const_mop_iterator MOI, | ||||
MachineInstr::const_mop_iterator MOE, LocationVec &Locs, | MachineInstr::const_mop_iterator MOE, LocationVec &Locs, | ||||
LiveOutVec &LiveOuts) const; | LiveOutVec &LiveOuts) const; | ||||
/// \brief Create a live-out register record for the given register @p Reg. | /// \brief Create a live-out register record for the given register @p Reg. | ||||
LiveOutReg createLiveOutReg(unsigned Reg, | LiveOutReg createLiveOutReg(unsigned Reg, | ||||
Show All 34 Lines |