[cfe-commits] r77514 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CGBuiltin.cpp CGCXX.cpp CGDecl.cpp CGExpr.cpp CGExprAgg.cpp CGExprConstant.cpp CGExprScalar.cpp CGObjCGNU.cpp CGObjCMac.cpp CodeGenFunction.cpp CodeGenModule.cpp TargetABIInfo.cpp

Owen Anderson resistor at mac.com
Wed Jul 29 15:16:19 PDT 2009


Author: resistor
Date: Wed Jul 29 17:16:19 2009
New Revision: 77514

URL: http://llvm.org/viewvc/llvm-project?rev=77514&view=rev
Log:
Update for LLVM API change.

Modified:
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/lib/CodeGen/TargetABIInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Jul 29 17:16:19 2009
@@ -184,12 +184,12 @@
       QualType Ty = E->getType();
       if (BDRE && BDRE->isByRef()) {
         uint64_t Align = getContext().getDeclAlignInBytes(BDRE->getDecl());
-        Types[i+5] = VMContext.getPointerType(BuildByRefType(Ty, Align), 0);
+        Types[i+5] = llvm::PointerType::get(BuildByRefType(Ty, Align), 0);
       } else
         Types[i+5] = ConvertType(Ty);
     }
 
-    llvm::StructType *Ty = VMContext.getStructType(Types, true);
+    llvm::StructType *Ty = llvm::StructType::get(Types, true);
 
     llvm::AllocaInst *A = CreateTempAlloca(Ty);
     A->setAlignment(subBlockAlign);
@@ -268,7 +268,7 @@
                                   llvm::ConstantInt::get(llvm::Type::Int64Ty,
                                                            offset),
                                     "block.literal");
-            Ty = VMContext.getPointerType(Ty, 0);
+            Ty = llvm::PointerType::get(Ty, 0);
             Loc = Builder.CreateBitCast(Loc, Ty);
             Loc = Builder.CreateLoad(Loc, false);
             // Loc = Builder.CreateBitCast(Loc, Ty);
@@ -310,7 +310,7 @@
   //   unsigned long reserved;
   //   unsigned long block_size;
   // };
