1 //===- StackMaps.cpp ------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "llvm/ADT/DenseMapInfo.h" 11 #include "llvm/ADT/STLExtras.h" 12 #include "llvm/ADT/Twine.h" 13 #include "llvm/CodeGen/AsmPrinter.h" 14 #include "llvm/CodeGen/MachineFrameInfo.h" 15 #include "llvm/CodeGen/MachineFunction.h" 16 #include "llvm/CodeGen/MachineInstr.h" 17 #include "llvm/CodeGen/MachineOperand.h" 18 #include "llvm/CodeGen/StackMaps.h" 19 #include "llvm/IR/DataLayout.h" 20 #include "llvm/MC/MCContext.h" 21 #include "llvm/MC/MCExpr.h" 22 #include "llvm/MC/MCObjectFileInfo.h" 23 #include "llvm/MC/MCRegisterInfo.h" 24 #include "llvm/MC/MCStreamer.h" 25 #include "llvm/Support/CommandLine.h" 26 #include "llvm/Support/Debug.h" 27 #include "llvm/Support/ErrorHandling.h" 28 #include "llvm/Support/MathExtras.h" 29 #include "llvm/Support/raw_ostream.h" 30 #include "llvm/Target/TargetOpcodes.h" 31 #include "llvm/Target/TargetRegisterInfo.h" 32 #include "llvm/Target/TargetSubtargetInfo.h" 33 #include <algorithm> 34 #include <cassert> 35 #include <cstdint> 36 #include <iterator> 37 #include <utility> 38 39 using namespace llvm; 40 41 #define DEBUG_TYPE "stackmaps" 42 43 static cl::opt<int> StackMapVersion( 44 "stackmap-version", cl::init(2), 45 cl::desc("Specify the stackmap encoding version (default = 2)")); 46 47 const char *StackMaps::WSMP = "Stack Maps: "; 48 49 StackMapOpers::StackMapOpers(const MachineInstr *MI) 50 : MI(MI) { 51 assert(getVarIdx() <= MI->getNumOperands() && 52 "invalid stackmap definition"); 53 } 54 55 PatchPointOpers::PatchPointOpers(const MachineInstr *MI) 56 : MI(MI), HasDef(MI->getOperand(0).isReg() && MI->getOperand(0).isDef() && 57 !MI->getOperand(0).isImplicit()) { 58 #ifndef NDEBUG 59 unsigned CheckStartIdx = 0, e = MI->getNumOperands(); 60 while (CheckStartIdx < e && MI->getOperand(CheckStartIdx).isReg() && 61 MI->getOperand(CheckStartIdx).isDef() && 62 !MI->getOperand(CheckStartIdx).isImplicit()) 63 ++CheckStartIdx; 64 65 assert(getMetaIdx() == CheckStartIdx && 66 "Unexpected additional definition in Patchpoint intrinsic."); 67 #endif 68 } 69 70 unsigned PatchPointOpers::getNextScratchIdx(unsigned StartIdx) const { 71 if (!StartIdx) 72 StartIdx = getVarIdx(); 73 74 // Find the next scratch register (implicit def and early clobber) 75 unsigned ScratchIdx = StartIdx, e = MI->getNumOperands(); 76 while (ScratchIdx < e && 77 !(MI->getOperand(ScratchIdx).isReg() && 78 MI->getOperand(ScratchIdx).isDef() && 79 MI->getOperand(ScratchIdx).isImplicit() && 80 MI->getOperand(ScratchIdx).isEarlyClobber())) 81 ++ScratchIdx; 82 83 assert(ScratchIdx != e && "No scratch register available"); 84 return ScratchIdx; 85 } 86 87 StackMaps::StackMaps(AsmPrinter &AP) : AP(AP) { 88 if (StackMapVersion != 2) 89 llvm_unreachable("Unsupported stackmap version!"); 90 } 91 92 /// Go up the super-register chain until we hit a valid dwarf register number. 93 static unsigned getDwarfRegNum(unsigned Reg, const TargetRegisterInfo *TRI) { 94 int RegNum = TRI->getDwarfRegNum(Reg, false); 95 for (MCSuperRegIterator SR(Reg, TRI); SR.isValid() && RegNum < 0; ++SR) 96 RegNum = TRI->getDwarfRegNum(*SR, false); 97 98 assert(RegNum >= 0 && "Invalid Dwarf register number."); 99 return (unsigned)RegNum; 100 } 101 102 MachineInstr::const_mop_iterator 103 StackMaps::parseOperand(MachineInstr::const_mop_iterator MOI, 104 MachineInstr::const_mop_iterator MOE, LocationVec &Locs, 105 LiveOutVec &LiveOuts) const { 106 const TargetRegisterInfo *TRI = AP.MF->getSubtarget().getRegisterInfo(); 107 if (MOI->isImm()) { 108 switch (MOI->getImm()) { 109 default: 110 llvm_unreachable("Unrecognized operand type."); 111 case StackMaps::DirectMemRefOp: { 112 auto &DL = AP.MF->getDataLayout(); 113 114 unsigned Size = DL.getPointerSizeInBits(); 115 assert((Size % 8) == 0 && "Need pointer size in bytes."); 116 Size /= 8; 117 unsigned Reg = (++MOI)->getReg(); 118 int64_t Imm = (++MOI)->getImm(); 119 Locs.emplace_back(StackMaps::Location::Direct, Size, 120 getDwarfRegNum(Reg, TRI), Imm); 121 break; 122 } 123 case StackMaps::IndirectMemRefOp: { 124 int64_t Size = (++MOI)->getImm(); 125 assert(Size > 0 && "Need a valid size for indirect memory locations."); 126 unsigned Reg = (++MOI)->getReg(); 127 int64_t Imm = (++MOI)->getImm(); 128 Locs.emplace_back(StackMaps::Location::Indirect, Size, 129 getDwarfRegNum(Reg, TRI), Imm); 130 break; 131 } 132 case StackMaps::ConstantOp: { 133 ++MOI; 134 assert(MOI->isImm() && "Expected constant operand."); 135 int64_t Imm = MOI->getImm(); 136 Locs.emplace_back(Location::Constant, sizeof(int64_t), 0, Imm); 137 break; 138 } 139 } 140 return ++MOI; 141 } 142 143 // The physical register number will ultimately be encoded as a DWARF regno. 144 // The stack map also records the size of a spill slot that can hold the 145 // register content. (The runtime can track the actual size of the data type 146 // if it needs to.) 147 if (MOI->isReg()) { 148 // Skip implicit registers (this includes our scratch registers) 149 if (MOI->isImplicit()) 150 return ++MOI; 151 152 assert(TargetRegisterInfo::isPhysicalRegister(MOI->getReg()) && 153 "Virtreg operands should have been rewritten before now."); 154 const TargetRegisterClass *RC = TRI->getMinimalPhysRegClass(MOI->getReg()); 155 assert(!MOI->getSubReg() && "Physical subreg still around."); 156 157 unsigned Offset = 0; 158 unsigned DwarfRegNum = getDwarfRegNum(MOI->getReg(), TRI); 159 unsigned LLVMRegNum = TRI->getLLVMRegNum(DwarfRegNum, false); 160 unsigned SubRegIdx = TRI->getSubRegIndex(LLVMRegNum, MOI->getReg()); 161 if (SubRegIdx) 162 Offset = TRI->getSubRegIdxOffset(SubRegIdx); 163 164 Locs.emplace_back(Location::Register, RC->getSize(), DwarfRegNum, Offset); 165 return ++MOI; 166 } 167 168 if (MOI->isRegLiveOut()) 169 LiveOuts = parseRegisterLiveOutMask(MOI->getRegLiveOut()); 170 171 return ++MOI; 172 } 173 174 void StackMaps::print(raw_ostream &OS) { 175 const TargetRegisterInfo *TRI = 176 AP.MF ? AP.MF->getSubtarget().getRegisterInfo() : nullptr; 177 OS << WSMP << "callsites:\n"; 178 for (const auto &CSI : CSInfos) { 179 const LocationVec &CSLocs = CSI.Locations; 180 const LiveOutVec &LiveOuts = CSI.LiveOuts; 181 182 OS << WSMP << "callsite " << CSI.ID << "\n"; 183 OS << WSMP << " has " << CSLocs.size() << " locations\n"; 184 185 unsigned Idx = 0; 186 for (const auto &Loc : CSLocs) { 187 OS << WSMP << "\t\tLoc " << Idx << ": "; 188 switch (Loc.Type) { 189 case Location::Unprocessed: 190 OS << "<Unprocessed operand>"; 191 break; 192 case Location::Register: 193 OS << "Register "; 194 if (TRI) 195 OS << TRI->getName(Loc.Reg); 196 else 197 OS << Loc.Reg; 198 break; 199 case Location::Direct: 200 OS << "Direct "; 201 if (TRI) 202 OS << TRI->getName(Loc.Reg); 203 else 204 OS << Loc.Reg; 205 if (Loc.Offset) 206 OS << " + " << Loc.Offset; 207 break; 208 case Location::Indirect: 209 OS << "Indirect "; 210 if (TRI) 211 OS << TRI->getName(Loc.Reg); 212 else 213 OS << Loc.Reg; 214 OS << "+" << Loc.Offset; 215 break; 216 case Location::Constant: 217 OS << "Constant " << Loc.Offset; 218 break; 219 case Location::ConstantIndex: 220 OS << "Constant Index " << Loc.Offset; 221 break; 222 } 223 OS << "\t[encoding: .byte " << Loc.Type << ", .byte " << Loc.Size 224 << ", .short " << Loc.Reg << ", .int " << Loc.Offset << "]\n"; 225 Idx++; 226 } 227 228 OS << WSMP << "\thas " << LiveOuts.size() << " live-out registers\n"; 229 230 Idx = 0; 231 for (const auto &LO : LiveOuts) { 232 OS << WSMP << "\t\tLO " << Idx << ": "; 233 if (TRI) 234 OS << TRI->getName(LO.Reg); 235 else 236 OS << LO.Reg; 237 OS << "\t[encoding: .short " << LO.DwarfRegNum << ", .byte 0, .byte " 238 << LO.Size << "]\n"; 239 Idx++; 240 } 241 } 242 } 243 244 /// Create a live-out register record for the given register Reg. 245 StackMaps::LiveOutReg 246 StackMaps::createLiveOutReg(unsigned Reg, const TargetRegisterInfo *TRI) const { 247 unsigned DwarfRegNum = getDwarfRegNum(Reg, TRI); 248 unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize(); 249 return LiveOutReg(Reg, DwarfRegNum, Size); 250 } 251 252 /// Parse the register live-out mask and return a vector of live-out registers 253 /// that need to be recorded in the stackmap. 254 StackMaps::LiveOutVec 255 StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const { 256 assert(Mask && "No register mask specified"); 257 const TargetRegisterInfo *TRI = AP.MF->getSubtarget().getRegisterInfo(); 258 LiveOutVec LiveOuts; 259 260 // Create a LiveOutReg for each bit that is set in the register mask. 261 for (unsigned Reg = 0, NumRegs = TRI->getNumRegs(); Reg != NumRegs; ++Reg) 262 if ((Mask[Reg / 32] >> Reg % 32) & 1) 263 LiveOuts.push_back(createLiveOutReg(Reg, TRI)); 264 265 // We don't need to keep track of a register if its super-register is already 266 // in the list. Merge entries that refer to the same dwarf register and use 267 // the maximum size that needs to be spilled. 268 269 std::sort(LiveOuts.begin(), LiveOuts.end(), 270 [](const LiveOutReg &LHS, const LiveOutReg &RHS) { 271 // Only sort by the dwarf register number. 272 return LHS.DwarfRegNum < RHS.DwarfRegNum; 273 }); 274 275 for (auto I = LiveOuts.begin(), E = LiveOuts.end(); I != E; ++I) { 276 for (auto II = std::next(I); II != E; ++II) { 277 if (I->DwarfRegNum != II->DwarfRegNum) { 278 // Skip all the now invalid entries. 279 I = --II; 280 break; 281 } 282 I->Size = std::max(I->Size, II->Size); 283 if (TRI->isSuperRegister(I->Reg, II->Reg)) 284 I->Reg = II->Reg; 285 II->Reg = 0; // mark for deletion. 286 } 287 } 288 289 LiveOuts.erase( 290 llvm::remove_if(LiveOuts, 291 [](const LiveOutReg &LO) { return LO.Reg == 0; }), 292 LiveOuts.end()); 293 294 return LiveOuts; 295 } 296 297 void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID, 298 MachineInstr::const_mop_iterator MOI, 299 MachineInstr::const_mop_iterator MOE, 300 bool recordResult) { 301 MCContext &OutContext = AP.OutStreamer->getContext(); 302 MCSymbol *MILabel = OutContext.createTempSymbol(); 303 AP.OutStreamer->EmitLabel(MILabel); 304 305 LocationVec Locations; 306 LiveOutVec LiveOuts; 307 308 if (recordResult) { 309 assert(PatchPointOpers(&MI).hasDef() && "Stackmap has no return value."); 310 parseOperand(MI.operands_begin(), std::next(MI.operands_begin()), Locations, 311 LiveOuts); 312 } 313 314 // Parse operands. 315 while (MOI != MOE) { 316 MOI = parseOperand(MOI, MOE, Locations, LiveOuts); 317 } 318 319 // Move large constants into the constant pool. 320 for (auto &Loc : Locations) { 321 // Constants are encoded as sign-extended integers. 322 // -1 is directly encoded as .long 0xFFFFFFFF with no constant pool. 323 if (Loc.Type == Location::Constant && !isInt<32>(Loc.Offset)) { 324 Loc.Type = Location::ConstantIndex; 325 // ConstPool is intentionally a MapVector of 'uint64_t's (as 326 // opposed to 'int64_t's). We should never be in a situation 327 // where we have to insert either the tombstone or the empty 328 // keys into a map, and for a DenseMap<uint64_t, T> these are 329 // (uint64_t)0 and (uint64_t)-1. They can be and are 330 // represented using 32 bit integers. 331 assert((uint64_t)Loc.Offset != DenseMapInfo<uint64_t>::getEmptyKey() && 332 (uint64_t)Loc.Offset != 333 DenseMapInfo<uint64_t>::getTombstoneKey() && 334 "empty and tombstone keys should fit in 32 bits!"); 335 auto Result = ConstPool.insert(std::make_pair(Loc.Offset, Loc.Offset)); 336 Loc.Offset = Result.first - ConstPool.begin(); 337 } 338 } 339 340 // Create an expression to calculate the offset of the callsite from function 341 // entry. 342 const MCExpr *CSOffsetExpr = MCBinaryExpr::createSub( 343 MCSymbolRefExpr::create(MILabel, OutContext), 344 MCSymbolRefExpr::create(AP.CurrentFnSymForSize, OutContext), OutContext); 345 346 CSInfos.emplace_back(CSOffsetExpr, ID, std::move(Locations), 347 std::move(LiveOuts)); 348 349 // Record the stack size of the current function and update callsite count. 350 const MachineFrameInfo &MFI = AP.MF->getFrameInfo(); 351 const TargetRegisterInfo *RegInfo = AP.MF->getSubtarget().getRegisterInfo(); 352 bool HasDynamicFrameSize = 353 MFI.hasVarSizedObjects() || RegInfo->needsStackRealignment(*(AP.MF)); 354 uint64_t FrameSize = HasDynamicFrameSize ? UINT64_MAX : MFI.getStackSize(); 355 356 auto CurrentIt = FnInfos.find(AP.CurrentFnSym); 357 if (CurrentIt != FnInfos.end()) 358 CurrentIt->second.RecordCount++; 359 else 360 FnInfos.insert(std::make_pair(AP.CurrentFnSym, FunctionInfo(FrameSize))); 361 } 362 363 void StackMaps::recordStackMap(const MachineInstr &MI) { 364 assert(MI.getOpcode() == TargetOpcode::STACKMAP && "expected stackmap"); 365 366 StackMapOpers opers(&MI); 367 const int64_t ID = MI.getOperand(PatchPointOpers::IDPos).getImm(); 368 recordStackMapOpers(MI, ID, std::next(MI.operands_begin(), opers.getVarIdx()), 369 MI.operands_end()); 370 } 371 372 void StackMaps::recordPatchPoint(const MachineInstr &MI) { 373 assert(MI.getOpcode() == TargetOpcode::PATCHPOINT && "expected patchpoint"); 374 375 PatchPointOpers opers(&MI); 376 const int64_t ID = opers.getID(); 377 auto MOI = std::next(MI.operands_begin(), opers.getStackMapStartIdx()); 378 recordStackMapOpers(MI, ID, MOI, MI.operands_end(), 379 opers.isAnyReg() && opers.hasDef()); 380 381 #ifndef NDEBUG 382 // verify anyregcc 383 auto &Locations = CSInfos.back().Locations; 384 if (opers.isAnyReg()) { 385 unsigned NArgs = opers.getNumCallArgs(); 386 for (unsigned i = 0, e = (opers.hasDef() ? NArgs + 1 : NArgs); i != e; ++i) 387 assert(Locations[i].Type == Location::Register && 388 "anyreg arg must be in reg."); 389 } 390 #endif 391 } 392 393 void StackMaps::recordStatepoint(const MachineInstr &MI) { 394 assert(MI.getOpcode() == TargetOpcode::STATEPOINT && "expected statepoint"); 395 396 StatepointOpers opers(&MI); 397 // Record all the deopt and gc operands (they're contiguous and run from the 398 // initial index to the end of the operand list) 399 const unsigned StartIdx = opers.getVarIdx(); 400 recordStackMapOpers(MI, opers.getID(), MI.operands_begin() + StartIdx, 401 MI.operands_end(), false); 402 } 403 404 /// Emit the stackmap header. 405 /// 406 /// Header { 407 /// uint8 : Stack Map Version (currently 2) 408 /// uint8 : Reserved (expected to be 0) 409 /// uint16 : Reserved (expected to be 0) 410 /// } 411 /// uint32 : NumFunctions 412 /// uint32 : NumConstants 413 /// uint32 : NumRecords 414 void StackMaps::emitStackmapHeader(MCStreamer &OS) { 415 // Header. 416 OS.EmitIntValue(StackMapVersion, 1); // Version. 417 OS.EmitIntValue(0, 1); // Reserved. 418 OS.EmitIntValue(0, 2); // Reserved. 419 420 // Num functions. 421 DEBUG(dbgs() << WSMP << "#functions = " << FnInfos.size() << '\n'); 422 OS.EmitIntValue(FnInfos.size(), 4); 423 // Num constants. 424 DEBUG(dbgs() << WSMP << "#constants = " << ConstPool.size() << '\n'); 425 OS.EmitIntValue(ConstPool.size(), 4); 426 // Num callsites. 427 DEBUG(dbgs() << WSMP << "#callsites = " << CSInfos.size() << '\n'); 428 OS.EmitIntValue(CSInfos.size(), 4); 429 } 430 431 /// Emit the function frame record for each function. 432 /// 433 /// StkSizeRecord[NumFunctions] { 434 /// uint64 : Function Address 435 /// uint64 : Stack Size 436 /// uint64 : Record Count 437 /// } 438 void StackMaps::emitFunctionFrameRecords(MCStreamer &OS) { 439 // Function Frame records. 440 DEBUG(dbgs() << WSMP << "functions:\n"); 441 for (auto const &FR : FnInfos) { 442 DEBUG(dbgs() << WSMP << "function addr: " << FR.first 443 << " frame size: " << FR.second.StackSize 444 << " callsite count: " << FR.second.RecordCount << '\n'); 445 OS.EmitSymbolValue(FR.first, 8); 446 OS.EmitIntValue(FR.second.StackSize, 8); 447 OS.EmitIntValue(FR.second.RecordCount, 8); 448 } 449 } 450 451 /// Emit the constant pool. 452 /// 453 /// int64 : Constants[NumConstants] 454 void StackMaps::emitConstantPoolEntries(MCStreamer &OS) { 455 // Constant pool entries. 456 DEBUG(dbgs() << WSMP << "constants:\n"); 457 for (const auto &ConstEntry : ConstPool) { 458 DEBUG(dbgs() << WSMP << ConstEntry.second << '\n'); 459 OS.EmitIntValue(ConstEntry.second, 8); 460 } 461 } 462 463 /// Emit the callsite info for each callsite. 464 /// 465 /// StkMapRecord[NumRecords] { 466 /// uint64 : PatchPoint ID 467 /// uint32 : Instruction Offset 468 /// uint16 : Reserved (record flags) 469 /// uint16 : NumLocations 470 /// Location[NumLocations] { 471 /// uint8 : Register | Direct | Indirect | Constant | ConstantIndex 472 /// uint8 : Size in Bytes 473 /// uint16 : Dwarf RegNum 474 /// int32 : Offset 475 /// } 476 /// uint16 : Padding 477 /// uint16 : NumLiveOuts 478 /// LiveOuts[NumLiveOuts] { 479 /// uint16 : Dwarf RegNum 480 /// uint8 : Reserved 481 /// uint8 : Size in Bytes 482 /// } 483 /// uint32 : Padding (only if required to align to 8 byte) 484 /// } 485 /// 486 /// Location Encoding, Type, Value: 487 /// 0x1, Register, Reg (value in register) 488 /// 0x2, Direct, Reg + Offset (frame index) 489 /// 0x3, Indirect, [Reg + Offset] (spilled value) 490 /// 0x4, Constant, Offset (small constant) 491 /// 0x5, ConstIndex, Constants[Offset] (large constant) 492 void StackMaps::emitCallsiteEntries(MCStreamer &OS) { 493 DEBUG(print(dbgs())); 494 // Callsite entries. 495 for (const auto &CSI : CSInfos) { 496 const LocationVec &CSLocs = CSI.Locations; 497 const LiveOutVec &LiveOuts = CSI.LiveOuts; 498 499 // Verify stack map entry. It's better to communicate a problem to the 500 // runtime than crash in case of in-process compilation. Currently, we do 501 // simple overflow checks, but we may eventually communicate other 502 // compilation errors this way. 503 if (CSLocs.size() > UINT16_MAX || LiveOuts.size() > UINT16_MAX) { 504 OS.EmitIntValue(UINT64_MAX, 8); // Invalid ID. 505 OS.EmitValue(CSI.CSOffsetExpr, 4); 506 OS.EmitIntValue(0, 2); // Reserved. 507 OS.EmitIntValue(0, 2); // 0 locations. 508 OS.EmitIntValue(0, 2); // padding. 509 OS.EmitIntValue(0, 2); // 0 live-out registers. 510 OS.EmitIntValue(0, 4); // padding. 511 continue; 512 } 513 514 OS.EmitIntValue(CSI.ID, 8); 515 OS.EmitValue(CSI.CSOffsetExpr, 4); 516 517 // Reserved for flags. 518 OS.EmitIntValue(0, 2); 519 OS.EmitIntValue(CSLocs.size(), 2); 520 521 for (const auto &Loc : CSLocs) { 522 OS.EmitIntValue(Loc.Type, 1); 523 OS.EmitIntValue(Loc.Size, 1); 524 OS.EmitIntValue(Loc.Reg, 2); 525 OS.EmitIntValue(Loc.Offset, 4); 526 } 527 528 // Num live-out registers and padding to align to 4 byte. 529 OS.EmitIntValue(0, 2); 530 OS.EmitIntValue(LiveOuts.size(), 2); 531 532 for (const auto &LO : LiveOuts) { 533 OS.EmitIntValue(LO.DwarfRegNum, 2); 534 OS.EmitIntValue(0, 1); 535 OS.EmitIntValue(LO.Size, 1); 536 } 537 // Emit alignment to 8 byte. 538 OS.EmitValueToAlignment(8); 539 } 540 } 541 542 /// Serialize the stackmap data. 543 void StackMaps::serializeToStackMapSection() { 544 (void)WSMP; 545 // Bail out if there's no stack map data. 546 assert((!CSInfos.empty() || ConstPool.empty()) && 547 "Expected empty constant pool too!"); 548 assert((!CSInfos.empty() || FnInfos.empty()) && 549 "Expected empty function record too!"); 550 if (CSInfos.empty()) 551 return; 552 553 MCContext &OutContext = AP.OutStreamer->getContext(); 554 MCStreamer &OS = *AP.OutStreamer; 555 556 // Create the section. 557 MCSection *StackMapSection = 558 OutContext.getObjectFileInfo()->getStackMapSection(); 559 OS.SwitchSection(StackMapSection); 560 561 // Emit a dummy symbol to force section inclusion. 562 OS.EmitLabel(OutContext.getOrCreateSymbol(Twine("__LLVM_StackMaps"))); 563 564 // Serialize data. 565 DEBUG(dbgs() << "********** Stack Map Output **********\n"); 566 emitStackmapHeader(OS); 567 emitFunctionFrameRecords(OS); 568 emitConstantPoolEntries(OS); 569 emitCallsiteEntries(OS); 570 OS.AddBlankLine(); 571 572 // Clean up. 573 CSInfos.clear(); 574 ConstPool.clear(); 575 } 576