forked from OSchip/llvm-project
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; } llvm-svn: 64683
This commit is contained in:
parent
fc3eb09a0f
commit
e084c01124
|
@ -813,7 +813,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
|
||||||
if (Base.isSimple()) {
|
if (Base.isSimple()) {
|
||||||
llvm::Constant *CV = GenerateConstantVector(Indices);
|
llvm::Constant *CV = GenerateConstantVector(Indices);
|
||||||
return LValue::MakeExtVectorElt(Base.getAddress(), CV,
|
return LValue::MakeExtVectorElt(Base.getAddress(), CV,
|
||||||
E->getBase()->getType().getCVRQualifiers());
|
Base.getQualifiers());
|
||||||
}
|
}
|
||||||
assert(Base.isExtVectorElt() && "Can only subscript lvalue vec elts here!");
|
assert(Base.isExtVectorElt() && "Can only subscript lvalue vec elts here!");
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
|
||||||
}
|
}
|
||||||
llvm::Constant *CV = llvm::ConstantVector::get(&CElts[0], CElts.size());
|
llvm::Constant *CV = llvm::ConstantVector::get(&CElts[0], CElts.size());
|
||||||
return LValue::MakeExtVectorElt(Base.getExtVectorAddr(), CV,
|
return LValue::MakeExtVectorElt(Base.getExtVectorAddr(), CV,
|
||||||
E->getBase()->getType().getCVRQualifiers());
|
Base.getQualifiers());
|
||||||
}
|
}
|
||||||
|
|
||||||
LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
||||||
|
@ -846,16 +846,14 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
||||||
if (PTy->getPointeeType()->isUnionType())
|
if (PTy->getPointeeType()->isUnionType())
|
||||||
isUnion = true;
|
isUnion = true;
|
||||||
CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
|
CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
|
||||||
}
|
} else if (isa<ObjCPropertyRefExpr>(BaseExpr) ||
|
||||||
else if (BaseExpr->getStmtClass() == Expr::ObjCPropertyRefExprClass ||
|
isa<ObjCKVCRefExpr>(BaseExpr)) {
|
||||||
BaseExpr->getStmtClass() == Expr::ObjCKVCRefExprClass) {
|
|
||||||
RValue RV = EmitObjCPropertyGet(BaseExpr);
|
RValue RV = EmitObjCPropertyGet(BaseExpr);
|
||||||
BaseValue = RV.getAggregateAddr();
|
BaseValue = RV.getAggregateAddr();
|
||||||
if (BaseExpr->getType()->isUnionType())
|
if (BaseExpr->getType()->isUnionType())
|
||||||
isUnion = true;
|
isUnion = true;
|
||||||
CVRQualifiers = BaseExpr->getType().getCVRQualifiers();
|
CVRQualifiers = BaseExpr->getType().getCVRQualifiers();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
LValue BaseLV = EmitLValue(BaseExpr);
|
LValue BaseLV = EmitLValue(BaseExpr);
|
||||||
if (BaseLV.isObjCIvar())
|
if (BaseLV.isObjCIvar())
|
||||||
isIvar = true;
|
isIvar = true;
|
||||||
|
@ -869,7 +867,8 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
|
||||||
FieldDecl *Field = dyn_cast<FieldDecl>(E->getMemberDecl());
|
FieldDecl *Field = dyn_cast<FieldDecl>(E->getMemberDecl());
|
||||||
// FIXME: Handle non-field member expressions
|
// FIXME: Handle non-field member expressions
|
||||||
assert(Field && "No code generation for non-field member references");
|
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);
|
LValue::SetObjCIvar(MemExpLV, isIvar);
|
||||||
return MemExpLV;
|
return MemExpLV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,10 @@ public:
|
||||||
|
|
||||||
bool isVolatileQualified() const { return Volatile; }
|
bool isVolatileQualified() const { return Volatile; }
|
||||||
bool isRestrictQualified() const { return Restrict; }
|
bool isRestrictQualified() const { return Restrict; }
|
||||||
|
unsigned getQualifiers() const {
|
||||||
|
return (Volatile ? QualType::Volatile : 0) |
|
||||||
|
(Restrict ? QualType::Restrict : 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool isObjCIvar() const { return Ivar; }
|
bool isObjCIvar() const { return Ivar; }
|
||||||
bool isObjCWeak() const { return ObjCType == Weak; }
|
bool isObjCWeak() const { return ObjCType == Weak; }
|
||||||
|
@ -275,8 +279,8 @@ public:
|
||||||
SetQualifiers(Qualifiers,R);
|
SetQualifiers(Qualifiers,R);
|
||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
static LValue MakeKVCRef(const ObjCKVCRefExpr *E,
|
|
||||||
unsigned Qualifiers) {
|
static LValue MakeKVCRef(const ObjCKVCRefExpr *E, unsigned Qualifiers) {
|
||||||
LValue R;
|
LValue R;
|
||||||
R.LVType = KVCRef;
|
R.LVType = KVCRef;
|
||||||
R.KVCRefExpr = E;
|
R.KVCRefExpr = E;
|
||||||
|
|
Loading…
Reference in New Issue