-  BlockDescriptorType = VMContext.getStructType(UnsignedLongTy,
+  BlockDescriptorType = llvm::StructType::get(UnsignedLongTy,
                                               UnsignedLongTy,
                                               NULL);
 
@@ -325,7 +325,7 @@
     return GenericBlockLiteralType;
 
   const llvm::Type *BlockDescPtrTy =
-    VMContext.getPointerTypeUnqual(getBlockDescriptorType());
+    llvm::PointerType::getUnqual(getBlockDescriptorType());
 
   const llvm::IntegerType *IntTy = cast<llvm::IntegerType>(
     getTypes().ConvertType(getContext().IntTy));
@@ -337,7 +337,7 @@
   //   void (*__invoke)(void *);
   //   struct __block_descriptor *__descriptor;
   // };
-  GenericBlockLiteralType = VMContext.getStructType(PtrToInt8Ty,
+  GenericBlockLiteralType = llvm::StructType::get(PtrToInt8Ty,
                                                   IntTy,
                                                   IntTy,
                                                   PtrToInt8Ty,
@@ -355,7 +355,7 @@
     return GenericExtendedBlockLiteralType;
 
   const llvm::Type *BlockDescPtrTy =
-    VMContext.getPointerTypeUnqual(getBlockDescriptorType());
+    llvm::PointerType::getUnqual(getBlockDescriptorType());
 
   const llvm::IntegerType *IntTy = cast<llvm::IntegerType>(
     getTypes().ConvertType(getContext().IntTy));
@@ -369,7 +369,7 @@
   //   void *__copy_func_helper_decl;
   //   void *__destroy_func_decl;
   // };
-  GenericExtendedBlockLiteralType = VMContext.getStructType(PtrToInt8Ty,
+  GenericExtendedBlockLiteralType = llvm::StructType::get(PtrToInt8Ty,
                                                           IntTy,
                                                           IntTy,
                                                           PtrToInt8Ty,
@@ -392,7 +392,7 @@
 
   // Get a pointer to the generic block literal.
   const llvm::Type *BlockLiteralTy =
-    VMContext.getPointerTypeUnqual(CGM.getGenericBlockLiteralType());
+    llvm::PointerType::getUnqual(CGM.getGenericBlockLiteralType());
 
   // Bitcast the callee to a block literal.
   llvm::Value *BlockLiteral =
@@ -403,7 +403,7 @@
 
   BlockLiteral =
     Builder.CreateBitCast(BlockLiteral,
-                          VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty),
+                          llvm::PointerType::getUnqual(llvm::Type::Int8Ty),
                           "tmp");
 
   // Add the block literal.
@@ -429,7 +429,7 @@
   const llvm::Type *BlockFTy = 
     CGM.getTypes().GetFunctionType(FnInfo, false);
   
-  const llvm::Type *BlockFTyPtr = VMContext.getPointerTypeUnqual(BlockFTy);
+  const llvm::Type *BlockFTyPtr = llvm::PointerType::getUnqual(BlockFTy);
   Func = Builder.CreateBitCast(Func, BlockFTyPtr);
   
   // And call the block.
@@ -460,11 +460,11 @@
     bool needsCopyDispose = BlockRequiresCopying(E->getType());
     uint64_t Align = getContext().getDeclAlignInBytes(E->getDecl());
     const llvm::Type *PtrStructTy
-      = VMContext.getPointerType(BuildByRefType(E->getType(), Align), 0);
+      = llvm::PointerType::get(BuildByRefType(E->getType(), Align), 0);
     // The block literal will need a copy/destroy helper.
     BlockHasCopyDispose = true;
     Ty = PtrStructTy;
-    Ty = VMContext.getPointerType(Ty, 0);
+    Ty = llvm::PointerType::get(Ty, 0);
     V = Builder.CreateBitCast(V, Ty);
     V = Builder.CreateLoad(V, false);
     V = Builder.CreateStructGEP(V, 1, "forwarding");
@@ -472,7 +472,7 @@
     V = Builder.CreateBitCast(V, PtrStructTy);
     V = Builder.CreateStructGEP(V, needsCopyDispose*2 + 4, "x");
   } else {
-    Ty = VMContext.getPointerType(Ty, 0);
+    Ty = llvm::PointerType::get(Ty, 0);
     V = Builder.CreateBitCast(V, Ty);
   }
   return V;
@@ -686,7 +686,7 @@
 
   uint64_t Pad = BlockOffset - OldOffset;
   if (Pad) {
-    VMContext.getArrayType(llvm::Type::Int8Ty, Pad);
+    llvm::ArrayType::get(llvm::Type::Int8Ty, Pad);
     QualType PadTy = getContext().getConstantArrayType(getContext().CharTy,
                                                        llvm::APInt(32, Pad),
                                                        ArrayType::Normal, 0);
@@ -750,13 +750,13 @@
   if (NoteForHelperp) {
     std::vector<HelperInfo> &NoteForHelper = *NoteForHelperp;
 
-    PtrPtrT = VMContext.getPointerType(VMContext.getPointerType(T, 0), 0);
+    PtrPtrT = llvm::PointerType::get(llvm::PointerType::get(T, 0), 0);
     SrcObj = Builder.CreateBitCast(SrcObj, PtrPtrT);
     SrcObj = Builder.CreateLoad(SrcObj);
 
     llvm::Value *DstObj = CGF.GetAddrOfLocalVar(Dst);
     llvm::Type *PtrPtrT;
-    PtrPtrT = VMContext.getPointerType(VMContext.getPointerType(T, 0), 0);
+    PtrPtrT = llvm::PointerType::get(llvm::PointerType::get(T, 0), 0);
     DstObj = Builder.CreateBitCast(DstObj, PtrPtrT);
     DstObj = Builder.CreateLoad(DstObj);
 
@@ -769,7 +769,7 @@
         llvm::Value *Srcv = SrcObj;
         Srcv = Builder.CreateStructGEP(Srcv, index);
         Srcv = Builder.CreateBitCast(Srcv,
-                                     VMContext.getPointerType(PtrToInt8Ty, 0));
+                                     llvm::PointerType::get(PtrToInt8Ty, 0));
         Srcv = Builder.CreateLoad(Srcv);
 
         llvm::Value *Dstv = Builder.CreateStructGEP(DstObj, index);
@@ -830,7 +830,7 @@
 
     llvm::Value *SrcObj = CGF.GetAddrOfLocalVar(Src);
     llvm::Type *PtrPtrT;
-    PtrPtrT = VMContext.getPointerType(VMContext.getPointerType(T, 0), 0);
+    PtrPtrT = llvm::PointerType::get(llvm::PointerType::get(T, 0), 0);
     SrcObj = Builder.CreateBitCast(SrcObj, PtrPtrT);
     SrcObj = Builder.CreateLoad(SrcObj);
 
@@ -843,7 +843,7 @@
         llvm::Value *Srcv = SrcObj;
         Srcv = Builder.CreateStructGEP(Srcv, index);
         Srcv = Builder.CreateBitCast(Srcv,
-                                     VMContext.getPointerType(PtrToInt8Ty, 0));
+                                     llvm::PointerType::get(PtrToInt8Ty, 0));
         Srcv = Builder.CreateLoad(Srcv);
 
         BuildBlockRelease(Srcv, flag);
@@ -911,7 +911,7 @@
 
   // dst->x
   llvm::Value *V = CGF.GetAddrOfLocalVar(Dst);
-  V = Builder.CreateBitCast(V, VMContext.getPointerType(T, 0));
+  V = Builder.CreateBitCast(V, llvm::PointerType::get(T, 0));
   V = Builder.CreateLoad(V);
   V = Builder.CreateStructGEP(V, 6, "x");
   llvm::Value *DstObj = Builder.CreateBitCast(V, PtrToInt8Ty);
@@ -921,7 +921,7 @@
   V = Builder.CreateLoad(V);
   V = Builder.CreateBitCast(V, T);
   V = Builder.CreateStructGEP(V, 6, "x");
-  V = Builder.CreateBitCast(V, VMContext.getPointerType(PtrToInt8Ty, 0));
+  V = Builder.CreateBitCast(V, llvm::PointerType::get(PtrToInt8Ty, 0));
   llvm::Value *SrcObj = Builder.CreateLoad(V);
   
   flag |= BLOCK_BYREF_CALLER;
@@ -973,10 +973,10 @@
   CGF.StartFunction(FD, R, Fn, Args, SourceLocation());
 
   llvm::Value *V = CGF.GetAddrOfLocalVar(Src);
-  V = Builder.CreateBitCast(V, VMContext.getPointerType(T, 0));
+  V = Builder.CreateBitCast(V, llvm::PointerType::get(T, 0));
   V = Builder.CreateLoad(V);
   V = Builder.CreateStructGEP(V, 6, "x");
-  V = Builder.CreateBitCast(V, VMContext.getPointerType(PtrToInt8Ty, 0));
+  V = Builder.CreateBitCast(V, llvm::PointerType::get(PtrToInt8Ty, 0));
   V = Builder.CreateLoad(V);
 
   flag |= BLOCK_BYREF_CALLER;
@@ -1026,7 +1026,7 @@
     const llvm::Type *ResultType = llvm::Type::VoidTy;
     ArgTys.push_back(PtrToInt8Ty);
     ArgTys.push_back(llvm::Type::Int32Ty);
-    FTy = VMContext.getFunctionType(ResultType, ArgTys, false);
+    FTy = llvm::FunctionType::get(ResultType, ArgTys, false);
     CGM.BlockObjectDispose
       = CGM.CreateRuntimeFunction(FTy, "_Block_object_dispose");
   }
@@ -1041,7 +1041,7 @@
     ArgTys.push_back(PtrToInt8Ty);
     ArgTys.push_back(PtrToInt8Ty);
     ArgTys.push_back(llvm::Type::Int32Ty);
-    FTy = VMContext.getFunctionType(ResultType, ArgTys, false);
+    FTy = llvm::FunctionType::get(ResultType, ArgTys, false);
     CGM.BlockObjectAssign
       = CGM.CreateRuntimeFunction(FTy, "_Block_object_assign");
   }
@@ -1061,7 +1061,7 @@
 BlockFunction::BlockFunction(CodeGenModule &cgm, CodeGenFunction &cgf,
                              CGBuilderTy &B)
   : CGM(cgm), CGF(cgf), VMContext(cgm.getLLVMContext()), Builder(B) {
-  PtrToInt8Ty = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  PtrToInt8Ty = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
 
   BlockHasCopyDispose = false;
 }

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Wed Jul 29 17:16:19 2009
@@ -78,7 +78,7 @@
   case Builtin::BI__builtin_va_end: {
     Value *ArgValue = EmitVAListRef(E->getArg(0));
     const llvm::Type *DestType = 
-      VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+      llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
     if (ArgValue->getType() != DestType)
       ArgValue = Builder.CreateBitCast(ArgValue, DestType, 
                                        ArgValue->getName().data());
@@ -92,7 +92,7 @@
     Value *SrcPtr = EmitVAListRef(E->getArg(1));
 
     const llvm::Type *Type = 
-      VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+      llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
 
     DstPtr = Builder.CreateBitCast(DstPtr, Type);
     SrcPtr = Builder.CreateBitCast(SrcPtr, Type);
@@ -482,7 +482,7 @@
   {
     const llvm::Type *ResType[2];
     ResType[0]= ConvertType(E->getArg(1)->getType());
-    ResType[1] = VMContext.getPointerTypeUnqual(ResType[0]);
+    ResType[1] = llvm::PointerType::getUnqual(ResType[0]);
     Value *AtomF = CGM.getIntrinsic(Intrinsic::atomic_cmp_swap, ResType, 2);
     Value *OldVal = EmitScalarExpr(E->getArg(1));
     Value *PrevVal = Builder.CreateCall3(AtomF, 
@@ -637,7 +637,7 @@
   case X86::BI__builtin_ia32_psrlqi128:
   case X86::BI__builtin_ia32_psrlwi128: {
     Ops[1] = Builder.CreateZExt(Ops[1], llvm::Type::Int64Ty, "zext");
-    const llvm::Type *Ty = VMContext.getVectorType(llvm::Type::Int64Ty, 2);
+    const llvm::Type *Ty = llvm::VectorType::get(llvm::Type::Int64Ty, 2);
     llvm::Value *Zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
     Ops[1] = Builder.CreateInsertElement(VMContext.getUndef(Ty),
                                          Ops[1], Zero, "insert");
@@ -692,7 +692,7 @@
   case X86::BI__builtin_ia32_psrlqi:
   case X86::BI__builtin_ia32_psrlwi: {
     Ops[1] = Builder.CreateZExt(Ops[1], llvm::Type::Int64Ty, "zext");
-    const llvm::Type *Ty = VMContext.getVectorType(llvm::Type::Int64Ty, 1);
+    const llvm::Type *Ty = llvm::VectorType::get(llvm::Type::Int64Ty, 1);
     Ops[1] = Builder.CreateBitCast(Ops[1], Ty, "bitcast");
     const char *name = 0;
     Intrinsic::ID ID = Intrinsic::not_intrinsic;
@@ -744,7 +744,7 @@
     return Builder.CreateCall(F, &Ops[0], &Ops[0] + Ops.size(), "cmpss");
   }
   case X86::BI__builtin_ia32_ldmxcsr: {
-    llvm::Type *PtrTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+    llvm::Type *PtrTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
     Value *One = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
     Value *Tmp = Builder.CreateAlloca(llvm::Type::Int32Ty, One, "tmp");
     Builder.CreateStore(Ops[0], Tmp);
@@ -752,7 +752,7 @@
                               Builder.CreateBitCast(Tmp, PtrTy));
   }
   case X86::BI__builtin_ia32_stmxcsr: {
-    llvm::Type *PtrTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+    llvm::Type *PtrTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
     Value *One = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
     Value *Tmp = Builder.CreateAlloca(llvm::Type::Int32Ty, One, "tmp");
     One = Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse_stmxcsr),
@@ -770,8 +770,8 @@
   case X86::BI__builtin_ia32_storehps:
   case X86::BI__builtin_ia32_storelps: {
     const llvm::Type *EltTy = llvm::Type::Int64Ty;
-    llvm::Type *PtrTy = VMContext.getPointerTypeUnqual(EltTy);
-    llvm::Type *VecTy = VMContext.getVectorType(EltTy, 2);
+    llvm::Type *PtrTy = llvm::PointerType::getUnqual(EltTy);
+    llvm::Type *VecTy = llvm::VectorType::get(EltTy, 2);
     
     // cast val v2i64
     Ops[1] = Builder.CreateBitCast(Ops[1], VecTy, "cast");

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Wed Jul 29 17:16:19 2009
@@ -45,7 +45,7 @@
                              GuardVName.c_str());
   
   // Load the first byte of the guard variable.
-  const llvm::Type *PtrTy = VMContext.getPointerType(llvm::Type::Int8Ty, 0);
+  const llvm::Type *PtrTy = llvm::PointerType::get(llvm::Type::Int8Ty, 0);
   llvm::Value *V = Builder.CreateLoad(Builder.CreateBitCast(GuardV, PtrTy), 
                                       "tmp");
   
@@ -166,7 +166,7 @@
   // FIXME. Once type layout is complete, this will probably change.
   const ASTRecordLayout &Layout = 
   getContext().getASTRecordLayout(ClassDecl);
-  llvm::Type *I8Ptr = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  llvm::Type *I8Ptr = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   uint64_t Offset = Layout.getBaseClassOffset(BaseClassDecl) / 8;
   llvm::Value *OffsetVal = 
     llvm::ConstantInt::get(
@@ -177,7 +177,7 @@
     getContext().getCanonicalType(
       getContext().getTypeDeclType(const_cast<CXXRecordDecl*>(BaseClassDecl)));
   const llvm::Type *BasePtr = ConvertType(BTy);
-  BasePtr = VMContext.getPointerTypeUnqual(BasePtr);
+  BasePtr = llvm::PointerType::getUnqual(BasePtr);
   BaseValue = Builder.CreateBitCast(BaseValue, BasePtr);
   return BaseValue;
 }

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Jul 29 17:16:19 2009
@@ -194,7 +194,7 @@
   // RAUW's the GV uses of this constant will be invalid.
   const llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(D.getType());
   const llvm::Type *LPtrTy =
-    VMContext.getPointerType(LTy, D.getType().getAddressSpace());
+    llvm::PointerType::get(LTy, D.getType().getAddressSpace());
   DMEntry = llvm::ConstantExpr::getBitCast(GV, LPtrTy);
 
   // Emit global variable debug descriptor for static vars.
@@ -225,7 +225,7 @@
   bool needsCopyDispose = BlockRequiresCopying(Ty);
   std::vector<const llvm::Type *> Types(needsCopyDispose*2+5);
   const llvm::PointerType *PtrToInt8Ty
-    = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+    = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   Types[0] = PtrToInt8Ty;
   Types[1] = PtrToInt8Ty;
   Types[2] = llvm::Type::Int32Ty;
@@ -238,7 +238,7 @@
   assert((Align <= unsigned(Target.getPointerAlign(0))/8)
          && "Can't align more than pointer yet");
   Types[needsCopyDispose*2 + 4] = LTy;
-  return VMContext.getStructType(Types, false);
+  return llvm::StructType::get(Types, false);
 }
 
 /// EmitLocalBlockVarDecl - Emit code and set up an entry in LocalDeclMap for a
@@ -283,7 +283,7 @@
     if (!DidCallStackSave) {
       // Save the stack.
       const llvm::Type *LTy =
-        VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+        llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
       llvm::Value *Stack = CreateTempAlloca(LTy, "saved_stack");
       
       llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::stacksave);
@@ -306,7 +306,7 @@
     // Get the element type.
     const llvm::Type *LElemTy = ConvertTypeForMem(Ty);    
     const llvm::Type *LElemPtrTy =
-      VMContext.getPointerType(LElemTy, D.getType().getAddressSpace());
+      llvm::PointerType::get(LElemTy, D.getType().getAddressSpace());
 
     llvm::Value *VLASize = EmitVLASize(Ty);
 
@@ -376,7 +376,7 @@
   
   if (isByRef) {
     const llvm::PointerType *PtrToInt8Ty
-      = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+      = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
 
     EnsureInsertPoint();
     llvm::Value *isa_field = Builder.CreateStructGEP(DeclPtr, 0);

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Jul 29 17:16:19 2009
@@ -124,7 +124,7 @@
     llvm::Value *U = VMContext.getUndef(EltTy);
     return RValue::getComplex(std::make_pair(U, U));
   } else if (hasAggregateLLVMType(Ty)) {
-    const llvm::Type *LTy = VMContext.getPointerTypeUnqual(ConvertType(Ty));
+    const llvm::Type *LTy = llvm::PointerType::getUnqual(ConvertType(Ty));
     return RValue::getAggregate(VMContext.getUndef(LTy));
   } else {
     return RValue::get(VMContext.getUndef(ConvertType(Ty)));
@@ -140,7 +140,7 @@
 LValue CodeGenFunction::EmitUnsupportedLValue(const Expr *E,
                                               const char *Name) {
   ErrorUnsupported(E, Name);
-  llvm::Type *Ty = VMContext.getPointerTypeUnqual(ConvertType(E->getType()));
+  llvm::Type *Ty = llvm::PointerType::getUnqual(ConvertType(E->getType()));
   return LValue::MakeAddr(VMContext.getUndef(Ty),
                           E->getType().getCVRQualifiers(),
                           getContext().getObjCGCAttrKind(E->getType()),
@@ -254,7 +254,7 @@
     const llvm::PointerType *DstPtr = cast<llvm::PointerType>(Addr->getType());
     if (DstPtr->getElementType() != SrcTy) {
       const llvm::Type *MemTy = 
-        VMContext.getPointerType(SrcTy, DstPtr->getAddressSpace());
+        llvm::PointerType::get(SrcTy, DstPtr->getAddressSpace());
       Addr = Builder.CreateBitCast(Addr, MemTy, "storetmp");
     }
   }
@@ -692,7 +692,7 @@
         bool needsCopyDispose = BlockRequiresCopying(VD->getType());
         const llvm::Type *PtrStructTy = V->getType();
         const llvm::Type *Ty = PtrStructTy;
-        Ty = VMContext.getPointerType(Ty, 0);
+        Ty = llvm::PointerType::get(Ty, 0);
         V = Builder.CreateStructGEP(V, 1, "forwarding");
         V = Builder.CreateBitCast(V, Ty);
         V = Builder.CreateLoad(V, false);
@@ -875,7 +875,7 @@
   // Extend or truncate the index type to 32 or 64-bits.
   unsigned IdxBitwidth = cast<llvm::IntegerType>(Idx->getType())->getBitWidth();
   if (IdxBitwidth != LLVMPointerWidth)
-    Idx = Builder.CreateIntCast(Idx, VMContext.getIntegerType(LLVMPointerWidth),
+    Idx = Builder.CreateIntCast(Idx, llvm::IntegerType::get(LLVMPointerWidth),
                                 IdxSigned, "idxprom");
 
   // We know that the pointer points to a type of the correct size,
@@ -902,7 +902,7 @@
     
     Idx = Builder.CreateMul(Idx, InterfaceSize);
 
-    llvm::Type *i8PTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+    llvm::Type *i8PTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
     Address = Builder.CreateGEP(Builder.CreateBitCast(Base, i8PTy), 
                                 Idx, "arrayidx");
     Address = Builder.CreateBitCast(Address, Base->getType());
@@ -1037,7 +1037,7 @@
   cast<llvm::PointerType>(BaseValue->getType());
   unsigned AS = BaseTy->getAddressSpace();
   BaseValue = Builder.CreateBitCast(BaseValue,
-                                    VMContext.getPointerType(FieldTy, AS),
+                                    llvm::PointerType::get(FieldTy, AS),
                                     "tmp");
   
   llvm::Value *Idx = 
@@ -1068,7 +1068,7 @@
       cast<llvm::PointerType>(BaseValue->getType());
     unsigned AS = BaseTy->getAddressSpace();
     V = Builder.CreateBitCast(V, 
-                              VMContext.getPointerType(FieldTy, AS), 
+                              llvm::PointerType::get(FieldTy, AS), 
                               "tmp");
   }
   if (Field->getType()->isReferenceType())

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed Jul 29 17:16:19 2009
@@ -543,7 +543,7 @@
   // equal, but other compilers do this optimization, and almost every memcpy
   // implementation handles this case safely.  If there is a libc that does not
   // safely handle this, we can add a target hook.
-  const llvm::Type *BP = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   if (DestPtr->getType() != BP)
     DestPtr = Builder.CreateBitCast(DestPtr, BP, "tmp");
   if (SrcPtr->getType() != BP)
@@ -553,7 +553,7 @@
   std::pair<uint64_t, unsigned> TypeInfo = getContext().getTypeInfo(Ty);
   
   // FIXME: Handle variable sized types.
-  const llvm::Type *IntPtr = VMContext.getIntegerType(LLVMPointerWidth);
+  const llvm::Type *IntPtr = llvm::IntegerType::get(LLVMPointerWidth);
   
   // FIXME: If we have a volatile struct, the optimizer can remove what might
   // appear to be `extra' memory ops:

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Wed Jul 29 17:16:19 2009
@@ -83,7 +83,7 @@
           
           const llvm::Type *Ty = llvm::Type::Int8Ty;
           if (NumBytes > 1) 
-            Ty = CGM.getLLVMContext().getArrayType(Ty, NumBytes);
+            Ty = llvm::ArrayType::get(Ty, NumBytes);
           
           llvm::Constant *Padding = CGM.getLLVMContext().getNullValue(Ty);
           PackedElements.push_back(Padding);
@@ -251,7 +251,7 @@
 
     const llvm::Type *Ty = llvm::Type::Int8Ty;
     if (NumBytes > 1) 
-      Ty = CGM.getLLVMContext().getArrayType(Ty, NumBytes);
+      Ty = llvm::ArrayType::get(Ty, NumBytes);
 
     llvm::Constant *C = CGM.getLLVMContext().getNullValue(Ty);
     Elements.push_back(C);
@@ -434,7 +434,7 @@
       std::vector<const llvm::Type*> Types;
       for (unsigned i = 0; i < Elts.size(); ++i)
         Types.push_back(Elts[i]->getType());
-      const llvm::StructType *SType = VMContext.getStructType(Types, true);
+      const llvm::StructType *SType = llvm::StructType::get(Types, true);
       return llvm::ConstantStruct::get(SType, Elts);
     }
 
@@ -549,7 +549,7 @@
       std::vector<const llvm::Type*> Types;
       for (unsigned i = 0; i < Elts.size(); ++i)
         Types.push_back(Elts[i]->getType());
-      SType = VMContext.getStructType(Types, true);
+      SType = llvm::StructType::get(Types, true);
     }
 
     return llvm::ConstantStruct::get(SType, Elts);
@@ -572,13 +572,13 @@
     if (unsigned NumPadBytes = TotalSize - CurSize) {
       const llvm::Type *Ty = llvm::Type::Int8Ty;
       if (NumPadBytes > 1)
-        Ty = VMContext.getArrayType(Ty, NumPadBytes);
+        Ty = llvm::ArrayType::get(Ty, NumPadBytes);
 
       Elts.push_back(VMContext.getNullValue(Ty));
       Types.push_back(Ty);
     }
 
-    llvm::StructType* STy = VMContext.getStructType(Types, false);
+    llvm::StructType* STy = llvm::StructType::get(Types, false);
     return llvm::ConstantStruct::get(STy, Elts);
   }
 
@@ -609,7 +609,7 @@
 
       InsertBitfieldIntoStruct(Elts, curField, ILE->getInit(0));
       const llvm::ArrayType *RetTy =
-          VMContext.getArrayType(NV->getType(), NumElts);
+          llvm::ArrayType::get(NV->getType(), NumElts);
       return llvm::ConstantArray::get(RetTy, Elts);
     }
 
@@ -831,7 +831,7 @@
         // Apply offset if necessary.
         if (!Offset->isNullValue()) {
           const llvm::Type *Type = 
-            VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+            llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
           llvm::Constant *Casted = llvm::ConstantExpr::getBitCast(C, Type);
           Casted = llvm::ConstantExpr::getGetElementPtr(Casted, &Offset, 1);
           C = llvm::ConstantExpr::getBitCast(Casted, C->getType());

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jul 29 17:16:19 2009
@@ -452,7 +452,7 @@
     assert(SrcType->isIntegerType() && "Not ptr->ptr or int->ptr conversion?");
     // First, convert to the correct width so that we control the kind of
     // extension.
-    const llvm::Type *MiddleTy = VMContext.getIntegerType(CGF.LLVMPointerWidth);
+    const llvm::Type *MiddleTy = llvm::IntegerType::get(CGF.LLVMPointerWidth);
     bool InputSigned = SrcType->isSignedIntegerType();
     llvm::Value* IntResult =
         Builder.CreateIntCast(Src, MiddleTy, InputSigned, "conv");
@@ -707,11 +707,11 @@
           size = -size;
         Inc = llvm::ConstantInt::get(Inc->getType(), size);
         const llvm::Type *i8Ty = 
-          VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+          llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
         InVal = Builder.CreateBitCast(InVal, i8Ty);
         NextVal = Builder.CreateGEP(InVal, Inc, "add.ptr");
         llvm::Value *lhs = LV.getAddress();
-        lhs = Builder.CreateBitCast(lhs, VMContext.getPointerTypeUnqual(i8Ty));
+        lhs = Builder.CreateBitCast(lhs, llvm::PointerType::getUnqual(i8Ty));
         LV = LValue::MakeAddr(lhs, ValTy.getCVRQualifiers(), 
                               CGF.getContext().getObjCGCAttrKind(ValTy));
       }
@@ -719,7 +719,7 @@
         NextVal = Builder.CreateGEP(InVal, Inc, "ptrincdec");
     } else {
       const llvm::Type *i8Ty =
-        VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+        llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
       NextVal = Builder.CreateBitCast(InVal, i8Ty, "tmp");
       NextVal = Builder.CreateGEP(NextVal, Inc, "ptrincdec");
       NextVal = Builder.CreateBitCast(NextVal, InVal->getType());
@@ -988,11 +988,11 @@
   handerArgTypes.push_back(llvm::Type::Int64Ty);
   handerArgTypes.push_back(llvm::Type::Int8Ty);
   handerArgTypes.push_back(llvm::Type::Int8Ty);
-  llvm::FunctionType *handlerTy = VMContext.getFunctionType(llvm::Type::Int64Ty,
+  llvm::FunctionType *handlerTy = llvm::FunctionType::get(llvm::Type::Int64Ty,
       handerArgTypes, false);
   llvm::Value *handlerFunction =
     CGF.CGM.getModule().getOrInsertGlobal("__overflow_handler",
-        VMContext.getPointerTypeUnqual(handlerTy));
+        llvm::PointerType::getUnqual(handlerTy));
   handlerFunction = Builder.CreateLoad(handlerFunction);
 
   llvm::Value *handlerResult = Builder.CreateCall4(handlerFunction,
@@ -1056,7 +1056,7 @@
   if (Width < CGF.LLVMPointerWidth) {
     // Zero or sign extend the pointer value based on whether the index is
     // signed or not.
-    const llvm::Type *IdxType = VMContext.getIntegerType(CGF.LLVMPointerWidth);
+    const llvm::Type *IdxType = llvm::IntegerType::get(CGF.LLVMPointerWidth);
     if (IdxExp->getType()->isSignedIntegerType())
       Idx = Builder.CreateSExt(Idx, IdxType, "idx.ext");
     else
@@ -1070,7 +1070,7 @@
       llvm::ConstantInt::get(Idx->getType(),
                              CGF.getContext().getTypeSize(OIT) / 8);
     Idx = Builder.CreateMul(Idx, InterfaceSize);
-    const llvm::Type *i8Ty = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+    const llvm::Type *i8Ty = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
     Value *Casted = Builder.CreateBitCast(Ptr, i8Ty);
     Value *Res = Builder.CreateGEP(Casted, Idx, "add.ptr");
     return Builder.CreateBitCast(Res, Ptr->getType());
@@ -1080,7 +1080,7 @@
   // extensions. The GNU void* casts amount to no-ops since our void*
   // type is i8*, but this is future proof.
   if (ElementType->isVoidType() || ElementType->isFunctionType()) {
-    const llvm::Type *i8Ty = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+    const llvm::Type *i8Ty = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
     Value *Casted = Builder.CreateBitCast(Ptr, i8Ty);
     Value *Res = Builder.CreateGEP(Casted, Idx, "add.ptr");
     return Builder.CreateBitCast(Res, Ptr->getType());
@@ -1118,8 +1118,7 @@
     if (Width < CGF.LLVMPointerWidth) {
       // Zero or sign extend the pointer value based on whether the index is
       // signed or not.
-      const llvm::Type *IdxType =
-        VMContext.getIntegerType(CGF.LLVMPointerWidth);
+      const llvm::Type *IdxType = llvm::IntegerType::get(CGF.LLVMPointerWidth);
       if (Ops.E->getRHS()->getType()->isSignedIntegerType())
         Idx = Builder.CreateSExt(Idx, IdxType, "idx.ext");
       else
@@ -1136,7 +1135,7 @@
                                CGF.getContext().getTypeSize(OIT) / 8);
       Idx = Builder.CreateMul(Idx, InterfaceSize);
       const llvm::Type *i8Ty = 
-        VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+        llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
       Value *LHSCasted = Builder.CreateBitCast(Ops.LHS, i8Ty);
       Value *Res = Builder.CreateGEP(LHSCasted, Idx, "add.ptr");
       return Builder.CreateBitCast(Res, Ops.LHS->getType());
@@ -1147,7 +1146,7 @@
     // void* type is i8*, but this is future proof.
     if (LHSElementType->isVoidType() || LHSElementType->isFunctionType()) {
       const llvm::Type *i8Ty =
-        VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+        llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
       Value *LHSCasted = Builder.CreateBitCast(Ops.LHS, i8Ty);
       Value *Res = Builder.CreateGEP(LHSCasted, Idx, "sub.ptr");
       return Builder.CreateBitCast(Res, Ops.LHS->getType());
@@ -1614,7 +1613,7 @@
 llvm::Value *CodeGenFunction::EmitVector(llvm::Value * const *Vals, 
                                          unsigned NumVals, bool isSplat) {
   llvm::Value *Vec
-    = VMContext.getUndef(VMContext.getVectorType(Vals[0]->getType(), NumVals));
+    = VMContext.getUndef(llvm::VectorType::get(Vals[0]->getType(), NumVals));
   
   for (unsigned i = 0, e = NumVals; i != e; ++i) {
     llvm::Value *Val = isSplat ? Vals[0] : Vals[i];

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Jul 29 17:16:19 2009
@@ -213,15 +213,15 @@
   Zeros[0] = llvm::ConstantInt::get(LongTy, 0);
   Zeros[1] = Zeros[0];
   NULLPtr = VMContext.getConstantPointerNull(
-    VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty));
+    llvm::PointerType::getUnqual(llvm::Type::Int8Ty));
   // C string type.  Used in lots of places.
   PtrToInt8Ty = 
-    VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+    llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   // Get the selector Type.
   SelectorTy = cast<llvm::PointerType>(
     CGM.getTypes().ConvertType(CGM.getContext().getObjCSelType()));
 
-  PtrToIntTy = VMContext.getPointerTypeUnqual(IntTy);
+  PtrToIntTy = llvm::PointerType::getUnqual(IntTy);
   PtrTy = PtrToInt8Ty;
  
   // Object type
@@ -232,7 +232,7 @@
   std::vector<const llvm::Type*> IMPArgs;
   IMPArgs.push_back(IdTy);
   IMPArgs.push_back(SelectorTy);
-  IMPTy = VMContext.getFunctionType(IdTy, IMPArgs, true);
+  IMPTy = llvm::FunctionType::get(IdTy, IMPArgs, true);
 }
 // This has to perform the lookup every time, since posing and related
 // techniques can modify the name -> class mapping.
@@ -244,7 +244,7 @@
 
   std::vector<const llvm::Type*> Params(1, PtrToInt8Ty);
   llvm::Constant *ClassLookupFn =
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(IdTy,
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy,
                                                       Params,
                                                       true),
                               "objc_lookup_class");
@@ -254,7 +254,7 @@
 llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, Selector Sel) {
   llvm::GlobalAlias *&US = UntypedSelectors[Sel.getAsString()];
   if (US == 0)
-    US = new llvm::GlobalAlias(VMContext.getPointerTypeUnqual(SelectorTy),
+    US = new llvm::GlobalAlias(llvm::PointerType::getUnqual(SelectorTy),
                                llvm::GlobalValue::InternalLinkage,
                                ".objc_untyped_selector_alias",
                                NULL, &TheModule);
@@ -280,7 +280,7 @@
 
   // If it isn't, cache it.
   llvm::GlobalAlias *Sel = new llvm::GlobalAlias(
-          VMContext.getPointerTypeUnqual(SelectorTy),
+          llvm::PointerType::getUnqual(SelectorTy),
           llvm::GlobalValue::InternalLinkage, SelName,
           NULL, &TheModule);
   TypedSelectors[Selector] = Sel;
@@ -321,7 +321,7 @@
   Ivars.push_back(MakeConstantString(Str));
   Ivars.push_back(llvm::ConstantInt::get(IntTy, Str.size()));
   llvm::Constant *ObjCStr = MakeGlobal(
-    VMContext.getStructType(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
+    llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
     Ivars, ".objc_str");
   ConstantStrings.push_back(
       llvm::ConstantExpr::getBitCast(ObjCStr, PtrToInt8Ty));
@@ -361,10 +361,10 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(PtrTy);
     if (IsClassMessage)  {
-      classLookupFunction = CGM.CreateRuntimeFunction(VMContext.getFunctionType(
+      classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
             IdTy, Params, true), "objc_get_meta_class");
     } else {
-      classLookupFunction = CGM.CreateRuntimeFunction(VMContext.getFunctionType(
+      classLookupFunction = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
             IdTy, Params, true), "objc_get_class");
     }
     ReceiverClass = CGF.Builder.CreateCall(classLookupFunction,
@@ -393,14 +393,14 @@
   }
   // Cast the pointer to a simplified version of the class structure
   ReceiverClass = CGF.Builder.CreateBitCast(ReceiverClass, 
-      VMContext.getPointerTypeUnqual(
-        VMContext.getStructType(IdTy, IdTy, NULL)));
+      llvm::PointerType::getUnqual(
+        llvm::StructType::get(IdTy, IdTy, NULL)));
   // Get the superclass pointer
   ReceiverClass = CGF.Builder.CreateStructGEP(ReceiverClass, 1);
   // Load the superclass pointer
   ReceiverClass = CGF.Builder.CreateLoad(ReceiverClass);
   // Construct the structure used to look up the IMP
-  llvm::StructType *ObjCSuperTy = VMContext.getStructType(Receiver->getType(),
+  llvm::StructType *ObjCSuperTy = llvm::StructType::get(Receiver->getType(),
       IdTy, NULL);
   llvm::Value *ObjCSuper = CGF.Builder.CreateAlloca(ObjCSuperTy);
 
@@ -410,11 +410,11 @@
 
   // Get the IMP
   std::vector<const llvm::Type*> Params;
-  Params.push_back(VMContext.getPointerTypeUnqual(ObjCSuperTy));
+  Params.push_back(llvm::PointerType::getUnqual(ObjCSuperTy));
   Params.push_back(SelectorTy);
   llvm::Constant *lookupFunction = 
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(
-          VMContext.getPointerTypeUnqual(impType), Params, true),
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(
+          llvm::PointerType::getUnqual(impType), Params, true),
         "objc_msg_lookup_super");
 
   llvm::Value *lookupArgs[] = {ObjCSuper, cmd};
@@ -468,15 +468,15 @@
     }
     Params.push_back(self->getType());
     llvm::Constant *lookupFunction = 
-      CGM.CreateRuntimeFunction(VMContext.getFunctionType(
-          VMContext.getPointerTypeUnqual(impType), Params, true),
+      CGM.CreateRuntimeFunction(llvm::FunctionType::get(
+          llvm::PointerType::getUnqual(impType), Params, true),
         "objc_msg_lookup_sender");
 
     imp = CGF.Builder.CreateCall3(lookupFunction, Receiver, cmd, self);
   } else {
     llvm::Constant *lookupFunction = 
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(
-        VMContext.getPointerTypeUnqual(impType), Params, true),
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(
+        llvm::PointerType::getUnqual(impType), Params, true),
       "objc_msg_lookup");
 
     imp = CGF.Builder.CreateCall2(lookupFunction, Receiver, cmd);
@@ -493,10 +493,10 @@
     const llvm::SmallVectorImpl<llvm::Constant *> &MethodTypes, 
     bool isClassMethodList) {
   // Get the method structure type.  
-  llvm::StructType *ObjCMethodTy = VMContext.getStructType(
+  llvm::StructType *ObjCMethodTy = llvm::StructType::get(
     PtrToInt8Ty, // Really a selector, but the runtime creates it us.
     PtrToInt8Ty, // Method types
-    VMContext.getPointerTypeUnqual(IMPTy), //Method pointer
+    llvm::PointerType::getUnqual(IMPTy), //Method pointer
     NULL);
   std::vector<llvm::Constant*> Methods;
   std::vector<llvm::Constant*> Elements;
@@ -512,23 +512,23 @@
       Elements.push_back(
             llvm::ConstantExpr::getGetElementPtr(MethodTypes[i], Zeros, 2));
       Method = llvm::ConstantExpr::getBitCast(Method,
-          VMContext.getPointerTypeUnqual(IMPTy));
+          llvm::PointerType::getUnqual(IMPTy));
       Elements.push_back(Method);
       Methods.push_back(llvm::ConstantStruct::get(ObjCMethodTy, Elements));
     }
   }
 
   // Array of method structures
-  llvm::ArrayType *ObjCMethodArrayTy = VMContext.getArrayType(ObjCMethodTy,
+  llvm::ArrayType *ObjCMethodArrayTy = llvm::ArrayType::get(ObjCMethodTy,
                                                             Methods.size());
   llvm::Constant *MethodArray = llvm::ConstantArray::get(ObjCMethodArrayTy,
                                                          Methods);
 
   // Structure containing list pointer, array and array count
   llvm::SmallVector<const llvm::Type*, 16> ObjCMethodListFields;
-  llvm::PATypeHolder OpaqueNextTy = VMContext.getOpaqueType();
-  llvm::Type *NextPtrTy = VMContext.getPointerTypeUnqual(OpaqueNextTy);
-  llvm::StructType *ObjCMethodListTy = VMContext.getStructType(NextPtrTy, 
+  llvm::PATypeHolder OpaqueNextTy = llvm::OpaqueType::get();
+  llvm::Type *NextPtrTy = llvm::PointerType::getUnqual(OpaqueNextTy);
+  llvm::StructType *ObjCMethodListTy = llvm::StructType::get(NextPtrTy, 
       IntTy, 
       ObjCMethodArrayTy,
       NULL);
@@ -539,7 +539,7 @@
 
   Methods.clear();
   Methods.push_back(VMContext.getConstantPointerNull(
-        VMContext.getPointerTypeUnqual(ObjCMethodListTy)));
+        llvm::PointerType::getUnqual(ObjCMethodListTy)));
   Methods.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty,
         MethodTypes.size()));
   Methods.push_back(MethodArray);
