1 //===- EHPersonalities.h - Compute EH-related information -----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_ANALYSIS_EHPERSONALITIES_H
11 #define LLVM_ANALYSIS_EHPERSONALITIES_H
13 #include "llvm/Support/ErrorHandling.h"
19 enum class EHPersonality {
31 /// \brief See if the given exception handling personality function is one
32 /// that we understand. If so, return a description of it; otherwise return
34 EHPersonality classifyEHPersonality(const Value *Pers);
36 /// \brief Returns true if this personality function catches asynchronous
38 inline bool isAsynchronousEHPersonality(EHPersonality Pers) {
39 // The two SEH personality functions can catch asynch exceptions. We assume
40 // unknown personalities don't catch asynch exceptions.
42 case EHPersonality::MSVC_X86SEH:
43 case EHPersonality::MSVC_Win64SEH:
48 llvm_unreachable("invalid enum");
51 /// \brief Returns true if this is a personality function that invokes
52 /// handler funclets (which must return to it).
53 inline bool isFuncletEHPersonality(EHPersonality Pers) {
55 case EHPersonality::MSVC_CXX:
56 case EHPersonality::MSVC_X86SEH:
57 case EHPersonality::MSVC_Win64SEH:
58 case EHPersonality::CoreCLR:
63 llvm_unreachable("invalid enum");
66 /// \brief Return true if this personality may be safely removed if there
67 /// are no invoke instructions remaining in the current function.
68 inline bool isNoOpWithoutInvoke(EHPersonality Pers) {
70 case EHPersonality::Unknown:
72 // All known personalities currently have this behavior
76 llvm_unreachable("invalid enum");
79 bool canSimplifyInvokeNoUnwind(const Function *F);
81 } // end namespace llvm