summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-08-31 20:02:16 +0000
committerReid Kleckner <rnk@google.com>2015-08-31 20:02:16 +0000
commite00faf8ce17a6ec31117a1dedb8ae506883d8232 (patch)
tree2c49aafbec193b096d78d7350aefa447341b5b4a /llvm/lib/CodeGen/MachineModuleInfo.cpp
parent5f912d3797bc253a86712e2677cd3d983d81de55 (diff)
downloadbcm5719-llvm-e00faf8ce17a6ec31117a1dedb8ae506883d8232.tar.gz
bcm5719-llvm-e00faf8ce17a6ec31117a1dedb8ae506883d8232.zip
[EH] Handle non-Function personalities like unknown personalities
Also delete and simplify a lot of MachineModuleInfo code that used to be needed to handle personalities on landingpads. Now that the personality is on the LLVM Function, we no longer need to track it this way on MMI. Certainly it should not live on LandingPadInfo. llvm-svn: 246478
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp57
1 files changed, 1 insertions, 56 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 6f9721a0d35..ee5852a8f93 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -211,8 +211,6 @@ bool MachineModuleInfo::doInitialization(Module &M) {
CallsUnwindInit = false;
HasEHFunclets = false;
DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false;
- // Always emit some info, by default "no personality" info.
- Personalities.push_back(nullptr);
PersonalityTypeCache = EHPersonality::Unknown;
AddrLabelSymbols = nullptr;
TheModule = nullptr;
@@ -316,26 +314,11 @@ MCSymbol *MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) {
return LandingPadLabel;
}
-/// addPersonality - Provide the personality function for the exception
-/// information.
-void MachineModuleInfo::addPersonality(MachineBasicBlock *LandingPad,
- const Function *Personality) {
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
- LP.Personality = Personality;
- addPersonality(Personality);
-}
-
void MachineModuleInfo::addPersonality(const Function *Personality) {
for (unsigned i = 0; i < Personalities.size(); ++i)
if (Personalities[i] == Personality)
return;
-
- // If this is the first personality we're adding go
- // ahead and add it at the beginning.
- if (!Personalities[0])
- Personalities[0] = Personality;
- else
- Personalities.push_back(Personality);
+ Personalities.push_back(Personality);
}
void MachineModuleInfo::addWinEHState(MachineBasicBlock *LandingPad,
@@ -484,44 +467,6 @@ try_next:;
return FilterID;
}
-/// getPersonality - Return the personality function for the current function.
-const Function *MachineModuleInfo::getPersonality() const {
- for (const LandingPadInfo &LPI : LandingPads)
- if (LPI.Personality)
- return LPI.Personality;
- return nullptr;
-}
-
-EHPersonality MachineModuleInfo::getPersonalityType() {
- if (PersonalityTypeCache == EHPersonality::Unknown) {
- if (const Function *F = getPersonality())
- PersonalityTypeCache = classifyEHPersonality(F);
- }
- return PersonalityTypeCache;
-}
-
-/// getPersonalityIndex - Return unique index for current personality
-/// function. NULL/first personality function should always get zero index.
-unsigned MachineModuleInfo::getPersonalityIndex() const {
- const Function* Personality = nullptr;
-
- // Scan landing pads. If there is at least one non-NULL personality - use it.
- for (unsigned i = 0, e = LandingPads.size(); i != e; ++i)
- if (LandingPads[i].Personality) {
- Personality = LandingPads[i].Personality;
- break;
- }
-
- for (unsigned i = 0, e = Personalities.size(); i < e; ++i) {
- if (Personalities[i] == Personality)
- return i;
- }
-
- // This will happen if the current personality function is
- // in the zero index.
- return 0;
-}
-
const Function *MachineModuleInfo::getWinEHParent(const Function *F) const {
StringRef WinEHParentName =
F->getFnAttribute("wineh-parent").getValueAsString();
OpenPOWER on IntegriCloud