1 //===-- lib/CodeGen/AsmPrinter/AsmPrinterHandler.h -------------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains a generic interface for AsmPrinter handlers,
11 // like debug and EH info emitters.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H
16 #define LLVM_LIB_CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H
18 #include "llvm/Support/DataTypes.h"
22 class MachineBasicBlock;
23 class MachineFunction;
27 /// \brief Collects and handles AsmPrinter objects required to build debug
28 /// or EH information.
29 class AsmPrinterHandler {
31 virtual ~AsmPrinterHandler();
33 /// \brief For symbols that have a size designated (e.g. common symbols),
34 /// this tracks that size.
35 virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) = 0;
37 /// \brief Emit all sections that should come after the content.
38 virtual void endModule() = 0;
40 /// \brief Gather pre-function debug information.
41 /// Every beginFunction(MF) call should be followed by an endFunction(MF)
43 virtual void beginFunction(const MachineFunction *MF) = 0;
45 // \brief Emit any of function marker (like .cfi_endproc). This is called
46 // before endFunction and cannot switch sections.
47 virtual void markFunctionEnd();
49 /// \brief Gather post-function debug information.
50 /// Please note that some AsmPrinter implementations may not call
51 /// beginFunction at all.
52 virtual void endFunction(const MachineFunction *MF) = 0;
54 /// \brief Emit target-specific EH funclet machinery.
55 virtual void beginFunclet(const MachineBasicBlock &MBB,
56 MCSymbol *Sym = nullptr) {}
57 virtual void endFunclet() {}
59 /// \brief Process beginning of an instruction.
60 virtual void beginInstruction(const MachineInstr *MI) = 0;
62 /// \brief Process end of an instruction.
63 virtual void endInstruction() = 0;
65 } // End of namespace llvm