diff gen/functions.cpp @ 585:fbb1a366cfbc

Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Tue, 09 Sep 2008 16:49:47 -0700
parents 406aee3416bb
children 26fce59fe80a
line wrap: on
line diff
--- a/gen/functions.cpp	Mon Sep 08 20:38:55 2008 +0200
+++ b/gen/functions.cpp	Tue Sep 09 16:49:47 2008 -0700
@@ -122,7 +122,13 @@
         bool refOrOut = ((arg->storageClass & STCref) || (arg->storageClass & STCout));
 
         const LLType* at = DtoType(argT);
-        if (isaStruct(at)) {
+
+        // FIXME: using the llvm type for these is a bad idea... aggregates are first class now and we're starting to use it ...
+
+        if (argT->iscomplex()) {
+            goto Lbadstuff;
+        }
+        else if (isaStruct(at)) {
             Logger::println("struct param");
             paramvec.push_back(getPtrToType(at));
             if (!refOrOut)
@@ -140,6 +146,7 @@
             paramvec.push_back(getPtrToType(at));
         }
         else {
+Lbadstuff:
             if (refOrOut) {
                 Logger::println("by ref param");
                 at = getPtrToType(at);
@@ -866,10 +873,10 @@
             arg = new DImValue(argexp->type, arg->getRVal());
     }
     // byval arg, but expr has no storage yet
-    else if (DtoIsPassedByRef(argexp->type) && (arg->isSlice() || arg->isComplex() || arg->isNull()))
+    else if (DtoIsPassedByRef(argexp->type) && (arg->isSlice() || arg->isNull()))
     {
         LLValue* alloc = DtoAlloca(DtoType(argexp->type), ".tmp_arg");
-        DVarValue* vv = new DVarValue(argexp->type, alloc, true);
+        DVarValue* vv = new DVarValue(argexp->type, alloc);
         DtoAssign(argexp->loc, vv, arg);
         arg = vv;
     }
@@ -883,7 +890,7 @@
 {
     Logger::println("DtoVariadicArgument");
     LOG_SCOPE;
-    DVarValue vv(argexp->type, dst, true);
+    DVarValue vv(argexp->type, dst);
     DtoAssign(argexp->loc, &vv, argexp->toElem(gIR));
 }