[cfe-commits] r41704 - in /cfe/trunk/CodeGen: CGExprComplex.cpp CGExprScalar.cpp
Ted Kremenek
kremenek at apple.com
Tue Sep 4 10:20:09 PDT 2007
Author: kremenek
Date: Tue Sep 4 12:20:08 2007
New Revision: 41704
URL: http://llvm.org/viewvc/llvm-project?rev=41704&view=rev
Log:
Updated calls to CreateGEP to new interface in LLVM mainline.
Modified:
cfe/trunk/CodeGen/CGExprComplex.cpp
cfe/trunk/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprComplex.cpp?rev=41704&r1=41703&r2=41704&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/CodeGen/CGExprComplex.cpp Tue Sep 4 12:20:08 2007
@@ -191,14 +191,18 @@
SrcPtr->getNameStart()+SrcPtr->getNameLen());
Name += ".realp";
- llvm::Value *RealPtr = Builder.CreateGEP(SrcPtr, Zero, Zero, Name.c_str());
+ llvm::Value *Ops[] = {Zero, Zero};
+ llvm::Value *RealPtr = Builder.CreateGEP(SrcPtr, Ops, Ops+2, Name.c_str());
Name.pop_back(); // .realp -> .real
llvm::Value *Real = Builder.CreateLoad(RealPtr, isVolatile, Name.c_str());
Name.resize(Name.size()-4); // .real -> .imagp
Name += "imagp";
- llvm::Value *ImagPtr = Builder.CreateGEP(SrcPtr, Zero, One, Name.c_str());
+
+ Ops[1] = One; // { Ops = { Zero, One }
+ llvm::Value *ImagPtr = Builder.CreateGEP(SrcPtr, Ops, Ops+2, Name.c_str());
+
Name.pop_back(); // .imagp -> .imag
llvm::Value *Imag = Builder.CreateLoad(ImagPtr, isVolatile, Name.c_str());
return ComplexPairTy(Real, Imag);
@@ -210,8 +214,12 @@
bool isVolatile) {
llvm::Constant *Zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
llvm::Constant *One = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1);
- llvm::Value *RealPtr = Builder.CreateGEP(Ptr, Zero, Zero, "real");
- llvm::Value *ImagPtr = Builder.CreateGEP(Ptr, Zero, One, "imag");
+
+ llvm::Value *Ops[] = {Zero, Zero};
+ llvm::Value *RealPtr = Builder.CreateGEP(Ptr, Ops, Ops+2, "real");
+
+ Ops[1] = One; // { Ops = { Zero, One }
+ llvm::Value *ImagPtr = Builder.CreateGEP(Ptr, Ops, Ops+2, "imag");
Builder.CreateStore(Val.first, RealPtr, isVolatile);
Builder.CreateStore(Val.second, ImagPtr, isVolatile);
Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=41704&r1=41703&r2=41704&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Tue Sep 4 12:20:08 2007
@@ -415,7 +415,9 @@
->getElementType()) &&
"Doesn't support VLAs yet!");
llvm::Constant *Idx0 = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0);
- return Builder.CreateGEP(V, Idx0, Idx0, "arraydecay");
+
+ llvm::Value *Ops[] = {Idx0, Idx0};
+ return Builder.CreateGEP(V, Ops, Ops+2, "arraydecay");
}
return EmitCastExpr(Op, E->getType());
More information about the cfe-commits
mailing list