On Sun, 26 May 2024 at 20:38, Richard Henderson
<richard.hender...@linaro.org> wrote:
>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> ---
>  risugen            |  10 +-
>  risugen_common.pm  |  50 +++++-
>  risugen_sparc64.pm | 385 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 443 insertions(+), 2 deletions(-)
>  create mode 100644 risugen_sparc64.pm

I'm not super-enthusiastic about making running risugen now
require an appropriate cross-toolchain for the target.
Since almost all of what risugen is doing is "write
these exact values to the test binary" we don't really
need an assembler to do that.

At any rate, an explanation in the commit message of the
advantages of doing it this way would be helpful in
deciding, I think.

> +sub open_asm($)
> +{
> +    my ($basename) = @_;
> +    my $fname = $basename . ".s";
> +    open(ASM, ">", $fname) or die "can't open $fname: $!";
> +    select ASM;

I think that using Perl select like this is liable to be
rather confusing, because it has "action at a distance"
effects on every other print statement. I would prefer it
if we passed in the filehandle to the print statements
explicitly. (We can use a global if handing the filehandle
around to all the functions is annoying.)

> +}
> +

> +sub gen_one_insn($)

(One day we should see if we can move most of gen_one_insn and
write_test_code to common code, because an awful lot of these
functions is identical across architectures. But that day
doesn't need to be today :-))

-- PMM

Reply via email to