xref: /trueos/contrib/llvm/include/llvm/MC/MCCodeEmitter.h (revision 4ca88b0ec14ea4e16311cb82d46526b1a4734c5a)
1 //===-- llvm/MC/MCCodeEmitter.h - Instruction Encoding ----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_MC_MCCODEEMITTER_H
11 #define LLVM_MC_MCCODEEMITTER_H
12 
13 #include "llvm/Support/Compiler.h"
14 
15 namespace llvm {
16 class MCFixup;
17 class MCInst;
18 class raw_ostream;
19 template<typename T> class SmallVectorImpl;
20 
21 /// MCCodeEmitter - Generic instruction encoding interface.
22 class MCCodeEmitter {
23 private:
24   MCCodeEmitter(const MCCodeEmitter &) LLVM_DELETED_FUNCTION;
25   void operator=(const MCCodeEmitter &) LLVM_DELETED_FUNCTION;
26 protected: // Can only create subclasses.
27   MCCodeEmitter();
28 
29 public:
30   virtual ~MCCodeEmitter();
31 
32   /// Lifetime management
reset()33   virtual void reset() { }
34 
35   /// EncodeInstruction - Encode the given \p Inst to bytes on the output
36   /// stream \p OS.
37   virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS,
38                                  SmallVectorImpl<MCFixup> &Fixups) const = 0;
39 };
40 
41 } // End llvm namespace
42 
43 #endif
44