[llvm] r207457 - [DWARF parser] Simplify DWARFDebugAranges generation.

Alexey Samsonov samsonov at google.com
Mon Apr 28 15:27:46 PDT 2014


Author: samsonov
Date: Mon Apr 28 17:27:46 2014
New Revision: 207457

URL: http://llvm.org/viewvc/llvm-project?rev=207457&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/DebugInfo/DWARFDebugArangeSet.h
    llvm/trunk/lib/DebugInfo/DWARFDebugAranges.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARFDebugArangeSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugArangeSet.h?rev=207457&r1=207456&r2=207457&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFDebugArangeSet.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARFDebugArangeSet.h Mon Apr 28 17:27:46 2014
@@ -63,7 +63,6 @@ public:
     return desc_iterator_range(ArangeDescriptors.begin(),
                                ArangeDescriptors.end());
   }
-  uint32_t getNumDescriptors() const { return ArangeDescriptors.size(); }
 };
 
 }

Modified: llvm/trunk/lib/DebugInfo/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFDebugAranges.cpp?rev=207457&r1=207456&r2=207457&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFDebugAranges.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFDebugAranges.cpp Mon Apr 28 17:27:46 2014
@@ -21,23 +21,11 @@ void DWARFDebugAranges::extract(DataExtr
   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);





More information about the llvm-commits mailing list