MCCodeEmitter.h revision 2761fc427082215c2affcc9d8db8491400bc9e5d
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/MC/MCFixup.h"
14
15#include <cassert>
16
17namespace llvm {
18class MCExpr;
19class MCInst;
20class raw_ostream;
21template<typename T> class SmallVectorImpl;
22
23/// MCCodeEmitter - Generic instruction encoding interface.
24class MCCodeEmitter {
25private:
26  MCCodeEmitter(const MCCodeEmitter &);   // DO NOT IMPLEMENT
27  void operator=(const MCCodeEmitter &);  // DO NOT IMPLEMENT
28protected: // Can only create subclasses.
29  MCCodeEmitter();
30
31public:
32  virtual ~MCCodeEmitter();
33
34  /// EncodeInstruction - Encode the given \arg Inst to bytes on the output
35  /// stream \arg OS.
36  virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS,
37                                 SmallVectorImpl<MCFixup> &Fixups) const = 0;
38};
39
40} // End llvm namespace
41
42#endif
43