llvm.org GIT mirror llvm / ab9a477
NFC: DebugInfo: Track the origin CU rather than just the base address for range lists Turns out knowing more than just the base address might be useful - specifically a future change to respect a DICompileUnit flag for the use of base address specifiers in DWARF < 5. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346380 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 10 months ago
4 changed file(s) with 11 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
429429 // Add the range list to the set of ranges to be emitted.
430430 auto IndexAndList =
431431 (DD->getDwarfVersion() < 5 && Skeleton ? Skeleton->DU : DU)
432 ->addRange((Skeleton ? Skeleton->BaseAddress : BaseAddress),
433 std::move(Range));
432 ->addRange(*(Skeleton ? Skeleton : this), std::move(Range));
434433
435434 uint32_t Index = IndexAndList.first;
436435 auto &List = *IndexAndList.second;
22742274 for (const RangeSpan &Range : List.getRanges())
22752275 SectionRanges[&Range.getStart()->getSection()].push_back(&Range);
22762276
2277 const MCSymbol *CUBase = List.getBaseAddress();
2277 const DwarfCompileUnit &CU = List.getCU();
2278 const MCSymbol *CUBase = CU.getBaseAddress();
22782279 bool BaseIsSet = false;
22792280 for (const auto &P : SectionRanges) {
22802281 // Don't bother with a base address entry if there's only one range in
110110 }
111111
112112 std::pair
113 DwarfFile::addRange(const MCSymbol *&CUBaseAddress,
114 SmallVector R) {
115 CURangeLists.push_back(RangeSpanList(Asm->createTempSymbol("debug_ranges"),
116 CUBaseAddress, std::move(R)));
113 DwarfFile::addRange(const DwarfCompileUnit &CU, SmallVector R) {
114 CURangeLists.push_back(
115 RangeSpanList(Asm->createTempSymbol("debug_ranges"), CU, std::move(R)));
117116 return std::make_pair(CURangeLists.size() - 1, &CURangeLists.back());
118117 }
4747 private:
4848 // Index for locating within the debug_range section this particular span.
4949 MCSymbol *RangeSym;
50 const MCSymbol **CUBaseAddress;
50 const DwarfCompileUnit *CU;
5151 // List of ranges.
5252 SmallVector Ranges;
5353
5454 public:
55 RangeSpanList(MCSymbol *Sym, const MCSymbol *&CUBaseAddress,
55 RangeSpanList(MCSymbol *Sym, const DwarfCompileUnit &CU,
5656 SmallVector Ranges)
57 : RangeSym(Sym), CUBaseAddress(&CUBaseAddress),
58 Ranges(std::move(Ranges)) {}
57 : RangeSym(Sym), CU(&CU), Ranges(std::move(Ranges)) {}
5958 MCSymbol *getSym() const { return RangeSym; }
60 const MCSymbol *&getBaseAddress() const { return *CUBaseAddress; }
59 const DwarfCompileUnit &getCU() const { return *CU; }
6160 const SmallVectorImpl &getRanges() const { return Ranges; }
6261 void addRange(RangeSpan Range) { Ranges.push_back(Range); }
6362 };
122121 return CUs;
123122 }
124123
125 std::pair addRange(const MCSymbol *&CUBaseAddress,
124 std::pair addRange(const DwarfCompileUnit &CU,
126125 SmallVector R);
127126
128127 /// getRangeLists - Get the vector of range lists.