diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-16 21:11:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-16 21:11:58 +0000 |
commit | 73525de7fd9bdd534382dc89a24f1f76db3e04b9 (patch) | |
tree | d7f67878553325ca2d681aaa3ed412c98bce6c9f /lib/CodeGen/CGExpr.cpp | |
parent | 450da9832b31d9b2e90af7708d197e5b9e1af8c8 (diff) |
enhance ExtVectorElementExpr to allow V->xxyy to work like (*V).xxyy
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 3e44c0079b..03efbc9ad5 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -257,13 +257,8 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) { if (LV.isPropertyRef()) return EmitLoadOfPropertyRefLValue(LV, ExprType); - if (LV.isKVCRef()) - return EmitLoadOfKVCRefLValue(LV, ExprType); - - assert(0 && "Unknown LValue type!"); - //an invalid RValue, but the assert will - //ensure that this point is never reached - return RValue(); + assert(LV.isKVCRef() && "Unknown LValue type!"); + return EmitLoadOfKVCRefLValue(LV, ExprType); } RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV, @@ -799,7 +794,16 @@ llvm::Constant *GenerateConstantVector(llvm::SmallVector<unsigned, 4> &Elts) { LValue CodeGenFunction:: EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { // Emit the base vector as an l-value. - LValue Base = EmitLValue(E->getBase()); + LValue Base; + + // ExtVectorElementExpr's base can either be a vector or pointer to vector. + if (const PointerType *PT = E->getBase()->getType()->getAsPointerType()) { + llvm::Value *Ptr = EmitScalarExpr(E->getBase()); + Base = LValue::MakeAddr(Ptr, PT->getPointeeType().getCVRQualifiers()); + } else { + assert(E->getBase()->getType()->isVectorType()); + Base = EmitLValue(E->getBase()); + } // Encode the element access list into a vector of unsigned indices. llvm::SmallVector<unsigned, 4> Indices; |