1 //===- llvm/MC/MCCodeEmitter.h - Instruction Encoding -----------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_MC_MCCODEEMITTER_H
10 #define LLVM_MC_MCCODEEMITTER_H
16 class MCSubtargetInfo
;
18 template<typename T
> class SmallVectorImpl
;
20 /// MCCodeEmitter - Generic instruction encoding interface.
22 protected: // Can only create subclasses.
26 MCCodeEmitter(const MCCodeEmitter
&) = delete;
27 MCCodeEmitter
&operator=(const MCCodeEmitter
&) = delete;
28 virtual ~MCCodeEmitter();
30 /// Lifetime management
31 virtual void reset() {}
33 /// EncodeInstruction - Encode the given \p Inst to bytes on the output
35 virtual void encodeInstruction(const MCInst
&Inst
, raw_ostream
&OS
,
36 SmallVectorImpl
<MCFixup
> &Fixups
,
37 const MCSubtargetInfo
&STI
) const = 0;
40 } // end namespace llvm
42 #endif // LLVM_MC_MCCODEEMITTER_H