26 if (!
F || !
F->getValueType() || !
F->getValueType()->isFunctionTy())
27 return EHPersonality::Unknown;
30 if (
F->getParent()->getTargetTriple().isWindowsArm64EC()) {
33 Name.consume_front(
"#");
37 .
Case(
"__gnat_eh_personality", EHPersonality::GNU_Ada)
38 .
Case(
"__gxx_personality_v0", EHPersonality::GNU_CXX)
39 .
Case(
"__gxx_personality_seh0", EHPersonality::GNU_CXX)
40 .
Case(
"__gxx_personality_sj0", EHPersonality::GNU_CXX_SjLj)
41 .
Case(
"__gcc_personality_v0", EHPersonality::GNU_C)
42 .
Case(
"__gcc_personality_seh0", EHPersonality::GNU_C)
43 .
Case(
"__gcc_personality_sj0", EHPersonality::GNU_C_SjLj)
44 .
Case(
"__objc_personality_v0", EHPersonality::GNU_ObjC)
45 .
Case(
"_except_handler3", EHPersonality::MSVC_X86SEH)
46 .
Case(
"_except_handler4", EHPersonality::MSVC_X86SEH)
47 .
Case(
"__C_specific_handler", EHPersonality::MSVC_TableSEH)
48 .
Case(
"__CxxFrameHandler3", EHPersonality::MSVC_CXX)
49 .
Case(
"ProcessCLRException", EHPersonality::CoreCLR)
50 .
Case(
"rust_eh_personality", EHPersonality::Rust)
51 .
Case(
"__gxx_wasm_personality_v0", EHPersonality::Wasm_CXX)
52 .
Case(
"__xlcxx_personality_v1", EHPersonality::XL_CXX)
53 .
Case(
"__zos_cxx_personality_v2", EHPersonality::ZOS_CXX)
54 .
Default(EHPersonality::Unknown);
59 case EHPersonality::GNU_Ada:
60 return "__gnat_eh_personality";
61 case EHPersonality::GNU_CXX:
62 return "__gxx_personality_v0";
63 case EHPersonality::GNU_CXX_SjLj:
64 return "__gxx_personality_sj0";
65 case EHPersonality::GNU_C:
66 return "__gcc_personality_v0";
67 case EHPersonality::GNU_C_SjLj:
68 return "__gcc_personality_sj0";
69 case EHPersonality::GNU_ObjC:
70 return "__objc_personality_v0";
71 case EHPersonality::MSVC_X86SEH:
72 return "_except_handler3";
73 case EHPersonality::MSVC_TableSEH:
74 return "__C_specific_handler";
75 case EHPersonality::MSVC_CXX:
76 return "__CxxFrameHandler3";
77 case EHPersonality::CoreCLR:
78 return "ProcessCLRException";
79 case EHPersonality::Rust:
80 return "rust_eh_personality";
81 case EHPersonality::Wasm_CXX:
82 return "__gxx_wasm_personality_v0";
83 case EHPersonality::XL_CXX:
84 return "__xlcxx_personality_v1";
85 case EHPersonality::ZOS_CXX:
86 return "__zos_cxx_personality_v2";
87 case EHPersonality::Unknown:
96 return EHPersonality::GNU_CXX;
98 return EHPersonality::GNU_C;
109 bool EHa = M->getModuleFlag(
"eh-asynch");
129 dbgs() <<
"\nColoring funclets for " <<
F.getName() <<
"\n");
131 Worklist.
push_back({EntryBlock, EntryBlock});
133 while (!Worklist.
empty()) {
138 dbgs() <<
"Visiting " << Visiting->
getName() <<
", "
139 << Color->getName() <<
"\n");
141 if (VisitingHead->isEHPad()) {
153 dbgs() <<
" Assigned color \'" << Color->getName()
154 <<
"\' to block \'" << Visiting->
getName()
159 if (
auto *CatchRet = dyn_cast<CatchReturnInst>(Terminator)) {
160 Value *ParentPad = CatchRet->getCatchSwitchParentPad();
161 if (isa<ConstantTokenNone>(ParentPad))
162 SuccColor = EntryBlock;
164 SuccColor = cast<Instruction>(ParentPad)->
getParent();
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
Module.h This file contains the declarations for the Module class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
#define DEBUG_WITH_TYPE(TYPE,...)
DEBUG_WITH_TYPE macro - This macro should be used by passes to emit debug information.
LLVM Basic Block Representation.
LLVM_ABI InstListType::const_iterator getFirstNonPHIIt() const
Returns an iterator to the first instruction in this block that is not a PHINode instruction.
const Function * getParent() const
Return the enclosing method, or null if none.
InstListType::iterator iterator
Instruction iterators...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
A Module instance is used to store all the information related to an LLVM module.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
void push_back(EltTy NewVal)
Triple - Helper class for working with autoconf configuration names.
LLVM Value Representation.
LLVM_ABI const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI StringRef getEHPersonalityName(EHPersonality Pers)
auto successors(const MachineBasicBlock *BB)
LLVM_ABI DenseMap< BasicBlock *, ColorVector > colorEHFunclets(Function &F)
If an EH funclet personality is in use (see isFuncletEHPersonality), this will recompute which blocks...
LLVM_ABI bool canSimplifyInvokeNoUnwind(const Function *F)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers)
See if the given exception handling personality function is one that we understand.
bool isAsynchronousEHPersonality(EHPersonality Pers)
Returns true if this personality function catches asynchronous exceptions.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
LLVM_ABI EHPersonality getDefaultEHPersonality(const Triple &T)