Allow integer immediates for AArch64 fmov instructions.
[deliverable/binutils-gdb.git] / gdb / regformats / regdat.sh
CommitLineData
3cf384d4
DJ
1#!/bin/sh -u
2
3# Register protocol definitions for GDB, the GNU debugger.
e2882c85 4# Copyright (C) 2001-2018 Free Software Foundation, Inc.
3cf384d4
DJ
5#
6# This file is part of GDB.
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
50efebf8 10# the Free Software Foundation; either version 3 of the License, or
3cf384d4
DJ
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
50efebf8 19# along with this program. If not, see <http://www.gnu.org/licenses/>.
3cf384d4 20
3cf384d4
DJ
21# Format of the input files
22read="type entry"
23
24do_read ()
25{
26 type=""
27 entry=""
28 while read line
29 do
30 if test "${line}" = ""
31 then
32 continue
33 elif test "${line}" = "#" -a "${comment}" = ""
34 then
35 continue
36 elif expr "${line}" : "#" > /dev/null
37 then
38 comment="${comment}
39${line}"
40 else
41
42 # The semantics of IFS varies between different SH's. Some
43 # treat ``::' as three fields while some treat it as just too.
44 # Work around this by eliminating ``::'' ....
45 line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
46
47 OFS="${IFS}" ; IFS="[:]"
48 eval read ${read} <<EOF
49${line}
50EOF
51 IFS="${OFS}"
52
53 # .... and then going back through each field and strip out those
54 # that ended up with just that space character.
55 for r in ${read}
56 do
57 if eval test \"\${${r}}\" = \"\ \"
58 then
59 eval ${r}=""
60 fi
61 done
62
63 break
64 fi
65 done
66 if [ -n "${type}" ]
67 then
68 true
69 else
70 false
71 fi
72}
73
74if test ! -r $1; then
75 echo "$0: Could not open $1." 1>&2
76 exit 1
77fi
78
79copyright ()
80{
81cat <<EOF
82/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
83
84/* A register protocol for GDB, the GNU debugger.
0b1afbb3 85 Copyright (C) 2001-2013 Free Software Foundation, Inc.
3cf384d4
DJ
86
87 This file is part of GDB.
88
89 This program is free software; you can redistribute it and/or modify
90 it under the terms of the GNU General Public License as published by
dcf7800b 91 the Free Software Foundation; either version 3 of the License, or
3cf384d4
DJ
92 (at your option) any later version.
93
94 This program is distributed in the hope that it will be useful,
95 but WITHOUT ANY WARRANTY; without even the implied warranty of
96 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97 GNU General Public License for more details.
98
99 You should have received a copy of the GNU General Public License
dcf7800b 100 along with this program. If not, see <http://www.gnu.org/licenses/>. */
3cf384d4
DJ
101
102/* This file was created with the aid of \`\`regdat.sh'' and \`\`$1''. */
103
104EOF
105}
106
107
108exec > new-$2
109copyright $1
219f2f23 110echo '#include "server.h"'
3cf384d4 111echo '#include "regdef.h"'
3aee8918 112echo '#include "tdesc.h"'
3cf384d4
DJ
113echo
114offset=0
115i=0
116name=x
9b4b61c8 117xmltarget=x
08d16641
PA
118xmlarch=x
119xmlosabi=x
3cf384d4 120expedite=x
ad7fc756 121feature=x
3cf384d4
DJ
122exec < $1
123while do_read
124do
125 if test "${type}" = "name"; then
126 name="${entry}"
c9a5e2a5
YQ
127
128 echo "const struct target_desc *tdesc_${name};"
129 echo ""
130 echo "void"
131 echo "init_registers_${name} (void)"
132 echo "{"
133 echo " static struct target_desc tdesc_${name}_s;"
134 echo " struct target_desc *result = &tdesc_${name}_s;"
82ec9bc7 135 echo " struct tdesc_feature *feature = tdesc_create_feature (result, \"${name}\");"
3cf384d4 136 continue
9b4b61c8
UW
137 elif test "${type}" = "xmltarget"; then
138 xmltarget="${entry}"
139 continue
140 elif test "${type}" = "xmlarch"; then
08d16641
PA
141 xmlarch="${entry}"
142 continue
143 elif test "${type}" = "osabi"; then
144 xmlosabi="${entry}"
9b4b61c8 145 continue
3cf384d4
DJ
146 elif test "${type}" = "expedite"; then
147 expedite="${entry}"
148 continue
ad7fc756
AH
149 elif test "${type}" = "feature"; then
150 feature="${entry}"
151 continue
3cf384d4
DJ
152 elif test "${name}" = x; then
153 echo "$0: $1 does not specify \`\`name''." 1>&2
154 exit 1
155 else
82ec9bc7 156 echo " tdesc_create_reg (feature, \"${entry}\","
f49ff000
YQ
157 echo " 0, 0, NULL, ${type}, NULL);"
158
3cf384d4
DJ
159 offset=`expr ${offset} + ${type}`
160 i=`expr $i + 1`
161 fi
162done
163
3cf384d4 164echo
3aee8918 165echo "static const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
e98577a9
AH
166if test "${feature}" != x; then
167 echo "static const char *xmltarget_${name} = 0;"
168elif test "${xmltarget}" = x; then
08d16641 169 if test "${xmlarch}" = x && test "${xmlosabi}" = x; then
3aee8918 170 echo "static const char *xmltarget_${name} = 0;"
08d16641 171 else
3aee8918 172 echo "static const char *xmltarget_${name} = \"@<target>\\"
08d16641
PA
173 if test "${xmlarch}" != x; then
174 echo "<architecture>${xmlarch}</architecture>\\"
175 fi
176 if test "${xmlosabi}" != x; then
177 echo "<osabi>${xmlosabi}</osabi>\\"
178 fi
179 echo "</target>\";"
180 fi
9b4b61c8 181else
3aee8918 182 echo "static const char *xmltarget_${name} = \"${xmltarget}\";"
9b4b61c8 183fi
0a30fbc4
DJ
184echo
185
186cat <<EOF
adc764e7 187#ifndef IN_PROCESS_AGENT
3aee8918 188 result->xmltarget = xmltarget_${name};
adc764e7 189#endif
3aee8918 190
190852c8 191 init_target_desc (result, expedite_regs_${name});
3aee8918
PA
192
193 tdesc_${name} = result;
0a30fbc4
DJ
194}
195EOF
3cf384d4
DJ
196
197# close things off
198exec 1>&2
bdf61915 199mv -- "new-$2" "$2"
This page took 1.450575 seconds and 4 git commands to generate.