[m-rev.] for review: delete invalid procs from the HLDS

Julien Fischer jfischer at opturion.com
Tue Jul 18 20:17:14 AEST 2023



On Tue, 18 Jul 2023, Zoltan Somogyi wrote:

> Delete invalid procs from their pred_info.
> 
> compiler/hlds_pred.m:
>     This module used to maintain a distinction between valid and invalid
>     procedures in a pred_info. The distinction was based on whether the
>     proc_info field containing a list of mode_error_infos was empty
>     (such procedures were valid) or nonempty (such procedures were invalid).
>
>     This field was used only during the early phases of the compiler
>     from mode analysis to unique mode analysis, but all later passes
>     had to check whether the field was empty before processing the procedure.
>
>     This diff deletes this field from proc_infos. The information that this
>     field used to contain is now stored in *temporary* data structures
>     maintained and used only by the mode and unique mode analysis phases.
>     These phases use the code they share in modes.m to delete all invalid
>     procedures from the HLDS before they hand over that HLDS to other phases.
>     This means that outside these two compiler phases, *all* procedures in the
>     HLDS will be valid.
>
>     Delete all service predicates and functions that tested procedures
>     for validity, since this has now become a meaningless test. In one case,
>     where there was no non-validity-testing equivalent, make one.

...


> diff --git a/compiler/mode_info.m b/compiler/mode_info.m
> index 9e5d33ace..9bc15fe6e 100644
> --- a/compiler/mode_info.m
> +++ b/compiler/mode_info.m

...

> @@ -455,7 +477,7 @@
>                  % e.g. where the insts they handle come from.
>                  %
>                  % XXX The reason this field exists is probably because
> -                % Fergus thought that it is easier to stuff this informatio
> +                % Fergus thought that it is easier to stuff this information
>                  % into the mode_info, which those general-purpose predicates
>                  % have already got, than to pass them in separate arguments,
>                  % even though the latter would be semantically cleaner.
> @@ -575,6 +597,13 @@
>                  msi_pred_var_multimode_error_map
>                                              :: pred_var_multimode_error_map,
> 
> +                % This fields record which procedures have mode errors

s/fields/field/

s/record/records/


> +                % generated for them. A procedure which has a nonempty list
> +                % of mode errors is considered invalid by mode analysis,
> +                % and will be deleted from the HLDS at end of the current
> +                % mode analysis pass.
> +                msi_proc_mode_error_map     :: proc_mode_error_map,
> +
>                  % All the arguments from here on are sub-word-sized,
>                  % which should allow the compiler to pack them together.

That looks fine otherwise.

Julien.


More information about the reviews mailing list