diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-01-23 18:49:01 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-01-23 18:49:01 +0000 |
commit | 5cc1569c548048e5427ef2c5c82de4a787c2a397 (patch) | |
tree | 1e04addd27f71eba672ba56a85dad8702fc710be /llvm/lib/CodeGen/MachineModuleInfo.cpp | |
parent | 577feba44b9552a1b68ba52e3bf36b3054b6dae7 (diff) | |
download | bcm5719-llvm-5cc1569c548048e5427ef2c5c82de4a787c2a397.tar.gz bcm5719-llvm-5cc1569c548048e5427ef2c5c82de4a787c2a397.zip |
Classify functions by EH personality type rather than using the triple
This mostly reverts commit r222062 and replaces it with a new enum. At
some point this enum will grow at least for other MSVC EH personalities.
Also beefs up the way we were sniffing the personality function.
Previously we would emit the Itanium LSDA despite using
__C_specific_handler.
Reviewers: majnemer
Differential Revision: http://reviews.llvm.org/D6987
llvm-svn: 226920
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineModuleInfo.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index b5a31925e6b..b4ce673659f 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -276,6 +276,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::None; AddrLabelSymbols = nullptr; TheModule = nullptr; @@ -554,7 +555,21 @@ 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::getPersonalityTypeSlow() { + const Function *Per = getPersonality(); + if (!Per) + PersonalityTypeCache = EHPersonality::None; + else if (Per->getName() == "__C_specific_handler") + PersonalityTypeCache = EHPersonality::Win64SEH; + else // Assume everything else is Itanium. + PersonalityTypeCache = EHPersonality::Itanium; + return PersonalityTypeCache; } /// getPersonalityIndex - Return unique index for current personality |