[PATCH risu] Add "--not-group" option to exclude groups of instructions.

Jun Sun posted 1 patch 12 months ago
Failed in applying to current master (apply log)
risugen | 10 ++++++++++
1 file changed, 10 insertions(+)
[PATCH risu] Add "--not-group" option to exclude groups of instructions.
Posted by Jun Sun 12 months ago
This mirrors the "--not-pattern" option and gives complete control over
group-based
instruction selection rules.

Signed-off-by: Jun Sun <jsun@junsun.net>
---
 risugen | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/risugen b/risugen
index f88c22a..f441f06 100755
--- a/risugen
+++ b/risugen
@@ -39,6 +39,7 @@ my $arch = "";
 my @insn_groups;

 my @groups = ();                # include groups
+my @not_groups = ();            # exclude groups
 my @pattern_re = ();            # include pattern
 my @not_pattern_re = ();        # exclude pattern

@@ -272,6 +273,12 @@ sub select_insn_keys ()
         my $re = '\b((' . join(')|(',@pattern_re) . '))\b';
         @insn_keys = grep /$re/, @insn_keys;
     }
+    if (@not_groups) {
+        @insn_keys = grep {
+            defined($insn_details{$_}->{groups}) &&
+                0 == scalar(get_intersection([$insn_details{$_}->{groups},
\@not_groups]))
+        } @insn_keys
+    }
     # exclude any specifics
     if (@not_pattern_re) {
         my $re = '\b((' . join(')|(',@not_pattern_re) . '))\b';
@@ -303,6 +310,7 @@ Valid options:
                    the perl regex '\\b((re)|(re))\\b'). This means that
                    'VMULL' will match 'VMULL A1' and 'VMULL A2' but not
                    'VMULL_scalar A1'. This is generally what you wanted.
+    --not-group name[,name..]: exclude instructions in the specified groups
     --not-pattern re[,re...] : exclude patterns matching regular
expression.
                    These REs are applied after the matching pattern which
                    is useful if you want to exclude a specific instruction
from
@@ -331,6 +339,7 @@ sub main()
                 "randseed=i" => \$randseed,
                 "fpscr=o" => \$fpscr,
                 "group=s" => \@groups,
+                "not-group=s" => \@not_groups,
                 "pattern=s" => \@pattern_re,
                 "not-pattern=s" => \@not_pattern_re,
                 "condprob=f" => sub {
@@ -347,6 +356,7 @@ sub main()
     @pattern_re = split(/,/,join(',',@pattern_re));
     @not_pattern_re = split(/,/,join(',',@not_pattern_re));
     @groups = split(/,/,join(',',@groups));
+    @not_groups = split(/,/,join(',',@not_groups));

     if ($#ARGV != 1) {
         usage();
-- 
2.34.1