Debian Codegraph @

suite/synctools/tablegen/include/llvm/CodeGen/AsmPrinterHandler.h

raw symbols SCIP
1 //===-- llvm/CodeGen/AsmPrinterHandler.h -----------------------*- C++ -*--===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains a generic interface for AsmPrinter handlers,
10 // like debug and EH info emitters.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CODEGEN_ASMPRINTERHANDLER_H
15 #define LLVM_CODEGEN_ASMPRINTERHANDLER_H
16
17 #include "llvm/Support/DataTypes.h"
18
19 namespace llvm {
20
21 class AsmPrinter;
22 class MachineBasicBlock;
23 class MachineFunction;
24 class MachineInstr;
25 class MCSymbol;
26 class Module;
27
28 typedef MCSymbol *ExceptionSymbolProvider(AsmPrinter *Asm,
29 const MachineBasicBlock *MBB);
30
31 /// Collects and handles AsmPrinter objects required to build debug
32 /// or EH information.
33 class AsmPrinterHandler {
34 public:
35 virtual ~AsmPrinterHandler();
36
37 /// For symbols that have a size designated (e.g. common symbols),
38 /// this tracks that size.
39 virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) = 0;
40
41 virtual void beginModule(Module *M) {}
42
43 /// Emit all sections that should come after the content.
44 virtual void endModule() = 0;
45
46 /// Gather pre-function debug information.
47 /// Every beginFunction(MF) call should be followed by an endFunction(MF)
48 /// call.
49 virtual void beginFunction(const MachineFunction *MF) = 0;
50
51 // Emit any of function marker (like .cfi_endproc). This is called
52 // before endFunction and cannot switch sections.
53 virtual void markFunctionEnd();
54
55 /// Gather post-function debug information.
56 /// Please note that some AsmPrinter implementations may not call
57 /// beginFunction at all.
58 virtual void endFunction(const MachineFunction *MF) = 0;
59
60 virtual void beginFragment(const MachineBasicBlock *MBB,
61 ExceptionSymbolProvider ESP) {}
62 virtual void endFragment() {}
63
64 /// Emit target-specific EH funclet machinery.
65 virtual void beginFunclet(const MachineBasicBlock &MBB,
66 MCSymbol *Sym = nullptr) {}
67 virtual void endFunclet() {}
68
69 /// Process beginning of an instruction.
70 virtual void beginInstruction(const MachineInstr *MI) = 0;
71
72 /// Process end of an instruction.
73 virtual void endInstruction() = 0;
74
75 /// Process beginning of a basic block during basic block sections.
76 virtual void beginBasicBlock(const MachineBasicBlock &MBB) {}
77
78 /// Process end of a basic block during basic block sections.
79 virtual void endBasicBlock(const MachineBasicBlock &MBB) {}
80 };
81
82 } // End of namespace llvm
83
84 #endif