commit 6962e1b6402a3598d11c9600e8c2fcd3642c8037
parent b287a2ae09aa7e51261645bc5a1e6584f6531bf3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 24 Sep 2017 17:13:21 +0200
[as] Remove empty fields of instbl.c
These arrays were empty and was really hard to detect that they
were empty.
Diffstat:
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/as/target/x86/gen.awk b/as/target/x86/gen.awk
@@ -40,24 +40,29 @@ END {
print "struct op optab[] = {"
for (i = 0; i < nvar; i++) {
printf "\t{\n" \
- "\t\t.bytes = (char []) {%s},\n"\
"\t\t.size = %d,\n"\
- "\t\t.format = %s,\n"\
- "\t\t.args = (char []) {%s}\n"\
- "\t},\n",
- opbytes[i], opsize[i], opformat[i], str2args(opargs[i])
+ "\t\t.format = %s,\n",
+ opsize[i], opformat[i]
+
+ if (opbytes[i] != "")
+ printf "\t\t.bytes = (char []) {%s},\n", opbytes[i]
+
+ a = str2args(opargs[i])
+ if (a != "")
+ printf "\t\t.args = (char []) {%s}\n", a
+
+ print "\t},"
}
print "};"
}
function str2args(s, args, i, out)
{
- split(s, args, /,/)
+ if (split(s, args, /,/) == 0 || args[1] == "none")
+ return ""
for (i in args) {
a = args[i]
- if (a == "none") {
- break
- } else if (match(a, /^imm8/)) {
+ if (match(a, /^imm8/)) {
out = "AIMM8"
} else if (match(a, /^imm16/)) {
out = "AIMM16"