changeset 97:198ad05f3ace new_gen

"-c" as argument now generates out.o (only works on linux now)
author Anders Johnsen <skabet@gmail.com>
date Tue, 06 May 2008 21:28:05 +0200
parents 438e6ed4cda1
children 7f9240d4ddc1
files dang/compiler.d
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dang/compiler.d	Tue May 06 18:51:08 2008 +0200
+++ b/dang/compiler.d	Tue May 06 21:28:05 2008 +0200
@@ -28,6 +28,8 @@
        sema.ScopeCheck,
        sema.TypeCheck;
 
+import tango.stdc.posix.unistd;
+
 import Opt = dang.OptParse;
 
 void checkFiles(char[][] *files)
@@ -152,8 +154,18 @@
             (Module m, SourceManager sm) {
                 StopWatch w; w.start;
                 auto llvmGen = new CodeGen();
-                auto llc = new Process("llc");
-                llvmGen.gen(m, llc.stdin.fileHandle, optimize, inline);
+                auto llc = new Process("llc","-o=-");
+                auto gcc = new Process("gcc","-c","-o","out.o","-x","assembler","-");
+                llc.execute();
+                int i = dup(llc.stdin.fileHandle);
+                llc.stdin.detach;
+                llvmGen.gen(m, i, optimize, inline);
+                llc.wait();
+                gcc.execute();
+                gcc.stdin.copy(llc.stdout);
+                gcc.stdin.detach;
+                gcc.wait();
+
                 timings ~= Measurement("Generating assemble bytecode", w.stop);
             });
     else if (what == "dot")