<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta name="robots" content="index,nofollow"> <title>CompileTimeOptions - MLton Standard ML Compiler (SML Compiler)</title> <link rel="stylesheet" type="text/css" charset="iso-8859-1" media="all" href="common.css"> <link rel="stylesheet" type="text/css" charset="iso-8859-1" media="screen" href="screen.css"> <link rel="stylesheet" type="text/css" charset="iso-8859-1" media="print" href="print.css"> <link rel="Start" href="Home"> </head> <body lang="en" dir="ltr"> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-833377-1"; urchinTracker(); </script> <table bgcolor = lightblue cellspacing = 0 style = "border: 0px;" width = 100%> <tr> <td style = " border: 0px; color: darkblue; font-size: 150%; text-align: left;"> <a class = mltona href="Home">MLton MLTONWIKIVERSION</a> <td style = " border: 0px; font-size: 150%; text-align: center; width: 50%;"> CompileTimeOptions <td style = " border: 0px; text-align: right;"> <table cellspacing = 0 style = "border: 0px"> <tr style = "vertical-align: middle;"> </table> <tr style = "background-color: white;"> <td colspan = 3 style = " border: 0px; font-size:70%; text-align: right;"> <a href = "Home">Home</a> <a href = "TitleIndex">Index</a> </table> <div id="content" lang="en" dir="ltr"> MLton's compile-time options control the name of the output file, the verbosity of compile-time messages, and whether or not certain optimizations are performed. They also can specify which intermediate files are saved and can stop the compilation process early, at some intermediate pass, in which case compilation can be resumed by passing the generated files to MLton. MLton uses the input file suffix to determine the type of input program. The possibilities are <tt>.c</tt>, <tt>.mlb</tt>, <tt>.o</tt>, <tt>.s</tt>, and <tt>.sml</tt>. <p> With no arguments, MLton prints the version number and exits. For a usage message, run MLton with an invalid switch, e.g. <tt>mlton -z</tt>. In the explanation below and in the usage message, for flags that take a number of choices (e.g. <tt>{true|false}</tt>), the first value listed is the default. </p> <h2 id="head-6bf5da9c080bee3a8142586c412aa39971137eee">Options</h2> <ul> <li> <p> <tt>-align {4|8}</tt> <br> Aligns object sizes and doubles in memory by the specified alignment. The default varies depending on architecture. </p> </li> <li class="gap"> <p> <tt>-as-opt </tt><em>option</em> <br> Pass <em>option</em> to <tt>gcc</tt> when assembling. </p> </li> <li class="gap"> <p> <tt>-cc-opt </tt><em>option</em> <br> Pass <em>option</em> to <tt>gcc</tt> when compiling C code. </p> </li> <li class="gap"> <p> <tt>-codegen {native|x86|amd64|c}</tt> <br> Generate native code or C code. With <tt>-codegen native</tt> (<tt>-codegen x86</tt> or <tt>-codegen amd64</tt>), MLton typically compiles more quickly and generates better code. </p> </li> <li class="gap"> <p> <tt>-const '</tt><em>name</em><tt> </tt><em>value</em><tt>'</tt> <br> Set the value of a compile-time constant. Here is a list of available constants, their default values, and what they control. </p> </li> <ul> <li> <p> <tt>Exn.keepHistory {false|true}</tt> <br> Enable <tt>MLton.Exn.history</tt>. See <a href="MLtonExn">MLtonExn</a> for details. There is a performance cost to setting this to <tt>true</tt>, both in memory usage of exceptions and in run time, because of additional work that must be performed at each exception construction, raise, and handle. </p> </li> </ul> <li class="gap"> <p> <tt>-default-ann </tt><em>ann</em> <br> Specify default <a href="MLBasisAnnotations">ML Basis annotations</a>. For example, <tt>-default-ann 'warnUnused true'</tt> causes unused variable warnings to be enabled by default. A default is overridden by the corresponding annotation in an ML Basis file. </p> </li> <li class="gap"> <p> <tt>-default-type </tt><em>type</em> <br> Specify the default binding for a primitive type. For example, <tt>-default-type word64</tt> causes the top-level type <tt>word</tt> and the top-level structure <tt>Word</tt> in the <a href="BasisLibrary">Basis Library</a> to be equal to <tt>Word64.word</tt> and <tt>Word64:WORD</tt>, respectively. Similarly, <tt>-default-type intinf</tt> causes the top-level type <tt>int</tt> and the top-level structure <tt>Int</tt> in the <a href="BasisLibrary">Basis Library</a> to be equal to <tt>IntInf.int</tt> and <tt>IntInf:INTEGER</tt>, respectively. </p> </li> <li class="gap"> <p> <tt>-disable-ann </tt><em>ann</em> <br> Ignore the specified <a href="MLBasisAnnotations">ML Basis annotation</a> in every ML Basis file. For example, to see <em>all</em> match and unused warnings, compile with <pre>-default-ann 'warnUnused true' -disable-ann forceUsed -disable-ann nonexhaustiveMatch -disable-ann redundantMatch -disable-ann warnUnused </pre> </p> </li> <li class="gap"> <p> <tt>-export-header </tt><em>file</em> <br> Write C prototypes to <em>file</em> for all of the functions in the program <a href="CallingFromCToSML">exported from SML to C</a>. </p> </li> <li class="gap"> <p> <tt>-ieee-fp {false|true}</tt> <br> Cause the native code generator to be pedantic about following the IEEE floating point standard. By default, it is not, because of the performance cost. This only has an effect with <tt>-codegen x86</tt>. </p> </li> <li class="gap"> <p> <tt>-inline </tt><em>n</em> <br> Set the inlining threshold used in the optimizer. The threshold is an approximate measure of code size of a procedure. The default is <tt>320</tt>. </p> </li> <li class="gap"> <p> <tt>-keep {g|o}</tt> <br> Save intermediate files. If no <tt>-keep</tt> argument is given, then only the output file is saved. <div> <table> <tr> <td> <tt>g</tt> </td> <td> generated <tt>.c</tt> and <tt>.s</tt> files passed to gcc and the assembler </td> </tr> <tr> <td> <tt>o</tt> </td> <td> object (<tt>.o</tt>) files </td> </tr> </p> </table> </div> </li> <li class="gap"> <p> <tt>-link-opt </tt><em>option</em> <br> Pass <em>option</em> to <tt>gcc</tt> when linking. You can use this to specify library search paths, e.g. <tt>-link-opt -Lpath</tt>, and libraries to link with, e.g. <tt>-link-opt -lfoo</tt>, or even both at the same time, e.g. <tt>-link-opt '-Lpath -lfoo'</tt>. If you wish to pass an option to the linker, you must use <tt>gcc</tt>'s <tt>-Wl,</tt> syntax, e.g., <tt>-link-opt '-Wl,--export-dynamic'</tt>. </p> </li> <li class="gap"> <p> <tt>-mlb-path-map </tt><em>file</em> <br> Use <em>file</em> as an <a href="MLBasisPathMap">ML Basis path map</a> to define additional MLB path variables. Multiple uses of <tt>-mlb-path-map</tt> and <tt>-mlb-path-var</tt> are allowed, with variable definitions in later path maps taking precedence over earlier ones. </p> </li> <li class="gap"> <p> <tt>-mlb-path-var '</tt><em>name</em><tt> </tt><em>value</em><tt>'</tt> <br> Define an additional MLB path variable. Multiple uses of <tt>-mlb-path-map</tt> and <tt>-mlb-path-var</tt> are allowed, with variable definitions in later path maps taking precedence over earlier ones. </p> </li> <li class="gap"> <p> <tt>-output </tt><em>file</em> <br> Specify the name of the final output file. The default name is the input file name with its suffix removed and an appropriate, possibly empty, suffix added. </p> </li> <li class="gap"> <p> <tt>-profile {no|alloc|count|time}</tt> <br> Produce an executable that gathers <a href="Profiling">Profiling</a> data. When such an executable is run, it produces an <tt>mlmon.out</tt> file. </p> </li> <li class="gap"> <p> <tt>-profile-branch {false|true}</tt> <br> If true, the profiler will separately gather profiling data for each branch of a function definition, <tt>case</tt> expression, and <tt>if</tt> expression. </p> </li> <li class="gap"> <p> <tt>-profile-stack {false|true}</tt> <br> If <tt>true</tt>, the executable will gather profiling data for all functions on the stack, not just the currently executing function. See <a href="ProfilingTheStack">ProfilingTheStack</a>. </p> </li> <li class="gap"> <p> <tt>-profile-val {false|true}</tt> <br> If <tt>true</tt>, the profiler will separately gather profiling data for each (expansive) <tt>val</tt> declaration. </p> </li> <li class="gap"> <p> <tt>-runtime </tt><em>arg</em> <br> Pass argument to the runtime system via <tt>@MLton</tt>. See <a href="RunTimeOptions">RunTimeOptions</a>. The argument will be processed before other <tt>@MLton</tt> command line switches. Multiple uses of <tt>-runtime</tt> are allowed, and will pass all the arguments in order. If the same runtime switch occurs more than once, then the last setting will take effect. There is no need to supply the leading <tt>@MLton</tt> or the trailing <tt>--</tt>; these will be supplied automatically. </p> <p> An argument to <tt>-runtime</tt> may contain spaces, which will cause the argument to be treated as a sequence of words by the runtime. For example the command line: </p> <pre>mlton -runtime 'ram-slop 0.4' foo.sml</pre><p> will cause <tt>foo</tt> to run as if it had been called like: </p> <pre>foo @MLton ram-slop 0.4 --</pre><p> An executable created with <tt>-runtime stop</tt> doesn't process any <tt>@MLton</tt> arguments. This is useful to create an executable, e.g. <tt>echo</tt>, that must treat <tt>@MLton</tt> like any other command-line argument. </p> <pre>% mlton -runtime stop echo.sml % echo @MLton -- @MLton --</pre></li> <li class="gap"> <p> <tt>-show-basis </tt><em>file</em> <br> Pretty print to <em>file</em> the basis defined by the input program. See <a href="ShowBasis">ShowBasis</a>. </p> </li> <li class="gap"> <p> <tt>-show-def-use </tt><em>file</em> <br> Output def-use information to <em>file</em>. Each identifier that is defined appears on a line, followed on subsequent lines by the position of each use. </p> </li> <li class="gap"> <p> <tt>-stop {f|g|o|tc}</tt> <br> Specify when to stop. <div> <table> <tr> <td> <tt>f</tt> </td> <td> list of files on stdout (only makes sense when input is <tt>foo.mlb</tt>) </td> </tr> <tr> <td> <tt>g</tt> </td> <td> generated <tt>.c</tt> and <tt>.s</tt> files </td> </tr> <tr> <td> <tt>o</tt> </td> <td> object (<tt>.o</tt>) files </td> </tr> <tr> <td> <tt>tc</tt> </td> <td> after type checking </td> </tr> </p> </table> </div> <p> If you compile with <tt>-stop g</tt> or <tt>-stop o</tt>, you can resume compilation by running MLton on the generated <tt>.c</tt> and <tt>.s</tt> or <tt>.o</tt> files. </p> </li> <li class="gap"> <p> <tt>-target {self|</tt><em>...</em><tt>}</tt> <br> Generate an executable that runs on the specified platform. The default is <tt>self</tt>, which means to compile for the machine that MLton is running on. To use any other target, you must first install a <a href="CrossCompiling"> cross compiler</a>. </p> </li> <li class="gap"> <p> <tt>-target-as-opt </tt><em>target</em><tt> </tt><em>option</em> <br> Like <tt>-as-opt</tt>, this passes <em>option</em> to <tt>gcc</tt> when assembling, except it only passes <em>option</em> when the target architecture or operating system is <em>target</em>. Valid values for <em>target</em> are: <tt>amd64</tt>, <tt>hppa</tt>, <tt>powerpc</tt>, <tt>sparc</tt>, <tt>x86</tt>, <tt>cygwin</tt>, <tt>darwin</tt>, <tt>freebsd</tt>, <tt>hpux</tt>, <tt>linux</tt>, <tt>mingw</tt>, <tt>netbsd</tt>, <tt>openbsd</tt>, <tt>solaris</tt>. </p> </li> <li class="gap"> <p> <tt>-target-cc-opt </tt><em>target</em><tt> </tt><em>option</em> <br> Like <tt>-cc-opt</tt>, this passes <em>option</em> to <tt>gcc</tt> when compiling C code, except it only passes <em>option</em> when the target architecture or operating system is <em>target</em>. Valid values for <em>target</em> are as for <tt>-target-as-opt</tt>. </p> </li> <li class="gap"> <p> <tt>-target-link-opt </tt><em>target</em><tt> </tt><em>option</em> <br> Like <tt>-link-opt</tt>, this passes <em>option</em> to <tt>gcc</tt> when linking, except it only passes <em>option</em> when the target architecture or operating system is <em>target</em>. Valid values for <em>target</em> are as for <tt>-target-as-opt</tt>. </p> </li> <li class="gap"> <p> <tt>-verbose {0|1|2|3}</tt> <br> How verbose to be about what passes are running. The default is <tt>0</tt>. <div> <table> <tr> <td> <tt>0</tt> </td> <td> silent </td> </tr> <tr> <td> <tt>1</tt> </td> <td> calls to compiler, assembler, and linker </td> </tr> <tr> <td> <tt>2</tt> </td> <td> 1, plus intermediate compiler passes </td> </tr> <tr> <td> <tt>3</tt> </td> <td> 2, plus some data structure sizes </td> </tr> </p> </table> </div> </li> </ul> </div> <p> <hr> Last edited on 2010-04-06 17:50:15 by <span title="129.21.75.73"><a href="MatthewFluet">MatthewFluet</a></span>. </body></html>