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/ADT/DenseMap.h"
14 #include "llvm/ADT/TinyPtrVector.h"
15 #include "llvm/Support/ErrorHandling.h"
22 enum class EHPersonality {
37 /// \brief See if the given exception handling personality function is one
38 /// that we understand. If so, return a description of it; otherwise return
40 EHPersonality classifyEHPersonality(const Value *Pers);
42 /// \brief Returns true if this personality function catches asynchronous
44 inline bool isAsynchronousEHPersonality(EHPersonality Pers) {
45 // The two SEH personality functions can catch asynch exceptions. We assume
46 // unknown personalities don't catch asynch exceptions.
48 case EHPersonality::MSVC_X86SEH:
49 case EHPersonality::MSVC_Win64SEH:
54 llvm_unreachable("invalid enum");
57 /// \brief Returns true if this is a personality function that invokes
58 /// handler funclets (which must return to it).
59 inline bool isFuncletEHPersonality(EHPersonality Pers) {
61 case EHPersonality::MSVC_CXX:
62 case EHPersonality::MSVC_X86SEH:
63 case EHPersonality::MSVC_Win64SEH:
64 case EHPersonality::CoreCLR:
69 llvm_unreachable("invalid enum");
72 /// \brief Return true if this personality may be safely removed if there
73 /// are no invoke instructions remaining in the current function.
74 inline bool isNoOpWithoutInvoke(EHPersonality Pers) {
76 case EHPersonality::Unknown:
78 // All known personalities currently have this behavior
82 llvm_unreachable("invalid enum");
85 bool canSimplifyInvokeNoUnwind(const Function *F);
87 typedef TinyPtrVector<BasicBlock *> ColorVector;
89 /// \brief If an EH funclet personality is in use (see isFuncletEHPersonality),
90 /// this will recompute which blocks are in which funclet. It is possible that
91 /// some blocks are in multiple funclets. Consider this analysis to be
93 DenseMap<BasicBlock *, ColorVector> colorEHFunclets(Function &F);
95 } // end namespace llvm