LLVM 22.0.0git
AsmPrinterHandler.h
Go to the documentation of this file.
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
19
20namespace llvm {
21
22class AsmPrinter;
23class MachineBasicBlock;
24class MachineFunction;
25class MachineInstr;
26class MCSymbol;
27class Module;
28
30 const MachineBasicBlock *MBB);
31
32/// Collects and handles AsmPrinter objects required to build debug
33/// or EH information.
35public:
37
38 virtual void beginModule(Module *M) {}
39
40 /// Emit all sections that should come after the content.
41 virtual void endModule() = 0;
42
43 /// Gather pre-function debug information.
44 /// Every beginFunction(MF) call should be followed by an endFunction(MF)
45 /// call.
46 virtual void beginFunction(const MachineFunction *MF) = 0;
47
48 // Emit any of function marker (like .cfi_endproc). This is called
49 // before endFunction and cannot switch sections.
50 virtual void markFunctionEnd();
51
52 /// Gather post-function debug information.
53 virtual void endFunction(const MachineFunction *MF) = 0;
54
55 /// Process the beginning of a new basic-block-section within a
56 /// function. Always called immediately after beginFunction for the first
57 /// basic-block. When basic-block-sections are enabled, called before the
58 /// first block of each such section.
60
61 /// Process the end of a basic-block-section within a function. When
62 /// basic-block-sections are enabled, called after the last block in each such
63 /// section (including the last section in the function). When
64 /// basic-block-sections are disabled, called at the end of a function,
65 /// immediately prior to markFunctionEnd.
67
68 /// For symbols that have a size designated (e.g. common symbols),
69 /// this tracks that size.
70 virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) {}
71
72 /// Process beginning of an instruction.
73 virtual void beginInstruction(const MachineInstr *MI) {}
74
75 /// Process end of an instruction.
76 virtual void endInstruction() {}
77
79
80 /// Emit target-specific EH funclet machinery.
81 virtual void beginFunclet(const MachineBasicBlock &MBB,
82 MCSymbol *Sym = nullptr) {}
83 virtual void endFunclet() {}
84};
85
86} // End of namespace llvm
87
88#endif
MachineBasicBlock & MBB
#define LLVM_ABI
Definition: Compiler.h:213
uint64_t Size
Symbol * Sym
Definition: ELF_riscv.cpp:479
IRTranslator LLVM IR MI
Machine Check Debug Module
Collects and handles AsmPrinter objects required to build debug or EH information.
virtual void beginCodeAlignment(const MachineBasicBlock &MBB)
virtual void beginInstruction(const MachineInstr *MI)
Process beginning of an instruction.
virtual void endInstruction()
Process end of an instruction.
virtual ~AsmPrinterHandler()
Pin vtables to this file.
virtual void beginModule(Module *M)
virtual void beginFunction(const MachineFunction *MF)=0
Gather pre-function debug information.
virtual void endBasicBlockSection(const MachineBasicBlock &MBB)
Process the end of a basic-block-section within a function.
virtual void beginBasicBlockSection(const MachineBasicBlock &MBB)
Process the beginning of a new basic-block-section within a function.
virtual void endModule()=0
Emit all sections that should come after the content.
virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size)
For symbols that have a size designated (e.g.
virtual void beginFunclet(const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr)
Emit target-specific EH funclet machinery.
virtual void endFunction(const MachineFunction *MF)=0
Gather post-function debug information.
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:90
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
Representation of each machine instruction.
Definition: MachineInstr.h:72
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCSymbol * ExceptionSymbolProvider(AsmPrinter *Asm, const MachineBasicBlock *MBB)