Add support of TNTC to llvm backend
[ghc-hetmet.git] / compiler / main / CodeOutput.lhs
index 83f23cf..bc2dd1e 100644 (file)
@@ -9,9 +9,11 @@ module CodeOutput( codeOutput, outputForeignStubs ) where
 #include "HsVersions.h"
 
 #ifndef OMIT_NATIVE_CODEGEN
-import UniqSupply      ( mkSplitUniqSupply )
 import AsmCodeGen      ( nativeCodeGen )
 #endif
+import LlvmCodeGen ( llvmCodeGen )
+
+import UniqSupply      ( mkSplitUniqSupply )
 
 #ifdef JAVA
 import JavaGen         ( javaGen )
@@ -81,6 +83,7 @@ codeOutput dflags this_mod location foreign_stubs pkg_deps flat_abstractC
              HscInterpreted -> return ();
              HscAsm         -> outputAsm dflags filenm flat_abstractC;
              HscC           -> outputC dflags filenm flat_abstractC pkg_deps;
+             HscLlvm        -> outputLlvm dflags filenm flat_abstractC;
              HscJava        -> 
 #ifdef JAVA
                               outputJava dflags filenm mod_name tycons core_binds;
@@ -168,6 +171,20 @@ outputAsm _ _ _
 
 %************************************************************************
 %*                                                                     *
+\subsection{LLVM}
+%*                                                                     *
+%************************************************************************
+
+\begin{code}
+outputLlvm :: DynFlags -> FilePath -> [RawCmm] -> IO ()
+outputLlvm dflags filenm flat_absC
+  = do ncg_uniqs <- mkSplitUniqSupply 'n'
+       doOutput filenm $ \f -> llvmCodeGen dflags f ncg_uniqs flat_absC
+\end{code}
+
+
+%************************************************************************
+%*                                                                     *
 \subsection{Java}
 %*                                                                     *
 %************************************************************************