Skip to content

Commit

Permalink
[MC] Remove the legacy overload of encodeInstruction
Browse files Browse the repository at this point in the history
https://reviews.llvm.org/D145791 added a new overload of encodeInstruction.
All in-tree targets have been migrated to use the new overload.
  • Loading branch information
MaskRay committed Aug 9, 2023
1 parent 7e39e2e commit e893407
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
11 changes: 2 additions & 9 deletions llvm/include/llvm/MC/MCCodeEmitter.h
Expand Up @@ -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;
Expand All @@ -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 {}

This comment has been minimized.

Copy link
@s-barannikov

s-barannikov Aug 10, 2023

Contributor

Should it be pure virtual? The old one was (before D145791).

This comment has been minimized.

Copy link
@MaskRay

MaskRay Aug 11, 2023

Author Member

Thanks for catching this. I'll update it.

};

} // end namespace llvm
Expand Down
9 changes: 0 additions & 9 deletions llvm/lib/MC/MCCodeEmitter.cpp
Expand Up @@ -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);
}

0 comments on commit e893407

Please sign in to comment.