X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FMachineModuleInfo.cpp;h=fca7df097b6493e4e54e02d2134bc5087864239e;hb=6de0a12927845ca49cd5cb1da9206fe503b565ec;hp=b5a31925e6b252024fd7961baa3c56eb0286aa51;hpb=4ac8ae7ea1d6043f1f75845acf7caf571f54ad40;p=oota-llvm.git diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index b5a31925e6b..fca7df097b6 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -9,6 +9,7 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/ADT/PointerUnion.h" +#include "llvm/Analysis/LibCallSemantics.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" @@ -276,6 +277,7 @@ bool MachineModuleInfo::doInitialization(Module &M) { DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false; // Always emit some info, by default "no personality" info. Personalities.push_back(nullptr); + PersonalityTypeCache = EHPersonality::Unknown; AddrLabelSymbols = nullptr; TheModule = nullptr; @@ -554,9 +556,17 @@ try_next:; /// getPersonality - Return the personality function for the current function. const Function *MachineModuleInfo::getPersonality() const { - return !LandingPads.empty() ? LandingPads[0].Personality : nullptr; + for (const LandingPadInfo &LPI : LandingPads) + if (LPI.Personality) + return LPI.Personality; + return nullptr; } +EHPersonality MachineModuleInfo::getPersonalityType() { + if (PersonalityTypeCache == EHPersonality::Unknown) + PersonalityTypeCache = classifyEHPersonality(getPersonality()); + return PersonalityTypeCache; +} /// getPersonalityIndex - Return unique index for current personality /// function. NULL/first personality function should always get zero index. unsigned MachineModuleInfo::getPersonalityIndex() const {