LLVM 24.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
40
41/// See if the given exception handling personality function is one
42/// that we understand. If so, return a description of it; otherwise return
43/// Unknown.
45
47
49
50/// Returns true if this personality function catches asynchronous
51/// exceptions.
53 // The two SEH personality functions can catch asynch exceptions. We assume
54 // unknown personalities don't catch asynch exceptions.
55 switch (Pers) {
58 return true;
59 default:
60 return false;
61 }
62 llvm_unreachable("invalid enum");
63}
64
65/// Returns true if this is a personality function that invokes
66/// handler funclets (which must return to it).
68 switch (Pers) {
73 return true;
74 default:
75 return false;
76 }
77 llvm_unreachable("invalid enum");
78}
79
80/// Returns true if this personality uses scope-style EH IR instructions:
81/// catchswitch, catchpad/ret, and cleanuppad/ret.
83 switch (Pers) {
90 return true;
91 default:
92 return false;
93 }
94 llvm_unreachable("invalid enum");
95}
96
97/// Return true if this personality may be safely removed if there
98/// are no invoke instructions remaining in the current function.
100 switch (Pers) {
102 return false;
103 // All known personalities currently have this behavior
104 default:
105 return true;
106 }
107 llvm_unreachable("invalid enum");
108}
109
111
113
114/// If an EH funclet personality is in use (see isFuncletEHPersonality),
115/// this will recompute which blocks are in which funclet. It is possible that
116/// some blocks are in multiple funclets. Consider this analysis to be
117/// expensive.
119
120} // end namespace llvm
121
122#endif // LLVM_IR_EHPERSONALITIES_H
#define LLVM_ABI
Definition Compiler.h:215
This file defines the DenseMap class.
#define F(x, y, z)
Definition MD5.cpp:54
#define T
LLVM Basic Block Representation.
Definition BasicBlock.h:62
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
LLVM Value Representation.
Definition Value.h:75
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI StringRef getEHPersonalityName(EHPersonality Pers)
@ Unknown
Not known to have no common set bits.
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)