[m-rev.] for review: in_all_grades/in_tailrec_grades_only

Julien Fischer jfischer at opturion.com
Tue May 19 10:40:30 AEST 2026


On Mon, 18 May 2026 at 20:10, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:

> Add in_all_grades/in_tailrec_grades_only flags ...
>
> ... as new options to require_tail_recursion pragmas.

...


> diff --git a/compiler/hlds_pred.m b/compiler/hlds_pred.m
> index 07ff49656..fade91299 100644
> --- a/compiler/hlds_pred.m
> +++ b/compiler/hlds_pred.m
> @@ -562,6 +562,7 @@
>
>      % Return a list of the proc_ids for all the modes of this predicate
>      % that are not imported.
> +    % ZZZ
>      %
>  :- func pred_info_all_non_imported_procids(pred_info) = list(proc_id).

Presuambly, this was in aid of something?

> diff --git a/compiler/mark_tail_calls.m b/compiler/mark_tail_calls.m
> index 43d52ecd4..853f1307b 100644
> --- a/compiler/mark_tail_calls.m
> +++ b/compiler/mark_tail_calls.m

...


> @@ -1091,6 +1103,17 @@ maybe_report_nontail_recursive_call(ModuleInfo,
>          true
>      ).
>
> +:- pred grade_supports_tail_recursion(module_info::in) is semidet.
> +
> +grade_supports_tail_recursion(ModuleInfo) :-
> +    module_info_get_globals(ModuleInfo, Globals),
> +    % XXX Are there any other grade components that disable tail recursion?
> +    globals.lookup_bool_option(Globals, profile_deep, no),
> +    globals.lookup_bool_option(Globals, exec_trace, no),
> +    globals.lookup_bool_option(Globals, source_to_source_debug, no),
> +    globals.lookup_bool_option(Globals, use_minimal_model_stack_copy, no),
> +    globals.lookup_bool_option(Globals, use_minimal_model_own_stacks, no).

agc grades?

The diff looks fine.

Julien.


More information about the reviews mailing list