1 //===- LibCallSemantics.h - Describe library semantics --------------------===//
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 // This file defines interfaces that can be used to describe language specific
11 // runtime library interfaces (e.g. libc, libm, etc) to LLVM optimizers.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_ANALYSIS_LIBCALLSEMANTICS_H
16 #define LLVM_ANALYSIS_LIBCALLSEMANTICS_H
18 #include "llvm/Analysis/AliasAnalysis.h"
23 enum class EHPersonality {
35 /// \brief See if the given exception handling personality function is one
36 /// that we understand. If so, return a description of it; otherwise return
38 EHPersonality classifyEHPersonality(const Value *Pers);
40 /// \brief Returns true if this personality function catches asynchronous
42 inline bool isAsynchronousEHPersonality(EHPersonality Pers) {
43 // The two SEH personality functions can catch asynch exceptions. We assume
44 // unknown personalities don't catch asynch exceptions.
46 case EHPersonality::MSVC_X86SEH:
47 case EHPersonality::MSVC_Win64SEH:
49 default: return false;
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:
63 default: return false;
65 llvm_unreachable("invalid enum");
68 /// \brief Return true if this personality may be safely removed if there
69 /// are no invoke instructions remaining in the current function.
70 inline bool isNoOpWithoutInvoke(EHPersonality Pers) {
72 case EHPersonality::Unknown:
74 // All known personalities currently have this behavior
77 llvm_unreachable("invalid enum");
80 bool canSimplifyInvokeNoUnwind(const Function *F);
82 } // end namespace llvm