1193323Sed//===-- DwarfException.h - Dwarf Exception Framework -----------*- C++ -*--===//
2193323Sed//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7193323Sed//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10193323Sed// This file contains support for writing dwarf exception info into asm files.
11193323Sed//
12193323Sed//===----------------------------------------------------------------------===//
13193323Sed
14280031Sdim#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
15280031Sdim#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
16193323Sed
17276479Sdim#include "EHStreamer.h"
18223017Sdim#include "llvm/CodeGen/AsmPrinter.h"
19193323Sed
20193323Sednamespace llvm {
21206274Srdivackyclass MachineFunction;
22261991Sdimclass ARMTargetStreamer;
23193323Sed
24288943Sdimclass LLVM_LIBRARY_VISIBILITY DwarfCFIExceptionBase : public EHStreamer {
25288943Sdimprotected:
26288943Sdim  DwarfCFIExceptionBase(AsmPrinter *A);
27288943Sdim
28288943Sdim  /// Per-function flag to indicate if frame CFI info should be emitted.
29288943Sdim  bool shouldEmitCFI;
30288943Sdim
31288943Sdim  void markFunctionEnd() override;
32288943Sdim};
33288943Sdim
34288943Sdimclass LLVM_LIBRARY_VISIBILITY DwarfCFIException : public DwarfCFIExceptionBase {
35288943Sdim  /// Per-function flag to indicate if .cfi_personality should be emitted.
36221345Sdim  bool shouldEmitPersonality;
37218893Sdim
38288943Sdim  /// Per-function flag to indicate if .cfi_lsda should be emitted.
39221345Sdim  bool shouldEmitLSDA;
40221345Sdim
41288943Sdim  /// Per-function flag to indicate if frame moves info should be emitted.
42218893Sdim  bool shouldEmitMoves;
43218893Sdim
44223017Sdim  AsmPrinter::CFIMoveType moveTypeModule;
45223017Sdim
46218893Sdimpublic:
47218893Sdim  //===--------------------------------------------------------------------===//
48218893Sdim  // Main entry points.
49218893Sdim  //
50218893Sdim  DwarfCFIException(AsmPrinter *A);
51288943Sdim  ~DwarfCFIException() override;
52218893Sdim
53288943Sdim  /// Emit all exception information that should come after the content.
54276479Sdim  void endModule() override;
55218893Sdim
56288943Sdim  /// Gather pre-function exception information.  Assumes being emitted
57288943Sdim  /// immediately after the function entry point.
58276479Sdim  void beginFunction(const MachineFunction *MF) override;
59218893Sdim
60288943Sdim  /// Gather and emit post-function exception information.
61276479Sdim  void endFunction(const MachineFunction *) override;
62218893Sdim};
63218893Sdim
64288943Sdimclass LLVM_LIBRARY_VISIBILITY ARMException : public DwarfCFIExceptionBase {
65276479Sdim  void emitTypeInfos(unsigned TTypeEncoding) override;
66261991Sdim  ARMTargetStreamer &getTargetStreamer();
67261991Sdim
68218893Sdimpublic:
69218893Sdim  //===--------------------------------------------------------------------===//
70218893Sdim  // Main entry points.
71218893Sdim  //
72223017Sdim  ARMException(AsmPrinter *A);
73288943Sdim  ~ARMException() override;
74218893Sdim
75288943Sdim  /// Emit all exception information that should come after the content.
76276479Sdim  void endModule() override;
77218893Sdim
78288943Sdim  /// Gather pre-function exception information.  Assumes being emitted
79288943Sdim  /// immediately after the function entry point.
80276479Sdim  void beginFunction(const MachineFunction *MF) override;
81218893Sdim
82288943Sdim  /// Gather and emit post-function exception information.
83276479Sdim  void endFunction(const MachineFunction *) override;
84218893Sdim};
85193323Sed} // End of namespace llvm
86193323Sed
87193323Sed#endif
88