@@ -554,7 +554,7 @@
     const llvm::SmallVectorImpl<llvm::Constant *>  &IvarTypes,
     const llvm::SmallVectorImpl<llvm::Constant *>  &IvarOffsets) {
   // Get the method structure type.  
-  llvm::StructType *ObjCIvarTy = VMContext.getStructType(
+  llvm::StructType *ObjCIvarTy = llvm::StructType::get(
     PtrToInt8Ty,
     PtrToInt8Ty,
     IntTy,
@@ -572,7 +572,7 @@
   }
 
   // Array of method structures
-  llvm::ArrayType *ObjCIvarArrayTy = VMContext.getArrayType(ObjCIvarTy,
+  llvm::ArrayType *ObjCIvarArrayTy = llvm::ArrayType::get(ObjCIvarTy,
       IvarNames.size());
 
   
@@ -580,7 +580,7 @@
   Elements.push_back(llvm::ConstantInt::get(IntTy, (int)IvarNames.size()));
   Elements.push_back(llvm::ConstantArray::get(ObjCIvarArrayTy, Ivars));
   // Structure containing array and array count
-  llvm::StructType *ObjCIvarListTy = VMContext.getStructType(IntTy,
+  llvm::StructType *ObjCIvarListTy = llvm::StructType::get(IntTy,
     ObjCIvarArrayTy,
     NULL);
 
@@ -602,7 +602,7 @@
   // Set up the class structure
   // Note:  Several of these are char*s when they should be ids.  This is
   // because the runtime performs this translation on load.
-  llvm::StructType *ClassTy = VMContext.getStructType(
+  llvm::StructType *ClassTy = llvm::StructType::get(
       PtrToInt8Ty,        // class_pointer
       PtrToInt8Ty,        // super_class
       PtrToInt8Ty,        // name
@@ -644,7 +644,7 @@
     const llvm::SmallVectorImpl<llvm::Constant *>  &MethodNames,
     const llvm::SmallVectorImpl<llvm::Constant *>  &MethodTypes) {
   // Get the method structure type.  
-  llvm::StructType *ObjCMethodDescTy = VMContext.getStructType(
+  llvm::StructType *ObjCMethodDescTy = llvm::StructType::get(
     PtrToInt8Ty, // Really a selector, but the runtime does the casting for us.
     PtrToInt8Ty,
     NULL);
@@ -658,11 +658,11 @@
           llvm::ConstantExpr::getGetElementPtr(MethodTypes[i], Zeros, 2));
     Methods.push_back(llvm::ConstantStruct::get(ObjCMethodDescTy, Elements));
   }
-  llvm::ArrayType *ObjCMethodArrayTy = VMContext.getArrayType(ObjCMethodDescTy,
+  llvm::ArrayType *ObjCMethodArrayTy = llvm::ArrayType::get(ObjCMethodDescTy,
       MethodNames.size());
   llvm::Constant *Array = llvm::ConstantArray::get(ObjCMethodArrayTy,
                                                      Methods);
-  llvm::StructType *ObjCMethodDescListTy = VMContext.getStructType(
+  llvm::StructType *ObjCMethodDescListTy = llvm::StructType::get(
       IntTy, ObjCMethodArrayTy, NULL);
   Methods.clear();
   Methods.push_back(llvm::ConstantInt::get(IntTy, MethodNames.size()));
@@ -672,9 +672,9 @@
 // Create the protocol list structure used in classes, categories and so on
 llvm::Constant *CGObjCGNU::GenerateProtocolList(
     const llvm::SmallVectorImpl<std::string> &Protocols) {
-  llvm::ArrayType *ProtocolArrayTy = VMContext.getArrayType(PtrToInt8Ty,
+  llvm::ArrayType *ProtocolArrayTy = llvm::ArrayType::get(PtrToInt8Ty,
       Protocols.size());
-  llvm::StructType *ProtocolListTy = VMContext.getStructType(
+  llvm::StructType *ProtocolListTy = llvm::StructType::get(
       PtrTy, //Should be a recurisve pointer, but it's always NULL here.
       LongTy,//FIXME: Should be size_t
       ProtocolArrayTy,
@@ -703,7 +703,7 @@
   llvm::Value *protocol = ExistingProtocols[PD->getNameAsString()];
   const llvm::Type *T = 
     CGM.getTypes().ConvertType(CGM.getContext().getObjCProtoType());
-  return Builder.CreateBitCast(protocol, VMContext.getPointerTypeUnqual(T));
+  return Builder.CreateBitCast(protocol, llvm::PointerType::getUnqual(T));
 }
 
 llvm::Constant *CGObjCGNU::GenerateEmptyProtocol(
@@ -718,7 +718,7 @@
     GenerateProtocolMethodList(EmptyConstantVector, EmptyConstantVector);
   // Protocols are objects containing lists of the methods implemented and
   // protocols adopted.
-  llvm::StructType *ProtocolTy = VMContext.getStructType(IdTy,
+  llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy,
       PtrToInt8Ty,
       ProtocolList->getType(),
       InstanceMethodList->getType(),
@@ -773,7 +773,7 @@
     GenerateProtocolMethodList(ClassMethodNames, ClassMethodTypes);
   // Protocols are objects containing lists of the methods implemented and
   // protocols adopted.
-  llvm::StructType *ProtocolTy = VMContext.getStructType(IdTy,
+  llvm::StructType *ProtocolTy = llvm::StructType::get(IdTy,
       PtrToInt8Ty,
       ProtocolList->getType(),
       InstanceMethodList->getType(),
@@ -843,7 +843,7 @@
   Elements.push_back(llvm::ConstantExpr::getBitCast(
         GenerateProtocolList(Protocols), PtrTy));
   Categories.push_back(llvm::ConstantExpr::getBitCast(
-        MakeGlobal(VMContext.getStructType(PtrToInt8Ty, PtrToInt8Ty, PtrTy,
+        MakeGlobal(llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, PtrTy,
             PtrTy, PtrTy, NULL), Elements), PtrTy));
 }
 
@@ -1019,8 +1019,8 @@
   const llvm::Type *SelStructPtrTy = SelectorTy;
   bool isSelOpaque = false;
   if (SelStructTy == 0) {
-    SelStructTy = VMContext.getStructType(PtrToInt8Ty, PtrToInt8Ty, NULL);
-    SelStructPtrTy = VMContext.getPointerTypeUnqual(SelStructTy);
+    SelStructTy = llvm::StructType::get(PtrToInt8Ty, PtrToInt8Ty, NULL);
+    SelStructPtrTy = llvm::PointerType::getUnqual(SelStructTy);
     isSelOpaque = true;
   }
 
@@ -1033,7 +1033,7 @@
   llvm::Constant *Statics = NULLPtr;
   // Generate statics list:
   if (ConstantStrings.size()) {
-    llvm::ArrayType *StaticsArrayTy = VMContext.getArrayType(PtrToInt8Ty,
+    llvm::ArrayType *StaticsArrayTy = llvm::ArrayType::get(PtrToInt8Ty,
         ConstantStrings.size() + 1);
     ConstantStrings.push_back(NULLPtr);
     Elements.push_back(MakeConstantString("NSConstantString",
@@ -1041,12 +1041,12 @@
     Elements.push_back(llvm::ConstantArray::get(StaticsArrayTy,
        ConstantStrings));
     llvm::StructType *StaticsListTy = 
-      VMContext.getStructType(PtrToInt8Ty, StaticsArrayTy, NULL);
+      llvm::StructType::get(PtrToInt8Ty, StaticsArrayTy, NULL);
     llvm::Type *StaticsListPtrTy =
-      VMContext.getPointerTypeUnqual(StaticsListTy);
+      llvm::PointerType::getUnqual(StaticsListTy);
     Statics = MakeGlobal(StaticsListTy, Elements, ".objc_statics");
     llvm::ArrayType *StaticsListArrayTy = 
-      VMContext.getArrayType(StaticsListPtrTy, 2);
+      llvm::ArrayType::get(StaticsListPtrTy, 2);
     Elements.clear();
     Elements.push_back(Statics);
     Elements.push_back(VMContext.getNullValue(StaticsListPtrTy));
@@ -1054,9 +1054,9 @@
     Statics = llvm::ConstantExpr::getBitCast(Statics, PtrTy);
   }
   // Array of classes, categories, and constant objects
-  llvm::ArrayType *ClassListTy = VMContext.getArrayType(PtrToInt8Ty,
+  llvm::ArrayType *ClassListTy = llvm::ArrayType::get(PtrToInt8Ty,
       Classes.size() + Categories.size()  + 2);
-  llvm::StructType *SymTabTy = VMContext.getStructType(LongTy, SelStructPtrTy,
+  llvm::StructType *SymTabTy = llvm::StructType::get(LongTy, SelStructPtrTy,
                                                      llvm::Type::Int16Ty,
                                                      llvm::Type::Int16Ty,
                                                      ClassListTy, NULL);
@@ -1089,7 +1089,7 @@
   // Number of static selectors
   Elements.push_back(llvm::ConstantInt::get(LongTy, Selectors.size() ));
   llvm::Constant *SelectorList = MakeGlobal(
-          VMContext.getArrayType(SelStructTy, Selectors.size()), Selectors,
+          llvm::ArrayType::get(SelStructTy, Selectors.size()), Selectors,
           ".objc_selector_list");
   Elements.push_back(llvm::ConstantExpr::getBitCast(SelectorList, 
     SelStructPtrTy));
@@ -1109,7 +1109,7 @@
     // type.
     if (isSelOpaque) {
       SelPtr = llvm::ConstantExpr::getBitCast(SelPtr,
-        VMContext.getPointerTypeUnqual(SelectorTy));
+        llvm::PointerType::getUnqual(SelectorTy));
     }
     (*iter).second->setAliasee(SelPtr);
   }
@@ -1126,7 +1126,7 @@
     // type.
     if (isSelOpaque) {
       SelPtr = llvm::ConstantExpr::getBitCast(SelPtr,
-        VMContext.getPointerTypeUnqual(SelectorTy));
+        llvm::PointerType::getUnqual(SelectorTy));
     }
     (*iter).second->setAliasee(SelPtr);
   }
@@ -1148,8 +1148,8 @@
 
   // The symbol table is contained in a module which has some version-checking
   // constants
-  llvm::StructType * ModuleTy = VMContext.getStructType(LongTy, LongTy,
-      PtrToInt8Ty, VMContext.getPointerTypeUnqual(SymTabTy), NULL);
+  llvm::StructType * ModuleTy = llvm::StructType::get(LongTy, LongTy,
+      PtrToInt8Ty, llvm::PointerType::getUnqual(SymTabTy), NULL);
   Elements.clear();
   // Runtime version used for compatibility checking.
   if (CGM.getContext().getLangOptions().ObjCNonFragileABI) {
@@ -1170,7 +1170,7 @@
   // Create the load function calling the runtime entry point with the module
   // structure
   llvm::Function * LoadFunction = llvm::Function::Create(
-      VMContext.getFunctionType(llvm::Type::VoidTy, false),
+      llvm::FunctionType::get(llvm::Type::VoidTy, false),
       llvm::GlobalValue::InternalLinkage, ".objc_load_function",
       &TheModule);
   llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", LoadFunction);
@@ -1178,8 +1178,8 @@
   Builder.SetInsertPoint(EntryBB);
 
   std::vector<const llvm::Type*> Params(1,
-      VMContext.getPointerTypeUnqual(ModuleTy));
-  llvm::Value *Register = CGM.CreateRuntimeFunction(VMContext.getFunctionType(
+      llvm::PointerType::getUnqual(ModuleTy));
+  llvm::Value *Register = CGM.CreateRuntimeFunction(llvm::FunctionType::get(
         llvm::Type::VoidTy, Params, true), "__objc_exec_class");
   Builder.CreateCall(Register, Module);
   Builder.CreateRetVoid();
@@ -1220,7 +1220,7 @@
 	Params.push_back(BoolTy);
 	// void objc_getProperty (id, SEL, ptrdiff_t, bool)
 	const llvm::FunctionType *FTy =
-		VMContext.getFunctionType(IdTy, Params, false);
+		llvm::FunctionType::get(IdTy, Params, false);
 	return cast<llvm::Function>(CGM.CreateRuntimeFunction(FTy,
 				"objc_getProperty"));
 }
@@ -1238,7 +1238,7 @@
 	Params.push_back(BoolTy);
 	// void objc_setProperty (id, SEL, ptrdiff_t, id, bool, bool)
 	const llvm::FunctionType *FTy =
-		VMContext.getFunctionType(llvm::Type::VoidTy, Params, false);
+		llvm::FunctionType::get(llvm::Type::VoidTy, Params, false);
 	return cast<llvm::Function>(CGM.CreateRuntimeFunction(FTy,
 				"objc_setProperty"));
 }
@@ -1258,14 +1258,14 @@
                                           const Stmt &S) {
   // Pointer to the personality function
   llvm::Constant *Personality =
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::Int32Ty,
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::Int32Ty,
           true),
         "__gnu_objc_personality_v0");
   Personality = llvm::ConstantExpr::getBitCast(Personality, PtrTy);
   std::vector<const llvm::Type*> Params;
   Params.push_back(PtrTy);
   llvm::Value *RethrowFn =
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::VoidTy,
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
           Params, false), "_Unwind_Resume_or_Rethrow");
 
   bool isTry = isa<ObjCAtTryStmt>(S);
@@ -1281,7 +1281,7 @@
   if (!isTry) {
     std::vector<const llvm::Type*> Args(1, IdTy);
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(llvm::Type::VoidTy, Args, false);
+      llvm::FunctionType::get(llvm::Type::VoidTy, Args, false);
     llvm::Value *SyncEnter = CGM.CreateRuntimeFunction(FTy, "objc_sync_enter");
     llvm::Value *SyncArg = 
       CGF.EmitScalarExpr(cast<ObjCAtSynchronizedStmt>(S).getSynchExpr());
@@ -1457,7 +1457,7 @@
     // @synchronized.
     std::vector<const llvm::Type*> Args(1, IdTy);
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(llvm::Type::VoidTy, Args, false);
+      llvm::FunctionType::get(llvm::Type::VoidTy, Args, false);
     llvm::Value *SyncExit = CGM.CreateRuntimeFunction(FTy, "objc_sync_exit");
     llvm::Value *SyncArg = 
       CGF.EmitScalarExpr(cast<ObjCAtSynchronizedStmt>(S).getSynchExpr());
@@ -1487,7 +1487,7 @@
 
   std::vector<const llvm::Type*> Args(1, IdTy);
   llvm::FunctionType *FTy =
-    VMContext.getFunctionType(llvm::Type::VoidTy, Args, false);
+    llvm::FunctionType::get(llvm::Type::VoidTy, Args, false);
   llvm::Value *ThrowFn = 
     CGM.CreateRuntimeFunction(FTy, "objc_exception_throw");
   

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Wed Jul 29 17:16:19 2009
@@ -102,12 +102,12 @@
                                                llvm::Value *Offset) {
   // Compute (type*) ( (char *) BaseValue + Offset)
   llvm::LLVMContext &VMContext = CGF.getLLVMContext();
-  llvm::Type *I8Ptr = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  llvm::Type *I8Ptr = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   QualType IvarTy = Ivar->getType();
   const llvm::Type *LTy = CGF.CGM.getTypes().ConvertTypeForMem(IvarTy);
   llvm::Value *V = CGF.Builder.CreateBitCast(BaseValue, I8Ptr);
   V = CGF.Builder.CreateGEP(V, Offset, "add.ptr");
-  V = CGF.Builder.CreateBitCast(V, VMContext.getPointerTypeUnqual(LTy));
+  V = CGF.Builder.CreateBitCast(V, llvm::PointerType::getUnqual(LTy));
   
   if (Ivar->isBitField()) {
     // We need to compute the bit offset for the bit-field, the offset
@@ -150,7 +150,7 @@
     Params.push_back(ObjectPtrTy);
     Params.push_back(SelectorPtrTy);
     return
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                       Params, true),
                               "objc_msgSend");
   }
@@ -161,7 +161,7 @@
     Params.push_back(ObjectPtrTy);
     Params.push_back(SelectorPtrTy);
     return
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::VoidTy,
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
                                                       Params, true),
                               "objc_msgSend_stret");
     
@@ -174,7 +174,7 @@
     Params.push_back(ObjectPtrTy);
     Params.push_back(SelectorPtrTy);
     return
-    CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::DoubleTy,
+    CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::DoubleTy,
                                                       Params,
                                                       true),
                               "objc_msgSend_fpret");
@@ -187,7 +187,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(SuperPtrTy);
     Params.push_back(SelectorPtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, true),
                                      SuperName);
   }
@@ -198,7 +198,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(SuperPtrTy);
     Params.push_back(SelectorPtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, true),
                                      SuperName);
   }
@@ -211,7 +211,7 @@
     Params.push_back(SuperPtrTy);
     Params.push_back(SelectorPtrTy);
     return CGM.CreateRuntimeFunction(
-                                  VMContext.getFunctionType(llvm::Type::VoidTy,
+                                  llvm::FunctionType::get(llvm::Type::VoidTy,
                                                              Params, true),
                                      "objc_msgSendSuper_stret");
   }
@@ -224,7 +224,7 @@
     Params.push_back(SuperPtrTy);
     Params.push_back(SelectorPtrTy);
     return CGM.CreateRuntimeFunction(
-                                   VMContext.getFunctionType(llvm::Type::VoidTy,
+                                   llvm::FunctionType::get(llvm::Type::VoidTy,
                                                              Params, true),
                                      "objc_msgSendSuper2_stret");
   }
@@ -337,7 +337,7 @@
     std::vector<const llvm::Type*> Args;
     Args.push_back(ObjectPtrTy->getPointerTo());
     llvm::FunctionType *FTy = 
-      VMContext.getFunctionType(ObjectPtrTy, Args, false);
+      llvm::FunctionType::get(ObjectPtrTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_read_weak");
   }    
   
@@ -347,7 +347,7 @@
     std::vector<const llvm::Type*> Args(1, ObjectPtrTy);
     Args.push_back(ObjectPtrTy->getPointerTo());
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(ObjectPtrTy, Args, false);
+      llvm::FunctionType::get(ObjectPtrTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_weak");
   }
   
@@ -357,7 +357,7 @@
     std::vector<const llvm::Type*> Args(1, ObjectPtrTy);
     Args.push_back(ObjectPtrTy->getPointerTo());
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(ObjectPtrTy, Args, false);
+      llvm::FunctionType::get(ObjectPtrTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_global");
   }
   
@@ -367,7 +367,7 @@
     std::vector<const llvm::Type*> Args(1, ObjectPtrTy);
     Args.push_back(ObjectPtrTy->getPointerTo());
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(ObjectPtrTy, Args, false);
+      llvm::FunctionType::get(ObjectPtrTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_ivar");
   }
   
@@ -377,7 +377,7 @@
     std::vector<const llvm::Type*> Args(1, Int8PtrTy);
     Args.push_back(Int8PtrTy);
     Args.push_back(LongTy);
-    llvm::FunctionType *FTy = VMContext.getFunctionType(Int8PtrTy, Args, false);
+    llvm::FunctionType *FTy = llvm::FunctionType::get(Int8PtrTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_memmove_collectable");
   }
   
@@ -387,7 +387,7 @@
     std::vector<const llvm::Type*> Args(1, ObjectPtrTy);
     Args.push_back(ObjectPtrTy->getPointerTo());
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(ObjectPtrTy, Args, false);
+      llvm::FunctionType::get(ObjectPtrTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_assign_strongCast");
   }
 
@@ -396,7 +396,7 @@
     // void objc_exception_throw(id)
     std::vector<const llvm::Type*> Args(1, ObjectPtrTy);
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(llvm::Type::VoidTy, Args, false);
+      llvm::FunctionType::get(llvm::Type::VoidTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_exception_throw");
   }
   
@@ -405,7 +405,7 @@
     // void objc_sync_enter (id)
     std::vector<const llvm::Type*> Args(1, ObjectPtrTy);
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(llvm::Type::VoidTy, Args, false);
+      llvm::FunctionType::get(llvm::Type::VoidTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_sync_enter");
   }
   
@@ -414,7 +414,7 @@
     // void objc_sync_exit (id)
     std::vector<const llvm::Type*> Args(1, ObjectPtrTy);
     llvm::FunctionType *FTy =
-      VMContext.getFunctionType(llvm::Type::VoidTy, Args, false);
+      llvm::FunctionType::get(llvm::Type::VoidTy, Args, false);
     return CGM.CreateRuntimeFunction(FTy, "objc_sync_exit");
   }
   
@@ -507,9 +507,9 @@
   /// ExceptionTryEnterFn - LLVM objc_exception_try_enter function.
   llvm::Constant *getExceptionTryEnterFn() {
     std::vector<const llvm::Type*> Params;
-    Params.push_back(VMContext.getPointerTypeUnqual(ExceptionDataTy));
+    Params.push_back(llvm::PointerType::getUnqual(ExceptionDataTy));
     return CGM.CreateRuntimeFunction(
-                                   VMContext.getFunctionType(llvm::Type::VoidTy,
+                                   llvm::FunctionType::get(llvm::Type::VoidTy,
                                                              Params, false),
                                      "objc_exception_try_enter");
   }
@@ -517,9 +517,9 @@
   /// ExceptionTryExitFn - LLVM objc_exception_try_exit function.
   llvm::Constant *getExceptionTryExitFn() {
     std::vector<const llvm::Type*> Params;
-    Params.push_back(VMContext.getPointerTypeUnqual(ExceptionDataTy));
+    Params.push_back(llvm::PointerType::getUnqual(ExceptionDataTy));
     return CGM.CreateRuntimeFunction(
-                                   VMContext.getFunctionType(llvm::Type::VoidTy,
+                                   llvm::FunctionType::get(llvm::Type::VoidTy,
                                                              Params, false),
                                      "objc_exception_try_exit");
   }
@@ -527,8 +527,8 @@
   /// ExceptionExtractFn - LLVM objc_exception_extract function.
   llvm::Constant *getExceptionExtractFn() {
     std::vector<const llvm::Type*> Params;
-    Params.push_back(VMContext.getPointerTypeUnqual(ExceptionDataTy));
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    Params.push_back(llvm::PointerType::getUnqual(ExceptionDataTy));
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, false),
                                      "objc_exception_extract");
     
@@ -540,7 +540,7 @@
     Params.push_back(ClassPtrTy);
     Params.push_back(ObjectPtrTy);
    return CGM.CreateRuntimeFunction(
-                                  VMContext.getFunctionType(llvm::Type::Int32Ty,
+                                  llvm::FunctionType::get(llvm::Type::Int32Ty,
                                                             Params, false),
                                     "objc_exception_match");
     
@@ -549,9 +549,9 @@
   /// SetJmpFn - LLVM _setjmp function.
   llvm::Constant *getSetJmpFn() {
     std::vector<const llvm::Type*> Params;
-    Params.push_back(VMContext.getPointerTypeUnqual(llvm::Type::Int32Ty));
+    Params.push_back(llvm::PointerType::getUnqual(llvm::Type::Int32Ty));
     return
-      CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::Int32Ty,
+      CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::Int32Ty,
                                                         Params, false),
                                 "_setjmp");
     
@@ -643,7 +643,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(ObjectPtrTy);
     Params.push_back(MessageRefPtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, true),
                                      "objc_msgSend_fixup");
   }
