1 ; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*-
3 ; Copyright 2000, 2007, 2009 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)
31 "Define a normal enum, fixed number of arguments."
32 (define-full-enum name comment attrs prefix vals)
35 ; Define a normal insn enum.
37 (define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals)
38 "Define a normal instruction opcode enum."
39 (define-full-insn-enum name comment attrs prefix fld vals)
44 ; Normally, fields are unsigned and have no encode/decode needs.
46 (define-pmacro (define-normal-ifield name comment attrs start length)
47 "Define a normal instruction field."
48 (define-full-ifield name comment attrs start length UINT #f #f)
51 ; For those who don't like typing.
53 (define-pmacro (df name comment attrs start length mode encode decode)
54 "Shorthand form of normal fields requiring mode, encode/decode."
55 (define-full-ifield name comment attrs start length mode encode decode)
58 "Shorthand form of define-normal-ifield."
62 ; Define a normal multi-ifield.
64 (define-pmacro (define-normal-multi-ifield name comment attrs
65 mode subflds insert extract)
66 "Define a normal multi-part instruction field."
67 (define-full-multi-ifield name comment attrs mode subflds insert extract)
70 ; For those who don't like typing.
73 "Shorthand form of define-normal-multi-ifield."
74 define-normal-multi-ifield
77 ; Simple multi-ifields: mode is UINT, default insert/extract support,
78 ; default encode/decode support.
80 (define-pmacro (dsmf name comment attrs subflds)
81 "Define a simple multi-part instruction field."
82 (define-full-multi-ifield name comment attrs UINT subflds #f #f)
87 ; Simpler version for most hardware elements.
88 ; Allow special assembler support specification but no semantic-name,
89 ; getter/setter, or layout specs.
91 (define-pmacro (define-normal-hardware name comment attrs type
92 indices values handlers)
93 "Define a normal hardware element."
94 (define-full-hardware name comment attrs name type
95 indices values handlers () () ())
98 ; For those who don't like typing.
101 "Shorthand form of define-normal-hardware."
102 define-normal-hardware
105 ; Simpler version of dnh that leaves out the indices, values, handlers,
106 ; getter/setter, and layout specs.
107 ; This is useful for 1 bit registers.
108 ; ??? While dsh and dnh aren't that distinguishable when perusing a .cpu file,
109 ; they both take a fixed number of positional arguments, and dsh is a proper
110 ; subset of dnh with all arguments in the same positions, so methinks things
113 (define-pmacro (define-simple-hardware name comment attrs type)
114 "Define a simple hardware element (usually a scalar register)."
115 (define-full-hardware name comment attrs name type () () () () () ())
119 "Shorthand form of define-simple-hardware."
120 define-simple-hardware
125 ; Simpler version for most operands.
126 ; Allow special assembler support specification but no handlers or
127 ; getter/setter specs.
129 (define-pmacro (define-normal-operand name comment attrs type index)
130 "Define a normal operand."
131 (define-full-operand name comment attrs type DFLT index () () ())
134 ; For those who don't like typing.
137 "Shorthand form of define-normal-operand."
138 define-normal-operand
141 ; Deprecated, but still in wide use.
144 "Shorthand form of define-normal-operand."
145 define-normal-operand
148 (define-pmacro (dndo x-name x-mode x-args
149 x-syntax x-base-ifield x-encoding x-ifield-assertion
151 "Define a normal derived operand."
152 (define-derived-operand
157 (base-ifield x-base-ifield)
158 (encoding x-encoding)
159 (ifield-assertion x-ifield-assertion)
167 ; Define an instruction object, normal version.
168 ; At present all fields must be specified.
169 ; Fields ifield-assertion is absent.
171 (define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing)
172 "Define a normal instruction."
173 (define-full-insn name comment attrs syntax fmt () semantics timing)
176 ; To reduce the amount of typing.
177 ; Note that this is the same name as the D'ni in MYST. Oooohhhh.....
178 ; this must be the right way to go. :-)
181 "Shorthand form of define-normal-insn."
185 ; Macro instructions.
187 ; Define a macro-insn object, normal version.
188 ; This only supports expanding to one real insn.
190 (define-pmacro (define-normal-macro-insn name comment attrs syntax expansion)
191 "Define a normal macro instruction."
192 (define-full-minsn name comment attrs syntax expansion)
195 ; To reduce the amount of typing.
198 "Shorthand form of define-normal-macro-insn."
199 define-normal-macro-insn
203 ; ??? Not currently available for use.
207 ;(define-pmacro (define-normal-mode name comment attrs bits bytes
208 ; non-mode-c-type printf-type sem-mode ptr-to host?)
209 ; "Define a normal mode.\n"
210 ; (define-full-mode name comment attrs bits bytes
211 ; non-mode-c-type printf-type sem-mode ptr-to host?)
214 ; For those who don't like typing.
216 ; "Shorthand form of define-normal-mode.\n"