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

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 20:25:39 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323846: [WebAssembly] Remove some unused code and tidy logging. NFC. (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42540?vs=131456&id=132096#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42540

Files:
  llvm/trunk/lib/MC/WasmObjectWriter.cpp


Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp
+++ llvm/trunk/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;
 
@@ -1122,6 +1113,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();
@@ -1136,8 +1128,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});
     }
   }
 
@@ -1150,8 +1141,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()
@@ -1293,7 +1285,8 @@
         case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB: {
           uint32_t Index = SymbolIndices.find(&WS)->second;
           IndirectSymbolIndices[&WS] = TableElems.size() + kInitialTableOffset;
-          DEBUG(dbgs() << "  -> adding to table: " << TableElems.size() << "\n");
+          DEBUG(dbgs() << "  -> adding " << WS.getName()
+                       << " to table: " << TableElems.size() << "\n");
           TableElems.push_back(Index);
           registerFunctionType(WS);
           break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42540.132096.patch
Type: text/x-patch
Size: 2447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180131/43aa071c/attachment.bin>


More information about the llvm-commits mailing list