9.10.2 High-level (HLDS -> HLDS) optimization options
These optimizations are high-level transformations on our HLDS (high-level
data structure).
--no-inlining- Disable all forms of inlining.
--no-inline-simple- Disable the inlining of simple procedures.
--no-inline-builtins- Generate builtins (e.g. arithmetic operators) as calls to
out of line procedures. This is done by default when debugging,
as without this option the execution of builtins is not traced.
--no-inline-single-use- Disable the inlining of procedures called only once.
--inline-compound-threshold threshold- Inline a procedure if its size
(measured roughly in terms of the number of connectives in its internal form),
multiplied by the number of times it is called,
is below the given threshold.
--inline-simple-threshold threshold- Inline a procedure if its size is less than the given threshold.
--intermod-inline-simple-threshold threshold- Similar to –inline-simple-threshold, except used to determine which
predicates should be included in ‘.opt’ files. Note that changing this
between writing the ‘.opt’ file and compiling to C may cause link errors,
and too high a value may result in reduced performance.
--inline-vars-threshold threshold- Don't inline a call if it would result in a procedure
containing more than threshold variables. Procedures
containing large numbers of variables can cause
slow compilation.
--loop-invariants- Optimize loop invariants by moving computations within a loop that are
the same on every iteration to the outside so they are only calculated
once. (This is a separate optimization to ‘--optimize-rl-invariants’.)
--no-common-struct- Disable optimization of common term structures.
--constraint-propagation- Enable the constraint propagation transformation,
which attempts to transform the code so that goals
which can fail are executed as early as possible.
--local-constraint-propagation- Enable the constraint propagation transformation,
but only rearrange goals within each procedure.
Specialized versions of procedures will not be created.
--no-follow-code- Don't migrate builtin goals into branched goals.
--optimize-unused-args- Remove unused predicate arguments. The compiler will
generate more efficient code for polymorphic predicates.
--intermod-unused-args- Perform unused argument removal across module boundaries.
This option implies ‘--optimize-unused-args’ and
‘--intermodule-optimization’.
--unneeded-code- Remove goals from computation paths where their outputs are not needed,
provided the language semantics options allow the deletion or movement
of the goal.
--unneeded-code-copy-limit limit- Gives the maximum number of places to which a goal may be copied
when removing it from computation paths on which its outputs are not needed.
A value of zero forbids goal movement and allows only goal deletion;
a value of one prevents any increase in the size of the code.
--optimize-higher-order- Specialize calls to higher-order predicates where
the higher-order arguments are known.
--type-specialization- Specialize calls to polymorphic predicates where
the polymorphic types are known.
--user-guided-type-specialization- Enable specialization of polymorphic predicates for which
there are `:- pragma type_spec' declarations.
See the “Type specialization” section in the “Pragmas”
chapter of the Mercury Language Reference Manual for more details.
--higher-order-size-limit limit- Set the maximum goal size of specialized versions created by
‘--optimize-higher-order’ and ‘--type-specialization’.
Goal size is measured as the number of calls, unifications
and branched goals.
--higher-order-arg-limit limit- Set the maximum size of higher-order arguments to
be specialized by ‘--optimize-higher-order’ and
‘--type-specialization’.
--optimize-constant-propagation- Evaluate constant expressions at compile time.
--introduce-accumulators- Attempt to introduce accumulating variables into
procedures, so as to make the procedure tail recursive.
--optimize-constructor-last-call- Enable the optimization of “last” calls that are followed by
constructor application.
--optimize-dead-procs- Enable dead procedure elimination.
--excess-assign- Remove excess assignment unifications.
--no-optimize-format-calls- Do not attempt to interpret the format string in calls to
string.format and related predicates at compile time;
always leave this to be done at runtime.
--optimize-duplicate-calls- Optimize away multiple calls to a predicate with the same input arguments.
--delay-constructs- Reorder goals to move construction unifications after
primitive goals that can fail.
--optimize-saved-vars- Minimize the number of variables that have to be saved across calls.
--deforestation- Enable deforestation. Deforestation is a program transformation whose aim
is to avoid the construction of intermediate data structures and to avoid
repeated traversals over data structures within a conjunction.
--deforestation-depth-limit limit- Specify a depth limit to prevent infinite loops in the deforestation algorithm.
A value of -1 specifies no depth limit. The default is 4.
--deforestation-vars-threshold threshold- Specify a rough limit on the number of variables
in a procedure created by deforestation.
A value of -1 specifies no limit. The default is 200.
--deforestation-size-threshold threshold- Specify a rough limit on the size of a goal
to be optimized by deforestation.
A value of -1 specifies no limit. The default is 15.
--analyse-exceptions- Try to identify those procedures that cannot throw an exception.
This information can be used by some optimization passes.
--analyse-trail-usage- Enable trail usage analysis.
Identify those procedures that will not modify the trail.
This information is used to reduce the overhead of trailing.
--analyse-mm-tabling- Identify those goals that do not calls procedures
that are evaluated using minimal model tabling.
This information is used to reduce the overhead of minimal model tabling.