AsmPrinterHandler.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //===-- lib/CodeGen/AsmPrinter/AsmPrinterHandler.h -------------*- 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. // This file contains a generic interface for AsmPrinter handlers,
  11. // like debug and EH info emitters.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H
  15. #define LLVM_LIB_CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H
  16. #include "llvm/Support/DataTypes.h"
  17. namespace llvm {
  18. class MachineFunction;
  19. class MachineInstr;
  20. class MCSymbol;
  21. /// \brief Collects and handles AsmPrinter objects required to build debug
  22. /// or EH information.
  23. class AsmPrinterHandler {
  24. public:
  25. virtual ~AsmPrinterHandler();
  26. /// \brief For symbols that have a size designated (e.g. common symbols),
  27. /// this tracks that size.
  28. virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) = 0;
  29. /// \brief Emit all sections that should come after the content.
  30. virtual void endModule() = 0;
  31. /// \brief Gather pre-function debug information.
  32. /// Every beginFunction(MF) call should be followed by an endFunction(MF)
  33. /// call.
  34. virtual void beginFunction(const MachineFunction *MF) = 0;
  35. // \brief Emit any of function marker (like .cfi_endproc). This is called
  36. // before endFunction and cannot switch sections.
  37. virtual void markFunctionEnd();
  38. /// \brief Gather post-function debug information.
  39. /// Please note that some AsmPrinter implementations may not call
  40. /// beginFunction at all.
  41. virtual void endFunction(const MachineFunction *MF) = 0;
  42. /// \brief Process beginning of an instruction.
  43. virtual void beginInstruction(const MachineInstr *MI) = 0;
  44. /// \brief Process end of an instruction.
  45. virtual void endInstruction() = 0;
  46. };
  47. } // End of namespace llvm
  48. #endif