[PATCH] D42540: [WebAssembly] Remove some unused code and tidy logging. NFC.

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 07:58:57 PST 2018


ncw created this revision.
ncw added a reviewer: sbc100.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.

A few bits split out of https://reviews.llvm.org/D41954, to go in before


Repository:
  rL LLVM

https://reviews.llvm.org/D42540

Files:
  lib/MC/WasmObjectWriter.cpp


Index: lib/MC/WasmObjectWriter.cpp
===================================================================
--- lib/MC/WasmObjectWriter.cpp
+++ lib/MC/WasmObjectWriter.cpp
@@ -194,15 +194,6 @@
 #endif
 
 class WasmObjectWriter : public MCObjectWriter {
-  /// Helper struct for containing some precomputed information on symbols.
-  struct WasmSymbolData {
-    const MCSymbolWasm *Symbol;
-    StringRef Name;
-
-    // Support lexicographic sorting.
-    bool operator<(const WasmSymbolData &RHS) const { return Name < RHS.Name; }
-  };
-
   /// The target specific Wasm writer instance.
   std::unique_ptr<MCWasmObjectTargetWriter> TargetObjectWriter;
 
@@ -1121,6 +1112,7 @@
     if (cast<MCSectionWasm>(Sec).getSectionName().startswith(".init_array"))
       continue;
 
+    uint32_t SegmentIndex = DataSegments.size();
     DataSize = alignTo(DataSize, Section.getAlignment());
     DataSegments.emplace_back();
     WasmDataSegment &Segment = DataSegments.back();
@@ -1135,8 +1127,7 @@
 
     if (const MCSymbolWasm *C = Section.getGroup()) {
       Comdats[C->getName()].emplace_back(
-          WasmComdatEntry{wasm::WASM_COMDAT_DATA,
-                          static_cast<uint32_t>(DataSegments.size()) - 1});
+          WasmComdatEntry{wasm::WASM_COMDAT_DATA, SegmentIndex});
     }
   }
 
@@ -1149,8 +1140,9 @@
 
     const auto &WS = static_cast<const MCSymbolWasm &>(S);
     DEBUG(dbgs() << "MCSymbol: '" << S << "'"
-                 << " isDefined=" << S.isDefined() << " isExternal="
-                 << S.isExternal() << " isTemporary=" << S.isTemporary()
+                 << " isDefined=" << S.isDefined()
+                 << " isExternal=" << S.isExternal()
+                 << " isTemporary=" << S.isTemporary()
                  << " isFunction=" << WS.isFunction()
                  << " isWeak=" << WS.isWeak()
                  << " isHidden=" << WS.isHidden()
@@ -1292,7 +1284,8 @@
       uint32_t SymbolIndex = SymbolIndices[WS];
       uint32_t TableIndex = TableElems.size() + kInitialTableOffset;
       if (TableIndices.try_emplace(WS, TableIndex).second) {
-        DEBUG(dbgs() << "  -> adding to table: " << TableElems.size() << "\n");
+        DEBUG(dbgs() << "  -> adding " << WS->getName() << " to table: " <<
+              TableElems.size() << "\n");
         TableElems.push_back(SymbolIndex);
       }
     };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42540.131456.patch
Type: text/x-patch
Size: 2353 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180125/8dba961d/attachment.bin>


More information about the llvm-commits mailing list