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