2009-11-09 Tristan Gingold <gingold@adacore.com>
[deliverable/binutils-gdb.git] / cpu / simplify.inc
CommitLineData
9aab5aa3
AC
1; Collection of macros, for GNU Binutils .cpu files. -*- Scheme -*-
2;
0aaaf7c3 3; Copyright 2000, 2007, 2009 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)
0aaaf7c3 31 "Define a normal enum, fixed number of arguments."
9aab5aa3
AC
32 (define-full-enum name comment attrs prefix vals)
33)
34
35; Define a normal insn enum.
36
37(define-pmacro (define-normal-insn-enum name comment attrs prefix fld vals)
0aaaf7c3 38 "Define a normal instruction opcode enum."
9aab5aa3
AC
39 (define-full-insn-enum name comment attrs prefix fld vals)
40)
41\f
42; Instruction fields.
43
0aaaf7c3 44; Normally, fields are unsigned and have no encode/decode needs.
9aab5aa3
AC
45
46(define-pmacro (define-normal-ifield name comment attrs start length)
0aaaf7c3 47 "Define a normal instruction field."
9aab5aa3
AC
48 (define-full-ifield name comment attrs start length UINT #f #f)
49)
50
51; For those who don't like typing.
52
0aaaf7c3
DE
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)
9aab5aa3
AC
56)
57(define-pmacro dnf
0aaaf7c3 58 "Shorthand form of define-normal-ifield."
9aab5aa3
AC
59 define-normal-ifield
60)
61
62; Define a normal multi-ifield.
9aab5aa3
AC
63
64(define-pmacro (define-normal-multi-ifield name comment attrs
65 mode subflds insert extract)
0aaaf7c3 66 "Define a normal multi-part instruction field."
9aab5aa3
AC
67 (define-full-multi-ifield name comment attrs mode subflds insert extract)
68)
69
70; For those who don't like typing.
71
72(define-pmacro dnmf
0aaaf7c3 73 "Shorthand form of define-normal-multi-ifield."
9aab5aa3
AC
74 define-normal-multi-ifield
75)
76
0aaaf7c3
DE
77; Simple multi-ifields: mode is UINT, default insert/extract support,
78; default encode/decode support.
9aab5aa3
AC
79
80(define-pmacro (dsmf name comment attrs subflds)
0aaaf7c3 81 "Define a simple multi-part instruction field."
9aab5aa3
AC
82 (define-full-multi-ifield name comment attrs UINT subflds #f #f)
83)
84\f
85; Hardware.
86
87; Simpler version for most hardware elements.
0aaaf7c3
DE
88; Allow special assembler support specification but no semantic-name,
89; getter/setter, or layout specs.
9aab5aa3
AC
90
91(define-pmacro (define-normal-hardware name comment attrs type
92 indices values handlers)
0aaaf7c3 93 "Define a normal hardware element."
9aab5aa3
AC
94 (define-full-hardware name comment attrs name type
95 indices values handlers () () ())
96)
97
98; For those who don't like typing.
99
100(define-pmacro dnh
0aaaf7c3 101 "Shorthand form of define-normal-hardware."
9aab5aa3
AC
102 define-normal-hardware
103)
104
105; Simpler version of dnh that leaves out the indices, values, handlers,
0aaaf7c3 106; getter/setter, and layout specs.
9aab5aa3
AC
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
111; are ok.
112
113(define-pmacro (define-simple-hardware name comment attrs type)
0aaaf7c3 114 "Define a simple hardware element (usually a scalar register)."
9aab5aa3
AC
115 (define-full-hardware name comment attrs name type () () () () () ())
116)
117
118(define-pmacro dsh
0aaaf7c3 119 "Shorthand form of define-simple-hardware."
9aab5aa3
AC
120 define-simple-hardware
121)
122\f
123; Operands.
124
0aaaf7c3
DE
125; Simpler version for most operands.
126; Allow special assembler support specification but no handlers or
127; getter/setter specs.
128
9aab5aa3 129(define-pmacro (define-normal-operand name comment attrs type index)
0aaaf7c3 130 "Define a normal operand."
9aab5aa3
AC
131 (define-full-operand name comment attrs type DFLT index () () ())
132)
133
134; For those who don't like typing.
0aaaf7c3
DE
135
136(define-pmacro dno
137 "Shorthand form of define-normal-operand."
138 define-normal-operand
139)
140
141; Deprecated, but still in wide use.
9aab5aa3
AC
142
143(define-pmacro dnop
0aaaf7c3 144 "Shorthand form of define-normal-operand."
9aab5aa3
AC
145 define-normal-operand
146)
147
148(define-pmacro (dndo x-name x-mode x-args
149 x-syntax x-base-ifield x-encoding x-ifield-assertion
150 x-getter x-setter)
151 "Define a normal derived operand."
152 (define-derived-operand
153 (name x-name)
154 (mode x-mode)
155 (args x-args)
156 (syntax x-syntax)
157 (base-ifield x-base-ifield)
158 (encoding x-encoding)
159 (ifield-assertion x-ifield-assertion)
160 (getter x-getter)
161 (setter x-setter)
162 )
163)
164\f
165; Instructions.
166
167; Define an instruction object, normal version.
168; At present all fields must be specified.
169; Fields ifield-assertion is absent.
170
171(define-pmacro (define-normal-insn name comment attrs syntax fmt semantics timing)
0aaaf7c3 172 "Define a normal instruction."
9aab5aa3
AC
173 (define-full-insn name comment attrs syntax fmt () semantics timing)
174)
175
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. :-)
179
180(define-pmacro dni
0aaaf7c3 181 "Shorthand form of define-normal-insn."
9aab5aa3
AC
182 define-normal-insn
183)
184\f
185; Macro instructions.
186
187; Define a macro-insn object, normal version.
188; This only supports expanding to one real insn.
189
190(define-pmacro (define-normal-macro-insn name comment attrs syntax expansion)
0aaaf7c3 191 "Define a normal macro instruction."
9aab5aa3
AC
192 (define-full-minsn name comment attrs syntax expansion)
193)
194
195; To reduce the amount of typing.
196
197(define-pmacro dnmi
0aaaf7c3 198 "Shorthand form of define-normal-macro-insn."
9aab5aa3
AC
199 define-normal-macro-insn
200)
201\f
202; Modes.
203; ??? Not currently available for use.
204;
205; Define Normal Mode
206;
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?)
212;)
213;
214; For those who don't like typing.
215;(define-pmacro dnm
216; "Shorthand form of define-normal-mode.\n"
217; define-normal-mode
218;)
This page took 0.247985 seconds and 4 git commands to generate.