1 //===-- DwarfException.h - Dwarf Exception Framework -----------*- C++ -*--===//
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
7 //===----------------------------------------------------------------------===//
9 // This file contains support for writing dwarf exception info into asm files.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
14 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
16 #include "EHStreamer.h"
17 #include "llvm/CodeGen/AsmPrinter.h"
18 #include "llvm/MC/MCDwarf.h"
21 class MachineFunction
;
22 class ARMTargetStreamer
;
24 class LLVM_LIBRARY_VISIBILITY DwarfCFIExceptionBase
: public EHStreamer
{
26 DwarfCFIExceptionBase(AsmPrinter
*A
);
28 /// Per-function flag to indicate if frame CFI info should be emitted.
30 /// Per-module flag to indicate if .cfi_section has beeen emitted.
31 bool hasEmittedCFISections
;
33 void markFunctionEnd() override
;
34 void endFragment() override
;
37 class LLVM_LIBRARY_VISIBILITY DwarfCFIException
: public DwarfCFIExceptionBase
{
38 /// Per-function flag to indicate if .cfi_personality should be emitted.
39 bool shouldEmitPersonality
;
41 /// Per-function flag to indicate if .cfi_personality must be emitted.
42 bool forceEmitPersonality
;
44 /// Per-function flag to indicate if .cfi_lsda should be emitted.
47 /// Per-function flag to indicate if frame moves info should be emitted.
51 //===--------------------------------------------------------------------===//
54 DwarfCFIException(AsmPrinter
*A
);
55 ~DwarfCFIException() override
;
57 /// Emit all exception information that should come after the content.
58 void endModule() override
;
60 /// Gather pre-function exception information. Assumes being emitted
61 /// immediately after the function entry point.
62 void beginFunction(const MachineFunction
*MF
) override
;
64 /// Gather and emit post-function exception information.
65 void endFunction(const MachineFunction
*) override
;
67 void beginFragment(const MachineBasicBlock
*MBB
,
68 ExceptionSymbolProvider ESP
) override
;
71 class LLVM_LIBRARY_VISIBILITY ARMException
: public DwarfCFIExceptionBase
{
72 void emitTypeInfos(unsigned TTypeEncoding
, MCSymbol
*TTBaseLabel
) override
;
73 ARMTargetStreamer
&getTargetStreamer();
76 //===--------------------------------------------------------------------===//
79 ARMException(AsmPrinter
*A
);
80 ~ARMException() override
;
82 /// Emit all exception information that should come after the content.
83 void endModule() override
{}
85 /// Gather pre-function exception information. Assumes being emitted
86 /// immediately after the function entry point.
87 void beginFunction(const MachineFunction
*MF
) override
;
89 /// Gather and emit post-function exception information.
90 void endFunction(const MachineFunction
*) override
;
92 } // End of namespace llvm