0001
0002
0003
0004
0005
0006
0007 BEGIN {
0008 print "/*"
0009 print " * Generated by gen-insn-x86-dat.sh and gen-insn-x86-dat.awk"
0010 print " * from insn-x86-dat-src.c for inclusion by insn-x86.c"
0011 print " * Do not change this code."
0012 print "*/\n"
0013 op = ""
0014 branch = ""
0015 rel = 0
0016 going = 0
0017 }
0018
0019 / Start here / {
0020 going = 1
0021 }
0022
0023 / Stop here / {
0024 going = 0
0025 }
0026
0027 /^\s*[0-9a-fA-F]+\:/ {
0028 if (going) {
0029 colon_pos = index($0, ":")
0030 useful_line = substr($0, colon_pos + 1)
0031 first_pos = match(useful_line, "[0-9a-fA-F]")
0032 useful_line = substr(useful_line, first_pos)
0033 gsub("\t", "\\t", useful_line)
0034 printf "{{"
0035 len = 0
0036 for (i = 2; i <= NF; i++) {
0037 if (match($i, "^[0-9a-fA-F][0-9a-fA-F]$")) {
0038 printf "0x%s, ", $i
0039 len += 1
0040 } else {
0041 break
0042 }
0043 }
0044 printf "}, %d, %s, \"%s\", \"%s\",", len, rel, op, branch
0045 printf "\n\"%s\",},\n", useful_line
0046 op = ""
0047 branch = ""
0048 rel = 0
0049 }
0050 }
0051
0052 / Expecting: / {
0053 expecting_str = " Expecting: "
0054 expecting_len = length(expecting_str)
0055 expecting_pos = index($0, expecting_str)
0056 useful_line = substr($0, expecting_pos + expecting_len)
0057 for (i = 1; i <= NF; i++) {
0058 if ($i == "Expecting:") {
0059 i++
0060 op = $i
0061 i++
0062 branch = $i
0063 i++
0064 rel = $i
0065 break
0066 }
0067 }
0068 }