[PATCH] D33551: [ELF] - Simplify implementation of constant pool when building .gdb_index

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 05:01:55 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL303973: [ELF] - Simplify implementation of constant pool when building .gdb_index (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D33551?vs=100257&id=100386#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33551

Files:
  lld/trunk/ELF/SyntheticSections.cpp
  lld/trunk/ELF/SyntheticSections.h


Index: lld/trunk/ELF/SyntheticSections.h
===================================================================
--- lld/trunk/ELF/SyntheticSections.h
+++ lld/trunk/ELF/SyntheticSections.h
@@ -515,7 +515,7 @@
   GdbHashTab SymbolTable;
 
   // The CU vector portion of the constant pool.
-  std::vector<std::vector<std::pair<uint32_t, uint8_t>>> CuVectors;
+  std::vector<std::vector<uint32_t>> CuVectors;
 
   std::vector<AddressEntry> AddressArea;
 
Index: lld/trunk/ELF/SyntheticSections.cpp
===================================================================
--- lld/trunk/ELF/SyntheticSections.cpp
+++ lld/trunk/ELF/SyntheticSections.cpp
@@ -1778,11 +1778,11 @@
     std::tie(IsNew, Sym) = SymbolTable.add(Hash, Offset);
     if (IsNew) {
       Sym->CuVectorIndex = CuVectors.size();
-      CuVectors.push_back({{CuId, Pair.second}});
-      continue;
+      CuVectors.push_back({});
     }
 
-    CuVectors[Sym->CuVectorIndex].push_back({CuId, Pair.second});
+    CuVectors[Sym->CuVectorIndex].push_back((Pair.second << 24) |
+                                            (uint32_t)CuId);
   }
 }
 
@@ -1806,7 +1806,7 @@
   ConstantPoolOffset =
       SymTabOffset + SymbolTable.getCapacity() * SymTabEntrySize;
 
-  for (std::vector<std::pair<uint32_t, uint8_t>> &CuVec : CuVectors) {
+  for (std::vector<uint32_t> &CuVec : CuVectors) {
     CuVectorsOffset.push_back(CuVectorsSize);
     CuVectorsSize += OffsetTypeSize * (CuVec.size() + 1);
   }
@@ -1859,14 +1859,11 @@
   }
 
   // Write the CU vectors into the constant pool.
-  for (std::vector<std::pair<uint32_t, uint8_t>> &CuVec : CuVectors) {
+  for (std::vector<uint32_t> &CuVec : CuVectors) {
     write32le(Buf, CuVec.size());
     Buf += 4;
-    for (std::pair<uint32_t, uint8_t> &P : CuVec) {
-      uint32_t Index = P.first;
-      uint8_t Flags = P.second;
-      Index |= Flags << 24;
-      write32le(Buf, Index);
+    for (uint32_t Val : CuVec) {
+      write32le(Buf, Val);
       Buf += 4;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33551.100386.patch
Type: text/x-patch
Size: 1976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/dee69813/attachment.bin>


More information about the llvm-commits mailing list