MCCodeEmitter.h revision 1d6547eb49ef46d2606810f0abad2570c41e38bd
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 18namespace llvm { 19class MCExpr; 20class MCInst; 21class raw_ostream; 22template<typename T> class SmallVectorImpl; 23 24/// MCCodeEmitter - Generic instruction encoding interface. 25class MCCodeEmitter { 26private: 27 MCCodeEmitter(const MCCodeEmitter &); // DO NOT IMPLEMENT 28 void operator=(const MCCodeEmitter &); // DO NOT IMPLEMENT 29protected: // Can only create subclasses. 30 MCCodeEmitter(); 31 32public: 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 55