Usage: ocamlopt <options> <files>
Options are:
-fPIC Generate position-independent machine code (default)
-fno-PIC Generate position-dependent machine code
-a Build a library
-alert <list> Enable or disable alerts according to <list>:
+<alertname> enable alert <alertname>
-<alertname> disable alert <alertname>
++<alertname> treat <alertname> as fatal error
--<alertname> treat <alertname> as non-fatal
@<alertname> enable <alertname> and treat it as fatal error
<alertname> can be 'all' to refer to all alert names
-absname Show absolute filenames in error messages
-no-absname Do not try to show absolute filenames in error messages (default)
-afl-instrument Enable instrumentation for afl-fuzz
-afl-inst-ratio Configure percentage of branches instrumented
(advanced, see afl-fuzz docs for AFL_INST_RATIO)
-annot (deprecated) Save information in <filename>.annot
-bin-annot Save typedtree in <filename>.cmt
-bin-annot-occurrences Store every occurrence of a bound name in the .cmt file.
This information can be used by external tools to provide
features such as project-wide occurrences. This flag has
no effect in the absence of '-bin-annot'.
-inline-branch-factor <n>|<round>=<n>[,...] Estimate the probability of a branch being cold as 1/(1+n) (used for inlining) (default 0.10)
-c Compile only (do not link)
-cc <command> Use <command> as the C compiler and linker
-cclib <opt> Pass option <opt> to the C linker
-ccopt <opt> Pass option <opt> to the C compiler and linker
-cmi-file <file> Use the <file> interface file to type-check
-clambda-checks Instrument clambda code with closure and field access checks (for debugging the compiler)
-Oclassic Make inlining decisions at function definition time rather than at the call site (replicates previous behaviour of the compiler)
-color {auto|always|never} Enable or disable colors in compiler messages
The following settings are supported:
auto use heuristics to enable colors only if supported
always enable colors
never disable colors
The default setting is 'auto', and the current heuristic
checks that the TERM environment variable exists and is
not empty or "dumb", and that isatty(stderr) holds.
If the option is not specified, these setting can alternatively
be set through the OCAML_COLOR environment variable.
-error-style {contextual|short} Control the way error messages and warnings are printed
The following settings are supported:
short only print the error and its location
contextual like "short", but also display the source code
snippet corresponding to the location of the error
The default setting is 'contextual'.
If the option is not specified, these setting can alternatively
be set through the OCAML_ERROR_STYLE environment variable.
-compact Optimize code size rather than speed
-config Print configuration values and exit
-config-var Print the value of a configuration variable, without a newline, and exit
(print nothing and exit with error value if the variable does not exist)
-dtypes (deprecated) same as -annot
-for-pack <ident> Generate code that can later be `packed' with
ocamlopt -pack -o <ident>.cmx
-g Record debugging information for exception backtrace
-no-g Do not record debugging information (default)
-function-sections Generate each function in a separate section if target supports it
-stop-after {parsing|typing|lambda|scheduling|emit} Stop after the given compilation pass.
-save-ir-after {scheduling} Save intermediate representation after the given compilation pass(may be specified more than once).
-i Print inferred interface
-i-variance Print inferred variances
-I <dir> Add <dir> to the list of include directories
-H <dir> Add <dir> to the list of "hidden" include directories
(Like -I, but the program can not directly reference these dependencies)
-impl <file> Compile <file> as a .ml file
-inline <n>|<round>=<n>[,...] Aggressiveness of inlining (default 1.25, higher numbers mean more aggressive)
-inline-toplevel <n>|<round>=<n>[,...] Aggressiveness of inlining at toplevel (higher numbers mean more aggressive)
-inline-alloc-cost <n>|<round>=<n>[,...] The cost of not removing an allocation during inlining (default 7, higher numbers more costly)
-inline-branch-cost <n>|<round>=<n>[,...] The cost of not removing a conditional during inlining (default 5, higher numbers more costly)
-inline-call-cost <n>|<round>=<n>[,...] The cost of not removing a call during inlining (default 5, higher numbers more costly)
-inline-prim-cost <n>|<round>=<n>[,...] The cost of not removing a primitive during inlining (default 3, higher numbers more costly)
-inline-indirect-cost <n>|<round>=<n>[,...] The cost of not removing an indirect call during inlining (default 4, higher numbers more costly)
-inline-lifting-benefit <n>|<round>=<n>[,...] The benefit of lifting definitions to toplevel during inlining (default 1300, higher numbers more beneficial)
-inlining-report Emit `.<round>.inlining' file(s) (one per round) showing the inliner's decisions
-insn-sched Run the instruction scheduling pass (default)
-intf <file> Compile <file> as a .mli file
-intf-suffix <string> Suffix for interface files (default: .mli)
-keep-docs Keep documentation strings in .cmi files
-no-keep-docs Do not keep documentation strings in .cmi files (default)
-keep-locs Keep locations in .cmi files (default)
-no-keep-locs Do not keep locations in .cmi files
-keywords <version+list> set keywords following the <version+list> spec:
-<version> if present specifies the base set of keywords
(if absent the current set of keywords is used)
-<list> is a "+"-separated list of keywords to add to
the base set of keywords.
-labels Use commuting label mode
-linkall Link all modules, even unused ones
-inline-max-depth <n>|<round>=<n>[,...] Maximum depth of search for inlining opportunities inside inlined functions (default 1)
-alias-deps Do record dependencies for module aliases
-no-alias-deps Do not record dependencies for module aliases
-linscan Use the linear scan register allocator
-app-funct Activate applicative functors
-no-app-funct Deactivate applicative functors
-no-float-const-prop Deactivate constant propagation for floating-point operations
-noassert Do not compile assertion checks
-noautolink Do not automatically link C libraries specified in .cmxa files
-nodynlink Enable optimizations for code that will not be dynlinked
-no-insn-sched Do not run the instruction scheduling pass
-nolabels Ignore non-optional labels in types
-nostdlib Do not add default directory to the list of include directories
-nocwd Do not implicitly add the current directory to the load path
-nopervasives (undocumented)
-no-unbox-free-vars-of-closures Do not unbox variables that will appear inside function closures
-no-unbox-specialised-args Do not unbox arguments to which functions have been specialised
-o <file> Set output file name to <file>
-O2 Apply increased optimization for speed
-O3 Apply aggressive optimization for speed (may significantly increase code size and compilation time)
-opaque Does not generate cross-module optimization information
(reduces necessary recompilation on module change)
-open <module> Opens the module <module> before typing
-output-obj Output an object file instead of an executable
-output-complete-obj Output an object file, including runtime, instead of an executable
-p (no longer supported)
-pack Package the given .cmx files into one .cmx
-plugin <plugin> (no longer supported)
-pp <command> Pipe sources through preprocessor <command>
-ppx <command> Pipe abstract syntax trees through preprocessor <command>
-principal Check principality of type inference
-no-principal Do not check principality of type inference (default)
-rectypes Allow arbitrary recursive types
-no-rectypes Do not allow arbitrary recursive types (default)
-remove-unused-arguments Remove unused function arguments
-rounds <n> Repeat tree optimization and inlining phases this many times (default 1). Rounds are numbered starting from zero.
-runtime-variant <str> Use the <str> variant of the run-time system
-with-runtime Include the runtime system in the generated program (default)
-without-runtime Do not include the runtime system in the generated program.
-S Keep intermediate assembly file
-safe-string (default unconditionally since 5.0)
-safer-matching Do not use type information to optimize pattern-matching
-set-runtime-default <param>=<value> Set the default for runtime parameter <param> to <value> (see the manual for further details)
-shared Produce a dynlinkable plugin
-short-paths Shorten paths in types
-strict-sequence Left-hand part of a sequence must have type unit
-no-strict-sequence Left-hand part of a sequence need not have type unit (default)
-strict-formats Reject invalid formats accepted by legacy implementations (default)
(Warning: Invalid formats may behave differently from
previous OCaml versions, and will become always-rejected
in future OCaml versions. You should always use this flag
to detect invalid formats so you can fix them.)
-no-strict-formats Accept invalid formats accepted by legacy implementations
(Warning: Invalid formats may behave differently from
previous OCaml versions, and will become always-rejected
in future OCaml versions. You should never use this flag
and instead fix invalid formats.)
-thread (deprecated) same as -I +threads
-unbox-closures Pass free variables via specialised arguments rather than closures
-unbox-closures-factor <n > 0> Scale the size threshold above which unbox-closures will slow down indirect calls rather than duplicating a function (default 10)
-inline-max-unroll <n>|<round>=<n>[,...] Unroll recursive functions at most this many times (default 0)
-unboxed-types unannotated unboxable types will be unboxed
-no-unboxed-types unannotated unboxable types will not be unboxed (default)
-unsafe Do not compile bounds checking on array and string access
-unsafe-string (option not available)
-v Print compiler version and location of standard library and exit
-verbose Print calls to external commands
-version Print version and exit
--version Print version and exit
-vnum Print version number and exit
-w <list> Enable or disable warnings according to <list>:
+<spec> enable warnings in <spec>
-<spec> disable warnings in <spec>
@<spec> enable warnings in <spec> and treat them as errors
<spec> can be:
<num> a single warning number
<num1>..<num2> a range of consecutive warning numbers
<letter> a predefined set
default setting is "+a-4-7-9-27-29-30-32..42-44-45-48-50-60-66..70-74"
-warn-error <list> Enable or disable error status for warnings according
to <list>. See option -w for the syntax of <list>.
Default setting is "-a"
-warn-help Show description of warning numbers
-where Print location of standard library and exit
- <file> Treat <file> as a file name (even if it starts with `-')
-match-context-rows <n> (advanced, see manual section 13.2.)
-dno-unique-ids (undocumented)
-dunique-ids (undocumented)
-dno-canonical-ids (undocumented)
-dcanonical-ids (undocumented)
-dno-locations (undocumented)
-dlocations (undocumented)
-dsource (undocumented)
-dparsetree (undocumented)
-dparsetree-loc-ghost-invariants (undocumented)
-dtypedtree (undocumented)
-dshape (undocumented)
-dmatchcomp (undocumented)
-drawlambda (undocumented)
-dlambda (undocumented)
-drawclambda (undocumented)
-dclambda (undocumented)
-dcmm-invariants Extra sanity checks on Cmm
-dflambda Print Flambda terms
-drawflambda Print Flambda terms after closure conversion
-dflambda-invariants Check Flambda invariants around each pass
-dflambda-no-invariants Do not Check Flambda invariants around each pass
-dflambda-let <stamp> Print when the given Flambda [Let] is created
-dflambda-verbose Print Flambda terms including around each pass
-dcmm (undocumented)
-dsel (undocumented)
-dcombine (undocumented)
-dcse (undocumented)
-dlive (undocumented)
-dspill (undocumented)
-dsplit (undocumented)
-dinterf (undocumented)
-dprefer (undocumented)
-dalloc (undocumented)
-dreload (undocumented)
-dscheduling (undocumented)
-dlinear (undocumented)
-dinterval (undocumented)
-dstartup (undocumented)
-dtimings Print timings information for each pass
-dprofile Print performance information for each pass
The columns are: time alloc top-heap absolute-top-heap.
-dump-into-file dump output like -dlambda into <target>.dump
-dump-dir <dir> dump output like -dlambda into <dir>/<target>.dump
-dump-pass Record transformations performed by these passes:
unbox-closures unbox-specialised-args unbox-free-vars-of-closures
remove-free-vars-equal-to-args remove-unused-arguments unused-arguments
-args <file> Read additional newline-terminated command line arguments
from <file>
-args0 <file> Read additional null character terminated command line arguments
from <file>
-depend <options> Compute dependencies (use 'ocamlopt -depend -help' for details)
-help Display this list of options
--help Display this list of options
Options (159)
| Option | Description | Source |
|---|---|---|
-fPIC | Generate position-independent machine code (default) | help |
-fno-PIC | Generate position-dependent machine code | help |
-a | Build a library | help |
-alert list | Enable or disable alerts according to <list>: +<alertname> enable alert <alertname> | help |
-absname | Show absolute filenames in error messages | help |
-no-absname | Do not try to show absolute filenames in error messages (default) | help |
-annot | (deprecated) Save information in <filename>.annot | help |
-bin-annot | Save typedtree in <filename>.cmt | help |
-bin-annot-occurrences | Store every occurrence of a bound name in the .cmt file. | help |
-inline-branch-factor n>|<round>=<n | Estimate the probability of a branch being cold as 1/(1+n) (used for inlining) (default 0.10) | help |
-c | Compile only (do not link) | help |
-cc command | Use <command> as the C compiler and linker | help |
-cclib opt | Pass option <opt> to the C linker | help |
-ccopt opt | Pass option <opt> to the C compiler and linker | help |
-cmi-file file | Use the <file> interface file to type-check | help |
-clambda-checks | Instrument clambda code with closure and field access checks (for debugging the compiler) | help |
-Oclassic | Make inlining decisions at function definition time rather than at the call site (replicates previous behaviour of the compiler) | help |
-color auto|always|never | Enable or disable colors in compiler messages The following settings are supported: auto use heuristics to enable colors only if supported always enable colors never disable colors The default… | help |
-error-style contextual|short | Control the way error messages and warnings are printed The following settings are supported: short only print the error and its location contextual like "short", but also display the source code… | help |
-compact | Optimize code size rather than speed | help |
-config | Print configuration values and exit | help |
-config-var | Print the value of a configuration variable, without a newline, and exit (print nothing and exit with error value if the variable does not exist) | help |
-dtypes | (deprecated) same as -annot | help |
-for-pack ident | Generate code that can later be `packed' with ocamlopt -pack -o <ident>.cmx | help |
-g | Record debugging information for exception backtrace | help |
-no-g | Do not record debugging information (default) | help |
-function-sections | Generate each function in a separate section if target supports it | help |
-i | Print inferred interface | help |
-i-variance | Print inferred variances | help |
-I dir | Add <dir> to the list of include directories | help |
-H dir | Add <dir> to the list of "hidden" include directories (Like -I, but the program can not directly reference these dependencies) | help |
-impl file | Compile <file> as a .ml file | help |
-inline n>|<round>=<n | Aggressiveness of inlining (default 1.25, higher numbers mean more aggressive) | help |
-inline-toplevel n>|<round>=<n | Aggressiveness of inlining at toplevel (higher numbers mean more aggressive) | help |
-inline-alloc-cost n>|<round>=<n | The cost of not removing an allocation during inlining (default 7, higher numbers more costly) | help |
-inline-branch-cost n>|<round>=<n | The cost of not removing a conditional during inlining (default 5, higher numbers more costly) | help |
-inline-call-cost n>|<round>=<n | The cost of not removing a call during inlining (default 5, higher numbers more costly) | help |
-inline-prim-cost n>|<round>=<n | The cost of not removing a primitive during inlining (default 3, higher numbers more costly) | help |
-inline-indirect-cost n>|<round>=<n | The cost of not removing an indirect call during inlining (default 4, higher numbers more costly) | help |
-inline-lifting-benefit n>|<round>=<n | The benefit of lifting definitions to toplevel during inlining (default 1300, higher numbers more beneficial) | help |
-inlining-report | Emit `.<round>.inlining' file(s) (one per round) showing the inliner's decisions | help |
-insn-sched | Run the instruction scheduling pass (default) | help |
-intf file | Compile <file> as a .mli file | help |
-intf-suffix string | Suffix for interface files (default: .mli) | help |
-keep-docs | Keep documentation strings in .cmi files | help |
-no-keep-docs | Do not keep documentation strings in .cmi files (default) | help |
-keep-locs | Keep locations in .cmi files (default) | help |
-no-keep-locs | Do not keep locations in .cmi files | help |
-keywords version+list | set keywords following the <version+list> spec: | help |
-labels | Use commuting label mode | help |
-linkall | Link all modules, even unused ones | help |
-inline-max-depth n>|<round>=<n | Maximum depth of search for inlining opportunities inside inlined functions (default 1) | help |
-alias-deps | Do record dependencies for module aliases | help |
-no-alias-deps | Do not record dependencies for module aliases | help |
-linscan | Use the linear scan register allocator | help |
-app-funct | Activate applicative functors | help |
-no-app-funct | Deactivate applicative functors | help |
-no-float-const-prop | Deactivate constant propagation for floating-point operations | help |
-noassert | Do not compile assertion checks | help |
-noautolink | Do not automatically link C libraries specified in .cmxa files | help |
-nodynlink | Enable optimizations for code that will not be dynlinked | help |
-no-insn-sched | Do not run the instruction scheduling pass | help |
-nolabels | Ignore non-optional labels in types | help |
-nostdlib | Do not add default directory to the list of include directories | help |
-nocwd | Do not implicitly add the current directory to the load path | help |
-nopervasives | (undocumented) | help |
-no-unbox-free-vars-of-closures | Do not unbox variables that will appear inside function closures | help |
-no-unbox-specialised-args | Do not unbox arguments to which functions have been specialised | help |
-o file | Set output file name to <file> | help |
-O2 | Apply increased optimization for speed | help |
-O3 | Apply aggressive optimization for speed (may significantly increase code size and compilation time) | help |
-opaque | Does not generate cross-module optimization information (reduces necessary recompilation on module change) | help |
-open module | Opens the module <module> before typing | help |
-output-obj | Output an object file instead of an executable | help |
-output-complete-obj | Output an object file, including runtime, instead of an executable | help |
-p | (no longer supported) | help |
-pack | Package the given .cmx files into one .cmx | help |
-plugin plugin | (no longer supported) | help |
-pp command | Pipe sources through preprocessor <command> | help |
-ppx command | Pipe abstract syntax trees through preprocessor <command> | help |
-principal | Check principality of type inference | help |
-no-principal | Do not check principality of type inference (default) | help |
-rectypes | Allow arbitrary recursive types | help |
-no-rectypes | Do not allow arbitrary recursive types (default) | help |
-remove-unused-arguments | Remove unused function arguments | help |
-rounds n | Repeat tree optimization and inlining phases this many times (default 1). | help |
-runtime-variant str | Use the <str> variant of the run-time system | help |
-S | Keep intermediate assembly file | help |
-safe-string | (default unconditionally since 5.0) | help |
-safer-matching | Do not use type information to optimize pattern-matching | help |
-set-runtime-default param>=<value | Set the default for runtime parameter <param> to <value> (see the manual for further details) | help |
-shared | Produce a dynlinkable plugin | help |
-short-paths | Shorten paths in types | help |
-strict-sequence | Left-hand part of a sequence must have type unit | help |
-no-strict-sequence | Left-hand part of a sequence need not have type unit (default) | help |
-strict-formats | Reject invalid formats accepted by legacy implementations (default) (Warning: Invalid formats may behave differently from previous OCaml versions, and will become always-rejected in future OCaml… | help |
-no-strict-formats | Accept invalid formats accepted by legacy implementations (Warning: Invalid formats may behave differently from previous OCaml versions, and will become always-rejected in future OCaml versions. | help |
-thread | (deprecated) same as -I +threads | help |
-unbox-closures | Pass free variables via specialised arguments rather than closures | help |
-unbox-closures-factor n | Scale the size threshold above which unbox-closures will slow down indirect calls rather than duplicating a function (default 10) | help |
-inline-max-unroll n>|<round>=<n | Unroll recursive functions at most this many times (default 0) | help |
-unboxed-types | unannotated unboxable types will be unboxed | help |
-no-unboxed-types | unannotated unboxable types will not be unboxed (default) | help |
-unsafe | Do not compile bounds checking on array and string access | help |
-unsafe-string | (option not available) | help |
-v | Print compiler version and location of standard library and exit | help |
-verbose | Print calls to external commands | help |
-version | Print version and exit | help |
--version | Print version and exit | help |
-vnum | Print version number and exit | help |
-w list | Enable or disable warnings according to <list>: +<spec> enable warnings in <spec> | help |
-warn-error list | Enable or disable error status for warnings according to <list>. | help |
-warn-help | Show description of warning numbers | help |
-where | Print location of standard library and exit | help |
-match-context-rows n | (advanced, see manual section 13.2.) | help |
-dno-unique-ids | (undocumented) | help |
-dunique-ids | (undocumented) | help |
-dno-canonical-ids | (undocumented) | help |
-dcanonical-ids | (undocumented) | help |
-dno-locations | (undocumented) | help |
-dlocations | (undocumented) | help |
-dsource | (undocumented) | help |
-dparsetree | (undocumented) | help |
-dparsetree-loc-ghost-invariants | (undocumented) | help |
-dtypedtree | (undocumented) | help |
-dshape | (undocumented) | help |
-dmatchcomp | (undocumented) | help |
-drawlambda | (undocumented) | help |
-dlambda | (undocumented) | help |
-drawclambda | (undocumented) | help |
-dclambda | (undocumented) | help |
-dcmm-invariants | Extra sanity checks on Cmm | help |
-dflambda | Print Flambda terms | help |
-drawflambda | Print Flambda terms after closure conversion | help |
-dflambda-invariants | Check Flambda invariants around each pass | help |
-dflambda-no-invariants | Do not Check Flambda invariants around each pass | help |
-dflambda-let stamp | Print when the given Flambda [Let] is created | help |
-dflambda-verbose | Print Flambda terms including around each pass | help |
-dcmm | (undocumented) | help |
-dsel | (undocumented) | help |
-dcombine | (undocumented) | help |
-dcse | (undocumented) | help |
-dlive | (undocumented) | help |
-dspill | (undocumented) | help |
-dsplit | (undocumented) | help |
-dinterf | (undocumented) | help |
-dprefer | (undocumented) | help |
-dalloc | (undocumented) | help |
-dreload | (undocumented) | help |
-dscheduling | (undocumented) | help |
-dlinear | (undocumented) | help |
-dinterval | (undocumented) | help |
-dstartup | (undocumented) | help |
-dtimings | Print timings information for each pass | help |
-dprofile | Print performance information for each pass The columns are: time alloc top-heap absolute-top-heap. | help |
-dump-into-file | dump output like -dlambda into <target>.dump | help |
-dump-pass | Record transformations performed by these passes: unbox-closures unbox-specialised-args unbox-free-vars-of-closures remove-free-vars-equal-to-args remove-unused-arguments unused-arguments | help |
-help | Display this list of options | help |
--help | Display this list of options | help |