diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-22 00:24:57 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-22 00:24:57 +0000 |
commit | e922c0201916e0b980ab3cfe91e1413e68d55647 (patch) | |
tree | 663be741b84470d97945f01da459a3627af683fd /lib/Transforms/IPO/LowerSetJmp.cpp | |
parent | 7cf12c7efd37dc12c3ed536a3f4c373dddac2b85 (diff) |
Get rid of the Pass+Context magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/LowerSetJmp.cpp')
-rw-r--r-- | lib/Transforms/IPO/LowerSetJmp.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index bfa2bd9bc2..e5ac22e8c7 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -134,8 +134,6 @@ static RegisterPass<LowerSetJmp> X("lowersetjmp", "Lower Set Jump"); bool LowerSetJmp::runOnModule(Module& M) { bool Changed = false; - Context = &M.getContext(); - // These are what the functions are called. Function* SetJmp = M.getFunction("llvm.setjmp"); Function* LongJmp = M.getFunction("llvm.longjmp"); @@ -203,8 +201,9 @@ bool LowerSetJmp::runOnModule(Module& M) { // This function is always successful, unless it isn't. bool LowerSetJmp::doInitialization(Module& M) { - const Type *SBPTy = Context->getPointerTypeUnqual(Type::Int8Ty); - const Type *SBPPTy = Context->getPointerTypeUnqual(SBPTy); + LLVMContext &Context = M.getContext(); + const Type *SBPTy = Context.getPointerTypeUnqual(Type::Int8Ty); + const Type *SBPPTy = Context.getPointerTypeUnqual(SBPTy); // N.B. See llvm/runtime/GCCLibraries/libexception/SJLJ-Exception.h for // a description of the following library functions. @@ -260,7 +259,7 @@ bool LowerSetJmp::IsTransformableFunction(const std::string& Name) { // throwing the exception for us. void LowerSetJmp::TransformLongJmpCall(CallInst* Inst) { - const Type* SBPTy = Context->getPointerTypeUnqual(Type::Int8Ty); + const Type* SBPTy = Inst->getContext().getPointerTypeUnqual(Type::Int8Ty); // Create the call to "__llvm_sjljeh_throw_longjmp". This takes the // same parameters as "longjmp", except that the buffer is cast to a @@ -291,7 +290,8 @@ void LowerSetJmp::TransformLongJmpCall(CallInst* Inst) Removed = &BB->back(); // If the removed instructions have any users, replace them now. if (!Removed->use_empty()) - Removed->replaceAllUsesWith(Context->getUndef(Removed->getType())); + Removed->replaceAllUsesWith( + Inst->getContext().getUndef(Removed->getType())); Removed->eraseFromParent(); } while (Removed != Inst); @@ -312,7 +312,7 @@ AllocaInst* LowerSetJmp::GetSetJmpMap(Function* Func) assert(Inst && "Couldn't find even ONE instruction in entry block!"); // Fill in the alloca and call to initialize the SJ map. - const Type *SBPTy = Context->getPointerTypeUnqual(Type::Int8Ty); + const Type *SBPTy = Func->getContext().getPointerTypeUnqual(Type::Int8Ty); AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst); CallInst::Create(InitSJMap, Map, "", Inst); return SJMap[Func] = Map; @@ -378,12 +378,12 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) Function* Func = ABlock->getParent(); // Add this setjmp to the setjmp map. - const Type* SBPTy = Context->getPointerTypeUnqual(Type::Int8Ty); + const Type* SBPTy = Inst->getContext().getPointerTypeUnqual(Type::Int8Ty); CastInst* BufPtr = new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst); std::vector<Value*> Args = make_vector<Value*>(GetSetJmpMap(Func), BufPtr, - Context->getConstantInt(Type::Int32Ty, + Inst->getContext().getConstantInt(Type::Int32Ty, SetJmpIDMap[Func]++), 0); CallInst::Create(AddSJToMap, Args.begin(), Args.end(), "", Inst); @@ -430,11 +430,11 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) PHINode* PHI = PHINode::Create(Type::Int32Ty, "SetJmpReturn", Inst); // Coming from a call to setjmp, the return is 0. - PHI->addIncoming(Context->getNullValue(Type::Int32Ty), ABlock); + PHI->addIncoming(Inst->getContext().getNullValue(Type::Int32Ty), ABlock); // Add the case for this setjmp's number... SwitchValuePair SVP = GetSJSwitch(Func, GetRethrowBB(Func)); - SVP.first->addCase(Context->getConstantInt(Type::Int32Ty, + SVP.first->addCase(Inst->getContext().getConstantInt(Type::Int32Ty, SetJmpIDMap[Func] - 1), SetJmpContBlock); |