Commit generated files for 2.12.1.
[binutils.git] / gas / m68k-parse.c
blob5cefc2e588b573dba1ac6e52ff20b1d9dcb79cce
1 /* A Bison parser, made from m68k-parse.y
2 by GNU bison 1.33. */
4 #define YYBISON 1 /* Identify Bison output. */
6 # define DR 257
7 # define AR 258
8 # define FPR 259
9 # define FPCR 260
10 # define LPC 261
11 # define ZAR 262
12 # define ZDR 263
13 # define LZPC 264
14 # define CREG 265
15 # define INDEXREG 266
16 # define EXPR 267
18 #line 27 "m68k-parse.y"
21 #include "as.h"
22 #include "tc-m68k.h"
23 #include "m68k-parse.h"
24 #include "safe-ctype.h"
26 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
27 etc), as well as gratuitiously global symbol names If other parser
28 generators (bison, byacc, etc) produce additional global names that
29 conflict at link time, then those parser generators need to be
30 fixed instead of adding those names to this list. */
32 #define yymaxdepth m68k_maxdepth
33 #define yyparse m68k_parse
34 #define yylex m68k_lex
35 #define yyerror m68k_error
36 #define yylval m68k_lval
37 #define yychar m68k_char
38 #define yydebug m68k_debug
39 #define yypact m68k_pact
40 #define yyr1 m68k_r1
41 #define yyr2 m68k_r2
42 #define yydef m68k_def
43 #define yychk m68k_chk
44 #define yypgo m68k_pgo
45 #define yyact m68k_act
46 #define yyexca m68k_exca
47 #define yyerrflag m68k_errflag
48 #define yynerrs m68k_nerrs
49 #define yyps m68k_ps
50 #define yypv m68k_pv
51 #define yys m68k_s
52 #define yy_yys m68k_yys
53 #define yystate m68k_state
54 #define yytmp m68k_tmp
55 #define yyv m68k_v
56 #define yy_yyv m68k_yyv
57 #define yyval m68k_val
58 #define yylloc m68k_lloc
59 #define yyreds m68k_reds /* With YYDEBUG defined */
60 #define yytoks m68k_toks /* With YYDEBUG defined */
61 #define yylhs m68k_yylhs
62 #define yylen m68k_yylen
63 #define yydefred m68k_yydefred
64 #define yydgoto m68k_yydgoto
65 #define yysindex m68k_yysindex
66 #define yyrindex m68k_yyrindex
67 #define yygindex m68k_yygindex
68 #define yytable m68k_yytable
69 #define yycheck m68k_yycheck
71 #ifndef YYDEBUG
72 #define YYDEBUG 1
73 #endif
75 /* Internal functions. */
77 static enum m68k_register m68k_reg_parse PARAMS ((char **));
78 static int yylex PARAMS ((void));
79 static void yyerror PARAMS ((const char *));
81 /* The parser sets fields pointed to by this global variable. */
82 static struct m68k_op *op;
85 #line 94 "m68k-parse.y"
86 #ifndef YYSTYPE
87 typedef union
89 struct m68k_indexreg indexreg;
90 enum m68k_register reg;
91 struct m68k_exp exp;
92 unsigned long mask;
93 int onereg;
94 } yystype;
95 # define YYSTYPE yystype
96 #endif
97 #ifndef YYDEBUG
98 # define YYDEBUG 0
99 #endif
103 #define YYFINAL 173
104 #define YYFLAG -32768
105 #define YYNTBASE 25
107 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
108 #define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 44)
110 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
111 static const char yytranslate[] =
113 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
114 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
115 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116 2, 2, 2, 2, 2, 14, 2, 2, 15, 2,
117 16, 17, 2, 18, 20, 19, 2, 24, 2, 2,
118 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
119 2, 2, 2, 2, 23, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 21, 2, 22, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
125 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
126 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
127 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
128 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
129 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
130 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
131 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
132 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
133 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
134 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
135 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
136 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
137 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
139 6, 7, 8, 9, 10, 11, 12, 13
142 #if YYDEBUG
143 static const short yyprhs[] =
145 0, 0, 2, 4, 6, 8, 10, 12, 14, 16,
146 18, 21, 24, 26, 30, 35, 40, 46, 52, 57,
147 61, 65, 69, 77, 85, 92, 98, 105, 111, 118,
148 124, 130, 135, 145, 153, 162, 169, 180, 189, 200,
149 209, 218, 221, 225, 229, 235, 242, 253, 263, 274,
150 276, 278, 280, 282, 284, 286, 288, 290, 292, 294,
151 296, 298, 300, 302, 303, 305, 307, 309, 310, 313,
152 314, 317, 318, 321, 323, 327, 331, 333, 335, 339,
153 343, 347, 349, 351, 353
155 static const short yyrhs[] =
157 26, 0, 27, 0, 28, 0, 3, 0, 4, 0,
158 5, 0, 6, 0, 11, 0, 13, 0, 14, 13,
159 0, 15, 13, 0, 40, 0, 16, 4, 17, 0,
160 16, 4, 17, 18, 0, 19, 16, 4, 17, 0,
161 16, 13, 20, 34, 17, 0, 16, 34, 20, 13,
162 17, 0, 13, 16, 34, 17, 0, 16, 7, 17,
163 0, 16, 8, 17, 0, 16, 10, 17, 0, 16,
164 13, 20, 34, 20, 29, 17, 0, 16, 13, 20,
165 34, 20, 36, 17, 0, 16, 13, 20, 30, 37,
166 17, 0, 16, 30, 20, 13, 17, 0, 13, 16,
167 34, 20, 29, 17, 0, 16, 34, 20, 29, 17,
168 0, 13, 16, 34, 20, 36, 17, 0, 16, 34,
169 20, 36, 17, 0, 13, 16, 30, 37, 17, 0,
170 16, 30, 37, 17, 0, 16, 21, 13, 37, 22,
171 20, 29, 38, 17, 0, 16, 21, 13, 37, 22,
172 38, 17, 0, 16, 21, 34, 22, 20, 29, 38,
173 17, 0, 16, 21, 34, 22, 38, 17, 0, 16,
174 21, 13, 20, 34, 20, 29, 22, 38, 17, 0,
175 16, 21, 34, 20, 29, 22, 38, 17, 0, 16,
176 21, 13, 20, 34, 20, 36, 22, 38, 17, 0,
177 16, 21, 34, 20, 36, 22, 38, 17, 0, 16,
178 21, 39, 30, 37, 22, 38, 17, 0, 35, 23,
179 0, 35, 23, 18, 0, 35, 23, 19, 0, 35,
180 23, 16, 13, 17, 0, 35, 23, 16, 39, 29,
181 17, 0, 35, 23, 16, 13, 17, 23, 16, 39,
182 29, 17, 0, 35, 23, 16, 13, 17, 23, 16,
183 13, 17, 0, 35, 23, 16, 39, 29, 17, 23,
184 16, 13, 17, 0, 12, 0, 31, 0, 12, 0,
185 32, 0, 32, 0, 4, 0, 8, 0, 3, 0,
186 9, 0, 4, 0, 7, 0, 33, 0, 10, 0,
187 8, 0, 0, 34, 0, 7, 0, 10, 0, 0,
188 20, 34, 0, 0, 20, 13, 0, 0, 13, 20,
189 0, 42, 0, 42, 24, 41, 0, 43, 24, 41,
190 0, 43, 0, 42, 0, 42, 24, 41, 0, 43,
191 24, 41, 0, 43, 19, 43, 0, 3, 0, 4,
192 0, 5, 0, 6, 0
195 #endif
197 #if YYDEBUG
198 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
199 static const short yyrline[] =
201 0, 117, 119, 120, 125, 131, 136, 141, 146, 151,
202 156, 161, 166, 178, 184, 189, 194, 204, 214, 224,
203 229, 234, 239, 246, 257, 264, 270, 277, 283, 294,
204 304, 311, 317, 325, 332, 339, 345, 353, 360, 372,
205 383, 395, 404, 412, 420, 430, 437, 445, 452, 465,
206 467, 479, 481, 492, 494, 495, 500, 502, 507, 509,
207 515, 517, 518, 523, 528, 533, 535, 540, 545, 553,
208 559, 567, 573, 581, 583, 587, 598, 603, 604, 608,
209 614, 624, 629, 633, 637
211 #endif
214 #if (YYDEBUG) || defined YYERROR_VERBOSE
216 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
217 static const char *const yytname[] =
219 "$", "error", "$undefined.", "DR", "AR", "FPR", "FPCR", "LPC", "ZAR",
220 "ZDR", "LZPC", "CREG", "INDEXREG", "EXPR", "'#'", "'&'", "'('", "')'",
221 "'+'", "'-'", "','", "'['", "']'", "'@'", "'/'", "operand",
222 "generic_operand", "motorola_operand", "mit_operand", "zireg", "zdireg",
223 "zadr", "zdr", "apc", "zapc", "optzapc", "zpc", "optczapc", "optcexpr",
224 "optexprc", "reglist", "ireglist", "reglistpair", "reglistreg", NULL
226 #endif
228 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
229 static const short yyr1[] =
231 0, 25, 25, 25, 26, 26, 26, 26, 26, 26,
232 26, 26, 26, 27, 27, 27, 27, 27, 27, 27,
233 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
234 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
235 27, 28, 28, 28, 28, 28, 28, 28, 28, 29,
236 29, 30, 30, 31, 31, 31, 32, 32, 33, 33,
237 34, 34, 34, 35, 35, 36, 36, 37, 37, 38,
238 38, 39, 39, 40, 40, 40, 41, 41, 41, 41,
239 42, 43, 43, 43, 43
242 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
243 static const short yyr2[] =
245 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
246 2, 2, 1, 3, 4, 4, 5, 5, 4, 3,
247 3, 3, 7, 7, 6, 5, 6, 5, 6, 5,
248 5, 4, 9, 7, 8, 6, 10, 8, 10, 8,
249 8, 2, 3, 3, 5, 6, 10, 9, 10, 1,
250 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
251 1, 1, 1, 0, 1, 1, 1, 0, 2, 0,
252 2, 0, 2, 1, 3, 3, 1, 1, 3, 3,
253 3, 1, 1, 1, 1
256 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
257 doesn't specify something else to do. Zero means the default is an
258 error. */
259 static const short yydefact[] =
261 63, 81, 82, 83, 84, 59, 62, 61, 8, 9,
262 0, 0, 0, 0, 1, 2, 3, 60, 64, 0,
263 12, 73, 0, 0, 10, 11, 56, 58, 59, 62,
264 57, 61, 51, 0, 71, 67, 52, 0, 0, 41,
265 0, 0, 0, 58, 67, 0, 13, 19, 20, 21,
266 0, 67, 0, 0, 0, 0, 0, 0, 71, 42,
267 43, 81, 82, 83, 84, 74, 77, 76, 80, 75,
268 0, 0, 18, 0, 14, 67, 0, 72, 0, 0,
269 69, 67, 0, 68, 31, 54, 65, 55, 66, 49,
270 0, 0, 50, 53, 0, 15, 0, 0, 0, 0,
271 30, 0, 0, 0, 16, 0, 68, 69, 0, 0,
272 0, 0, 0, 25, 17, 27, 29, 44, 72, 0,
273 78, 79, 26, 28, 24, 0, 0, 0, 0, 0,
274 69, 69, 70, 69, 35, 69, 0, 45, 22, 23,
275 0, 0, 69, 33, 0, 0, 0, 0, 0, 71,
276 0, 69, 69, 0, 37, 39, 34, 40, 0, 0,
277 0, 0, 0, 32, 47, 0, 0, 36, 38, 46,
278 48, 0, 0, 0
281 static const short yydefgoto[] =
283 171, 14, 15, 16, 91, 35, 92, 93, 17, 83,
284 19, 94, 55, 111, 53, 20, 65, 66, 67
287 static const short yypact[] =
289 89, 10, 11, 19, 23,-32768,-32768,-32768,-32768, 13,
290 -4, 22, 57, 36,-32768,-32768,-32768,-32768,-32768, 18,
291 -32768, 33, -2, 114,-32768,-32768,-32768, 46, 62, 66,
292 -32768, 67,-32768, 68, 131, 69,-32768, 70, 105, 147,
293 156, 156, 156,-32768, 94, 25, 101,-32768,-32768,-32768,
294 114, 100, 53, 9, 138, 108, 103, 112, 117,-32768,
295 -32768,-32768,-32768,-32768,-32768,-32768, 119, 12,-32768,-32768,
296 64, 130,-32768, 124,-32768, 94, 81, 64, 135, 124,
297 132, 94, 150,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
298 151, 152,-32768,-32768, 153,-32768, 120, 146, 156, 156,
299 -32768, 154, 155, 157,-32768, 124, 144, 158, 159, 160,
300 73, 162, 161,-32768,-32768,-32768,-32768, 163,-32768, 167,
301 -32768,-32768,-32768,-32768,-32768, 168, 170, 124, 73, 171,
302 169, 169,-32768, 169,-32768, 169, 164, 172,-32768,-32768,
303 174, 175, 169,-32768, 177, 176, 181, 182, 183, 178,
304 185, 169, 169, 186,-32768,-32768,-32768,-32768, 136, 146,
305 179, 187, 188,-32768,-32768, 189, 190,-32768,-32768,-32768,
306 -32768, 173, 194,-32768
309 static const short yypgoto[] =
311 -32768,-32768,-32768,-32768, -72, 1,-32768, -7,-32768, 3,
312 -32768, -65, -31, -103, -58,-32768, -40, 202, 6
316 #define YYLAST 207
319 static const short yytable[] =
321 97, 101, 69, 18, 129, 36, 22, 108, 102, 24,
322 -4, -5, 26, 71, 109, 37, 36, 41, 30, -6,
323 78, 32, 42, -7, 44, 119, 45, 145, 146, 23,
324 147, 41, 148, 125, -58, 25, 99, 52, 133, 153,
325 126, 39, 72, 36, 103, 73, 36, 68, 161, 162,
326 112, 75, 38, 76, 81, 140, 142, 40, 120, 121,
327 26, 27, 141, 46, 28, 29, 30, 31, 43, 32,
328 33, 5, 6, 79, 7, 80, 26, 85, 34, 47,
329 106, 87, 30, 48, 49, 89, 132, 165, 50, 54,
330 56, 159, 1, 2, 3, 4, 5, 6, 104, 7,
331 8, 105, 9, 10, 11, 12, 26, 85, 13, 57,
332 86, 87, 30, 88, 70, 89, 90, 26, 43, 74,
333 77, 5, 6, 30, 7, 84, 32, 26, 85, 95,
334 96, 86, 87, 30, 88, 43, 89, 117, 5, 6,
335 118, 7, 43, 98, 51, 5, 6, 100, 7, 26,
336 85, 82, 110, 164, 87, 30, 118, 107, 89, 61,
337 62, 63, 64, 58, 127, 59, 60, 113, 114, 115,
338 116, 122, 123, 172, 124, 0, 0, 0, 128, 134,
339 149, 130, 131, 135, 137, 138, 136, 139, 143, 144,
340 132, 158, 166, 154, 173, 150, 151, 152, 155, 156,
341 157, 160, 21, 163, 167, 168, 169, 170
344 static const short yycheck[] =
346 58, 73, 42, 0, 107, 12, 0, 79, 73, 13,
347 0, 0, 3, 44, 79, 12, 23, 19, 9, 0,
348 51, 12, 24, 0, 23, 97, 23, 130, 131, 16,
349 133, 19, 135, 105, 23, 13, 24, 34, 110, 142,
350 105, 23, 17, 50, 75, 20, 53, 41, 151, 152,
351 81, 50, 16, 50, 53, 127, 128, 24, 98, 99,
352 3, 4, 127, 17, 7, 8, 9, 10, 4, 12,
353 13, 7, 8, 20, 10, 22, 3, 4, 21, 17,
354 77, 8, 9, 17, 17, 12, 13, 159, 20, 20,
355 20, 149, 3, 4, 5, 6, 7, 8, 17, 10,
356 11, 20, 13, 14, 15, 16, 3, 4, 19, 4,
357 7, 8, 9, 10, 20, 12, 13, 3, 4, 18,
358 20, 7, 8, 9, 10, 17, 12, 3, 4, 17,
359 13, 7, 8, 9, 10, 4, 12, 17, 7, 8,
360 20, 10, 4, 24, 13, 7, 8, 17, 10, 3,
361 4, 13, 20, 17, 8, 9, 20, 22, 12, 3,
362 4, 5, 6, 16, 20, 18, 19, 17, 17, 17,
363 17, 17, 17, 0, 17, -1, -1, -1, 20, 17,
364 16, 22, 22, 22, 17, 17, 23, 17, 17, 20,
365 13, 13, 13, 17, 0, 23, 22, 22, 17, 17,
366 17, 16, 0, 17, 17, 17, 17, 17
368 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
369 #line 3 "/usr/share/bison/bison.simple"
371 /* Skeleton output parser for bison,
373 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
374 Foundation, Inc.
376 This program is free software; you can redistribute it and/or modify
377 it under the terms of the GNU General Public License as published by
378 the Free Software Foundation; either version 2, or (at your option)
379 any later version.
381 This program is distributed in the hope that it will be useful,
382 but WITHOUT ANY WARRANTY; without even the implied warranty of
383 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
384 GNU General Public License for more details.
386 You should have received a copy of the GNU General Public License
387 along with this program; if not, write to the Free Software
388 Foundation, Inc., 59 Temple Place - Suite 330,
389 Boston, MA 02111-1307, USA. */
391 /* As a special exception, when this file is copied by Bison into a
392 Bison output file, you may use that output file without restriction.
393 This special exception was added by the Free Software Foundation
394 in version 1.24 of Bison. */
396 /* This is the parser code that is written into each bison parser when
397 the %semantic_parser declaration is not specified in the grammar.
398 It was written by Richard Stallman by simplifying the hairy parser
399 used when %semantic_parser is specified. */
401 /* All symbols defined below should begin with yy or YY, to avoid
402 infringing on user name space. This should be done even for local
403 variables, as they might otherwise be expanded by user macros.
404 There are some unavoidable exceptions within include files to
405 define necessary library symbols; they are noted "INFRINGES ON
406 USER NAME SPACE" below. */
408 #ifdef __cplusplus
409 # define YYSTD(x) std::x
410 #else
411 # define YYSTD(x) x
412 #endif
414 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
416 /* The parser invokes alloca or malloc; define the necessary symbols. */
418 # if YYSTACK_USE_ALLOCA
419 # define YYSTACK_ALLOC alloca
420 # else
421 # ifndef YYSTACK_USE_ALLOCA
422 # if defined (alloca) || defined (_ALLOCA_H)
423 # define YYSTACK_ALLOC alloca
424 # else
425 # ifdef __GNUC__
426 # define YYSTACK_ALLOC __builtin_alloca
427 # endif
428 # endif
429 # endif
430 # endif
432 # ifdef YYSTACK_ALLOC
433 /* Pacify GCC's `empty if-body' warning. */
434 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
435 # else
436 # ifdef __cplusplus
437 # include <cstdlib> /* INFRINGES ON USER NAME SPACE */
438 # define YYSIZE_T std::size_t
439 # else
440 # ifdef __STDC__
441 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
442 # define YYSIZE_T size_t
443 # endif
444 # endif
445 # define YYSTACK_ALLOC YYSTD (malloc)
446 # define YYSTACK_FREE YYSTD (free)
447 # endif
449 /* A type that is properly aligned for any stack member. */
450 union yyalloc
452 short yyss;
453 YYSTYPE yyvs;
454 # if YYLSP_NEEDED
455 YYLTYPE yyls;
456 # endif
459 /* The size of the maximum gap between one aligned stack and the next. */
460 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
462 /* The size of an array large to enough to hold all stacks, each with
463 N elements. */
464 # if YYLSP_NEEDED
465 # define YYSTACK_BYTES(N) \
466 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
467 + 2 * YYSTACK_GAP_MAX)
468 # else
469 # define YYSTACK_BYTES(N) \
470 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
471 + YYSTACK_GAP_MAX)
472 # endif
474 /* Relocate the TYPE STACK from its old location to the new one. The
475 local variables YYSIZE and YYSTACKSIZE give the old and new number of
476 elements in the stack, and YYPTR gives the new location of the
477 stack. Advance YYPTR to a properly aligned location for the next
478 stack. */
479 # define YYSTACK_RELOCATE(Type, Stack) \
480 do \
482 YYSIZE_T yynewbytes; \
483 yymemcpy ((char *) yyptr, (char *) (Stack), \
484 yysize * (YYSIZE_T) sizeof (Type)); \
485 Stack = &yyptr->Stack; \
486 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
487 yyptr += yynewbytes / sizeof (*yyptr); \
489 while (0)
491 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
494 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
495 # define YYSIZE_T __SIZE_TYPE__
496 #endif
497 #if ! defined (YYSIZE_T) && defined (size_t)
498 # define YYSIZE_T size_t
499 #endif
500 #if ! defined (YYSIZE_T)
501 # ifdef __cplusplus
502 # include <cstddef> /* INFRINGES ON USER NAME SPACE */
503 # define YYSIZE_T std::size_t
504 # else
505 # ifdef __STDC__
506 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
507 # define YYSIZE_T size_t
508 # endif
509 # endif
510 #endif
511 #if ! defined (YYSIZE_T)
512 # define YYSIZE_T unsigned int
513 #endif
515 #define yyerrok (yyerrstatus = 0)
516 #define yyclearin (yychar = YYEMPTY)
517 #define YYEMPTY -2
518 #define YYEOF 0
519 #define YYACCEPT goto yyacceptlab
520 #define YYABORT goto yyabortlab
521 #define YYERROR goto yyerrlab1
522 /* Like YYERROR except do call yyerror. This remains here temporarily
523 to ease the transition to the new meaning of YYERROR, for GCC.
524 Once GCC version 2 has supplanted version 1, this can go. */
525 #define YYFAIL goto yyerrlab
526 #define YYRECOVERING() (!!yyerrstatus)
527 #define YYBACKUP(Token, Value) \
528 do \
529 if (yychar == YYEMPTY && yylen == 1) \
531 yychar = (Token); \
532 yylval = (Value); \
533 yychar1 = YYTRANSLATE (yychar); \
534 YYPOPSTACK; \
535 goto yybackup; \
537 else \
539 yyerror ("syntax error: cannot back up"); \
540 YYERROR; \
542 while (0)
544 #define YYTERROR 1
545 #define YYERRCODE 256
548 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
549 are run).
551 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
552 first token. By default, to implement support for ranges, extend
553 its range to the last symbol. */
555 #ifndef YYLLOC_DEFAULT
556 # define YYLLOC_DEFAULT(Current, Rhs, N) \
557 Current.last_line = Rhs[N].last_line; \
558 Current.last_column = Rhs[N].last_column;
559 #endif
562 /* YYLEX -- calling `yylex' with the right arguments. */
564 #if YYPURE
565 # if YYLSP_NEEDED
566 # ifdef YYLEX_PARAM
567 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
568 # else
569 # define YYLEX yylex (&yylval, &yylloc)
570 # endif
571 # else /* !YYLSP_NEEDED */
572 # ifdef YYLEX_PARAM
573 # define YYLEX yylex (&yylval, YYLEX_PARAM)
574 # else
575 # define YYLEX yylex (&yylval)
576 # endif
577 # endif /* !YYLSP_NEEDED */
578 #else /* !YYPURE */
579 # define YYLEX yylex ()
580 #endif /* !YYPURE */
583 /* Enable debugging if requested. */
584 #if YYDEBUG
586 # ifndef YYFPRINTF
587 # ifdef __cplusplus
588 # include <cstdio> /* INFRINGES ON USER NAME SPACE */
589 # else
590 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
591 # endif
592 # define YYFPRINTF YYSTD (fprintf)
593 # endif
595 # define YYDPRINTF(Args) \
596 do { \
597 if (yydebug) \
598 YYFPRINTF Args; \
599 } while (0)
600 /* Nonzero means print parse trace. [The following comment makes no
601 sense to me. Could someone clarify it? --akim] Since this is
602 uninitialized, it does not stop multiple parsers from coexisting.
604 int yydebug;
605 #else /* !YYDEBUG */
606 # define YYDPRINTF(Args)
607 #endif /* !YYDEBUG */
609 /* YYINITDEPTH -- initial size of the parser's stacks. */
610 #ifndef YYINITDEPTH
611 # define YYINITDEPTH 200
612 #endif
614 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
615 if the built-in stack extension method is used).
617 Do not make this value too large; the results are undefined if
618 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
619 evaluated with infinite-precision integer arithmetic. */
621 #if YYMAXDEPTH == 0
622 # undef YYMAXDEPTH
623 #endif
625 #ifndef YYMAXDEPTH
626 # define YYMAXDEPTH 10000
627 #endif
629 #if ! defined (yyoverflow) && ! defined (yymemcpy)
630 # if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
631 # define yymemcpy __builtin_memcpy
632 # else /* not GNU C or C++ */
634 /* This is the most reliable way to avoid incompatibilities
635 in available built-in functions on various systems. */
636 static void
637 # if defined (__STDC__) || defined (__cplusplus)
638 yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
639 # else
640 yymemcpy (yyto, yyfrom, yycount)
641 char *yyto;
642 const char *yyfrom;
643 YYSIZE_T yycount;
644 # endif
646 register const char *yyf = yyfrom;
647 register char *yyt = yyto;
648 register YYSIZE_T yyi = yycount;
650 while (yyi-- != 0)
651 *yyt++ = *yyf++;
653 # endif
654 #endif
656 #ifdef YYERROR_VERBOSE
658 # ifndef yystrlen
659 # if defined (__GLIBC__) && defined (_STRING_H)
660 # define yystrlen strlen
661 # else
662 /* Return the length of YYSTR. */
663 static YYSIZE_T
664 # if defined (__STDC__) || defined (__cplusplus)
665 yystrlen (const char *yystr)
666 # else
667 yystrlen (yystr)
668 const char *yystr;
669 # endif
671 register const char *yys = yystr;
673 while (*yys++ != '\0')
674 continue;
676 return yys - yystr - 1;
678 # endif
679 # endif
681 # ifndef yystpcpy
682 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
683 # define yystpcpy stpcpy
684 # else
685 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
686 YYDEST. */
687 static char *
688 # if defined (__STDC__) || defined (__cplusplus)
689 yystpcpy (char *yydest, const char *yysrc)
690 # else
691 yystpcpy (yydest, yysrc)
692 char *yydest;
693 const char *yysrc;
694 # endif
696 register char *yyd = yydest;
697 register const char *yys = yysrc;
699 while ((*yyd++ = *yys++) != '\0')
700 continue;
702 return yyd - 1;
704 # endif
705 # endif
706 #endif
708 #line 341 "/usr/share/bison/bison.simple"
711 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
712 into yyparse. The argument should have type void *.
713 It should actually point to an object.
714 Grammar actions can access the variable by casting it
715 to the proper pointer type. */
717 #ifdef YYPARSE_PARAM
718 # ifdef __cplusplus
719 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
720 # define YYPARSE_PARAM_DECL
721 # else /* !__cplusplus */
722 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
723 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
724 # endif /* !__cplusplus */
725 #else /* !YYPARSE_PARAM */
726 # define YYPARSE_PARAM_ARG
727 # define YYPARSE_PARAM_DECL
728 #endif /* !YYPARSE_PARAM */
730 /* Prevent warning if -Wstrict-prototypes. */
731 #ifdef __GNUC__
732 # ifdef YYPARSE_PARAM
733 int yyparse (void *);
734 # else
735 int yyparse (void);
736 # endif
737 #endif
739 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
740 variables are global, or local to YYPARSE. */
742 #define YY_DECL_NON_LSP_VARIABLES \
743 /* The lookahead symbol. */ \
744 int yychar; \
746 /* The semantic value of the lookahead symbol. */ \
747 YYSTYPE yylval; \
749 /* Number of parse errors so far. */ \
750 int yynerrs;
752 #if YYLSP_NEEDED
753 # define YY_DECL_VARIABLES \
754 YY_DECL_NON_LSP_VARIABLES \
756 /* Location data for the lookahead symbol. */ \
757 YYLTYPE yylloc;
758 #else
759 # define YY_DECL_VARIABLES \
760 YY_DECL_NON_LSP_VARIABLES
761 #endif
764 /* If nonreentrant, generate the variables here. */
766 #if !YYPURE
767 YY_DECL_VARIABLES
768 #endif /* !YYPURE */
771 yyparse (YYPARSE_PARAM_ARG)
772 YYPARSE_PARAM_DECL
774 /* If reentrant, generate the variables here. */
775 #if YYPURE
776 YY_DECL_VARIABLES
777 #endif /* !YYPURE */
779 register int yystate;
780 register int yyn;
781 int yyresult;
782 /* Number of tokens to shift before error messages enabled. */
783 int yyerrstatus;
784 /* Lookahead token as an internal (translated) token number. */
785 int yychar1 = 0;
787 /* Three stacks and their tools:
788 `yyss': related to states,
789 `yyvs': related to semantic values,
790 `yyls': related to locations.
792 Refer to the stacks thru separate pointers, to allow yyoverflow
793 to reallocate them elsewhere. */
795 /* The state stack. */
796 short yyssa[YYINITDEPTH];
797 short *yyss = yyssa;
798 register short *yyssp;
800 /* The semantic value stack. */
801 YYSTYPE yyvsa[YYINITDEPTH];
802 YYSTYPE *yyvs = yyvsa;
803 register YYSTYPE *yyvsp;
805 #if YYLSP_NEEDED
806 /* The location stack. */
807 YYLTYPE yylsa[YYINITDEPTH];
808 YYLTYPE *yyls = yylsa;
809 YYLTYPE *yylsp;
810 #endif
812 #if YYLSP_NEEDED
813 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
814 #else
815 # define YYPOPSTACK (yyvsp--, yyssp--)
816 #endif
818 YYSIZE_T yystacksize = YYINITDEPTH;
821 /* The variables used to return semantic value and location from the
822 action routines. */
823 YYSTYPE yyval;
824 #if YYLSP_NEEDED
825 YYLTYPE yyloc;
826 #endif
828 /* When reducing, the number of symbols on the RHS of the reduced
829 rule. */
830 int yylen;
832 YYDPRINTF ((stderr, "Starting parse\n"));
834 yystate = 0;
835 yyerrstatus = 0;
836 yynerrs = 0;
837 yychar = YYEMPTY; /* Cause a token to be read. */
839 /* Initialize stack pointers.
840 Waste one element of value and location stack
841 so that they stay on the same level as the state stack.
842 The wasted elements are never initialized. */
844 yyssp = yyss;
845 yyvsp = yyvs;
846 #if YYLSP_NEEDED
847 yylsp = yyls;
848 #endif
849 goto yysetstate;
851 /*------------------------------------------------------------.
852 | yynewstate -- Push a new state, which is found in yystate. |
853 `------------------------------------------------------------*/
854 yynewstate:
855 /* In all cases, when you get here, the value and location stacks
856 have just been pushed. so pushing a state here evens the stacks.
858 yyssp++;
860 yysetstate:
861 *yyssp = yystate;
863 if (yyssp >= yyss + yystacksize - 1)
865 /* Get the current used size of the three stacks, in elements. */
866 YYSIZE_T yysize = yyssp - yyss + 1;
868 #ifdef yyoverflow
870 /* Give user a chance to reallocate the stack. Use copies of
871 these so that the &'s don't force the real ones into
872 memory. */
873 YYSTYPE *yyvs1 = yyvs;
874 short *yyss1 = yyss;
876 /* Each stack pointer address is followed by the size of the
877 data in use in that stack, in bytes. */
878 # if YYLSP_NEEDED
879 YYLTYPE *yyls1 = yyls;
880 /* This used to be a conditional around just the two extra args,
881 but that might be undefined if yyoverflow is a macro. */
882 yyoverflow ("parser stack overflow",
883 &yyss1, yysize * sizeof (*yyssp),
884 &yyvs1, yysize * sizeof (*yyvsp),
885 &yyls1, yysize * sizeof (*yylsp),
886 &yystacksize);
887 yyls = yyls1;
888 # else
889 yyoverflow ("parser stack overflow",
890 &yyss1, yysize * sizeof (*yyssp),
891 &yyvs1, yysize * sizeof (*yyvsp),
892 &yystacksize);
893 # endif
894 yyss = yyss1;
895 yyvs = yyvs1;
897 #else /* no yyoverflow */
898 /* Extend the stack our own way. */
899 if (yystacksize >= YYMAXDEPTH)
900 goto yyoverflowlab;
901 yystacksize *= 2;
902 if (yystacksize > YYMAXDEPTH)
903 yystacksize = YYMAXDEPTH;
906 short *yyss1 = yyss;
907 union yyalloc *yyptr =
908 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
909 if (! yyptr)
910 goto yyoverflowlab;
911 YYSTACK_RELOCATE (short, yyss);
912 YYSTACK_RELOCATE (YYSTYPE, yyvs);
913 # if YYLSP_NEEDED
914 YYSTACK_RELOCATE (YYLTYPE, yyls);
915 # endif
916 # undef YYSTACK_RELOCATE
917 if (yyss1 != yyssa)
918 YYSTACK_FREE (yyss1);
920 #endif /* no yyoverflow */
922 yyssp = yyss + yysize - 1;
923 yyvsp = yyvs + yysize - 1;
924 #if YYLSP_NEEDED
925 yylsp = yyls + yysize - 1;
926 #endif
928 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
929 (unsigned long int) yystacksize));
931 if (yyssp >= yyss + yystacksize - 1)
932 YYABORT;
935 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
937 goto yybackup;
940 /*-----------.
941 | yybackup. |
942 `-----------*/
943 yybackup:
945 /* Do appropriate processing given the current state. */
946 /* Read a lookahead token if we need one and don't already have one. */
947 /* yyresume: */
949 /* First try to decide what to do without reference to lookahead token. */
951 yyn = yypact[yystate];
952 if (yyn == YYFLAG)
953 goto yydefault;
955 /* Not known => get a lookahead token if don't already have one. */
957 /* yychar is either YYEMPTY or YYEOF
958 or a valid token in external form. */
960 if (yychar == YYEMPTY)
962 YYDPRINTF ((stderr, "Reading a token: "));
963 yychar = YYLEX;
966 /* Convert token to internal form (in yychar1) for indexing tables with */
968 if (yychar <= 0) /* This means end of input. */
970 yychar1 = 0;
971 yychar = YYEOF; /* Don't call YYLEX any more */
973 YYDPRINTF ((stderr, "Now at end of input.\n"));
975 else
977 yychar1 = YYTRANSLATE (yychar);
979 #if YYDEBUG
980 /* We have to keep this `#if YYDEBUG', since we use variables
981 which are defined only if `YYDEBUG' is set. */
982 if (yydebug)
984 YYFPRINTF (stderr, "Next token is %d (%s",
985 yychar, yytname[yychar1]);
986 /* Give the individual parser a way to print the precise
987 meaning of a token, for further debugging info. */
988 # ifdef YYPRINT
989 YYPRINT (stderr, yychar, yylval);
990 # endif
991 YYFPRINTF (stderr, ")\n");
993 #endif
996 yyn += yychar1;
997 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
998 goto yydefault;
1000 yyn = yytable[yyn];
1002 /* yyn is what to do for this token type in this state.
1003 Negative => reduce, -yyn is rule number.
1004 Positive => shift, yyn is new state.
1005 New state is final state => don't bother to shift,
1006 just return success.
1007 0, or most negative number => error. */
1009 if (yyn < 0)
1011 if (yyn == YYFLAG)
1012 goto yyerrlab;
1013 yyn = -yyn;
1014 goto yyreduce;
1016 else if (yyn == 0)
1017 goto yyerrlab;
1019 if (yyn == YYFINAL)
1020 YYACCEPT;
1022 /* Shift the lookahead token. */
1023 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1024 yychar, yytname[yychar1]));
1026 /* Discard the token being shifted unless it is eof. */
1027 if (yychar != YYEOF)
1028 yychar = YYEMPTY;
1030 *++yyvsp = yylval;
1031 #if YYLSP_NEEDED
1032 *++yylsp = yylloc;
1033 #endif
1035 /* Count tokens shifted since error; after three, turn off error
1036 status. */
1037 if (yyerrstatus)
1038 yyerrstatus--;
1040 yystate = yyn;
1041 goto yynewstate;
1044 /*-----------------------------------------------------------.
1045 | yydefault -- do the default action for the current state. |
1046 `-----------------------------------------------------------*/
1047 yydefault:
1048 yyn = yydefact[yystate];
1049 if (yyn == 0)
1050 goto yyerrlab;
1051 goto yyreduce;
1054 /*-----------------------------.
1055 | yyreduce -- Do a reduction. |
1056 `-----------------------------*/
1057 yyreduce:
1058 /* yyn is the number of a rule to reduce with. */
1059 yylen = yyr2[yyn];
1061 /* If YYLEN is nonzero, implement the default value of the action:
1062 `$$ = $1'.
1064 Otherwise, the following line sets YYVAL to the semantic value of
1065 the lookahead token. This behavior is undocumented and Bison
1066 users should not rely upon it. Assigning to YYVAL
1067 unconditionally makes the parser a bit smaller, and it avoids a
1068 GCC warning that YYVAL may be used uninitialized. */
1069 yyval = yyvsp[1-yylen];
1071 #if YYLSP_NEEDED
1072 /* Similarly for the default location. Let the user run additional
1073 commands if for instance locations are ranges. */
1074 yyloc = yylsp[1-yylen];
1075 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1076 #endif
1078 #if YYDEBUG
1079 /* We have to keep this `#if YYDEBUG', since we use variables which
1080 are defined only if `YYDEBUG' is set. */
1081 if (yydebug)
1083 int yyi;
1085 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1086 yyn, yyrline[yyn]);
1088 /* Print the symbols being reduced, and their result. */
1089 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
1090 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1091 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1093 #endif
1095 switch (yyn) {
1097 case 4:
1098 #line 127 "m68k-parse.y"
1100 op->mode = DREG;
1101 op->reg = yyvsp[0].reg;
1103 break;
1104 case 5:
1105 #line 132 "m68k-parse.y"
1107 op->mode = AREG;
1108 op->reg = yyvsp[0].reg;
1110 break;
1111 case 6:
1112 #line 137 "m68k-parse.y"
1114 op->mode = FPREG;
1115 op->reg = yyvsp[0].reg;
1117 break;
1118 case 7:
1119 #line 142 "m68k-parse.y"
1121 op->mode = CONTROL;
1122 op->reg = yyvsp[0].reg;
1124 break;
1125 case 8:
1126 #line 147 "m68k-parse.y"
1128 op->mode = CONTROL;
1129 op->reg = yyvsp[0].reg;
1131 break;
1132 case 9:
1133 #line 152 "m68k-parse.y"
1135 op->mode = ABSL;
1136 op->disp = yyvsp[0].exp;
1138 break;
1139 case 10:
1140 #line 157 "m68k-parse.y"
1142 op->mode = IMMED;
1143 op->disp = yyvsp[0].exp;
1145 break;
1146 case 11:
1147 #line 162 "m68k-parse.y"
1149 op->mode = IMMED;
1150 op->disp = yyvsp[0].exp;
1152 break;
1153 case 12:
1154 #line 167 "m68k-parse.y"
1156 op->mode = REGLST;
1157 op->mask = yyvsp[0].mask;
1159 break;
1160 case 13:
1161 #line 180 "m68k-parse.y"
1163 op->mode = AINDR;
1164 op->reg = yyvsp[-1].reg;
1166 break;
1167 case 14:
1168 #line 185 "m68k-parse.y"
1170 op->mode = AINC;
1171 op->reg = yyvsp[-2].reg;
1173 break;
1174 case 15:
1175 #line 190 "m68k-parse.y"
1177 op->mode = ADEC;
1178 op->reg = yyvsp[-1].reg;
1180 break;
1181 case 16:
1182 #line 195 "m68k-parse.y"
1184 op->reg = yyvsp[-1].reg;
1185 op->disp = yyvsp[-3].exp;
1186 if ((yyvsp[-1].reg >= ZADDR0 && yyvsp[-1].reg <= ZADDR7)
1187 || yyvsp[-1].reg == ZPC)
1188 op->mode = BASE;
1189 else
1190 op->mode = DISP;
1192 break;
1193 case 17:
1194 #line 205 "m68k-parse.y"
1196 op->reg = yyvsp[-3].reg;
1197 op->disp = yyvsp[-1].exp;
1198 if ((yyvsp[-3].reg >= ZADDR0 && yyvsp[-3].reg <= ZADDR7)
1199 || yyvsp[-3].reg == ZPC)
1200 op->mode = BASE;
1201 else
1202 op->mode = DISP;
1204 break;
1205 case 18:
1206 #line 215 "m68k-parse.y"
1208 op->reg = yyvsp[-1].reg;
1209 op->disp = yyvsp[-3].exp;
1210 if ((yyvsp[-1].reg >= ZADDR0 && yyvsp[-1].reg <= ZADDR7)
1211 || yyvsp[-1].reg == ZPC)
1212 op->mode = BASE;
1213 else
1214 op->mode = DISP;
1216 break;
1217 case 19:
1218 #line 225 "m68k-parse.y"
1220 op->mode = DISP;
1221 op->reg = yyvsp[-1].reg;
1223 break;
1224 case 20:
1225 #line 230 "m68k-parse.y"
1227 op->mode = BASE;
1228 op->reg = yyvsp[-1].reg;
1230 break;
1231 case 21:
1232 #line 235 "m68k-parse.y"
1234 op->mode = BASE;
1235 op->reg = yyvsp[-1].reg;
1237 break;
1238 case 22:
1239 #line 240 "m68k-parse.y"
1241 op->mode = BASE;
1242 op->reg = yyvsp[-3].reg;
1243 op->disp = yyvsp[-5].exp;
1244 op->index = yyvsp[-1].indexreg;
1246 break;
1247 case 23:
1248 #line 247 "m68k-parse.y"
1250 if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
1251 yyerror (_("syntax error"));
1252 op->mode = BASE;
1253 op->reg = yyvsp[-1].reg;
1254 op->disp = yyvsp[-5].exp;
1255 op->index.reg = yyvsp[-3].reg;
1256 op->index.size = SIZE_UNSPEC;
1257 op->index.scale = 1;
1259 break;
1260 case 24:
1261 #line 258 "m68k-parse.y"
1263 op->mode = BASE;
1264 op->reg = yyvsp[-1].reg;
1265 op->disp = yyvsp[-4].exp;
1266 op->index = yyvsp[-2].indexreg;
1268 break;
1269 case 25:
1270 #line 265 "m68k-parse.y"
1272 op->mode = BASE;
1273 op->disp = yyvsp[-1].exp;
1274 op->index = yyvsp[-3].indexreg;
1276 break;
1277 case 26:
1278 #line 271 "m68k-parse.y"
1280 op->mode = BASE;
1281 op->reg = yyvsp[-3].reg;
1282 op->disp = yyvsp[-5].exp;
1283 op->index = yyvsp[-1].indexreg;
1285 break;
1286 case 27:
1287 #line 278 "m68k-parse.y"
1289 op->mode = BASE;
1290 op->reg = yyvsp[-3].reg;
1291 op->index = yyvsp[-1].indexreg;
1293 break;
1294 case 28:
1295 #line 284 "m68k-parse.y"
1297 if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
1298 yyerror (_("syntax error"));
1299 op->mode = BASE;
1300 op->reg = yyvsp[-1].reg;
1301 op->disp = yyvsp[-5].exp;
1302 op->index.reg = yyvsp[-3].reg;
1303 op->index.size = SIZE_UNSPEC;
1304 op->index.scale = 1;
1306 break;
1307 case 29:
1308 #line 295 "m68k-parse.y"
1310 if (yyvsp[-3].reg == PC || yyvsp[-3].reg == ZPC)
1311 yyerror (_("syntax error"));
1312 op->mode = BASE;
1313 op->reg = yyvsp[-1].reg;
1314 op->index.reg = yyvsp[-3].reg;
1315 op->index.size = SIZE_UNSPEC;
1316 op->index.scale = 1;
1318 break;
1319 case 30:
1320 #line 305 "m68k-parse.y"
1322 op->mode = BASE;
1323 op->reg = yyvsp[-1].reg;
1324 op->disp = yyvsp[-4].exp;
1325 op->index = yyvsp[-2].indexreg;
1327 break;
1328 case 31:
1329 #line 312 "m68k-parse.y"
1331 op->mode = BASE;
1332 op->reg = yyvsp[-1].reg;
1333 op->index = yyvsp[-2].indexreg;
1335 break;
1336 case 32:
1337 #line 318 "m68k-parse.y"
1339 op->mode = POST;
1340 op->reg = yyvsp[-5].reg;
1341 op->disp = yyvsp[-6].exp;
1342 op->index = yyvsp[-2].indexreg;
1343 op->odisp = yyvsp[-1].exp;
1345 break;
1346 case 33:
1347 #line 326 "m68k-parse.y"
1349 op->mode = POST;
1350 op->reg = yyvsp[-3].reg;
1351 op->disp = yyvsp[-4].exp;
1352 op->odisp = yyvsp[-1].exp;
1354 break;
1355 case 34:
1356 #line 333 "m68k-parse.y"
1358 op->mode = POST;
1359 op->reg = yyvsp[-5].reg;
1360 op->index = yyvsp[-2].indexreg;
1361 op->odisp = yyvsp[-1].exp;
1363 break;
1364 case 35:
1365 #line 340 "m68k-parse.y"
1367 op->mode = POST;
1368 op->reg = yyvsp[-3].reg;
1369 op->odisp = yyvsp[-1].exp;
1371 break;
1372 case 36:
1373 #line 346 "m68k-parse.y"
1375 op->mode = PRE;
1376 op->reg = yyvsp[-5].reg;
1377 op->disp = yyvsp[-7].exp;
1378 op->index = yyvsp[-3].indexreg;
1379 op->odisp = yyvsp[-1].exp;
1381 break;
1382 case 37:
1383 #line 354 "m68k-parse.y"
1385 op->mode = PRE;
1386 op->reg = yyvsp[-5].reg;
1387 op->index = yyvsp[-3].indexreg;
1388 op->odisp = yyvsp[-1].exp;
1390 break;
1391 case 38:
1392 #line 361 "m68k-parse.y"
1394 if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC)
1395 yyerror (_("syntax error"));
1396 op->mode = PRE;
1397 op->reg = yyvsp[-3].reg;
1398 op->disp = yyvsp[-7].exp;
1399 op->index.reg = yyvsp[-5].reg;
1400 op->index.size = SIZE_UNSPEC;
1401 op->index.scale = 1;
1402 op->odisp = yyvsp[-1].exp;
1404 break;
1405 case 39:
1406 #line 373 "m68k-parse.y"
1408 if (yyvsp[-5].reg == PC || yyvsp[-5].reg == ZPC)
1409 yyerror (_("syntax error"));
1410 op->mode = PRE;
1411 op->reg = yyvsp[-3].reg;
1412 op->index.reg = yyvsp[-5].reg;
1413 op->index.size = SIZE_UNSPEC;
1414 op->index.scale = 1;
1415 op->odisp = yyvsp[-1].exp;
1417 break;
1418 case 40:
1419 #line 384 "m68k-parse.y"
1421 op->mode = PRE;
1422 op->reg = yyvsp[-3].reg;
1423 op->disp = yyvsp[-5].exp;
1424 op->index = yyvsp[-4].indexreg;
1425 op->odisp = yyvsp[-1].exp;
1427 break;
1428 case 41:
1429 #line 397 "m68k-parse.y"
1431 /* We use optzapc to avoid a shift/reduce conflict. */
1432 if (yyvsp[-1].reg < ADDR0 || yyvsp[-1].reg > ADDR7)
1433 yyerror (_("syntax error"));
1434 op->mode = AINDR;
1435 op->reg = yyvsp[-1].reg;
1437 break;
1438 case 42:
1439 #line 405 "m68k-parse.y"
1441 /* We use optzapc to avoid a shift/reduce conflict. */
1442 if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7)
1443 yyerror (_("syntax error"));
1444 op->mode = AINC;
1445 op->reg = yyvsp[-2].reg;
1447 break;
1448 case 43:
1449 #line 413 "m68k-parse.y"
1451 /* We use optzapc to avoid a shift/reduce conflict. */
1452 if (yyvsp[-2].reg < ADDR0 || yyvsp[-2].reg > ADDR7)
1453 yyerror (_("syntax error"));
1454 op->mode = ADEC;
1455 op->reg = yyvsp[-2].reg;
1457 break;
1458 case 44:
1459 #line 421 "m68k-parse.y"
1461 op->reg = yyvsp[-4].reg;
1462 op->disp = yyvsp[-1].exp;
1463 if ((yyvsp[-4].reg >= ZADDR0 && yyvsp[-4].reg <= ZADDR7)
1464 || yyvsp[-4].reg == ZPC)
1465 op->mode = BASE;
1466 else
1467 op->mode = DISP;
1469 break;
1470 case 45:
1471 #line 431 "m68k-parse.y"
1473 op->mode = BASE;
1474 op->reg = yyvsp[-5].reg;
1475 op->disp = yyvsp[-2].exp;
1476 op->index = yyvsp[-1].indexreg;
1478 break;
1479 case 46:
1480 #line 438 "m68k-parse.y"
1482 op->mode = POST;
1483 op->reg = yyvsp[-9].reg;
1484 op->disp = yyvsp[-6].exp;
1485 op->index = yyvsp[-1].indexreg;
1486 op->odisp = yyvsp[-2].exp;
1488 break;
1489 case 47:
1490 #line 446 "m68k-parse.y"
1492 op->mode = POST;
1493 op->reg = yyvsp[-8].reg;
1494 op->disp = yyvsp[-5].exp;
1495 op->odisp = yyvsp[-1].exp;
1497 break;
1498 case 48:
1499 #line 453 "m68k-parse.y"
1501 op->mode = PRE;
1502 op->reg = yyvsp[-9].reg;
1503 op->disp = yyvsp[-6].exp;
1504 op->index = yyvsp[-5].indexreg;
1505 op->odisp = yyvsp[-1].exp;
1507 break;
1508 case 50:
1509 #line 468 "m68k-parse.y"
1511 yyval.indexreg.reg = yyvsp[0].reg;
1512 yyval.indexreg.size = SIZE_UNSPEC;
1513 yyval.indexreg.scale = 1;
1515 break;
1516 case 52:
1517 #line 482 "m68k-parse.y"
1519 yyval.indexreg.reg = yyvsp[0].reg;
1520 yyval.indexreg.size = SIZE_UNSPEC;
1521 yyval.indexreg.scale = 1;
1523 break;
1524 case 63:
1525 #line 525 "m68k-parse.y"
1527 yyval.reg = ZADDR0;
1529 break;
1530 case 67:
1531 #line 542 "m68k-parse.y"
1533 yyval.reg = ZADDR0;
1535 break;
1536 case 68:
1537 #line 546 "m68k-parse.y"
1539 yyval.reg = yyvsp[0].reg;
1541 break;
1542 case 69:
1543 #line 555 "m68k-parse.y"
1545 yyval.exp.exp.X_op = O_absent;
1546 yyval.exp.size = SIZE_UNSPEC;
1548 break;
1549 case 70:
1550 #line 560 "m68k-parse.y"
1552 yyval.exp = yyvsp[0].exp;
1554 break;
1555 case 71:
1556 #line 569 "m68k-parse.y"
1558 yyval.exp.exp.X_op = O_absent;
1559 yyval.exp.size = SIZE_UNSPEC;
1561 break;
1562 case 72:
1563 #line 574 "m68k-parse.y"
1565 yyval.exp = yyvsp[-1].exp;
1567 break;
1568 case 74:
1569 #line 584 "m68k-parse.y"
1571 yyval.mask = yyvsp[-2].mask | yyvsp[0].mask;
1573 break;
1574 case 75:
1575 #line 588 "m68k-parse.y"
1577 yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask;
1579 break;
1580 case 76:
1581 #line 600 "m68k-parse.y"
1583 yyval.mask = 1 << yyvsp[0].onereg;
1585 break;
1586 case 78:
1587 #line 605 "m68k-parse.y"
1589 yyval.mask = yyvsp[-2].mask | yyvsp[0].mask;
1591 break;
1592 case 79:
1593 #line 609 "m68k-parse.y"
1595 yyval.mask = (1 << yyvsp[-2].onereg) | yyvsp[0].mask;
1597 break;
1598 case 80:
1599 #line 616 "m68k-parse.y"
1601 if (yyvsp[-2].onereg <= yyvsp[0].onereg)
1602 yyval.mask = (1 << (yyvsp[0].onereg + 1)) - 1 - ((1 << yyvsp[-2].onereg) - 1);
1603 else
1604 yyval.mask = (1 << (yyvsp[-2].onereg + 1)) - 1 - ((1 << yyvsp[0].onereg) - 1);
1606 break;
1607 case 81:
1608 #line 626 "m68k-parse.y"
1610 yyval.onereg = yyvsp[0].reg - DATA0;
1612 break;
1613 case 82:
1614 #line 630 "m68k-parse.y"
1616 yyval.onereg = yyvsp[0].reg - ADDR0 + 8;
1618 break;
1619 case 83:
1620 #line 634 "m68k-parse.y"
1622 yyval.onereg = yyvsp[0].reg - FP0 + 16;
1624 break;
1625 case 84:
1626 #line 638 "m68k-parse.y"
1628 if (yyvsp[0].reg == FPI)
1629 yyval.onereg = 24;
1630 else if (yyvsp[0].reg == FPS)
1631 yyval.onereg = 25;
1632 else
1633 yyval.onereg = 26;
1635 break;
1638 #line 727 "/usr/share/bison/bison.simple"
1641 yyvsp -= yylen;
1642 yyssp -= yylen;
1643 #if YYLSP_NEEDED
1644 yylsp -= yylen;
1645 #endif
1647 #if YYDEBUG
1648 if (yydebug)
1650 short *yyssp1 = yyss - 1;
1651 YYFPRINTF (stderr, "state stack now");
1652 while (yyssp1 != yyssp)
1653 YYFPRINTF (stderr, " %d", *++yyssp1);
1654 YYFPRINTF (stderr, "\n");
1656 #endif
1658 *++yyvsp = yyval;
1659 #if YYLSP_NEEDED
1660 *++yylsp = yyloc;
1661 #endif
1663 /* Now `shift' the result of the reduction. Determine what state
1664 that goes to, based on the state we popped back to and the rule
1665 number reduced by. */
1667 yyn = yyr1[yyn];
1669 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1670 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1671 yystate = yytable[yystate];
1672 else
1673 yystate = yydefgoto[yyn - YYNTBASE];
1675 goto yynewstate;
1678 /*------------------------------------.
1679 | yyerrlab -- here on detecting error |
1680 `------------------------------------*/
1681 yyerrlab:
1682 /* If not already recovering from an error, report this error. */
1683 if (!yyerrstatus)
1685 ++yynerrs;
1687 #ifdef YYERROR_VERBOSE
1688 yyn = yypact[yystate];
1690 if (yyn > YYFLAG && yyn < YYLAST)
1692 YYSIZE_T yysize = 0;
1693 char *yymsg;
1694 int yyx, yycount;
1696 yycount = 0;
1697 /* Start YYX at -YYN if negative to avoid negative indexes in
1698 YYCHECK. */
1699 for (yyx = yyn < 0 ? -yyn : 0;
1700 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1701 if (yycheck[yyx + yyn] == yyx)
1702 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1703 yysize += yystrlen ("parse error, unexpected ") + 1;
1704 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1705 yymsg = (char *) YYSTACK_ALLOC (yysize);
1706 if (yymsg != 0)
1708 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1709 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1711 if (yycount < 5)
1713 yycount = 0;
1714 for (yyx = yyn < 0 ? -yyn : 0;
1715 yyx < (int) (sizeof (yytname) / sizeof (char *));
1716 yyx++)
1717 if (yycheck[yyx + yyn] == yyx)
1719 const char *yyq = ! yycount ? ", expecting " : " or ";
1720 yyp = yystpcpy (yyp, yyq);
1721 yyp = yystpcpy (yyp, yytname[yyx]);
1722 yycount++;
1725 yyerror (yymsg);
1726 YYSTACK_FREE (yymsg);
1728 else
1729 yyerror ("parse error; also virtual memory exhausted");
1731 else
1732 #endif /* defined (YYERROR_VERBOSE) */
1733 yyerror ("parse error");
1735 goto yyerrlab1;
1738 /*--------------------------------------------------.
1739 | yyerrlab1 -- error raised explicitly by an action |
1740 `--------------------------------------------------*/
1741 yyerrlab1:
1742 if (yyerrstatus == 3)
1744 /* If just tried and failed to reuse lookahead token after an
1745 error, discard it. */
1747 /* return failure if at end of input */
1748 if (yychar == YYEOF)
1749 YYABORT;
1750 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1751 yychar, yytname[yychar1]));
1752 yychar = YYEMPTY;
1755 /* Else will try to reuse lookahead token after shifting the error
1756 token. */
1758 yyerrstatus = 3; /* Each real token shifted decrements this */
1760 goto yyerrhandle;
1763 /*-------------------------------------------------------------------.
1764 | yyerrdefault -- current state does not do anything special for the |
1765 | error token. |
1766 `-------------------------------------------------------------------*/
1767 yyerrdefault:
1768 #if 0
1769 /* This is wrong; only states that explicitly want error tokens
1770 should shift them. */
1772 /* If its default is to accept any token, ok. Otherwise pop it. */
1773 yyn = yydefact[yystate];
1774 if (yyn)
1775 goto yydefault;
1776 #endif
1779 /*---------------------------------------------------------------.
1780 | yyerrpop -- pop the current state because it cannot handle the |
1781 | error token |
1782 `---------------------------------------------------------------*/
1783 yyerrpop:
1784 if (yyssp == yyss)
1785 YYABORT;
1786 yyvsp--;
1787 yystate = *--yyssp;
1788 #if YYLSP_NEEDED
1789 yylsp--;
1790 #endif
1792 #if YYDEBUG
1793 if (yydebug)
1795 short *yyssp1 = yyss - 1;
1796 YYFPRINTF (stderr, "Error: state stack now");
1797 while (yyssp1 != yyssp)
1798 YYFPRINTF (stderr, " %d", *++yyssp1);
1799 YYFPRINTF (stderr, "\n");
1801 #endif
1803 /*--------------.
1804 | yyerrhandle. |
1805 `--------------*/
1806 yyerrhandle:
1807 yyn = yypact[yystate];
1808 if (yyn == YYFLAG)
1809 goto yyerrdefault;
1811 yyn += YYTERROR;
1812 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1813 goto yyerrdefault;
1815 yyn = yytable[yyn];
1816 if (yyn < 0)
1818 if (yyn == YYFLAG)
1819 goto yyerrpop;
1820 yyn = -yyn;
1821 goto yyreduce;
1823 else if (yyn == 0)
1824 goto yyerrpop;
1826 if (yyn == YYFINAL)
1827 YYACCEPT;
1829 YYDPRINTF ((stderr, "Shifting error token, "));
1831 *++yyvsp = yylval;
1832 #if YYLSP_NEEDED
1833 *++yylsp = yylloc;
1834 #endif
1836 yystate = yyn;
1837 goto yynewstate;
1840 /*-------------------------------------.
1841 | yyacceptlab -- YYACCEPT comes here. |
1842 `-------------------------------------*/
1843 yyacceptlab:
1844 yyresult = 0;
1845 goto yyreturn;
1847 /*-----------------------------------.
1848 | yyabortlab -- YYABORT comes here. |
1849 `-----------------------------------*/
1850 yyabortlab:
1851 yyresult = 1;
1852 goto yyreturn;
1854 /*---------------------------------------------.
1855 | yyoverflowab -- parser overflow comes here. |
1856 `---------------------------------------------*/
1857 yyoverflowlab:
1858 yyerror ("parser stack overflow");
1859 yyresult = 2;
1860 /* Fall through. */
1862 yyreturn:
1863 #ifndef yyoverflow
1864 if (yyss != yyssa)
1865 YYSTACK_FREE (yyss);
1866 #endif
1867 return yyresult;
1869 #line 648 "m68k-parse.y"
1872 /* The string to parse is stored here, and modified by yylex. */
1874 static char *str;
1876 /* The original string pointer. */
1878 static char *strorig;
1880 /* If *CCP could be a register, return the register number and advance
1881 *CCP. Otherwise don't change *CCP, and return 0. */
1883 static enum m68k_register
1884 m68k_reg_parse (ccp)
1885 register char **ccp;
1887 char *start = *ccp;
1888 char c;
1889 char *p;
1890 symbolS *symbolp;
1892 if (flag_reg_prefix_optional)
1894 if (*start == REGISTER_PREFIX)
1895 start++;
1896 p = start;
1898 else
1900 if (*start != REGISTER_PREFIX)
1901 return 0;
1902 p = start + 1;
1905 if (! is_name_beginner (*p))
1906 return 0;
1908 p++;
1909 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
1910 p++;
1912 c = *p;
1913 *p = 0;
1914 symbolp = symbol_find (start);
1915 *p = c;
1917 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
1919 *ccp = p;
1920 return S_GET_VALUE (symbolp);
1923 /* In MRI mode, something like foo.bar can be equated to a register
1924 name. */
1925 while (flag_mri && c == '.')
1927 ++p;
1928 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
1929 p++;
1930 c = *p;
1931 *p = '\0';
1932 symbolp = symbol_find (start);
1933 *p = c;
1934 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
1936 *ccp = p;
1937 return S_GET_VALUE (symbolp);
1941 return 0;
1944 /* The lexer. */
1946 static int
1947 yylex ()
1949 enum m68k_register reg;
1950 char *s;
1951 int parens;
1952 int c = 0;
1953 int tail = 0;
1954 char *hold;
1956 if (*str == ' ')
1957 ++str;
1959 if (*str == '\0')
1960 return 0;
1962 /* Various special characters are just returned directly. */
1963 switch (*str)
1965 case '@':
1966 /* In MRI mode, this can be the start of an octal number. */
1967 if (flag_mri)
1969 if (ISDIGIT (str[1])
1970 || ((str[1] == '+' || str[1] == '-')
1971 && ISDIGIT (str[2])))
1972 break;
1974 /* Fall through. */
1975 case '#':
1976 case '&':
1977 case ',':
1978 case ')':
1979 case '/':
1980 case '[':
1981 case ']':
1982 return *str++;
1983 case '+':
1984 /* It so happens that a '+' can only appear at the end of an
1985 operand. If it appears anywhere else, it must be a unary
1986 plus on an expression. */
1987 if (str[1] == '\0')
1988 return *str++;
1989 break;
1990 case '-':
1991 /* A '-' can only appear in -(ar), rn-rn, or ar@-. If it
1992 appears anywhere else, it must be a unary minus on an
1993 expression. */
1994 if (str[1] == '\0')
1995 return *str++;
1996 s = str + 1;
1997 if (*s == '(')
1998 ++s;
1999 if (m68k_reg_parse (&s) != 0)
2000 return *str++;
2001 break;
2002 case '(':
2003 /* A '(' can only appear in `(reg)', `(expr,...', `([', `@(', or
2004 `)('. If it appears anywhere else, it must be starting an
2005 expression. */
2006 if (str[1] == '['
2007 || (str > strorig
2008 && (str[-1] == '@'
2009 || str[-1] == ')')))
2010 return *str++;
2011 s = str + 1;
2012 if (m68k_reg_parse (&s) != 0)
2013 return *str++;
2014 /* Check for the case of '(expr,...' by scanning ahead. If we
2015 find a comma outside of balanced parentheses, we return '('.
2016 If we find an unbalanced right parenthesis, then presumably
2017 the '(' really starts an expression. */
2018 parens = 0;
2019 for (s = str + 1; *s != '\0'; s++)
2021 if (*s == '(')
2022 ++parens;
2023 else if (*s == ')')
2025 if (parens == 0)
2026 break;
2027 --parens;
2029 else if (*s == ',' && parens == 0)
2031 /* A comma can not normally appear in an expression, so
2032 this is a case of '(expr,...'. */
2033 return *str++;
2038 /* See if it's a register. */
2040 reg = m68k_reg_parse (&str);
2041 if (reg != 0)
2043 int ret;
2045 yylval.reg = reg;
2047 if (reg >= DATA0 && reg <= DATA7)
2048 ret = DR;
2049 else if (reg >= ADDR0 && reg <= ADDR7)
2050 ret = AR;
2051 else if (reg >= FP0 && reg <= FP7)
2052 return FPR;
2053 else if (reg == FPI
2054 || reg == FPS
2055 || reg == FPC)
2056 return FPCR;
2057 else if (reg == PC)
2058 return LPC;
2059 else if (reg >= ZDATA0 && reg <= ZDATA7)
2060 ret = ZDR;
2061 else if (reg >= ZADDR0 && reg <= ZADDR7)
2062 ret = ZAR;
2063 else if (reg == ZPC)
2064 return LZPC;
2065 else
2066 return CREG;
2068 /* If we get here, we have a data or address register. We
2069 must check for a size or scale; if we find one, we must
2070 return INDEXREG. */
2072 s = str;
2074 if (*s != '.' && *s != ':' && *s != '*')
2075 return ret;
2077 yylval.indexreg.reg = reg;
2079 if (*s != '.' && *s != ':')
2080 yylval.indexreg.size = SIZE_UNSPEC;
2081 else
2083 ++s;
2084 switch (*s)
2086 case 'w':
2087 case 'W':
2088 yylval.indexreg.size = SIZE_WORD;
2089 ++s;
2090 break;
2091 case 'l':
2092 case 'L':
2093 yylval.indexreg.size = SIZE_LONG;
2094 ++s;
2095 break;
2096 default:
2097 yyerror (_("illegal size specification"));
2098 yylval.indexreg.size = SIZE_UNSPEC;
2099 break;
2103 yylval.indexreg.scale = 1;
2105 if (*s == '*' || *s == ':')
2107 expressionS scale;
2109 ++s;
2111 hold = input_line_pointer;
2112 input_line_pointer = s;
2113 expression (&scale);
2114 s = input_line_pointer;
2115 input_line_pointer = hold;
2117 if (scale.X_op != O_constant)
2118 yyerror (_("scale specification must resolve to a number"));
2119 else
2121 switch (scale.X_add_number)
2123 case 1:
2124 case 2:
2125 case 4:
2126 case 8:
2127 yylval.indexreg.scale = scale.X_add_number;
2128 break;
2129 default:
2130 yyerror (_("invalid scale value"));
2131 break;
2136 str = s;
2138 return INDEXREG;
2141 /* It must be an expression. Before we call expression, we need to
2142 look ahead to see if there is a size specification. We must do
2143 that first, because otherwise foo.l will be treated as the symbol
2144 foo.l, rather than as the symbol foo with a long size
2145 specification. The grammar requires that all expressions end at
2146 the end of the operand, or with ',', '(', ']', ')'. */
2148 parens = 0;
2149 for (s = str; *s != '\0'; s++)
2151 if (*s == '(')
2153 if (parens == 0
2154 && s > str
2155 && (s[-1] == ')' || ISALNUM (s[-1])))
2156 break;
2157 ++parens;
2159 else if (*s == ')')
2161 if (parens == 0)
2162 break;
2163 --parens;
2165 else if (parens == 0
2166 && (*s == ',' || *s == ']'))
2167 break;
2170 yylval.exp.size = SIZE_UNSPEC;
2171 if (s <= str + 2
2172 || (s[-2] != '.' && s[-2] != ':'))
2173 tail = 0;
2174 else
2176 switch (s[-1])
2178 case 's':
2179 case 'S':
2180 case 'b':
2181 case 'B':
2182 yylval.exp.size = SIZE_BYTE;
2183 break;
2184 case 'w':
2185 case 'W':
2186 yylval.exp.size = SIZE_WORD;
2187 break;
2188 case 'l':
2189 case 'L':
2190 yylval.exp.size = SIZE_LONG;
2191 break;
2192 default:
2193 break;
2195 if (yylval.exp.size != SIZE_UNSPEC)
2196 tail = 2;
2199 #ifdef OBJ_ELF
2201 /* Look for @PLTPC, etc. */
2202 char *cp;
2204 yylval.exp.pic_reloc = pic_none;
2205 cp = s - tail;
2206 if (cp - 6 > str && cp[-6] == '@')
2208 if (strncmp (cp - 6, "@PLTPC", 6) == 0)
2210 yylval.exp.pic_reloc = pic_plt_pcrel;
2211 tail += 6;
2213 else if (strncmp (cp - 6, "@GOTPC", 6) == 0)
2215 yylval.exp.pic_reloc = pic_got_pcrel;
2216 tail += 6;
2219 else if (cp - 4 > str && cp[-4] == '@')
2221 if (strncmp (cp - 4, "@PLT", 4) == 0)
2223 yylval.exp.pic_reloc = pic_plt_off;
2224 tail += 4;
2226 else if (strncmp (cp - 4, "@GOT", 4) == 0)
2228 yylval.exp.pic_reloc = pic_got_off;
2229 tail += 4;
2233 #endif
2235 if (tail != 0)
2237 c = s[-tail];
2238 s[-tail] = 0;
2241 hold = input_line_pointer;
2242 input_line_pointer = str;
2243 expression (&yylval.exp.exp);
2244 str = input_line_pointer;
2245 input_line_pointer = hold;
2247 if (tail != 0)
2249 s[-tail] = c;
2250 str = s;
2253 return EXPR;
2256 /* Parse an m68k operand. This is the only function which is called
2257 from outside this file. */
2260 m68k_ip_op (s, oparg)
2261 char *s;
2262 struct m68k_op *oparg;
2264 memset (oparg, 0, sizeof *oparg);
2265 oparg->error = NULL;
2266 oparg->index.reg = ZDATA0;
2267 oparg->index.scale = 1;
2268 oparg->disp.exp.X_op = O_absent;
2269 oparg->odisp.exp.X_op = O_absent;
2271 str = strorig = s;
2272 op = oparg;
2274 return yyparse ();
2277 /* The error handler. */
2279 static void
2280 yyerror (s)
2281 const char *s;
2283 op->error = s;