blob: 115869dc4ed8b728f2f569b6abbe023ef9c9beb6 [file] [log] [blame]
Bill Wendlingd64cd2b2009-05-15 01:12:28 +00001//===-- 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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
15#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
Bill Wendlingd64cd2b2009-05-15 01:12:28 +000016
Saleem Abdulrasool8076cab2014-06-11 01:19:03 +000017#include "EHStreamer.h"
Rafael Espindolafdc3e6f2011-05-10 18:39:09 +000018#include "llvm/CodeGen/AsmPrinter.h"
Bill Wendlingd64cd2b2009-05-15 01:12:28 +000019
20namespace llvm {
Chris Lattnerda790ea2010-04-05 05:28:23 +000021class MachineFunction;
Rafael Espindolaa17151a2013-10-08 13:08:17 +000022class ARMTargetStreamer;
Bill Wendlingd64cd2b2009-05-15 01:12:28 +000023
Saleem Abdulrasool8076cab2014-06-11 01:19:03 +000024class DwarfCFIException : public EHStreamer {
Rafael Espindolaef142e42015-03-09 18:11:42 +000025 /// Per-function flag to indicate if .cfi_personality should be emitted.
Rafael Espindola697edc82011-04-29 14:48:51 +000026 bool shouldEmitPersonality;
27
Rafael Espindolaef142e42015-03-09 18:11:42 +000028 /// Per-function flag to indicate if .cfi_lsda should be emitted.
Rafael Espindola697edc82011-04-29 14:48:51 +000029 bool shouldEmitLSDA;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000030
Rafael Espindolaef142e42015-03-09 18:11:42 +000031 /// Per-function flag to indicate if frame moves info should be emitted.
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000032 bool shouldEmitMoves;
33
Rafael Espindolafdc3e6f2011-05-10 18:39:09 +000034 AsmPrinter::CFIMoveType moveTypeModule;
35
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000036public:
37 //===--------------------------------------------------------------------===//
38 // Main entry points.
39 //
40 DwarfCFIException(AsmPrinter *A);
41 virtual ~DwarfCFIException();
42
Rafael Espindolaef142e42015-03-09 18:11:42 +000043 /// Emit all exception information that should come after the content.
Craig Topper7b883b32014-03-08 06:31:39 +000044 void endModule() override;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000045
Rafael Espindolaef142e42015-03-09 18:11:42 +000046 /// Gather pre-function exception information. Assumes being emitted
47 /// immediately after the function entry point.
Craig Topper7b883b32014-03-08 06:31:39 +000048 void beginFunction(const MachineFunction *MF) override;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000049
Rafael Espindolaef142e42015-03-09 18:11:42 +000050 /// Gather and emit post-function exception information.
Craig Topper7b883b32014-03-08 06:31:39 +000051 void endFunction(const MachineFunction *) override;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000052};
53
Saleem Abdulrasool8076cab2014-06-11 01:19:03 +000054class ARMException : public EHStreamer {
55 void emitTypeInfos(unsigned TTypeEncoding) override;
Rafael Espindolaa17151a2013-10-08 13:08:17 +000056 ARMTargetStreamer &getTargetStreamer();
57
Rafael Espindolaef142e42015-03-09 18:11:42 +000058 /// Per-function flag to indicate if frame CFI info should be emitted.
Artyom Skrobovf6830f42014-02-14 17:19:07 +000059 bool shouldEmitCFI;
60
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000061public:
62 //===--------------------------------------------------------------------===//
63 // Main entry points.
64 //
65 ARMException(AsmPrinter *A);
66 virtual ~ARMException();
67
Rafael Espindolaef142e42015-03-09 18:11:42 +000068 /// Emit all exception information that should come after the content.
Craig Topper7b883b32014-03-08 06:31:39 +000069 void endModule() override;
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000070
Rafael Espindolaef142e42015-03-09 18:11:42 +000071 /// Gather pre-function exception information. Assumes being emitted
72 /// immediately after the function entry point.
Craig Topper7b883b32014-03-08 06:31:39 +000073 void beginFunction(const MachineFunction *MF) override;
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000074
Rafael Espindolaef142e42015-03-09 18:11:42 +000075 /// Gather and emit post-function exception information.
Craig Topper7b883b32014-03-08 06:31:39 +000076 void endFunction(const MachineFunction *) override;
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000077};
Bill Wendlingd64cd2b2009-05-15 01:12:28 +000078} // End of namespace llvm
79
80#endif