Move more code back to 2.5 APIs.
[oota-llvm.git] / lib / Transforms / IPO / LowerSetJmp.cpp
index 980123af57e3f947fa564fb13b8e03cdadc25575..3a65ac7a8f596ab6a1c26b705f4b13c0412f89c0 100644 (file)
@@ -201,9 +201,8 @@ bool LowerSetJmp::runOnModule(Module& M) {
 // This function is always successful, unless it isn't.
 bool LowerSetJmp::doInitialization(Module& M)
 {
-  LLVMContext &Context = M.getContext();
-  const Type *SBPTy = Context.getPointerTypeUnqual(Type::Int8Ty);
-  const Type *SBPPTy = Context.getPointerTypeUnqual(SBPTy);
+  const Type *SBPTy = PointerType::getUnqual(Type::Int8Ty);
+  const Type *SBPPTy = PointerType::getUnqual(SBPTy);
 
   // N.B. See llvm/runtime/GCCLibraries/libexception/SJLJ-Exception.h for
   // a description of the following library functions.
@@ -259,7 +258,7 @@ bool LowerSetJmp::IsTransformableFunction(const std::string& Name) {
 // throwing the exception for us.
 void LowerSetJmp::TransformLongJmpCall(CallInst* Inst)
 {
-  const Type* SBPTy = Inst->getContext().getPointerTypeUnqual(Type::Int8Ty);
+  const Type* SBPTy = PointerType::getUnqual(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
@@ -290,8 +289,7 @@ void LowerSetJmp::TransformLongJmpCall(CallInst* Inst)
     Removed = &BB->back();
     // If the removed instructions have any users, replace them now.
     if (!Removed->use_empty())
-      Removed->replaceAllUsesWith(
-        Inst->getContext().getUndef(Removed->getType()));
+      Removed->replaceAllUsesWith(UndefValue::get(Removed->getType()));
     Removed->eraseFromParent();
   } while (Removed != Inst);
 
@@ -312,7 +310,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 = Func->getContext().getPointerTypeUnqual(Type::Int8Ty);
+  const Type *SBPTy = PointerType::getUnqual(Type::Int8Ty);
   AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst);
   CallInst::Create(InitSJMap, Map, "", Inst);
   return SJMap[Func] = Map;
@@ -378,7 +376,7 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
   Function* Func = ABlock->getParent();
 
   // Add this setjmp to the setjmp map.
-  const Type* SBPTy = Inst->getContext().getPointerTypeUnqual(Type::Int8Ty);
+  const Type* SBPTy = PointerType::getUnqual(Type::Int8Ty);
   CastInst* BufPtr = 
     new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst);
   std::vector<Value*> Args =