mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
... by having the automatically-generated optimization_options.m module
export the information we will need for that documentation.
tools/make_optimization_options_end:
Modify the predicate that lists the options at each optimization level
in two distinct ways:
- by turning the existing comments documenting the meaning of each
optimization level into strings that we can include the documentation,
and
- by adding next to each optimization_option setting, which cannot be
easily turned into the user-facing names of the options being set,
the option and its new value, which can be turned into that.
There was another possible way to get the second job done. This was
to have tools/make_optimization_options_middle generate TWO versions
of the code that is now bodily included in options.m between
INCLUDE_HANDLER_FILE_{START,END}: the one we have there now,
and one that can do the conversion in the reverse direction.
I judged this extra 500+ lines of code to be too much, even if
automatically generated.
(Putting the code as the body of a predicate with two modes would work,
but this would separate the parts of switch on Option inside the
special_handler that are automatically generated from the parts
which are hand-written, and would therefore allow any accidental
duplicate arms (options handled in both parts) to be undetected.
I judged this to be unacceptable also.)
The method I chose does duplicate some code (each level lists the
same info in two different ways), but since the consistency is trivial
to check visually, and we update levels so rarely, this should not matter.
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Conform to the changes above.
tools/make_optimization_options_db:
compiler/options.m:
Rename the optopt_everything_in_one_c_function option to the name
it has inside optimization_options.m, optopt_use_just_one_c_func.
Since this did not break anything, move the option to the
oc_unused category.
compiler/optimization_options.m:
Automatic update after the changes in tools/make_optimization_options*.
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
%---------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%---------------------------------------------------------------------------%
|
|
% Copyright (C) 2020,2025 The Mercury team.
|
|
% This file may only be copied under the terms of the GNU General
|
|
% Public License - see the file COPYING in the Mercury distribution.
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% File: optimization_options.m
|
|
% Main author: zs
|
|
%
|
|
% THIS MODULE IS AUTOMATICALLY GENERATED BY tools/make_optimization_options.
|
|
% DO NOT EDIT.
|
|
%
|
|
% This module manages optimization options. It defines a type, the opt_tuple,
|
|
% that allows quick access to them, sets their default values, and implements
|
|
% the turning on of optimizations when a given optimization level is selected.
|
|
%
|
|
|
|
:- module libs.optimization_options.
|
|
:- interface.
|
|
|
|
:- import_module libs.options.
|
|
|
|
:- import_module bool.
|
|
:- import_module getopt.
|
|
:- import_module list.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|