diff options
author | Alex Bennée <alex@bennee.com> | 2013-12-02 12:27:46 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-04-25 13:19:58 +0100 |
commit | fbdaf029aa2a16e23d11a4f71b481c06cf0b8000 (patch) | |
tree | 7e317f92642d22666feeb77c012161759ac0d143 /risugen | |
parent | 98768b9eed5902039b140819c98d49c92caa06f9 (diff) |
risugen: add --not-pattern flag for convenience
The --pattern flag is useful for including whole classes of instructions.
You could also do specific instruction with it. However if you want a
whole class of instructions without a specific few instructions you'd
need to come up with a more complex regex.
With this you can for example to:
risugen --pattern ".* A64" --not-pattern "ROR.*" aarch64.risu test3.bin
Diffstat (limited to 'risugen')
-rwxr-xr-x | risugen | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -38,7 +38,8 @@ my $is_aarch64 = 0; # are we in aarch64 mode? my $is_thumb = 0; # are we currently in Thumb mode? my $test_thumb = 0; # should test code be Thumb mode? -my @pattern_re = (); +my @pattern_re = (); # include pattern +my @not_pattern_re = (); # exclude pattern my $bytecount; @@ -947,6 +948,11 @@ sub write_test_code($$$$) my $re = '\b((' . join(')|(',@pattern_re) . '))\b'; @keys = grep /$re/, @keys; } + # exclude any specifics + if (@not_pattern_re) { + my $re = '\b((' . join(')|(',@not_pattern_re) . '))\b'; + @keys = grep !/$re/, @keys; + } if (!@keys) { print STDERR "No instruction patterns available! (bad config file or --pattern argument?)\n"; exit(1); @@ -1214,7 +1220,11 @@ 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. - --no-fp : disable floating point: no fp init, randomization etc. + --not-pattern re[,re...] : exclude patterns matching regular expression. + These RE's are applied after the matching pattern which + is useful if you want to exclude a specific instruction from + a general set you have excluded. + --no-fp : disable floating point: no fp init, randomization etc. Useful to test before support for FP is available. --help : print this message EOT @@ -1232,7 +1242,8 @@ sub main() "numinsns=i" => \$numinsns, "fpscr=o" => \$fpscr, "pattern=s" => \@pattern_re, - "condprob=f" => sub { + "not-pattern=s" => \@not_pattern_re, + "condprob=f" => sub { $condprob = $_[1]; if ($condprob < 0.0 || $condprob > 1.0) { die "Value \"$condprob\" invalid for option condprob (must be between 0 and 1)\n"; @@ -1242,6 +1253,7 @@ sub main() ) or return 1; # allow "--pattern re,re" and "--pattern re --pattern re" @pattern_re = split(/,/,join(',',@pattern_re)); + @not_pattern_re = split(/,/,join(',',@not_pattern_re)); if ($#ARGV != 1) { usage(); |