[llvm-commits] [llvm-gcc-4.0] r41698 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
Gordon Henriksen
gordonhenriksen at mac.com
Tue Sep 4 09:57:26 PDT 2007
Hm. Did revision 41697 not get mailed, or is it just me?
On 2007-09-04, at 12:14, David Greene wrote:
> Author: greened
> Date: Tue Sep 4 11:14:57 2007
> New Revision: 41698
>
> URL: http://llvm.org/viewvc/llvm-project?rev=41698&view=rev
> Log:
> Update for new GEP interface.
>
>
> Modified:
> llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
>
> Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/
> llvm-convert.cpp?rev=41698&r1=41697&r2=41698&view=diff
>
> ======================================================================
> ========
> --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
> +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Tue Sep 4 11:14:57 2007
> @@ -478,7 +478,7 @@
> ConstantInt::get(Type::Int32Ty, FieldNo)
> };
>
> - Loc = Builder.CreateGEP(Loc, Idxs, 2, "tmp");
> + Loc = Builder.CreateGEP(Loc, Idxs, Idxs + 2, "tmp");
> LocStack.push_back(Loc);
> }
> void ExitField() {
> @@ -1165,8 +1165,9 @@
> if (isPaddingElement(STy, i))
> continue;
> Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
> - Value *DElPtr = Builder.CreateGEP(DestPtr, Zero, Idx, "tmp");
> - Value *SElPtr = Builder.CreateGEP(SrcPtr, Zero, Idx, "tmp");
> + Value *Idxs[2] = { Zero, Idx };
> + Value *DElPtr = Builder.CreateGEP(DestPtr, Idxs, Idxs + 2,
> "tmp");
> + Value *SElPtr = Builder.CreateGEP(SrcPtr, Idxs, Idxs + 2,
> "tmp");
> CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile,
> Alignment,
> Builder);
> }
> @@ -1175,8 +1176,9 @@
> Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
> for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
> Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
> - Value *DElPtr = Builder.CreateGEP(DestPtr, Zero, Idx, "tmp");
> - Value *SElPtr = Builder.CreateGEP(SrcPtr, Zero, Idx, "tmp");
> + Value *Idxs[2] = { Zero, Idx };
> + Value *DElPtr = Builder.CreateGEP(DestPtr, Idxs, Idxs + 2,
> "tmp");
> + Value *SElPtr = Builder.CreateGEP(SrcPtr, Idxs, Idxs + 2,
> "tmp");
> CopyAggregate(DElPtr, SElPtr, isDstVolatile, isSrcVolatile,
> Alignment,
> Builder);
> }
> @@ -1246,14 +1248,18 @@
> Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
> for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
> Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
> - ZeroAggregate(Builder.CreateGEP(DestPtr, Zero, Idx, "tmp"),
> Builder);
> + Value *Idxs[2] = { Zero, Idx };
> + ZeroAggregate(Builder.CreateGEP(DestPtr, Idxs, Idxs + 2,
> "tmp"),
> + Builder);
> }
> } else {
> const ArrayType *ATy = cast<ArrayType>(ElTy);
> Constant *Zero = ConstantInt::get(Type::Int32Ty, 0);
> for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
> Constant *Idx = ConstantInt::get(Type::Int32Ty, i);
> - ZeroAggregate(Builder.CreateGEP(DestPtr, Zero, Idx, "tmp"),
> Builder);
> + Value *Idxs[2] = { Zero, Idx };
> + ZeroAggregate(Builder.CreateGEP(DestPtr, Idxs, Idxs + 2,
> "tmp"),
> + Builder);
> }
> }
> }
> @@ -2708,8 +2714,9 @@
> if (cast<PointerType>(Loc->getType())->getElementType() !=
> StructTy)
> // This always deals with pointer types so BitCast is
> appropriate
> Loc = Builder.CreateBitCast(Loc, PointerType::get
> (StructTy), "tmp");
> -
> - LocStack.push_back(Builder.CreateGEP(Loc, Zero, FIdx, "tmp"));
> +
> + Value *Idxs[2] = { Zero, FIdx };
> + LocStack.push_back(Builder.CreateGEP(Loc, Idxs, Idxs + 2,
> "tmp"));
> }
> void ExitField() {
> LocStack.pop_back();
> @@ -4973,23 +4980,27 @@
> Value *SrcComplex, bool
> isVolatile) {
> Value *I0 = ConstantInt::get(Type::Int32Ty, 0);
> Value *I1 = ConstantInt::get(Type::Int32Ty, 1);
> + Value *Idxs[2] = { I0, I0 };
>
> - Value *RealPtr = Builder.CreateGEP(SrcComplex, I0, I0, "real");
> + Value *RealPtr = Builder.CreateGEP(SrcComplex, Idxs, Idxs + 2,
> "real");
> Real = Builder.CreateLoad(RealPtr, isVolatile, "real");
> -
> - Value *ImagPtr = Builder.CreateGEP(SrcComplex, I0, I1, "real");
> +
> + Idxs[1] = I1;
> + Value *ImagPtr = Builder.CreateGEP(SrcComplex, Idxs, Idxs + 2,
> "real");
> Imag = Builder.CreateLoad(ImagPtr, isVolatile, "imag");
> }
>
> void TreeToLLVM::EmitStoreToComplex(Value *DestComplex, Value *Real,
> Value *Imag, bool isVolatile) {
> Value *I0 = ConstantInt::get(Type::Int32Ty, 0);
> - Value *I1 = ConstantInt::get(Type::Int32Ty, 1);
> -
> - Value *RealPtr = Builder.CreateGEP(DestComplex, I0, I0, "real");
> + Value *I1 = ConstantInt::get(Type::Int32Ty, 1);
> + Value *Idxs[2] = { I0, I0 };
> +
> + Value *RealPtr = Builder.CreateGEP(DestComplex, Idxs, Idxs + 2,
> "real");
> Builder.CreateStore(Real, RealPtr, isVolatile);
>
> - Value *ImagPtr = Builder.CreateGEP(DestComplex, I0, I1, "real");
> + Idxs[1] = I1;
> + Value *ImagPtr = Builder.CreateGEP(DestComplex, Idxs, Idxs + 2,
> "real");
> Builder.CreateStore(Imag, ImagPtr, isVolatile);
> }
>
> @@ -5198,8 +5209,8 @@
>
> // If this is an index into an LLVM array, codegen as a GEP.
> if (isArrayCompatible(ArrayType)) {
> - Value *Ptr = Builder.CreateGEP(ArrayAddr,ConstantInt::get
> (Type::Int32Ty, 0),
> - IndexVal, "tmp");
> + Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0),
> IndexVal };
> + Value *Ptr = Builder.CreateGEP(ArrayAddr, Idxs, Idxs + 2, "tmp");
> return BitCastToType(Ptr, PointerType::get(ConvertType
> (TREE_TYPE(exp))));
> }
>
> @@ -5282,9 +5293,8 @@
> uint32_t MemberIndex = CI->getZExtValue();
> assert(MemberIndex < StructTy->getNumContainedTypes() &&
> "Field Idx out of range!");
> - FieldPtr = Builder.CreateGEP(StructAddrLV.Ptr,
> - Constant::getNullValue
> (Type::Int32Ty), CI,
> - "tmp");
> + Value *Idxs[2] = { Constant::getNullValue(Type::Int32Ty), CI };
> + FieldPtr = Builder.CreateGEP(StructAddrLV.Ptr, Idxs, Idxs + 2,
> "tmp");
>
> // Now that we did an offset from the start of the struct,
> subtract off
> // the offset from BitStart.
> @@ -5435,9 +5445,9 @@
> LValue Ptr = EmitLV(TREE_OPERAND(exp, 0));
> assert(!Ptr.isBitfield() && "BIT_FIELD_REF operands cannot be
> bitfields!");
>
> - return LValue(Builder.CreateGEP(Ptr.Ptr,
> - ConstantInt::get(Type::Int32Ty, 0),
> - ConstantInt::get(Type::Int32Ty,
> Idx), "tmp"));
> + Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0),
> + ConstantInt::get(Type::Int32Ty, Idx) };
> + return LValue(Builder.CreateGEP(Ptr.Ptr, Idxs, Idxs + 2, "tmp"));
> }
>
> LValue TreeToLLVM::EmitLV_VIEW_CONVERT_EXPR(tree exp) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
— Gordon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070904/4cfae00f/attachment.html>
More information about the llvm-commits
mailing list