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 20 namespace llvm { 21 class MachineFunction; 22 class ARMTargetStreamer; 23 24 class DwarfCFIExceptionBase : public EHStreamer { 25 protected: 26 DwarfCFIExceptionBase(AsmPrinter *A); 27 28 /// Per-function flag to indicate if frame CFI info should be emitted. 29 bool shouldEmitCFI; 30 31 void markFunctionEnd() override; 32 }; 33 34 class DwarfCFIException : public DwarfCFIExceptionBase { 35 /// Per-function flag to indicate if .cfi_personality should be emitted. 36 bool shouldEmitPersonality; 37 38 /// Per-function flag to indicate if .cfi_lsda should be emitted. 39 bool shouldEmitLSDA; 40 41 /// Per-function flag to indicate if frame moves info should be emitted. 42 bool shouldEmitMoves; 43 44 AsmPrinter::CFIMoveType moveTypeModule; 45 46 public: 47 //===--------------------------------------------------------------------===// 48 // Main entry points. 49 // 50 DwarfCFIException(AsmPrinter *A); 51 ~DwarfCFIException() override; 52 53 /// Emit all exception information that should come after the content. 54 void endModule() override; 55 56 /// Gather pre-function exception information. Assumes being emitted 57 /// immediately after the function entry point. 58 void beginFunction(const MachineFunction *MF) override; 59 60 /// Gather and emit post-function exception information. 61 void endFunction(const MachineFunction *) override; 62 }; 63 64 class ARMException : public DwarfCFIExceptionBase { 65 void emitTypeInfos(unsigned TTypeEncoding) override; 66 ARMTargetStreamer &getTargetStreamer(); 67 68 public: 69 //===--------------------------------------------------------------------===// 70 // Main entry points. 71 // 72 ARMException(AsmPrinter *A); 73 ~ARMException() override; 74 75 /// Emit all exception information that should come after the content. 76 void endModule() override; 77 78 /// Gather pre-function exception information. Assumes being emitted 79 /// immediately after the function entry point. 80 void beginFunction(const MachineFunction *MF) override; 81 82 /// Gather and emit post-function exception information. 83 void endFunction(const MachineFunction *) override; 84 }; 85 } // End of namespace llvm 86 87 #endif 88