LLVM  10.0.0svn
EHPersonalities.h
Go to the documentation of this file.
1 //===- EHPersonalities.h - Compute EH-related information -----------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_ANALYSIS_EHPERSONALITIES_H
10 #define LLVM_ANALYSIS_EHPERSONALITIES_H
11 
12 #include "llvm/ADT/DenseMap.h"
13 #include "llvm/ADT/TinyPtrVector.h"
14 #include "llvm/ADT/Triple.h"
16 
17 namespace llvm {
18 class BasicBlock;
19 class Function;
20 class Value;
21 
22 enum class EHPersonality {
23  Unknown,
24  GNU_Ada,
25  GNU_C,
26  GNU_C_SjLj,
27  GNU_CXX,
29  GNU_ObjC,
32  MSVC_CXX,
33  CoreCLR,
34  Rust,
35  Wasm_CXX
36 };
37 
38 /// 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 /// 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 /// 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 /// Returns true if this personality uses scope-style EH IR instructions:
78 /// catchswitch, catchpad/ret, and cleanuppad/ret.
80  switch (Pers) {
86  return true;
87  default:
88  return false;
89  }
90  llvm_unreachable("invalid enum");
91 }
92 
93 /// Return true if this personality may be safely removed if there
94 /// are no invoke instructions remaining in the current function.
96  switch (Pers) {
98  return false;
99  // All known personalities currently have this behavior
100  default:
101  return true;
102  }
103  llvm_unreachable("invalid enum");
104 }
105 
107 
109 
110 /// If an EH funclet personality is in use (see isFuncletEHPersonality),
111 /// this will recompute which blocks are in which funclet. It is possible that
112 /// some blocks are in multiple funclets. Consider this analysis to be
113 /// expensive.
115 
116 } // end namespace llvm
117 
118 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Various leaf nodes.
Definition: ISDOpcodes.h:59
F(f)
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Definition: TinyPtrVector.h:30
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:43
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:74
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
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...