]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / CodeGen / AsmPrinter / DwarfException.h
1 //===-- DwarfException.h - Dwarf Exception Framework -----------*- C++ -*--===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains support for writing dwarf exception info into asm files.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
16
17 #include "EHStreamer.h"
18 #include "llvm/CodeGen/AsmPrinter.h"
19 #include "llvm/MC/MCDwarf.h"
20
21 namespace llvm {
22 class MachineFunction;
23 class ARMTargetStreamer;
24
25 class LLVM_LIBRARY_VISIBILITY DwarfCFIExceptionBase : public EHStreamer {
26 protected:
27   DwarfCFIExceptionBase(AsmPrinter *A);
28
29   /// Per-function flag to indicate if frame CFI info should be emitted.
30   bool shouldEmitCFI;
31   /// Per-module flag to indicate if .cfi_section has beeen emitted.
32   bool hasEmittedCFISections;
33
34   void markFunctionEnd() override;
35   void endFragment() override;
36 };
37
38 class LLVM_LIBRARY_VISIBILITY DwarfCFIException : public DwarfCFIExceptionBase {
39   /// Per-function flag to indicate if .cfi_personality should be emitted.
40   bool shouldEmitPersonality;
41
42   /// Per-function flag to indicate if .cfi_personality must be emitted.
43   bool forceEmitPersonality;
44
45   /// Per-function flag to indicate if .cfi_lsda should be emitted.
46   bool shouldEmitLSDA;
47
48   /// Per-function flag to indicate if frame moves info should be emitted.
49   bool shouldEmitMoves;
50
51 public:
52   //===--------------------------------------------------------------------===//
53   // Main entry points.
54   //
55   DwarfCFIException(AsmPrinter *A);
56   ~DwarfCFIException() override;
57
58   /// Emit all exception information that should come after the content.
59   void endModule() override;
60
61   /// Gather pre-function exception information.  Assumes being emitted
62   /// immediately after the function entry point.
63   void beginFunction(const MachineFunction *MF) override;
64
65   /// Gather and emit post-function exception information.
66   void endFunction(const MachineFunction *) override;
67
68   void beginFragment(const MachineBasicBlock *MBB,
69                      ExceptionSymbolProvider ESP) override;
70 };
71
72 class LLVM_LIBRARY_VISIBILITY ARMException : public DwarfCFIExceptionBase {
73   void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) override;
74   ARMTargetStreamer &getTargetStreamer();
75
76 public:
77   //===--------------------------------------------------------------------===//
78   // Main entry points.
79   //
80   ARMException(AsmPrinter *A);
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 } // End of namespace llvm
94
95 #endif