LLVM  10.0.0svn
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 
28 
29 /// Collects and handles AsmPrinter objects required to build debug
30 /// or EH information.
32 public:
33  virtual ~AsmPrinterHandler();
34 
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;
38 
39  /// Emit all sections that should come after the content.
40  virtual void endModule() = 0;
41 
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;
46 
47  // Emit any of function marker (like .cfi_endproc). This is called
48  // before endFunction and cannot switch sections.
49  virtual void markFunctionEnd();
50 
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;
55 
56  virtual void beginFragment(const MachineBasicBlock *MBB,
58  virtual void endFragment() {}
59 
60  /// Emit target-specific EH funclet machinery.
61  virtual void beginFunclet(const MachineBasicBlock &MBB,
62  MCSymbol *Sym = nullptr) {}
63  virtual void endFunclet() {}
64 
65  /// Process beginning of an instruction.
66  virtual void beginInstruction(const MachineInstr *MI) = 0;
67 
68  /// Process end of an instruction.
69  virtual void endInstruction() = 0;
70 };
71 } // End of namespace llvm
72 
73 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size)=0
For symbols that have a size designated (e.g.
Collects and handles AsmPrinter objects required to build debug or EH information.
virtual void beginInstruction(const MachineInstr *MI)=0
Process beginning of an instruction.
virtual void endInstruction()=0
Process end of an instruction.
virtual void beginFragment(const MachineBasicBlock *MBB, ExceptionSymbolProvider ESP)
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:78
virtual void markFunctionEnd()
MCSymbol * ExceptionSymbolProvider(AsmPrinter *Asm)
virtual void beginFunction(const MachineFunction *MF)=0
Gather pre-function debug information.
virtual void endModule()=0
Emit all sections that should come after the content.
virtual void beginFunclet(const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr)
Emit target-specific EH funclet machinery.
Representation of each machine instruction.
Definition: MachineInstr.h:63
virtual ~AsmPrinterHandler()
Pin vtable to this file.
uint32_t Size
Definition: Profile.cpp:46
virtual void endFunction(const MachineFunction *MF)=0
Gather post-function debug information.
IRTranslator LLVM IR MI