@@ -653,7 +653,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(ObjectPtrTy);
     Params.push_back(MessageRefPtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, true),
                                      "objc_msgSend_fpret_fixup");
   }
@@ -663,7 +663,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(ObjectPtrTy);
     Params.push_back(MessageRefPtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, true),
                                      "objc_msgSend_stret_fixup");
   }
@@ -673,7 +673,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(ObjectPtrTy);
     Params.push_back(MessageRefPtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, true),
                                      "objc_msgSendId_fixup");
   }
@@ -683,7 +683,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(ObjectPtrTy);
     Params.push_back(MessageRefPtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                              Params, true),
                                      "objc_msgSendId_stret_fixup");
   }
@@ -693,7 +693,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(SuperPtrTy);
     Params.push_back(SuperMessageRefPtrTy);
-    return  CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return  CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                               Params, true),
                                       "objc_msgSendSuper2_fixup");
   }
@@ -704,7 +704,7 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(SuperPtrTy);
     Params.push_back(SuperMessageRefPtrTy);
-    return  CGM.CreateRuntimeFunction(VMContext.getFunctionType(ObjectPtrTy,
+    return  CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy,
                                                               Params, true),
                                       "objc_msgSendSuper2_stret_fixup");
   }
@@ -715,7 +715,7 @@
   /// exception personality function.
   llvm::Value *getEHPersonalityPtr() {
     llvm::Constant *Personality = 
-      CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::Int32Ty,
+      CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::Int32Ty,
                                                         true),
                               "__objc_personality_v0");
     return llvm::ConstantExpr::getBitCast(Personality, Int8PtrTy);
