<div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, 30 Aug 2025 at 03:27, Zoltan Somogyi <<a href="mailto:zoltan.somogyi@runbox.com">zoltan.somogyi@runbox.com</a>> wrote:<br></div><div><br></div><div>> diff --git a/doc/mercury_user_guide.texi b/doc/mercury_user_guide.texi<br>> index 79d268e94..0b7f1d8a8 100644<br>> --- a/doc/mercury_user_guide.texi<br>> +++ b/doc/mercury_user_guide.texi<br>> @@ -2330,20 +2334,96 @@ Mercury's first step<br>>  towards avoiding circular dependencies between @file{.trans_opt} files<br>>  is to impose an order on the modules of the program<br>>  when the @command{mmc --generate-dependencies} command is executed for it.<br>> -This order is recorded in the @file{.dv}<br>> -The second step is to ensure that<br>> -a @file{.trans_opt} file can only ever depend on<br>> -@file{.trans_opt} files that @emph{follow} it in the order,<br>> -never ones that @emph{precede} it.<br>> +(One reason, though not the only one,<br>> +why @command{mmc --make} does not support @file{.trans_opt} files is that<br>> +it neither has nor needs a @command{mmc --generate-dependencies} step.)<br><br>That doesn't seem a very strong reason, presuambly *if* mmc --make were<br>modified to support transitive intermodule-optimization, we would modify<br>its internal dependency mechanism to account for that?<br><br>...<br><br>> -mmc --make-transitive-optimization-interface @var{module_1}.m @var{module_2}.m @dots{}<br>> +@command{mmc --generate-dependencies --also-output-module-order prog.m}.<br>> +@end example<br>> +<br>> +After this command, @file{prog.module_order} will contain<br>> +the strongly connected components (SCCs)<br>> +of the module dependency graph of the program in a top-down order,<br>> +with different SCCs separated by blank lines,<br>> +and with the different modules in each SCC being listed<br>> +one per line with no blank lines between them.<br><br>I would break that up into separate sentences, the second beginning<br>with: "The graph will be in a top-down order ..."<br><br>> +The order of the modules of the program<br>> +is exactly the order in which appear in this file.<br>> +<br>> +@c JUNK<br>> +@c The compiler does this when making dependencies for <br>> +@c This order is recorded in the @file{.d}<br>> +@c The second step is to ensure that<br>> +@c a @file{.trans_opt} file can only ever depend on<br>> +@c @file{.trans_opt} files that @emph{follow} it in the order,<br>> +@c never ones that @emph{precede} it.<br>> +<br>> +To actually construct the @file{.trans_opt} files for e.g.@:<br>> +@file{@var{module_1}.m} and @file{@var{module_2}.m},<br>> +use a command such as<br>> +<br>> +@example<br>> +mmc --make-transitive-optimization-interface --analyse-exceptions @var{module_1}.m @var{module_2}.m<br>>  @end example<br>>  @findex --make-transitive-optimization-interface<br>>  @findex --make-trans-opt<br>>  <br>> +Beside @option{--analyse-exceptions},<br>> +the following options also record their results in @file{.trans_opt} files.<br>> +@itemize @option<br>> +@c @item @option{--analyse-closures}, and<br><br>The analysis carried out by --analyse-closures is within a module only.<br>Its results are not placed in .opt or .trans_opt files.<br><br>> +@item --enable-termination<br>> +This option turns on Mercury's first termination analyser,<br>> +which uses linear inequalities.<br>> +@item --enable-termination2<br>> +This option turns on Mercury's second termination analyser,<br>> +which uses convex constraints.<br>> +@item --analyse-trail-usage and<br>> +This option turns on an analysis<br>> +that reports which predicates and functions<br><br>What do you mean by "reports"? The analysis determines which<br>predicates and functions do not touch the trail, but it doesn't<br>report them, except to the rest of the compiler. <br><br>> +definitely do not touch the trail,<br>> +enabling the compiler to reduce the overhead of trailing.<br>> +(This analysis is applicable only in trailing grades.)<br>> +@item --analyse-mm-tabling<br>> +This option turns on an analysis<br>> +that reports which predicates and functions have call trees<br><br>Similarly.<br><br>> +that do not involve mininal model tabled procedures at all,<br><br>s/mininal/minimal/<br><br>> +enabling the compiler to reduce the overhead of minimal model tabling.<br>> +(This analysis is applicable only in minimal model grades.)<br>> +@end itemize<br>> +<br>> +The results of both termination analysis systems<br>> +can be used by the user to spot potential performance problems.<br>> +(That performance problem @emph{may} be non-termination,<br>> +but the analyser's inability to prove termination<br>> +may also be caused by less drastic performance problems.)<br><br>I suggest: s/caused by/indicative of/<br><br>> +The compiler can also perform more optimizations on calls<br>> +for which it knows that the called predicate and function always terminates.<br>> +<br>> +After @file{.trans_opt} files containing such analysis results<br><br>Delete "such".<br><br>> +have been created,<br>> +any invocation of @command{mmc} to compile say @var{module_3}<br>> +with the @code{--transitive-intermodule-optimization} option<br>> +(or @code{--trans-intermod-opt} for short),<br><br>Delete the parenthised bit; there's no point cluttering the text<br>up by reminding readers of what abbreviations exist for options.)<br><br>The rest looks fine.<br><br>Julien.<br></div></div></div>