blob: e59961f8576956b6638792484104d2ca74008ab5 [file] [log] [blame]
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +00001//===-- 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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000015#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H
16#define LLVM_LIB_CODEGEN_ASMPRINTER_ASMPRINTERHANDLER_H
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +000017
18#include "llvm/Support/DataTypes.h"
19
20namespace llvm {
21
David Majnemera80c1512015-09-29 20:12:33 +000022class MachineBasicBlock;
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +000023class MachineFunction;
24class MachineInstr;
25class MCSymbol;
26
27/// \brief Collects and handles AsmPrinter objects required to build debug
28/// or EH information.
29class AsmPrinterHandler {
30public:
Juergen Ributzkadb9ee002013-12-14 12:23:14 +000031 virtual ~AsmPrinterHandler();
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +000032
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;
36
37 /// \brief Emit all sections that should come after the content.
38 virtual void endModule() = 0;
39
40 /// \brief Gather pre-function debug information.
Eric Christopher4df11602013-12-10 00:26:06 +000041 /// Every beginFunction(MF) call should be followed by an endFunction(MF)
42 /// call.
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +000043 virtual void beginFunction(const MachineFunction *MF) = 0;
44
Rafael Espindolaa6001792015-03-09 18:29:12 +000045 // \brief Emit any of function marker (like .cfi_endproc). This is called
46 // before endFunction and cannot switch sections.
47 virtual void markFunctionEnd();
48
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +000049 /// \brief Gather post-function debug information.
Timur Iskhodzhanovc05ef042013-12-03 18:57:43 +000050 /// Please note that some AsmPrinter implementations may not call
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +000051 /// beginFunction at all.
52 virtual void endFunction(const MachineFunction *MF) = 0;
53
David Majnemera80c1512015-09-29 20:12:33 +000054 /// \brief Emit target-specific EH funclet machinery.
55 virtual void beginFunclet(const MachineBasicBlock &MBB,
56 MCSymbol *Sym = nullptr) {}
57 virtual void endFunclet() {}
58
Timur Iskhodzhanov1cd14442013-12-03 15:10:23 +000059 /// \brief Process beginning of an instruction.
60 virtual void beginInstruction(const MachineInstr *MI) = 0;
61
62 /// \brief Process end of an instruction.
63 virtual void endInstruction() = 0;
64};
65} // End of namespace llvm
66
67#endif