1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>CompileTimeOptions</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">
<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css"/>
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20130715</a>
</div>
</div>
<div id="header">
<h1>CompileTimeOptions</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>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 <span class="monospaced">.c</span>,
<span class="monospaced">.mlb</span>, <span class="monospaced">.o</span>, <span class="monospaced">.s</span>, and <span class="monospaced">.sml</span>.</p></div>
<div class="paragraph"><p>With no arguments, MLton prints the version number and exits. For a
usage message, run MLton with an invalid switch, e.g. <span class="monospaced">mlton -z</span>. In
the explanation below and in the usage message, for flags that take a
number of choices (e.g. <span class="monospaced">{true|false}</span>), the first value listed is the
default.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_options">Options</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">-align <em>n</em></span>
</p>
<div class="paragraph"><p>Aligns object in memory by the specified alignment (<span class="monospaced">4</span> or <span class="monospaced">8</span>).
The default varies depending on architecture.</p></div>
</li>
<li>
<p>
<span class="monospaced">-as-opt <em>option</em></span>
</p>
<div class="paragraph"><p>Pass <em>option</em> to <span class="monospaced">gcc</span> when compiling assembler code. If you wish to
pass an option to the assembler, you must use <span class="monospaced">gcc</span>'s <span class="monospaced">-Wa,</span> syntax.</p></div>
</li>
<li>
<p>
<span class="monospaced">-cc-opt <em>option</em></span>
</p>
<div class="paragraph"><p>Pass <em>option</em> to <span class="monospaced">gcc</span> when compiling C code.</p></div>
</li>
<li>
<p>
<span class="monospaced">-codegen {native|x86|amd64|c}</span>
</p>
<div class="paragraph"><p>Generate native code or C code. With <span class="monospaced">-codegen native</span>
(<span class="monospaced">-codegen x86</span> or <span class="monospaced">-codegen amd64</span>), MLton typically compiles more
quickly and generates better code.</p></div>
</li>
<li>
<p>
<span class="monospaced">-const <em>name</em> <em>value</em></span>
</p>
<div class="paragraph"><p>Set the value of a compile-time constant. Here is a list of
available constants, their default values, and what they control.</p></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">Exn.keepHistory {false|true}</span>
</p>
<div class="paragraph"><p>Enable <span class="monospaced">MLton.Exn.history</span>. See <a href="MLtonExn">MLtonExn</a> for details. There is a
performance cost to setting this to <span class="monospaced">true</span>, 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></div>
</li>
</ul></div>
</li>
<li>
<p>
<span class="monospaced">-default-ann <em>ann</em></span>
</p>
<div class="paragraph"><p>Specify default <a href="MLBasisAnnotations">ML Basis annotations</a>. For
example, <span class="monospaced">-default-ann 'warnUnused true'</span> causes unused variable
warnings to be enabled by default. A default is overridden by the
corresponding annotation in an ML Basis file.</p></div>
</li>
<li>
<p>
<span class="monospaced">-default-type <em>type</em></span>
</p>
<div class="paragraph"><p>Specify the default binding for a primitive type. For example,
<span class="monospaced">-default-type word64</span> causes the top-level type <span class="monospaced">word</span> and the
top-level structure <span class="monospaced">Word</span> in the <a href="BasisLibrary">Basis Library</a> to be
equal to <span class="monospaced">Word64.word</span> and <span class="monospaced">Word64:WORD</span>, respectively. Similarly,
<span class="monospaced">-default-type intinf</span> causes the top-level type <span class="monospaced">int</span> and the
top-level structure <span class="monospaced">Int</span> in the <a href="BasisLibrary">Basis Library</a> to be
equal to <span class="monospaced">IntInf.int</span> and <span class="monospaced">IntInf:INTEGER</span>, respectively.</p></div>
</li>
<li>
<p>
<span class="monospaced">-disable-ann <em>ann</em></span>
</p>
<div class="paragraph"><p>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</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>-default-ann 'warnUnused true'
-disable-ann forceUsed
-disable-ann nonexhaustiveMatch
-disable-ann redundantMatch
-disable-ann warnUnused</pre>
</div></div>
</li>
<li>
<p>
<span class="monospaced">-export-header <em>file</em></span>
</p>
<div class="paragraph"><p>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></div>
</li>
<li>
<p>
<span class="monospaced">-ieee-fp {false|true}</span>
</p>
<div class="paragraph"><p>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 <span class="monospaced">-codegen x86</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">-inline <em>n</em></span>
</p>
<div class="paragraph"><p>Set the inlining threshold used in the optimizer. The threshold is an
approximate measure of code size of a procedure. The default is
<span class="monospaced">320</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">-keep {g|o}</span>
</p>
<div class="paragraph"><p>Save intermediate files. If no <span class="monospaced">-keep</span> argument is given, then only
the output file is saved.</p></div>
<table class="tableblock frame-all grid-all"
style="
width:100%;
">
<col style="width:25%;">
<col style="width:75%;">
<tbody>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">g</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">generated <span class="monospaced">.c</span> and <span class="monospaced">.s</span> files passed to <span class="monospaced">gcc</span></p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">o</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">object (<span class="monospaced">.o</span>) files</p></td>
</tr>
</tbody>
</table>
</li>
<li>
<p>
<span class="monospaced">-link-opt <em>option</em></span>
</p>
<div class="paragraph"><p>Pass <em>option</em> to <span class="monospaced">gcc</span> when linking. You can use this to specify
library search paths, e.g. <span class="monospaced">-link-opt -Lpath</span>, and libraries to link
with, e.g., <span class="monospaced">-link-opt -lfoo</span>, or even both at the same time,
e.g. <span class="monospaced">-link-opt '-Lpath -lfoo'</span>. If you wish to pass an option to the
linker, you must use <span class="monospaced">gcc</span>'s <span class="monospaced">-Wl,</span> syntax, e.g.,
<span class="monospaced">-link-opt '-Wl,--export-dynamic'</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">-mlb-path-map <em>file</em></span>
</p>
<div class="paragraph"><p>Use <em>file</em> as an <a href="MLBasisPathMap">ML Basis path map</a> to define
additional MLB path variables. Multiple uses of <span class="monospaced">-mlb-path-map</span> and
<span class="monospaced">-mlb-path-var</span> are allowed, with variable definitions in later path
maps taking precedence over earlier ones.</p></div>
</li>
<li>
<p>
<span class="monospaced">-mlb-path-var <em>name</em> <em>value</em></span>
</p>
<div class="paragraph"><p>Define an additional MLB path variable. Multiple uses of
<span class="monospaced">-mlb-path-map</span> and <span class="monospaced">-mlb-path-var</span> are allowed, with variable
definitions in later path maps taking precedence over earlier ones.</p></div>
</li>
<li>
<p>
<span class="monospaced">-output <em>file</em></span>
</p>
<div class="paragraph"><p>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></div>
</li>
<li>
<p>
<span class="monospaced">-profile {no|alloc|count|time}</span>
</p>
<div class="paragraph"><p>Produce an executable that gathers <a href="Profiling"> profiling</a> data. When
such an executable is run, it produces an <span class="monospaced">mlmon.out</span> file.</p></div>
</li>
<li>
<p>
<span class="monospaced">-profile-branch {false|true}</span>
</p>
<div class="paragraph"><p>If true, the profiler will separately gather profiling data for each
branch of a function definition, <span class="monospaced">case</span> expression, and <span class="monospaced">if</span>
expression.</p></div>
</li>
<li>
<p>
<span class="monospaced">-profile-stack {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, 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></div>
</li>
<li>
<p>
<span class="monospaced">-profile-val {false|true}</span>
</p>
<div class="paragraph"><p>If <span class="monospaced">true</span>, the profiler will separately gather profiling data for each
(expansive) <span class="monospaced">val</span> declaration.</p></div>
</li>
<li>
<p>
<span class="monospaced">-runtime <em>arg</em></span>
</p>
<div class="paragraph"><p>Pass argument to the runtime system via <span class="monospaced">@MLton</span>. See
<a href="RunTimeOptions">RunTimeOptions</a>. The argument will be processed before other
<span class="monospaced">@MLton</span> command line switches. Multiple uses of <span class="monospaced">-runtime</span> 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 <span class="monospaced">@MLton</span> or the
trailing <span class="monospaced">--</span>; these will be supplied automatically.</p></div>
<div class="paragraph"><p>An argument to <span class="monospaced">-runtime</span> 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></div>
<div class="listingblock">
<div class="content monospaced">
<pre>mlton -runtime 'ram-slop 0.4' foo.sml</pre>
</div></div>
<div class="paragraph"><p>will cause <span class="monospaced">foo</span> to run as if it had been called like:</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>foo @MLton ram-slop 0.4 --</pre>
</div></div>
<div class="paragraph"><p>An executable created with <span class="monospaced">-runtime stop</span> doesn’t process any
<span class="monospaced">@MLton</span> arguments. This is useful to create an executable, e.g.,
<span class="monospaced">echo</span>, that must treat <span class="monospaced">@MLton</span> like any other command-line argument.</p></div>
<div class="listingblock">
<div class="content monospaced">
<pre>% mlton -runtime stop echo.sml
% echo @MLton --
@MLton --</pre>
</div></div>
</li>
<li>
<p>
<span class="monospaced">-show-basis <em>file</em></span>
</p>
<div class="paragraph"><p>Pretty print to <em>file</em> the basis defined by the input program. See
<a href="ShowBasis">ShowBasis</a>.</p></div>
</li>
<li>
<p>
<span class="monospaced">-show-def-use <em>file</em></span>
</p>
<div class="paragraph"><p>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></div>
</li>
<li>
<p>
<span class="monospaced">-stop {f|g|o|tc}</span>
</p>
<div class="paragraph"><p>Specify when to stop.</p></div>
<table class="tableblock frame-all grid-all"
style="
width:100%;
">
<col style="width:25%;">
<col style="width:75%;">
<tbody>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">f</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">list of files on stdout (only makes sense when input is <span class="monospaced">foo.mlb</span>)</p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">g</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">generated <span class="monospaced">.c</span> and <span class="monospaced">.s</span> files</p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">o</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">object (<span class="monospaced">.o</span>) files</p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">tc</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">after type checking</p></td>
</tr>
</tbody>
</table>
<div class="paragraph"><p>If you compile with <span class="monospaced">-stop g</span> or <span class="monospaced">-stop o</span>, you can resume compilation
by running MLton on the generated <span class="monospaced">.c</span> and <span class="monospaced">.s</span> or <span class="monospaced">.o</span> files.</p></div>
</li>
<li>
<p>
<span class="monospaced">-target {self|<em>…</em>}</span>
</p>
<div class="paragraph"><p>Generate an executable that runs on the specified platform. The
default is <span class="monospaced">self</span>, 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></div>
</li>
<li>
<p>
<span class="monospaced">-target-as-opt <em>target</em> <em>option</em></span>
</p>
<div class="paragraph"><p>Like <span class="monospaced">-as-opt</span>, this passes <em>option</em> to <span class="monospaced">gcc</span> when compliling
assembler code, except it only passes <em>option</em> when the target
architecture or operating system is <em>target</em>.</p></div>
</li>
<li>
<p>
<span class="monospaced">-target-cc-opt <em>target</em> <em>option</em></span>
</p>
<div class="paragraph"><p>Like <span class="monospaced">-cc-opt</span>, this passes <em>option</em> to <span class="monospaced">gcc</span> when compiling C code,
except it only passes <em>option</em> when the target architecture or
operating system is <em>target</em>.</p></div>
</li>
<li>
<p>
<span class="monospaced">-target-link-opt <em>target</em> <em>option</em></span>
</p>
<div class="paragraph"><p>Like <span class="monospaced">-link-opt</span>, this passes <em>option</em> to <span class="monospaced">gcc</span> when linking, except
it only passes <em>option</em> when the target architecture or operating
system is <em>target</em>.</p></div>
</li>
<li>
<p>
<span class="monospaced">-verbose {0|1|2|3}</span>
</p>
<div class="paragraph"><p>How verbose to be about what passes are running. The default is <span class="monospaced">0</span>.</p></div>
<table class="tableblock frame-all grid-all"
style="
width:100%;
">
<col style="width:25%;">
<col style="width:75%;">
<tbody>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">0</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">silent</p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">1</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">calls to compiler, assembler, and linker</p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">2</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">1, plus intermediate compiler passes</p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top" ><p class="tableblock"><span class="monospaced">3</span></p></td>
<td class="tableblock halign-left valign-top" ><p class="tableblock">2, plus some data structure sizes</p></td>
</tr>
</tbody>
</table>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
|