diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
commit | 1928da94b55683957759d5c5ff4593a118773394 (patch) | |
tree | 48b44512b5db8ced345df4a1a56b5065cf2a14d9 /lib/CodeGen/CGExprComplex.cpp | |
parent | 53992adde3eda3ccf9da63bc7e45673f043de18f (diff) | |
download | FreeBSD-src-1928da94b55683957759d5c5ff4593a118773394.zip FreeBSD-src-1928da94b55683957759d5c5ff4593a118773394.tar.gz |
Update clang to r108243.
Diffstat (limited to 'lib/CodeGen/CGExprComplex.cpp')
-rw-r--r-- | lib/CodeGen/CGExprComplex.cpp | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp index 0a0c914..90b6446 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/lib/CodeGen/CGExprComplex.cpp @@ -181,7 +181,7 @@ public: ComplexPairTy VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) { return CGF.EmitCXXExprWithTemporaries(E).getComplexVal(); } - ComplexPairTy VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E) { + ComplexPairTy VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) { assert(E->getType()->isAnyComplexType() && "Expected complex type!"); QualType Elem = E->getType()->getAs<ComplexType>()->getElementType(); llvm::Constant *Null = llvm::Constant::getNullValue(CGF.ConvertType(Elem)); @@ -523,20 +523,20 @@ EmitCompoundAssign(const CompoundAssignOperator *E, OpInfo.Ty = E->getComputationResultType(); OpInfo.RHS = EmitCast(E->getRHS(), OpInfo.Ty); - LValue LHSLV = CGF.EmitLValue(E->getLHS()); + LValue LHS = CGF.EmitLValue(E->getLHS()); // We know the LHS is a complex lvalue. ComplexPairTy LHSComplexPair; - if (LHSLV.isPropertyRef()) - LHSComplexPair = - CGF.EmitObjCPropertyGet(LHSLV.getPropertyRefExpr()).getComplexVal(); - else if (LHSLV.isKVCRef()) - LHSComplexPair = - CGF.EmitObjCPropertyGet(LHSLV.getKVCRefExpr()).getComplexVal(); + if (LHS.isPropertyRef()) + LHSComplexPair = + CGF.EmitObjCPropertyGet(LHS.getPropertyRefExpr()).getComplexVal(); + else if (LHS.isKVCRef()) + LHSComplexPair = + CGF.EmitObjCPropertyGet(LHS.getKVCRefExpr()).getComplexVal(); else - LHSComplexPair = EmitLoadOfComplex(LHSLV.getAddress(), - LHSLV.isVolatileQualified()); + LHSComplexPair = EmitLoadOfComplex(LHS.getAddress(), + LHS.isVolatileQualified()); - OpInfo.LHS=EmitComplexToComplexCast(LHSComplexPair, LHSTy, OpInfo.Ty); + OpInfo.LHS = EmitComplexToComplexCast(LHSComplexPair, LHSTy, OpInfo.Ty); // Expand the binary operator. ComplexPairTy Result = (this->*Func)(OpInfo); @@ -545,23 +545,26 @@ EmitCompoundAssign(const CompoundAssignOperator *E, Result = EmitComplexToComplexCast(Result, OpInfo.Ty, LHSTy); // Store the result value into the LHS lvalue. - if (LHSLV.isPropertyRef()) - CGF.EmitObjCPropertySet(LHSLV.getPropertyRefExpr(), + if (LHS.isPropertyRef()) + CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), RValue::getComplex(Result)); - else if (LHSLV.isKVCRef()) - CGF.EmitObjCPropertySet(LHSLV.getKVCRefExpr(), RValue::getComplex(Result)); + else if (LHS.isKVCRef()) + CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Result)); else - EmitStoreOfComplex(Result, LHSLV.getAddress(), LHSLV.isVolatileQualified()); - // And now return the LHS + EmitStoreOfComplex(Result, LHS.getAddress(), LHS.isVolatileQualified()); + + // Restore the Ignore* flags. IgnoreReal = ignreal; IgnoreImag = ignimag; IgnoreRealAssign = ignreal; IgnoreImagAssign = ignimag; - if (LHSLV.isPropertyRef()) - return CGF.EmitObjCPropertyGet(LHSLV.getPropertyRefExpr()).getComplexVal(); - else if (LHSLV.isKVCRef()) - return CGF.EmitObjCPropertyGet(LHSLV.getKVCRefExpr()).getComplexVal(); - return EmitLoadOfComplex(LHSLV.getAddress(), LHSLV.isVolatileQualified()); + + // Objective-C property assignment never reloads the value following a store. + if (LHS.isPropertyRef() || LHS.isKVCRef()) + return Result; + + // Otherwise, reload the value. + return EmitLoadOfComplex(LHS.getAddress(), LHS.isVolatileQualified()); } ComplexPairTy ComplexExprEmitter::VisitBinAssign(const BinaryOperator *E) { @@ -578,31 +581,26 @@ ComplexPairTy ComplexExprEmitter::VisitBinAssign(const BinaryOperator *E) { // Compute the address to store into. LValue LHS = CGF.EmitLValue(E->getLHS()); - // Store into it, if simple. - if (LHS.isSimple()) { - EmitStoreOfComplex(Val, LHS.getAddress(), LHS.isVolatileQualified()); - - // And now return the LHS - IgnoreReal = ignreal; - IgnoreImag = ignimag; - IgnoreRealAssign = ignreal; - IgnoreImagAssign = ignimag; - return EmitLoadOfComplex(LHS.getAddress(), LHS.isVolatileQualified()); - } - - // Otherwise we must have a property setter (no complex vector/bitfields). + // Store the result value into the LHS lvalue. if (LHS.isPropertyRef()) CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), RValue::getComplex(Val)); - else + else if (LHS.isKVCRef()) CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Val)); + else + EmitStoreOfComplex(Val, LHS.getAddress(), LHS.isVolatileQualified()); - // There is no reload after a store through a method, but we need to restore - // the Ignore* flags. + // Restore the Ignore* flags. IgnoreReal = ignreal; IgnoreImag = ignimag; IgnoreRealAssign = ignreal; IgnoreImagAssign = ignimag; - return Val; + + // Objective-C property assignment never reloads the value following a store. + if (LHS.isPropertyRef() || LHS.isKVCRef()) + return Val; + + // Otherwise, reload the value. + return EmitLoadOfComplex(LHS.getAddress(), LHS.isVolatileQualified()); } ComplexPairTy ComplexExprEmitter::VisitBinComma(const BinaryOperator *E) { |