Files
mercury/tests/warnings/help_opt_levels.err_exp
Zoltan Somogyi 51b1304b0d Record the initial values of the bool_special options ...
... which are managed by tools/make_optimization_options.

tools/make_optimization_options_middle:
    When creating compiler/optimization_options.m, put into it
    a new predicate that records, for each bool_special option
    managed by this module, its initial value.

compiler/print_help.m:
    Handle bool_special options whose initial value this new predicate
    makes known the same way we now handle plain bool options.
    The difference this makes is that bool_special options that
    default to "yes" will now have their --no-xyz form listed as
    the user-visible form of the option, not their --xyz form.

tools/make_optimization_options_db:
tools/make_optimization_options_end:
    Fix a discrepancy that made documenting the smart indexing
    unnecessarily complicated. The first such option defaulted to "no",
    but was switched to "yes" at -O0, while the others all defaulted
    to "yes". Allow these options to be documented in the same manner
    by making them *all* default to "no", and switch them all on at -O0.

compiler/optimization_options.m:
    Rebuilt with the updated make_optimization_options.

compiler/options.m:
    Many of the bool_special options that default to "yes" had
    help text that already assumed that this text followed
    the option name being printed as --no-xyz.

    For the others, which assumed that they followed --xyz,
    change the help text to be appropriate when following
    the --no-xyz form.

tests/warnings/help_text.err_exp:
    Expect the updated help texts.

doc/user_guide.texi:
    Expect the updated help texts, from this and earlier commits.

tests/warnings/help_opt_level.err_exp:
    Expect the added level-enabled options.
2025-07-07 13:19:35 +02:00

123 lines
3.3 KiB
Plaintext

Optimization level 0:
Aim to minimize overall compilation time.
The options set at this level are:
--common-data
--excess-assign
--llds-optimize
--mlds-optimize
--mlds-peephole
--optimize-dead-procs
--optimize-jumps
--optimize-labels
--optimize-peep
--optimize-peep-mkword
--optimize-repeat=1
--smart-atomic-indexing
--smart-float-indexing
--smart-indexing
--smart-string-indexing
--smart-tag-indexing
--static-ground-terms
Optimization level 1:
Apply optimizations which are cheap and have a good payoff
while still keeping compilation time small.
The options set at this level are:
--c-optimize
--emit-c-loops
--middle-rec
--optimize-delay-slot
--optimize-frames
--optimize-tailcalls
--use-local-vars
Optimization level 2:
Apply optimizations which have a good payoff relative to their cost;
but include optimizations which are more costly than with -O1.
The options set at this level are:
--common-struct
--follow-code
--inline-compound-threshold=10
--inline-simple
--inline-single-use
--merge-code-after-switch
--optimize-constant-propagation
--optimize-dups
--optimize-fulljumps
--optimize-initializations
--optimize-repeat=3
--simple-neg
--split-switch-arms
--user-guided-type-specialization
Optimization level 3:
Apply optimizations which usually have a good payoff even if they
increase compilation time quite a bit.
The options set at this level are:
--constraint-propagation
--deforestation
--local-constraint-propagation
--optimize-higher-order
--optimize-reassign
--optimize-repeat=4
--optimize-saved-vars-const
--optimize-unused-args
Optimization level 4:
Apply optimizations which may have some payoff even if they
increase compilation time quite a bit.
Currently this enables the use of local variables
and increases the inlining thresholds.
The options set at this level are:
--higher-order-size-limit=30
--inline-compound-threshold=20
--inline-simple-threshold=8
Optimization level 5:
Apply optimizations which may have some payoff even if they
increase compilation time a lot.
Currently this enables the search for construction unifications that
can be delayed past failing computations, allows more passes of the
low-level optimizations, and increases the inlining thresholds
still further. We also enable eliminate_local_vars only at
this level, because that pass is implemented pretty inefficiently.
The options set at this level are:
--delay-constructs
--eliminate-local-variables
--higher-order-size-limit=40
--inline-compound-threshold=100
--loop-invariants
--optimize-repeat=5
Optimization level 6:
Apply optimizations which may have any payoff even if they
increase compilation time to completely unreasonable levels.
Currently this just enables inlining of GC_malloc(), redo(), and fail().
The options set at this level are:
--inline-alloc
--use-macro-for-redo-fail