LLVM  mainline
DwarfException.h
Go to the documentation of this file.
00001 //===-- DwarfException.h - Dwarf Exception Framework -----------*- C++ -*--===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains support for writing dwarf exception info into asm files.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
00015 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
00016 
00017 #include "EHStreamer.h"
00018 #include "llvm/CodeGen/AsmPrinter.h"
00019 
00020 namespace llvm {
00021 class MachineFunction;
00022 class ARMTargetStreamer;
00023 
00024 class DwarfCFIExceptionBase : public EHStreamer {
00025 protected:
00026   DwarfCFIExceptionBase(AsmPrinter *A);
00027 
00028   /// Per-function flag to indicate if frame CFI info should be emitted.
00029   bool shouldEmitCFI;
00030 
00031   void markFunctionEnd() override;
00032 };
00033 
00034 class DwarfCFIException : public DwarfCFIExceptionBase {
00035   /// Per-function flag to indicate if .cfi_personality should be emitted.
00036   bool shouldEmitPersonality;
00037 
00038   /// Per-function flag to indicate if .cfi_lsda should be emitted.
00039   bool shouldEmitLSDA;
00040 
00041   /// Per-function flag to indicate if frame moves info should be emitted.
00042   bool shouldEmitMoves;
00043 
00044   AsmPrinter::CFIMoveType moveTypeModule;
00045 
00046 public:
00047   //===--------------------------------------------------------------------===//
00048   // Main entry points.
00049   //
00050   DwarfCFIException(AsmPrinter *A);
00051   ~DwarfCFIException() override;
00052 
00053   /// Emit all exception information that should come after the content.
00054   void endModule() override;
00055 
00056   /// Gather pre-function exception information.  Assumes being emitted
00057   /// immediately after the function entry point.
00058   void beginFunction(const MachineFunction *MF) override;
00059 
00060   /// Gather and emit post-function exception information.
00061   void endFunction(const MachineFunction *) override;
00062 };
00063 
00064 class ARMException : public DwarfCFIExceptionBase {
00065   void emitTypeInfos(unsigned TTypeEncoding) override;
00066   ARMTargetStreamer &getTargetStreamer();
00067 
00068 public:
00069   //===--------------------------------------------------------------------===//
00070   // Main entry points.
00071   //
00072   ARMException(AsmPrinter *A);
00073   ~ARMException() override;
00074 
00075   /// Emit all exception information that should come after the content.
00076   void endModule() override;
00077 
00078   /// Gather pre-function exception information.  Assumes being emitted
00079   /// immediately after the function entry point.
00080   void beginFunction(const MachineFunction *MF) override;
00081 
00082   /// Gather and emit post-function exception information.
00083   void endFunction(const MachineFunction *) override;
00084 };
00085 } // End of namespace llvm
00086 
00087 #endif