1 //===- llvm/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp -------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/CodeGen/DbgEntityHistoryCalculator.h" 10 #include "llvm/ADT/BitVector.h" 11 #include "llvm/ADT/Optional.h" 12 #include "llvm/ADT/STLExtras.h" 13 #include "llvm/ADT/SmallSet.h" 14 #include "llvm/ADT/SmallVector.h" 15 #include "llvm/CodeGen/LexicalScopes.h" 16 #include "llvm/CodeGen/MachineBasicBlock.h" 17 #include "llvm/CodeGen/MachineFunction.h" 18 #include "llvm/CodeGen/MachineInstr.h" 19 #include "llvm/CodeGen/MachineOperand.h" 20 #include "llvm/CodeGen/TargetLowering.h" 21 #include "llvm/CodeGen/TargetRegisterInfo.h" 22 #include "llvm/CodeGen/TargetSubtargetInfo.h" 23 #include "llvm/IR/DebugInfoMetadata.h" 24 #include "llvm/IR/DebugLoc.h" 25 #include "llvm/MC/MCRegisterInfo.h" 26 #include "llvm/Support/Debug.h" 27 #include "llvm/Support/raw_ostream.h" 28 #include <cassert> 29 #include <map> 30 #include <utility> 31 32 using namespace llvm; 33 34 #define DEBUG_TYPE "dwarfdebug" 35 36 namespace { 37 using EntryIndex = DbgValueHistoryMap::EntryIndex; 38 } 39 40 // If @MI is a DBG_VALUE with debug value described by a 41 // defined register, returns the number of this register. 42 // In the other case, returns 0. 43 static Register isDescribedByReg(const MachineInstr &MI) { 44 assert(MI.isDebugValue()); 45 assert(MI.getNumOperands() == 4); 46 // If the location of variable is an entry value (DW_OP_LLVM_entry_value) 47 // do not consider it as a register location. 48 if (MI.getDebugExpression()->isEntryValue()) 49 return 0; 50 // If location of variable is described using a register (directly or 51 // indirectly), this register is always a first operand. 52 return MI.getDebugOperand(0).isReg() ? MI.getDebugOperand(0).getReg() 53 : Register(); 54 } 55 56 bool DbgValueHistoryMap::startDbgValue(InlinedEntity Var, 57 const MachineInstr &MI, 58 EntryIndex &NewIndex) { 59 // Instruction range should start with a DBG_VALUE instruction for the 60 // variable. 61 assert(MI.isDebugValue() && "not a DBG_VALUE"); 62 auto &Entries = VarEntries[Var]; 63 if (!Entries.empty() && Entries.back().isDbgValue() && 64 !Entries.back().isClosed() && 65 Entries.back().getInstr()->isIdenticalTo(MI)) { 66 LLVM_DEBUG(dbgs() << "Coalescing identical DBG_VALUE entries:\n" 67 << "\t" << Entries.back().getInstr() << "\t" << MI 68 << "\n"); 69 return false; 70 } 71 Entries.emplace_back(&MI, Entry::DbgValue); 72 NewIndex = Entries.size() - 1; 73 return true; 74 } 75 76 EntryIndex DbgValueHistoryMap::startClobber(InlinedEntity Var, 77 const MachineInstr &MI) { 78 auto &Entries = VarEntries[Var]; 79 // If an instruction clobbers multiple registers that the variable is 80 // described by, then we may have already created a clobbering instruction. 81 if (Entries.back().isClobber() && Entries.back().getInstr() == &MI) 82 return Entries.size() - 1; 83 Entries.emplace_back(&MI, Entry::Clobber); 84 return Entries.size() - 1; 85 } 86 87 void DbgValueHistoryMap::Entry::endEntry(EntryIndex Index) { 88 // For now, instruction ranges are not allowed to cross basic block 89 // boundaries. 90 assert(isDbgValue() && "Setting end index for non-debug value"); 91 assert(!isClosed() && "End index has already been set"); 92 EndIndex = Index; 93 } 94 95 using OrderMap = DenseMap<const MachineInstr *, unsigned>; 96 /// Number instructions so that we can compare instruction positions within MF. 97 /// Meta instructions are given the same nubmer as the preceding instruction. 98 /// Because the block ordering will not change it is possible (and safe) to 99 /// compare instruction positions between blocks. 100 static void numberInstructions(const MachineFunction &MF, OrderMap &Ordering) { 101 // We give meta instructions the same number as the peceding instruction 102 // because this function is written for the task of comparing positions of 103 // variable location ranges against scope ranges. To reflect what we'll see 104 // in the binary, when we look at location ranges we must consider all 105 // DBG_VALUEs between two real instructions at the same position. And a 106 // scope range which ends on a meta instruction should be considered to end 107 // at the last seen real instruction. E.g. 108 // 109 // 1 instruction p Both the variable location for x and for y start 110 // 1 DBG_VALUE for "x" after instruction p so we give them all the same 111 // 1 DBG_VALUE for "y" number. If a scope range ends at DBG_VALUE for "y", 112 // 2 instruction q we should treat it as ending after instruction p 113 // because it will be the last real instruction in the 114 // range. DBG_VALUEs at or after this position for 115 // variables declared in the scope will have no effect. 116 unsigned position = 0; 117 for (const MachineBasicBlock &MBB : MF) 118 for (const MachineInstr &MI : MBB) 119 Ordering[&MI] = MI.isMetaInstruction() ? position : ++position; 120 } 121 122 /// Check if instruction A comes before B. Meta instructions have the same 123 /// position as the preceding non-meta instruction. See numberInstructions for 124 /// more info. 125 static bool isBefore(const MachineInstr *A, const MachineInstr *B, 126 const OrderMap &Ordering) { 127 return Ordering.lookup(A) < Ordering.lookup(B); 128 } 129 130 /// Check if the instruction range [StartMI, EndMI] intersects any instruction 131 /// range in Ranges. EndMI can be nullptr to indicate that the range is 132 /// unbounded. Assumes Ranges is ordered and disjoint. Returns true and points 133 /// to the first intersecting scope range if one exists. 134 static Optional<ArrayRef<InsnRange>::iterator> 135 intersects(const MachineInstr *StartMI, const MachineInstr *EndMI, 136 const ArrayRef<InsnRange> &Ranges, const OrderMap &Ordering) { 137 for (auto RangesI = Ranges.begin(), RangesE = Ranges.end(); 138 RangesI != RangesE; ++RangesI) { 139 if (EndMI && isBefore(EndMI, RangesI->first, Ordering)) 140 return None; 141 if (EndMI && !isBefore(RangesI->second, EndMI, Ordering)) 142 return RangesI; 143 if (isBefore(StartMI, RangesI->second, Ordering)) 144 return RangesI; 145 } 146 return None; 147 } 148 149 void DbgValueHistoryMap::trimLocationRanges(const MachineFunction &MF, 150 LexicalScopes &LScopes) { 151 OrderMap Ordering; 152 numberInstructions(MF, Ordering); 153 154 // The indices of the entries we're going to remove for each variable. 155 SmallVector<EntryIndex, 4> ToRemove; 156 // Entry reference count for each variable. Clobbers left with no references 157 // will be removed. 158 SmallVector<int, 4> ReferenceCount; 159 // Entries reference other entries by index. Offsets is used to remap these 160 // references if any entries are removed. 161 SmallVector<size_t, 4> Offsets; 162 163 for (auto &Record : VarEntries) { 164 auto &HistoryMapEntries = Record.second; 165 if (HistoryMapEntries.empty()) 166 continue; 167 168 InlinedEntity Entity = Record.first; 169 const DILocalVariable *LocalVar = cast<DILocalVariable>(Entity.first); 170 171 LexicalScope *Scope = nullptr; 172 if (const DILocation *InlinedAt = Entity.second) { 173 Scope = LScopes.findInlinedScope(LocalVar->getScope(), InlinedAt); 174 } else { 175 Scope = LScopes.findLexicalScope(LocalVar->getScope()); 176 // Ignore variables for non-inlined function level scopes. The scope 177 // ranges (from scope->getRanges()) will not include any instructions 178 // before the first one with a debug-location, which could cause us to 179 // incorrectly drop a location. We could introduce special casing for 180 // these variables, but it doesn't seem worth it because no out-of-scope 181 // locations have been observed for variables declared in function level 182 // scopes. 183 if (Scope && 184 (Scope->getScopeNode() == Scope->getScopeNode()->getSubprogram()) && 185 (Scope->getScopeNode() == LocalVar->getScope())) 186 continue; 187 } 188 189 // If there is no scope for the variable then something has probably gone 190 // wrong. 191 if (!Scope) 192 continue; 193 194 ToRemove.clear(); 195 // Zero the reference counts. 196 ReferenceCount.assign(HistoryMapEntries.size(), 0); 197 // Index of the DBG_VALUE which marks the start of the current location 198 // range. 199 EntryIndex StartIndex = 0; 200 ArrayRef<InsnRange> ScopeRanges(Scope->getRanges()); 201 for (auto EI = HistoryMapEntries.begin(), EE = HistoryMapEntries.end(); 202 EI != EE; ++EI, ++StartIndex) { 203 // Only DBG_VALUEs can open location ranges so skip anything else. 204 if (!EI->isDbgValue()) 205 continue; 206 207 // Index of the entry which closes this range. 208 EntryIndex EndIndex = EI->getEndIndex(); 209 // If this range is closed bump the reference count of the closing entry. 210 if (EndIndex != NoEntry) 211 ReferenceCount[EndIndex] += 1; 212 // Skip this location range if the opening entry is still referenced. It 213 // may close a location range which intersects a scope range. 214 // TODO: We could be 'smarter' and trim these kinds of ranges such that 215 // they do not leak out of the scope ranges if they partially overlap. 216 if (ReferenceCount[StartIndex] > 0) 217 continue; 218 219 const MachineInstr *StartMI = EI->getInstr(); 220 const MachineInstr *EndMI = EndIndex != NoEntry 221 ? HistoryMapEntries[EndIndex].getInstr() 222 : nullptr; 223 // Check if the location range [StartMI, EndMI] intersects with any scope 224 // range for the variable. 225 if (auto R = intersects(StartMI, EndMI, ScopeRanges, Ordering)) { 226 // Adjust ScopeRanges to exclude ranges which subsequent location ranges 227 // cannot possibly intersect. 228 ScopeRanges = ArrayRef<InsnRange>(R.getValue(), ScopeRanges.end()); 229 } else { 230 // If the location range does not intersect any scope range then the 231 // DBG_VALUE which opened this location range is usless, mark it for 232 // removal. 233 ToRemove.push_back(StartIndex); 234 // Because we'll be removing this entry we need to update the reference 235 // count of the closing entry, if one exists. 236 if (EndIndex != NoEntry) 237 ReferenceCount[EndIndex] -= 1; 238 } 239 } 240 241 // If there is nothing to remove then jump to next variable. 242 if (ToRemove.empty()) 243 continue; 244 245 // Mark clobbers that will no longer close any location ranges for removal. 246 for (size_t i = 0; i < HistoryMapEntries.size(); ++i) 247 if (ReferenceCount[i] <= 0 && HistoryMapEntries[i].isClobber()) 248 ToRemove.push_back(i); 249 250 std::sort(ToRemove.begin(), ToRemove.end()); 251 252 // Build an offset map so we can update the EndIndex of the remaining 253 // entries. 254 // Zero the offsets. 255 Offsets.assign(HistoryMapEntries.size(), 0); 256 size_t CurOffset = 0; 257 auto ToRemoveItr = ToRemove.begin(); 258 for (size_t EntryIdx = *ToRemoveItr; EntryIdx < HistoryMapEntries.size(); 259 ++EntryIdx) { 260 // Check if this is an entry which will be removed. 261 if (ToRemoveItr != ToRemove.end() && *ToRemoveItr == EntryIdx) { 262 ++ToRemoveItr; 263 ++CurOffset; 264 } 265 Offsets[EntryIdx] = CurOffset; 266 } 267 268 // Update the EndIndex of the entries to account for those which will be 269 // removed. 270 for (auto &Entry : HistoryMapEntries) 271 if (Entry.isClosed()) 272 Entry.EndIndex -= Offsets[Entry.EndIndex]; 273 274 // Now actually remove the entries. Iterate backwards so that our remaining 275 // ToRemove indices are valid after each erase. 276 for (auto Itr = ToRemove.rbegin(), End = ToRemove.rend(); Itr != End; ++Itr) 277 HistoryMapEntries.erase(HistoryMapEntries.begin() + *Itr); 278 } 279 } 280 281 void DbgLabelInstrMap::addInstr(InlinedEntity Label, const MachineInstr &MI) { 282 assert(MI.isDebugLabel() && "not a DBG_LABEL"); 283 LabelInstr[Label] = &MI; 284 } 285 286 namespace { 287 288 // Maps physreg numbers to the variables they describe. 289 using InlinedEntity = DbgValueHistoryMap::InlinedEntity; 290 using RegDescribedVarsMap = std::map<unsigned, SmallVector<InlinedEntity, 1>>; 291 292 // Keeps track of the debug value entries that are currently live for each 293 // inlined entity. As the history map entries are stored in a SmallVector, they 294 // may be moved at insertion of new entries, so store indices rather than 295 // pointers. 296 using DbgValueEntriesMap = std::map<InlinedEntity, SmallSet<EntryIndex, 1>>; 297 298 } // end anonymous namespace 299 300 // Claim that @Var is not described by @RegNo anymore. 301 static void dropRegDescribedVar(RegDescribedVarsMap &RegVars, unsigned RegNo, 302 InlinedEntity Var) { 303 const auto &I = RegVars.find(RegNo); 304 assert(RegNo != 0U && I != RegVars.end()); 305 auto &VarSet = I->second; 306 const auto &VarPos = llvm::find(VarSet, Var); 307 assert(VarPos != VarSet.end()); 308 VarSet.erase(VarPos); 309 // Don't keep empty sets in a map to keep it as small as possible. 310 if (VarSet.empty()) 311 RegVars.erase(I); 312 } 313 314 // Claim that @Var is now described by @RegNo. 315 static void addRegDescribedVar(RegDescribedVarsMap &RegVars, unsigned RegNo, 316 InlinedEntity Var) { 317 assert(RegNo != 0U); 318 auto &VarSet = RegVars[RegNo]; 319 assert(!is_contained(VarSet, Var)); 320 VarSet.push_back(Var); 321 } 322 323 /// Create a clobbering entry and end all open debug value entries 324 /// for \p Var that are described by \p RegNo using that entry. 325 static void clobberRegEntries(InlinedEntity Var, unsigned RegNo, 326 const MachineInstr &ClobberingInstr, 327 DbgValueEntriesMap &LiveEntries, 328 DbgValueHistoryMap &HistMap) { 329 EntryIndex ClobberIndex = HistMap.startClobber(Var, ClobberingInstr); 330 331 // Close all entries whose values are described by the register. 332 SmallVector<EntryIndex, 4> IndicesToErase; 333 for (auto Index : LiveEntries[Var]) { 334 auto &Entry = HistMap.getEntry(Var, Index); 335 assert(Entry.isDbgValue() && "Not a DBG_VALUE in LiveEntries"); 336 if (isDescribedByReg(*Entry.getInstr()) == RegNo) { 337 IndicesToErase.push_back(Index); 338 Entry.endEntry(ClobberIndex); 339 } 340 } 341 342 // Drop all entries that have ended. 343 for (auto Index : IndicesToErase) 344 LiveEntries[Var].erase(Index); 345 } 346 347 /// Add a new debug value for \p Var. Closes all overlapping debug values. 348 static void handleNewDebugValue(InlinedEntity Var, const MachineInstr &DV, 349 RegDescribedVarsMap &RegVars, 350 DbgValueEntriesMap &LiveEntries, 351 DbgValueHistoryMap &HistMap) { 352 EntryIndex NewIndex; 353 if (HistMap.startDbgValue(Var, DV, NewIndex)) { 354 SmallDenseMap<unsigned, bool, 4> TrackedRegs; 355 356 // If we have created a new debug value entry, close all preceding 357 // live entries that overlap. 358 SmallVector<EntryIndex, 4> IndicesToErase; 359 const DIExpression *DIExpr = DV.getDebugExpression(); 360 for (auto Index : LiveEntries[Var]) { 361 auto &Entry = HistMap.getEntry(Var, Index); 362 assert(Entry.isDbgValue() && "Not a DBG_VALUE in LiveEntries"); 363 const MachineInstr &DV = *Entry.getInstr(); 364 bool Overlaps = DIExpr->fragmentsOverlap(DV.getDebugExpression()); 365 if (Overlaps) { 366 IndicesToErase.push_back(Index); 367 Entry.endEntry(NewIndex); 368 } 369 if (Register Reg = isDescribedByReg(DV)) 370 TrackedRegs[Reg] |= !Overlaps; 371 } 372 373 // If the new debug value is described by a register, add tracking of 374 // that register if it is not already tracked. 375 if (Register NewReg = isDescribedByReg(DV)) { 376 if (!TrackedRegs.count(NewReg)) 377 addRegDescribedVar(RegVars, NewReg, Var); 378 LiveEntries[Var].insert(NewIndex); 379 TrackedRegs[NewReg] = true; 380 } 381 382 // Drop tracking of registers that are no longer used. 383 for (auto I : TrackedRegs) 384 if (!I.second) 385 dropRegDescribedVar(RegVars, I.first, Var); 386 387 // Drop all entries that have ended, and mark the new entry as live. 388 for (auto Index : IndicesToErase) 389 LiveEntries[Var].erase(Index); 390 LiveEntries[Var].insert(NewIndex); 391 } 392 } 393 394 // Terminate the location range for variables described by register at 395 // @I by inserting @ClobberingInstr to their history. 396 static void clobberRegisterUses(RegDescribedVarsMap &RegVars, 397 RegDescribedVarsMap::iterator I, 398 DbgValueHistoryMap &HistMap, 399 DbgValueEntriesMap &LiveEntries, 400 const MachineInstr &ClobberingInstr) { 401 // Iterate over all variables described by this register and add this 402 // instruction to their history, clobbering it. 403 for (const auto &Var : I->second) 404 clobberRegEntries(Var, I->first, ClobberingInstr, LiveEntries, HistMap); 405 RegVars.erase(I); 406 } 407 408 // Terminate the location range for variables described by register 409 // @RegNo by inserting @ClobberingInstr to their history. 410 static void clobberRegisterUses(RegDescribedVarsMap &RegVars, unsigned RegNo, 411 DbgValueHistoryMap &HistMap, 412 DbgValueEntriesMap &LiveEntries, 413 const MachineInstr &ClobberingInstr) { 414 const auto &I = RegVars.find(RegNo); 415 if (I == RegVars.end()) 416 return; 417 clobberRegisterUses(RegVars, I, HistMap, LiveEntries, ClobberingInstr); 418 } 419 420 void llvm::calculateDbgEntityHistory(const MachineFunction *MF, 421 const TargetRegisterInfo *TRI, 422 DbgValueHistoryMap &DbgValues, 423 DbgLabelInstrMap &DbgLabels) { 424 const TargetLowering *TLI = MF->getSubtarget().getTargetLowering(); 425 unsigned SP = TLI->getStackPointerRegisterToSaveRestore(); 426 Register FrameReg = TRI->getFrameRegister(*MF); 427 RegDescribedVarsMap RegVars; 428 DbgValueEntriesMap LiveEntries; 429 for (const auto &MBB : *MF) { 430 for (const auto &MI : MBB) { 431 if (MI.isDebugValue()) { 432 assert(MI.getNumOperands() > 1 && "Invalid DBG_VALUE instruction!"); 433 // Use the base variable (without any DW_OP_piece expressions) 434 // as index into History. The full variables including the 435 // piece expressions are attached to the MI. 436 const DILocalVariable *RawVar = MI.getDebugVariable(); 437 assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) && 438 "Expected inlined-at fields to agree"); 439 InlinedEntity Var(RawVar, MI.getDebugLoc()->getInlinedAt()); 440 441 handleNewDebugValue(Var, MI, RegVars, LiveEntries, DbgValues); 442 } else if (MI.isDebugLabel()) { 443 assert(MI.getNumOperands() == 1 && "Invalid DBG_LABEL instruction!"); 444 const DILabel *RawLabel = MI.getDebugLabel(); 445 assert(RawLabel->isValidLocationForIntrinsic(MI.getDebugLoc()) && 446 "Expected inlined-at fields to agree"); 447 // When collecting debug information for labels, there is no MCSymbol 448 // generated for it. So, we keep MachineInstr in DbgLabels in order 449 // to query MCSymbol afterward. 450 InlinedEntity L(RawLabel, MI.getDebugLoc()->getInlinedAt()); 451 DbgLabels.addInstr(L, MI); 452 } 453 454 // Meta Instructions have no output and do not change any values and so 455 // can be safely ignored. 456 if (MI.isMetaInstruction()) 457 continue; 458 459 // Not a DBG_VALUE instruction. It may clobber registers which describe 460 // some variables. 461 for (const MachineOperand &MO : MI.operands()) { 462 if (MO.isReg() && MO.isDef() && MO.getReg()) { 463 // Ignore call instructions that claim to clobber SP. The AArch64 464 // backend does this for aggregate function arguments. 465 if (MI.isCall() && MO.getReg() == SP) 466 continue; 467 // If this is a virtual register, only clobber it since it doesn't 468 // have aliases. 469 if (Register::isVirtualRegister(MO.getReg())) 470 clobberRegisterUses(RegVars, MO.getReg(), DbgValues, LiveEntries, 471 MI); 472 // If this is a register def operand, it may end a debug value 473 // range. Ignore frame-register defs in the epilogue and prologue, 474 // we expect debuggers to understand that stack-locations are 475 // invalid outside of the function body. 476 else if (MO.getReg() != FrameReg || 477 (!MI.getFlag(MachineInstr::FrameDestroy) && 478 !MI.getFlag(MachineInstr::FrameSetup))) { 479 for (MCRegAliasIterator AI(MO.getReg(), TRI, true); AI.isValid(); 480 ++AI) 481 clobberRegisterUses(RegVars, *AI, DbgValues, LiveEntries, MI); 482 } 483 } else if (MO.isRegMask()) { 484 // If this is a register mask operand, clobber all debug values in 485 // non-CSRs. 486 SmallVector<unsigned, 32> RegsToClobber; 487 // Don't consider SP to be clobbered by register masks. 488 for (auto It : RegVars) { 489 unsigned int Reg = It.first; 490 if (Reg != SP && Register::isPhysicalRegister(Reg) && 491 MO.clobbersPhysReg(Reg)) 492 RegsToClobber.push_back(Reg); 493 } 494 495 for (unsigned Reg : RegsToClobber) { 496 clobberRegisterUses(RegVars, Reg, DbgValues, LiveEntries, MI); 497 } 498 } 499 } // End MO loop. 500 } // End instr loop. 501 502 // Make sure locations for all variables are valid only until the end of 503 // the basic block (unless it's the last basic block, in which case let 504 // their liveness run off to the end of the function). 505 if (!MBB.empty() && &MBB != &MF->back()) { 506 // Iterate over all variables that have open debug values. 507 for (auto &Pair : LiveEntries) { 508 if (Pair.second.empty()) 509 continue; 510 511 // Create a clobbering entry. 512 EntryIndex ClobIdx = DbgValues.startClobber(Pair.first, MBB.back()); 513 514 // End all entries. 515 for (EntryIndex Idx : Pair.second) { 516 DbgValueHistoryMap::Entry &Ent = DbgValues.getEntry(Pair.first, Idx); 517 assert(Ent.isDbgValue() && !Ent.isClosed()); 518 Ent.endEntry(ClobIdx); 519 } 520 } 521 522 LiveEntries.clear(); 523 RegVars.clear(); 524 } 525 } 526 } 527 528 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 529 LLVM_DUMP_METHOD void DbgValueHistoryMap::dump() const { 530 dbgs() << "DbgValueHistoryMap:\n"; 531 for (const auto &VarRangePair : *this) { 532 const InlinedEntity &Var = VarRangePair.first; 533 const Entries &Entries = VarRangePair.second; 534 535 const DILocalVariable *LocalVar = cast<DILocalVariable>(Var.first); 536 const DILocation *Location = Var.second; 537 538 dbgs() << " - " << LocalVar->getName() << " at "; 539 540 if (Location) 541 dbgs() << Location->getFilename() << ":" << Location->getLine() << ":" 542 << Location->getColumn(); 543 else 544 dbgs() << "<unknown location>"; 545 546 dbgs() << " --\n"; 547 548 for (const auto &E : enumerate(Entries)) { 549 const auto &Entry = E.value(); 550 dbgs() << " Entry[" << E.index() << "]: "; 551 if (Entry.isDbgValue()) 552 dbgs() << "Debug value\n"; 553 else 554 dbgs() << "Clobber\n"; 555 dbgs() << " Instr: " << *Entry.getInstr(); 556 if (Entry.isDbgValue()) { 557 if (Entry.getEndIndex() == NoEntry) 558 dbgs() << " - Valid until end of function\n"; 559 else 560 dbgs() << " - Closed by Entry[" << Entry.getEndIndex() << "]\n"; 561 } 562 dbgs() << "\n"; 563 } 564 } 565 } 566 #endif 567