10 #define DEBUG_TYPE "stackmaps"
33 HasDef(MI->getOperand(0).
isReg() && MI->getOperand(0).isDef() &&
34 !MI->getOperand(0).isImplicit()),
35 IsAnyReg(MI->getOperand(getMetaIdx(CCPos)).getImm() == CallingConv::
AnyReg) {
40 while (CheckStartIdx < e && MI->getOperand(CheckStartIdx).
isReg() &&
46 "Unexpected additonal definition in Patchpoint intrinsic.");
57 while (ScratchIdx < e &&
64 assert(ScratchIdx != e &&
"No scratch register available");
77 LocationVec CallsiteLocs;
80 std::pair<Location, MachineInstr::const_mop_iterator> ParseResult =
83 Location &Loc = ParseResult.first;
85 "Stackmap return location must be a register.");
86 CallsiteLocs.push_back(Loc);
90 std::pair<Location, MachineInstr::const_mop_iterator> ParseResult =
91 OpParser(MOI, MOE, AP.
TM);
93 Location &Loc = ParseResult.first;
98 Loc.Offset = ConstPool.getConstantIndex(Loc.Offset);
101 CallsiteLocs.push_back(Loc);
102 MOI = ParseResult.second;
110 CSInfos.push_back(CallsiteInfo(CSOffsetExpr, ID, CallsiteLocs));
116 for (; MOI != MOE; ++MOI)
127 assert((int32_t)ID == ID &&
"Stack maps hold 32-bit IDs");
138 assert((int32_t)ID == ID &&
"Stack maps hold 32-bit IDs");
142 opers.isAnyReg() && opers.hasDef());
147 if (opers.isAnyReg()) {
149 for (
unsigned i = 0, e = (opers.hasDef() ? NArgs+1 : NArgs); i != e; ++i)
151 "anyreg arg must be in reg.");
200 const char *WSMP =
"Stack Maps: ";
204 DEBUG(
dbgs() <<
"********** Stack Map Output **********\n");
213 for (
unsigned i = 0; i < ConstPool.getNumConstants(); ++i)
216 DEBUG(
dbgs() << WSMP <<
"#callsites = " << CSInfos.size() <<
"\n");
219 for (CallsiteInfoList::const_iterator CSII = CSInfos.begin(),
220 CSIE = CSInfos.end();
221 CSII != CSIE; ++CSII) {
223 unsigned CallsiteID = CSII->ID;
226 DEBUG(
dbgs() << WSMP <<
"callsite " << CallsiteID <<
"\n");
232 if (CSLocs.
size() > UINT16_MAX) {
246 DEBUG(
dbgs() << WSMP <<
" has " << CSLocs.
size() <<
" locations\n");
250 unsigned operIdx = 0;
252 LocI != LocE; ++LocI, ++operIdx) {
255 dbgs() << WSMP <<
" Loc " << operIdx <<
": ";
258 dbgs() <<
"<Unprocessed operand>";
283 int Offset = Loc.Offset;
287 SR.
isValid() && (int)RegNo < 0; ++SR) {
293 assert(!Loc.Offset &&
"Register location should have zero offset");
302 "Missing location register");
311 AP.OutStreamer.AddBlankLine();
static bool isReg(const MCInst &MI, unsigned OpNo)
mop_iterator operands_end()
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent va...
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
static MachineInstr::const_mop_iterator getStackMapEndMOP(MachineInstr::const_mop_iterator MOI, MachineInstr::const_mop_iterator MOE)
unsigned getVarIdx() const
unsigned getSubRegIndex(unsigned RegNo, unsigned SubRegNo) const
For a given register pair, return the sub-register index if the second register is a sub-register of ...
MCSymbol * GetOrCreateSymbol(StringRef Name)
MCSymbol * CreateTempSymbol()
bool isReg() const
isReg - Tests if this is a MO_Register operand.
ID
LLVM Calling Convention Representation.
MCContext & getContext() const
static const MCBinaryExpr * CreateSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
unsigned getNumOperands() const
void SwitchSection(const MCSection *Section, const MCExpr *Subsection=0)
PatchPointOpers(const MachineInstr *MI)
virtual void EmitIntValue(uint64_t Value, unsigned Size)
void EmitValue(const MCExpr *Value, unsigned Size)
static const MCSymbolRefExpr * Create(const MCSymbol *Symbol, MCContext &Ctx)
bool isEarlyClobber() const
const MachineOperand & getOperand(unsigned i) const
ItTy next(ItTy it, Dist n)
MI-level patchpoint operands.
int getLLVMRegNum(unsigned RegNum, bool isEH) const
Map a dwarf register back to a target register.
void recordPatchPoint(const MachineInstr &MI)
Generate a stackmap record for a patchpoint instruction.
void serializeToStackMapSection()
bool isRegMask() const
isRegMask - Tests if this is a MO_RegisterMask operand.
const MCSection * getStackMapSection() const
virtual void EmitLabel(MCSymbol *Symbol)
unsigned getNextScratchIdx(unsigned StartIdx=0) const
Get the next scratch register operand index.
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
void recordStackMap(const MachineInstr &MI)
Generate a stackmap record for a stackmap instruction.
const MCRegisterInfo * getRegisterInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const
unsigned getSubRegIdxOffset(unsigned Idx) const
Get the offset of the bit range covered by a sub-register index. If an Offset doesn't make sense (the...
mop_iterator operands_begin()
const MCObjectFileInfo * getObjectFileInfo() const
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
unsigned getMetaIdx(unsigned Pos=0) const