LLVM 19.0.0git
DwarfException.h
Go to the documentation of this file.
1//===-- DwarfException.h - Dwarf Exception Framework -----------*- 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 support for writing dwarf exception info into asm files.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
15
16#include "EHStreamer.h"
18#include "llvm/MC/MCDwarf.h"
19
20namespace llvm {
21class MachineFunction;
22class ARMTargetStreamer;
23
25 /// Per-function flag to indicate if .cfi_personality should be emitted.
26 bool shouldEmitPersonality = false;
27
28 /// Per-function flag to indicate if .cfi_personality must be emitted.
29 bool forceEmitPersonality = false;
30
31 /// Per-function flag to indicate if .cfi_lsda should be emitted.
32 bool shouldEmitLSDA = false;
33
34 /// Per-function flag to indicate if frame CFI info should be emitted.
35 bool shouldEmitCFI = false;
36
37 /// Per-module flag to indicate if .cfi_section has beeen emitted.
38 bool hasEmittedCFISections = false;
39
40 /// Vector of all personality functions seen so far in the module.
41 std::vector<const GlobalValue *> Personalities;
42
43 void addPersonality(const GlobalValue *Personality);
44
45public:
46 //===--------------------------------------------------------------------===//
47 // Main entry points.
48 //
51
52 /// Emit all exception information that should come after the content.
53 void endModule() override;
54
55 /// Gather pre-function exception information. Assumes being emitted
56 /// immediately after the function entry point.
57 void beginFunction(const MachineFunction *MF) override;
58
59 /// Gather and emit post-function exception information.
60 void endFunction(const MachineFunction *) override;
61
62 void beginBasicBlockSection(const MachineBasicBlock &MBB) override;
63 void endBasicBlockSection(const MachineBasicBlock &MBB) override;
64};
65
67 /// Per-function flag to indicate if frame CFI info should be emitted.
68 bool shouldEmitCFI = false;
69
70 /// Per-module flag to indicate if .cfi_section has beeen emitted.
71 bool hasEmittedCFISections = false;
72
73 void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) override;
74 ARMTargetStreamer &getTargetStreamer();
75
76public:
77 //===--------------------------------------------------------------------===//
78 // Main entry points.
79 //
81 ~ARMException() override;
82
83 /// Emit all exception information that should come after the content.
84 void endModule() override {}
85
86 /// Gather pre-function exception information. Assumes being emitted
87 /// immediately after the function entry point.
88 void beginFunction(const MachineFunction *MF) override;
89
90 /// Gather and emit post-function exception information.
91 void endFunction(const MachineFunction *) override;
92
93 void markFunctionEnd() override;
94};
95
97 /// This is AIX's compat unwind section, which unwinder would use
98 /// to find the location of LSDA area and personality rountine.
99 void emitExceptionInfoTable(const MCSymbol *LSDA, const MCSymbol *PerSym);
100
101public:
103
104 void endModule() override {}
105 void beginFunction(const MachineFunction *MF) override {}
106 void endFunction(const MachineFunction *MF) override;
107};
108} // End of namespace llvm
109
110#endif
MachineBasicBlock & MBB
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_LIBRARY_VISIBILITY
Definition: Compiler.h:131
void beginFunction(const MachineFunction *MF) override
Gather pre-function debug information.
void endModule() override
Emit all sections that should come after the content.
~ARMException() override
void endModule() override
Emit all exception information that should come after the content.
This class is intended to be used as a driving class for all asm writers.
Definition: AsmPrinter.h:84
~DwarfCFIException() override
Emits exception handling directives.
Definition: EHStreamer.h:30
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:40
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18