@@ -725,13 +725,13 @@
     std::vector<const llvm::Type*> Params;
     Params.push_back(Int8PtrTy);
     return CGM.CreateRuntimeFunction(
-                                   VMContext.getFunctionType(llvm::Type::VoidTy,
+                                   llvm::FunctionType::get(llvm::Type::VoidTy,
                                                              Params, false),
                                      "_Unwind_Resume_or_Rethrow");
   }
   
   llvm::Constant *getObjCEndCatchFn() {
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::VoidTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(llvm::Type::VoidTy,
                                                              false),
                                      "objc_end_catch");
     
@@ -740,7 +740,7 @@
   llvm::Constant *getObjCBeginCatchFn() {
     std::vector<const llvm::Type*> Params;
     Params.push_back(Int8PtrTy);
-    return CGM.CreateRuntimeFunction(VMContext.getFunctionType(Int8PtrTy,
+    return CGM.CreateRuntimeFunction(llvm::FunctionType::get(Int8PtrTy,
                                                              Params, false),
                                      "objc_begin_catch");
   }
@@ -1553,7 +1553,7 @@
   }
   assert(Fn && "EmitLegacyMessageSend - unknown API");
   Fn = llvm::ConstantExpr::getBitCast(Fn,
-                                        VMContext.getPointerTypeUnqual(FTy));
+                                        llvm::PointerType::getUnqual(FTy));
   return CGF.EmitCall(FnInfo, Fn, ActualArgs);
 }
 
@@ -1769,7 +1769,7 @@
   Values[1] = llvm::ConstantInt::get(ObjCTypes.LongTy,
                                        ProtocolRefs.size() - 1);
   Values[2] = 
-    llvm::ConstantArray::get(VMContext.getArrayType(ObjCTypes.ProtocolPtrTy, 
+    llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.ProtocolPtrTy, 
                                                   ProtocolRefs.size()), 
                              ProtocolRefs);
   
@@ -1815,7 +1815,7 @@
   std::vector<llvm::Constant*> Values(3);
   Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, PropertySize);
   Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Properties.size());
-  llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.PropertyTy, 
+  llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.PropertyTy, 
                                              Properties.size());
   Values[2] = llvm::ConstantArray::get(AT, Properties);
   llvm::Constant *Init = llvm::ConstantStruct::get(Values);
@@ -1855,7 +1855,7 @@
 
   std::vector<llvm::Constant*> Values(2);
   Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
-  llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodDescriptionTy, 
+  llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodDescriptionTy, 
                                              Methods.size());
   Values[1] = llvm::ConstantArray::get(AT, Methods);
   llvm::Constant *Init = llvm::ConstantStruct::get(Values);
@@ -2227,7 +2227,7 @@
 
   std::vector<llvm::Constant*> Values(2);
   Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
-  llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.IvarTy,
+  llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarTy,
                                              Ivars.size());
   Values[1] = llvm::ConstantArray::get(AT, Ivars);
   llvm::Constant *Init = llvm::ConstantStruct::get(Values);
@@ -2287,7 +2287,7 @@
   std::vector<llvm::Constant*> Values(3);
   Values[0] = VMContext.getNullValue(ObjCTypes.Int8PtrTy);
   Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
-  llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodTy,
+  llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
                                              Methods.size());
   Values[2] = llvm::ConstantArray::get(AT, Methods);
   llvm::Constant *Init = llvm::ConstantStruct::get(Values);
