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