blob: 0440fce506d028aa2254d3b8decd538a7fd77cb7 [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
Chris Lattner7a7cd922009-07-17 20:32:07 +000014#ifndef LLVM_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H
15#define LLVM_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 Espindola697edc82011-04-29 14:48:51 +000025 /// 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;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000032
33 /// shouldEmitMoves - Per-function flag to indicate if frame moves info
34 /// should be emitted.
35 bool shouldEmitMoves;
36
Rafael Espindolafdc3e6f2011-05-10 18:39:09 +000037 AsmPrinter::CFIMoveType moveTypeModule;
38
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000039public:
40 //===--------------------------------------------------------------------===//
41 // Main entry points.
42 //
43 DwarfCFIException(AsmPrinter *A);
44 virtual ~DwarfCFIException();
45
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +000046 /// endModule - Emit all exception information that should come after the
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000047 /// content.
Craig Topper7b883b32014-03-08 06:31:39 +000048 void endModule() override;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000049
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +000050 /// beginFunction - Gather pre-function exception information. Assumes being
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000051 /// emitted immediately after the function entry point.
Craig Topper7b883b32014-03-08 06:31:39 +000052 void beginFunction(const MachineFunction *MF) override;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000053
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +000054 /// endFunction - Gather and emit post-function exception information.
Craig Topper7b883b32014-03-08 06:31:39 +000055 void endFunction(const MachineFunction *) override;
Anton Korobeynikovb46ef572011-01-14 21:57:53 +000056};
57
Saleem Abdulrasool8076cab2014-06-11 01:19:03 +000058class ARMException : public EHStreamer {
59 void emitTypeInfos(unsigned TTypeEncoding) override;
Rafael Espindolaa17151a2013-10-08 13:08:17 +000060 ARMTargetStreamer &getTargetStreamer();
61
Artyom Skrobovf6830f42014-02-14 17:19:07 +000062 /// shouldEmitCFI - Per-function flag to indicate if frame CFI info
63 /// should be emitted.
64 bool shouldEmitCFI;
65
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000066public:
67 //===--------------------------------------------------------------------===//
68 // Main entry points.
69 //
70 ARMException(AsmPrinter *A);
71 virtual ~ARMException();
72
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +000073 /// endModule - Emit all exception information that should come after the
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000074 /// content.
Craig Topper7b883b32014-03-08 06:31:39 +000075 void endModule() override;
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000076
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +000077 /// beginFunction - Gather pre-function exception information. Assumes being
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000078 /// emitted immediately after the function entry point.
Craig Topper7b883b32014-03-08 06:31:39 +000079 void beginFunction(const MachineFunction *MF) override;
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000080
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +000081 /// endFunction - Gather and emit post-function exception information.
Craig Topper7b883b32014-03-08 06:31:39 +000082 void endFunction(const MachineFunction *) override;
Anton Korobeynikova7ec2dc2011-03-05 18:43:15 +000083};
84
Saleem Abdulrasool8076cab2014-06-11 01:19:03 +000085class Win64Exception : public EHStreamer {
Charles Davis91ed7992011-05-27 23:47:32 +000086 /// 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
98public:
99 //===--------------------------------------------------------------------===//
100 // Main entry points.
101 //
102 Win64Exception(AsmPrinter *A);
103 virtual ~Win64Exception();
104
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +0000105 /// endModule - Emit all exception information that should come after the
Charles Davis91ed7992011-05-27 23:47:32 +0000106 /// content.
Craig Topper7b883b32014-03-08 06:31:39 +0000107 void endModule() override;
Charles Davis91ed7992011-05-27 23:47:32 +0000108
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +0000109 /// beginFunction - Gather pre-function exception information. Assumes being
Charles Davis91ed7992011-05-27 23:47:32 +0000110 /// emitted immediately after the function entry point.
Craig Topper7b883b32014-03-08 06:31:39 +0000111 void beginFunction(const MachineFunction *MF) override;
Charles Davis91ed7992011-05-27 23:47:32 +0000112
Timur Iskhodzhanov119f3072013-11-26 13:34:55 +0000113 /// endFunction - Gather and emit post-function exception information.
Craig Topper7b883b32014-03-08 06:31:39 +0000114 void endFunction(const MachineFunction *) override;
Charles Davis91ed7992011-05-27 23:47:32 +0000115};
116
Bill Wendlingd64cd2b2009-05-15 01:12:28 +0000117} // End of namespace llvm
118
119#endif