[m-rev.] for review: factor out common code in const_prop.m
Peter Wang
novalazy at gmail.com
Fri Dec 9 15:02:37 AEDT 2022
On Thu, 08 Dec 2022 20:27:16 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> The new code in const_prop.m is the test case for the fix
> to string trie switches in my last diff. Since it requires that fix,
> I will commit it only after that fix is in an rotd.
>
> For review by anyone.
>
> Zoltan.
> Factor out common code in const_prop.m.
>
> compiler/const_prop.m:
> As above.
>
> Handle / in both int.m and uint.m the same way as //, since / is a
> synonym of // in both modules.
>
> Also, handle the compile-time evaluation of plus, minus, and
> unchecked_quotient in uint.m. Previusly, we only evaluated
> their synonyms +, -, * and //.
>
> configure.ac:
> Require the installed compiler to contain the fix for a bug that
> prevents compilation of the new code of const_prop.m in hlc grades.
The change to configure.ac wasn't included but I assume it's correct.
> diff --git a/compiler/const_prop.m b/compiler/const_prop.m
> index ae64acaae..8e75adac4 100644
> --- a/compiler/const_prop.m
> +++ b/compiler/const_prop.m
> @@ -381,67 +381,53 @@ evaluate_det_call_int_3_mode_0(Globals, ProcName, X, Y, Z,
> %
> % For the unchecked operations, we do this because there is no point
> % in trying to optimize operations that *will* return a nonsense result,
> - % this creating a landmine that will go off sometime later in the
> + % thus creating a landmine that will go off sometime later in the
> % program's execution (unless if user is unlucky, and he/she just
> % silently gets nonsense output).
> (
> FunctorY = some_int_const(int_const(YVal)),
> (
> - ProcName = "plus",
> + ( ProcName = "+" ; ProcName = "plus"
> + ; ProcName = "-" ; ProcName = "minus"
> + ; ProcName = "*" ; ProcName = "times"
> + ; ProcName = "//" ; ProcName = "/"
> + ; ProcName = "unchecked_quotient"
> + ; ProcName = "mod"
> + ; ProcName = "rem" ; ProcName = "unchecked_rem"
> + ; ProcName = "<<" ; ProcName = "unchecked_left_shift"
> + ; ProcName = ">>" ; ProcName = "unchecked_right_shift"
> + ),
> globals.lookup_bool_option(Globals, pregenerated_dist, no),
> int_emu.target_bits_per_int(Globals, BitsPerInt),
> + require_complete_switch [ProcName]
> + (
> + ( ProcName = "+"; ProcName = "plus" ),
Space before semicolon.
That's fine.
Peter
More information about the reviews
mailing list