LLVM 22.0.0git
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_IR_EHPERSONALITIES_H
10#define LLVM_IR_EHPERSONALITIES_H
11
12#include "llvm/ADT/DenseMap.h"
15
16namespace llvm {
17class BasicBlock;
18class Function;
19class Triple;
20class Value;
21
22enum class EHPersonality {
23 Unknown,
24 GNU_Ada,
25 GNU_C,
27 GNU_CXX,
33 CoreCLR,
34 Rust,
36 XL_CXX,
37 ZOS_CXX,
38};
39
40/// See if the given exception handling personality function is one
41/// that we understand. If so, return a description of it; otherwise return
42/// Unknown.
44
46
48
49/// Returns true if this personality function catches asynchronous
50/// exceptions.
52 // The two SEH personality functions can catch asynch exceptions. We assume
53 // unknown personalities don't catch asynch exceptions.
54 switch (Pers) {
57 return true;
58 default:
59 return false;
60 }
61 llvm_unreachable("invalid enum");
62}
63
64/// Returns true if this is a personality function that invokes
65/// handler funclets (which must return to it).
67 switch (Pers) {
72 return true;
73 default:
74 return false;
75 }
76 llvm_unreachable("invalid enum");
77}
78
79/// Returns true if this personality uses scope-style EH IR instructions:
80/// catchswitch, catchpad/ret, and cleanuppad/ret.
82 switch (Pers) {
88 return true;
89 default:
90 return false;
91 }
92 llvm_unreachable("invalid enum");
93}
94
95/// Return true if this personality may be safely removed if there
96/// are no invoke instructions remaining in the current function.
98 switch (Pers) {
100 return false;
101 // All known personalities currently have this behavior
102 default:
103 return true;
104 }
105 llvm_unreachable("invalid enum");
106}
107
108LLVM_ABI bool canSimplifyInvokeNoUnwind(const Function *F);
109
111
112/// If an EH funclet personality is in use (see isFuncletEHPersonality),
113/// this will recompute which blocks are in which funclet. It is possible that
114/// some blocks are in multiple funclets. Consider this analysis to be
115/// expensive.
117
118} // end namespace llvm
119
120#endif // LLVM_IR_EHPERSONALITIES_H
#define LLVM_ABI
Definition: Compiler.h:213
This file defines the DenseMap class.
#define F(x, y, z)
Definition: MD5.cpp:55
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Definition: TinyPtrVector.h:29
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:81
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
LLVM_ABI StringRef getEHPersonalityName(EHPersonality Pers)
LLVM_ABI DenseMap< BasicBlock *, ColorVector > colorEHFunclets(Function &F)
If an EH funclet personality is in use (see isFuncletEHPersonality), this will recompute which blocks...
bool isScopedEHPersonality(EHPersonality Pers)
Returns true if this personality uses scope-style EH IR instructions: catchswitch,...
bool isNoOpWithoutInvoke(EHPersonality Pers)
Return true if this personality may be safely removed if there are no invoke instructions remaining i...
LLVM_ABI bool canSimplifyInvokeNoUnwind(const Function *F)
LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
bool isFuncletEHPersonality(EHPersonality Pers)
Returns true if this is a personality function that invokes handler funclets (which must return to it...
bool isAsynchronousEHPersonality(EHPersonality Pers)
Returns true if this personality function catches asynchronous exceptions.
TinyPtrVector< BasicBlock * > ColorVector
LLVM_ABI EHPersonality getDefaultEHPersonality(const Triple &T)