diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-12-02 23:06:39 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-12-02 23:06:39 +0000 |
commit | 1114aa2fc68b45b7cc2100585081ebeba0f3f694 (patch) | |
tree | 318c3fd04ec58a141f7264935cb5e30d6a844909 /include | |
parent | 66c86b041704aa761755c031f10d4c344aef7cdc (diff) |
Move EH-specific helper functions to a more appropriate place
No functionality change is intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254562 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/EHPersonalities.h | 83 | ||||
-rw-r--r-- | include/llvm/Analysis/LibCallSemantics.h | 84 | ||||
-rw-r--r-- | include/llvm/CodeGen/MachineModuleInfo.h | 2 | ||||
-rw-r--r-- | include/llvm/CodeGen/WinEHFuncInfo.h | 1 |
4 files changed, 85 insertions, 85 deletions
diff --git a/include/llvm/Analysis/EHPersonalities.h b/include/llvm/Analysis/EHPersonalities.h new file mode 100644 index 00000000000..8d5f0f20349 --- /dev/null +++ b/include/llvm/Analysis/EHPersonalities.h @@ -0,0 +1,83 @@ +//===- EHPersonalities.h - Compute EH-related information -----------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ANALYSIS_LIBCALLSEMANTICS_H +#define LLVM_ANALYSIS_LIBCALLSEMANTICS_H + +#include "llvm/Support/ErrorHandling.h" + +namespace llvm { +class Function; +class Value; + +enum class EHPersonality { + Unknown, + GNU_Ada, + GNU_C, + GNU_CXX, + GNU_ObjC, + MSVC_X86SEH, + MSVC_Win64SEH, + MSVC_CXX, + CoreCLR +}; + +/// \brief See if the given exception handling personality function is one +/// that we understand. If so, return a description of it; otherwise return +/// Unknown. +EHPersonality classifyEHPersonality(const Value *Pers); + +/// \brief Returns true if this personality function catches asynchronous +/// exceptions. +inline bool isAsynchronousEHPersonality(EHPersonality Pers) { + // The two SEH personality functions can catch asynch exceptions. We assume + // unknown personalities don't catch asynch exceptions. + switch (Pers) { + case EHPersonality::MSVC_X86SEH: + case EHPersonality::MSVC_Win64SEH: + return true; + default: + return false; + } + llvm_unreachable("invalid enum"); +} + +/// \brief Returns true if this is a personality function that invokes +/// handler funclets (which must return to it). +inline bool isFuncletEHPersonality(EHPersonality Pers) { + switch (Pers) { + case EHPersonality::MSVC_CXX: + case EHPersonality::MSVC_X86SEH: + case EHPersonality::MSVC_Win64SEH: + case EHPersonality::CoreCLR: + return true; + default: + return false; + } + llvm_unreachable("invalid enum"); +} + +/// \brief Return true if this personality may be safely removed if there +/// are no invoke instructions remaining in the current function. +inline bool isNoOpWithoutInvoke(EHPersonality Pers) { + switch (Pers) { + case EHPersonality::Unknown: + return false; + // All known personalities currently have this behavior + default: + return true; + } + llvm_unreachable("invalid enum"); +} + +bool canSimplifyInvokeNoUnwind(const Function *F); + +} // end namespace llvm + +#endif diff --git a/include/llvm/Analysis/LibCallSemantics.h b/include/llvm/Analysis/LibCallSemantics.h deleted file mode 100644 index 14ecb55f340..00000000000 --- a/include/llvm/Analysis/LibCallSemantics.h +++ /dev/null @@ -1,84 +0,0 @@ -//===- LibCallSemantics.h - Describe library semantics --------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines interfaces that can be used to describe language specific -// runtime library interfaces (e.g. libc, libm, etc) to LLVM optimizers. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_LIBCALLSEMANTICS_H -#define LLVM_ANALYSIS_LIBCALLSEMANTICS_H - -#include "llvm/Analysis/AliasAnalysis.h" - -namespace llvm { -class InvokeInst; - - enum class EHPersonality { - Unknown, - GNU_Ada, - GNU_C, - GNU_CXX, - GNU_ObjC, - MSVC_X86SEH, - MSVC_Win64SEH, - MSVC_CXX, - CoreCLR - }; - - /// \brief See if the given exception handling personality function is one - /// that we understand. If so, return a description of it; otherwise return - /// Unknown. - EHPersonality classifyEHPersonality(const Value *Pers); - - /// \brief Returns true if this personality function catches asynchronous - /// exceptions. - inline bool isAsynchronousEHPersonality(EHPersonality Pers) { - // The two SEH personality functions can catch asynch exceptions. We assume - // unknown personalities don't catch asynch exceptions. - switch (Pers) { - case EHPersonality::MSVC_X86SEH: - case EHPersonality::MSVC_Win64SEH: - return true; - default: return false; - } - llvm_unreachable("invalid enum"); - } - - /// \brief Returns true if this is a personality function that invokes - /// handler funclets (which must return to it). - inline bool isFuncletEHPersonality(EHPersonality Pers) { - switch (Pers) { - case EHPersonality::MSVC_CXX: - case EHPersonality::MSVC_X86SEH: - case EHPersonality::MSVC_Win64SEH: - case EHPersonality::CoreCLR: - return true; - default: return false; - } - llvm_unreachable("invalid enum"); - } - - /// \brief Return true if this personality may be safely removed if there - /// are no invoke instructions remaining in the current function. - inline bool isNoOpWithoutInvoke(EHPersonality Pers) { - switch (Pers) { - case EHPersonality::Unknown: - return false; - // All known personalities currently have this behavior - default: return true; - } - llvm_unreachable("invalid enum"); - } - - bool canSimplifyInvokeNoUnwind(const Function *F); - -} // end namespace llvm - -#endif diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index fd42b46476c..43b9f5203c5 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -35,7 +35,7 @@ #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Analysis/LibCallSemantics.h" +#include "llvm/Analysis/EHPersonalities.h" #include "llvm/IR/DebugLoc.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/ValueHandle.h" diff --git a/include/llvm/CodeGen/WinEHFuncInfo.h b/include/llvm/CodeGen/WinEHFuncInfo.h index 5def70692ba..5e8bb56eb61 100644 --- a/include/llvm/CodeGen/WinEHFuncInfo.h +++ b/include/llvm/CodeGen/WinEHFuncInfo.h @@ -22,6 +22,7 @@ namespace llvm { class AllocaInst; class BasicBlock; +class CatchReturnInst; class Constant; class Function; class GlobalVariable; |