summaryrefslogtreecommitdiff
path: root/lib/CodeGen/DwarfEHPrepare.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-07-30 05:42:50 +0000
committerBill Wendling <isanbard@gmail.com>2011-07-30 05:42:50 +0000
commit10c6d12a9fd4dab411091f64db4db69670b88850 (patch)
tree629a8bff765bcf0baa378c7367ab1d903f3910fc /lib/CodeGen/DwarfEHPrepare.cpp
parentefd7919618d59bd0e3fcf861cc0d1eacbbed0ac6 (diff)
downloadllvm-10c6d12a9fd4dab411091f64db4db69670b88850.tar.gz
llvm-10c6d12a9fd4dab411091f64db4db69670b88850.tar.bz2
llvm-10c6d12a9fd4dab411091f64db4db69670b88850.tar.xz
Revert r136253, r136263, r136269, r136313, r136325, r136326, r136329, r136338,
r136339, r136341, r136369, r136387, r136392, r136396, r136429, r136430, r136444, r136445, r136446, r136253 pending review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfEHPrepare.cpp')
-rw-r--r--lib/CodeGen/DwarfEHPrepare.cpp58
1 files changed, 1 insertions, 57 deletions
diff --git a/lib/CodeGen/DwarfEHPrepare.cpp b/lib/CodeGen/DwarfEHPrepare.cpp
index 3aa72ee196..03604b0a17 100644
--- a/lib/CodeGen/DwarfEHPrepare.cpp
+++ b/lib/CodeGen/DwarfEHPrepare.cpp
@@ -63,8 +63,6 @@ namespace {
typedef SmallPtrSet<BasicBlock*, 8> BBSet;
BBSet LandingPads;
- bool InsertUnwindResumeCalls();
-
bool NormalizeLandingPads();
bool LowerUnwindsAndResumes();
bool MoveExceptionValueCalls();
@@ -660,67 +658,13 @@ Instruction *DwarfEHPrepare::CreateExceptionValueCall(BasicBlock *BB) {
return CallInst::Create(ExceptionValueIntrinsic, "eh.value.call", Start);
}
-/// InsertUnwindResumeCalls - Convert the ResumeInsts that are still present
-/// into calls to the appropriate _Unwind_Resume function.
-bool DwarfEHPrepare::InsertUnwindResumeCalls() {
- SmallVector<ResumeInst*, 16> Resumes;
- for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
- for (BasicBlock::iterator II = I->begin(), IE = I->end(); II != IE; ++II)
- if (ResumeInst *RI = dyn_cast<ResumeInst>(II))
- Resumes.push_back(RI);
-
- if (Resumes.empty())
- return false;
-
- // Find the rewind function if we didn't already.
- if (!RewindFunction) {
- LLVMContext &Ctx = Resumes[0]->getContext();
- FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx),
- Type::getInt8PtrTy(Ctx), false);
- const char *RewindName = TLI->getLibcallName(RTLIB::UNWIND_RESUME);
- RewindFunction = F->getParent()->getOrInsertFunction(RewindName, FTy);
- }
-
- // Create the basic block where the _Unwind_Resume call will live.
- LLVMContext &Ctx = F->getContext();
- BasicBlock *UnwindBB = BasicBlock::Create(Ctx, "unwind_resume", F);
- PHINode *PN = PHINode::Create(Type::getInt8PtrTy(Ctx), Resumes.size(),
- "exn.obj", UnwindBB);
-
- // Extract the exception object from the ResumeInst and add it to the PHI node
- // that feeds the _Unwind_Resume call.
- for (SmallVectorImpl<ResumeInst*>::iterator
- I = Resumes.begin(), E = Resumes.end(); I != E; ++I) {
- ResumeInst *RI = *I;
- BranchInst::Create(UnwindBB, RI->getParent());
- ExtractValueInst *ExnObj = ExtractValueInst::Create(RI->getOperand(0),
- 0, "exn.obj", RI);
- PN->addIncoming(ExnObj, RI->getParent());
- RI->eraseFromParent();
- }
-
- // Call the function.
- CallInst *CI = CallInst::Create(RewindFunction, PN, "", UnwindBB);
- CI->setCallingConv(TLI->getLibcallCallingConv(RTLIB::UNWIND_RESUME));
-
- // We never expect _Unwind_Resume to return.
- new UnreachableInst(Ctx, UnwindBB);
- return true;
-}
-
bool DwarfEHPrepare::runOnFunction(Function &Fn) {
bool Changed = false;
// Initialize internal state.
- DT = &getAnalysis<DominatorTree>(); // FIXME: We won't need this with the new EH.
+ DT = &getAnalysis<DominatorTree>();
F = &Fn;
- if (InsertUnwindResumeCalls()) {
- // FIXME: The reset of this function can go once the new EH is done.
- LandingPads.clear();
- return true;
- }
-
// Ensure that only unwind edges end at landing pads (a landing pad is a
// basic block where an invoke unwind edge ends).
Changed |= NormalizeLandingPads();