@@ -2851,7 +2851,7 @@
     llvm::ConstantInt::get(llvm::Type::Int32Ty, version),
     llvm::ConstantInt::get(llvm::Type::Int32Ty, flags)
   };
-  llvm::ArrayType *AT = VMContext.getArrayType(llvm::Type::Int32Ty, 2);  
+  llvm::ArrayType *AT = llvm::ArrayType::get(llvm::Type::Int32Ty, 2);  
 
   const char *Section;
   if (ObjCABI == 1)
@@ -2919,7 +2919,7 @@
                                      ObjCTypes.Int8PtrTy);
 
   Values[4] = 
-    llvm::ConstantArray::get(VMContext.getArrayType(ObjCTypes.Int8PtrTy,
+    llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.Int8PtrTy,
                                                   NumClasses + NumCategories),
                              Symbols);
 
@@ -3190,7 +3190,7 @@
   bool hasUnion = false;
   
   unsigned int WordsToScan, WordsToSkip;
-  const llvm::Type *PtrTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  const llvm::Type *PtrTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   if (CGM.getLangOptions().getGCMode() == LangOptions::NonGC)
     return VMContext.getNullValue(PtrTy);
   
@@ -3523,16 +3523,16 @@
   IntTy = Types.ConvertType(Ctx.IntTy);
   LongTy = Types.ConvertType(Ctx.LongTy);
   LongLongTy = Types.ConvertType(Ctx.LongLongTy);
-  Int8PtrTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  Int8PtrTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   
   ObjectPtrTy = Types.ConvertType(Ctx.getObjCIdType());
-  PtrObjectPtrTy = VMContext.getPointerTypeUnqual(ObjectPtrTy);
+  PtrObjectPtrTy = llvm::PointerType::getUnqual(ObjectPtrTy);
   SelectorPtrTy = Types.ConvertType(Ctx.getObjCSelType());
   
   // FIXME: It would be nice to unify this with the opaque type, so that the IR
   // comes out a bit cleaner.
   const llvm::Type *T = Types.ConvertType(Ctx.getObjCProtoType());
-  ExternalProtocolPtrTy = VMContext.getPointerTypeUnqual(T);
+  ExternalProtocolPtrTy = llvm::PointerType::getUnqual(T);
   
   // I'm not sure I like this. The implicit coordination is a bit
   // gross. We should solve this in a reasonable fashion because this
@@ -3559,13 +3559,13 @@
   SuperPtrCTy = Ctx.getPointerType(SuperCTy);
   
   SuperTy = cast<llvm::StructType>(Types.ConvertType(SuperCTy));
-  SuperPtrTy = VMContext.getPointerTypeUnqual(SuperTy); 
+  SuperPtrTy = llvm::PointerType::getUnqual(SuperTy); 
   
   // struct _prop_t {
   //   char *name;
   //   char *attributes; 
   // }
-  PropertyTy = VMContext.getStructType(Int8PtrTy, Int8PtrTy, NULL);
+  PropertyTy = llvm::StructType::get(Int8PtrTy, Int8PtrTy, NULL);
   CGM.getModule().addTypeName("struct._prop_t", 
                               PropertyTy);
   
@@ -3574,30 +3574,30 @@
   //   uint32_t count_of_properties;
   //   struct _prop_t prop_list[count_of_properties];
   // }
-  PropertyListTy = VMContext.getStructType(IntTy,
+  PropertyListTy = llvm::StructType::get(IntTy,
                                          IntTy,
-                                         VMContext.getArrayType(PropertyTy, 0),
+                                         llvm::ArrayType::get(PropertyTy, 0),
                                          NULL);
   CGM.getModule().addTypeName("struct._prop_list_t", 
                               PropertyListTy);
   // struct _prop_list_t *
-  PropertyListPtrTy = VMContext.getPointerTypeUnqual(PropertyListTy);
+  PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy);
   
   // struct _objc_method {
   //   SEL _cmd;
   //   char *method_type;
   //   char *_imp;
   // }
-  MethodTy = VMContext.getStructType(SelectorPtrTy,
+  MethodTy = llvm::StructType::get(SelectorPtrTy,
                                    Int8PtrTy,
                                    Int8PtrTy,
                                    NULL);
   CGM.getModule().addTypeName("struct._objc_method", MethodTy);
   
   // struct _objc_cache *
-  CacheTy = VMContext.getOpaqueType();
+  CacheTy = llvm::OpaqueType::get();
   CGM.getModule().addTypeName("struct._objc_cache", CacheTy);
-  CachePtrTy = VMContext.getPointerTypeUnqual(CacheTy);
+  CachePtrTy = llvm::PointerType::getUnqual(CacheTy);
 }
 
 ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) 
@@ -3608,7 +3608,7 @@
   //   char *types;
   // }
   MethodDescriptionTy = 
