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 {
34 /// \brief See if the given exception handling personality function is one
35 /// that we understand. If so, return a description of it; otherwise return
37 EHPersonality classifyEHPersonality(const Value *Pers);
39 /// \brief Returns true if this personality function catches asynchronous
41 inline bool isAsynchronousEHPersonality(EHPersonality Pers) {
42 // The two SEH personality functions can catch asynch exceptions. We assume
43 // unknown personalities don't catch asynch exceptions.
45 case EHPersonality::MSVC_X86SEH:
46 case EHPersonality::MSVC_Win64SEH:
51 llvm_unreachable("invalid enum");
54 /// \brief Returns true if this is a personality function that invokes
55 /// handler funclets (which must return to it).
56 inline bool isFuncletEHPersonality(EHPersonality Pers) {
58 case EHPersonality::MSVC_CXX:
59 case EHPersonality::MSVC_X86SEH:
60 case EHPersonality::MSVC_Win64SEH:
61 case EHPersonality::CoreCLR:
66 llvm_unreachable("invalid enum");
69 /// \brief Return true if this personality may be safely removed if there
70 /// are no invoke instructions remaining in the current function.
71 inline bool isNoOpWithoutInvoke(EHPersonality Pers) {
73 case EHPersonality::Unknown:
75 // All known personalities currently have this behavior
79 llvm_unreachable("invalid enum");
82 bool canSimplifyInvokeNoUnwind(const Function *F);
84 typedef TinyPtrVector<BasicBlock *> ColorVector;
86 /// \brief If an EH funclet personality is in use (see isFuncletEHPersonality),
87 /// this will recompute which blocks are in which funclet. It is possible that
88 /// some blocks are in multiple funclets. Consider this analysis to be
90 DenseMap<BasicBlock *, ColorVector> colorEHFunclets(Function &F);
92 } // end namespace llvm