diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-04-28 22:27:46 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-04-28 22:27:46 +0000 |
commit | fee0ee24c8b2488be0d7c34e33fca4ddf385b18a (patch) | |
tree | db90fca9c155bf76282dad74e5eab20bafed8c59 | |
parent | d67ffe8b7377ed8e39ef2be4ab088ec28159fb9e (diff) | |
download | bcm5719-llvm-fee0ee24c8b2488be0d7c34e33fca4ddf385b18a.tar.gz bcm5719-llvm-fee0ee24c8b2488be0d7c34e33fca4ddf385b18a.zip |
[DWARF parser] Simplify DWARFDebugAranges generation.
There is no need to keep the whole contents of .debug_aranges section
in memory when we build address ranges table. Memory optimization that
used to be in this code (precalculate the size of vector of ranges before
filling it) is not really needed - later we will compact and resize this
vector anyway.
llvm-svn: 207457
-rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugArangeSet.h | 1 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/DWARFDebugAranges.cpp | 21 |
2 files changed, 2 insertions, 20 deletions
diff --git a/llvm/lib/DebugInfo/DWARFDebugArangeSet.h b/llvm/lib/DebugInfo/DWARFDebugArangeSet.h index c18b3c5e504..d6c2d8b27c5 100644 --- a/llvm/lib/DebugInfo/DWARFDebugArangeSet.h +++ b/llvm/lib/DebugInfo/DWARFDebugArangeSet.h @@ -63,7 +63,6 @@ public: return desc_iterator_range(ArangeDescriptors.begin(), ArangeDescriptors.end()); } - uint32_t getNumDescriptors() const { return ArangeDescriptors.size(); } }; } diff --git a/llvm/lib/DebugInfo/DWARFDebugAranges.cpp b/llvm/lib/DebugInfo/DWARFDebugAranges.cpp index 4d7bf306f6c..2524adc25c1 100644 --- a/llvm/lib/DebugInfo/DWARFDebugAranges.cpp +++ b/llvm/lib/DebugInfo/DWARFDebugAranges.cpp @@ -21,23 +21,11 @@ void DWARFDebugAranges::extract(DataExtractor DebugArangesData) { if (!DebugArangesData.isValidOffset(0)) return; uint32_t Offset = 0; - typedef std::vector<DWARFDebugArangeSet> RangeSetColl; - RangeSetColl Sets; DWARFDebugArangeSet Set; - uint32_t TotalRanges = 0; while (Set.extract(DebugArangesData, &Offset)) { - Sets.push_back(Set); - TotalRanges += Set.getNumDescriptors(); - } - if (TotalRanges == 0) - return; - - Aranges.reserve(TotalRanges); - for (const auto &I : Sets) { - uint32_t CUOffset = I.getCompileUnitDIEOffset(); - - for (const auto &Desc : I.descriptors()) { + uint32_t CUOffset = Set.getCompileUnitDIEOffset(); + for (const auto &Desc : Set.descriptors()) { uint64_t LowPC = Desc.Address; uint64_t HighPC = Desc.getEndAddress(); appendRange(CUOffset, LowPC, HighPC); @@ -112,11 +100,6 @@ void DWARFDebugAranges::sortAndMinimize() { ++minimal_size; } - // If the sizes are the same, then no consecutive aranges can be - // combined, we are done. - if (minimal_size == orig_arange_size) - return; - // Else, make a new RangeColl that _only_ contains what we need. RangeColl minimal_aranges; minimal_aranges.resize(minimal_size); |