MCCodeEmitter.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifndef LLVM_MC_MCCODEEMITTER_H
  10. #define LLVM_MC_MCCODEEMITTER_H
  11. #include "llvm/Support/Compiler.h"
  12. namespace llvm {
  13. class MCFixup;
  14. class MCInst;
  15. class MCSubtargetInfo;
  16. class raw_ostream;
  17. template<typename T> class SmallVectorImpl;
  18. /// MCCodeEmitter - Generic instruction encoding interface.
  19. class MCCodeEmitter {
  20. private:
  21. MCCodeEmitter(const MCCodeEmitter &) = delete;
  22. void operator=(const MCCodeEmitter &) = delete;
  23. protected: // Can only create subclasses.
  24. MCCodeEmitter();
  25. public:
  26. virtual ~MCCodeEmitter();
  27. /// Lifetime management
  28. virtual void reset() {}
  29. /// EncodeInstruction - Encode the given \p Inst to bytes on the output
  30. /// stream \p OS.
  31. virtual void encodeInstruction(const MCInst &Inst, raw_ostream &OS,
  32. SmallVectorImpl<MCFixup> &Fixups,
  33. const MCSubtargetInfo &STI) const = 0;
  34. };
  35. } // End llvm namespace
  36. #endif