[cfe-commits] r41336 - /cfe/trunk/CodeGen/CGComplexExpr.cpp

Chris Lattner sabre at nondot.org
Thu Aug 23 14:38:16 PDT 2007


Author: lattner
Date: Thu Aug 23 16:38:16 2007
New Revision: 41336

URL: http://llvm.org/viewvc/llvm-project?rev=41336&view=rev
Log:
add support for codegen of calls returning complex.

Modified:
    cfe/trunk/CodeGen/CGComplexExpr.cpp

Modified: cfe/trunk/CodeGen/CGComplexExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGComplexExpr.cpp?rev=41336&r1=41335&r2=41336&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGComplexExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGComplexExpr.cpp Thu Aug 23 16:38:16 2007
@@ -74,10 +74,9 @@
   ComplexPairTy VisitArraySubscriptExpr(Expr *E) { return EmitLoadOfLValue(E); }
   ComplexPairTy VisitMemberExpr(Expr *E) { return EmitLoadOfLValue(E); }
 
-  // FIXME: Call
   // FIXME: CompoundLiteralExpr
   // FIXME: ImplicitCastExpr
-  // FIXME: CastExpr
+  ComplexPairTy VisitCallExpr(const CallExpr *E);
   
   // Operators.
   ComplexPairTy VisitPrePostIncDec(const UnaryOperator *E,
@@ -107,7 +106,7 @@
   
   ComplexPairTy VisitBinMul        (const BinaryOperator *E);
   ComplexPairTy VisitBinAdd        (const BinaryOperator *E);
-  // FIXME: div/rem
+  // FIXME: sub/div/rem
   // GCC rejects and/or/xor for integer complex.
   // Logical and/or always return int, never complex.
 
@@ -170,6 +169,11 @@
   return ComplexPairTy(U, U);
 }
 
+ComplexPairTy ComplexExprEmitter::VisitCallExpr(const CallExpr *E) {
+  llvm::Value *AggPtr = CGF.EmitCallExpr(E).getAggregateAddr();
+  return EmitLoadOfComplex(AggPtr, false);
+}
+
 ComplexPairTy ComplexExprEmitter::VisitPrePostIncDec(const UnaryOperator *E,
                                                      bool isInc, bool isPre) {
   LValue LV = CGF.EmitLValue(E->getSubExpr());





More information about the cfe-commits mailing list