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 {
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:
48 default: return false;
50 llvm_unreachable("invalid enum");
53 /// \brief Returns true if this is an MSVC personality function.
54 inline bool isMSVCEHPersonality(EHPersonality Pers) {
55 // The two SEH personality functions can catch asynch exceptions. We assume
56 // unknown personalities don't catch asynch exceptions.
58 case EHPersonality::MSVC_CXX:
59 case EHPersonality::MSVC_X86SEH:
60 case EHPersonality::MSVC_Win64SEH:
62 default: return false;
64 llvm_unreachable("invalid enum");
67 /// \brief Return true if this personality may be safely removed if there
68 /// are no invoke instructions remaining in the current function.
69 inline bool isNoOpWithoutInvoke(EHPersonality Pers) {
71 case EHPersonality::Unknown:
73 // All known personalities currently have this behavior
76 llvm_unreachable("invalid enum");
79 bool canSimplifyInvokeNoUnwind(const Function *F);
81 } // end namespace llvm