LLVM  6.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 };
37 
38 /// \brief See if the given exception handling personality function is one
39 /// that we understand. If so, return a description of it; otherwise return
40 /// Unknown.
42 
44 
46 
47 /// \brief Returns true if this personality function catches asynchronous
48 /// exceptions.
50  // The two SEH personality functions can catch asynch exceptions. We assume
51  // unknown personalities don't catch asynch exceptions.
52  switch (Pers) {
55  return true;
56  default:
57  return false;
58  }
59  llvm_unreachable("invalid enum");
60 }
61 
62 /// \brief Returns true if this is a personality function that invokes
63 /// handler funclets (which must return to it).
65  switch (Pers) {
70  return true;
71  default:
72  return false;
73  }
74  llvm_unreachable("invalid enum");
75 }
76 
77 /// \brief Return true if this personality may be safely removed if there
78 /// are no invoke instructions remaining in the current function.
80  switch (Pers) {
82  return false;
83  // All known personalities currently have this behavior
84  default:
85  return true;
86  }
87  llvm_unreachable("invalid enum");
88 }
89 
91 
93 
94 /// \brief If an EH funclet personality is in use (see isFuncletEHPersonality),
95 /// this will recompute which blocks are in which funclet. It is possible that
96 /// some blocks are in multiple funclets. Consider this analysis to be
97 /// expensive.
99 
100 } // end namespace llvm
101 
102 #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)
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...