nhc13 compile-time options


nhc13 is a script which calls (if necessary) in turn, the C preprocessor, the GreenCard preprocessor, the compiler proper, the C compiler, the assembler, and finally the linker. You can control these stages using environment variables and flags.

File arguments.
.hs Haskell source file
.lhs literate Haskell source file
.gc Haskell source file to be preprocessed with GreenCard
.c nhc13 bytecode file
.s assembler file
.o object file

Environment variables.
NHC13LIBDIR The full path (excluding final machine-specific part) to the nhc13 executables and libs
NHC13INCDIR The full path to the nhc13 interface and include files.
NHC13COMP The name/path of the nhc13 compiler proper
GREENCARD The name/path of the GreenCard preprocessor
GREENCARDOPTS Additional options to the GreenCard preprocessor
TMP A temporary directory for intermediate files (default: /tmp)

Flags.
--version display version information and quit
-v verbose - echo commands before executing them
-cpp run the C preprocessor over the source file first
-p compile for heap profiling
-t compile for time profiling
-T compile for tracing
-c compile only - do not link to a final executable
-S stop after generating assembler file (.s)
-C stop after generating bytecode file (.c)
-o file name the final object or executable file
-d objdir place intermediate object files in objdir
-Hsize set the default heap for the final executable to size
-bigEnd cross-compile for a big endian machine
-littleEnd cross-compile for a little endian machine
-llib link against the library named lib
-Ldir search dir when linking against libs
-Idir/ search directory dir for imported modules during compilation, and for #include'd C header files during compilation of the C-section of a GreenCard file
-idir/ as for -I option, except also search dir and dir/$MACHINE for a library archive called lib$CFG.a at link stage, where $CFG is taken from the -p, -t, and -T flags, respectively indicating heap profiling, time profiling or tracing
-Pdir/ search directory dir for prelude and stdlib modules during compilation
-Dsym define sym when pre-processing, and when compiling the C-section of a GreenCard file
-Usym undefine sym when pre-processing, and when compiling the C-section of a GreenCard file
+rts runtime system options specified between +RTS ... -RTS delimiters should be passed on to the compiler proper using the nhc13 syntax (i.e. when nhc13comp was compiled by nhc13)
-rts runtime system options specified between +RTS ... -RTS delimiters should be passed on to the compiler proper using the hbc syntax (i.e. when nhc13comp was compiled by hbc)
+RTS the following options (up to -RTS) should be passed only to the compiler's runtime system (for instance to set the compilation heap size)
+CTS the following options (up to -CTS) should be passed only to the compiler proper (as detailed below)


The following flags can be passed to the nhc13 compiler proper. Occasionally a compiler option-name may conflict with (for instance) a linker option-name. To be sure that compiler options are parsed correctly, it is best to enclose them between +CTS and -CTS.

In general, the default value of an option is "off" (except where noted), and using the flag turns the option on. Where the default value is "on", an option can be turned off by prefixing the flag with no: for instance -zap is usually on by default, but -nozap will turn it off.

Options to change the usual compilation behaviour.
-redefine Don't complain if redefining an imported identifier
-part Compiling part of a lib, so don't complain if module name differs from file name and don't create profiling information for this module
-lib Compiling a lib, don't complain if importing modules with names that differ from their filenames
-unix Use unix filenames (default=on) (off=RiscOS filenames)
-unlit Unliterate the source code
-ansiC Generate bytecode file as ANSI C (default=on)
-profile number of occurrences = amount of heap profiling information per node
-tprof compile for time profiling
-zap Generate code to zap unused arguments/stack positions (default=on)
-prelude Keep prelude definitions in interface file
-keepcase Don't lift case, we fix those later
-dbgtrans perform tracing translation (for runtime tracer)
-dbgprelude use the tracing prelude
-trusted a "trusted" module (tracer)

Options to examine the internal progress of the compiler, stage by stage.
-lex show lexical input
-parse show syntax tree after parser
-import print name of imported files
-depend print imported identifiers that are used (not even alpha-tested yet)
-need show need table before import
-ineed show need table after import
-irename show rename table after import
-ibound show symbol table after import
-iineed show need table between all import files
-iibound show symbol table between all import files
-rename show syntax tree after rename
-rbound show symbol table after rename
-derive show syntax tree after derive
-dbound show symbol table after derive
-pbound show symbol table after inserting primitive functions
-ebound show symbol table after extract
-remove show syntax tree after fields are removed (translated into selectors)
-scc show syntax tree after splitting into strongly connected groups
-type show syntax tree after type check
-tbound show symbol table after type check
-fixsyntax show syntax tree after removing newtype constructors and fixing Class.Type.method
-stg show stg tree after translation from syntax tree
-fsbound show symbol table after adding Class.Type.method info
-lift show syntax tree after lambda lifting
-lbound show symbol table after lambda lifting
-case show stg tree after simplification of patterns
-cbound show symbol table after simplification of pattern
-prim show stg tree after inserting primitive functions
-bcbefore show stg tree before converting to byte code
-gcode show G code
-gcodefix show G code after large constant fixed
-gcodemem show G code NEEDHEAP
-gcodeopt1 show G code optimisation
-gcoderel show G code after offsets
-arity show stg tree after arity
-stgcode show STG code
-gcodeopt2 show G code optimisation
-free show stg tree with explicit free variables
-atom show stg tree after only atoms in applications
-abound show symbol table after only atoms in applications
-funnames insert position and name of functions in the code
-ilex show lexical input for interface files
-iparse show syntax tree after parser for interface files
-dbg show ast after debugging translation (tracer)
-dbg2 more debugging output (tracer)


The latest updates to these pages are available on the WWW from http://www.cs.york.ac.uk/fp/nhc13/

1998.06.18
York Functional Programming Group
Malcolm.Wallace@cs.york.ac.uk