-    VMContext.getStructType(SelectorPtrTy,
+    llvm::StructType::get(SelectorPtrTy,
                           Int8PtrTy,
                           NULL);
   CGM.getModule().addTypeName("struct._objc_method_description", 
@@ -3619,15 +3619,15 @@
   //   struct _objc_method_description[1];
   // }
   MethodDescriptionListTy = 
-    VMContext.getStructType(IntTy,
-                          VMContext.getArrayType(MethodDescriptionTy, 0),
+    llvm::StructType::get(IntTy,
+                          llvm::ArrayType::get(MethodDescriptionTy, 0),
                           NULL);
   CGM.getModule().addTypeName("struct._objc_method_description_list", 
                               MethodDescriptionListTy);
   
   // struct _objc_method_description_list *
   MethodDescriptionListPtrTy = 
-    VMContext.getPointerTypeUnqual(MethodDescriptionListTy);
+    llvm::PointerType::getUnqual(MethodDescriptionListTy);
 
   // Protocol description structures
 
@@ -3638,7 +3638,7 @@
   //   struct _objc_property_list *instance_properties;
   // }
   ProtocolExtensionTy = 
-    VMContext.getStructType(IntTy,
+    llvm::StructType::get(IntTy,
                           MethodDescriptionListPtrTy,
                           MethodDescriptionListPtrTy,
                           PropertyListPtrTy,
@@ -3647,17 +3647,17 @@
                               ProtocolExtensionTy);
   
   // struct _objc_protocol_extension *
-  ProtocolExtensionPtrTy = VMContext.getPointerTypeUnqual(ProtocolExtensionTy);
+  ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(ProtocolExtensionTy);
 
   // Handle recursive construction of Protocol and ProtocolList types
 
-  llvm::PATypeHolder ProtocolTyHolder = VMContext.getOpaqueType();
-  llvm::PATypeHolder ProtocolListTyHolder = VMContext.getOpaqueType();
+  llvm::PATypeHolder ProtocolTyHolder = llvm::OpaqueType::get();
+  llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get();
 
   const llvm::Type *T = 
-    VMContext.getStructType(VMContext.getPointerTypeUnqual(ProtocolListTyHolder),
+    llvm::StructType::get(llvm::PointerType::getUnqual(ProtocolListTyHolder),
                           LongTy,
-                          VMContext.getArrayType(ProtocolTyHolder, 0),
+                          llvm::ArrayType::get(ProtocolTyHolder, 0),
                           NULL);
   cast<llvm::OpaqueType>(ProtocolListTyHolder.get())->refineAbstractTypeTo(T);
 
@@ -3668,9 +3668,9 @@
   //   struct _objc_method_description_list *instance_methods;
   //   struct _objc_method_description_list *class_methods;
   // }
-  T = VMContext.getStructType(ProtocolExtensionPtrTy,
+  T = llvm::StructType::get(ProtocolExtensionPtrTy,
                             Int8PtrTy,
-                           VMContext.getPointerTypeUnqual(ProtocolListTyHolder),
+                           llvm::PointerType::getUnqual(ProtocolListTyHolder),
                             MethodDescriptionListPtrTy,
                             MethodDescriptionListPtrTy,
                             NULL);
@@ -3680,11 +3680,11 @@
   CGM.getModule().addTypeName("struct._objc_protocol_list", 
                               ProtocolListTy);
   // struct _objc_protocol_list *
-  ProtocolListPtrTy = VMContext.getPointerTypeUnqual(ProtocolListTy);
+  ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy);
 
   ProtocolTy = cast<llvm::StructType>(ProtocolTyHolder.get());
   CGM.getModule().addTypeName("struct._objc_protocol", ProtocolTy);
-  ProtocolPtrTy = VMContext.getPointerTypeUnqual(ProtocolTy);
+  ProtocolPtrTy = llvm::PointerType::getUnqual(ProtocolTy);
 
   // Class description structures
 
@@ -3693,32 +3693,32 @@
   //   char *ivar_type;
   //   int  ivar_offset;
   // }
-  IvarTy = VMContext.getStructType(Int8PtrTy, 
+  IvarTy = llvm::StructType::get(Int8PtrTy, 
                                  Int8PtrTy, 
                                  IntTy, 
                                  NULL);
   CGM.getModule().addTypeName("struct._objc_ivar", IvarTy);
 
   // struct _objc_ivar_list *
-  IvarListTy = VMContext.getOpaqueType();
+  IvarListTy = llvm::OpaqueType::get();
   CGM.getModule().addTypeName("struct._objc_ivar_list", IvarListTy);
-  IvarListPtrTy = VMContext.getPointerTypeUnqual(IvarListTy);
+  IvarListPtrTy = llvm::PointerType::getUnqual(IvarListTy);
 
   // struct _objc_method_list *
-  MethodListTy = VMContext.getOpaqueType();
+  MethodListTy = llvm::OpaqueType::get();
   CGM.getModule().addTypeName("struct._objc_method_list", MethodListTy);
-  MethodListPtrTy = VMContext.getPointerTypeUnqual(MethodListTy);
+  MethodListPtrTy = llvm::PointerType::getUnqual(MethodListTy);
 
   // struct _objc_class_extension *
   ClassExtensionTy = 
-    VMContext.getStructType(IntTy,
+    llvm::StructType::get(IntTy,
                           Int8PtrTy,
                           PropertyListPtrTy,
                           NULL);
   CGM.getModule().addTypeName("struct._objc_class_extension", ClassExtensionTy);
-  ClassExtensionPtrTy = VMContext.getPointerTypeUnqual(ClassExtensionTy);
+  ClassExtensionPtrTy = llvm::PointerType::getUnqual(ClassExtensionTy);
 
-  llvm::PATypeHolder ClassTyHolder = VMContext.getOpaqueType();
+  llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get();
 
   // struct _objc_class {
   //   Class isa;
@@ -3734,8 +3734,8 @@
   //   char *ivar_layout;
   //   struct _objc_class_ext *ext;
   // };
-  T = VMContext.getStructType(VMContext.getPointerTypeUnqual(ClassTyHolder),
-                            VMContext.getPointerTypeUnqual(ClassTyHolder),
+  T = llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
+                            llvm::PointerType::getUnqual(ClassTyHolder),
                             Int8PtrTy,
                             LongTy,
                             LongTy,
@@ -3751,7 +3751,7 @@
   
   ClassTy = cast<llvm::StructType>(ClassTyHolder.get());
   CGM.getModule().addTypeName("struct._objc_class", ClassTy);
-  ClassPtrTy = VMContext.getPointerTypeUnqual(ClassTy);
+  ClassPtrTy = llvm::PointerType::getUnqual(ClassTy);
 
   // struct _objc_category {
   //   char *category_name;
@@ -3761,7 +3761,7 @@
   //   uint32_t size;  // sizeof(struct _objc_category)
   //   struct _objc_property_list *instance_properties;// category's @property
   // }
-  CategoryTy = VMContext.getStructType(Int8PtrTy,
+  CategoryTy = llvm::StructType::get(Int8PtrTy,
                                      Int8PtrTy,
                                      MethodListPtrTy,
                                      MethodListPtrTy,
@@ -3780,14 +3780,14 @@
   //   short cat_def_cnt;
   //   char *defs[cls_def_cnt + cat_def_cnt];
   // }
-  SymtabTy = VMContext.getStructType(LongTy,
+  SymtabTy = llvm::StructType::get(LongTy,
                                    SelectorPtrTy,
                                    ShortTy,
                                    ShortTy,
-                                   VMContext.getArrayType(Int8PtrTy, 0),
+                                   llvm::ArrayType::get(Int8PtrTy, 0),
                                    NULL);
   CGM.getModule().addTypeName("struct._objc_symtab", SymtabTy);
-  SymtabPtrTy = VMContext.getPointerTypeUnqual(SymtabTy);
+  SymtabPtrTy = llvm::PointerType::getUnqual(SymtabTy);
 
   // struct _objc_module {
   //   long version;
@@ -3796,7 +3796,7 @@
   //   struct _objc_symtab* symtab;
   //  }
   ModuleTy = 
-    VMContext.getStructType(LongTy,
+    llvm::StructType::get(LongTy,
                           LongTy,
                           Int8PtrTy,
                           SymtabPtrTy,
@@ -3809,11 +3809,11 @@
   uint64_t SetJmpBufferSize = 18;
  
   // Exceptions
-  const llvm::Type *StackPtrTy = VMContext.getArrayType(
-                         VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty), 4);
+  const llvm::Type *StackPtrTy = llvm::ArrayType::get(
+                         llvm::PointerType::getUnqual(llvm::Type::Int8Ty), 4);
                            
   ExceptionDataTy = 
-    VMContext.getStructType(VMContext.getArrayType(llvm::Type::Int32Ty, 
+    llvm::StructType::get(llvm::ArrayType::get(llvm::Type::Int32Ty, 
                                                SetJmpBufferSize),
                           StackPtrTy, NULL);
   CGM.getModule().addTypeName("struct._objc_exception_data", 
@@ -3829,14 +3829,14 @@
   //   uint32_t method_count;
   //   struct _objc_method method_list[method_count];
   // }
-  MethodListnfABITy = VMContext.getStructType(IntTy,
+  MethodListnfABITy = llvm::StructType::get(IntTy,
                                             IntTy,
-                                            VMContext.getArrayType(MethodTy, 0),
+                                            llvm::ArrayType::get(MethodTy, 0),
                                             NULL);
   CGM.getModule().addTypeName("struct.__method_list_t",
                               MethodListnfABITy);
   // struct method_list_t *
-  MethodListnfABIPtrTy = VMContext.getPointerTypeUnqual(MethodListnfABITy);
+  MethodListnfABIPtrTy = llvm::PointerType::getUnqual(MethodListnfABITy);
   
   // struct _protocol_t {
   //   id isa;  // NULL
@@ -3852,11 +3852,11 @@
   // }
   
   // Holder for struct _protocol_list_t *
-  llvm::PATypeHolder ProtocolListTyHolder = VMContext.getOpaqueType();
+  llvm::PATypeHolder ProtocolListTyHolder = llvm::OpaqueType::get();
   
-  ProtocolnfABITy = VMContext.getStructType(ObjectPtrTy,
+  ProtocolnfABITy = llvm::StructType::get(ObjectPtrTy,
                                           Int8PtrTy,
-                                          VMContext.getPointerTypeUnqual(
+                                          llvm::PointerType::getUnqual(
                                             ProtocolListTyHolder),
                                           MethodListnfABIPtrTy,
                                           MethodListnfABIPtrTy,
@@ -3870,14 +3870,14 @@
                               ProtocolnfABITy);
 
   // struct _protocol_t*
-  ProtocolnfABIPtrTy = VMContext.getPointerTypeUnqual(ProtocolnfABITy);
+  ProtocolnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolnfABITy);
   
   // struct _protocol_list_t {
   //   long protocol_count;   // Note, this is 32/64 bit
   //   struct _protocol_t *[protocol_count];
   // }
-  ProtocolListnfABITy = VMContext.getStructType(LongTy,
-                                              VMContext.getArrayType(
+  ProtocolListnfABITy = llvm::StructType::get(LongTy,
+                                              llvm::ArrayType::get(
                                                 ProtocolnfABIPtrTy, 0),
                                               NULL);
   CGM.getModule().addTypeName("struct._objc_protocol_list",
@@ -3886,7 +3886,7 @@
                                                       ProtocolListnfABITy);
   
   // struct _objc_protocol_list*
-  ProtocolListnfABIPtrTy = VMContext.getPointerTypeUnqual(ProtocolListnfABITy);
+  ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolListnfABITy);
   
   // struct _ivar_t {
   //   unsigned long int *offset;  // pointer to ivar offset location
@@ -3895,7 +3895,7 @@
   //   uint32_t alignment;
   //   uint32_t size;
   // }
-  IvarnfABITy = VMContext.getStructType(VMContext.getPointerTypeUnqual(LongTy),
+  IvarnfABITy = llvm::StructType::get(llvm::PointerType::getUnqual(LongTy),
                                       Int8PtrTy,
                                       Int8PtrTy,
                                       IntTy,
@@ -3908,14 +3908,14 @@
   //   uint32 count;
   //   struct _iver_t list[count];
   // }
-  IvarListnfABITy = VMContext.getStructType(IntTy,
+  IvarListnfABITy = llvm::StructType::get(IntTy,
                                           IntTy,
-                                          VMContext.getArrayType(
+                                          llvm::ArrayType::get(
                                                                IvarnfABITy, 0),
                                           NULL);
   CGM.getModule().addTypeName("struct._ivar_list_t", IvarListnfABITy);
   
-  IvarListnfABIPtrTy = VMContext.getPointerTypeUnqual(IvarListnfABITy);
+  IvarListnfABIPtrTy = llvm::PointerType::getUnqual(IvarListnfABITy);
   
   // struct _class_ro_t {
   //   uint32_t const flags;
@@ -3932,7 +3932,7 @@
   // }
   
   // FIXME. Add 'reserved' field in 64bit abi mode!
-  ClassRonfABITy = VMContext.getStructType(IntTy,
+  ClassRonfABITy = llvm::StructType::get(IntTy,
                                          IntTy,
                                          IntTy,
                                          Int8PtrTy,
@@ -3950,8 +3950,8 @@
   std::vector<const llvm::Type*> Params;
   Params.push_back(ObjectPtrTy);
   Params.push_back(SelectorPtrTy);
-  ImpnfABITy = VMContext.getPointerTypeUnqual(
-                      VMContext.getFunctionType(ObjectPtrTy, Params, false));
+  ImpnfABITy = llvm::PointerType::getUnqual(
+                      llvm::FunctionType::get(ObjectPtrTy, Params, false));
   
   // struct _class_t {
   //   struct _class_t *isa;
@@ -3961,13 +3961,13 @@
   //   struct class_ro_t *ro;
   // }
   
-  llvm::PATypeHolder ClassTyHolder = VMContext.getOpaqueType();
+  llvm::PATypeHolder ClassTyHolder = llvm::OpaqueType::get();
   ClassnfABITy =
-    VMContext.getStructType(VMContext.getPointerTypeUnqual(ClassTyHolder),
-                            VMContext.getPointerTypeUnqual(ClassTyHolder),
+    llvm::StructType::get(llvm::PointerType::getUnqual(ClassTyHolder),
+                            llvm::PointerType::getUnqual(ClassTyHolder),
                             CachePtrTy,
-                            VMContext.getPointerTypeUnqual(ImpnfABITy),
-                            VMContext.getPointerTypeUnqual(ClassRonfABITy),
+                            llvm::PointerType::getUnqual(ImpnfABITy),
+                            llvm::PointerType::getUnqual(ClassRonfABITy),
                             NULL);
   CGM.getModule().addTypeName("struct._class_t", ClassnfABITy);
 
@@ -3975,7 +3975,7 @@
                                                                 ClassnfABITy);
   
   // LLVM for struct _class_t *
-  ClassnfABIPtrTy = VMContext.getPointerTypeUnqual(ClassnfABITy);
+  ClassnfABIPtrTy = llvm::PointerType::getUnqual(ClassnfABITy);
   
   // struct _category_t {
   //   const char * const name;
@@ -3985,7 +3985,7 @@
   //   const struct _protocol_list_t * const protocols;
   //   const struct _prop_list_t * const properties;
   // }
-  CategorynfABITy = VMContext.getStructType(Int8PtrTy,
+  CategorynfABITy = llvm::StructType::get(Int8PtrTy,
                                           ClassnfABIPtrTy,
                                           MethodListnfABIPtrTy,
                                           MethodListnfABIPtrTy,
@@ -4019,20 +4019,20 @@
   MessageRefTy = cast<llvm::StructType>(Types.ConvertType(MessageRefCTy));
   
   // MessageRefPtrTy - LLVM for struct _message_ref_t*
-  MessageRefPtrTy = VMContext.getPointerTypeUnqual(MessageRefTy);
+  MessageRefPtrTy = llvm::PointerType::getUnqual(MessageRefTy);
   
   // SuperMessageRefTy - LLVM for:
   // struct _super_message_ref_t {
   //   SUPER_IMP messenger;
   //   SEL name;
   // };
-  SuperMessageRefTy = VMContext.getStructType(ImpnfABITy,
+  SuperMessageRefTy = llvm::StructType::get(ImpnfABITy,
                                             SelectorPtrTy,
                                             NULL);
   CGM.getModule().addTypeName("struct._super_message_ref_t", SuperMessageRefTy);
   
   // SuperMessageRefPtrTy - LLVM for struct _super_message_ref_t*
-  SuperMessageRefPtrTy = VMContext.getPointerTypeUnqual(SuperMessageRefTy);  
+  SuperMessageRefPtrTy = llvm::PointerType::getUnqual(SuperMessageRefTy);  
   
 
   // struct objc_typeinfo {
@@ -4040,12 +4040,12 @@
   //   const char*  name;    // c++ typeinfo string
   //   Class        cls;
   // };
-  EHTypeTy = VMContext.getStructType(VMContext.getPointerTypeUnqual(Int8PtrTy),
+  EHTypeTy = llvm::StructType::get(llvm::PointerType::getUnqual(Int8PtrTy),
                                    Int8PtrTy,
                                    ClassnfABIPtrTy,
                                    NULL);
   CGM.getModule().addTypeName("struct._objc_typeinfo", EHTypeTy);
-  EHTypePtrTy = VMContext.getPointerTypeUnqual(EHTypeTy);
+  EHTypePtrTy = llvm::PointerType::getUnqual(EHTypeTy);
 }
 
 llvm::Function *CGObjCNonFragileABIMac::ModuleInitFunction() { 
@@ -4069,7 +4069,7 @@
     Symbols[i] = llvm::ConstantExpr::getBitCast(Container[i],
                                                 ObjCTypes.Int8PtrTy);
   llvm::Constant* Init = 
-    llvm::ConstantArray::get(VMContext.getArrayType(ObjCTypes.Int8PtrTy,
+    llvm::ConstantArray::get(llvm::ArrayType::get(ObjCTypes.Int8PtrTy,
                                                   NumClasses),
                              Symbols);
   
@@ -4116,7 +4116,7 @@
     flags |= eImageInfo_GCOnly;
   Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, flags);
   llvm::Constant* Init = llvm::ConstantArray::get(
-                                    VMContext.getArrayType(ObjCTypes.IntTy, 2),
+                                    llvm::ArrayType::get(ObjCTypes.IntTy, 2),
                                       Values);   
   llvm::GlobalVariable *IMGV =
     new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
@@ -4594,7 +4594,7 @@
   Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
   // method_count
   Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
-  llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.MethodTy,
+  llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
                                              Methods.size());
   Values[2] = llvm::ConstantArray::get(AT, Methods);
   llvm::Constant *Init = llvm::ConstantStruct::get(Values);
@@ -4720,7 +4720,7 @@
   unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.IvarnfABITy);
   Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
   Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
-  llvm::ArrayType *AT = VMContext.getArrayType(ObjCTypes.IvarnfABITy,
+  llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarnfABITy,
                                              Ivars.size());
   Values[2] = llvm::ConstantArray::get(AT, Ivars);
   llvm::Constant *Init = llvm::ConstantStruct::get(Values);
@@ -4913,7 +4913,7 @@
     llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1);
   Values[1] = 
     llvm::ConstantArray::get(
-      VMContext.getArrayType(ObjCTypes.ProtocolnfABIPtrTy,
+      llvm::ArrayType::get(ObjCTypes.ProtocolnfABIPtrTy,
                              ProtocolRefs.size()), 
                              ProtocolRefs);
   
@@ -5081,7 +5081,7 @@
   Callee = CGF.Builder.CreateLoad(Callee);
   const llvm::FunctionType *FTy = Types.GetFunctionType(FnInfo1, true);
   Callee = CGF.Builder.CreateBitCast(Callee,
-                                     VMContext.getPointerTypeUnqual(FTy));
+                                     llvm::PointerType::getUnqual(FTy));
   return CGF.EmitCall(FnInfo1, Callee, ActualArgs);
 }
 

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Wed Jul 29 17:16:19 2009
@@ -403,7 +403,7 @@
 }
 
 void CodeGenFunction::EmitMemSetToZero(llvm::Value *DestPtr, QualType Ty) {
-  const llvm::Type *BP = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   if (DestPtr->getType() != BP)
     DestPtr = Builder.CreateBitCast(DestPtr, BP, "tmp");
 
@@ -415,7 +415,7 @@
     return;
   
   // FIXME: Handle variable sized types.
-  const llvm::Type *IntPtr = VMContext.getIntegerType(LLVMPointerWidth);
+  const llvm::Type *IntPtr = llvm::IntegerType::get(LLVMPointerWidth);
 
   Builder.CreateCall4(CGM.getMemSetFn(), DestPtr,
                       getLLVMContext().getNullValue(llvm::Type::Int8Ty),

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Jul 29 17:16:19 2009
@@ -196,15 +196,15 @@
 void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) {
   // Ctor function type is void()*.
   llvm::FunctionType* CtorFTy =
-    VMContext.getFunctionType(llvm::Type::VoidTy, 
+    llvm::FunctionType::get(llvm::Type::VoidTy, 
                             std::vector<const llvm::Type*>(),
                             false);
-  llvm::Type *CtorPFTy = VMContext.getPointerTypeUnqual(CtorFTy);
+  llvm::Type *CtorPFTy = llvm::PointerType::getUnqual(CtorFTy);
 
   // Get the type of a ctor entry, { i32, void ()* }.
   llvm::StructType* CtorStructTy = 
-    VMContext.getStructType(llvm::Type::Int32Ty, 
-                          VMContext.getPointerTypeUnqual(CtorFTy), NULL);
+    llvm::StructType::get(llvm::Type::Int32Ty, 
+                          llvm::PointerType::getUnqual(CtorFTy), NULL);
 
   // Construct the constructor and destructor arrays.
   std::vector<llvm::Constant*> Ctors;
@@ -217,7 +217,7 @@
   }
 
   if (!Ctors.empty()) {
-    llvm::ArrayType *AT = VMContext.getArrayType(CtorStructTy, Ctors.size());
+    llvm::ArrayType *AT = llvm::ArrayType::get(CtorStructTy, Ctors.size());
     new llvm::GlobalVariable(TheModule, AT, false,
                              llvm::GlobalValue::AppendingLinkage,
                              llvm::ConstantArray::get(AT, Ctors),
@@ -231,7 +231,7 @@
 
   // Create a new global variable for the ConstantStruct in the Module.
   llvm::Constant *Array =
-  llvm::ConstantArray::get(VMContext.getArrayType(Annotations[0]->getType(),
+  llvm::ConstantArray::get(llvm::ArrayType::get(Annotations[0]->getType(),
                                                 Annotations.size()),
                            Annotations);
   llvm::GlobalValue *gv = 
@@ -418,7 +418,7 @@
   if (LLVMUsed.empty())
     return;
 
-  llvm::Type *i8PTy = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  llvm::Type *i8PTy = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   
   // Convert LLVMUsed to what ConstantArray needs.
   std::vector<llvm::Constant*> UsedArray;
@@ -431,7 +431,7 @@
   
   if (UsedArray.empty())
     return;
-  llvm::ArrayType *ATy = VMContext.getArrayType(i8PTy, UsedArray.size());
+  llvm::ArrayType *ATy = llvm::ArrayType::get(i8PTy, UsedArray.size());
   
   llvm::GlobalVariable *GV = 
     new llvm::GlobalVariable(getModule(), ATy, false, 
@@ -483,7 +483,7 @@
 
   // get [N x i8] constants for the annotation string, and the filename string
   // which are the 2nd and 3rd elements of the global annotation structure.
-  const llvm::Type *SBP = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+  const llvm::Type *SBP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   llvm::Constant *anno = llvm::ConstantArray::get(AA->getAnnotation(), true);
   llvm::Constant *unit = llvm::ConstantArray::get(M->getModuleIdentifier(),
                                                   true);
@@ -620,7 +620,7 @@
       return Entry;
     
     // Make sure the result is of the correct type.
-    const llvm::Type *PTy = VMContext.getPointerTypeUnqual(Ty);
+    const llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
     return llvm::ConstantExpr::getBitCast(Entry, PTy);
   }
   
@@ -647,7 +647,7 @@
   // sure not to try to set attributes.
   bool IsIncompleteFunction = false;
   if (!isa<llvm::FunctionType>(Ty)) {
-    Ty = VMContext.getFunctionType(llvm::Type::VoidTy,
+    Ty = llvm::FunctionType::get(llvm::Type::VoidTy,
                                  std::vector<const llvm::Type*>(), false);
     IsIncompleteFunction = true;
   }
@@ -755,7 +755,7 @@
     Ty = getTypes().ConvertTypeForMem(ASTTy);
   
   const llvm::PointerType *PTy = 
-    VMContext.getPointerType(Ty, ASTTy.getAddressSpace());
+    llvm::PointerType::get(Ty, ASTTy.getAddressSpace());
   return GetOrCreateLLVMGlobal(getMangledName(D), PTy, D);
 }
 
@@ -766,7 +766,7 @@
                                      const char *Name) {
   // Convert Name to be a uniqued string from the IdentifierInfo table.
   Name = getContext().Idents.get(Name).getName();
-  return GetOrCreateLLVMGlobal(Name, VMContext.getPointerTypeUnqual(Ty), 0);
+  return GetOrCreateLLVMGlobal(Name, llvm::PointerType::getUnqual(Ty), 0);
 }
 
 void CodeGenModule::EmitTentativeDefinition(const VarDecl *D) {
@@ -974,7 +974,7 @@
       // Just create the same type as was lowered by ConvertType 
       // but strip off the varargs bit.
       std::vector<const llvm::Type*> Args(Ty->param_begin(), Ty->param_end());
-      Ty = VMContext.getFunctionType(Ty->getReturnType(), Args, false);
+      Ty = llvm::FunctionType::get(Ty->getReturnType(), Args, false);
     }
   }
 
@@ -1058,7 +1058,7 @@
     Aliasee = GetOrCreateLLVMFunction(AliaseeName, DeclTy, GlobalDecl());
   else
     Aliasee = GetOrCreateLLVMGlobal(AliaseeName,
-                                    VMContext.getPointerTypeUnqual(DeclTy), 0);
+                                    llvm::PointerType::getUnqual(DeclTy), 0);
 
   // Create the new alias itself, but don't set a name yet.
   llvm::GlobalValue *GA = 
@@ -1266,7 +1266,7 @@
   // If we don't already have it, get __CFConstantStringClassReference.
   if (!CFConstantStringClassRef) {
     const llvm::Type *Ty = getTypes().ConvertType(getContext().IntTy);
-    Ty = VMContext.getArrayType(Ty, 0);
+    Ty = llvm::ArrayType::get(Ty, 0);
     llvm::Constant *GV = CreateRuntimeVariable(Ty, 
                                            "__CFConstantStringClassReference");
     // Decay array -> ptr

Modified: cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetABIInfo.cpp?rev=77514&r1=77513&r2=77514&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Wed Jul 29 17:16:19 2009
@@ -308,14 +308,14 @@
       // backend will like.
       if (Size == 128)
         return
-          ABIArgInfo::getCoerce(VMContext.getVectorType(llvm::Type::Int64Ty,
+          ABIArgInfo::getCoerce(llvm::VectorType::get(llvm::Type::Int64Ty,
                                                            2));
 
       // Always return in register if it fits in a general purpose
       // register, or if it is 64 bits and has a single element.
       if ((Size == 8 || Size == 16 || Size == 32) ||
           (Size == 64 && VT->getNumElements() == 1))
-        return ABIArgInfo::getCoerce(VMContext.getIntegerType(Size));
+        return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
 
       return ABIArgInfo::getIndirect(0);
     }
@@ -340,7 +340,7 @@
           // element type.
           uint64_t Size = Context.getTypeSize(RetTy);
           return ABIArgInfo::getCoerce(
-            VMContext.getIntegerType((unsigned) Size));
+            llvm::IntegerType::get((unsigned) Size));
         } else if (BT->getKind() == BuiltinType::Float) {
           assert(Context.getTypeSize(RetTy) == Context.getTypeSize(SeltTy) &&
                  "Unexpect single element structure size!");
@@ -354,7 +354,7 @@
         // FIXME: It would be really nice if this could come out as the proper
         // pointer type.
         llvm::Type *PtrTy =
-          VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
+          llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
         return ABIArgInfo::getCoerce(PtrTy);
       } else if (SeltTy->isVectorType()) {
         // 64- and 128-bit vectors are never returned in a
@@ -371,7 +371,7 @@
     // in a register.
     if (X86_32ABIInfo::shouldReturnTypeInRegister(RetTy, Context)) {
       uint64_t Size = Context.getTypeSize(RetTy);
-      return ABIArgInfo::getCoerce(VMContext.getIntegerType(Size));
+      return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
     }
 
     return ABIArgInfo::getIndirect(0);
@@ -424,16 +424,15 @@
 
 llvm::Value *X86_32ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
                                       CodeGenFunction &CGF) const {
-  llvm::LLVMContext &VMContext = CGF.getLLVMContext();
-  const llvm::Type *BP = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
-  const llvm::Type *BPP = VMContext.getPointerTypeUnqual(BP);
+  const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
+  const llvm::Type *BPP = llvm::PointerType::getUnqual(BP);
 
   CGBuilderTy &Builder = CGF.Builder;
   llvm::Value *VAListAddrAsBPP = Builder.CreateBitCast(VAListAddr, BPP,
                                                        "ap");
   llvm::Value *Addr = Builder.CreateLoad(VAListAddrAsBPP, "ap.cur");
   llvm::Type *PTy =
-    VMContext.getPointerTypeUnqual(CGF.ConvertType(Ty));
+    llvm::PointerType::getUnqual(CGF.ConvertType(Ty));
   llvm::Value *AddrTyped = Builder.CreateBitCast(Addr, PTy);
 
   uint64_t Offset =
@@ -876,7 +875,7 @@
     // %st1.
   case ComplexX87:
     assert(Hi == ComplexX87 && "Unexpected ComplexX87 classification.");
-    ResType = VMContext.getStructType(llvm::Type::X86_FP80Ty,
+    ResType = llvm::StructType::get(llvm::Type::X86_FP80Ty,
                                     llvm::Type::X86_FP80Ty,
                                     NULL);
     break;
@@ -893,10 +892,10 @@
   case NoClass: break;
 
   case Integer:
-    ResType = VMContext.getStructType(ResType, llvm::Type::Int64Ty, NULL);
+    ResType = llvm::StructType::get(ResType, llvm::Type::Int64Ty, NULL);
     break;
   case SSE:
-    ResType = VMContext.getStructType(ResType, llvm::Type::DoubleTy, NULL);
+    ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
     break;
 
     // AMD64-ABI 3.2.3p4: Rule 5. If the class is SSEUP, the eightbyte
@@ -905,7 +904,7 @@
     // SSEUP should always be preceeded by SSE, just widen.
   case SSEUp:
     assert(Lo == SSE && "Unexpected SSEUp classification.");
-    ResType = VMContext.getVectorType(llvm::Type::DoubleTy, 2);
+    ResType = llvm::VectorType::get(llvm::Type::DoubleTy, 2);
     break;
 
     // AMD64-ABI 3.2.3p4: Rule 7. If the class is X87UP, the value is
@@ -916,7 +915,7 @@
     // preceeded by X87. In such situations we follow gcc and pass the
     // extra bits in an SSE reg.
     if (Lo != X87)
-      ResType = VMContext.getStructType(ResType, llvm::Type::DoubleTy, NULL);
+      ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
     break;
   }
 
@@ -986,7 +985,7 @@
 
   case NoClass: break;
   case Integer:
-    ResType = VMContext.getStructType(ResType, llvm::Type::Int64Ty, NULL);
+    ResType = llvm::StructType::get(ResType, llvm::Type::Int64Ty, NULL);
     ++neededInt;
     break;
 
@@ -994,7 +993,7 @@
     // memory), except in situations involving unions.
   case X87Up:
   case SSE:
-    ResType = VMContext.getStructType(ResType, llvm::Type::DoubleTy, NULL);
+    ResType = llvm::StructType::get(ResType, llvm::Type::DoubleTy, NULL);
     ++neededSSE;
     break;
 
@@ -1003,7 +1002,7 @@
     // register.
   case SSEUp:
     assert(Lo == SSE && "Unexpected SSEUp classification.");
-    ResType = VMContext.getVectorType(llvm::Type::DoubleTy, 2);
+    ResType = llvm::VectorType::get(llvm::Type::DoubleTy, 2);
     break;
   }
 
@@ -1047,7 +1046,6 @@
 static llvm::Value *EmitVAArgFromMemory(llvm::Value *VAListAddr,
                                         QualType Ty,
                                         CodeGenFunction &CGF) {
-  llvm::LLVMContext &VMContext = CGF.getLLVMContext();
   llvm::Value *overflow_arg_area_p =
     CGF.Builder.CreateStructGEP(VAListAddr, 2, "overflow_arg_area_p");
   llvm::Value *overflow_arg_area =
@@ -1077,7 +1075,7 @@
   const llvm::Type *LTy = CGF.ConvertTypeForMem(Ty);
   llvm::Value *Res =
     CGF.Builder.CreateBitCast(overflow_arg_area,
-                              VMContext.getPointerTypeUnqual(LTy));
+                              llvm::PointerType::getUnqual(LTy));
 
   // AMD64-ABI 3.5.7p5: Step 9. Set l->overflow_arg_area to:
   // l->overflow_arg_area + sizeof(type).
@@ -1183,8 +1181,8 @@
     const llvm::Type *TyHi = ST->getElementType(1);
     assert((TyLo->isFloatingPoint() ^ TyHi->isFloatingPoint()) &&
            "Unexpected ABI info for mixed regs");
-    const llvm::Type *PTyLo = VMContext.getPointerTypeUnqual(TyLo);
-    const llvm::Type *PTyHi = VMContext.getPointerTypeUnqual(TyHi);
+    const llvm::Type *PTyLo = llvm::PointerType::getUnqual(TyLo);
+    const llvm::Type *PTyHi = llvm::PointerType::getUnqual(TyHi);
     llvm::Value *GPAddr = CGF.Builder.CreateGEP(RegAddr, gp_offset);
     llvm::Value *FPAddr = CGF.Builder.CreateGEP(RegAddr, fp_offset);
     llvm::Value *RegLoAddr = TyLo->isFloatingPoint() ? FPAddr : GPAddr;
@@ -1196,16 +1194,16 @@
     CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 1));
 
     RegAddr = CGF.Builder.CreateBitCast(Tmp,
-                                        VMContext.getPointerTypeUnqual(LTy));
+                                        llvm::PointerType::getUnqual(LTy));
   } else if (neededInt) {
     RegAddr = CGF.Builder.CreateGEP(RegAddr, gp_offset);
     RegAddr = CGF.Builder.CreateBitCast(RegAddr,
-                                        VMContext.getPointerTypeUnqual(LTy));
+                                        llvm::PointerType::getUnqual(LTy));
   } else {
     if (neededSSE == 1) {
       RegAddr = CGF.Builder.CreateGEP(RegAddr, fp_offset);
       RegAddr = CGF.Builder.CreateBitCast(RegAddr,
-                                          VMContext.getPointerTypeUnqual(LTy));
+                                          llvm::PointerType::getUnqual(LTy));
     } else {
       assert(neededSSE == 2 && "Invalid number of needed registers!");
       // SSE registers are spaced 16 bytes apart in the register save
@@ -1215,8 +1213,8 @@
         CGF.Builder.CreateGEP(RegAddrLo,
                             llvm::ConstantInt::get(llvm::Type::Int32Ty, 16));
       const llvm::Type *DblPtrTy =
-        VMContext.getPointerTypeUnqual(llvm::Type::DoubleTy);
-      const llvm::StructType *ST = VMContext.getStructType(llvm::Type::DoubleTy,
+        llvm::PointerType::getUnqual(llvm::Type::DoubleTy);
+      const llvm::StructType *ST = llvm::StructType::get(llvm::Type::DoubleTy,
                                                          llvm::Type::DoubleTy,
                                                          NULL);
       llvm::Value *V, *Tmp = CGF.CreateTempAlloca(ST);
@@ -1227,7 +1225,7 @@
                                                            DblPtrTy));
       CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 1));
       RegAddr = CGF.Builder.CreateBitCast(Tmp,
-                                          VMContext.getPointerTypeUnqual(LTy));
+                                          llvm::PointerType::getUnqual(LTy));
     }
   }
 
@@ -1356,8 +1354,8 @@
     SizeRegs = (Context.getTypeSize(Ty) + 31) / 32;
   }
   std::vector<const llvm::Type*> LLVMFields;
-  LLVMFields.push_back(VMContext.getArrayType(ElemTy, SizeRegs));
-  const llvm::Type* STy = VMContext.getStructType(LLVMFields, true);
+  LLVMFields.push_back(llvm::ArrayType::get(ElemTy, SizeRegs));
+  const llvm::Type* STy = llvm::StructType::get(LLVMFields, true);
   return ABIArgInfo::getCoerce(STy);
 }
 
@@ -1381,18 +1379,16 @@
 
 llvm::Value *ARMABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
                                       CodeGenFunction &CGF) const {
-  llvm::LLVMContext &VMContext = CGF.getLLVMContext();                                        
-
   // FIXME: Need to handle alignment
-  const llvm::Type *BP = VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
-  const llvm::Type *BPP = VMContext.getPointerTypeUnqual(BP);
+  const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
+  const llvm::Type *BPP = llvm::PointerType::getUnqual(BP);
 
   CGBuilderTy &Builder = CGF.Builder;
   llvm::Value *VAListAddrAsBPP = Builder.CreateBitCast(VAListAddr, BPP,
                                                        "ap");
   llvm::Value *Addr = Builder.CreateLoad(VAListAddrAsBPP, "ap.cur");
   llvm::Type *PTy =
-    VMContext.getPointerTypeUnqual(CGF.ConvertType(Ty));
+    llvm::PointerType::getUnqual(CGF.ConvertType(Ty));
   llvm::Value *AddrTyped = Builder.CreateBitCast(Addr, PTy);
 
   uint64_t Offset =





More information about the cfe-commits mailing list