diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-15 05:43:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-15 05:43:05 +0000 |
commit | 77b398cd5f01fc69072e7d3af370d3b991dc82c4 (patch) | |
tree | eb5e5d8784107e49609b5e2782adbafd4d9a5ac0 /lib | |
parent | 41de073b0482c1b9cf40f0a80c24b17333f0d9c9 (diff) | |
download | external_llvm-77b398cd5f01fc69072e7d3af370d3b991dc82c4.zip external_llvm-77b398cd5f01fc69072e7d3af370d3b991dc82c4.tar.gz external_llvm-77b398cd5f01fc69072e7d3af370d3b991dc82c4.tar.bz2 |
Minor cleanups, give credit, remove code that should not be necessary, and
was a "major hack" :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/IPO/LowerSetJmp.cpp | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index e0d167a..fc9af5b 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -1,7 +1,7 @@ //===- LowerSetJmp.cpp - Code pertaining to lowering set/long jumps -------===// // // This file implements the lowering of setjmp and longjmp to use the -// LLVM invoke instruction as necessary. +// LLVM invoke and unwind instructions as necessary. // // Lowering of longjmp is fairly trivial. We replace the call with a // call to the LLVM library function "__llvm_sjljeh_throw_longjmp()". @@ -17,6 +17,8 @@ // original except block being executed if it isn't a longjmp except // that is handled by that function. // +// This pass was contributed to LLVM by Bill Wendling. +// //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// @@ -218,10 +220,8 @@ bool LowerSetJmp::IsTransformableFunction(const std::string& Name) { std::string SJLJEh("__llvm_sjljeh"); - if (Name.size() > SJLJEh.size()) { - std::string N(Name.begin(), Name.begin() + SJLJEh.size()); - return N != SJLJEh; - } + if (Name.size() > SJLJEh.size()) + return std::string(Name.begin(), Name.begin() + SJLJEh.size()) != SJLJEh; return true; } @@ -354,29 +354,6 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) SetJmpIDMap[Func]++), 0), "", Inst); - // FIXME: This is a nasty piece of code. We want the jump buffer to - // dominate all uses. However, we're doing unnatural things to the CFG - // which cause this dominance to be lost. The only way to guarantee we - // get it back is to place where the jump buffer is being allocated - // into the entry block. That's what this code does. The alloca for the - // jump buffer is followed by a getelementptr call. - if (GetElementPtrInst* GEP = dyn_cast<GetElementPtrInst>(Inst->getOperand(1))) - if (GEP->use_size() > 1) { - if (AllocaInst* AI = dyn_cast<AllocaInst>(GEP->getPointerOperand())) { - BasicBlock& Entry = Func->getEntryNode(); - BasicBlock::InstListType& EntryIL = Entry.getInstList(); - - Instruction* NewAI = AI->clone(); - Instruction* NewGEP = GEP->clone(); - NewAI->setName(AI->getName()); - NewGEP->setName(GEP->getName()); - EntryIL.push_front(NewGEP); - EntryIL.push_front(NewAI); - GEP->replaceAllUsesWith(NewGEP); - AI->replaceAllUsesWith(NewAI); - } - } - // Change the setjmp call into a branch statement. We'll remove the // setjmp call in a little bit. No worries. BasicBlock* SetJmpContBlock = ABlock->splitBasicBlock(Inst); |