diff gen/tollvm.cpp @ 486:a34078905d01

Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in. Reimplemented support for nested functions/class using a new approach. Added error on taking address of intrinsic. Fixed problems with the ->syntaxCopy of TypeFunction delegate exp. Removed DtoDType and replaced all uses with ->toBasetype() instead. Removed unused inplace stuff. Fixed a bunch of issues in the runtime unittests, not complete yet. Added mini tests.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Sun, 10 Aug 2008 08:37:38 +0200
parents e381e082d5cb
children eada571dc8ff
line wrap: on
line diff
--- a/gen/tollvm.cpp	Sat Aug 09 09:03:52 2008 +0200
+++ b/gen/tollvm.cpp	Sun Aug 10 08:37:38 2008 +0200
@@ -23,14 +23,14 @@
 
 bool DtoIsPassedByRef(Type* type)
 {
-    Type* typ = DtoDType(type);
+    Type* typ = type->toBasetype();
     TY t = typ->ty;
     return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray || typ->iscomplex());
 }
 
 bool DtoIsReturnedInArg(Type* type)
 {
-    Type* typ = DtoDType(type);
+    Type* typ = type->toBasetype();
     TY t = typ->ty;
     return (t == Tstruct || t == Tarray || t == Tdelegate || t == Tsarray || typ->iscomplex());
 }
@@ -54,16 +54,6 @@
     return llvm::ParamAttr::None;
 }
 
-Type* DtoDType(Type* t)
-{
-    if (t->ty == Ttypedef) {
-        Type* bt = t->toBasetype();
-        assert(bt);
-        return DtoDType(bt);
-    }
-    return t;
-}
-
 const LLType* DtoType(Type* t)
 {
     assert(t);
@@ -143,7 +133,7 @@
     case Tfunction:
     {
         if (!t->ir.type || *t->ir.type == NULL) {
-            return DtoFunctionType(t,NULL);
+            return DtoFunctionType(t,NULL,NULL);
         }
         else {
             return t->ir.type->get();
@@ -205,7 +195,7 @@
 const LLStructType* DtoDelegateType(Type* t)
 {
     const LLType* i8ptr = getVoidPtrType();
-    const LLType* func = DtoFunctionType(t->next, i8ptr);
+    const LLType* func = DtoFunctionType(t->next, NULL, i8ptr);
     const LLType* funcptr = getPtrToType(func);
     return LLStructType::get(i8ptr, funcptr, 0);
 }
@@ -666,8 +656,9 @@
 
 size_t getABITypeSize(const LLType* t)
 {
-    Logger::cout() << "getting abi type of: " << *t << '\n';
-    return gTargetData->getABITypeSize(t);
+    size_t sz = gTargetData->getABITypeSize(t);
+    Logger::cout() << "abi type size of: " << *t << " == " << sz << '\n';
+    return sz;
 }
 
 unsigned char getABITypeAlign(const LLType* t)