[llvm] r303163 - [DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRangesVector.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue May 16 05:30:59 PDT 2017
Author: grimar
Date: Tue May 16 07:30:59 2017
New Revision: 303163
URL: http://llvm.org/viewvc/llvm-project?rev=303163&view=rev
Log:
[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRangesVector.
Recommit of r303159 "[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRangesVector"
All places were shitched to use DWARFAddressRange now.
Suggested during review of D33184.
Modified:
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h?rev=303163&r1=303162&r2=303163&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h Tue May 16 07:30:59 2017
@@ -22,8 +22,13 @@ namespace llvm {
class raw_ostream;
+struct DWARFAddressRange {
+ uint64_t LowPC;
+ uint64_t HighPC;
+};
+
/// DWARFAddressRangesVector - represents a set of absolute address ranges.
-typedef std::vector<std::pair<uint64_t, uint64_t>> DWARFAddressRangesVector;
+typedef std::vector<DWARFAddressRange> DWARFAddressRangesVector;
class DWARFDebugRangeList {
public:
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp?rev=303163&r1=303162&r2=303163&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp Tue May 16 07:30:59 2017
@@ -54,9 +54,8 @@ void DWARFDebugAranges::generate(DWARFCo
if (ParsedCUOffsets.insert(CUOffset).second) {
DWARFAddressRangesVector CURanges;
CU->collectAddressRanges(CURanges);
- for (const auto &R : CURanges) {
- appendRange(CUOffset, R.first, R.second);
- }
+ for (const auto &R : CURanges)
+ appendRange(CUOffset, R.LowPC, R.HighPC);
}
}
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp?rev=303163&r1=303162&r2=303163&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp Tue May 16 07:30:59 2017
@@ -69,8 +69,8 @@ DWARFDebugRangeList::getAbsoluteRanges(u
if (RLE.isBaseAddressSelectionEntry(AddressSize)) {
BaseAddress = RLE.EndAddress;
} else {
- Res.push_back(std::make_pair(BaseAddress + RLE.StartAddress,
- BaseAddress + RLE.EndAddress));
+ Res.push_back(
+ {BaseAddress + RLE.StartAddress, BaseAddress + RLE.EndAddress});
}
}
return Res;
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=303163&r1=303162&r2=303163&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp Tue May 16 07:30:59 2017
@@ -60,8 +60,8 @@ static void dumpRanges(raw_ostream &OS,
OS << '\n';
OS.indent(Indent);
OS << format("[0x%0*" PRIx64 " - 0x%0*" PRIx64 ")",
- AddressSize*2, Range.first,
- AddressSize*2, Range.second);
+ AddressSize*2, Range.LowPC,
+ AddressSize*2, Range.HighPC);
}
}
@@ -229,9 +229,9 @@ DWARFDie::getAddressRanges() const {
return DWARFAddressRangesVector();
// Single range specified by low/high PC.
uint64_t LowPC, HighPC;
- if (getLowAndHighPC(LowPC, HighPC)) {
- return DWARFAddressRangesVector(1, std::make_pair(LowPC, HighPC));
- }
+ if (getLowAndHighPC(LowPC, HighPC))
+ return {{LowPC, HighPC}};
+
// Multiple ranges from .debug_ranges section.
auto RangesOffset = toSectionOffset(find(DW_AT_ranges));
if (RangesOffset) {
@@ -257,7 +257,7 @@ DWARFDie::collectChildrenAddressRanges(D
bool DWARFDie::addressRangeContainsAddress(const uint64_t Address) const {
for (const auto& R : getAddressRanges()) {
- if (R.first <= Address && Address < R.second)
+ if (R.LowPC <= Address && Address < R.HighPC)
return true;
}
return false;
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp?rev=303163&r1=303162&r2=303163&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFUnit.cpp Tue May 16 07:30:59 2017
@@ -349,18 +349,18 @@ void DWARFUnit::updateAddressDieMap(DWAR
if (Die.isSubroutineDIE()) {
for (const auto &R : Die.getAddressRanges()) {
// Ignore 0-sized ranges.
- if (R.first == R.second)
+ if (R.LowPC == R.HighPC)
continue;
- auto B = AddrDieMap.upper_bound(R.first);
- if (B != AddrDieMap.begin() && R.first < (--B)->second.first) {
+ auto B = AddrDieMap.upper_bound(R.LowPC);
+ if (B != AddrDieMap.begin() && R.LowPC < (--B)->second.first) {
// The range is a sub-range of existing ranges, we need to split the
// existing range.
- if (R.second < B->second.first)
- AddrDieMap[R.second] = B->second;
- if (R.first > B->first)
- AddrDieMap[B->first].first = R.first;
+ if (R.HighPC < B->second.first)
+ AddrDieMap[R.HighPC] = B->second;
+ if (R.LowPC > B->first)
+ AddrDieMap[B->first].first = R.LowPC;
}
- AddrDieMap[R.first] = std::make_pair(R.second, Die);
+ AddrDieMap[R.LowPC] = std::make_pair(R.HighPC, Die);
}
}
// Parent DIEs are added to the AddrDieMap prior to the Children DIEs to
More information about the llvm-commits
mailing list