LLVM 19.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
18
19namespace llvm {
20
21class AsmPrinter;
22class MachineBasicBlock;
23class MachineFunction;
24class MachineInstr;
25class MCSymbol;
26class Module;
27
29 const MachineBasicBlock *MBB);
30
31/// Collects and handles AsmPrinter objects required to build debug
32/// or EH information.
34public:
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 virtual void endFunction(const MachineFunction *MF) = 0;
57
58 /// Process the beginning of a new basic-block-section within a
59 /// function. Always called immediately after beginFunction for the first
60 /// basic-block. When basic-block-sections are enabled, called before the
61 /// first block of each such section.
63
64 /// Process the end of a basic-block-section within a function. When
65 /// basic-block-sections are enabled, called after the last block in each such
66 /// section (including the last section in the function). When
67 /// basic-block-sections are disabled, called at the end of a function,
68 /// immediately prior to markFunctionEnd.
70
71 /// Emit target-specific EH funclet machinery.
72 virtual void beginFunclet(const MachineBasicBlock &MBB,
73 MCSymbol *Sym = nullptr) {}
74 virtual void endFunclet() {}
75
76 /// Process beginning of an instruction.
77 virtual void beginInstruction(const MachineInstr *MI) = 0;
78
79 /// Process end of an instruction.
80 virtual void endInstruction() = 0;
81};
82
83} // End of namespace llvm
84
85#endif
MachineBasicBlock & MBB
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 ~AsmPrinterHandler()
Pin vtable to this file.
virtual void endInstruction()=0
Process end of an instruction.
virtual void beginModule(Module *M)
virtual void beginFunction(const MachineFunction *MF)=0
Gather pre-function debug information.
virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size)=0
For symbols that have a size designated (e.g.
virtual void markFunctionEnd()
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 beginInstruction(const MachineInstr *MI)=0
Process beginning of an instruction.
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:84
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:40
Representation of each machine instruction.
Definition: MachineInstr.h:69
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MCSymbol * ExceptionSymbolProvider(AsmPrinter *Asm, const MachineBasicBlock *MBB)