summaryrefslogtreecommitdiff
path: root/regs.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-12 20:27:41 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-12 20:27:41 -0700
commit16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c (patch)
tree8402b87bfea53a1b9c57069653c3b8f42e0f8b6e /regs.pl
parent7978feebd2fb0be9f4a37980090dfebeeb29a36d (diff)
downloadnasm-16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c.tar.gz
nasm-16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c.tar.bz2
nasm-16b0a33ceae7b57cf4ebc9ab62cd4e1dc00dbf8c.zip
Use enumerations where practical to ease debugging
We have a lot of enumerations; by declaring fields as such, we make it easier when debugging, since the debugger can display the enumerations in cleartext. However, make sure exceptional values (like -1) are included in the enumeration, since the compiler otherwise may not include it in the valid range of the enumeration.
Diffstat (limited to 'regs.pl')
-rwxr-xr-xregs.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/regs.pl b/regs.pl
index be37c7c..c0b2adf 100755
--- a/regs.pl
+++ b/regs.pl
@@ -86,10 +86,14 @@ if ( $fmt eq 'h' ) {
$attach = ' = EXPR_REG_START'; # EXPR_REG_START == 1
foreach $reg ( sort(keys(%regs)) ) {
print " R_\U${reg}\E${attach},\n";
- $attach = ''; $ch = ',';
+ $attach = '';
$expr_regs++;
}
- print " REG_ENUM_LIMIT\n";
+ print " REG_ENUM_LIMIT,\n";
+ # Unfortunately the code uses both 0 and -1 as "no register" in
+ # different places...
+ print " R_zero = 0,\n";
+ print " R_none = -1";
print "};\n\n";
printf "#define EXPR_REG_END %d\n", $expr_regs-1;
foreach $reg ( sort(keys(%regs)) ) {