[m-rev.] for review: Fix -O<n> options below default optimisation level.

Zoltan Somogyi zoltan.somogyi at runbox.com
Mon Jun 7 16:38:11 AEST 2021


2021-06-07 14:13 GMT+10:00 "Peter Wang" <novalazy at gmail.com>:
> compiler/options.m:
>    Add new option `--default-opt-level' for use by Mercury.config.
> 
> tools/make_optimization_options_end:
>    Add predicate to parse the value of `--default-opt-level' from the
>    options table. The option value is a string because the value of the
>    MERCURY_DEFAULT_OPT_LEVEL environment variable will be passed as
>    the option value. The existence of the environment variable was
>    (barely) documented, but the allowable values are not.
>    Though the user might conceivably have set any Mercury compiler
>    option in that environment variable, the value was probably only
>    intended to be a string of the form "-O<int>", and that is all we
>    will support.
> 
> tools/make_optimization_options_middle:
>    Use `get_default_opt_level'.
> 
> compiler/optimization_options.m:
>    Regenerate this file.
> 
> compiler/options_file.m:
>    Do not automatically add "-O2" to MCFlags.
>    The comment says this was to set a default optimisation level when
>    calling the `mercury_compile' binary instead of the `mmc' script,
>    but `get_default_opt_level' already defaults to optimisation level 2.
> 
> scripts/Mercury.config.in:
>    Pass the value of MERCURY_DEFAULT_OPT_LEVEL using the
>    `--default-opt-level` option.

That looks fine.

Zoltan.


More information about the reviews mailing list