From: Owen Anderson Date: Wed, 29 Jul 2009 22:16:19 +0000 (+0000) Subject: Update for LLVM API change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96e0fc726c6fe7538522c60743705d5e696b40af;p=clang Update for LLVM API change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77514 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 8e7a7922ad..c7d900cf48 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -184,12 +184,12 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) { 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::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) { 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 @@ const llvm::Type *BlockModule::getBlockDescriptorType() { // unsigned long reserved; // unsigned long block_size; // }; - BlockDescriptorType = VMContext.getStructType(UnsignedLongTy, + BlockDescriptorType = llvm::StructType::get(UnsignedLongTy, UnsignedLongTy, NULL); @@ -325,7 +325,7 @@ const llvm::Type *BlockModule::getGenericBlockLiteralType() { return GenericBlockLiteralType; const llvm::Type *BlockDescPtrTy = - VMContext.getPointerTypeUnqual(getBlockDescriptorType()); + llvm::PointerType::getUnqual(getBlockDescriptorType()); const llvm::IntegerType *IntTy = cast( getTypes().ConvertType(getContext().IntTy)); @@ -337,7 +337,7 @@ const llvm::Type *BlockModule::getGenericBlockLiteralType() { // void (*__invoke)(void *); // struct __block_descriptor *__descriptor; // }; - GenericBlockLiteralType = VMContext.getStructType(PtrToInt8Ty, + GenericBlockLiteralType = llvm::StructType::get(PtrToInt8Ty, IntTy, IntTy, PtrToInt8Ty, @@ -355,7 +355,7 @@ const llvm::Type *BlockModule::getGenericExtendedBlockLiteralType() { return GenericExtendedBlockLiteralType; const llvm::Type *BlockDescPtrTy = - VMContext.getPointerTypeUnqual(getBlockDescriptorType()); + llvm::PointerType::getUnqual(getBlockDescriptorType()); const llvm::IntegerType *IntTy = cast( getTypes().ConvertType(getContext().IntTy)); @@ -369,7 +369,7 @@ const llvm::Type *BlockModule::getGenericExtendedBlockLiteralType() { // 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 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) { // 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 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) { BlockLiteral = Builder.CreateBitCast(BlockLiteral, - VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty), + llvm::PointerType::getUnqual(llvm::Type::Int8Ty), "tmp"); // Add the block literal. @@ -429,7 +429,7 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) { 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 @@ llvm::Value *CodeGenFunction::GetAddrOfBlockDecl(const BlockDeclRefExpr *E) { 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 @@ llvm::Value *CodeGenFunction::GetAddrOfBlockDecl(const BlockDeclRefExpr *E) { 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 BlockFunction::getBlockOffset(const BlockDeclRefExpr *BDRE) { 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 @@ GenerateCopyHelperFunction(bool BlockHasCopyDispose, const llvm::StructType *T, if (NoteForHelperp) { std::vector &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 @@ GenerateCopyHelperFunction(bool BlockHasCopyDispose, const llvm::StructType *T, 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 @@ GenerateDestroyHelperFunction(bool BlockHasCopyDispose, 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 @@ GenerateDestroyHelperFunction(bool BlockHasCopyDispose, 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 @@ GeneratebyrefCopyHelperFunction(const llvm::Type *T, int flag) { // 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 @@ GeneratebyrefCopyHelperFunction(const llvm::Type *T, int flag) { 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 @@ BlockFunction::GeneratebyrefDestroyHelperFunction(const llvm::Type *T, 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 @@ llvm::Value *BlockFunction::getBlockObjectDispose() { 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 @@ llvm::Value *BlockFunction::getBlockObjectAssign() { 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 @@ ASTContext &BlockFunction::getContext() const { return CGM.getContext(); } 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; } diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 86650a1e7e..05f27d57a6 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -78,7 +78,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, 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 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, 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 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, { 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 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, 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 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, 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 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, 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 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, 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 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, 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"); diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index d6173a0ec1..f80956b93f 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -45,7 +45,7 @@ CodeGenFunction::GenerateStaticCXXBlockVarDeclInit(const VarDecl &D, 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 @@ llvm::Value *CodeGenFunction::AddressCXXOfBaseClass(llvm::Value *BaseValue, // 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 @@ llvm::Value *CodeGenFunction::AddressCXXOfBaseClass(llvm::Value *BaseValue, getContext().getCanonicalType( getContext().getTypeDeclType(const_cast(BaseClassDecl))); const llvm::Type *BasePtr = ConvertType(BTy); - BasePtr = VMContext.getPointerTypeUnqual(BasePtr); + BasePtr = llvm::PointerType::getUnqual(BasePtr); BaseValue = Builder.CreateBitCast(BaseValue, BasePtr); return BaseValue; } diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 554c4f0b0e..3c3814c70d 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -194,7 +194,7 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) { // 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 @@ const llvm::Type *CodeGenFunction::BuildByRefType(QualType Ty, bool needsCopyDispose = BlockRequiresCopying(Ty); std::vector 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 @@ const llvm::Type *CodeGenFunction::BuildByRefType(QualType Ty, 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 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { 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 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { // 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 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { 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); diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 8c77f386ed..ea14242a00 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -124,7 +124,7 @@ RValue CodeGenFunction::GetUndefRValue(QualType Ty) { 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 @@ RValue CodeGenFunction::EmitUnsupportedRValue(const Expr *E, 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 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, llvm::Value *Addr, const llvm::PointerType *DstPtr = cast(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 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { 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 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { // Extend or truncate the index type to 32 or 64-bits. unsigned IdxBitwidth = cast(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 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { 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 @@ LValue CodeGenFunction::EmitLValueForBitfield(llvm::Value* BaseValue, cast(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 @@ LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue, cast(BaseValue->getType()); unsigned AS = BaseTy->getAddressSpace(); V = Builder.CreateBitCast(V, - VMContext.getPointerType(FieldTy, AS), + llvm::PointerType::get(FieldTy, AS), "tmp"); } if (Field->getType()->isReferenceType()) diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 7dbf2df6dd..a711f49ef7 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -543,7 +543,7 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, // 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 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, std::pair 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: diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 8e45997aee..e5d1b06bb8 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -83,7 +83,7 @@ class VISIBILITY_HIDDEN ConstStructBuilder { 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 @@ class VISIBILITY_HIDDEN ConstStructBuilder { 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: 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 @@ public: 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 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, // 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()); diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index c9a1276738..64261dde6f 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -452,7 +452,7 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, 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 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E, 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 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E, 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 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) { 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 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { 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 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { 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 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { // 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 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) { 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 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) { 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 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) { // 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 @@ Value *CodeGenFunction::EmitShuffleVector(Value* V1, Value *V2, ...) { 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]; diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 450b4cdac4..85a5141951 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -213,15 +213,15 @@ CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm) 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( CGM.getTypes().ConvertType(CGM.getContext().getObjCSelType())); - PtrToIntTy = VMContext.getPointerTypeUnqual(IntTy); + PtrToIntTy = llvm::PointerType::getUnqual(IntTy); PtrTy = PtrToInt8Ty; // Object type @@ -232,7 +232,7 @@ CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm) std::vector 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 @@ llvm::Value *CGObjCGNU::GetClass(CGBuilderTy &Builder, std::vector 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::GetClass(CGBuilderTy &Builder, 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 @@ llvm::Value *CGObjCGNU::GetSelector(CGBuilderTy &Builder, const ObjCMethodDecl // 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 @@ llvm::Constant *CGObjCGNU::GenerateConstantString(const ObjCStringLiteral *SL) { 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 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, std::vector 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 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, } // 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 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF, // Get the IMP std::vector 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 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF, } 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 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const std::string &ClassName, const llvm::SmallVectorImpl &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 Methods; std::vector Elements; @@ -512,23 +512,23 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const std::string &ClassName, 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 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 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const std::string &ClassName, 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 @@ llvm::Constant *CGObjCGNU::GenerateIvarList( const llvm::SmallVectorImpl &IvarTypes, const llvm::SmallVectorImpl &IvarOffsets) { // Get the method structure type. - llvm::StructType *ObjCIvarTy = VMContext.getStructType( + llvm::StructType *ObjCIvarTy = llvm::StructType::get( PtrToInt8Ty, PtrToInt8Ty, IntTy, @@ -572,7 +572,7 @@ llvm::Constant *CGObjCGNU::GenerateIvarList( } // Array of method structures - llvm::ArrayType *ObjCIvarArrayTy = VMContext.getArrayType(ObjCIvarTy, + llvm::ArrayType *ObjCIvarArrayTy = llvm::ArrayType::get(ObjCIvarTy, IvarNames.size()); @@ -580,7 +580,7 @@ llvm::Constant *CGObjCGNU::GenerateIvarList( 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 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure( // 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 @@ llvm::Constant *CGObjCGNU::GenerateProtocolMethodList( const llvm::SmallVectorImpl &MethodNames, const llvm::SmallVectorImpl &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::Constant *CGObjCGNU::GenerateProtocolMethodList( 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 @@ llvm::Constant *CGObjCGNU::GenerateProtocolMethodList( // Create the protocol list structure used in classes, categories and so on llvm::Constant *CGObjCGNU::GenerateProtocolList( const llvm::SmallVectorImpl &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 *CGObjCGNU::GenerateProtocolRef(CGBuilderTy &Builder, 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 @@ llvm::Constant *CGObjCGNU::GenerateEmptyProtocol( 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 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { 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 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { 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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { 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::Function *CGObjCGNU::ModuleInitFunction() { 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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { 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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { 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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { // 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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { // type. if (isSelOpaque) { SelPtr = llvm::ConstantExpr::getBitCast(SelPtr, - VMContext.getPointerTypeUnqual(SelectorTy)); + llvm::PointerType::getUnqual(SelectorTy)); } (*iter).second->setAliasee(SelPtr); } @@ -1126,7 +1126,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { // type. if (isSelOpaque) { SelPtr = llvm::ConstantExpr::getBitCast(SelPtr, - VMContext.getPointerTypeUnqual(SelectorTy)); + llvm::PointerType::getUnqual(SelectorTy)); } (*iter).second->setAliasee(SelPtr); } @@ -1148,8 +1148,8 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { // 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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { // 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 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { Builder.SetInsertPoint(EntryBB); std::vector 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 @@ llvm::Function *CGObjCGNU::GetPropertyGetFunction() { 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(CGM.CreateRuntimeFunction(FTy, "objc_getProperty")); } @@ -1238,7 +1238,7 @@ llvm::Function *CGObjCGNU::GetPropertySetFunction() { 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(CGM.CreateRuntimeFunction(FTy, "objc_setProperty")); } @@ -1258,14 +1258,14 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, 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 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(S); @@ -1281,7 +1281,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, if (!isTry) { std::vector 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(S).getSynchExpr()); @@ -1457,7 +1457,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF, // @synchronized. std::vector 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(S).getSynchExpr()); @@ -1487,7 +1487,7 @@ void CGObjCGNU::EmitThrowStmt(CodeGen::CodeGenFunction &CGF, std::vector 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"); diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 1a065fab96..45ce425090 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -102,12 +102,12 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF, 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 @@ private: 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 @@ private: 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 @@ private: 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 @@ private: std::vector 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 @@ private: std::vector 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 @@ private: 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 @@ private: 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: // void objc_exception_throw(id) std::vector 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 @@ public: // void objc_sync_enter (id) std::vector 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 @@ public: // void objc_sync_exit (id) std::vector 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 @@ public: /// ExceptionTryEnterFn - LLVM objc_exception_try_enter function. llvm::Constant *getExceptionTryEnterFn() { std::vector 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 @@ public: /// ExceptionTryExitFn - LLVM objc_exception_try_exit function. llvm::Constant *getExceptionTryExitFn() { std::vector 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 @@ public: /// ExceptionExtractFn - LLVM objc_exception_extract function. llvm::Constant *getExceptionExtractFn() { std::vector 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 @@ public: 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 @@ public: /// SetJmpFn - LLVM _setjmp function. llvm::Constant *getSetJmpFn() { std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: std::vector 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 @@ public: /// 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 @@ public: std::vector 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 @@ public: llvm::Constant *getObjCBeginCatchFn() { std::vector 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 @@ CodeGen::RValue CGObjCCommonMac::EmitLegacyMessageSend( } 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 @@ CGObjCMac::EmitProtocolList(const std::string &Name, 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 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(const std::string &Name, std::vector 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 @@ llvm::Constant *CGObjCMac::EmitMethodDescList(const std::string &Name, std::vector 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 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID, std::vector 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 @@ llvm::Constant *CGObjCMac::EmitMethodList(const std::string &Name, std::vector 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 @@ void CGObjCMac::EmitImageInfo() { 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 @@ llvm::Constant *CGObjCMac::EmitModuleSymbols() { 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 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout( 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 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm) 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 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm) SuperPtrCTy = Ctx.getPointerType(SuperCTy); SuperTy = cast(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 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm) // 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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // char *types; // } MethodDescriptionTy = - VMContext.getStructType(SelectorPtrTy, + llvm::StructType::get(SelectorPtrTy, Int8PtrTy, NULL); CGM.getModule().addTypeName("struct._objc_method_description", @@ -3619,15 +3619,15 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // 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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // struct _objc_property_list *instance_properties; // } ProtocolExtensionTy = - VMContext.getStructType(IntTy, + llvm::StructType::get(IntTy, MethodDescriptionListPtrTy, MethodDescriptionListPtrTy, PropertyListPtrTy, @@ -3647,17 +3647,17 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) 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(ProtocolListTyHolder.get())->refineAbstractTypeTo(T); @@ -3668,9 +3668,9 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // 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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) CGM.getModule().addTypeName("struct._objc_protocol_list", ProtocolListTy); // struct _objc_protocol_list * - ProtocolListPtrTy = VMContext.getPointerTypeUnqual(ProtocolListTy); + ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy); ProtocolTy = cast(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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // 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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // 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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) ClassTy = cast(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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // 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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // 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 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) // struct _objc_symtab* symtab; // } ModuleTy = - VMContext.getStructType(LongTy, + llvm::StructType::get(LongTy, LongTy, Int8PtrTy, SymtabPtrTy, @@ -3809,11 +3809,11 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm) 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // } // 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // } // FIXME. Add 'reserved' field in 64bit abi mode! - ClassRonfABITy = VMContext.getStructType(IntTy, + ClassRonfABITy = llvm::StructType::get(IntTy, IntTy, IntTy, Int8PtrTy, @@ -3950,8 +3950,8 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul std::vector 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // 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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul MessageRefTy = cast(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 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul // 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 @@ void CGObjCNonFragileABIMac::AddModuleClassList(const 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 @@ void CGObjCNonFragileABIMac::FinishNonFragileABIModule() { 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 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList( 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 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList( 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 @@ CGObjCNonFragileABIMac::EmitProtocolList(const std::string &Name, 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 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend( 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); } diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 28d729c225..82ec1eb603 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -403,7 +403,7 @@ unsigned CodeGenFunction::GetIDForAddrOfLabel(const LabelStmt *L) { } 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 @@ void CodeGenFunction::EmitMemSetToZero(llvm::Value *DestPtr, QualType Ty) { 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), diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index f0b90f05b0..6aba6c25f3 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -196,15 +196,15 @@ void CodeGenModule::AddGlobalDtor(llvm::Function * Dtor, int Priority) { 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(), 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 Ctors; @@ -217,7 +217,7 @@ void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) { } 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 @@ void CodeGenModule::EmitAnnotations() { // 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 @@ void CodeGenModule::EmitLLVMUsed() { 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 UsedArray; @@ -431,7 +431,7 @@ void CodeGenModule::EmitLLVMUsed() { 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 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV, // 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 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(const char *MangledName, 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 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(const char *MangledName, // sure not to try to set attributes. bool IsIncompleteFunction = false; if (!isa(Ty)) { - Ty = VMContext.getFunctionType(llvm::Type::VoidTy, + Ty = llvm::FunctionType::get(llvm::Type::VoidTy, std::vector(), false); IsIncompleteFunction = true; } @@ -755,7 +755,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, 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 @@ CodeGenModule::CreateRuntimeVariable(const llvm::Type *Ty, 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 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) { // Just create the same type as was lowered by ConvertType // but strip off the varargs bit. std::vector 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 @@ void CodeGenModule::EmitAliasDefinition(const ValueDecl *D) { 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 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { // 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 diff --git a/lib/CodeGen/TargetABIInfo.cpp b/lib/CodeGen/TargetABIInfo.cpp index 938281e9db..ae9ccb1be4 100644 --- a/lib/CodeGen/TargetABIInfo.cpp +++ b/lib/CodeGen/TargetABIInfo.cpp @@ -308,14 +308,14 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy, // 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 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy, // 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 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy, // 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 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy, // 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 @@ ABIArgInfo X86_32ABIInfo::classifyArgumentType(QualType Ty, 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 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy, // %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 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy, 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 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy, // 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 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy, // 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 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, ASTContext &Context, 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 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, ASTContext &Context, // 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 @@ ABIArgInfo X86_64ABIInfo::classifyArgumentType(QualType Ty, ASTContext &Context, // 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 @@ void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI, ASTContext &Context, 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 @@ static llvm::Value *EmitVAArgFromMemory(llvm::Value *VAListAddr, 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 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, 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 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, 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 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, 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 @@ llvm::Value *X86_64ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty, 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 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, SizeRegs = (Context.getTypeSize(Ty) + 31) / 32; } std::vector 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 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy, 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 =