1/* A Bison parser, made by GNU Bison 3.0.  */
2
3/* Bison implementation for Yacc-like parsers in C
4
5   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6
7   This program is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20/* As a special exception, you may create a larger work that contains
21   part or all of the Bison parser skeleton and distribute that work
22   under terms of your choice, so long as that work isn't itself a
23   parser generator using the skeleton or a modified version thereof
24   as a parser skeleton.  Alternatively, if you modify or redistribute
25   the parser skeleton itself, you may (at your option) remove this
26   special exception, which will cause the skeleton and the resulting
27   Bison output files to be licensed under the GNU General Public
28   License without this special exception.
29
30   This special exception was added by the Free Software Foundation in
31   version 2.2 of Bison.  */
32
33/* C LALR(1) parser skeleton written by Richard Stallman, by
34   simplifying the original so-called "semantic" parser.  */
35
36/* All symbols defined below should begin with yy or YY, to avoid
37   infringing on user name space.  This should be done even for local
38   variables, as they might otherwise be expanded by user macros.
39   There are some unavoidable exceptions within include files to
40   define necessary library symbols; they are noted "INFRINGES ON
41   USER NAME SPACE" below.  */
42
43/* Identify Bison output.  */
44#define YYBISON 1
45
46/* Bison version.  */
47#define YYBISON_VERSION "3.0"
48
49/* Skeleton name.  */
50#define YYSKELETON_NAME "yacc.c"
51
52/* Pure parsers.  */
53#define YYPURE 0
54
55/* Push parsers.  */
56#define YYPUSH 0
57
58/* Pull parsers.  */
59#define YYPULL 1
60
61
62
63
64/* Copy the first part of user declarations.  */
65#line 21 "./itbl-parse.y" /* yacc.c:339  */
66
67
68/*
69
70Yacc grammar for instruction table entries.
71
72=======================================================================
73Original Instruction table specification document:
74
75	    MIPS Coprocessor Table Specification
76	    ====================================
77
78This document describes the format of the MIPS coprocessor table.  The
79table specifies a list of valid functions, data registers and control
80registers that can be used in coprocessor instructions.  This list,
81together with the coprocessor instruction classes listed below,
82specifies the complete list of coprocessor instructions that will
83be recognized and assembled by the GNU assembler.  In effect,
84this makes the GNU assembler table-driven, where the table is
85specified by the programmer.
86
87The table is an ordinary text file that the GNU assembler reads when
88it starts.  Using the information in the table, the assembler
89generates an internal list of valid coprocessor registers and
90functions.  The assembler uses this internal list in addition to the
91standard MIPS registers and instructions which are built-in to the
92assembler during code generation.
93
94To specify the coprocessor table when invoking the GNU assembler, use
95the command line option "--itbl file", where file is the
96complete name of the table, including path and extension.
97
98Examples:
99
100	    gas -t cop.tbl test.s -o test.o
101	    gas -t /usr/local/lib/cop.tbl test.s -o test.o
102	    gas --itbl d:\gnu\data\cop.tbl test.s -o test.o
103
104Only one table may be supplied during a single invocation of
105the assembler.
106
107
108Instruction classes
109===================
110
111Below is a list of the valid coprocessor instruction classes for
112any given coprocessor "z".  These instructions are already recognized
113by the assembler, and are listed here only for reference.
114
115Class   format	    	    	      instructions
116-------------------------------------------------
117Class1:
118	op base rt offset
119	    	    	    	    	    	    	    LWCz rt,offset (base)
120	    	    	    	    	    	    	    SWCz rt,offset (base)
121Class2:
122	COPz sub rt rd 0
123	    	    	    	    	    	    	    MTCz rt,rd
124	    	    	    	    	    	    	    MFCz rt,rd
125	    	    	    	    	    	    	    CTCz rt,rd
126	    	    	    	    	    	    	    CFCz rt,rd
127Class3:
128	COPz CO cofun
129	    	    	    	    	    	    	    COPz cofun
130Class4:
131	COPz BC br offset
132	    	    	    	    	    	    	    BCzT offset
133	    	    	    	    	    	    	    BCzF offset
134Class5:
135	COPz sub rt rd 0
136	    	    	    	    	    	    	    DMFCz rt,rd
137	    	    	    	    	    	    	    DMTCz rt,rd
138Class6:
139	op base rt offset
140	    	    	    	    	    	    	    LDCz rt,offset (base)
141	    	    	    	    	    	    	    SDCz rt,offset (base)
142Class7:
143	COPz BC br offset
144	    	    	    	    	    	    	    BCzTL offset
145	    	    	    	    	    	    	    BCzFL offset
146
147The coprocessor table defines coprocessor-specific registers that can
148be used with all of the above classes of instructions, where
149appropriate.  It also defines additional coprocessor-specific
150functions for Class3 (COPz cofun) instructions, Thus, the table allows
151the programmer to use convenient mnemonics and operands for these
152functions, instead of the COPz mmenmonic and cofun operand.
153
154The names of the MIPS general registers and their aliases are defined
155by the assembler and will be recognized as valid register names by the
156assembler when used (where allowed) in coprocessor instructions.
157However, the names and values of all coprocessor data and control
158register mnemonics must be specified in the coprocessor table.
159
160
161Table Grammar
162=============
163
164Here is the grammar for the coprocessor table:
165
166	    table -> entry*
167
168	    entry -> [z entrydef] [comment] '\n'
169
170	    entrydef -> type name val
171	    entrydef -> 'insn' name val funcdef ; type of entry (instruction)
172
173	    z -> 'p'['0'..'3']	    	     ; processor number
174	    type -> ['dreg' | 'creg' | 'greg' ]	     ; type of entry (register)
175	; 'dreg', 'creg' or 'greg' specifies a data, control, or general
176	;	    register mnemonic, respectively
177	    name -> [ltr|dec]*	    	     ; mnemonic of register/function
178	    val -> [dec|hex]	    	     ; register/function number (integer constant)
179
180	    funcdef -> frange flags fields
181	    	    	    	; bitfield range for opcode
182	    	    	    	; list of fields' formats
183	    fields -> field*
184	    field -> [','] ftype frange flags
185	    flags -> ['*' flagexpr]
186	    flagexpr -> '[' flagexpr ']'
187	    flagexpr -> val '|' flagexpr
188	    ftype -> [ type | 'immed' | 'addr' ]
189	; 'immed' specifies an immediate value; see grammar for "val" above
190	    	; 'addr' specifies a C identifier; name of symbol to be resolved at
191	;	    link time
192	    frange -> ':' val '-' val	; starting to ending bit positions, where
193	    	    	    	; where 0 is least significant bit
194	    frange -> (null)	    	; default range of 31-0 will be assumed
195
196	    comment -> [';'|'#'] [char]*
197	    char -> any printable character
198	    ltr -> ['a'..'z'|'A'..'Z']
199	    dec -> ['0'..'9']*	    	    	    	    	     ; value in decimal
200	    hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']*	; value in hexadecimal
201
202
203Examples
204========
205
206Example 1:
207
208The table:
209
210	    p1 dreg d1 1	     ; data register "d1" for COP1 has value 1
211	    p1 creg c3 3	     ; ctrl register "c3" for COP1 has value 3
212	    p3 func fill 0x1f:24-20	      ; function "fill" for COP3 has value 31 and
213	    	    	; no fields
214
215will allow the assembler to accept the following coprocessor instructions:
216
217	    LWC1 d1,0x100 ($2)
218	    fill
219
220Here, the general purpose register "$2", and instruction "LWC1", are standard
221mnemonics built-in to the MIPS assembler.
222
223
224Example 2:
225
226The table:
227
228	    p3 dreg d3 3	     ; data register "d3" for COP3 has value 3
229	    p3 creg c2 22	     ; control register "c2" for COP3 has value 22
230	    p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0
231	    	; function "fee" for COP3 has value 31, and 3 fields
232	    	; consisting of a data register, a control register,
233	    	; and an immediate value.
234
235will allow the assembler to accept the following coprocessor instruction:
236
237	    fee d3,c2,0x1
238
239and will emit the object code:
240
241	    31-26  25 24-20 19-18  17-13 12-8  7-0
242	    COPz   CO fun	    	      dreg  creg  immed
243	    010011 1  11111 00	     00011 10110 00000001
244
245	    0x4ff07601
246
247
248Example 3:
249
250The table:
251
252	    p3 dreg d3 3	     ; data register "d3" for COP3 has value 3
253	    p3 creg c2 22	     ; control register "c2" for COP3 has value 22
254	    p3 func fuu 0x01f00001 dreg:17-13 creg:12-8
255
256will allow the assembler to accept the following coprocessor
257instruction:
258
259	    fuu d3,c2
260
261and will emit the object code:
262
263	    31-26  25 24-20 19-18  17-13 12-8  7-0
264	    COPz   CO fun	    	      dreg  creg
265	    010011 1  11111 00	     00011 10110 00000001
266
267	    0x4ff07601
268
269In this way, the programmer can force arbitrary bits of an instruction
270to have predefined values.
271
272=======================================================================
273Additional notes:
274
275Encoding of ranges:
276To handle more than one bit position range within an instruction,
277use 0s to mask out the ranges which don't apply.
278May decide to modify the syntax to allow commas separate multiple
279ranges within an instruction (range','range).
280
281Changes in grammar:
282	The number of parms argument to the function entry
283was deleted from the original format such that we now count the fields.
284
285----
286FIXME! should really change lexical analyzer
287to recognize 'dreg' etc. in context sensitive way.
288Currently function names or mnemonics may be incorrectly parsed as keywords
289
290FIXME! hex is ambiguous with any digit
291
292*/
293
294#include "as.h"
295#include "itbl-lex.h"
296#include "itbl-ops.h"
297
298/* #define DEBUG */
299
300#ifdef DEBUG
301#ifndef DBG_LVL
302#define DBG_LVL 1
303#endif
304#else
305#define DBG_LVL 0
306#endif
307
308#if DBG_LVL >= 1
309#define DBG(x) printf x
310#else
311#define DBG(x)
312#endif
313
314#if DBG_LVL >= 2
315#define DBGL2(x) printf x
316#else
317#define DBGL2(x)
318#endif
319
320static int sbit, ebit;
321static struct itbl_entry *insn=0;
322static int yyerror (const char *);
323
324
325#line 326 "itbl-parse.c" /* yacc.c:339  */
326
327# ifndef YY_NULL
328#  if defined __cplusplus && 201103L <= __cplusplus
329#   define YY_NULL nullptr
330#  else
331#   define YY_NULL 0
332#  endif
333# endif
334
335/* Enabling verbose error messages.  */
336#ifdef YYERROR_VERBOSE
337# undef YYERROR_VERBOSE
338# define YYERROR_VERBOSE 1
339#else
340# define YYERROR_VERBOSE 0
341#endif
342
343/* In a future release of Bison, this section will be replaced
344   by #include "y.tab.h".  */
345#ifndef YY_YY_ITBL_PARSE_H_INCLUDED
346# define YY_YY_ITBL_PARSE_H_INCLUDED
347/* Debug traces.  */
348#ifndef YYDEBUG
349# define YYDEBUG 0
350#endif
351#if YYDEBUG
352extern int yydebug;
353#endif
354
355/* Token type.  */
356#ifndef YYTOKENTYPE
357# define YYTOKENTYPE
358  enum yytokentype
359  {
360    DREG = 258,
361    CREG = 259,
362    GREG = 260,
363    IMMED = 261,
364    ADDR = 262,
365    INSN = 263,
366    NUM = 264,
367    ID = 265,
368    NL = 266,
369    PNUM = 267
370  };
371#endif
372/* Tokens.  */
373#define DREG 258
374#define CREG 259
375#define GREG 260
376#define IMMED 261
377#define ADDR 262
378#define INSN 263
379#define NUM 264
380#define ID 265
381#define NL 266
382#define PNUM 267
383
384/* Value type.  */
385#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
386typedef union YYSTYPE YYSTYPE;
387union YYSTYPE
388{
389#line 282 "./itbl-parse.y" /* yacc.c:355  */
390
391    char *str;
392    int num;
393    int processor;
394    unsigned long val;
395
396
397#line 398 "itbl-parse.c" /* yacc.c:355  */
398};
399# define YYSTYPE_IS_TRIVIAL 1
400# define YYSTYPE_IS_DECLARED 1
401#endif
402
403
404extern YYSTYPE yylval;
405
406int yyparse (void);
407
408#endif /* !YY_YY_ITBL_PARSE_H_INCLUDED  */
409
410/* Copy the second part of user declarations.  */
411
412#line 413 "itbl-parse.c" /* yacc.c:358  */
413
414#ifdef short
415# undef short
416#endif
417
418#ifdef YYTYPE_UINT8
419typedef YYTYPE_UINT8 yytype_uint8;
420#else
421typedef unsigned char yytype_uint8;
422#endif
423
424#ifdef YYTYPE_INT8
425typedef YYTYPE_INT8 yytype_int8;
426#else
427typedef signed char yytype_int8;
428#endif
429
430#ifdef YYTYPE_UINT16
431typedef YYTYPE_UINT16 yytype_uint16;
432#else
433typedef unsigned short int yytype_uint16;
434#endif
435
436#ifdef YYTYPE_INT16
437typedef YYTYPE_INT16 yytype_int16;
438#else
439typedef short int yytype_int16;
440#endif
441
442#ifndef YYSIZE_T
443# ifdef __SIZE_TYPE__
444#  define YYSIZE_T __SIZE_TYPE__
445# elif defined size_t
446#  define YYSIZE_T size_t
447# elif ! defined YYSIZE_T
448#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
449#  define YYSIZE_T size_t
450# else
451#  define YYSIZE_T unsigned int
452# endif
453#endif
454
455#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
456
457#ifndef YY_
458# if defined YYENABLE_NLS && YYENABLE_NLS
459#  if ENABLE_NLS
460#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
461#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
462#  endif
463# endif
464# ifndef YY_
465#  define YY_(Msgid) Msgid
466# endif
467#endif
468
469#ifndef __attribute__
470/* This feature is available in gcc versions 2.5 and later.  */
471# if (! defined __GNUC__ || __GNUC__ < 2 \
472      || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
473#  define __attribute__(Spec) /* empty */
474# endif
475#endif
476
477/* Suppress unused-variable warnings by "using" E.  */
478#if ! defined lint || defined __GNUC__
479# define YYUSE(E) ((void) (E))
480#else
481# define YYUSE(E) /* empty */
482#endif
483
484#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
485/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
486# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
487    _Pragma ("GCC diagnostic push") \
488    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
489    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
490# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
491    _Pragma ("GCC diagnostic pop")
492#else
493# define YY_INITIAL_VALUE(Value) Value
494#endif
495#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
496# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
497# define YY_IGNORE_MAYBE_UNINITIALIZED_END
498#endif
499#ifndef YY_INITIAL_VALUE
500# define YY_INITIAL_VALUE(Value) /* Nothing. */
501#endif
502
503
504#if ! defined yyoverflow || YYERROR_VERBOSE
505
506/* The parser invokes alloca or malloc; define the necessary symbols.  */
507
508# ifdef YYSTACK_USE_ALLOCA
509#  if YYSTACK_USE_ALLOCA
510#   ifdef __GNUC__
511#    define YYSTACK_ALLOC __builtin_alloca
512#   elif defined __BUILTIN_VA_ARG_INCR
513#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
514#   elif defined _AIX
515#    define YYSTACK_ALLOC __alloca
516#   elif defined _MSC_VER
517#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
518#    define alloca _alloca
519#   else
520#    define YYSTACK_ALLOC alloca
521#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
522#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
523      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
524#     ifndef EXIT_SUCCESS
525#      define EXIT_SUCCESS 0
526#     endif
527#    endif
528#   endif
529#  endif
530# endif
531
532# ifdef YYSTACK_ALLOC
533   /* Pacify GCC's 'empty if-body' warning.  */
534#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
535#  ifndef YYSTACK_ALLOC_MAXIMUM
536    /* The OS might guarantee only one guard page at the bottom of the stack,
537       and a page size can be as small as 4096 bytes.  So we cannot safely
538       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
539       to allow for a few compiler-allocated temporary stack slots.  */
540#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
541#  endif
542# else
543#  define YYSTACK_ALLOC YYMALLOC
544#  define YYSTACK_FREE YYFREE
545#  ifndef YYSTACK_ALLOC_MAXIMUM
546#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
547#  endif
548#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
549       && ! ((defined YYMALLOC || defined malloc) \
550             && (defined YYFREE || defined free)))
551#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
552#   ifndef EXIT_SUCCESS
553#    define EXIT_SUCCESS 0
554#   endif
555#  endif
556#  ifndef YYMALLOC
557#   define YYMALLOC malloc
558#   if ! defined malloc && ! defined EXIT_SUCCESS
559void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
560#   endif
561#  endif
562#  ifndef YYFREE
563#   define YYFREE free
564#   if ! defined free && ! defined EXIT_SUCCESS
565void free (void *); /* INFRINGES ON USER NAME SPACE */
566#   endif
567#  endif
568# endif
569#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
570
571
572#if (! defined yyoverflow \
573     && (! defined __cplusplus \
574         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
575
576/* A type that is properly aligned for any stack member.  */
577union yyalloc
578{
579  yytype_int16 yyss_alloc;
580  YYSTYPE yyvs_alloc;
581};
582
583/* The size of the maximum gap between one aligned stack and the next.  */
584# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
585
586/* The size of an array large to enough to hold all stacks, each with
587   N elements.  */
588# define YYSTACK_BYTES(N) \
589     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
590      + YYSTACK_GAP_MAXIMUM)
591
592# define YYCOPY_NEEDED 1
593
594/* Relocate STACK from its old location to the new one.  The
595   local variables YYSIZE and YYSTACKSIZE give the old and new number of
596   elements in the stack, and YYPTR gives the new location of the
597   stack.  Advance YYPTR to a properly aligned location for the next
598   stack.  */
599# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
600    do                                                                  \
601      {                                                                 \
602        YYSIZE_T yynewbytes;                                            \
603        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
604        Stack = &yyptr->Stack_alloc;                                    \
605        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
606        yyptr += yynewbytes / sizeof (*yyptr);                          \
607      }                                                                 \
608    while (0)
609
610#endif
611
612#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
613/* Copy COUNT objects from SRC to DST.  The source and destination do
614   not overlap.  */
615# ifndef YYCOPY
616#  if defined __GNUC__ && 1 < __GNUC__
617#   define YYCOPY(Dst, Src, Count) \
618      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
619#  else
620#   define YYCOPY(Dst, Src, Count)              \
621      do                                        \
622        {                                       \
623          YYSIZE_T yyi;                         \
624          for (yyi = 0; yyi < (Count); yyi++)   \
625            (Dst)[yyi] = (Src)[yyi];            \
626        }                                       \
627      while (0)
628#  endif
629# endif
630#endif /* !YYCOPY_NEEDED */
631
632/* YYFINAL -- State number of the termination state.  */
633#define YYFINAL  9
634/* YYLAST -- Last index in YYTABLE.  */
635#define YYLAST   46
636
637/* YYNTOKENS -- Number of terminals.  */
638#define YYNTOKENS  20
639/* YYNNTS -- Number of nonterminals.  */
640#define YYNNTS  15
641/* YYNRULES -- Number of rules.  */
642#define YYNRULES  29
643/* YYNSTATES -- Number of states.  */
644#define YYNSTATES  51
645
646/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
647   by yylex, with out-of-bounds checking.  */
648#define YYUNDEFTOK  2
649#define YYMAXUTOK   267
650
651#define YYTRANSLATE(YYX)                                                \
652  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
653
654/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
655   as returned by yylex, without out-of-bounds checking.  */
656static const yytype_uint8 yytranslate[] =
657{
658       0,     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,    17,     2,    13,    19,     2,     2,     2,     2,
663       2,     2,     2,     2,     2,     2,     2,     2,    18,     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,    15,     2,    16,     2,     2,     2,     2,     2,     2,
668       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
669       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
670       2,     2,     2,     2,    14,     2,     2,     2,     2,     2,
671       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
672       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
673       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
674       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
675       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
676       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
677       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
678       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
679       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
680       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
681       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
682       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
683       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
684       5,     6,     7,     8,     9,    10,    11,    12
685};
686
687#if YYDEBUG
688  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
689static const yytype_uint16 yyrline[] =
690{
691       0,   299,   299,   303,   304,   308,   315,   314,   323,   324,
692     328,   329,   330,   334,   339,   344,   352,   361,   365,   369,
693     376,   382,   388,   395,   402,   410,   415,   420,   428,   444
694};
695#endif
696
697#if YYDEBUG || YYERROR_VERBOSE || 0
698/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
699   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
700static const char *const yytname[] =
701{
702  "$end", "error", "$undefined", "DREG", "CREG", "GREG", "IMMED", "ADDR",
703  "INSN", "NUM", "ID", "NL", "PNUM", "','", "'|'", "'['", "']'", "'*'",
704  "':'", "'-'", "$accept", "insntbl", "entrys", "entry", "$@1",
705  "fieldspecs", "ftype", "fieldspec", "flagexpr", "flags", "range", "pnum",
706  "regtype", "name", "value", YY_NULL
707};
708#endif
709
710# ifdef YYPRINT
711/* YYTOKNUM[NUM] -- (External) token number corresponding to the
712   (internal) symbol number NUM (which must be that of a token).  */
713static const yytype_uint16 yytoknum[] =
714{
715       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
716     265,   266,   267,    44,   124,    91,    93,    42,    58,    45
717};
718# endif
719
720#define YYPACT_NINF -16
721
722#define yypact_value_is_default(Yystate) \
723  (!!((Yystate) == (-16)))
724
725#define YYTABLE_NINF -5
726
727#define yytable_value_is_error(Yytable_value) \
728  0
729
730  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
731     STATE-NUM.  */
732static const yytype_int8 yypact[] =
733{
734       0,    -9,   -16,   -16,    10,   -16,     0,    12,   -16,   -16,
735     -16,   -16,   -16,   -16,     3,     3,   -16,     9,     9,   -16,
736      11,     8,    19,    15,   -16,    14,    -6,   -16,    25,    21,
737      -6,   -16,     1,   -16,    -6,    20,   -16,   -16,    18,    26,
738      11,     1,   -16,   -16,   -16,     1,   -16,    15,   -16,   -16,
739     -16
740};
741
742  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
743     Performed when YYTABLE does not specify something else to do.  Zero
744     means the default is an error.  */
745static const yytype_uint8 yydefact[] =
746{
747       0,     0,     8,    24,     0,     2,     0,     0,     9,     1,
748       3,    25,    26,    27,     0,     0,    28,     0,     0,    29,
749      23,     0,     0,    21,     5,     0,     0,     6,     0,    19,
750       0,    20,    12,    22,     0,     0,    15,    14,     0,     0,
751      23,    12,    13,    17,    18,    12,     7,    21,    11,    10,
752      16
753};
754
755  /* YYPGOTO[NTERM-NUM].  */
756static const yytype_int8 yypgoto[] =
757{
758     -16,   -16,    32,   -16,   -16,   -15,   -16,     2,    -3,    -8,
759       4,   -16,    34,    27,    28
760};
761
762  /* YYDEFGOTO[NTERM-NUM].  */
763static const yytype_int8 yydefgoto[] =
764{
765      -1,     4,     5,     6,    32,    39,    40,    41,    31,    27,
766      23,     7,    42,    17,    20
767};
768
769  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
770     positive, shift that token.  If negative, reduce the rule whose
771     number is the opposite.  If YYTABLE_NINF, syntax error.  */
772static const yytype_int8 yytable[] =
773{
774      -4,     1,     8,    29,    11,    12,    13,    36,    37,    30,
775       9,     2,     3,    16,    38,    11,    12,    13,    19,    24,
776      14,    11,    12,    13,    36,    37,    48,    35,    25,    22,
777      49,    43,    26,    28,    33,    34,    44,    46,    10,    50,
778      45,    15,    18,     0,    47,     0,    21
779};
780
781static const yytype_int8 yycheck[] =
782{
783       0,     1,    11,     9,     3,     4,     5,     6,     7,    15,
784       0,    11,    12,    10,    13,     3,     4,     5,     9,    11,
785       8,     3,     4,     5,     6,     7,    41,    30,     9,    18,
786      45,    34,    17,    19,     9,    14,    16,    11,     6,    47,
787      38,     7,    15,    -1,    40,    -1,    18
788};
789
790  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
791     symbol of state STATE-NUM.  */
792static const yytype_uint8 yystos[] =
793{
794       0,     1,    11,    12,    21,    22,    23,    31,    11,     0,
795      22,     3,     4,     5,     8,    32,    10,    33,    33,     9,
796      34,    34,    18,    30,    11,     9,    17,    29,    19,     9,
797      15,    28,    24,     9,    14,    28,     6,     7,    13,    25,
798      26,    27,    32,    28,    16,    27,    11,    30,    25,    25,
799      29
800};
801
802  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
803static const yytype_uint8 yyr1[] =
804{
805       0,    20,    21,    22,    22,    23,    24,    23,    23,    23,
806      25,    25,    25,    26,    26,    26,    27,    28,    28,    28,
807      29,    29,    30,    30,    31,    32,    32,    32,    33,    34
808};
809
810  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
811static const yytype_uint8 yyr2[] =
812{
813       0,     2,     1,     2,     0,     5,     0,     9,     1,     2,
814       3,     2,     0,     1,     1,     1,     3,     3,     3,     1,
815       2,     0,     4,     0,     1,     1,     1,     1,     1,     1
816};
817
818
819#define yyerrok         (yyerrstatus = 0)
820#define yyclearin       (yychar = YYEMPTY)
821#define YYEMPTY         (-2)
822#define YYEOF           0
823
824#define YYACCEPT        goto yyacceptlab
825#define YYABORT         goto yyabortlab
826#define YYERROR         goto yyerrorlab
827
828
829#define YYRECOVERING()  (!!yyerrstatus)
830
831#define YYBACKUP(Token, Value)                                  \
832do                                                              \
833  if (yychar == YYEMPTY)                                        \
834    {                                                           \
835      yychar = (Token);                                         \
836      yylval = (Value);                                         \
837      YYPOPSTACK (yylen);                                       \
838      yystate = *yyssp;                                         \
839      goto yybackup;                                            \
840    }                                                           \
841  else                                                          \
842    {                                                           \
843      yyerror (YY_("syntax error: cannot back up")); \
844      YYERROR;                                                  \
845    }                                                           \
846while (0)
847
848/* Error token number */
849#define YYTERROR        1
850#define YYERRCODE       256
851
852
853
854/* Enable debugging if requested.  */
855#if YYDEBUG
856
857# ifndef YYFPRINTF
858#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
859#  define YYFPRINTF fprintf
860# endif
861
862# define YYDPRINTF(Args)                        \
863do {                                            \
864  if (yydebug)                                  \
865    YYFPRINTF Args;                             \
866} while (0)
867
868/* This macro is provided for backward compatibility. */
869#ifndef YY_LOCATION_PRINT
870# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
871#endif
872
873
874# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
875do {                                                                      \
876  if (yydebug)                                                            \
877    {                                                                     \
878      YYFPRINTF (stderr, "%s ", Title);                                   \
879      yy_symbol_print (stderr,                                            \
880                  Type, Value); \
881      YYFPRINTF (stderr, "\n");                                           \
882    }                                                                     \
883} while (0)
884
885
886/*----------------------------------------.
887| Print this symbol's value on YYOUTPUT.  |
888`----------------------------------------*/
889
890static void
891yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
892{
893  FILE *yyo = yyoutput;
894  YYUSE (yyo);
895  if (!yyvaluep)
896    return;
897# ifdef YYPRINT
898  if (yytype < YYNTOKENS)
899    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
900# endif
901  YYUSE (yytype);
902}
903
904
905/*--------------------------------.
906| Print this symbol on YYOUTPUT.  |
907`--------------------------------*/
908
909static void
910yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
911{
912  YYFPRINTF (yyoutput, "%s %s (",
913             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
914
915  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
916  YYFPRINTF (yyoutput, ")");
917}
918
919/*------------------------------------------------------------------.
920| yy_stack_print -- Print the state stack from its BOTTOM up to its |
921| TOP (included).                                                   |
922`------------------------------------------------------------------*/
923
924static void
925yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
926{
927  YYFPRINTF (stderr, "Stack now");
928  for (; yybottom <= yytop; yybottom++)
929    {
930      int yybot = *yybottom;
931      YYFPRINTF (stderr, " %d", yybot);
932    }
933  YYFPRINTF (stderr, "\n");
934}
935
936# define YY_STACK_PRINT(Bottom, Top)                            \
937do {                                                            \
938  if (yydebug)                                                  \
939    yy_stack_print ((Bottom), (Top));                           \
940} while (0)
941
942
943/*------------------------------------------------.
944| Report that the YYRULE is going to be reduced.  |
945`------------------------------------------------*/
946
947static void
948yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
949{
950  unsigned long int yylno = yyrline[yyrule];
951  int yynrhs = yyr2[yyrule];
952  int yyi;
953  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
954             yyrule - 1, yylno);
955  /* The symbols being reduced.  */
956  for (yyi = 0; yyi < yynrhs; yyi++)
957    {
958      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
959      yy_symbol_print (stderr,
960                       yystos[yyssp[yyi + 1 - yynrhs]],
961                       &(yyvsp[(yyi + 1) - (yynrhs)])
962                                              );
963      YYFPRINTF (stderr, "\n");
964    }
965}
966
967# define YY_REDUCE_PRINT(Rule)          \
968do {                                    \
969  if (yydebug)                          \
970    yy_reduce_print (yyssp, yyvsp, Rule); \
971} while (0)
972
973/* Nonzero means print parse trace.  It is left uninitialized so that
974   multiple parsers can coexist.  */
975int yydebug;
976#else /* !YYDEBUG */
977# define YYDPRINTF(Args)
978# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
979# define YY_STACK_PRINT(Bottom, Top)
980# define YY_REDUCE_PRINT(Rule)
981#endif /* !YYDEBUG */
982
983
984/* YYINITDEPTH -- initial size of the parser's stacks.  */
985#ifndef YYINITDEPTH
986# define YYINITDEPTH 200
987#endif
988
989/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
990   if the built-in stack extension method is used).
991
992   Do not make this value too large; the results are undefined if
993   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
994   evaluated with infinite-precision integer arithmetic.  */
995
996#ifndef YYMAXDEPTH
997# define YYMAXDEPTH 10000
998#endif
999
1000
1001#if YYERROR_VERBOSE
1002
1003# ifndef yystrlen
1004#  if defined __GLIBC__ && defined _STRING_H
1005#   define yystrlen strlen
1006#  else
1007/* Return the length of YYSTR.  */
1008static YYSIZE_T
1009yystrlen (const char *yystr)
1010{
1011  YYSIZE_T yylen;
1012  for (yylen = 0; yystr[yylen]; yylen++)
1013    continue;
1014  return yylen;
1015}
1016#  endif
1017# endif
1018
1019# ifndef yystpcpy
1020#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1021#   define yystpcpy stpcpy
1022#  else
1023/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1024   YYDEST.  */
1025static char *
1026yystpcpy (char *yydest, const char *yysrc)
1027{
1028  char *yyd = yydest;
1029  const char *yys = yysrc;
1030
1031  while ((*yyd++ = *yys++) != '\0')
1032    continue;
1033
1034  return yyd - 1;
1035}
1036#  endif
1037# endif
1038
1039# ifndef yytnamerr
1040/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1041   quotes and backslashes, so that it's suitable for yyerror.  The
1042   heuristic is that double-quoting is unnecessary unless the string
1043   contains an apostrophe, a comma, or backslash (other than
1044   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1045   null, do not copy; instead, return the length of what the result
1046   would have been.  */
1047static YYSIZE_T
1048yytnamerr (char *yyres, const char *yystr)
1049{
1050  if (*yystr == '"')
1051    {
1052      YYSIZE_T yyn = 0;
1053      char const *yyp = yystr;
1054
1055      for (;;)
1056        switch (*++yyp)
1057          {
1058          case '\'':
1059          case ',':
1060            goto do_not_strip_quotes;
1061
1062          case '\\':
1063            if (*++yyp != '\\')
1064              goto do_not_strip_quotes;
1065            /* Fall through.  */
1066          default:
1067            if (yyres)
1068              yyres[yyn] = *yyp;
1069            yyn++;
1070            break;
1071
1072          case '"':
1073            if (yyres)
1074              yyres[yyn] = '\0';
1075            return yyn;
1076          }
1077    do_not_strip_quotes: ;
1078    }
1079
1080  if (! yyres)
1081    return yystrlen (yystr);
1082
1083  return yystpcpy (yyres, yystr) - yyres;
1084}
1085# endif
1086
1087/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1088   about the unexpected token YYTOKEN for the state stack whose top is
1089   YYSSP.
1090
1091   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1092   not large enough to hold the message.  In that case, also set
1093   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1094   required number of bytes is too large to store.  */
1095static int
1096yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1097                yytype_int16 *yyssp, int yytoken)
1098{
1099  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1100  YYSIZE_T yysize = yysize0;
1101  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1102  /* Internationalized format string. */
1103  const char *yyformat = YY_NULL;
1104  /* Arguments of yyformat. */
1105  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1106  /* Number of reported tokens (one for the "unexpected", one per
1107     "expected"). */
1108  int yycount = 0;
1109
1110  /* There are many possibilities here to consider:
1111     - If this state is a consistent state with a default action, then
1112       the only way this function was invoked is if the default action
1113       is an error action.  In that case, don't check for expected
1114       tokens because there are none.
1115     - The only way there can be no lookahead present (in yychar) is if
1116       this state is a consistent state with a default action.  Thus,
1117       detecting the absence of a lookahead is sufficient to determine
1118       that there is no unexpected or expected token to report.  In that
1119       case, just report a simple "syntax error".
1120     - Don't assume there isn't a lookahead just because this state is a
1121       consistent state with a default action.  There might have been a
1122       previous inconsistent state, consistent state with a non-default
1123       action, or user semantic action that manipulated yychar.
1124     - Of course, the expected token list depends on states to have
1125       correct lookahead information, and it depends on the parser not
1126       to perform extra reductions after fetching a lookahead from the
1127       scanner and before detecting a syntax error.  Thus, state merging
1128       (from LALR or IELR) and default reductions corrupt the expected
1129       token list.  However, the list is correct for canonical LR with
1130       one exception: it will still contain any token that will not be
1131       accepted due to an error action in a later state.
1132  */
1133  if (yytoken != YYEMPTY)
1134    {
1135      int yyn = yypact[*yyssp];
1136      yyarg[yycount++] = yytname[yytoken];
1137      if (!yypact_value_is_default (yyn))
1138        {
1139          /* Start YYX at -YYN if negative to avoid negative indexes in
1140             YYCHECK.  In other words, skip the first -YYN actions for
1141             this state because they are default actions.  */
1142          int yyxbegin = yyn < 0 ? -yyn : 0;
1143          /* Stay within bounds of both yycheck and yytname.  */
1144          int yychecklim = YYLAST - yyn + 1;
1145          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1146          int yyx;
1147
1148          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1149            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1150                && !yytable_value_is_error (yytable[yyx + yyn]))
1151              {
1152                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1153                  {
1154                    yycount = 1;
1155                    yysize = yysize0;
1156                    break;
1157                  }
1158                yyarg[yycount++] = yytname[yyx];
1159                {
1160                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1161                  if (! (yysize <= yysize1
1162                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1163                    return 2;
1164                  yysize = yysize1;
1165                }
1166              }
1167        }
1168    }
1169
1170  switch (yycount)
1171    {
1172# define YYCASE_(N, S)                      \
1173      case N:                               \
1174        yyformat = S;                       \
1175      break
1176      YYCASE_(0, YY_("syntax error"));
1177      YYCASE_(1, YY_("syntax error, unexpected %s"));
1178      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1179      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1180      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1181      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1182# undef YYCASE_
1183    }
1184
1185  {
1186    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1187    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1188      return 2;
1189    yysize = yysize1;
1190  }
1191
1192  if (*yymsg_alloc < yysize)
1193    {
1194      *yymsg_alloc = 2 * yysize;
1195      if (! (yysize <= *yymsg_alloc
1196             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1197        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1198      return 1;
1199    }
1200
1201  /* Avoid sprintf, as that infringes on the user's name space.
1202     Don't have undefined behavior even if the translation
1203     produced a string with the wrong number of "%s"s.  */
1204  {
1205    char *yyp = *yymsg;
1206    int yyi = 0;
1207    while ((*yyp = *yyformat) != '\0')
1208      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1209        {
1210          yyp += yytnamerr (yyp, yyarg[yyi++]);
1211          yyformat += 2;
1212        }
1213      else
1214        {
1215          yyp++;
1216          yyformat++;
1217        }
1218  }
1219  return 0;
1220}
1221#endif /* YYERROR_VERBOSE */
1222
1223/*-----------------------------------------------.
1224| Release the memory associated to this symbol.  |
1225`-----------------------------------------------*/
1226
1227static void
1228yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1229{
1230  YYUSE (yyvaluep);
1231  if (!yymsg)
1232    yymsg = "Deleting";
1233  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1234
1235  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1236  YYUSE (yytype);
1237  YY_IGNORE_MAYBE_UNINITIALIZED_END
1238}
1239
1240
1241
1242
1243/* The lookahead symbol.  */
1244int yychar;
1245
1246/* The semantic value of the lookahead symbol.  */
1247YYSTYPE yylval;
1248/* Number of syntax errors so far.  */
1249int yynerrs;
1250
1251
1252/*----------.
1253| yyparse.  |
1254`----------*/
1255
1256int
1257yyparse (void)
1258{
1259    int yystate;
1260    /* Number of tokens to shift before error messages enabled.  */
1261    int yyerrstatus;
1262
1263    /* The stacks and their tools:
1264       'yyss': related to states.
1265       'yyvs': related to semantic values.
1266
1267       Refer to the stacks through separate pointers, to allow yyoverflow
1268       to reallocate them elsewhere.  */
1269
1270    /* The state stack.  */
1271    yytype_int16 yyssa[YYINITDEPTH];
1272    yytype_int16 *yyss;
1273    yytype_int16 *yyssp;
1274
1275    /* The semantic value stack.  */
1276    YYSTYPE yyvsa[YYINITDEPTH];
1277    YYSTYPE *yyvs;
1278    YYSTYPE *yyvsp;
1279
1280    YYSIZE_T yystacksize;
1281
1282  int yyn;
1283  int yyresult;
1284  /* Lookahead token as an internal (translated) token number.  */
1285  int yytoken = 0;
1286  /* The variables used to return semantic value and location from the
1287     action routines.  */
1288  YYSTYPE yyval;
1289
1290#if YYERROR_VERBOSE
1291  /* Buffer for error messages, and its allocated size.  */
1292  char yymsgbuf[128];
1293  char *yymsg = yymsgbuf;
1294  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1295#endif
1296
1297#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1298
1299  /* The number of symbols on the RHS of the reduced rule.
1300     Keep to zero when no symbol should be popped.  */
1301  int yylen = 0;
1302
1303  yyssp = yyss = yyssa;
1304  yyvsp = yyvs = yyvsa;
1305  yystacksize = YYINITDEPTH;
1306
1307  YYDPRINTF ((stderr, "Starting parse\n"));
1308
1309  yystate = 0;
1310  yyerrstatus = 0;
1311  yynerrs = 0;
1312  yychar = YYEMPTY; /* Cause a token to be read.  */
1313  goto yysetstate;
1314
1315/*------------------------------------------------------------.
1316| yynewstate -- Push a new state, which is found in yystate.  |
1317`------------------------------------------------------------*/
1318 yynewstate:
1319  /* In all cases, when you get here, the value and location stacks
1320     have just been pushed.  So pushing a state here evens the stacks.  */
1321  yyssp++;
1322
1323 yysetstate:
1324  *yyssp = yystate;
1325
1326  if (yyss + yystacksize - 1 <= yyssp)
1327    {
1328      /* Get the current used size of the three stacks, in elements.  */
1329      YYSIZE_T yysize = yyssp - yyss + 1;
1330
1331#ifdef yyoverflow
1332      {
1333        /* Give user a chance to reallocate the stack.  Use copies of
1334           these so that the &'s don't force the real ones into
1335           memory.  */
1336        YYSTYPE *yyvs1 = yyvs;
1337        yytype_int16 *yyss1 = yyss;
1338
1339        /* Each stack pointer address is followed by the size of the
1340           data in use in that stack, in bytes.  This used to be a
1341           conditional around just the two extra args, but that might
1342           be undefined if yyoverflow is a macro.  */
1343        yyoverflow (YY_("memory exhausted"),
1344                    &yyss1, yysize * sizeof (*yyssp),
1345                    &yyvs1, yysize * sizeof (*yyvsp),
1346                    &yystacksize);
1347
1348        yyss = yyss1;
1349        yyvs = yyvs1;
1350      }
1351#else /* no yyoverflow */
1352# ifndef YYSTACK_RELOCATE
1353      goto yyexhaustedlab;
1354# else
1355      /* Extend the stack our own way.  */
1356      if (YYMAXDEPTH <= yystacksize)
1357        goto yyexhaustedlab;
1358      yystacksize *= 2;
1359      if (YYMAXDEPTH < yystacksize)
1360        yystacksize = YYMAXDEPTH;
1361
1362      {
1363        yytype_int16 *yyss1 = yyss;
1364        union yyalloc *yyptr =
1365          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1366        if (! yyptr)
1367          goto yyexhaustedlab;
1368        YYSTACK_RELOCATE (yyss_alloc, yyss);
1369        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1370#  undef YYSTACK_RELOCATE
1371        if (yyss1 != yyssa)
1372          YYSTACK_FREE (yyss1);
1373      }
1374# endif
1375#endif /* no yyoverflow */
1376
1377      yyssp = yyss + yysize - 1;
1378      yyvsp = yyvs + yysize - 1;
1379
1380      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1381                  (unsigned long int) yystacksize));
1382
1383      if (yyss + yystacksize - 1 <= yyssp)
1384        YYABORT;
1385    }
1386
1387  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1388
1389  if (yystate == YYFINAL)
1390    YYACCEPT;
1391
1392  goto yybackup;
1393
1394/*-----------.
1395| yybackup.  |
1396`-----------*/
1397yybackup:
1398
1399  /* Do appropriate processing given the current state.  Read a
1400     lookahead token if we need one and don't already have one.  */
1401
1402  /* First try to decide what to do without reference to lookahead token.  */
1403  yyn = yypact[yystate];
1404  if (yypact_value_is_default (yyn))
1405    goto yydefault;
1406
1407  /* Not known => get a lookahead token if don't already have one.  */
1408
1409  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1410  if (yychar == YYEMPTY)
1411    {
1412      YYDPRINTF ((stderr, "Reading a token: "));
1413      yychar = yylex ();
1414    }
1415
1416  if (yychar <= YYEOF)
1417    {
1418      yychar = yytoken = YYEOF;
1419      YYDPRINTF ((stderr, "Now at end of input.\n"));
1420    }
1421  else
1422    {
1423      yytoken = YYTRANSLATE (yychar);
1424      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1425    }
1426
1427  /* If the proper action on seeing token YYTOKEN is to reduce or to
1428     detect an error, take that action.  */
1429  yyn += yytoken;
1430  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1431    goto yydefault;
1432  yyn = yytable[yyn];
1433  if (yyn <= 0)
1434    {
1435      if (yytable_value_is_error (yyn))
1436        goto yyerrlab;
1437      yyn = -yyn;
1438      goto yyreduce;
1439    }
1440
1441  /* Count tokens shifted since error; after three, turn off error
1442     status.  */
1443  if (yyerrstatus)
1444    yyerrstatus--;
1445
1446  /* Shift the lookahead token.  */
1447  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1448
1449  /* Discard the shifted token.  */
1450  yychar = YYEMPTY;
1451
1452  yystate = yyn;
1453  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1454  *++yyvsp = yylval;
1455  YY_IGNORE_MAYBE_UNINITIALIZED_END
1456
1457  goto yynewstate;
1458
1459
1460/*-----------------------------------------------------------.
1461| yydefault -- do the default action for the current state.  |
1462`-----------------------------------------------------------*/
1463yydefault:
1464  yyn = yydefact[yystate];
1465  if (yyn == 0)
1466    goto yyerrlab;
1467  goto yyreduce;
1468
1469
1470/*-----------------------------.
1471| yyreduce -- Do a reduction.  |
1472`-----------------------------*/
1473yyreduce:
1474  /* yyn is the number of a rule to reduce with.  */
1475  yylen = yyr2[yyn];
1476
1477  /* If YYLEN is nonzero, implement the default value of the action:
1478     '$$ = $1'.
1479
1480     Otherwise, the following line sets YYVAL to garbage.
1481     This behavior is undocumented and Bison
1482     users should not rely upon it.  Assigning to YYVAL
1483     unconditionally makes the parser a bit smaller, and it avoids a
1484     GCC warning that YYVAL may be used uninitialized.  */
1485  yyval = yyvsp[1-yylen];
1486
1487
1488  YY_REDUCE_PRINT (yyn);
1489  switch (yyn)
1490    {
1491        case 5:
1492#line 309 "./itbl-parse.y" /* yacc.c:1661  */
1493    {
1494	    DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n",
1495	    	    insntbl_line, (yyvsp[-4].num), (yyvsp[-3].num), (yyvsp[-2].str), (yyvsp[-1].val)));
1496	    itbl_add_reg ((yyvsp[-4].num), (yyvsp[-3].num), (yyvsp[-2].str), (yyvsp[-1].val));
1497	  }
1498#line 1499 "itbl-parse.c" /* yacc.c:1661  */
1499    break;
1500
1501  case 6:
1502#line 315 "./itbl-parse.y" /* yacc.c:1661  */
1503    {
1504	    DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x",
1505	    	    insntbl_line, (yyvsp[-5].num), (yyvsp[-3].str), (yyvsp[-2].val)));
1506	    DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, (yyvsp[0].val)));
1507	    insn=itbl_add_insn ((yyvsp[-5].num), (yyvsp[-3].str), (yyvsp[-2].val), sbit, ebit, (yyvsp[0].val));
1508	  }
1509#line 1510 "itbl-parse.c" /* yacc.c:1661  */
1510    break;
1511
1512  case 7:
1513#line 322 "./itbl-parse.y" /* yacc.c:1661  */
1514    {}
1515#line 1516 "itbl-parse.c" /* yacc.c:1661  */
1516    break;
1517
1518  case 13:
1519#line 335 "./itbl-parse.y" /* yacc.c:1661  */
1520    {
1521	    DBGL2 (("ftype\n"));
1522	    (yyval.num) = (yyvsp[0].num);
1523	  }
1524#line 1525 "itbl-parse.c" /* yacc.c:1661  */
1525    break;
1526
1527  case 14:
1528#line 340 "./itbl-parse.y" /* yacc.c:1661  */
1529    {
1530	    DBGL2 (("addr\n"));
1531	    (yyval.num) = ADDR;
1532	  }
1533#line 1534 "itbl-parse.c" /* yacc.c:1661  */
1534    break;
1535
1536  case 15:
1537#line 345 "./itbl-parse.y" /* yacc.c:1661  */
1538    {
1539	    DBGL2 (("immed\n"));
1540	    (yyval.num) = IMMED;
1541	  }
1542#line 1543 "itbl-parse.c" /* yacc.c:1661  */
1543    break;
1544
1545  case 16:
1546#line 353 "./itbl-parse.y" /* yacc.c:1661  */
1547    {
1548	    DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n",
1549	    	    insntbl_line, (yyvsp[-2].num), sbit, ebit, (yyvsp[0].val)));
1550	    itbl_add_operand (insn, (yyvsp[-2].num), sbit, ebit, (yyvsp[0].val));
1551	  }
1552#line 1553 "itbl-parse.c" /* yacc.c:1661  */
1553    break;
1554
1555  case 17:
1556#line 362 "./itbl-parse.y" /* yacc.c:1661  */
1557    {
1558	    (yyval.val) = (yyvsp[-2].num) | (yyvsp[0].val);
1559	  }
1560#line 1561 "itbl-parse.c" /* yacc.c:1661  */
1561    break;
1562
1563  case 18:
1564#line 366 "./itbl-parse.y" /* yacc.c:1661  */
1565    {
1566	    (yyval.val) = (yyvsp[-1].val);
1567	  }
1568#line 1569 "itbl-parse.c" /* yacc.c:1661  */
1569    break;
1570
1571  case 19:
1572#line 370 "./itbl-parse.y" /* yacc.c:1661  */
1573    {
1574	    (yyval.val) = (yyvsp[0].num);
1575	  }
1576#line 1577 "itbl-parse.c" /* yacc.c:1661  */
1577    break;
1578
1579  case 20:
1580#line 377 "./itbl-parse.y" /* yacc.c:1661  */
1581    {
1582	    DBGL2 (("flags=%d\n", (yyvsp[0].val)));
1583	    (yyval.val) = (yyvsp[0].val);
1584	  }
1585#line 1586 "itbl-parse.c" /* yacc.c:1661  */
1586    break;
1587
1588  case 21:
1589#line 382 "./itbl-parse.y" /* yacc.c:1661  */
1590    {
1591	    (yyval.val) = 0;
1592	  }
1593#line 1594 "itbl-parse.c" /* yacc.c:1661  */
1594    break;
1595
1596  case 22:
1597#line 389 "./itbl-parse.y" /* yacc.c:1661  */
1598    {
1599	    DBGL2 (("range %d %d\n", (yyvsp[-2].num), (yyvsp[0].num)));
1600	    sbit = (yyvsp[-2].num);
1601	    ebit = (yyvsp[0].num);
1602	  }
1603#line 1604 "itbl-parse.c" /* yacc.c:1661  */
1604    break;
1605
1606  case 23:
1607#line 395 "./itbl-parse.y" /* yacc.c:1661  */
1608    {
1609	    sbit = 31;
1610	    ebit = 0;
1611	  }
1612#line 1613 "itbl-parse.c" /* yacc.c:1661  */
1613    break;
1614
1615  case 24:
1616#line 403 "./itbl-parse.y" /* yacc.c:1661  */
1617    {
1618	    DBGL2 (("pnum=%d\n",(yyvsp[0].num)));
1619	    (yyval.num) = (yyvsp[0].num);
1620	  }
1621#line 1622 "itbl-parse.c" /* yacc.c:1661  */
1622    break;
1623
1624  case 25:
1625#line 411 "./itbl-parse.y" /* yacc.c:1661  */
1626    {
1627	    DBGL2 (("dreg\n"));
1628	    (yyval.num) = DREG;
1629	  }
1630#line 1631 "itbl-parse.c" /* yacc.c:1661  */
1631    break;
1632
1633  case 26:
1634#line 416 "./itbl-parse.y" /* yacc.c:1661  */
1635    {
1636	    DBGL2 (("creg\n"));
1637	    (yyval.num) = CREG;
1638	  }
1639#line 1640 "itbl-parse.c" /* yacc.c:1661  */
1640    break;
1641
1642  case 27:
1643#line 421 "./itbl-parse.y" /* yacc.c:1661  */
1644    {
1645	    DBGL2 (("greg\n"));
1646	    (yyval.num) = GREG;
1647	  }
1648#line 1649 "itbl-parse.c" /* yacc.c:1661  */
1649    break;
1650
1651  case 28:
1652#line 429 "./itbl-parse.y" /* yacc.c:1661  */
1653    {
1654	    DBGL2 (("name=%s\n",(yyvsp[0].str)));
1655	    (yyval.str) = (yyvsp[0].str);
1656	  }
1657#line 1658 "itbl-parse.c" /* yacc.c:1661  */
1658    break;
1659
1660  case 29:
1661#line 445 "./itbl-parse.y" /* yacc.c:1661  */
1662    {
1663	    DBGL2 (("val=x%x\n",(yyvsp[0].num)));
1664	    (yyval.val) = (yyvsp[0].num);
1665	  }
1666#line 1667 "itbl-parse.c" /* yacc.c:1661  */
1667    break;
1668
1669
1670#line 1671 "itbl-parse.c" /* yacc.c:1661  */
1671      default: break;
1672    }
1673  /* User semantic actions sometimes alter yychar, and that requires
1674     that yytoken be updated with the new translation.  We take the
1675     approach of translating immediately before every use of yytoken.
1676     One alternative is translating here after every semantic action,
1677     but that translation would be missed if the semantic action invokes
1678     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1679     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1680     incorrect destructor might then be invoked immediately.  In the
1681     case of YYERROR or YYBACKUP, subsequent parser actions might lead
1682     to an incorrect destructor call or verbose syntax error message
1683     before the lookahead is translated.  */
1684  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1685
1686  YYPOPSTACK (yylen);
1687  yylen = 0;
1688  YY_STACK_PRINT (yyss, yyssp);
1689
1690  *++yyvsp = yyval;
1691
1692  /* Now 'shift' the result of the reduction.  Determine what state
1693     that goes to, based on the state we popped back to and the rule
1694     number reduced by.  */
1695
1696  yyn = yyr1[yyn];
1697
1698  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1699  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1700    yystate = yytable[yystate];
1701  else
1702    yystate = yydefgoto[yyn - YYNTOKENS];
1703
1704  goto yynewstate;
1705
1706
1707/*--------------------------------------.
1708| yyerrlab -- here on detecting error.  |
1709`--------------------------------------*/
1710yyerrlab:
1711  /* Make sure we have latest lookahead translation.  See comments at
1712     user semantic actions for why this is necessary.  */
1713  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1714
1715  /* If not already recovering from an error, report this error.  */
1716  if (!yyerrstatus)
1717    {
1718      ++yynerrs;
1719#if ! YYERROR_VERBOSE
1720      yyerror (YY_("syntax error"));
1721#else
1722# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1723                                        yyssp, yytoken)
1724      {
1725        char const *yymsgp = YY_("syntax error");
1726        int yysyntax_error_status;
1727        yysyntax_error_status = YYSYNTAX_ERROR;
1728        if (yysyntax_error_status == 0)
1729          yymsgp = yymsg;
1730        else if (yysyntax_error_status == 1)
1731          {
1732            if (yymsg != yymsgbuf)
1733              YYSTACK_FREE (yymsg);
1734            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1735            if (!yymsg)
1736              {
1737                yymsg = yymsgbuf;
1738                yymsg_alloc = sizeof yymsgbuf;
1739                yysyntax_error_status = 2;
1740              }
1741            else
1742              {
1743                yysyntax_error_status = YYSYNTAX_ERROR;
1744                yymsgp = yymsg;
1745              }
1746          }
1747        yyerror (yymsgp);
1748        if (yysyntax_error_status == 2)
1749          goto yyexhaustedlab;
1750      }
1751# undef YYSYNTAX_ERROR
1752#endif
1753    }
1754
1755
1756
1757  if (yyerrstatus == 3)
1758    {
1759      /* If just tried and failed to reuse lookahead token after an
1760         error, discard it.  */
1761
1762      if (yychar <= YYEOF)
1763        {
1764          /* Return failure if at end of input.  */
1765          if (yychar == YYEOF)
1766            YYABORT;
1767        }
1768      else
1769        {
1770          yydestruct ("Error: discarding",
1771                      yytoken, &yylval);
1772          yychar = YYEMPTY;
1773        }
1774    }
1775
1776  /* Else will try to reuse lookahead token after shifting the error
1777     token.  */
1778  goto yyerrlab1;
1779
1780
1781/*---------------------------------------------------.
1782| yyerrorlab -- error raised explicitly by YYERROR.  |
1783`---------------------------------------------------*/
1784yyerrorlab:
1785
1786  /* Pacify compilers like GCC when the user code never invokes
1787     YYERROR and the label yyerrorlab therefore never appears in user
1788     code.  */
1789  if (/*CONSTCOND*/ 0)
1790     goto yyerrorlab;
1791
1792  /* Do not reclaim the symbols of the rule whose action triggered
1793     this YYERROR.  */
1794  YYPOPSTACK (yylen);
1795  yylen = 0;
1796  YY_STACK_PRINT (yyss, yyssp);
1797  yystate = *yyssp;
1798  goto yyerrlab1;
1799
1800
1801/*-------------------------------------------------------------.
1802| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1803`-------------------------------------------------------------*/
1804yyerrlab1:
1805  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1806
1807  for (;;)
1808    {
1809      yyn = yypact[yystate];
1810      if (!yypact_value_is_default (yyn))
1811        {
1812          yyn += YYTERROR;
1813          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1814            {
1815              yyn = yytable[yyn];
1816              if (0 < yyn)
1817                break;
1818            }
1819        }
1820
1821      /* Pop the current state because it cannot handle the error token.  */
1822      if (yyssp == yyss)
1823        YYABORT;
1824
1825
1826      yydestruct ("Error: popping",
1827                  yystos[yystate], yyvsp);
1828      YYPOPSTACK (1);
1829      yystate = *yyssp;
1830      YY_STACK_PRINT (yyss, yyssp);
1831    }
1832
1833  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1834  *++yyvsp = yylval;
1835  YY_IGNORE_MAYBE_UNINITIALIZED_END
1836
1837
1838  /* Shift the error token.  */
1839  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1840
1841  yystate = yyn;
1842  goto yynewstate;
1843
1844
1845/*-------------------------------------.
1846| yyacceptlab -- YYACCEPT comes here.  |
1847`-------------------------------------*/
1848yyacceptlab:
1849  yyresult = 0;
1850  goto yyreturn;
1851
1852/*-----------------------------------.
1853| yyabortlab -- YYABORT comes here.  |
1854`-----------------------------------*/
1855yyabortlab:
1856  yyresult = 1;
1857  goto yyreturn;
1858
1859#if !defined yyoverflow || YYERROR_VERBOSE
1860/*-------------------------------------------------.
1861| yyexhaustedlab -- memory exhaustion comes here.  |
1862`-------------------------------------------------*/
1863yyexhaustedlab:
1864  yyerror (YY_("memory exhausted"));
1865  yyresult = 2;
1866  /* Fall through.  */
1867#endif
1868
1869yyreturn:
1870  if (yychar != YYEMPTY)
1871    {
1872      /* Make sure we have latest lookahead translation.  See comments at
1873         user semantic actions for why this is necessary.  */
1874      yytoken = YYTRANSLATE (yychar);
1875      yydestruct ("Cleanup: discarding lookahead",
1876                  yytoken, &yylval);
1877    }
1878  /* Do not reclaim the symbols of the rule whose action triggered
1879     this YYABORT or YYACCEPT.  */
1880  YYPOPSTACK (yylen);
1881  YY_STACK_PRINT (yyss, yyssp);
1882  while (yyssp != yyss)
1883    {
1884      yydestruct ("Cleanup: popping",
1885                  yystos[*yyssp], yyvsp);
1886      YYPOPSTACK (1);
1887    }
1888#ifndef yyoverflow
1889  if (yyss != yyssa)
1890    YYSTACK_FREE (yyss);
1891#endif
1892#if YYERROR_VERBOSE
1893  if (yymsg != yymsgbuf)
1894    YYSTACK_FREE (yymsg);
1895#endif
1896  return yyresult;
1897}
1898#line 450 "./itbl-parse.y" /* yacc.c:1906  */
1899
1900
1901static int
1902yyerror (const char *msg)
1903{
1904  printf ("line %d: %s\n", insntbl_line, msg);
1905  return 0;
1906}
1907