diff gen/tollvm.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 7e2867ed70d9
children 1b62222581fb
line wrap: on
line diff
--- a/gen/tollvm.cpp	Mon Sep 08 20:38:55 2008 +0200
+++ b/gen/tollvm.cpp	Tue Sep 09 16:49:47 2008 -0700
@@ -25,14 +25,14 @@
 {
     Type* typ = type->toBasetype();
     TY t = typ->ty;
-    return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray || typ->iscomplex());
+    return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray);
 }
 
 bool DtoIsReturnedInArg(Type* type)
 {
     Type* typ = type->toBasetype();
     TY t = typ->ty;
-    return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray || typ->iscomplex());
+    return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray);
 }
 
 unsigned DtoShouldExtend(Type* type)
@@ -541,15 +541,6 @@
     //st->setVolatile(gIR->func()->inVolatile);
 }
 
-bool DtoCanLoad(LLValue* ptr)
-{
-    if (isaPointer(ptr->getType())) {
-        const LLType* data = ptr->getType()->getContainedType(0);
-        return data->isFirstClassType() && !(isaStruct(data) || isaArray(data));
-    }
-    return false;
-}
-
 //////////////////////////////////////////////////////////////////////////////////////////
 
 LLValue* DtoBitCast(LLValue* v, const LLType* t, const char* name)
@@ -770,3 +761,12 @@
     gIR->module->addTypeName("ModuleReference", st);
     return st;
 }
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+LLValue* DtoAggrPair(const LLType* type, LLValue* V1, LLValue* V2, const char* name)
+{
+    LLValue* res = llvm::UndefValue::get(type);
+    res = gIR->ir->CreateInsertValue(res, V1, 0, "tmp");
+    return gIR->ir->CreateInsertValue(res, V2, 1, name?name:"tmp");
+}