]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Update s390-check-opcodes.pl
authorFlorian Krohm <flo2030@eich-krohm.de>
Thu, 15 Jan 2026 20:16:08 +0000 (20:16 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Thu, 15 Jan 2026 20:16:08 +0000 (20:16 +0000)
Remove the --check-formats option. The specialisation of opcode names in
<binutils>/opcode/s390_opc.txt is no longer interesting as we do not need
to distinguish whether a register number in an opcode denotes a GPR od FPR
or whatever.
Instead it is better to use those opcode format names as shown in the
Principles of Ops wherever possible. Simplifies proofreading.

auxprogs/s390-check-opcodes.pl

index 4e0d2c6ac188071dfeb411d28afe2ddb1e876dab..0feec276e57901de3b45f370b4dfc03a6b022bf5 100755 (executable)
@@ -2,7 +2,6 @@
 
 use strict;
 use warnings;
-use Getopt::Long;
 
 #------------------------------------------------------------------
 # This script assists in updating s390-opcodes.csv
@@ -16,17 +15,15 @@ use Getopt::Long;
 my $csv_file;
 my $opc_file;
 my $toir_file;
-my $check_formats = 0;
-my $usage = "usage: s390-check-opcodes [--check-formats] s390-opcodes.csv "
+my $usage = "usage: s390-check-opcodes s390-opcodes.csv "
           . "s390-opc.txt guest_s390_toIR.c\n";
 
-GetOptions("check-formats" => \$check_formats) || die $usage;
-
 my $num_arg = $#ARGV + 1;
 
 if ($num_arg == 0) {
     my $cwd = `pwd`;
     my ($basedir) = $cwd =~ m|(.*)/valgrind/|;
+    die $usage if (! defined $basedir);
     $csv_file  = "$basedir/valgrind/docs/internals/s390-opcodes.csv";
     $opc_file  = "$basedir/binutils-gdb/opcodes/s390-opc.txt";
     $toir_file = "$basedir/valgrind/VEX/priv/guest_s390_toIR.c";
@@ -39,12 +36,10 @@ if ($num_arg == 0) {
 }
 
 my %opc_desc = ();
-my %opc_format = ();
 my %csv_desc = ();
 my %csv_implemented = ();
 my %toir_implemented = ();
 my %toir_decoded = ();
-my %toir_format = ();
 my %known_arch = map {($_ => 1)}
     qw(g5 z900 z990 z9-109 z9-ec z10 z196 zEC12 z13 arch12 arch13 arch14 arch15);
 
@@ -261,9 +256,6 @@ while (my $line = <OPC>) {
        $opc_desc{$mnemonic} = $description;
     }
 
-    if (! exists $opc_format{$mnemonic}) {
-        $opc_format{$mnemonic} = $format;
-    }
     if ($description =~ /,/) {
        print "warning: description of $mnemonic contains comma\n";
     }
@@ -325,9 +317,6 @@ while (my $line = <TOIR>) {
        my $mnemonic = lc $1;
        $toir_implemented{$mnemonic} = 1;
     }
-    if ($line =~ /^..*s390_format_([A-Z_]+)[ ]*\([ ]*s390_irgen_([A-Z]+)/) {
-        $toir_format{lc $2} = $1;
-    }
 }
 close(TOIR);
 
@@ -385,22 +374,5 @@ foreach my $opc (keys %opc_desc) {
     }
 }
 
-#----------------------------------------------------
-# 5) Cross-check opcode formats
-#----------------------------------------------------
-if ($check_formats) {
-    foreach my $opc (keys %toir_format) {
-        if (! exists $opc_format{$opc}) {
-            print "*** format $toir_format{$opc} does not exist in s390-opc.txt\n";
-        } else {
-            if ($opc_format{$opc} ne $toir_format{$opc}) {
-                print "*** format for opcode $opc differs:\n";
-                print "    binutils:    $opc_format{$opc}\n";
-                print "    toIR:        $toir_format{$opc}\n";
-            }
-        }
-    }
-}
-
 print "there are " . int(keys %toir_implemented) . " implemented opcodes\n";
 exit 0