source: trunk/src/binutils/gas/m68k-parse.c@ 610

Last change on this file since 610 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

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