Commit bc9c3916 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

Implement -ddump-c-backend argument

To dump output of the C backend.
parent 7e93ae8b
Pipeline #27749 failed with stages
in 382 minutes and 25 seconds
......@@ -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
{-
......
......@@ -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
......
......@@ -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"
......
......@@ -552,6 +552,15 @@ LLVM code generator
LLVM code from the :ref:`LLVM code generator <llvm-code-gen>`
C code generator
~~~~~~~~~~~~~~~~
.. ghc-flag:: -ddump-c-backend
:shortdesc: Dump C code produced by the C (unregisterised) backend.
:type: dynamic
:shortdesc: Dump C code produced by the C (unregisterised) backend.
Native code generator
~~~~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment