[cfe-commits] r64683 - in /cfe/trunk/lib/CodeGen: CGExpr.cpp CGValue.h
Chris Lattner
sabre at nondot.org
Mon Feb 16 14:25:49 PST 2009
Author: lattner
Date: Mon Feb 16 16:25:49 2009
New Revision: 64683
URL: http://llvm.org/viewvc/llvm-project?rev=64683&view=rev
Log:
fix volatile handling with ExtVectorElementExpr, so that we
emit two volatile loads for:
typedef __attribute__(( ext_vector_type(4) )) float float4;
float test(volatile float4 *P) {
return P->x+P->y;
}
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGValue.h
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=64683&r1=64682&r2=64683&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Feb 16 16:25:49 2009
@@ -813,7 +813,7 @@
if (Base.isSimple()) {
llvm::Constant *CV = GenerateConstantVector(Indices);
return LValue::MakeExtVectorElt(Base.getAddress(), CV,
- E->getBase()->getType().getCVRQualifiers());
+ Base.getQualifiers());
}
assert(Base.isExtVectorElt() && "Can only subscript lvalue vec elts here!");
@@ -828,7 +828,7 @@
}
llvm::Constant *CV = llvm::ConstantVector::get(&CElts[0], CElts.size());
return LValue::MakeExtVectorElt(Base.getExtVectorAddr(), CV,
- E->getBase()->getType().getCVRQualifiers());
+ Base.getQualifiers());
}
LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
@@ -846,16 +846,14 @@
if (PTy->getPointeeType()->isUnionType())
isUnion = true;
CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
- }
- else if (BaseExpr->getStmtClass() == Expr::ObjCPropertyRefExprClass ||
- BaseExpr->getStmtClass() == Expr::ObjCKVCRefExprClass) {
+ } else if (isa<ObjCPropertyRefExpr>(BaseExpr) ||
+ isa<ObjCKVCRefExpr>(BaseExpr)) {
RValue RV = EmitObjCPropertyGet(BaseExpr);
BaseValue = RV.getAggregateAddr();
if (BaseExpr->getType()->isUnionType())
isUnion = true;
CVRQualifiers = BaseExpr->getType().getCVRQualifiers();
- }
- else {
+ } else {
LValue BaseLV = EmitLValue(BaseExpr);
if (BaseLV.isObjCIvar())
isIvar = true;
@@ -869,7 +867,8 @@
FieldDecl *Field = dyn_cast<FieldDecl>(E->getMemberDecl());
// FIXME: Handle non-field member expressions
assert(Field && "No code generation for non-field member references");
- LValue MemExpLV = EmitLValueForField(BaseValue, Field, isUnion, CVRQualifiers);
+ LValue MemExpLV = EmitLValueForField(BaseValue, Field, isUnion,
+ CVRQualifiers);
LValue::SetObjCIvar(MemExpLV, isIvar);
return MemExpLV;
}
Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=64683&r1=64682&r2=64683&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Mon Feb 16 16:25:49 2009
@@ -169,6 +169,10 @@
bool isVolatileQualified() const { return Volatile; }
bool isRestrictQualified() const { return Restrict; }
+ unsigned getQualifiers() const {
+ return (Volatile ? QualType::Volatile : 0) |
+ (Restrict ? QualType::Restrict : 0);
+ }
bool isObjCIvar() const { return Ivar; }
bool isObjCWeak() const { return ObjCType == Weak; }
@@ -275,8 +279,8 @@
SetQualifiers(Qualifiers,R);
return R;
}
- static LValue MakeKVCRef(const ObjCKVCRefExpr *E,
- unsigned Qualifiers) {
+
+ static LValue MakeKVCRef(const ObjCKVCRefExpr *E, unsigned Qualifiers) {
LValue R;
R.LVType = KVCRef;
R.KVCRefExpr = E;
More information about the cfe-commits
mailing list