Commit generated files for binutils 2.17.90.
[binutils.git] / gas / itbl-parse.c
blob909a130ac470f368086f234b96c5cfba36086de7
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
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 2, or (at your option)
11 any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 DREG = 258,
70 CREG = 259,
71 GREG = 260,
72 IMMED = 261,
73 ADDR = 262,
74 INSN = 263,
75 NUM = 264,
76 ID = 265,
77 NL = 266,
78 PNUM = 267
80 #endif
81 /* Tokens. */
82 #define DREG 258
83 #define CREG 259
84 #define GREG 260
85 #define IMMED 261
86 #define ADDR 262
87 #define INSN 263
88 #define NUM 264
89 #define ID 265
90 #define NL 266
91 #define PNUM 267
96 /* Copy the first part of user declarations. */
97 #line 21 "itbl-parse.y"
102 Yacc grammar for instruction table entries.
104 =======================================================================
105 Original Instruction table specification document:
107 MIPS Coprocessor Table Specification
108 ====================================
110 This document describes the format of the MIPS coprocessor table. The
111 table specifies a list of valid functions, data registers and control
112 registers that can be used in coprocessor instructions. This list,
113 together with the coprocessor instruction classes listed below,
114 specifies the complete list of coprocessor instructions that will
115 be recognized and assembled by the GNU assembler. In effect,
116 this makes the GNU assembler table-driven, where the table is
117 specified by the programmer.
119 The table is an ordinary text file that the GNU assembler reads when
120 it starts. Using the information in the table, the assembler
121 generates an internal list of valid coprocessor registers and
122 functions. The assembler uses this internal list in addition to the
123 standard MIPS registers and instructions which are built-in to the
124 assembler during code generation.
126 To specify the coprocessor table when invoking the GNU assembler, use
127 the command line option "--itbl file", where file is the
128 complete name of the table, including path and extension.
130 Examples:
132 gas -t cop.tbl test.s -o test.o
133 gas -t /usr/local/lib/cop.tbl test.s -o test.o
134 gas --itbl d:\gnu\data\cop.tbl test.s -o test.o
136 Only one table may be supplied during a single invocation of
137 the assembler.
140 Instruction classes
141 ===================
143 Below is a list of the valid coprocessor instruction classes for
144 any given coprocessor "z". These instructions are already recognized
145 by the assembler, and are listed here only for reference.
147 Class format instructions
148 -------------------------------------------------
149 Class1:
150 op base rt offset
151 LWCz rt,offset (base)
152 SWCz rt,offset (base)
153 Class2:
154 COPz sub rt rd 0
155 MTCz rt,rd
156 MFCz rt,rd
157 CTCz rt,rd
158 CFCz rt,rd
159 Class3:
160 COPz CO cofun
161 COPz cofun
162 Class4:
163 COPz BC br offset
164 BCzT offset
165 BCzF offset
166 Class5:
167 COPz sub rt rd 0
168 DMFCz rt,rd
169 DMTCz rt,rd
170 Class6:
171 op base rt offset
172 LDCz rt,offset (base)
173 SDCz rt,offset (base)
174 Class7:
175 COPz BC br offset
176 BCzTL offset
177 BCzFL offset
179 The coprocessor table defines coprocessor-specific registers that can
180 be used with all of the above classes of instructions, where
181 appropriate. It also defines additional coprocessor-specific
182 functions for Class3 (COPz cofun) instructions, Thus, the table allows
183 the programmer to use convenient mnemonics and operands for these
184 functions, instead of the COPz mmenmonic and cofun operand.
186 The names of the MIPS general registers and their aliases are defined
187 by the assembler and will be recognized as valid register names by the
188 assembler when used (where allowed) in coprocessor instructions.
189 However, the names and values of all coprocessor data and control
190 register mnemonics must be specified in the coprocessor table.
193 Table Grammar
194 =============
196 Here is the grammar for the coprocessor table:
198 table -> entry*
200 entry -> [z entrydef] [comment] '\n'
202 entrydef -> type name val
203 entrydef -> 'insn' name val funcdef ; type of entry (instruction)
205 z -> 'p'['0'..'3'] ; processor number
206 type -> ['dreg' | 'creg' | 'greg' ] ; type of entry (register)
207 ; 'dreg', 'creg' or 'greg' specifies a data, control, or general
208 ; register mnemonic, respectively
209 name -> [ltr|dec]* ; mnemonic of register/function
210 val -> [dec|hex] ; register/function number (integer constant)
212 funcdef -> frange flags fields
213 ; bitfield range for opcode
214 ; list of fields' formats
215 fields -> field*
216 field -> [','] ftype frange flags
217 flags -> ['*' flagexpr]
218 flagexpr -> '[' flagexpr ']'
219 flagexpr -> val '|' flagexpr
220 ftype -> [ type | 'immed' | 'addr' ]
221 ; 'immed' specifies an immediate value; see grammar for "val" above
222 ; 'addr' specifies a C identifier; name of symbol to be resolved at
223 ; link time
224 frange -> ':' val '-' val ; starting to ending bit positions, where
225 ; where 0 is least significant bit
226 frange -> (null) ; default range of 31-0 will be assumed
228 comment -> [';'|'#'] [char]*
229 char -> any printable character
230 ltr -> ['a'..'z'|'A'..'Z']
231 dec -> ['0'..'9']* ; value in decimal
232 hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']* ; value in hexadecimal
235 Examples
236 ========
238 Example 1:
240 The table:
242 p1 dreg d1 1 ; data register "d1" for COP1 has value 1
243 p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3
244 p3 func fill 0x1f:24-20 ; function "fill" for COP3 has value 31 and
245 ; no fields
247 will allow the assembler to accept the following coprocessor instructions:
249 LWC1 d1,0x100 ($2)
250 fill
252 Here, the general purpose register "$2", and instruction "LWC1", are standard
253 mnemonics built-in to the MIPS assembler.
256 Example 2:
258 The table:
260 p3 dreg d3 3 ; data register "d3" for COP3 has value 3
261 p3 creg c2 22 ; control register "c2" for COP3 has value 22
262 p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0
263 ; function "fee" for COP3 has value 31, and 3 fields
264 ; consisting of a data register, a control register,
265 ; and an immediate value.
267 will allow the assembler to accept the following coprocessor instruction:
269 fee d3,c2,0x1
271 and will emit the object code:
273 31-26 25 24-20 19-18 17-13 12-8 7-0
274 COPz CO fun dreg creg immed
275 010011 1 11111 00 00011 10110 00000001
277 0x4ff07601
280 Example 3:
282 The table:
284 p3 dreg d3 3 ; data register "d3" for COP3 has value 3
285 p3 creg c2 22 ; control register "c2" for COP3 has value 22
286 p3 func fuu 0x01f00001 dreg:17-13 creg:12-8
288 will allow the assembler to accept the following coprocessor
289 instruction:
291 fuu d3,c2
293 and will emit the object code:
295 31-26 25 24-20 19-18 17-13 12-8 7-0
296 COPz CO fun dreg creg
297 010011 1 11111 00 00011 10110 00000001
299 0x4ff07601
301 In this way, the programmer can force arbitrary bits of an instruction
302 to have predefined values.
304 =======================================================================
305 Additional notes:
307 Encoding of ranges:
308 To handle more than one bit position range within an instruction,
309 use 0s to mask out the ranges which don't apply.
310 May decide to modify the syntax to allow commas separate multiple
311 ranges within an instruction (range','range).
313 Changes in grammar:
314 The number of parms argument to the function entry
315 was deleted from the original format such that we now count the fields.
317 ----
318 FIXME! should really change lexical analyzer
319 to recognize 'dreg' etc. in context sensitive way.
320 Currently function names or mnemonics may be incorrectly parsed as keywords
322 FIXME! hex is ambiguous with any digit
326 #include "as.h"
327 #include "itbl-lex.h"
328 #include "itbl-ops.h"
330 /* #define DEBUG */
332 #ifdef DEBUG
333 #ifndef DBG_LVL
334 #define DBG_LVL 1
335 #endif
336 #else
337 #define DBG_LVL 0
338 #endif
340 #if DBG_LVL >= 1
341 #define DBG(x) printf x
342 #else
343 #define DBG(x)
344 #endif
346 #if DBG_LVL >= 2
347 #define DBGL2(x) printf x
348 #else
349 #define DBGL2(x)
350 #endif
352 static int sbit, ebit;
353 static struct itbl_entry *insn=0;
354 static int yyerror (const char *);
358 /* Enabling traces. */
359 #ifndef YYDEBUG
360 # define YYDEBUG 0
361 #endif
363 /* Enabling verbose error messages. */
364 #ifdef YYERROR_VERBOSE
365 # undef YYERROR_VERBOSE
366 # define YYERROR_VERBOSE 1
367 #else
368 # define YYERROR_VERBOSE 0
369 #endif
371 /* Enabling the token table. */
372 #ifndef YYTOKEN_TABLE
373 # define YYTOKEN_TABLE 0
374 #endif
376 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
377 typedef union YYSTYPE
378 #line 282 "itbl-parse.y"
380 char *str;
381 int num;
382 int processor;
383 unsigned long val;
385 /* Line 187 of yacc.c. */
386 #line 387 "itbl-parse.c"
387 YYSTYPE;
388 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
389 # define YYSTYPE_IS_DECLARED 1
390 # define YYSTYPE_IS_TRIVIAL 1
391 #endif
395 /* Copy the second part of user declarations. */
398 /* Line 216 of yacc.c. */
399 #line 400 "itbl-parse.c"
401 #ifdef short
402 # undef short
403 #endif
405 #ifdef YYTYPE_UINT8
406 typedef YYTYPE_UINT8 yytype_uint8;
407 #else
408 typedef unsigned char yytype_uint8;
409 #endif
411 #ifdef YYTYPE_INT8
412 typedef YYTYPE_INT8 yytype_int8;
413 #elif (defined __STDC__ || defined __C99__FUNC__ \
414 || defined __cplusplus || defined _MSC_VER)
415 typedef signed char yytype_int8;
416 #else
417 typedef short int yytype_int8;
418 #endif
420 #ifdef YYTYPE_UINT16
421 typedef YYTYPE_UINT16 yytype_uint16;
422 #else
423 typedef unsigned short int yytype_uint16;
424 #endif
426 #ifdef YYTYPE_INT16
427 typedef YYTYPE_INT16 yytype_int16;
428 #else
429 typedef short int yytype_int16;
430 #endif
432 #ifndef YYSIZE_T
433 # ifdef __SIZE_TYPE__
434 # define YYSIZE_T __SIZE_TYPE__
435 # elif defined size_t
436 # define YYSIZE_T size_t
437 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
438 || defined __cplusplus || defined _MSC_VER)
439 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
440 # define YYSIZE_T size_t
441 # else
442 # define YYSIZE_T unsigned int
443 # endif
444 #endif
446 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
448 #ifndef YY_
449 # if YYENABLE_NLS
450 # if ENABLE_NLS
451 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
452 # define YY_(msgid) dgettext ("bison-runtime", msgid)
453 # endif
454 # endif
455 # ifndef YY_
456 # define YY_(msgid) msgid
457 # endif
458 #endif
460 /* Suppress unused-variable warnings by "using" E. */
461 #if ! defined lint || defined __GNUC__
462 # define YYUSE(e) ((void) (e))
463 #else
464 # define YYUSE(e) /* empty */
465 #endif
467 /* Identity function, used to suppress warnings about constant conditions. */
468 #ifndef lint
469 # define YYID(n) (n)
470 #else
471 #if (defined __STDC__ || defined __C99__FUNC__ \
472 || defined __cplusplus || defined _MSC_VER)
473 static int
474 YYID (int i)
475 #else
476 static int
477 YYID (i)
478 int i;
479 #endif
481 return i;
483 #endif
485 #if ! defined yyoverflow || YYERROR_VERBOSE
487 /* The parser invokes alloca or malloc; define the necessary symbols. */
489 # ifdef YYSTACK_USE_ALLOCA
490 # if YYSTACK_USE_ALLOCA
491 # ifdef __GNUC__
492 # define YYSTACK_ALLOC __builtin_alloca
493 # elif defined __BUILTIN_VA_ARG_INCR
494 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
495 # elif defined _AIX
496 # define YYSTACK_ALLOC __alloca
497 # elif defined _MSC_VER
498 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
499 # define alloca _alloca
500 # else
501 # define YYSTACK_ALLOC alloca
502 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
503 || defined __cplusplus || defined _MSC_VER)
504 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
505 # ifndef _STDLIB_H
506 # define _STDLIB_H 1
507 # endif
508 # endif
509 # endif
510 # endif
511 # endif
513 # ifdef YYSTACK_ALLOC
514 /* Pacify GCC's `empty if-body' warning. */
515 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
516 # ifndef YYSTACK_ALLOC_MAXIMUM
517 /* The OS might guarantee only one guard page at the bottom of the stack,
518 and a page size can be as small as 4096 bytes. So we cannot safely
519 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
520 to allow for a few compiler-allocated temporary stack slots. */
521 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
522 # endif
523 # else
524 # define YYSTACK_ALLOC YYMALLOC
525 # define YYSTACK_FREE YYFREE
526 # ifndef YYSTACK_ALLOC_MAXIMUM
527 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
528 # endif
529 # if (defined __cplusplus && ! defined _STDLIB_H \
530 && ! ((defined YYMALLOC || defined malloc) \
531 && (defined YYFREE || defined free)))
532 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
533 # ifndef _STDLIB_H
534 # define _STDLIB_H 1
535 # endif
536 # endif
537 # ifndef YYMALLOC
538 # define YYMALLOC malloc
539 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
540 || defined __cplusplus || defined _MSC_VER)
541 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
542 # endif
543 # endif
544 # ifndef YYFREE
545 # define YYFREE free
546 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
547 || defined __cplusplus || defined _MSC_VER)
548 void free (void *); /* INFRINGES ON USER NAME SPACE */
549 # endif
550 # endif
551 # endif
552 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
555 #if (! defined yyoverflow \
556 && (! defined __cplusplus \
557 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
559 /* A type that is properly aligned for any stack member. */
560 union yyalloc
562 yytype_int16 yyss;
563 YYSTYPE yyvs;
566 /* The size of the maximum gap between one aligned stack and the next. */
567 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
569 /* The size of an array large to enough to hold all stacks, each with
570 N elements. */
571 # define YYSTACK_BYTES(N) \
572 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
573 + YYSTACK_GAP_MAXIMUM)
575 /* Copy COUNT objects from FROM to TO. The source and destination do
576 not overlap. */
577 # ifndef YYCOPY
578 # if defined __GNUC__ && 1 < __GNUC__
579 # define YYCOPY(To, From, Count) \
580 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
581 # else
582 # define YYCOPY(To, From, Count) \
583 do \
585 YYSIZE_T yyi; \
586 for (yyi = 0; yyi < (Count); yyi++) \
587 (To)[yyi] = (From)[yyi]; \
589 while (YYID (0))
590 # endif
591 # endif
593 /* Relocate STACK from its old location to the new one. The
594 local variables YYSIZE and YYSTACKSIZE give the old and new number of
595 elements in the stack, and YYPTR gives the new location of the
596 stack. Advance YYPTR to a properly aligned location for the next
597 stack. */
598 # define YYSTACK_RELOCATE(Stack) \
599 do \
601 YYSIZE_T yynewbytes; \
602 YYCOPY (&yyptr->Stack, Stack, yysize); \
603 Stack = &yyptr->Stack; \
604 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
605 yyptr += yynewbytes / sizeof (*yyptr); \
607 while (YYID (0))
609 #endif
611 /* YYFINAL -- State number of the termination state. */
612 #define YYFINAL 9
613 /* YYLAST -- Last index in YYTABLE. */
614 #define YYLAST 46
616 /* YYNTOKENS -- Number of terminals. */
617 #define YYNTOKENS 20
618 /* YYNNTS -- Number of nonterminals. */
619 #define YYNNTS 15
620 /* YYNRULES -- Number of rules. */
621 #define YYNRULES 29
622 /* YYNRULES -- Number of states. */
623 #define YYNSTATES 51
625 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
626 #define YYUNDEFTOK 2
627 #define YYMAXUTOK 267
629 #define YYTRANSLATE(YYX) \
630 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
632 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
633 static const yytype_uint8 yytranslate[] =
635 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
639 2, 2, 17, 2, 13, 19, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 18, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 15, 2, 16, 2, 2, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
647 2, 2, 2, 2, 14, 2, 2, 2, 2, 2,
648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
649 2, 2, 2, 2, 2, 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, 2, 2, 2, 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, 1, 2, 3, 4,
661 5, 6, 7, 8, 9, 10, 11, 12
664 #if YYDEBUG
665 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
666 YYRHS. */
667 static const yytype_uint8 yyprhs[] =
669 0, 0, 3, 5, 8, 9, 15, 16, 26, 28,
670 31, 35, 38, 39, 41, 43, 45, 49, 53, 57,
671 59, 62, 63, 68, 69, 71, 73, 75, 77, 79
674 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
675 static const yytype_int8 yyrhs[] =
677 21, 0, -1, 22, -1, 23, 22, -1, -1, 31,
678 32, 33, 34, 11, -1, -1, 31, 8, 33, 34,
679 30, 29, 24, 25, 11, -1, 11, -1, 1, 11,
680 -1, 13, 27, 25, -1, 27, 25, -1, -1, 32,
681 -1, 7, -1, 6, -1, 26, 30, 29, -1, 9,
682 14, 28, -1, 15, 28, 16, -1, 9, -1, 17,
683 28, -1, -1, 18, 9, 19, 9, -1, -1, 12,
684 -1, 3, -1, 4, -1, 5, -1, 10, -1, 9,
688 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
689 static const yytype_uint16 yyrline[] =
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
695 #endif
697 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
698 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
699 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
700 static const char *const yytname[] =
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", 0
708 #endif
710 # ifdef YYPRINT
711 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
712 token YYLEX-NUM. */
713 static const yytype_uint16 yytoknum[] =
715 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
716 265, 266, 267, 44, 124, 91, 93, 42, 58, 45
718 # endif
720 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
721 static const yytype_uint8 yyr1[] =
723 0, 20, 21, 22, 22, 23, 24, 23, 23, 23,
724 25, 25, 25, 26, 26, 26, 27, 28, 28, 28,
725 29, 29, 30, 30, 31, 32, 32, 32, 33, 34
728 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
729 static const yytype_uint8 yyr2[] =
731 0, 2, 1, 2, 0, 5, 0, 9, 1, 2,
732 3, 2, 0, 1, 1, 1, 3, 3, 3, 1,
733 2, 0, 4, 0, 1, 1, 1, 1, 1, 1
736 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
737 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
738 means the default is an error. */
739 static const yytype_uint8 yydefact[] =
741 0, 0, 8, 24, 0, 2, 0, 0, 9, 1,
742 3, 25, 26, 27, 0, 0, 28, 0, 0, 29,
743 23, 0, 0, 21, 5, 0, 0, 6, 0, 19,
744 0, 20, 12, 22, 0, 0, 15, 14, 0, 0,
745 23, 12, 13, 17, 18, 12, 7, 21, 11, 10,
749 /* YYDEFGOTO[NTERM-NUM]. */
750 static const yytype_int8 yydefgoto[] =
752 -1, 4, 5, 6, 32, 39, 40, 41, 31, 27,
753 23, 7, 42, 17, 20
756 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
757 STATE-NUM. */
758 #define YYPACT_NINF -16
759 static const yytype_int8 yypact[] =
761 0, -9, -16, -16, 10, -16, 0, 12, -16, -16,
762 -16, -16, -16, -16, 3, 3, -16, 9, 9, -16,
763 11, 8, 19, 15, -16, 14, -6, -16, 25, 21,
764 -6, -16, 1, -16, -6, 20, -16, -16, 18, 26,
765 11, 1, -16, -16, -16, 1, -16, 15, -16, -16,
769 /* YYPGOTO[NTERM-NUM]. */
770 static const yytype_int8 yypgoto[] =
772 -16, -16, 32, -16, -16, -15, -16, 2, -3, -8,
773 4, -16, 34, 27, 28
776 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
777 positive, shift that token. If negative, reduce the rule which
778 number is the opposite. If zero, do what YYDEFACT says.
779 If YYTABLE_NINF, syntax error. */
780 #define YYTABLE_NINF -5
781 static const yytype_int8 yytable[] =
783 -4, 1, 8, 29, 11, 12, 13, 36, 37, 30,
784 9, 2, 3, 16, 38, 11, 12, 13, 19, 24,
785 14, 11, 12, 13, 36, 37, 48, 35, 25, 22,
786 49, 43, 26, 28, 33, 34, 44, 46, 10, 50,
787 45, 15, 18, 0, 47, 0, 21
790 static const yytype_int8 yycheck[] =
792 0, 1, 11, 9, 3, 4, 5, 6, 7, 15,
793 0, 11, 12, 10, 13, 3, 4, 5, 9, 11,
794 8, 3, 4, 5, 6, 7, 41, 30, 9, 18,
795 45, 34, 17, 19, 9, 14, 16, 11, 6, 47,
796 38, 7, 15, -1, 40, -1, 18
799 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
800 symbol of state STATE-NUM. */
801 static const yytype_uint8 yystos[] =
803 0, 1, 11, 12, 21, 22, 23, 31, 11, 0,
804 22, 3, 4, 5, 8, 32, 10, 33, 33, 9,
805 34, 34, 18, 30, 11, 9, 17, 29, 19, 9,
806 15, 28, 24, 9, 14, 28, 6, 7, 13, 25,
807 26, 27, 32, 28, 16, 27, 11, 30, 25, 25,
811 #define yyerrok (yyerrstatus = 0)
812 #define yyclearin (yychar = YYEMPTY)
813 #define YYEMPTY (-2)
814 #define YYEOF 0
816 #define YYACCEPT goto yyacceptlab
817 #define YYABORT goto yyabortlab
818 #define YYERROR goto yyerrorlab
821 /* Like YYERROR except do call yyerror. This remains here temporarily
822 to ease the transition to the new meaning of YYERROR, for GCC.
823 Once GCC version 2 has supplanted version 1, this can go. */
825 #define YYFAIL goto yyerrlab
827 #define YYRECOVERING() (!!yyerrstatus)
829 #define YYBACKUP(Token, Value) \
830 do \
831 if (yychar == YYEMPTY && yylen == 1) \
833 yychar = (Token); \
834 yylval = (Value); \
835 yytoken = YYTRANSLATE (yychar); \
836 YYPOPSTACK (1); \
837 goto yybackup; \
839 else \
841 yyerror (YY_("syntax error: cannot back up")); \
842 YYERROR; \
844 while (YYID (0))
847 #define YYTERROR 1
848 #define YYERRCODE 256
851 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
852 If N is 0, then set CURRENT to the empty location which ends
853 the previous symbol: RHS[0] (always defined). */
855 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
856 #ifndef YYLLOC_DEFAULT
857 # define YYLLOC_DEFAULT(Current, Rhs, N) \
858 do \
859 if (YYID (N)) \
861 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
862 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
863 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
864 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
866 else \
868 (Current).first_line = (Current).last_line = \
869 YYRHSLOC (Rhs, 0).last_line; \
870 (Current).first_column = (Current).last_column = \
871 YYRHSLOC (Rhs, 0).last_column; \
873 while (YYID (0))
874 #endif
877 /* YY_LOCATION_PRINT -- Print the location on the stream.
878 This macro was not mandated originally: define only if we know
879 we won't break user code: when these are the locations we know. */
881 #ifndef YY_LOCATION_PRINT
882 # if YYLTYPE_IS_TRIVIAL
883 # define YY_LOCATION_PRINT(File, Loc) \
884 fprintf (File, "%d.%d-%d.%d", \
885 (Loc).first_line, (Loc).first_column, \
886 (Loc).last_line, (Loc).last_column)
887 # else
888 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
889 # endif
890 #endif
893 /* YYLEX -- calling `yylex' with the right arguments. */
895 #ifdef YYLEX_PARAM
896 # define YYLEX yylex (YYLEX_PARAM)
897 #else
898 # define YYLEX yylex ()
899 #endif
901 /* Enable debugging if requested. */
902 #if YYDEBUG
904 # ifndef YYFPRINTF
905 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
906 # define YYFPRINTF fprintf
907 # endif
909 # define YYDPRINTF(Args) \
910 do { \
911 if (yydebug) \
912 YYFPRINTF Args; \
913 } while (YYID (0))
915 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
916 do { \
917 if (yydebug) \
919 YYFPRINTF (stderr, "%s ", Title); \
920 yy_symbol_print (stderr, \
921 Type, Value); \
922 YYFPRINTF (stderr, "\n"); \
924 } while (YYID (0))
927 /*--------------------------------.
928 | Print this symbol on YYOUTPUT. |
929 `--------------------------------*/
931 /*ARGSUSED*/
932 #if (defined __STDC__ || defined __C99__FUNC__ \
933 || defined __cplusplus || defined _MSC_VER)
934 static void
935 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
936 #else
937 static void
938 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
939 FILE *yyoutput;
940 int yytype;
941 YYSTYPE const * const yyvaluep;
942 #endif
944 if (!yyvaluep)
945 return;
946 # ifdef YYPRINT
947 if (yytype < YYNTOKENS)
948 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
949 # else
950 YYUSE (yyoutput);
951 # endif
952 switch (yytype)
954 default:
955 break;
960 /*--------------------------------.
961 | Print this symbol on YYOUTPUT. |
962 `--------------------------------*/
964 #if (defined __STDC__ || defined __C99__FUNC__ \
965 || defined __cplusplus || defined _MSC_VER)
966 static void
967 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
968 #else
969 static void
970 yy_symbol_print (yyoutput, yytype, yyvaluep)
971 FILE *yyoutput;
972 int yytype;
973 YYSTYPE const * const yyvaluep;
974 #endif
976 if (yytype < YYNTOKENS)
977 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
978 else
979 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
981 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
982 YYFPRINTF (yyoutput, ")");
985 /*------------------------------------------------------------------.
986 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
987 | TOP (included). |
988 `------------------------------------------------------------------*/
990 #if (defined __STDC__ || defined __C99__FUNC__ \
991 || defined __cplusplus || defined _MSC_VER)
992 static void
993 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
994 #else
995 static void
996 yy_stack_print (bottom, top)
997 yytype_int16 *bottom;
998 yytype_int16 *top;
999 #endif
1001 YYFPRINTF (stderr, "Stack now");
1002 for (; bottom <= top; ++bottom)
1003 YYFPRINTF (stderr, " %d", *bottom);
1004 YYFPRINTF (stderr, "\n");
1007 # define YY_STACK_PRINT(Bottom, Top) \
1008 do { \
1009 if (yydebug) \
1010 yy_stack_print ((Bottom), (Top)); \
1011 } while (YYID (0))
1014 /*------------------------------------------------.
1015 | Report that the YYRULE is going to be reduced. |
1016 `------------------------------------------------*/
1018 #if (defined __STDC__ || defined __C99__FUNC__ \
1019 || defined __cplusplus || defined _MSC_VER)
1020 static void
1021 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1022 #else
1023 static void
1024 yy_reduce_print (yyvsp, yyrule)
1025 YYSTYPE *yyvsp;
1026 int yyrule;
1027 #endif
1029 int yynrhs = yyr2[yyrule];
1030 int yyi;
1031 unsigned long int yylno = yyrline[yyrule];
1032 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1033 yyrule - 1, yylno);
1034 /* The symbols being reduced. */
1035 for (yyi = 0; yyi < yynrhs; yyi++)
1037 fprintf (stderr, " $%d = ", yyi + 1);
1038 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1039 &(yyvsp[(yyi + 1) - (yynrhs)])
1041 fprintf (stderr, "\n");
1045 # define YY_REDUCE_PRINT(Rule) \
1046 do { \
1047 if (yydebug) \
1048 yy_reduce_print (yyvsp, Rule); \
1049 } while (YYID (0))
1051 /* Nonzero means print parse trace. It is left uninitialized so that
1052 multiple parsers can coexist. */
1053 int yydebug;
1054 #else /* !YYDEBUG */
1055 # define YYDPRINTF(Args)
1056 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1057 # define YY_STACK_PRINT(Bottom, Top)
1058 # define YY_REDUCE_PRINT(Rule)
1059 #endif /* !YYDEBUG */
1062 /* YYINITDEPTH -- initial size of the parser's stacks. */
1063 #ifndef YYINITDEPTH
1064 # define YYINITDEPTH 200
1065 #endif
1067 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1068 if the built-in stack extension method is used).
1070 Do not make this value too large; the results are undefined if
1071 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1072 evaluated with infinite-precision integer arithmetic. */
1074 #ifndef YYMAXDEPTH
1075 # define YYMAXDEPTH 10000
1076 #endif
1080 #if YYERROR_VERBOSE
1082 # ifndef yystrlen
1083 # if defined __GLIBC__ && defined _STRING_H
1084 # define yystrlen strlen
1085 # else
1086 /* Return the length of YYSTR. */
1087 #if (defined __STDC__ || defined __C99__FUNC__ \
1088 || defined __cplusplus || defined _MSC_VER)
1089 static YYSIZE_T
1090 yystrlen (const char *yystr)
1091 #else
1092 static YYSIZE_T
1093 yystrlen (yystr)
1094 const char *yystr;
1095 #endif
1097 YYSIZE_T yylen;
1098 for (yylen = 0; yystr[yylen]; yylen++)
1099 continue;
1100 return yylen;
1102 # endif
1103 # endif
1105 # ifndef yystpcpy
1106 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1107 # define yystpcpy stpcpy
1108 # else
1109 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1110 YYDEST. */
1111 #if (defined __STDC__ || defined __C99__FUNC__ \
1112 || defined __cplusplus || defined _MSC_VER)
1113 static char *
1114 yystpcpy (char *yydest, const char *yysrc)
1115 #else
1116 static char *
1117 yystpcpy (yydest, yysrc)
1118 char *yydest;
1119 const char *yysrc;
1120 #endif
1122 char *yyd = yydest;
1123 const char *yys = yysrc;
1125 while ((*yyd++ = *yys++) != '\0')
1126 continue;
1128 return yyd - 1;
1130 # endif
1131 # endif
1133 # ifndef yytnamerr
1134 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1135 quotes and backslashes, so that it's suitable for yyerror. The
1136 heuristic is that double-quoting is unnecessary unless the string
1137 contains an apostrophe, a comma, or backslash (other than
1138 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1139 null, do not copy; instead, return the length of what the result
1140 would have been. */
1141 static YYSIZE_T
1142 yytnamerr (char *yyres, const char *yystr)
1144 if (*yystr == '"')
1146 YYSIZE_T yyn = 0;
1147 char const *yyp = yystr;
1149 for (;;)
1150 switch (*++yyp)
1152 case '\'':
1153 case ',':
1154 goto do_not_strip_quotes;
1156 case '\\':
1157 if (*++yyp != '\\')
1158 goto do_not_strip_quotes;
1159 /* Fall through. */
1160 default:
1161 if (yyres)
1162 yyres[yyn] = *yyp;
1163 yyn++;
1164 break;
1166 case '"':
1167 if (yyres)
1168 yyres[yyn] = '\0';
1169 return yyn;
1171 do_not_strip_quotes: ;
1174 if (! yyres)
1175 return yystrlen (yystr);
1177 return yystpcpy (yyres, yystr) - yyres;
1179 # endif
1181 /* Copy into YYRESULT an error message about the unexpected token
1182 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1183 including the terminating null byte. If YYRESULT is null, do not
1184 copy anything; just return the number of bytes that would be
1185 copied. As a special case, return 0 if an ordinary "syntax error"
1186 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1187 size calculation. */
1188 static YYSIZE_T
1189 yysyntax_error (char *yyresult, int yystate, int yychar)
1191 int yyn = yypact[yystate];
1193 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1194 return 0;
1195 else
1197 int yytype = YYTRANSLATE (yychar);
1198 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1199 YYSIZE_T yysize = yysize0;
1200 YYSIZE_T yysize1;
1201 int yysize_overflow = 0;
1202 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1203 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1204 int yyx;
1206 # if 0
1207 /* This is so xgettext sees the translatable formats that are
1208 constructed on the fly. */
1209 YY_("syntax error, unexpected %s");
1210 YY_("syntax error, unexpected %s, expecting %s");
1211 YY_("syntax error, unexpected %s, expecting %s or %s");
1212 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1213 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1214 # endif
1215 char *yyfmt;
1216 char const *yyf;
1217 static char const yyunexpected[] = "syntax error, unexpected %s";
1218 static char const yyexpecting[] = ", expecting %s";
1219 static char const yyor[] = " or %s";
1220 char yyformat[sizeof yyunexpected
1221 + sizeof yyexpecting - 1
1222 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1223 * (sizeof yyor - 1))];
1224 char const *yyprefix = yyexpecting;
1226 /* Start YYX at -YYN if negative to avoid negative indexes in
1227 YYCHECK. */
1228 int yyxbegin = yyn < 0 ? -yyn : 0;
1230 /* Stay within bounds of both yycheck and yytname. */
1231 int yychecklim = YYLAST - yyn + 1;
1232 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1233 int yycount = 1;
1235 yyarg[0] = yytname[yytype];
1236 yyfmt = yystpcpy (yyformat, yyunexpected);
1238 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1239 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1241 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1243 yycount = 1;
1244 yysize = yysize0;
1245 yyformat[sizeof yyunexpected - 1] = '\0';
1246 break;
1248 yyarg[yycount++] = yytname[yyx];
1249 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1250 yysize_overflow |= (yysize1 < yysize);
1251 yysize = yysize1;
1252 yyfmt = yystpcpy (yyfmt, yyprefix);
1253 yyprefix = yyor;
1256 yyf = YY_(yyformat);
1257 yysize1 = yysize + yystrlen (yyf);
1258 yysize_overflow |= (yysize1 < yysize);
1259 yysize = yysize1;
1261 if (yysize_overflow)
1262 return YYSIZE_MAXIMUM;
1264 if (yyresult)
1266 /* Avoid sprintf, as that infringes on the user's name space.
1267 Don't have undefined behavior even if the translation
1268 produced a string with the wrong number of "%s"s. */
1269 char *yyp = yyresult;
1270 int yyi = 0;
1271 while ((*yyp = *yyf) != '\0')
1273 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1275 yyp += yytnamerr (yyp, yyarg[yyi++]);
1276 yyf += 2;
1278 else
1280 yyp++;
1281 yyf++;
1285 return yysize;
1288 #endif /* YYERROR_VERBOSE */
1291 /*-----------------------------------------------.
1292 | Release the memory associated to this symbol. |
1293 `-----------------------------------------------*/
1295 /*ARGSUSED*/
1296 #if (defined __STDC__ || defined __C99__FUNC__ \
1297 || defined __cplusplus || defined _MSC_VER)
1298 static void
1299 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1300 #else
1301 static void
1302 yydestruct (yymsg, yytype, yyvaluep)
1303 const char *yymsg;
1304 int yytype;
1305 YYSTYPE *yyvaluep;
1306 #endif
1308 YYUSE (yyvaluep);
1310 if (!yymsg)
1311 yymsg = "Deleting";
1312 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1314 switch (yytype)
1317 default:
1318 break;
1323 /* Prevent warnings from -Wmissing-prototypes. */
1325 #ifdef YYPARSE_PARAM
1326 #if defined __STDC__ || defined __cplusplus
1327 int yyparse (void *YYPARSE_PARAM);
1328 #else
1329 int yyparse ();
1330 #endif
1331 #else /* ! YYPARSE_PARAM */
1332 #if defined __STDC__ || defined __cplusplus
1333 int yyparse (void);
1334 #else
1335 int yyparse ();
1336 #endif
1337 #endif /* ! YYPARSE_PARAM */
1341 /* The look-ahead symbol. */
1342 int yychar;
1344 /* The semantic value of the look-ahead symbol. */
1345 YYSTYPE yylval;
1347 /* Number of syntax errors so far. */
1348 int yynerrs;
1352 /*----------.
1353 | yyparse. |
1354 `----------*/
1356 #ifdef YYPARSE_PARAM
1357 #if (defined __STDC__ || defined __C99__FUNC__ \
1358 || defined __cplusplus || defined _MSC_VER)
1360 yyparse (void *YYPARSE_PARAM)
1361 #else
1363 yyparse (YYPARSE_PARAM)
1364 void *YYPARSE_PARAM;
1365 #endif
1366 #else /* ! YYPARSE_PARAM */
1367 #if (defined __STDC__ || defined __C99__FUNC__ \
1368 || defined __cplusplus || defined _MSC_VER)
1370 yyparse (void)
1371 #else
1373 yyparse ()
1375 #endif
1376 #endif
1379 int yystate;
1380 int yyn;
1381 int yyresult;
1382 /* Number of tokens to shift before error messages enabled. */
1383 int yyerrstatus;
1384 /* Look-ahead token as an internal (translated) token number. */
1385 int yytoken = 0;
1386 #if YYERROR_VERBOSE
1387 /* Buffer for error messages, and its allocated size. */
1388 char yymsgbuf[128];
1389 char *yymsg = yymsgbuf;
1390 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1391 #endif
1393 /* Three stacks and their tools:
1394 `yyss': related to states,
1395 `yyvs': related to semantic values,
1396 `yyls': related to locations.
1398 Refer to the stacks thru separate pointers, to allow yyoverflow
1399 to reallocate them elsewhere. */
1401 /* The state stack. */
1402 yytype_int16 yyssa[YYINITDEPTH];
1403 yytype_int16 *yyss = yyssa;
1404 yytype_int16 *yyssp;
1406 /* The semantic value stack. */
1407 YYSTYPE yyvsa[YYINITDEPTH];
1408 YYSTYPE *yyvs = yyvsa;
1409 YYSTYPE *yyvsp;
1413 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1415 YYSIZE_T yystacksize = YYINITDEPTH;
1417 /* The variables used to return semantic value and location from the
1418 action routines. */
1419 YYSTYPE yyval;
1422 /* The number of symbols on the RHS of the reduced rule.
1423 Keep to zero when no symbol should be popped. */
1424 int yylen = 0;
1426 YYDPRINTF ((stderr, "Starting parse\n"));
1428 yystate = 0;
1429 yyerrstatus = 0;
1430 yynerrs = 0;
1431 yychar = YYEMPTY; /* Cause a token to be read. */
1433 /* Initialize stack pointers.
1434 Waste one element of value and location stack
1435 so that they stay on the same level as the state stack.
1436 The wasted elements are never initialized. */
1438 yyssp = yyss;
1439 yyvsp = yyvs;
1441 goto yysetstate;
1443 /*------------------------------------------------------------.
1444 | yynewstate -- Push a new state, which is found in yystate. |
1445 `------------------------------------------------------------*/
1446 yynewstate:
1447 /* In all cases, when you get here, the value and location stacks
1448 have just been pushed. So pushing a state here evens the stacks. */
1449 yyssp++;
1451 yysetstate:
1452 *yyssp = yystate;
1454 if (yyss + yystacksize - 1 <= yyssp)
1456 /* Get the current used size of the three stacks, in elements. */
1457 YYSIZE_T yysize = yyssp - yyss + 1;
1459 #ifdef yyoverflow
1461 /* Give user a chance to reallocate the stack. Use copies of
1462 these so that the &'s don't force the real ones into
1463 memory. */
1464 YYSTYPE *yyvs1 = yyvs;
1465 yytype_int16 *yyss1 = yyss;
1468 /* Each stack pointer address is followed by the size of the
1469 data in use in that stack, in bytes. This used to be a
1470 conditional around just the two extra args, but that might
1471 be undefined if yyoverflow is a macro. */
1472 yyoverflow (YY_("memory exhausted"),
1473 &yyss1, yysize * sizeof (*yyssp),
1474 &yyvs1, yysize * sizeof (*yyvsp),
1476 &yystacksize);
1478 yyss = yyss1;
1479 yyvs = yyvs1;
1481 #else /* no yyoverflow */
1482 # ifndef YYSTACK_RELOCATE
1483 goto yyexhaustedlab;
1484 # else
1485 /* Extend the stack our own way. */
1486 if (YYMAXDEPTH <= yystacksize)
1487 goto yyexhaustedlab;
1488 yystacksize *= 2;
1489 if (YYMAXDEPTH < yystacksize)
1490 yystacksize = YYMAXDEPTH;
1493 yytype_int16 *yyss1 = yyss;
1494 union yyalloc *yyptr =
1495 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1496 if (! yyptr)
1497 goto yyexhaustedlab;
1498 YYSTACK_RELOCATE (yyss);
1499 YYSTACK_RELOCATE (yyvs);
1501 # undef YYSTACK_RELOCATE
1502 if (yyss1 != yyssa)
1503 YYSTACK_FREE (yyss1);
1505 # endif
1506 #endif /* no yyoverflow */
1508 yyssp = yyss + yysize - 1;
1509 yyvsp = yyvs + yysize - 1;
1512 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1513 (unsigned long int) yystacksize));
1515 if (yyss + yystacksize - 1 <= yyssp)
1516 YYABORT;
1519 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1521 goto yybackup;
1523 /*-----------.
1524 | yybackup. |
1525 `-----------*/
1526 yybackup:
1528 /* Do appropriate processing given the current state. Read a
1529 look-ahead token if we need one and don't already have one. */
1531 /* First try to decide what to do without reference to look-ahead token. */
1532 yyn = yypact[yystate];
1533 if (yyn == YYPACT_NINF)
1534 goto yydefault;
1536 /* Not known => get a look-ahead token if don't already have one. */
1538 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1539 if (yychar == YYEMPTY)
1541 YYDPRINTF ((stderr, "Reading a token: "));
1542 yychar = YYLEX;
1545 if (yychar <= YYEOF)
1547 yychar = yytoken = YYEOF;
1548 YYDPRINTF ((stderr, "Now at end of input.\n"));
1550 else
1552 yytoken = YYTRANSLATE (yychar);
1553 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1556 /* If the proper action on seeing token YYTOKEN is to reduce or to
1557 detect an error, take that action. */
1558 yyn += yytoken;
1559 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1560 goto yydefault;
1561 yyn = yytable[yyn];
1562 if (yyn <= 0)
1564 if (yyn == 0 || yyn == YYTABLE_NINF)
1565 goto yyerrlab;
1566 yyn = -yyn;
1567 goto yyreduce;
1570 if (yyn == YYFINAL)
1571 YYACCEPT;
1573 /* Count tokens shifted since error; after three, turn off error
1574 status. */
1575 if (yyerrstatus)
1576 yyerrstatus--;
1578 /* Shift the look-ahead token. */
1579 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1581 /* Discard the shifted token unless it is eof. */
1582 if (yychar != YYEOF)
1583 yychar = YYEMPTY;
1585 yystate = yyn;
1586 *++yyvsp = yylval;
1588 goto yynewstate;
1591 /*-----------------------------------------------------------.
1592 | yydefault -- do the default action for the current state. |
1593 `-----------------------------------------------------------*/
1594 yydefault:
1595 yyn = yydefact[yystate];
1596 if (yyn == 0)
1597 goto yyerrlab;
1598 goto yyreduce;
1601 /*-----------------------------.
1602 | yyreduce -- Do a reduction. |
1603 `-----------------------------*/
1604 yyreduce:
1605 /* yyn is the number of a rule to reduce with. */
1606 yylen = yyr2[yyn];
1608 /* If YYLEN is nonzero, implement the default value of the action:
1609 `$$ = $1'.
1611 Otherwise, the following line sets YYVAL to garbage.
1612 This behavior is undocumented and Bison
1613 users should not rely upon it. Assigning to YYVAL
1614 unconditionally makes the parser a bit smaller, and it avoids a
1615 GCC warning that YYVAL may be used uninitialized. */
1616 yyval = yyvsp[1-yylen];
1619 YY_REDUCE_PRINT (yyn);
1620 switch (yyn)
1622 case 5:
1623 #line 309 "itbl-parse.y"
1625 DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n",
1626 insntbl_line, (yyvsp[(1) - (5)].num), (yyvsp[(2) - (5)].num), (yyvsp[(3) - (5)].str), (yyvsp[(4) - (5)].val)));
1627 itbl_add_reg ((yyvsp[(1) - (5)].num), (yyvsp[(2) - (5)].num), (yyvsp[(3) - (5)].str), (yyvsp[(4) - (5)].val));
1629 break;
1631 case 6:
1632 #line 315 "itbl-parse.y"
1634 DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x",
1635 insntbl_line, (yyvsp[(1) - (6)].num), (yyvsp[(3) - (6)].str), (yyvsp[(4) - (6)].val)));
1636 DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, (yyvsp[(6) - (6)].val)));
1637 insn=itbl_add_insn ((yyvsp[(1) - (6)].num), (yyvsp[(3) - (6)].str), (yyvsp[(4) - (6)].val), sbit, ebit, (yyvsp[(6) - (6)].val));
1639 break;
1641 case 7:
1642 #line 322 "itbl-parse.y"
1644 break;
1646 case 13:
1647 #line 335 "itbl-parse.y"
1649 DBGL2 (("ftype\n"));
1650 (yyval.num) = (yyvsp[(1) - (1)].num);
1652 break;
1654 case 14:
1655 #line 340 "itbl-parse.y"
1657 DBGL2 (("addr\n"));
1658 (yyval.num) = ADDR;
1660 break;
1662 case 15:
1663 #line 345 "itbl-parse.y"
1665 DBGL2 (("immed\n"));
1666 (yyval.num) = IMMED;
1668 break;
1670 case 16:
1671 #line 353 "itbl-parse.y"
1673 DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n",
1674 insntbl_line, (yyvsp[(1) - (3)].num), sbit, ebit, (yyvsp[(3) - (3)].val)));
1675 itbl_add_operand (insn, (yyvsp[(1) - (3)].num), sbit, ebit, (yyvsp[(3) - (3)].val));
1677 break;
1679 case 17:
1680 #line 362 "itbl-parse.y"
1682 (yyval.val) = (yyvsp[(1) - (3)].num) | (yyvsp[(3) - (3)].val);
1684 break;
1686 case 18:
1687 #line 366 "itbl-parse.y"
1689 (yyval.val) = (yyvsp[(2) - (3)].val);
1691 break;
1693 case 19:
1694 #line 370 "itbl-parse.y"
1696 (yyval.val) = (yyvsp[(1) - (1)].num);
1698 break;
1700 case 20:
1701 #line 377 "itbl-parse.y"
1703 DBGL2 (("flags=%d\n", (yyvsp[(2) - (2)].val)));
1704 (yyval.val) = (yyvsp[(2) - (2)].val);
1706 break;
1708 case 21:
1709 #line 382 "itbl-parse.y"
1711 (yyval.val) = 0;
1713 break;
1715 case 22:
1716 #line 389 "itbl-parse.y"
1718 DBGL2 (("range %d %d\n", (yyvsp[(2) - (4)].num), (yyvsp[(4) - (4)].num)));
1719 sbit = (yyvsp[(2) - (4)].num);
1720 ebit = (yyvsp[(4) - (4)].num);
1722 break;
1724 case 23:
1725 #line 395 "itbl-parse.y"
1727 sbit = 31;
1728 ebit = 0;
1730 break;
1732 case 24:
1733 #line 403 "itbl-parse.y"
1735 DBGL2 (("pnum=%d\n",(yyvsp[(1) - (1)].num)));
1736 (yyval.num) = (yyvsp[(1) - (1)].num);
1738 break;
1740 case 25:
1741 #line 411 "itbl-parse.y"
1743 DBGL2 (("dreg\n"));
1744 (yyval.num) = DREG;
1746 break;
1748 case 26:
1749 #line 416 "itbl-parse.y"
1751 DBGL2 (("creg\n"));
1752 (yyval.num) = CREG;
1754 break;
1756 case 27:
1757 #line 421 "itbl-parse.y"
1759 DBGL2 (("greg\n"));
1760 (yyval.num) = GREG;
1762 break;
1764 case 28:
1765 #line 429 "itbl-parse.y"
1767 DBGL2 (("name=%s\n",(yyvsp[(1) - (1)].str)));
1768 (yyval.str) = (yyvsp[(1) - (1)].str);
1770 break;
1772 case 29:
1773 #line 445 "itbl-parse.y"
1775 DBGL2 (("val=x%x\n",(yyvsp[(1) - (1)].num)));
1776 (yyval.val) = (yyvsp[(1) - (1)].num);
1778 break;
1781 /* Line 1267 of yacc.c. */
1782 #line 1783 "itbl-parse.c"
1783 default: break;
1785 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1787 YYPOPSTACK (yylen);
1788 yylen = 0;
1789 YY_STACK_PRINT (yyss, yyssp);
1791 *++yyvsp = yyval;
1794 /* Now `shift' the result of the reduction. Determine what state
1795 that goes to, based on the state we popped back to and the rule
1796 number reduced by. */
1798 yyn = yyr1[yyn];
1800 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1801 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1802 yystate = yytable[yystate];
1803 else
1804 yystate = yydefgoto[yyn - YYNTOKENS];
1806 goto yynewstate;
1809 /*------------------------------------.
1810 | yyerrlab -- here on detecting error |
1811 `------------------------------------*/
1812 yyerrlab:
1813 /* If not already recovering from an error, report this error. */
1814 if (!yyerrstatus)
1816 ++yynerrs;
1817 #if ! YYERROR_VERBOSE
1818 yyerror (YY_("syntax error"));
1819 #else
1821 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1822 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1824 YYSIZE_T yyalloc = 2 * yysize;
1825 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1826 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1827 if (yymsg != yymsgbuf)
1828 YYSTACK_FREE (yymsg);
1829 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1830 if (yymsg)
1831 yymsg_alloc = yyalloc;
1832 else
1834 yymsg = yymsgbuf;
1835 yymsg_alloc = sizeof yymsgbuf;
1839 if (0 < yysize && yysize <= yymsg_alloc)
1841 (void) yysyntax_error (yymsg, yystate, yychar);
1842 yyerror (yymsg);
1844 else
1846 yyerror (YY_("syntax error"));
1847 if (yysize != 0)
1848 goto yyexhaustedlab;
1851 #endif
1856 if (yyerrstatus == 3)
1858 /* If just tried and failed to reuse look-ahead token after an
1859 error, discard it. */
1861 if (yychar <= YYEOF)
1863 /* Return failure if at end of input. */
1864 if (yychar == YYEOF)
1865 YYABORT;
1867 else
1869 yydestruct ("Error: discarding",
1870 yytoken, &yylval);
1871 yychar = YYEMPTY;
1875 /* Else will try to reuse look-ahead token after shifting the error
1876 token. */
1877 goto yyerrlab1;
1880 /*---------------------------------------------------.
1881 | yyerrorlab -- error raised explicitly by YYERROR. |
1882 `---------------------------------------------------*/
1883 yyerrorlab:
1885 /* Pacify compilers like GCC when the user code never invokes
1886 YYERROR and the label yyerrorlab therefore never appears in user
1887 code. */
1888 if (/*CONSTCOND*/ 0)
1889 goto yyerrorlab;
1891 /* Do not reclaim the symbols of the rule which action triggered
1892 this YYERROR. */
1893 YYPOPSTACK (yylen);
1894 yylen = 0;
1895 YY_STACK_PRINT (yyss, yyssp);
1896 yystate = *yyssp;
1897 goto yyerrlab1;
1900 /*-------------------------------------------------------------.
1901 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1902 `-------------------------------------------------------------*/
1903 yyerrlab1:
1904 yyerrstatus = 3; /* Each real token shifted decrements this. */
1906 for (;;)
1908 yyn = yypact[yystate];
1909 if (yyn != YYPACT_NINF)
1911 yyn += YYTERROR;
1912 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1914 yyn = yytable[yyn];
1915 if (0 < yyn)
1916 break;
1920 /* Pop the current state because it cannot handle the error token. */
1921 if (yyssp == yyss)
1922 YYABORT;
1925 yydestruct ("Error: popping",
1926 yystos[yystate], yyvsp);
1927 YYPOPSTACK (1);
1928 yystate = *yyssp;
1929 YY_STACK_PRINT (yyss, yyssp);
1932 if (yyn == YYFINAL)
1933 YYACCEPT;
1935 *++yyvsp = yylval;
1938 /* Shift the error token. */
1939 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1941 yystate = yyn;
1942 goto yynewstate;
1945 /*-------------------------------------.
1946 | yyacceptlab -- YYACCEPT comes here. |
1947 `-------------------------------------*/
1948 yyacceptlab:
1949 yyresult = 0;
1950 goto yyreturn;
1952 /*-----------------------------------.
1953 | yyabortlab -- YYABORT comes here. |
1954 `-----------------------------------*/
1955 yyabortlab:
1956 yyresult = 1;
1957 goto yyreturn;
1959 #ifndef yyoverflow
1960 /*-------------------------------------------------.
1961 | yyexhaustedlab -- memory exhaustion comes here. |
1962 `-------------------------------------------------*/
1963 yyexhaustedlab:
1964 yyerror (YY_("memory exhausted"));
1965 yyresult = 2;
1966 /* Fall through. */
1967 #endif
1969 yyreturn:
1970 if (yychar != YYEOF && yychar != YYEMPTY)
1971 yydestruct ("Cleanup: discarding lookahead",
1972 yytoken, &yylval);
1973 /* Do not reclaim the symbols of the rule which action triggered
1974 this YYABORT or YYACCEPT. */
1975 YYPOPSTACK (yylen);
1976 YY_STACK_PRINT (yyss, yyssp);
1977 while (yyssp != yyss)
1979 yydestruct ("Cleanup: popping",
1980 yystos[*yyssp], yyvsp);
1981 YYPOPSTACK (1);
1983 #ifndef yyoverflow
1984 if (yyss != yyssa)
1985 YYSTACK_FREE (yyss);
1986 #endif
1987 #if YYERROR_VERBOSE
1988 if (yymsg != yymsgbuf)
1989 YYSTACK_FREE (yymsg);
1990 #endif
1991 /* Make sure YYID is used. */
1992 return YYID (yyresult);
1996 #line 450 "itbl-parse.y"
1999 static int
2000 yyerror (msg)
2001 const char *msg;
2003 printf ("line %d: %s\n", insntbl_line, msg);
2004 return 0;