[llvm] e893407 - [MC] Remove the legacy overload of encodeInstruction

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 15:27:10 PDT 2023


Author: Fangrui Song
Date: 2023-08-09T15:27:06-07:00
New Revision: e8934075b90a38f9dd3361472e696f11e50a8aa4

URL: https://github.com/llvm/llvm-project/commit/e8934075b90a38f9dd3361472e696f11e50a8aa4
DIFF: https://github.com/llvm/llvm-project/commit/e8934075b90a38f9dd3361472e696f11e50a8aa4.diff

LOG: [MC] Remove the legacy overload of encodeInstruction

https://reviews.llvm.org/D145791 added a new overload of encodeInstruction.
All in-tree targets have been migrated to use the new overload.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCCodeEmitter.h
    llvm/lib/MC/MCCodeEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCCodeEmitter.h b/llvm/include/llvm/MC/MCCodeEmitter.h
index a86b98c145fc84..0df7e8586d73ea 100644
--- a/llvm/include/llvm/MC/MCCodeEmitter.h
+++ b/llvm/include/llvm/MC/MCCodeEmitter.h
@@ -22,13 +22,6 @@ class MCCodeEmitter {
 protected: // Can only create subclasses.
   MCCodeEmitter();
 
-  /// EncodeInstruction - Encode the given \p Inst to bytes on the output stream
-  /// \p OS. Allows for an implementation of encodeInstruction that uses streams
-  /// instead of a SmallVector.
-  virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS,
-                                 SmallVectorImpl<MCFixup> &Fixups,
-                                 const MCSubtargetInfo &STI) const {}
-
 public:
   MCCodeEmitter(const MCCodeEmitter &) = delete;
   MCCodeEmitter &operator=(const MCCodeEmitter &) = delete;
@@ -43,10 +36,10 @@ class MCCodeEmitter {
   /// \param CB code buffer
   virtual void emitPrefix(const MCInst &Inst, SmallVectorImpl<char> &CB,
                           const MCSubtargetInfo &STI) const {}
-  /// EncodeInstruction - Encode the given \p Inst to bytes and append to \p CB.
+  /// Encode the given \p Inst to bytes and append to \p CB.
   virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl<char> &CB,
                                  SmallVectorImpl<MCFixup> &Fixups,
-                                 const MCSubtargetInfo &STI) const;
+                                 const MCSubtargetInfo &STI) const {}
 };
 
 } // end namespace llvm

diff  --git a/llvm/lib/MC/MCCodeEmitter.cpp b/llvm/lib/MC/MCCodeEmitter.cpp
index afbe31e0070c91..0d114f12d58c53 100644
--- a/llvm/lib/MC/MCCodeEmitter.cpp
+++ b/llvm/lib/MC/MCCodeEmitter.cpp
@@ -7,18 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/MC/MCCodeEmitter.h"
-#include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
 
 MCCodeEmitter::MCCodeEmitter() = default;
 
 MCCodeEmitter::~MCCodeEmitter() = default;
-
-void MCCodeEmitter::encodeInstruction(const MCInst &Inst,
-                                      SmallVectorImpl<char> &CB,
-                                      SmallVectorImpl<MCFixup> &Fixups,
-                                      const MCSubtargetInfo &STI) const {
-  raw_svector_ostream OS(CB);
-  encodeInstruction(Inst, OS, Fixups, STI);
-}


        


More information about the llvm-commits mailing list