MC: Split MCFixupKindInfo out into its own header.
[oota-llvm.git] / 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/MC/MCFixup.h"
14 #include "llvm/MC/MCFixupKindInfo.h"
15
16 #include <cassert>
17
18 namespace llvm {
19 class MCExpr;
20 class MCInst;
21 class raw_ostream;
22 template<typename T> class SmallVectorImpl;
23
24 /// MCCodeEmitter - Generic instruction encoding interface.
25 class MCCodeEmitter {
26 private:
27   MCCodeEmitter(const MCCodeEmitter &);   // DO NOT IMPLEMENT
28   void operator=(const MCCodeEmitter &);  // DO NOT IMPLEMENT
29 protected: // Can only create subclasses.
30   MCCodeEmitter();
31
32 public:
33   virtual ~MCCodeEmitter();
34
35   /// @name Target Independent Fixup Information
36   /// @{
37
38   /// getNumFixupKinds - Get the number of target specific fixup kinds.
39   virtual unsigned getNumFixupKinds() const = 0;
40
41   /// getFixupKindInfo - Get information on a fixup kind.
42   virtual const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const;
43
44   /// @}
45
46   /// EncodeInstruction - Encode the given \arg Inst to bytes on the output
47   /// stream \arg OS.
48   virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS,
49                                  SmallVectorImpl<MCFixup> &Fixups) const = 0;
50 };
51
52 } // End llvm namespace
53
54 #endif