LLVM 22.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
13
14namespace llvm {
15
16class MCFixup;
17class MCInst;
18class MCSubtargetInfo;
19class raw_ostream;
20template<typename T> class SmallVectorImpl;
21
22/// MCCodeEmitter - Generic instruction encoding interface.
24protected: // Can only create subclasses.
26
27public:
28 MCCodeEmitter(const MCCodeEmitter &) = delete;
30 virtual ~MCCodeEmitter();
31
32 /// Lifetime management
33 virtual void reset() {}
34
35 /// Encode the given \p Inst to bytes and append to \p CB.
36 virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl<char> &CB,
38 const MCSubtargetInfo &STI) const = 0;
39};
40
41} // end namespace llvm
42
43#endif // LLVM_MC_MCCODEEMITTER_H
#define LLVM_ABI
Definition Compiler.h:213
virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
Encode the given Inst to bytes and append to CB.
virtual void reset()
Lifetime management.
MCCodeEmitter & operator=(const MCCodeEmitter &)=delete
virtual ~MCCodeEmitter()
MCCodeEmitter(const MCCodeEmitter &)=delete
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition MCFixup.h:61
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Generic base class for all target subtargets.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.