Next: Experimental source-to-source optimizations, Previous: Overall control of optimizations, Up: Optimization options [Contents][Index]
--optimize-dead-procs
--optimise-dead-procs
Delete all procedures that are never called.
--unneeded-code
Remove goals from computation paths where their outputs are not needed, provided the semantics options allow the deletion or movement of the goal.
--unneeded-code-copy-limit copy_limit
Specify 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-unused-args
--optimise-unused-args
Delete unused arguments from predicates and functions. This will cause the compiler to generate more efficient code for many polymorphic predicates.
--intermod-unused-args
Delete unused arguments from predicates and functions even when the analysis required crosses module boundaries. This option implies ‘--optimize-unused-args’ and ‘--intermodule-optimization’.
--no-optimize-format-calls
Do not optimize calls to string.format
, io.format
, and
stream.string_writer.format
at compile time. The default is to
interpret the format string in such calls at compile time, replacing
those calls with the sequence of more primitive operations required to
implement them.
--optimize-constant-propagation
--optimise-constant-propagation
Given calls to some frequently used library functions and predicates, mainly those that do arithmetic, evaluate them at compile time, if all their input arguments are constants.
--optimize-duplicate-calls
--optimise-duplicate-calls
Given multiple calls to a predicate or function with the same input arguments, optimize away all but one.
--excess-assign
Remove assignment unifications whose only effect is to give another name to the same value.
--inlining
Ask the compiler to inline procedures using its usual heuristics.
--no-inline-builtins
Normally, the compiler implements builtin operations (such as arithmetic) using inline code. With ‘--no-inline-builtins’, the compiler will implement them as calls to out-of-line procedures. This latter is done by default when debugging, since this allows the execution of builtins to be traced.
--inline-single-use
Inline procedures which are called only from one call site.
--inline-simple
Inline all simple procedures.
--inline-simple-threshold threshold
With ‘--inline-simple’, 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-compound-threshold threshold
Inline a procedure if its size (measured roughly in terms of the number of connectives in its internal form) less the assumed call cost, multiplied by the number of times it is called, is below the given threshold.
--inline-call-cost cost
Assume that the cost of a call is the given parameter. Used only in conjunction with ‘--inline-compound-threshold’.
--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.
--inline-linear-tail-rec-sccs
Given a set of mutually recursive procedures (an SCC, or strongly connected component, of the call graph) in which each procedure contains exactly tail call to a procedure in the SCC, so that the tail recursive calls form a linear chain through the SCC, inline the callee at every one of those mutually tail recursive call sites. This converts mutual tail recursion into self tail recursion, which the MLDS backend can turn into code that runs in constant stack space.
--optimize-higher-order
--optimise-higher-order
Create specialized variants of higher-order predicates and functions for call sites where the values of the higher-order arguments are known.
--type-specialization
--type-specialisation
Enable specialization of polymorphic predicates where the polymorphic types are known.
--user-guided-type-specialization
--user-guided-type-specialisation
Enable specialization of polymorphic predicates for which there are
:- pragma type_spec
declarations. See the
“Type specialization” section of the “Pragmas” chapter of the
Mercury language Reference Manual for more details.
--higher-order-size-limit max_size
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 max_size
Set the maximum size of higher-order arguments to be specialized by ‘--optimize-higher-order’ and ‘--type-specialization’.
--loop-invariants
Hoist loop invariant computations out of loops.
--introduce-accumulators
Attempt to make procedures tail recursive by introducing accumulator variables into them.
--optimize-constructor-last-call
--optimise-constructor-last-call
Enable the optimization of almost-last calls that are followed only by constructor application.
--no-split-switch-arms
When a switch on a variable has an inner switch on that same variable inside one of its arms, the default is to split up that arm of the outer switch along the same lines, effectively inlining the inner switch. ‘--no-split-switch-arms’ prevents this split.
--no-const-struct
By default, the compiler will gather constant ground structures in a separate table, with each such structure being stored in this table just once, even if it occurs in many different procedures. ‘--no-const-struct’ prevents this behavior.
--common-struct
Replace two or more occurrences of the same term in a conjunction with just one copy.
--optimize-saved-vars
--optimise-saved-vars
Minimize the number of variables saved across calls.
--constraint-propagation
Perform the constraint propagation transformation, which attempts to ensure that goals which can fail are executed as early as possible.
--local-constraint-propagation
Perform the constraint propagation transformation, but only rearrange goals within each procedure. Specialized versions of procedures will not be created.
--deforestation
Perform deforestation, which is a program transformation whose aims are to avoid the construction of intermediate data structures, and to avoid repeated traversals over data structures within a conjunction.
--deforestation-depth-limit depth_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.
--delay-constructs
--delay-construct
Reorder goals to move construction unifications after primitive goals that can fail.
--no-generate-trail-ops-inline
Normally, the compiler generates inline code for trailing operations. With ‘--no-generate-trail-ops-inline’, the compiler will implement them using calls to those operations in the standard library.
Next: Experimental source-to-source optimizations, Previous: Overall control of optimizations, Up: Optimization options [Contents][Index]