Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H |
| 15 | #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXCEPTION_H |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 16 | |
Saleem Abdulrasool | 8076cab | 2014-06-11 01:19:03 +0000 | [diff] [blame] | 17 | #include "EHStreamer.h" |
Rafael Espindola | fdc3e6f | 2011-05-10 18:39:09 +0000 | [diff] [blame] | 18 | #include "llvm/CodeGen/AsmPrinter.h" |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
Chris Lattner | da790ea | 2010-04-05 05:28:23 +0000 | [diff] [blame] | 21 | class MachineFunction; |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 22 | class ARMTargetStreamer; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 23 | |
Rafael Espindola | a600179 | 2015-03-09 18:29:12 +0000 | [diff] [blame] | 24 | class DwarfCFIExceptionBase : public EHStreamer { |
| 25 | protected: |
| 26 | DwarfCFIExceptionBase(AsmPrinter *A); |
| 27 | |
| 28 | /// Per-function flag to indicate if frame CFI info should be emitted. |
| 29 | bool shouldEmitCFI; |
| 30 | |
| 31 | void markFunctionEnd() override; |
| 32 | }; |
| 33 | |
| 34 | class DwarfCFIException : public DwarfCFIExceptionBase { |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 35 | /// Per-function flag to indicate if .cfi_personality should be emitted. |
Rafael Espindola | 697edc8 | 2011-04-29 14:48:51 +0000 | [diff] [blame] | 36 | bool shouldEmitPersonality; |
| 37 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 38 | /// Per-function flag to indicate if .cfi_lsda should be emitted. |
Rafael Espindola | 697edc8 | 2011-04-29 14:48:51 +0000 | [diff] [blame] | 39 | bool shouldEmitLSDA; |
Anton Korobeynikov | b46ef57 | 2011-01-14 21:57:53 +0000 | [diff] [blame] | 40 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 41 | /// Per-function flag to indicate if frame moves info should be emitted. |
Anton Korobeynikov | b46ef57 | 2011-01-14 21:57:53 +0000 | [diff] [blame] | 42 | bool shouldEmitMoves; |
| 43 | |
Rafael Espindola | fdc3e6f | 2011-05-10 18:39:09 +0000 | [diff] [blame] | 44 | AsmPrinter::CFIMoveType moveTypeModule; |
| 45 | |
Anton Korobeynikov | b46ef57 | 2011-01-14 21:57:53 +0000 | [diff] [blame] | 46 | public: |
| 47 | //===--------------------------------------------------------------------===// |
| 48 | // Main entry points. |
| 49 | // |
| 50 | DwarfCFIException(AsmPrinter *A); |
Alexander Kornienko | f817c1c | 2015-04-11 02:11:45 +0000 | [diff] [blame^] | 51 | ~DwarfCFIException() override; |
Anton Korobeynikov | b46ef57 | 2011-01-14 21:57:53 +0000 | [diff] [blame] | 52 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 53 | /// Emit all exception information that should come after the content. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 54 | void endModule() override; |
Anton Korobeynikov | b46ef57 | 2011-01-14 21:57:53 +0000 | [diff] [blame] | 55 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 56 | /// Gather pre-function exception information. Assumes being emitted |
| 57 | /// immediately after the function entry point. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 58 | void beginFunction(const MachineFunction *MF) override; |
Anton Korobeynikov | b46ef57 | 2011-01-14 21:57:53 +0000 | [diff] [blame] | 59 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 60 | /// Gather and emit post-function exception information. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 61 | void endFunction(const MachineFunction *) override; |
Anton Korobeynikov | b46ef57 | 2011-01-14 21:57:53 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
Rafael Espindola | a600179 | 2015-03-09 18:29:12 +0000 | [diff] [blame] | 64 | class ARMException : public DwarfCFIExceptionBase { |
Saleem Abdulrasool | 8076cab | 2014-06-11 01:19:03 +0000 | [diff] [blame] | 65 | void emitTypeInfos(unsigned TTypeEncoding) override; |
Rafael Espindola | a17151a | 2013-10-08 13:08:17 +0000 | [diff] [blame] | 66 | ARMTargetStreamer &getTargetStreamer(); |
| 67 | |
Anton Korobeynikov | a7ec2dc | 2011-03-05 18:43:15 +0000 | [diff] [blame] | 68 | public: |
| 69 | //===--------------------------------------------------------------------===// |
| 70 | // Main entry points. |
| 71 | // |
| 72 | ARMException(AsmPrinter *A); |
Alexander Kornienko | f817c1c | 2015-04-11 02:11:45 +0000 | [diff] [blame^] | 73 | ~ARMException() override; |
Anton Korobeynikov | a7ec2dc | 2011-03-05 18:43:15 +0000 | [diff] [blame] | 74 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 75 | /// Emit all exception information that should come after the content. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 76 | void endModule() override; |
Anton Korobeynikov | a7ec2dc | 2011-03-05 18:43:15 +0000 | [diff] [blame] | 77 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 78 | /// Gather pre-function exception information. Assumes being emitted |
| 79 | /// immediately after the function entry point. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 80 | void beginFunction(const MachineFunction *MF) override; |
Anton Korobeynikov | a7ec2dc | 2011-03-05 18:43:15 +0000 | [diff] [blame] | 81 | |
Rafael Espindola | ef142e4 | 2015-03-09 18:11:42 +0000 | [diff] [blame] | 82 | /// Gather and emit post-function exception information. |
Craig Topper | 7b883b3 | 2014-03-08 06:31:39 +0000 | [diff] [blame] | 83 | void endFunction(const MachineFunction *) override; |
Anton Korobeynikov | a7ec2dc | 2011-03-05 18:43:15 +0000 | [diff] [blame] | 84 | }; |
Bill Wendling | d64cd2b | 2009-05-15 01:12:28 +0000 | [diff] [blame] | 85 | } // End of namespace llvm |
| 86 | |
| 87 | #endif |