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