2 # gen-insn-x86-dat.awk: script to convert data for the insn-x86 test
3 # Copyright (c) 2015, Intel Corporation.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms and conditions of the GNU General Public License,
7 # version 2, as published by the Free Software Foundation.
9 # This program is distributed in the hope it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 print " * Generated by gen-insn-x86-dat.sh and gen-insn-x86-dat.awk"
17 print " * from insn-x86-dat-src.c for inclusion by insn-x86.c"
18 print " * Do not change this code."
34 /^\s
*[0-9a
-fA
-F
]+\
:/ {
36 colon_pos =
index($
0, ":")
37 useful_line =
substr($
0, colon_pos
+ 1)
38 first_pos =
match(useful_line
, "[0-9a-fA-F]")
39 useful_line =
substr(useful_line
, first_pos
)
40 gsub("\t", "\\t", useful_line
)
43 for (i =
2; i
<=
NF; i
++) {
44 if (match($i
, "^[0-9a-fA-F][0-9a-fA-F]$")) {
51 printf "}, %d, %s, \"%s\", \"%s\",", len
, rel
, op
, branch
52 printf "\n\"%s\",},\n", useful_line
60 expecting_str =
" Expecting: "
61 expecting_len =
length(expecting_str
)
62 expecting_pos =
index($
0, expecting_str
)
63 useful_line =
substr($
0, expecting_pos
+ expecting_len
)
64 for (i =
1; i
<=
NF; i
++) {
65 if ($i ==
"Expecting:") {