Get rid of the Pass+Context magic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index bfa2bd9..e5ac22e 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -134,8 +134,6 @@
 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 @@
 // 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 @@
 // 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 @@
     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 @@
   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 @@
   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 @@
   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);