summaryrefslogtreecommitdiff
path: root/compiler/main/CodeOutput.lhs
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-12-11 20:41:18 +0000
committerIan Lynagh <ian@well-typed.com>2012-12-11 22:35:28 +0000
commitbd8f7fc56b84369f4e820263c0bcdc85760de6d4 (patch)
tree048f5a1b92979a599c5e2974e66639325ceaf6df /compiler/main/CodeOutput.lhs
parent8685535cfdfc68223162070c50d604072c3213b7 (diff)
downloadhaskell-bd8f7fc56b84369f4e820263c0bcdc85760de6d4.tar.gz
Implement the -dynamic-too optimised path for the NCG
We don't yet have the slow path, for when we have to fall back to separate compilation. We also only currently handle the case qhere we're compiling Haskell code with the NCG.
Diffstat (limited to 'compiler/main/CodeOutput.lhs')
-rw-r--r--compiler/main/CodeOutput.lhs14
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/main/CodeOutput.lhs b/compiler/main/CodeOutput.lhs
index f76b0ef481..047cc018da 100644
--- a/compiler/main/CodeOutput.lhs
+++ b/compiler/main/CodeOutput.lhs
@@ -144,9 +144,17 @@ outputAsm dflags filenm cmm_stream
| cGhcWithNativeCodeGen == "YES"
= do ncg_uniqs <- mkSplitUniqSupply 'n'
- _ <- {-# SCC "OutputAsm" #-} doOutput filenm $
- \f -> {-# SCC "NativeCodeGen" #-}
- nativeCodeGen dflags f ncg_uniqs cmm_stream
+ let filenmDyn = filenm ++ "-dyn"
+ withHandles f = doOutput filenm $ \h ->
+ ifGeneratingDynamicToo dflags
+ (doOutput filenmDyn $ \dynH ->
+ f [(h, dflags),
+ (dynH, doDynamicToo dflags)])
+ (f [(h, dflags)])
+
+ _ <- {-# SCC "OutputAsm" #-} withHandles $
+ \hs -> {-# SCC "NativeCodeGen" #-}
+ nativeCodeGen dflags hs ncg_uniqs cmm_stream
return ()
| otherwise