Home | History | Annotate | Download | only in AsmPrinter
      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_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
     15 #define LLVM_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 DwarfCFIException : public EHStreamer {
     25   /// shouldEmitPersonality - Per-function flag to indicate if .cfi_personality
     26   /// should be emitted.
     27   bool shouldEmitPersonality;
     28 
     29   /// shouldEmitLSDA - Per-function flag to indicate if .cfi_lsda
     30   /// should be emitted.
     31   bool shouldEmitLSDA;
     32 
     33   /// shouldEmitMoves - Per-function flag to indicate if frame moves info
     34   /// should be emitted.
     35   bool shouldEmitMoves;
     36 
     37   AsmPrinter::CFIMoveType moveTypeModule;
     38 
     39 public:
     40   //===--------------------------------------------------------------------===//
     41   // Main entry points.
     42   //
     43   DwarfCFIException(AsmPrinter *A);
     44   virtual ~DwarfCFIException();
     45 
     46   /// endModule - Emit all exception information that should come after the
     47   /// content.
     48   void endModule() override;
     49 
     50   /// beginFunction - Gather pre-function exception information.  Assumes being
     51   /// emitted immediately after the function entry point.
     52   void beginFunction(const MachineFunction *MF) override;
     53 
     54   /// endFunction - Gather and emit post-function exception information.
     55   void endFunction(const MachineFunction *) override;
     56 };
     57 
     58 class ARMException : public EHStreamer {
     59   void emitTypeInfos(unsigned TTypeEncoding) override;
     60   ARMTargetStreamer &getTargetStreamer();
     61 
     62   /// shouldEmitCFI - Per-function flag to indicate if frame CFI info
     63   /// should be emitted.
     64   bool shouldEmitCFI;
     65 
     66 public:
     67   //===--------------------------------------------------------------------===//
     68   // Main entry points.
     69   //
     70   ARMException(AsmPrinter *A);
     71   virtual ~ARMException();
     72 
     73   /// endModule - Emit all exception information that should come after the
     74   /// content.
     75   void endModule() override;
     76 
     77   /// beginFunction - Gather pre-function exception information.  Assumes being
     78   /// emitted immediately after the function entry point.
     79   void beginFunction(const MachineFunction *MF) override;
     80 
     81   /// endFunction - Gather and emit post-function exception information.
     82   void endFunction(const MachineFunction *) override;
     83 };
     84 
     85 class Win64Exception : public EHStreamer {
     86   /// shouldEmitPersonality - Per-function flag to indicate if personality
     87   /// info should be emitted.
     88   bool shouldEmitPersonality;
     89 
     90   /// shouldEmitLSDA - Per-function flag to indicate if the LSDA
     91   /// should be emitted.
     92   bool shouldEmitLSDA;
     93 
     94   /// shouldEmitMoves - Per-function flag to indicate if frame moves info
     95   /// should be emitted.
     96   bool shouldEmitMoves;
     97 
     98 public:
     99   //===--------------------------------------------------------------------===//
    100   // Main entry points.
    101   //
    102   Win64Exception(AsmPrinter *A);
    103   virtual ~Win64Exception();
    104 
    105   /// endModule - Emit all exception information that should come after the
    106   /// content.
    107   void endModule() override;
    108 
    109   /// beginFunction - Gather pre-function exception information.  Assumes being
    110   /// emitted immediately after the function entry point.
    111   void beginFunction(const MachineFunction *MF) override;
    112 
    113   /// endFunction - Gather and emit post-function exception information.
    114   void endFunction(const MachineFunction *) override;
    115 };
    116 
    117 } // End of namespace llvm
    118 
    119 #endif
    120