diff dmd/mtype.c @ 1147:dbe4af57b240

Changed use of toObjFile to a new codegen method. More versioning of DMD specific codegen code.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Fri, 27 Mar 2009 17:54:27 +0100
parents 1860414bf3b7
children 442ab244c455
line wrap: on
line diff
--- a/dmd/mtype.c	Thu Mar 26 20:45:53 2009 +0100
+++ b/dmd/mtype.c	Fri Mar 27 17:54:27 2009 +0100
@@ -15,7 +15,11 @@
 #include <alloca.h>
 #endif
 
+#ifdef __DMC__
 #include <math.h>
+#else
+#include <cmath>
+#endif
 
 #include <stdio.h>
 #include <assert.h>
@@ -65,7 +69,11 @@
 #include "aggregate.h"
 #include "hdrgen.h"
 
-#include "gen/tollvm.h"
+#if IN_LLVM
+//#include "gen/tollvm.h"
+Ir* Type::sir = NULL;
+unsigned GetTypeAlignment(Ir* ir, Type* t);
+#endif
 
 FuncDeclaration *hasThis(Scope *sc);
 
@@ -164,7 +172,11 @@
     return 'M';		// name mangling prefix for functions needing 'this'
 }
 
+#if IN_LLVM
+void Type::init(Ir* _sir)
+#else
 void Type::init()
+#endif
 {   int i;
     int j;
 
@@ -238,6 +250,9 @@
 
     tvoidptr = tvoid->pointerTo();
 
+    // LDC
+    sir = _sir;
+
     // set size_t / ptrdiff_t types and pointer size
     if (global.params.is64bit)
     {
@@ -1017,7 +1032,7 @@
 {
     if (ty == Tvoid)
         return 1;
-    return getABITypeAlign(DtoType(this));
+    return GetTypeAlignment(sir, this);
 }