1 ; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*-
3 ; Copyright 2000, 2007 Free Software Foundation, Inc.
5 ; Contributed by Red Hat Inc.
7 ; This file is part of the GNU Binutils.
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
11 ; the Free Software Foundation; either version 3 of the License, or
12 ; (at your option) any later version.
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.
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
21 ; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
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).
30 (define-pmacro (define-normal-enum name comment attrs prefix vals)
32 Define a normal enum, fixed number of arguments.
34 (define-full-enum name comment attrs prefix vals)
37 ; Define a normal insn enum.
39 (define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals)
41 Define a normal instruction opcode enum.
43 (define-full-insn-enum name comment attrs prefix fld vals)
48 ; Normally, fields are unsigned have no encode/decode needs.
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)
55 ; For those who don't like typing.
58 "Shorthand form of define-full-ifield.\n"
62 "Shorthand form of define-normal-ifield.\n"
66 ; Define a normal multi-ifield.
67 ; FIXME: The define-normal version for ifields doesn't include the mode.
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)
75 ; For those who don't like typing.
78 "Shorthand form of define-normal-multi-ifield.\n"
79 define-normal-multi-ifield
82 ; Simple multi-ifields: mode is UINT, default insert/extract support.
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)
91 ; Simpler version for most hardware elements.
92 ; Allow special assembler support specification but no semantic-name or
95 (define-pmacro (define-normal-hardware name comment attrs type
96 indices values handlers)
98 Define a normal hardware element.
100 (define-full-hardware name comment attrs name type
101 indices values handlers () () ())
104 ; For those who don't like typing.
107 "Shorthand form of define-normal-hardware.\n"
108 define-normal-hardware
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
119 (define-pmacro (define-simple-hardware name comment attrs type)
121 Define a simple hardware element (usually a scalar register).
123 (define-full-hardware name comment attrs name type () () () () () ())
127 "Shorthand form of define-simple-hardware.\n"
128 define-simple-hardware
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 () () ())
138 ; For those who don't like typing.
142 "Shorthand form of define-normal-operand.\n"
143 define-normal-operand
146 (define-pmacro (dndo x-name x-mode x-args
147 x-syntax x-base-ifield x-encoding x-ifield-assertion
149 "Define a normal derived operand."
150 (define-derived-operand
155 (base-ifield x-base-ifield)
156 (encoding x-encoding)
157 (ifield-assertion x-ifield-assertion)
165 ; Define an instruction object, normal version.
166 ; At present all fields must be specified.
167 ; Fields ifield-assertion is absent.
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)
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. :-)
179 "Shorthand form of define-normal-insn.\n"
183 ; Macro instructions.
185 ; Define a macro-insn object, normal version.
186 ; This only supports expanding to one real insn.
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)
193 ; To reduce the amount of typing.
196 "Shorthand form of define-normal-macro-insn.\n"
197 define-normal-macro-insn
201 ; ??? Not currently available for use.
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?)
212 ; For those who don't like typing.
214 ; "Shorthand form of define-normal-mode.\n"