1
; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*-
3
; Copyright 2000 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
; Define a normal enum without using name/value pairs.
26
; This is currently the same as define-full-enum but it needn't remain
27
; that way (it's define-full-enum that would change).
29
(define-pmacro (define-normal-enum name comment attrs prefix vals)
31
Define a normal enum, fixed number of arguments.
33
(define-full-enum name comment attrs prefix vals)
36
; Define a normal insn enum.
38
(define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals)
40
Define a normal instruction opcode enum.
42
(define-full-insn-enum name comment attrs prefix fld vals)
47
; Normally, fields are unsigned have no encode/decode needs.
49
(define-pmacro (define-normal-ifield name comment attrs start length)
50
"Define a normal instruction field.\n"
51
(define-full-ifield name comment attrs start length UINT #f #f)
54
; For those who don't like typing.
57
"Shorthand form of define-full-ifield.\n"
61
"Shorthand form of define-normal-ifield.\n"
65
; Define a normal multi-ifield.
66
; FIXME: The define-normal version for ifields doesn't include the mode.
68
(define-pmacro (define-normal-multi-ifield name comment attrs
69
mode subflds insert extract)
70
"Define a normal multi-part instruction field.\n"
71
(define-full-multi-ifield name comment attrs mode subflds insert extract)
74
; For those who don't like typing.
77
"Shorthand form of define-normal-multi-ifield.\n"
78
define-normal-multi-ifield
81
; Simple multi-ifields: mode is UINT, default insert/extract support.
83
(define-pmacro (dsmf name comment attrs subflds)
84
"Define a simple multi-part instruction field.\n"
85
(define-full-multi-ifield name comment attrs UINT subflds #f #f)
90
; Simpler version for most hardware elements.
91
; Allow special assembler support specification but no semantic-name or
94
(define-pmacro (define-normal-hardware name comment attrs type
95
indices values handlers)
97
Define a normal hardware element.
99
(define-full-hardware name comment attrs name type
100
indices values handlers () () ())
103
; For those who don't like typing.
106
"Shorthand form of define-normal-hardware.\n"
107
define-normal-hardware
110
; Simpler version of dnh that leaves out the indices, values, handlers,
111
; get, set, and layout specs.
112
; This is useful for 1 bit registers.
113
; ??? While dsh and dnh aren't that distinguishable when perusing a .cpu file,
114
; they both take a fixed number of positional arguments, and dsh is a proper
115
; subset of dnh with all arguments in the same positions, so methinks things
118
(define-pmacro (define-simple-hardware name comment attrs type)
120
Define a simple hardware element (usually a scalar register).
122
(define-full-hardware name comment attrs name type () () () () () ())
126
"Shorthand form of define-simple-hardware.\n"
127
define-simple-hardware
132
(define-pmacro (define-normal-operand name comment attrs type index)
133
"Define a normal operand.\n"
134
(define-full-operand name comment attrs type DFLT index () () ())
137
; For those who don't like typing.
141
"Shorthand form of define-normal-operand.\n"
142
define-normal-operand
145
(define-pmacro (dndo x-name x-mode x-args
146
x-syntax x-base-ifield x-encoding x-ifield-assertion
148
"Define a normal derived operand."
149
(define-derived-operand
154
(base-ifield x-base-ifield)
155
(encoding x-encoding)
156
(ifield-assertion x-ifield-assertion)
164
; Define an instruction object, normal version.
165
; At present all fields must be specified.
166
; Fields ifield-assertion is absent.
168
(define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing)
169
"Define a normal instruction.\n"
170
(define-full-insn name comment attrs syntax fmt () semantics timing)
173
; To reduce the amount of typing.
174
; Note that this is the same name as the D'ni in MYST. Oooohhhh.....
175
; this must be the right way to go. :-)
178
"Shorthand form of define-normal-insn.\n"
182
; Macro instructions.
184
; Define a macro-insn object, normal version.
185
; This only supports expanding to one real insn.
187
(define-pmacro (define-normal-macro-insn name comment attrs syntax expansion)
188
"Define a normal macro instruction.\n"
189
(define-full-minsn name comment attrs syntax expansion)
192
; To reduce the amount of typing.
195
"Shorthand form of define-normal-macro-insn.\n"
196
define-normal-macro-insn
200
; ??? Not currently available for use.
204
;(define-pmacro (define-normal-mode name comment attrs bits bytes
205
; non-mode-c-type printf-type sem-mode ptr-to host?)
206
; "Define a normal mode.\n"
207
; (define-full-mode name comment attrs bits bytes
208
; non-mode-c-type printf-type sem-mode ptr-to host?)
211
; For those who don't like typing.
213
; "Shorthand form of define-normal-mode.\n"