LLVM  14.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 
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 
29  const MachineBasicBlock *MBB);
30 
31 /// Collects and handles AsmPrinter objects required to build debug
32 /// or EH information.
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,
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
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::AsmPrinterHandler::endFunction
virtual void endFunction(const MachineFunction *MF)=0
Gather post-function debug information.
llvm::AsmPrinterHandler::endFunclet
virtual void endFunclet()
Definition: AsmPrinterHandler.h:67
llvm::AsmPrinterHandler::beginInstruction
virtual void beginInstruction(const MachineInstr *MI)=0
Process beginning of an instruction.
llvm::AsmPrinterHandler::beginFragment
virtual void beginFragment(const MachineBasicBlock *MBB, ExceptionSymbolProvider ESP)
Definition: AsmPrinterHandler.h:60
llvm::AsmPrinterHandler::markFunctionEnd
virtual void markFunctionEnd()
Definition: AsmPrinter.cpp:3475
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::AsmPrinterHandler::~AsmPrinterHandler
virtual ~AsmPrinterHandler()
Pin vtable to this file.
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
uint64_t
llvm::AsmPrinterHandler::beginBasicBlock
virtual void beginBasicBlock(const MachineBasicBlock &MBB)
Process beginning of a basic block during basic block sections.
Definition: AsmPrinterHandler.h:76
llvm::AsmPrinterHandler::beginFunclet
virtual void beginFunclet(const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr)
Emit target-specific EH funclet machinery.
Definition: AsmPrinterHandler.h:65
llvm::AsmPrinterHandler::endModule
virtual void endModule()=0
Emit all sections that should come after the content.
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::MachineFunction
Definition: MachineFunction.h:234
llvm::ExceptionSymbolProvider
MCSymbol * ExceptionSymbolProvider(AsmPrinter *Asm, const MachineBasicBlock *MBB)
Definition: AsmPrinterHandler.h:28
llvm::AsmPrinterHandler::setSymbolSize
virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size)=0
For symbols that have a size designated (e.g.
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::AsmPrinter
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:81
llvm::AsmPrinterHandler
Collects and handles AsmPrinter objects required to build debug or EH information.
Definition: AsmPrinterHandler.h:33
llvm::AsmPrinterHandler::endInstruction
virtual void endInstruction()=0
Process end of an instruction.
llvm::AsmPrinterHandler::beginFunction
virtual void beginFunction(const MachineFunction *MF)=0
Gather pre-function debug information.
DataTypes.h
llvm::HexStyle::Asm
@ Asm
0ffh
Definition: MCInstPrinter.h:34
llvm::AsmPrinterHandler::endBasicBlock
virtual void endBasicBlock(const MachineBasicBlock &MBB)
Process end of a basic block during basic block sections.
Definition: AsmPrinterHandler.h:79
llvm::N86::ESP
@ ESP
Definition: X86MCTargetDesc.h:51
llvm::AsmPrinterHandler::beginModule
virtual void beginModule(Module *M)
Definition: AsmPrinterHandler.h:41
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::AsmPrinterHandler::endFragment
virtual void endFragment()
Definition: AsmPrinterHandler.h:62