From: Owen Anderson <resistor@mac.com> Date: Thu, 30 Jul 2009 23:11:26 +0000 (+0000) Subject: Update for LLVM API changes. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03e205031b08669f05c41eed5b896fc94c4a12bb;p=clang Update for LLVM API changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77638 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 05f27d57a6..9f88bb8cbf 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -605,7 +605,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, // Unknown builtin, for now just dump it out and return undef. if (hasAggregateLLVMType(E->getType())) return RValue::getAggregate(CreateTempAlloca(ConvertType(E->getType()))); - return RValue::get(VMContext.getUndef(ConvertType(E->getType()))); + return RValue::get(llvm::UndefValue::get(ConvertType(E->getType()))); } Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID, @@ -639,7 +639,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, Ops[1] = Builder.CreateZExt(Ops[1], llvm::Type::Int64Ty, "zext"); 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] = Builder.CreateInsertElement(llvm::UndefValue::get(Ty), Ops[1], Zero, "insert"); Ops[1] = Builder.CreateBitCast(Ops[1], Ops[0]->getType(), "bitcast"); const char *name = 0; diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index b8b774f7f0..4d48f0801f 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -267,7 +267,7 @@ CodeGenFunction::EmitCXXConstructExpr(llvm::Value *Dest, llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) { if (E->isArray()) { ErrorUnsupported(E, "new[] expression"); - return VMContext.getUndef(ConvertType(E->getType())); + return llvm::UndefValue::get(ConvertType(E->getType())); } QualType AllocType = E->getAllocatedType(); diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 8367c27fa1..3e9a2739c4 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -121,13 +121,13 @@ RValue CodeGenFunction::GetUndefRValue(QualType Ty) { return RValue::get(0); } else if (const ComplexType *CTy = Ty->getAsComplexType()) { const llvm::Type *EltTy = ConvertType(CTy->getElementType()); - llvm::Value *U = VMContext.getUndef(EltTy); + llvm::Value *U = llvm::UndefValue::get(EltTy); return RValue::getComplex(std::make_pair(U, U)); } else if (hasAggregateLLVMType(Ty)) { const llvm::Type *LTy = llvm::PointerType::getUnqual(ConvertType(Ty)); - return RValue::getAggregate(VMContext.getUndef(LTy)); + return RValue::getAggregate(llvm::UndefValue::get(LTy)); } else { - return RValue::get(VMContext.getUndef(ConvertType(Ty))); + return RValue::get(llvm::UndefValue::get(ConvertType(Ty))); } } @@ -141,7 +141,7 @@ LValue CodeGenFunction::EmitUnsupportedLValue(const Expr *E, const char *Name) { ErrorUnsupported(E, Name); llvm::Type *Ty = llvm::PointerType::getUnqual(ConvertType(E->getType())); - return LValue::MakeAddr(VMContext.getUndef(Ty), + return LValue::MakeAddr(llvm::UndefValue::get(Ty), E->getType().getCVRQualifiers(), getContext().getObjCGCAttrKind(E->getType()), E->getType().getAddressSpace()); @@ -412,7 +412,7 @@ RValue CodeGenFunction::EmitLoadOfExtVectorElementLValue(LValue LV, llvm::Value *MaskV = llvm::ConstantVector::get(&Mask[0], Mask.size()); Vec = Builder.CreateShuffleVector(Vec, - VMContext.getUndef(Vec->getType()), + llvm::UndefValue::get(Vec->getType()), MaskV, "tmp"); return RValue::get(Vec); } @@ -617,7 +617,7 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, llvm::Value *MaskV = llvm::ConstantVector::get(&Mask[0], Mask.size()); Vec = Builder.CreateShuffleVector(SrcVal, - VMContext.getUndef(Vec->getType()), + llvm::UndefValue::get(Vec->getType()), MaskV, "tmp"); } else if (NumDstElts > NumSrcElts) { // Extended the source vector to the same length and then shuffle it @@ -629,12 +629,12 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src, for (i = 0; i != NumSrcElts; ++i) ExtMask.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, i)); for (; i != NumDstElts; ++i) - ExtMask.push_back(VMContext.getUndef(llvm::Type::Int32Ty)); + ExtMask.push_back(llvm::UndefValue::get(llvm::Type::Int32Ty)); llvm::Value *ExtMaskV = llvm::ConstantVector::get(&ExtMask[0], ExtMask.size()); llvm::Value *ExtSrcVal = Builder.CreateShuffleVector(SrcVal, - VMContext.getUndef(SrcVal->getType()), + llvm::UndefValue::get(SrcVal->getType()), ExtMaskV, "tmp"); // build identity llvm::SmallVector<llvm::Constant*, 4> Mask; diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 59f5c83e30..dd163a988e 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -200,7 +200,7 @@ public: const llvm::Type *ElementType = VType->getElementType(); // Emit individual vector element stores. - llvm::Value *V = VMContext.getUndef(VType); + llvm::Value *V = llvm::UndefValue::get(VType); // Emit initializers unsigned i; @@ -473,7 +473,7 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, llvm::Value *Elt = EmitScalarConversion(Src, SrcType, EltTy); // Insert the element in element zero of an undef vector - llvm::Value *UnV = VMContext.getUndef(DstTy); + llvm::Value *UnV = llvm::UndefValue::get(DstTy); llvm::Value *Idx = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0); UnV = Builder.CreateInsertElement(UnV, Elt, Idx, "tmp"); @@ -552,7 +552,7 @@ Value *ScalarExprEmitter::VisitExpr(Expr *E) { CGF.ErrorUnsupported(E, "scalar expression"); if (E->getType()->isVoidType()) return 0; - return VMContext.getUndef(CGF.ConvertType(E->getType())); + return llvm::UndefValue::get(CGF.ConvertType(E->getType())); } Value *ScalarExprEmitter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { @@ -875,7 +875,7 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E, // (Note that we do actually need the imaginary part of the RHS for // multiplication and division.) CGF.ErrorUnsupported(E, "complex compound assignment"); - return VMContext.getUndef(CGF.ConvertType(E->getType())); + return llvm::UndefValue::get(CGF.ConvertType(E->getType())); } // Emit the RHS first. __block variables need to have the rhs evaluated @@ -1612,7 +1612,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(llvm::VectorType::get(Vals[0]->getType(), NumVals)); + = llvm::UndefValue::get(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 85a5141951..6974f986b4 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -212,7 +212,7 @@ CGObjCGNU::CGObjCGNU(CodeGen::CodeGenModule &cgm) Zeros[0] = llvm::ConstantInt::get(LongTy, 0); Zeros[1] = Zeros[0]; - NULLPtr = VMContext.getConstantPointerNull( + NULLPtr = llvm::ConstantPointerNull::get( llvm::PointerType::getUnqual(llvm::Type::Int8Ty)); // C string type. Used in lots of places. PtrToInt8Ty = @@ -464,7 +464,7 @@ CGObjCGNU::GenerateMessageSend(CodeGen::CodeGenFunction &CGF, if (isa<ObjCMethodDecl>(CGF.CurFuncDecl)) { self = CGF.LoadObjCSelf(); } else { - self = VMContext.getConstantPointerNull(IdTy); + self = llvm::ConstantPointerNull::get(IdTy); } Params.push_back(self->getType()); llvm::Constant *lookupFunction = @@ -538,7 +538,7 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const std::string &ClassName, ObjCMethodListTy = llvm::cast<llvm::StructType>(OpaqueNextTy.get()); Methods.clear(); - Methods.push_back(VMContext.getConstantPointerNull( + Methods.push_back(llvm::ConstantPointerNull::get( llvm::PointerType::getUnqual(ObjCMethodListTy))); Methods.push_back(llvm::ConstantInt::get(llvm::Type::Int32Ty, MethodTypes.size())); @@ -620,7 +620,7 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure( NULL); llvm::Constant *Zero = llvm::ConstantInt::get(LongTy, 0); llvm::Constant *NullP = - VMContext.getConstantPointerNull(PtrTy); + llvm::ConstantPointerNull::get(PtrTy); // Fill in the structure std::vector<llvm::Constant*> Elements; Elements.push_back(llvm::ConstantExpr::getBitCast(MetaClass, PtrToInt8Ty)); @@ -966,7 +966,7 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { if (!SuperClassName.empty()) { SuperClass = MakeConstantString(SuperClassName, ".super_class_name"); } else { - SuperClass = VMContext.getConstantPointerNull(PtrToInt8Ty); + SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty); } // Empty vector used to construct empty method lists llvm::SmallVector<llvm::Constant*, 1> empty; diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index fb4b924765..bb53dcc39e 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -156,7 +156,7 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy, // Create a marker to make it easy to insert allocas into the entryblock // later. Don't create this with the builder, because we don't want it // folded. - llvm::Value *Undef = VMContext.getUndef(llvm::Type::Int32Ty); + llvm::Value *Undef = llvm::UndefValue::get(llvm::Type::Int32Ty); AllocaInsertPt = new llvm::BitCastInst(Undef, llvm::Type::Int32Ty, "", EntryBB); if (Builder.isNamePreserving()) diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 6aba6c25f3..2cc0aab22a 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -808,7 +808,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { if (!Init) { ErrorUnsupported(D, "static initializer"); QualType T = D->getInit()->getType(); - Init = VMContext.getUndef(getTypes().ConvertType(T)); + Init = llvm::UndefValue::get(getTypes().ConvertType(T)); } }