[llvm-branch-commits] [cfe-branch] r73486 - /cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp
Daniel Dunbar
daniel at zuster.org
Tue Jun 16 09:01:06 PDT 2009
Author: ddunbar
Date: Tue Jun 16 11:01:06 2009
New Revision: 73486
URL: http://llvm.org/viewvc/llvm-project?rev=73486&view=rev
Log:
Merge in 73158 (<rdar://problem/6957814>):
------------------------------------------------------------------------
r73158 | ddunbar | 2009-06-09 21:38:50 -0700 (Tue, 09 Jun 2009) | 2 lines
Support complex properties, ivars and message expressions.
------------------------------------------------------------------------
Modified:
cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp
Modified: cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp?rev=73486&r1=73485&r2=73486&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/branches/Apple/Dib/lib/CodeGen/CGExprComplex.cpp Tue Jun 16 11:01:06 2009
@@ -47,7 +47,14 @@
/// and returns the result.
ComplexPairTy EmitLoadOfLValue(const Expr *E) {
LValue LV = CGF.EmitLValue(E);
- return EmitLoadOfComplex(LV.getAddress(), LV.isVolatileQualified());
+ if (LV.isSimple())
+ return EmitLoadOfComplex(LV.getAddress(), LV.isVolatileQualified());
+
+ if (LV.isPropertyRef())
+ return CGF.EmitObjCPropertyGet(LV.getPropertyRefExpr()).getComplexVal();
+
+ assert(LV.isKVCRef() && "Unknown LValue type!");
+ return CGF.EmitObjCPropertyGet(LV.getKVCRefExpr()).getComplexVal();
}
/// EmitLoadOfComplex - Given a pointer to a complex value, emit code to load
@@ -77,6 +84,18 @@
// l-values.
ComplexPairTy VisitDeclRefExpr(const Expr *E) { return EmitLoadOfLValue(E); }
+ ComplexPairTy VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
+ return EmitLoadOfLValue(E);
+ }
+ ComplexPairTy VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
+ return EmitLoadOfLValue(E);
+ }
+ ComplexPairTy VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) {
+ return EmitLoadOfLValue(E);
+ }
+ ComplexPairTy VisitObjCMessageExpr(ObjCMessageExpr *E) {
+ return CGF.EmitObjCMessageExpr(E).getComplexVal();
+ }
ComplexPairTy VisitArraySubscriptExpr(Expr *E) { return EmitLoadOfLValue(E); }
ComplexPairTy VisitMemberExpr(const Expr *E) { return EmitLoadOfLValue(E); }
@@ -448,9 +467,31 @@
// Compute the address to store into.
LValue LHS = CGF.EmitLValue(E->getLHS());
-
- // Store into it.
- EmitStoreOfComplex(Val, LHS.getAddress(), LHS.isVolatileQualified());
+
+ // 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).
+ if (LHS.isPropertyRef())
+ CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), RValue::getComplex(Val));
+ else
+ CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Val));
+
+ // There is no reload after a store through a method, but we need to restore
+ // the Ignore* flags.
+ IgnoreReal = ignreal;
+ IgnoreImag = ignimag;
+ IgnoreRealAssign = ignreal;
+ IgnoreImagAssign = ignimag;
return Val;
}
More information about the llvm-branch-commits
mailing list