[m-rev.] for post-commit review: more switch gen simplification

Julien Fischer jfischer at opturion.com
Mon Apr 3 19:37:49 AEST 2023


On Mon, 3 Apr 2023, Zoltan Somogyi wrote:

> Further simplify the management of MLDS switches.
> 
> compiler/ml_switch_gen.m:
>     The code for deciding how to implement switches on strings was
>     a convoluted nest of tests, which tested several different properties
>     of the target language. The flexibility this afforded could have been
>     useful in the past when the MLDS backend targeted MSIL and gcc asm,
>     but with today's three target languages, they are just overkill,
>     especially since several parts of the old code were unreachable.
>     Replace all that code with a simple switch on the target language.
>     Move the switch arm for C into its own predicate in order to reduce
>     the required indentation level.
>
>     Assume that all target languages support switches on (smaller-than-64-bit)
>     integers, because they all do.
>
>     Use Defns, not Decls, to refer to lists of local var definitions.
>
>     Fix an misleading old comment.
> 
> compiler/ml_target_util.m:
>     Delete the code testing whether a target language supports switches on
>     smaller-than-64-bit integers.

That's fine.

Julien.


More information about the reviews mailing list