1 //===-- DwarfException.h - Dwarf Exception Framework -----------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains support for writing dwarf exception info into asm files.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
17 #include "EHStreamer.h"
18 #include "llvm/CodeGen/AsmPrinter.h"
19 #include "llvm/MC/MCDwarf.h"
22 class MachineFunction;
23 class ARMTargetStreamer;
25 class LLVM_LIBRARY_VISIBILITY DwarfCFIExceptionBase : public EHStreamer {
27 DwarfCFIExceptionBase(AsmPrinter *A);
29 /// Per-function flag to indicate if frame CFI info should be emitted.
31 /// Per-module flag to indicate if .cfi_section has beeen emitted.
32 bool hasEmittedCFISections;
34 void markFunctionEnd() override;
35 void endFragment() override;
38 class LLVM_LIBRARY_VISIBILITY DwarfCFIException : public DwarfCFIExceptionBase {
39 /// Per-function flag to indicate if .cfi_personality should be emitted.
40 bool shouldEmitPersonality;
42 /// Per-function flag to indicate if .cfi_personality must be emitted.
43 bool forceEmitPersonality;
45 /// Per-function flag to indicate if .cfi_lsda should be emitted.
48 /// Per-function flag to indicate if frame moves info should be emitted.
52 //===--------------------------------------------------------------------===//
55 DwarfCFIException(AsmPrinter *A);
56 ~DwarfCFIException() override;
58 /// Emit all exception information that should come after the content.
59 void endModule() override;
61 /// Gather pre-function exception information. Assumes being emitted
62 /// immediately after the function entry point.
63 void beginFunction(const MachineFunction *MF) override;
65 /// Gather and emit post-function exception information.
66 void endFunction(const MachineFunction *) override;
68 void beginFragment(const MachineBasicBlock *MBB,
69 ExceptionSymbolProvider ESP) override;
72 class LLVM_LIBRARY_VISIBILITY ARMException : public DwarfCFIExceptionBase {
73 void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) override;
74 ARMTargetStreamer &getTargetStreamer();
77 //===--------------------------------------------------------------------===//
80 ARMException(AsmPrinter *A);
81 ~ARMException() override;
83 /// Emit all exception information that should come after the content.
84 void endModule() override {}
86 /// Gather pre-function exception information. Assumes being emitted
87 /// immediately after the function entry point.
88 void beginFunction(const MachineFunction *MF) override;
90 /// Gather and emit post-function exception information.
91 void endFunction(const MachineFunction *) override;
93 } // End of namespace llvm