summaryrefslogtreecommitdiff
path: root/regen/regcomp.pl
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2010-12-26 10:30:40 -0700
committerKarl Williamson <public@khwilliamson.com>2011-01-16 16:36:43 -0700
commit5458d9a05ef8545ccbb8a58e670fbede60d10480 (patch)
treedcc68670b938c99b31f92ce57f1f71eeeef75098 /regen/regcomp.pl
parent93136d17f9881a8e1aebaec99f2febb8e56aefa3 (diff)
downloadperl-5458d9a05ef8545ccbb8a58e670fbede60d10480.tar.gz
regcomp.pl: Add capability for fields to be > 1 bit
Currently, it doesn't generate a good dump structure if a field has more than one bit.
Diffstat (limited to 'regen/regcomp.pl')
-rw-r--r--regen/regcomp.pl26
1 files changed, 24 insertions, 2 deletions
diff --git a/regen/regcomp.pl b/regen/regcomp.pl
index 41cbc6eaf9..2a1fb037a4 100644
--- a/regen/regcomp.pl
+++ b/regen/regcomp.pl
@@ -291,10 +291,32 @@ foreach my $file ("op_reg_common.h", "regexp.h") {
my %vrxf=reverse %rxfv;
printf $out "\t/* Bits in extflags defined: %s */\n", unpack 'B*', pack 'N', $val;
for (0..31) {
- my $n=$vrxf{2**$_}||"UNUSED_BIT_$_";
+ my $power_of_2 = 2**$_;
+ my $n=$vrxf{$power_of_2};
+ if (! $n) {
+
+ # Here, there was no name that matched exactly the bit. It could be
+ # either that it is unused, or the name matches multiple bits.
+ if (! ($val & $power_of_2)) {
+ $n = "UNUSED_BIT_$_";
+ }
+ else {
+
+ # Here, must be because it matches multiple bits. Look through
+ # all possibilities until find one that matches this one. Use
+ # that name, and all the bits it matches
+ foreach my $name (keys %rxfv) {
+ if ($rxfv{$name} & $power_of_2) {
+ $n = $name;
+ $power_of_2 = $rxfv{$name};
+ last;
+ }
+ }
+ }
+ }
$n=~s/^RXf_(PMf_)?//;
printf $out qq(\t%-20s/* 0x%08x */\n),
- qq("$n",),2**$_;
+ qq("$n",),$power_of_2;
}
print $out <<EOP;