[Alignment][NFC] Support compile time constants
[llvm-core.git] / include / llvm / CodeGen / AsmPrinterHandler.h
blobaffb558f2fa66f632b66d90d47243a6d35aa2d33
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.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CODEGEN_ASMPRINTERHANDLER_H
15 #define LLVM_CODEGEN_ASMPRINTERHANDLER_H
17 #include "llvm/Support/DataTypes.h"
19 namespace llvm {
21 class AsmPrinter;
22 class MachineBasicBlock;
23 class MachineFunction;
24 class MachineInstr;
25 class MCSymbol;
27 typedef MCSymbol *ExceptionSymbolProvider(AsmPrinter *Asm);
29 /// Collects and handles AsmPrinter objects required to build debug
30 /// or EH information.
31 class AsmPrinterHandler {
32 public:
33 virtual ~AsmPrinterHandler();
35 /// For symbols that have a size designated (e.g. common symbols),
36 /// this tracks that size.
37 virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) = 0;
39 /// Emit all sections that should come after the content.
40 virtual void endModule() = 0;
42 /// Gather pre-function debug information.
43 /// Every beginFunction(MF) call should be followed by an endFunction(MF)
44 /// call.
45 virtual void beginFunction(const MachineFunction *MF) = 0;
47 // Emit any of function marker (like .cfi_endproc). This is called
48 // before endFunction and cannot switch sections.
49 virtual void markFunctionEnd();
51 /// Gather post-function debug information.
52 /// Please note that some AsmPrinter implementations may not call
53 /// beginFunction at all.
54 virtual void endFunction(const MachineFunction *MF) = 0;
56 virtual void beginFragment(const MachineBasicBlock *MBB,
57 ExceptionSymbolProvider ESP) {}
58 virtual void endFragment() {}
60 /// Emit target-specific EH funclet machinery.
61 virtual void beginFunclet(const MachineBasicBlock &MBB,
62 MCSymbol *Sym = nullptr) {}
63 virtual void endFunclet() {}
65 /// Process beginning of an instruction.
66 virtual void beginInstruction(const MachineInstr *MI) = 0;
68 /// Process end of an instruction.
69 virtual void endInstruction() = 0;
71 } // End of namespace llvm
73 #endif