diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-08-22 12:09:24 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-08-23 12:04:15 +0300 |
commit | a8300520a714fa5e46e342e10175d237d89221c5 (patch) | |
tree | 90823e8854bebb6288a94e36613f8c022336a367 /compiler/main | |
parent | c3e26ab3bd450a2ad17cc80b41dda084558039a2 (diff) | |
download | haskell-a8300520a714fa5e46e342e10175d237d89221c5.tar.gz |
Make non-streaming LLVM and C backends streaming
This adds a Stream.consume function, uses it in LLVM and C code
generators, and removes the use of Stream.collect function which was
used to collect streaming Cmm generation results into a list.
LLVM and C backends now properly use streamed Cmm generation, instead of
collecting Cmm groups into a list before generating LLVM/C code.
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/CodeOutput.hs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/main/CodeOutput.hs b/compiler/main/CodeOutput.hs index 4133526532..66c11f08a4 100644 --- a/compiler/main/CodeOutput.hs +++ b/compiler/main/CodeOutput.hs @@ -12,19 +12,19 @@ module CodeOutput( codeOutput, outputForeignStubs ) where import GhcPrelude -import AsmCodeGen ( nativeCodeGen ) -import LlvmCodeGen ( llvmCodeGen ) +import AsmCodeGen ( nativeCodeGen ) +import LlvmCodeGen ( llvmCodeGen ) import UniqSupply ( mkSplitUniqSupply ) import Finder ( mkStubPaths ) -import PprC ( writeCs ) +import PprC ( writeC ) import CmmLint ( cmmLint ) import Packages import Cmm ( RawCmmGroup ) import HscTypes import DynFlags -import Stream (Stream) +import Stream ( Stream ) import qualified Stream import FileCleanup @@ -117,9 +117,6 @@ outputC :: DynFlags outputC dflags filenm cmm_stream packages = do - -- ToDo: make the C backend consume the C-- incrementally, by - -- pushing the cmm_stream inside (c.f. nativeCodeGen) - rawcmms <- Stream.collect cmm_stream withTiming (return dflags) (text "C codegen") id $ do -- figure out which header files to #include in the generated .hc file: @@ -142,7 +139,7 @@ outputC dflags filenm cmm_stream packages doOutput filenm $ \ h -> do hPutStr h ("/* GHC_PACKAGES " ++ unwords pkg_names ++ "\n*/\n") hPutStr h cc_injects - writeCs dflags h rawcmms + Stream.consume cmm_stream (writeC dflags h) {- ************************************************************************ |