LLVM 24.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;
24class MachineFunction;
25class MachineInstr;
26class MCSymbol;
27class Module;
28
29/// Collects and handles AsmPrinter objects required to build debug
30/// or EH information.
32public:
34
35 virtual void beginModule(Module *M) {}
36
37 /// Emit all sections that should come after the content.
38 virtual void endModule() = 0;
39
40 /// Gather pre-function debug information.
41 /// Every beginFunction(MF) call should be followed by an endFunction(MF)
42 /// call.
43 virtual void beginFunction(const MachineFunction *MF) = 0;
44
45 // Emit any of function marker (like .cfi_endproc). This is called
46 // before endFunction and cannot switch sections.
47 virtual void markFunctionEnd();
48
49 /// Gather post-function debug information.
50 virtual void endFunction(const MachineFunction *MF) = 0;
51
52 /// Process the beginning of a new basic-block-section within a
53 /// function. Always called immediately after beginFunction for the first
54 /// basic-block. When basic-block-sections are enabled, called before the
55 /// first block of each such section.
57
58 /// Process the end of a basic-block-section within a function. When
59 /// basic-block-sections are enabled, called after the last block in each such
60 /// section (including the last section in the function). When
61 /// basic-block-sections are disabled, called at the end of a function,
62 /// immediately prior to markFunctionEnd.
64
65 /// For symbols that have a size designated (e.g. common symbols),
66 /// this tracks that size.
67 virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) {}
68
69 /// Process beginning of an instruction.
70 virtual void beginInstruction(const MachineInstr *MI) {}
71
72 /// Process end of an instruction.
73 virtual void endInstruction() {}
74
76
77 /// Emit target-specific EH funclet machinery.
78 virtual void beginFunclet(const MachineBasicBlock &MBB,
79 MCSymbol *Sym = nullptr) {}
80 virtual void endFunclet() {}
81};
82
83} // End of namespace llvm
84
85#endif
unsigned uint64_t
MachineBasicBlock & MBB
#define LLVM_ABI
Definition Compiler.h:215
IRTranslator LLVM IR MI
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 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 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:91
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.
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
This is an optimization pass for GlobalISel generic memory operations.