diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-11-20 17:31:57 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-22 06:28:10 -0500 |
commit | bc9c3916df96a20c58b91fd383a0da77ec83c4b0 (patch) | |
tree | 798f3e963891c74294734f76fdb068fcdc66e5fc /compiler/GHC/Driver | |
parent | 7e93ae8b2257c17d5ae5ef7832db723e897c8e8b (diff) | |
download | haskell-bc9c3916df96a20c58b91fd383a0da77ec83c4b0.tar.gz |
Implement -ddump-c-backend argument
To dump output of the C backend.
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r-- | compiler/GHC/Driver/CodeOutput.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Driver/Flags.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/CodeOutput.hs b/compiler/GHC/Driver/CodeOutput.hs index 4886d5a2ee..2bb30656dd 100644 --- a/compiler/GHC/Driver/CodeOutput.hs +++ b/compiler/GHC/Driver/CodeOutput.hs @@ -138,7 +138,13 @@ outputC dflags filenm cmm_stream packages = hPutStr h ("/* GHC_PACKAGES " ++ unwords pkg_names ++ "\n*/\n") hPutStr h "#include \"Stg.h\"\n" let platform = targetPlatform dflags - writeC = printForC dflags h . cmmToC platform + writeC cmm = do + let doc = cmmToC platform cmm + dumpIfSet_dyn dflags Opt_D_dump_c_backend + "C backend output" + FormatC + doc + printForC dflags h doc Stream.consume cmm_stream writeC {- diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index b7d3d4d459..25acaab359 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -49,6 +49,7 @@ data DumpFlag | Opt_D_dump_asm_conflicts | Opt_D_dump_asm_stats | Opt_D_dump_asm_expanded + | Opt_D_dump_c_backend | Opt_D_dump_llvm | Opt_D_dump_core_stats | Opt_D_dump_deriv diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 082cdf95a8..7be2da383c 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -2539,6 +2539,8 @@ dynamic_flags_deps = [ (setDumpFlag Opt_D_dump_asm_expanded) , make_ord_flag defGhcFlag "ddump-llvm" (NoArg $ setObjBackend LLVM >> setDumpFlag' Opt_D_dump_llvm) + , make_ord_flag defGhcFlag "ddump-c-backend" + (NoArg $ setDumpFlag' Opt_D_dump_c_backend) , make_ord_flag defGhcFlag "ddump-deriv" (setDumpFlag Opt_D_dump_deriv) , make_ord_flag defGhcFlag "ddump-ds" |