LLVM  7.0.0svn
EHPersonalities.h
Go to the documentation of this file.
1 //===- EHPersonalities.h - Compute EH-related information -----------------===//
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 #ifndef LLVM_ANALYSIS_EHPERSONALITIES_H
11 #define LLVM_ANALYSIS_EHPERSONALITIES_H
12 
13 #include "llvm/ADT/DenseMap.h"
14 #include "llvm/ADT/TinyPtrVector.h"
15 #include "llvm/ADT/Triple.h"
17 
18 namespace llvm {
19 class BasicBlock;
20 class Function;
21 class Value;
22 
23 enum class EHPersonality {
24  Unknown,
25  GNU_Ada,
26  GNU_C,
27  GNU_C_SjLj,
28  GNU_CXX,
30  GNU_ObjC,
33  MSVC_CXX,
34  CoreCLR,
35  Rust,
36  Wasm_CXX
37 };
38 
39 /// See if the given exception handling personality function is one
40 /// that we understand. If so, return a description of it; otherwise return
41 /// Unknown.
43 
45 
47 
48 /// Returns true if this personality function catches asynchronous
49 /// exceptions.
51  // The two SEH personality functions can catch asynch exceptions. We assume
52  // unknown personalities don't catch asynch exceptions.
53  switch (Pers) {
56  return true;
57  default:
58  return false;
59  }
60  llvm_unreachable("invalid enum");
61 }
62 
63 /// Returns true if this is a personality function that invokes
64 /// handler funclets (which must return to it).
66  switch (Pers) {
71  return true;
72  default:
73  return false;
74  }
75  llvm_unreachable("invalid enum");
76 }
77 
78 /// Returns true if this personality uses scope-style EH IR instructions:
79 /// catchswitch, catchpad/ret, and cleanuppad/ret.
81  switch (Pers) {
87  return true;
88  default:
89  return false;
90  }
91  llvm_unreachable("invalid enum");
92 }
93 
94 /// Return true if this personality may be safely removed if there
95 /// are no invoke instructions remaining in the current function.
97  switch (Pers) {
99  return false;
100  // All known personalities currently have this behavior
101  default:
102  return true;
103  }
104  llvm_unreachable("invalid enum");
105 }
106 
108 
110 
111 /// If an EH funclet personality is in use (see isFuncletEHPersonality),
112 /// this will recompute which blocks are in which funclet. It is possible that
113 /// some blocks are in multiple funclets. Consider this analysis to be
114 /// expensive.
116 
117 } // end namespace llvm
118 
119 #endif
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Various leaf nodes.
Definition: ISDOpcodes.h:60
F(f)
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Definition: TinyPtrVector.h:31
bool canSimplifyInvokeNoUnwind(const Function *F)
bool isScopedEHPersonality(EHPersonality Pers)
Returns true if this personality uses scope-style EH IR instructions: catchswitch, catchpad/ret, and cleanuppad/ret.
EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
EHPersonality getDefaultEHPersonality(const Triple &T)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
StringRef getEHPersonalityName(EHPersonality Pers)
TinyPtrVector< BasicBlock * > ColorVector
bool isAsynchronousEHPersonality(EHPersonality Pers)
Returns true if this personality function catches asynchronous exceptions.
LLVM Value Representation.
Definition: Value.h:73
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
DenseMap< BasicBlock *, ColorVector > colorEHFunclets(Function &F)
If an EH funclet personality is in use (see isFuncletEHPersonality), this will recompute which blocks...
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...