summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-07-25 01:10:17 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-07-25 01:10:17 +0400
commit79699d8edae5e56df5c35be151b7fc1f436c1ed9 (patch)
tree7e709850d8ff739f3bdf89996884f17a90767df9
parentb8e699fb3d5e61f3e64fceb8632aac64886ea1cf (diff)
downloadnasm-79699d8edae5e56df5c35be151b7fc1f436c1ed9.tar.gz
regs.pl: Introduce is_register() helper
Instead of opencoded check use inline helper. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rwxr-xr-xregs.pl7
1 files changed, 7 insertions, 0 deletions
diff --git a/regs.pl b/regs.pl
index 82c48295..e6350f92 100755
--- a/regs.pl
+++ b/regs.pl
@@ -134,6 +134,13 @@ if ( $fmt eq 'h' ) {
foreach $reg ( sort(keys(%regs)) ) {
printf "#define %-15s %2d\n", "REG_NUM_\U${reg}", $regvals{$reg};
}
+
+ print "\n";
+ print "static inline int is_register(int reg)\n";
+ print "{\n";
+ print " return reg >= EXPR_REG_START && reg < REG_ENUM_LIMIT;\n";
+ print "}\n";
+
print "\n\n#endif /* NASM_REGS_H */\n";
} elsif ( $fmt eq 'c' ) {
# Output regs.c