LLVM  14.0.0git
MCCodeEmitter.h
Go to the documentation of this file.
1 //===- llvm/MC/MCCodeEmitter.h - Instruction Encoding -----------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_MC_MCCODEEMITTER_H
10 #define LLVM_MC_MCCODEEMITTER_H
11 
12 namespace llvm {
13 
14 class MCFixup;
15 class MCInst;
16 class MCSubtargetInfo;
17 class raw_ostream;
18 template<typename T> class SmallVectorImpl;
19 
20 /// MCCodeEmitter - Generic instruction encoding interface.
22 protected: // Can only create subclasses.
23  MCCodeEmitter();
24 
25 public:
26  MCCodeEmitter(const MCCodeEmitter &) = delete;
27  MCCodeEmitter &operator=(const MCCodeEmitter &) = delete;
28  virtual ~MCCodeEmitter();
29 
30  /// Lifetime management
31  virtual void reset() {}
32 
33  /// Emit the prefixes of given instruction on the output stream.
34  ///
35  /// \param Inst a single low-level machine instruction.
36  /// \param OS output stream.
37  virtual void emitPrefix(const MCInst &Inst, raw_ostream &OS,
38  const MCSubtargetInfo &STI) const {}
39  /// EncodeInstruction - Encode the given \p Inst to bytes on the output
40  /// stream \p OS.
41  virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS,
43  const MCSubtargetInfo &STI) const = 0;
44 };
45 
46 } // end namespace llvm
47 
48 #endif // LLVM_MC_MCCODEEMITTER_H
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MCCodeEmitter::MCCodeEmitter
MCCodeEmitter()
llvm::MCCodeEmitter::emitPrefix
virtual void emitPrefix(const MCInst &Inst, raw_ostream &OS, const MCSubtargetInfo &STI) const
Emit the prefixes of given instruction on the output stream.
Definition: MCCodeEmitter.h:37
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::AArch64::Fixups
Fixups
Definition: AArch64FixupKinds.h:17
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::MCCodeEmitter::~MCCodeEmitter
virtual ~MCCodeEmitter()
llvm::MCCodeEmitter::operator=
MCCodeEmitter & operator=(const MCCodeEmitter &)=delete
llvm::MCCodeEmitter::reset
virtual void reset()
Lifetime management.
Definition: MCCodeEmitter.h:31
llvm::MCCodeEmitter
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:21
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::MCCodeEmitter::encodeInstruction
virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.