Commit | Line | Data |
---|---|---|
9aab5aa3 AC |
1 | ; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*- |
2 | ; | |
9b201bb5 | 3 | ; Copyright 2000, 2007 Free Software Foundation, Inc. |
9aab5aa3 AC |
4 | ; |
5 | ; Contributed by Red Hat Inc. | |
6 | ; | |
7 | ; This file is part of the GNU Binutils. | |
8 | ; | |
9 | ; This program is free software; you can redistribute it and/or modify | |
10 | ; it under the terms of the GNU General Public License as published by | |
9b201bb5 | 11 | ; the Free Software Foundation; either version 3 of the License, or |
9aab5aa3 AC |
12 | ; (at your option) any later version. |
13 | ; | |
14 | ; This program is distributed in the hope that it will be useful, | |
15 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ; GNU General Public License for more details. | |
18 | ; | |
19 | ; You should have received a copy of the GNU General Public License | |
20 | ; along with this program; if not, write to the Free Software | |
9b201bb5 NC |
21 | ; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
22 | ; MA 02110-1301, USA. | |
9aab5aa3 AC |
23 | \f |
24 | ; Enums. | |
25 | ||
26 | ; Define a normal enum without using name/value pairs. | |
27 | ; This is currently the same as define-full-enum but it needn't remain | |
28 | ; that way (it's define-full-enum that would change). | |
29 | ||
30 | (define-pmacro (define-normal-enum name comment attrs prefix vals) | |
31 | "\ | |
32 | Define a normal enum, fixed number of arguments. | |
33 | " | |
34 | (define-full-enum name comment attrs prefix vals) | |
35 | ) | |
36 | ||
37 | ; Define a normal insn enum. | |
38 | ||
39 | (define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals) | |
40 | "\ | |
41 | Define a normal instruction opcode enum. | |
42 | " | |
43 | (define-full-insn-enum name comment attrs prefix fld vals) | |
44 | ) | |
45 | \f | |
46 | ; Instruction fields. | |
47 | ||
48 | ; Normally, fields are unsigned have no encode/decode needs. | |
49 | ||
50 | (define-pmacro (define-normal-ifield name comment attrs start length) | |
51 | "Define a normal instruction field.\n" | |
52 | (define-full-ifield name comment attrs start length UINT #f #f) | |
53 | ) | |
54 | ||
55 | ; For those who don't like typing. | |
56 | ||
57 | (define-pmacro df | |
58 | "Shorthand form of define-full-ifield.\n" | |
59 | define-full-ifield | |
60 | ) | |
61 | (define-pmacro dnf | |
62 | "Shorthand form of define-normal-ifield.\n" | |
63 | define-normal-ifield | |
64 | ) | |
65 | ||
66 | ; Define a normal multi-ifield. | |
67 | ; FIXME: The define-normal version for ifields doesn't include the mode. | |
68 | ||
69 | (define-pmacro (define-normal-multi-ifield name comment attrs | |
70 | mode subflds insert extract) | |
71 | "Define a normal multi-part instruction field.\n" | |
72 | (define-full-multi-ifield name comment attrs mode subflds insert extract) | |
73 | ) | |
74 | ||
75 | ; For those who don't like typing. | |
76 | ||
77 | (define-pmacro dnmf | |
78 | "Shorthand form of define-normal-multi-ifield.\n" | |
79 | define-normal-multi-ifield | |
80 | ) | |
81 | ||
82 | ; Simple multi-ifields: mode is UINT, default insert/extract support. | |
83 | ||
84 | (define-pmacro (dsmf name comment attrs subflds) | |
85 | "Define a simple multi-part instruction field.\n" | |
86 | (define-full-multi-ifield name comment attrs UINT subflds #f #f) | |
87 | ) | |
88 | \f | |
89 | ; Hardware. | |
90 | ||
91 | ; Simpler version for most hardware elements. | |
92 | ; Allow special assembler support specification but no semantic-name or | |
93 | ; get/set specs. | |
94 | ||
95 | (define-pmacro (define-normal-hardware name comment attrs type | |
96 | indices values handlers) | |
97 | "\ | |
98 | Define a normal hardware element. | |
99 | " | |
100 | (define-full-hardware name comment attrs name type | |
101 | indices values handlers () () ()) | |
102 | ) | |
103 | ||
104 | ; For those who don't like typing. | |
105 | ||
106 | (define-pmacro dnh | |
107 | "Shorthand form of define-normal-hardware.\n" | |
108 | define-normal-hardware | |
109 | ) | |
110 | ||
111 | ; Simpler version of dnh that leaves out the indices, values, handlers, | |
112 | ; get, set, and layout specs. | |
113 | ; This is useful for 1 bit registers. | |
114 | ; ??? While dsh and dnh aren't that distinguishable when perusing a .cpu file, | |
115 | ; they both take a fixed number of positional arguments, and dsh is a proper | |
116 | ; subset of dnh with all arguments in the same positions, so methinks things | |
117 | ; are ok. | |
118 | ||
119 | (define-pmacro (define-simple-hardware name comment attrs type) | |
120 | "\ | |
121 | Define a simple hardware element (usually a scalar register). | |
122 | " | |
123 | (define-full-hardware name comment attrs name type () () () () () ()) | |
124 | ) | |
125 | ||
126 | (define-pmacro dsh | |
127 | "Shorthand form of define-simple-hardware.\n" | |
128 | define-simple-hardware | |
129 | ) | |
130 | \f | |
131 | ; Operands. | |
132 | ||
133 | (define-pmacro (define-normal-operand name comment attrs type index) | |
134 | "Define a normal operand.\n" | |
135 | (define-full-operand name comment attrs type DFLT index () () ()) | |
136 | ) | |
137 | ||
138 | ; For those who don't like typing. | |
139 | ; FIXME: dno? | |
140 | ||
141 | (define-pmacro dnop | |
142 | "Shorthand form of define-normal-operand.\n" | |
143 | define-normal-operand | |
144 | ) | |
145 | ||
146 | (define-pmacro (dndo x-name x-mode x-args | |
147 | x-syntax x-base-ifield x-encoding x-ifield-assertion | |
148 | x-getter x-setter) | |
149 | "Define a normal derived operand." | |
150 | (define-derived-operand | |
151 | (name x-name) | |
152 | (mode x-mode) | |
153 | (args x-args) | |
154 | (syntax x-syntax) | |
155 | (base-ifield x-base-ifield) | |
156 | (encoding x-encoding) | |
157 | (ifield-assertion x-ifield-assertion) | |
158 | (getter x-getter) | |
159 | (setter x-setter) | |
160 | ) | |
161 | ) | |
162 | \f | |
163 | ; Instructions. | |
164 | ||
165 | ; Define an instruction object, normal version. | |
166 | ; At present all fields must be specified. | |
167 | ; Fields ifield-assertion is absent. | |
168 | ||
169 | (define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing) | |
170 | "Define a normal instruction.\n" | |
171 | (define-full-insn name comment attrs syntax fmt () semantics timing) | |
172 | ) | |
173 | ||
174 | ; To reduce the amount of typing. | |
175 | ; Note that this is the same name as the D'ni in MYST. Oooohhhh..... | |
176 | ; this must be the right way to go. :-) | |
177 | ||
178 | (define-pmacro dni | |
179 | "Shorthand form of define-normal-insn.\n" | |
180 | define-normal-insn | |
181 | ) | |
182 | \f | |
183 | ; Macro instructions. | |
184 | ||
185 | ; Define a macro-insn object, normal version. | |
186 | ; This only supports expanding to one real insn. | |
187 | ||
188 | (define-pmacro (define-normal-macro-insn name comment attrs syntax expansion) | |
189 | "Define a normal macro instruction.\n" | |
190 | (define-full-minsn name comment attrs syntax expansion) | |
191 | ) | |
192 | ||
193 | ; To reduce the amount of typing. | |
194 | ||
195 | (define-pmacro dnmi | |
196 | "Shorthand form of define-normal-macro-insn.\n" | |
197 | define-normal-macro-insn | |
198 | ) | |
199 | \f | |
200 | ; Modes. | |
201 | ; ??? Not currently available for use. | |
202 | ; | |
203 | ; Define Normal Mode | |
204 | ; | |
205 | ;(define-pmacro (define-normal-mode name comment attrs bits bytes | |
206 | ; non-mode-c-type printf-type sem-mode ptr-to host?) | |
207 | ; "Define a normal mode.\n" | |
208 | ; (define-full-mode name comment attrs bits bytes | |
209 | ; non-mode-c-type printf-type sem-mode ptr-to host?) | |
210 | ;) | |
211 | ; | |
212 | ; For those who don't like typing. | |
213 | ;(define-pmacro dnm | |
214 | ; "Shorthand form of define-normal-mode.\n" | |
215 | ; define-normal-mode | |
216 | ;) |