Next: Runtime system options
Up: Manual page
Previous: Manual page
  Contents
Compile-time options
MLton's options allow you to control the name of the output file, the
verbosity of compile-time messages, and whether or not certain optimizations are
performed. They also allow you to specify which intermediate files are saved
and to stop the compilation process early, at some intermediate pass. MLton
uses the input file suffix to determine the type of input program. The
possibilities are .cm, .sml, .c, .S and .o.
In the explanation below and in the usage message, for flags that take a boolean
argument (true|false), the first value listed is the default. For
example, by default, overflow checking on is performed on integer arithmetic.
- -detect-overflow {true|false}
-
This flag controls whether or not overflow checking is performed on integer
arithmetic, in particular on Int.{+,-,*, ,div,quot}.
- -Ddefine
-
Define a compile-time constant accessible via MLton's _prim
syntax (see Section 5.1).
- -exn-history {false|true}
-
Enable Exn.history. This has a performance impact, both in memory usage
of exceptions and in runtime, because of additional work that must be performed
at each exception construction, raise, and handle. By default, it is disabled.
- -h heapSize[km]
-
The resulting executable will use a fixed size heap of heapSize size. A value
of 0 means that the heap size should be chosen almost as large as the
amount of
RAM in the machine. A trailing k means that heapSize is in units of
1024 bytes. A trailing m means that heapSize is in megabytes. If
neither appears, then heapSize is in bytes. By default the executable
will use an automatically resized heap.
- -include file.h
-
Specify an additional .h file to be included for defining compile-time
constants (see Section 5.1). The file will be included with
#include <file.h>.
- -ieee-fp {false|true}
-
Control whether or not the code generator is pedantic about following
the IEEE floating point standard. By default, it is not, because of the
performance cost.
- -inline n
-
Set the inlining threshold used in the CPS simplifier. The default is 320.
- -Idir
-
Specify an additional directory to be searched for include files (included with
-i).
- -keep {cps|dot|g|o|sml}
-
Save the intermediate file(s) corresponding to the given arg. If
no -keep argument is given, then only the final file(s) is saved.
cps |
CPS file |
dot |
dot files. Implies -keep cps. See Section 6 for
details. |
g |
generated .S and .c files passed to gcc and the assembler |
o |
object file |
sml |
SML file |
- -llib
-
Specify an additional library to link with.
This switch is passed unchanged to the linker.
- -Ldir
-
Specify an additional directory to be searched for libraries.
This switch is passed unchanged to the linker.
- -native {true|false}
-
Controls whether or not to use native code generation. By default this is
true. Older versions of MLton generated C code and used gcc to produce assembly, but this functionality is being phased out.
- -polyvariance {true|false}
-
Control whether the optimizer runs polyvariance, which is a pass that duplicates
small, higher-order functions to improve performance. The default is for
polyvariance to be on.
- -o file
-
Specify the name of the final output file.
The default file name is the input file with its
suffix removed and an appropriate suffix added.
- -p
-
Produce an executable that will gather profiling information. The default is
not to gather profiling information. This option implies -keep cps.
See Section 6 for details.
- -safe {true|false}
-
This switch determines the value of the SML variable MLton.safe, which
controls whether the basis library performs array, string, and vector bounds
checks, division for zero checks, and other checks. By default, MLton.safe is true. Compiling -safe false changes the behavior of
some programs, does not conform to the basis library specification, and may
cause programs to seg fault.
- -static
-
Produce a statically linked executable. This switch is passed unchanged to the
linker.
- -stop {f|g|o|sml}
-
Secify pass to stop at.
f |
list of files on stdout (only makes sense when input is foo.cm) |
g |
generated .S and .c files |
sml |
SML file (only makes sense when input is foo.cm) |
o |
object file |
If you compile -stop g or -stop o, you can resume compilation by
running mlton on the generated .c and .S or .o files.
- -v[0123]
-
How verbose to be about what passes are running. The default is 0.
0 |
silent |
1 |
show calls to compiler, assembler, and linker |
2 |
show all intermediate compiler passes |
3 |
show all intermediate compiler passes, and some data structure sizes |
With no other arguments, mlton -v prints out the version number and the
default settings of all options and exits.
Next: Runtime system options
Up: Manual page
Previous: Manual page
  Contents