summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJoseph Tremoulet <jotrem@microsoft.com>2015-10-06 20:28:16 +0000
committerJoseph Tremoulet <jotrem@microsoft.com>2015-10-06 20:28:16 +0000
commit2afea5438f924af932cf62e39daa4a06e298fb37 (patch)
tree6ddf7b58761a8eb26d3e00a4856588b75bc9e936 /llvm/lib/CodeGen
parenta087fd21daaa43a04c9721976bf8f57a92a4f492 (diff)
downloadbcm5719-llvm-2afea5438f924af932cf62e39daa4a06e298fb37.tar.gz
bcm5719-llvm-2afea5438f924af932cf62e39daa4a06e298fb37.zip
[WinEH] Recognize CoreCLR personality function
Summary: - Add CoreCLR to if/else ladders and switches as appropriate. - Rename isMSVCEHPersonality to isFuncletEHPersonality to better reflect what it captures. Reviewers: majnemer, andrew.w.kaylor, rnk Subscribers: pgavlin, AndyAyers, llvm-commits Differential Revision: http://reviews.llvm.org/D13449 llvm-svn: 249455
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinException.cpp8
-rw-r--r--llvm/lib/CodeGen/DwarfEHPrepare.cpp4
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp4
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp10
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp4
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp4
6 files changed, 18 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
index 7764a6e716e..4f1d5cb864a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
@@ -113,10 +113,10 @@ void WinException::endFunction(const MachineFunction *MF) {
if (F->hasPersonalityFn())
Per = classifyEHPersonality(F->getPersonalityFn());
- // Get rid of any dead landing pads if we're not using a Windows EH scheme. In
- // Windows EH schemes, the landing pad is not actually reachable. It only
- // exists so that we can emit the right table data.
- if (!isMSVCEHPersonality(Per))
+ // Get rid of any dead landing pads if we're not using funclets. In funclet
+ // schemes, the landing pad is not actually reachable. It only exists so
+ // that we can emit the right table data.
+ if (!isFuncletEHPersonality(Per))
MMI->TidyLandingPads();
endFunclet();
diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp
index e019dfbc8f7..0f6e1463f10 100644
--- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp
+++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp
@@ -192,9 +192,9 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls(Function &Fn) {
if (Resumes.empty())
return false;
- // Check the personality, don't do anything if it's for MSVC.
+ // Check the personality, don't do anything if it's funclet-based.
EHPersonality Pers = classifyEHPersonality(Fn.getPersonalityFn());
- if (isMSVCEHPersonality(Pers))
+ if (isFuncletEHPersonality(Pers))
return false;
LLVMContext &Ctx = Fn.getContext();
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 7da68deaaa3..fb455943f90 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -273,11 +273,11 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
LPads.push_back(LPI);
}
- // If this is an MSVC EH personality, we need to do a bit more work.
+ // If this personality uses funclets, we need to do a bit more work.
if (!Fn->hasPersonalityFn())
return;
EHPersonality Personality = classifyEHPersonality(Fn->getPersonalityFn());
- if (!isMSVCEHPersonality(Personality))
+ if (!isFuncletEHPersonality(Personality))
return;
if (Personality == EHPersonality::MSVC_Win64SEH ||
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index d498c547bfd..fc140f65571 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1207,8 +1207,10 @@ static void
findUnwindDestinations(FunctionLoweringInfo &FuncInfo,
const BasicBlock *EHPadBB,
SmallVectorImpl<MachineBasicBlock *> &UnwindDests) {
- bool IsMSVCCXX = classifyEHPersonality(FuncInfo.Fn->getPersonalityFn()) ==
- EHPersonality::MSVC_CXX;
+ EHPersonality Personality =
+ classifyEHPersonality(FuncInfo.Fn->getPersonalityFn());
+ bool IsMSVCCXX = Personality == EHPersonality::MSVC_CXX;
+ bool IsCoreCLR = Personality == EHPersonality::CoreCLR;
while (EHPadBB) {
const Instruction *Pad = EHPadBB->getFirstNonPHI();
if (isa<LandingPadInst>(Pad)) {
@@ -1224,8 +1226,8 @@ findUnwindDestinations(FunctionLoweringInfo &FuncInfo,
} else if (const auto *CPI = dyn_cast<CatchPadInst>(Pad)) {
// Add the catchpad handler to the possible destinations.
UnwindDests.push_back(FuncInfo.MBBMap[CPI->getNormalDest()]);
- // In MSVC C++, catchblocks are funclets and need prologues.
- if (IsMSVCCXX)
+ // In MSVC C++ and CoreCLR, catchblocks are funclets and need prologues.
+ if (IsMSVCCXX || IsCoreCLR)
UnwindDests.back()->setIsEHFuncletEntry();
EHPadBB = CPI->getUnwindDest();
} else if (const auto *CEPI = dyn_cast<CatchEndPadInst>(Pad)) {
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index c449ea8ba91..c20270d9a7e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -941,7 +941,7 @@ bool SelectionDAGISel::PrepareEHLandingPad() {
BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(), II)
.addSym(Label);
- // If this is an MSVC-style personality function, we need to split the landing
+ // If this personality function uses funclets, we need to split the landing
// pad into several BBs.
const BasicBlock *LLVMBB = MBB->getBasicBlock();
const Constant *Personality = MF->getFunction()->getPersonalityFn();
@@ -949,7 +949,7 @@ bool SelectionDAGISel::PrepareEHLandingPad() {
MF->getMMI().addPersonality(PF);
EHPersonality PersonalityType = classifyEHPersonality(Personality);
- if (isMSVCEHPersonality(PersonalityType)) {
+ if (isFuncletEHPersonality(PersonalityType)) {
SmallVector<MachineBasicBlock *, 4> ClauseBBs;
const IntrinsicInst *ActionsCall =
dyn_cast<IntrinsicInst>(LLVMBB->getFirstInsertionPt());
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index 3b6187594e9..88a639e8778 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -433,8 +433,8 @@ bool WinEHPrepare::runOnFunction(Function &Fn) {
// Classify the personality to see what kind of preparation we need.
Personality = classifyEHPersonality(Fn.getPersonalityFn());
- // Do nothing if this is not an MSVC personality.
- if (!isMSVCEHPersonality(Personality))
+ // Do nothing if this is not a funclet-based personality.
+ if (!isFuncletEHPersonality(Personality))
return false;
SmallVector<LandingPadInst *, 4> LPads;
OpenPOWER on IntegriCloud