[llvm] r304804 - [WebAssembly] Remove unused methods from MCWasmObjectTargetWriter

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 09:39:00 PDT 2017


Author: sbc
Date: Tue Jun  6 11:38:59 2017
New Revision: 304804

URL: http://llvm.org/viewvc/llvm-project?rev=304804&view=rev
Log:
[WebAssembly] Remove unused methods from MCWasmObjectTargetWriter

These methods looks like they were originally came from
MCELFObjectTargetWriter but they are never called by the
WasmObjectWriter.

Remove these methods meant the declaration of WasmRelocationEntry
could also move into the cpp file.

Differential Revision: https://reviews.llvm.org/D33905

Modified:
    llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h
    llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp
    llvm/trunk/lib/MC/WasmObjectWriter.cpp

Modified: llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h?rev=304804&r1=304803&r2=304804&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h Tue Jun  6 11:38:59 2017
@@ -28,27 +28,6 @@ class MCSymbolWasm;
 class MCValue;
 class raw_pwrite_stream;
 
-// Information about a single relocation.
-struct WasmRelocationEntry {
-  uint64_t Offset;            // Where is the relocation.
-  const MCSymbolWasm *Symbol; // The symbol to relocate with.
-  int64_t Addend;             // A value to add to the symbol.
-  unsigned Type;              // The type of the relocation.
-  MCSectionWasm *FixupSection;// The section the relocation is targeting.
-
-  WasmRelocationEntry(uint64_t Offset, const MCSymbolWasm *Symbol,
-                      int64_t Addend, unsigned Type,
-                      MCSectionWasm *FixupSection)
-      : Offset(Offset), Symbol(Symbol), Addend(Addend), Type(Type),
-        FixupSection(FixupSection) {}
-
-  void print(raw_ostream &Out) const {
-    Out << "Off=" << Offset << ", Sym=" << Symbol << ", Addend=" << Addend
-        << ", Type=" << Type << ", FixupSection=" << FixupSection;
-  }
-  void dump() const { print(errs()); }
-};
-
 class MCWasmObjectTargetWriter {
   const unsigned Is64Bit : 1;
 
@@ -56,17 +35,11 @@ protected:
   explicit MCWasmObjectTargetWriter(bool Is64Bit_);
 
 public:
-  virtual ~MCWasmObjectTargetWriter() {}
+  virtual ~MCWasmObjectTargetWriter();
 
   virtual unsigned getRelocType(MCContext &Ctx, const MCValue &Target,
                                 const MCFixup &Fixup, bool IsPCRel) const = 0;
 
-  virtual bool needsRelocateWithSymbol(const MCSymbol &Sym,
-                                       unsigned Type) const;
-
-  virtual void sortRelocs(const MCAssembler &Asm,
-                          std::vector<WasmRelocationEntry> &Relocs);
-
   /// \name Accessors
   /// @{
   bool is64Bit() const { return Is64Bit; }

Modified: llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp?rev=304804&r1=304803&r2=304804&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp (original)
+++ llvm/trunk/lib/MC/MCWasmObjectTargetWriter.cpp Tue Jun  6 11:38:59 2017
@@ -17,11 +17,5 @@ using namespace llvm;
 MCWasmObjectTargetWriter::MCWasmObjectTargetWriter(bool Is64Bit_)
     : Is64Bit(Is64Bit_) {}
 
-bool MCWasmObjectTargetWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
-                                                       unsigned Type) const {
-  return false;
-}
-
-void MCWasmObjectTargetWriter::sortRelocs(
-    const MCAssembler &Asm, std::vector<WasmRelocationEntry> &Relocs) {
-}
+// Pin the vtable to this object file
+MCWasmObjectTargetWriter::~MCWasmObjectTargetWriter() = default;

Modified: llvm/trunk/lib/MC/WasmObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WasmObjectWriter.cpp?rev=304804&r1=304803&r2=304804&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp Tue Jun  6 11:38:59 2017
@@ -127,6 +127,27 @@ struct WasmGlobal {
   uint32_t ImportIndex;
 };
 
+// Information about a single relocation.
+struct WasmRelocationEntry {
+  uint64_t Offset;            // Where is the relocation.
+  const MCSymbolWasm *Symbol; // The symbol to relocate with.
+  int64_t Addend;             // A value to add to the symbol.
+  unsigned Type;              // The type of the relocation.
+  MCSectionWasm *FixupSection;// The section the relocation is targeting.
+
+  WasmRelocationEntry(uint64_t Offset, const MCSymbolWasm *Symbol,
+                      int64_t Addend, unsigned Type,
+                      MCSectionWasm *FixupSection)
+      : Offset(Offset), Symbol(Symbol), Addend(Addend), Type(Type),
+        FixupSection(FixupSection) {}
+
+  void print(raw_ostream &Out) const {
+    Out << "Off=" << Offset << ", Sym=" << Symbol << ", Addend=" << Addend
+        << ", Type=" << Type << ", FixupSection=" << FixupSection;
+  }
+  void dump() const { print(errs()); }
+};
+
 class WasmObjectWriter : public MCObjectWriter {
   /// Helper struct for containing some precomputed information on symbols.
   struct WasmSymbolData {




More information about the llvm-commits mailing list