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