]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/llvm/include/llvm/MC/MCCodeEmitter.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / llvm / include / llvm / MC / MCCodeEmitter.h
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
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