Move a few more APIs back to 2.5 forms.  The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index a9d218c..4eac467 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -115,8 +115,6 @@
 // doInitialization - Make sure that there is a prototype for abort in the
 // current module.
 bool LowerInvoke::doInitialization(Module &M) {
-  LLVMContext &Context = M.getContext();
-  
   const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty);
   AbortMessage = 0;
   if (ExpensiveEHSupport) {
@@ -143,7 +141,7 @@
     if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))) {
       JBListHead = new GlobalVariable(M, PtrJBList, false,
                                       GlobalValue::LinkOnceAnyLinkage,
-                                      Context.getNullValue(PtrJBList),
+                                      Constant::getNullValue(PtrJBList),
                                       "llvm.sjljeh.jblist");
     }
 
@@ -177,8 +175,6 @@
 }
 
 void LowerInvoke::createAbortMessage(Module *M) {
-  LLVMContext &Context = M->getContext();
-
   if (ExpensiveEHSupport) {
     // The abort message for expensive EH support tells the user that the
     // program 'unwound' without an 'invoke' instruction.
@@ -189,7 +185,7 @@
     GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
                                                GlobalValue::InternalLinkage,
                                                Msg, "abortmsg");
-    std::vector<Constant*> GEPIdx(2, Context.getNullValue(Type::Int32Ty));
+    std::vector<Constant*> GEPIdx(2, Constant::getNullValue(Type::Int32Ty));
     AbortMessage = ConstantExpr::getGetElementPtr(MsgGV, &GEPIdx[0], 2);
   } else {
     // The abort message for cheap EH support tells the user that EH is not
@@ -202,7 +198,7 @@
     GlobalVariable *MsgGV = new GlobalVariable(*M, Msg->getType(), true,
                                                GlobalValue::InternalLinkage,
                                                Msg, "abortmsg");
-    std::vector<Constant*> GEPIdx(2, Context.getNullValue(Type::Int32Ty));
+    std::vector<Constant*> GEPIdx(2, Constant::getNullValue(Type::Int32Ty));
     AbortMessage = ConstantExpr::getGetElementPtr(MsgGV, &GEPIdx[0], 2);
   }
 }
@@ -223,7 +219,6 @@
 }
 
 bool LowerInvoke::insertCheapEHSupport(Function &F) {
-  LLVMContext &Context = F.getContext();
   bool Changed = false;
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
     if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) {
@@ -256,7 +251,7 @@
       // Insert a return instruction.  This really should be a "barrier", as it
       // is unreachable.
       ReturnInst::Create(F.getReturnType() == Type::VoidTy ? 0 :
-                         Context.getNullValue(F.getReturnType()), UI);
+                         Constant::getNullValue(F.getReturnType()), UI);
 
       // Remove the unwind instruction now.
       BB->getInstList().erase(UI);
@@ -271,7 +266,6 @@
 void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
                                          AllocaInst *InvokeNum,
                                          SwitchInst *CatchSwitch) {
-  LLVMContext &Context = II->getContext();
   ConstantInt *InvokeNoC = ConstantInt::get(Type::Int32Ty, InvokeNo);
 
   // If the unwind edge has phi nodes, split the edge.
@@ -291,7 +285,7 @@
 
   BasicBlock::iterator NI = II->getNormalDest()->getFirstNonPHI();
   // nonvolatile.
-  new StoreInst(Context.getNullValue(Type::Int32Ty), InvokeNum, false, NI);
+  new StoreInst(Constant::getNullValue(Type::Int32Ty), InvokeNum, false, NI);
 
   // Add a switch case to our unwind block.
   CatchSwitch->addCase(InvokeNoC, II->getUnwindDest());
@@ -433,8 +427,6 @@
   std::vector<UnwindInst*> Unwinds;
   std::vector<InvokeInst*> Invokes;
 
-  LLVMContext &Context = F.getContext();
-
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
     if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
       // Remember all return instructions in case we insert an invoke into this
@@ -482,7 +474,7 @@
                      "jblink", F.begin()->begin());
 
     std::vector<Value*> Idx;
-    Idx.push_back(Context.getNullValue(Type::Int32Ty));
+    Idx.push_back(Constant::getNullValue(Type::Int32Ty));
     Idx.push_back(ConstantInt::get(Type::Int32Ty, 1));
     OldJmpBufPtr = GetElementPtrInst::Create(JmpBuf, Idx.begin(), Idx.end(),
                                              "OldBuf",
@@ -535,7 +527,7 @@
     // Compare the return value to zero.
     Value *IsNormal = new ICmpInst(EntryBB->getTerminator(),
                                    ICmpInst::ICMP_EQ, SJRet,
-                                   Context.getNullValue(SJRet->getType()),
+                                   Constant::getNullValue(SJRet->getType()),
                                    "notunwind");
     // Nuke the uncond branch.
     EntryBB->getTerminator()->eraseFromParent();
@@ -569,14 +561,14 @@
 
   // Load the JBList, if it's null, then there was no catch!
   Value *NotNull = new ICmpInst(*UnwindHandler, ICmpInst::ICMP_NE, BufPtr,
-                                Context.getNullValue(BufPtr->getType()),
+                                Constant::getNullValue(BufPtr->getType()),
                                 "notnull");
   BranchInst::Create(UnwindBlock, TermBlock, NotNull, UnwindHandler);
 
   // Create the block to do the longjmp.
   // Get a pointer to the jmpbuf and longjmp.
   std::vector<Value*> Idx;
-  Idx.push_back(Context.getNullValue(Type::Int32Ty));
+  Idx.push_back(Constant::getNullValue(Type::Int32Ty));
   Idx.push_back(ConstantInt::get(Type::Int32Ty, 0));
   Idx[0] = GetElementPtrInst::Create(BufPtr, Idx.begin(), Idx.end(), "JmpBuf",
                                      UnwindBlock);