1 /* A Bison parser, made by GNU Bison 3.0.5. */ 2 3 /* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018 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.5" 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 default: /* Avoid compiler warnings. */ 1198 YYCASE_(0, YY_("syntax error")); 1199 YYCASE_(1, YY_("syntax error, unexpected %s")); 1200 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1201 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1202 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1203 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1204 # undef YYCASE_ 1205 } 1206 1207 { 1208 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1209 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1210 return 2; 1211 yysize = yysize1; 1212 } 1213 1214 if (*yymsg_alloc < yysize) 1215 { 1216 *yymsg_alloc = 2 * yysize; 1217 if (! (yysize <= *yymsg_alloc 1218 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1219 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1220 return 1; 1221 } 1222 1223 /* Avoid sprintf, as that infringes on the user's name space. 1224 Don't have undefined behavior even if the translation 1225 produced a string with the wrong number of "%s"s. */ 1226 { 1227 char *yyp = *yymsg; 1228 int yyi = 0; 1229 while ((*yyp = *yyformat) != '\0') 1230 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1231 { 1232 yyp += yytnamerr (yyp, yyarg[yyi++]); 1233 yyformat += 2; 1234 } 1235 else 1236 { 1237 yyp++; 1238 yyformat++; 1239 } 1240 } 1241 return 0; 1242 } 1243 #endif /* YYERROR_VERBOSE */ 1244 1245 /*-----------------------------------------------. 1246 | Release the memory associated to this symbol. | 1247 `-----------------------------------------------*/ 1248 1249 static void 1250 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1251 { 1252 YYUSE (yyvaluep); 1253 if (!yymsg) 1254 yymsg = "Deleting"; 1255 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1256 1257 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1258 YYUSE (yytype); 1259 YY_IGNORE_MAYBE_UNINITIALIZED_END 1260 } 1261 1262 1263 1264 1265 /* The lookahead symbol. */ 1266 int yychar; 1267 1268 /* The semantic value of the lookahead symbol. */ 1269 YYSTYPE yylval; 1270 /* Number of syntax errors so far. */ 1271 int yynerrs; 1272 1273 1274 /*----------. 1275 | yyparse. | 1276 `----------*/ 1277 1278 int 1279 yyparse (void) 1280 { 1281 int yystate; 1282 /* Number of tokens to shift before error messages enabled. */ 1283 int yyerrstatus; 1284 1285 /* The stacks and their tools: 1286 'yyss': related to states. 1287 'yyvs': related to semantic values. 1288 1289 Refer to the stacks through separate pointers, to allow yyoverflow 1290 to reallocate them elsewhere. */ 1291 1292 /* The state stack. */ 1293 yytype_int16 yyssa[YYINITDEPTH]; 1294 yytype_int16 *yyss; 1295 yytype_int16 *yyssp; 1296 1297 /* The semantic value stack. */ 1298 YYSTYPE yyvsa[YYINITDEPTH]; 1299 YYSTYPE *yyvs; 1300 YYSTYPE *yyvsp; 1301 1302 YYSIZE_T yystacksize; 1303 1304 int yyn; 1305 int yyresult; 1306 /* Lookahead token as an internal (translated) token number. */ 1307 int yytoken = 0; 1308 /* The variables used to return semantic value and location from the 1309 action routines. */ 1310 YYSTYPE yyval; 1311 1312 #if YYERROR_VERBOSE 1313 /* Buffer for error messages, and its allocated size. */ 1314 char yymsgbuf[128]; 1315 char *yymsg = yymsgbuf; 1316 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1317 #endif 1318 1319 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1320 1321 /* The number of symbols on the RHS of the reduced rule. 1322 Keep to zero when no symbol should be popped. */ 1323 int yylen = 0; 1324 1325 yyssp = yyss = yyssa; 1326 yyvsp = yyvs = yyvsa; 1327 yystacksize = YYINITDEPTH; 1328 1329 YYDPRINTF ((stderr, "Starting parse\n")); 1330 1331 yystate = 0; 1332 yyerrstatus = 0; 1333 yynerrs = 0; 1334 yychar = YYEMPTY; /* Cause a token to be read. */ 1335 goto yysetstate; 1336 1337 /*------------------------------------------------------------. 1338 | yynewstate -- Push a new state, which is found in yystate. | 1339 `------------------------------------------------------------*/ 1340 yynewstate: 1341 /* In all cases, when you get here, the value and location stacks 1342 have just been pushed. So pushing a state here evens the stacks. */ 1343 yyssp++; 1344 1345 yysetstate: 1346 *yyssp = yystate; 1347 1348 if (yyss + yystacksize - 1 <= yyssp) 1349 { 1350 /* Get the current used size of the three stacks, in elements. */ 1351 YYSIZE_T yysize = yyssp - yyss + 1; 1352 1353 #ifdef yyoverflow 1354 { 1355 /* Give user a chance to reallocate the stack. Use copies of 1356 these so that the &'s don't force the real ones into 1357 memory. */ 1358 YYSTYPE *yyvs1 = yyvs; 1359 yytype_int16 *yyss1 = yyss; 1360 1361 /* Each stack pointer address is followed by the size of the 1362 data in use in that stack, in bytes. This used to be a 1363 conditional around just the two extra args, but that might 1364 be undefined if yyoverflow is a macro. */ 1365 yyoverflow (YY_("memory exhausted"), 1366 &yyss1, yysize * sizeof (*yyssp), 1367 &yyvs1, yysize * sizeof (*yyvsp), 1368 &yystacksize); 1369 1370 yyss = yyss1; 1371 yyvs = yyvs1; 1372 } 1373 #else /* no yyoverflow */ 1374 # ifndef YYSTACK_RELOCATE 1375 goto yyexhaustedlab; 1376 # else 1377 /* Extend the stack our own way. */ 1378 if (YYMAXDEPTH <= yystacksize) 1379 goto yyexhaustedlab; 1380 yystacksize *= 2; 1381 if (YYMAXDEPTH < yystacksize) 1382 yystacksize = YYMAXDEPTH; 1383 1384 { 1385 yytype_int16 *yyss1 = yyss; 1386 union yyalloc *yyptr = 1387 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1388 if (! yyptr) 1389 goto yyexhaustedlab; 1390 YYSTACK_RELOCATE (yyss_alloc, yyss); 1391 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1392 # undef YYSTACK_RELOCATE 1393 if (yyss1 != yyssa) 1394 YYSTACK_FREE (yyss1); 1395 } 1396 # endif 1397 #endif /* no yyoverflow */ 1398 1399 yyssp = yyss + yysize - 1; 1400 yyvsp = yyvs + yysize - 1; 1401 1402 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1403 (unsigned long int) yystacksize)); 1404 1405 if (yyss + yystacksize - 1 <= yyssp) 1406 YYABORT; 1407 } 1408 1409 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1410 1411 if (yystate == YYFINAL) 1412 YYACCEPT; 1413 1414 goto yybackup; 1415 1416 /*-----------. 1417 | yybackup. | 1418 `-----------*/ 1419 yybackup: 1420 1421 /* Do appropriate processing given the current state. Read a 1422 lookahead token if we need one and don't already have one. */ 1423 1424 /* First try to decide what to do without reference to lookahead token. */ 1425 yyn = yypact[yystate]; 1426 if (yypact_value_is_default (yyn)) 1427 goto yydefault; 1428 1429 /* Not known => get a lookahead token if don't already have one. */ 1430 1431 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1432 if (yychar == YYEMPTY) 1433 { 1434 YYDPRINTF ((stderr, "Reading a token: ")); 1435 yychar = yylex (); 1436 } 1437 1438 if (yychar <= YYEOF) 1439 { 1440 yychar = yytoken = YYEOF; 1441 YYDPRINTF ((stderr, "Now at end of input.\n")); 1442 } 1443 else 1444 { 1445 yytoken = YYTRANSLATE (yychar); 1446 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1447 } 1448 1449 /* If the proper action on seeing token YYTOKEN is to reduce or to 1450 detect an error, take that action. */ 1451 yyn += yytoken; 1452 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1453 goto yydefault; 1454 yyn = yytable[yyn]; 1455 if (yyn <= 0) 1456 { 1457 if (yytable_value_is_error (yyn)) 1458 goto yyerrlab; 1459 yyn = -yyn; 1460 goto yyreduce; 1461 } 1462 1463 /* Count tokens shifted since error; after three, turn off error 1464 status. */ 1465 if (yyerrstatus) 1466 yyerrstatus--; 1467 1468 /* Shift the lookahead token. */ 1469 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1470 1471 /* Discard the shifted token. */ 1472 yychar = YYEMPTY; 1473 1474 yystate = yyn; 1475 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1476 *++yyvsp = yylval; 1477 YY_IGNORE_MAYBE_UNINITIALIZED_END 1478 1479 goto yynewstate; 1480 1481 1482 /*-----------------------------------------------------------. 1483 | yydefault -- do the default action for the current state. | 1484 `-----------------------------------------------------------*/ 1485 yydefault: 1486 yyn = yydefact[yystate]; 1487 if (yyn == 0) 1488 goto yyerrlab; 1489 goto yyreduce; 1490 1491 1492 /*-----------------------------. 1493 | yyreduce -- Do a reduction. | 1494 `-----------------------------*/ 1495 yyreduce: 1496 /* yyn is the number of a rule to reduce with. */ 1497 yylen = yyr2[yyn]; 1498 1499 /* If YYLEN is nonzero, implement the default value of the action: 1500 '$$ = $1'. 1501 1502 Otherwise, the following line sets YYVAL to garbage. 1503 This behavior is undocumented and Bison 1504 users should not rely upon it. Assigning to YYVAL 1505 unconditionally makes the parser a bit smaller, and it avoids a 1506 GCC warning that YYVAL may be used uninitialized. */ 1507 yyval = yyvsp[1-yylen]; 1508 1509 1510 YY_REDUCE_PRINT (yyn); 1511 switch (yyn) 1512 { 1513 case 5: 1514 #line 309 "./itbl-parse.y" /* yacc.c:1648 */ 1515 { 1516 DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n", 1517 insntbl_line, (yyvsp[-4].num), (yyvsp[-3].num), (yyvsp[-2].str), (yyvsp[-1].val))); 1518 itbl_add_reg ((yyvsp[-4].num), (yyvsp[-3].num), (yyvsp[-2].str), (yyvsp[-1].val)); 1519 } 1520 #line 1521 "itbl-parse.c" /* yacc.c:1648 */ 1521 break; 1522 1523 case 6: 1524 #line 315 "./itbl-parse.y" /* yacc.c:1648 */ 1525 { 1526 DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x", 1527 insntbl_line, (yyvsp[-5].num), (yyvsp[-3].str), (yyvsp[-2].val))); 1528 DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, (yyvsp[0].val))); 1529 insn=itbl_add_insn ((yyvsp[-5].num), (yyvsp[-3].str), (yyvsp[-2].val), sbit, ebit, (yyvsp[0].val)); 1530 } 1531 #line 1532 "itbl-parse.c" /* yacc.c:1648 */ 1532 break; 1533 1534 case 7: 1535 #line 322 "./itbl-parse.y" /* yacc.c:1648 */ 1536 {} 1537 #line 1538 "itbl-parse.c" /* yacc.c:1648 */ 1538 break; 1539 1540 case 13: 1541 #line 335 "./itbl-parse.y" /* yacc.c:1648 */ 1542 { 1543 DBGL2 (("ftype\n")); 1544 (yyval.num) = (yyvsp[0].num); 1545 } 1546 #line 1547 "itbl-parse.c" /* yacc.c:1648 */ 1547 break; 1548 1549 case 14: 1550 #line 340 "./itbl-parse.y" /* yacc.c:1648 */ 1551 { 1552 DBGL2 (("addr\n")); 1553 (yyval.num) = ADDR; 1554 } 1555 #line 1556 "itbl-parse.c" /* yacc.c:1648 */ 1556 break; 1557 1558 case 15: 1559 #line 345 "./itbl-parse.y" /* yacc.c:1648 */ 1560 { 1561 DBGL2 (("immed\n")); 1562 (yyval.num) = IMMED; 1563 } 1564 #line 1565 "itbl-parse.c" /* yacc.c:1648 */ 1565 break; 1566 1567 case 16: 1568 #line 353 "./itbl-parse.y" /* yacc.c:1648 */ 1569 { 1570 DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n", 1571 insntbl_line, (yyvsp[-2].num), sbit, ebit, (yyvsp[0].val))); 1572 itbl_add_operand (insn, (yyvsp[-2].num), sbit, ebit, (yyvsp[0].val)); 1573 } 1574 #line 1575 "itbl-parse.c" /* yacc.c:1648 */ 1575 break; 1576 1577 case 17: 1578 #line 362 "./itbl-parse.y" /* yacc.c:1648 */ 1579 { 1580 (yyval.val) = (yyvsp[-2].num) | (yyvsp[0].val); 1581 } 1582 #line 1583 "itbl-parse.c" /* yacc.c:1648 */ 1583 break; 1584 1585 case 18: 1586 #line 366 "./itbl-parse.y" /* yacc.c:1648 */ 1587 { 1588 (yyval.val) = (yyvsp[-1].val); 1589 } 1590 #line 1591 "itbl-parse.c" /* yacc.c:1648 */ 1591 break; 1592 1593 case 19: 1594 #line 370 "./itbl-parse.y" /* yacc.c:1648 */ 1595 { 1596 (yyval.val) = (yyvsp[0].num); 1597 } 1598 #line 1599 "itbl-parse.c" /* yacc.c:1648 */ 1599 break; 1600 1601 case 20: 1602 #line 377 "./itbl-parse.y" /* yacc.c:1648 */ 1603 { 1604 DBGL2 (("flags=%d\n", (yyvsp[0].val))); 1605 (yyval.val) = (yyvsp[0].val); 1606 } 1607 #line 1608 "itbl-parse.c" /* yacc.c:1648 */ 1608 break; 1609 1610 case 21: 1611 #line 382 "./itbl-parse.y" /* yacc.c:1648 */ 1612 { 1613 (yyval.val) = 0; 1614 } 1615 #line 1616 "itbl-parse.c" /* yacc.c:1648 */ 1616 break; 1617 1618 case 22: 1619 #line 389 "./itbl-parse.y" /* yacc.c:1648 */ 1620 { 1621 DBGL2 (("range %d %d\n", (yyvsp[-2].num), (yyvsp[0].num))); 1622 sbit = (yyvsp[-2].num); 1623 ebit = (yyvsp[0].num); 1624 } 1625 #line 1626 "itbl-parse.c" /* yacc.c:1648 */ 1626 break; 1627 1628 case 23: 1629 #line 395 "./itbl-parse.y" /* yacc.c:1648 */ 1630 { 1631 sbit = 31; 1632 ebit = 0; 1633 } 1634 #line 1635 "itbl-parse.c" /* yacc.c:1648 */ 1635 break; 1636 1637 case 24: 1638 #line 403 "./itbl-parse.y" /* yacc.c:1648 */ 1639 { 1640 DBGL2 (("pnum=%d\n",(yyvsp[0].num))); 1641 (yyval.num) = (yyvsp[0].num); 1642 } 1643 #line 1644 "itbl-parse.c" /* yacc.c:1648 */ 1644 break; 1645 1646 case 25: 1647 #line 411 "./itbl-parse.y" /* yacc.c:1648 */ 1648 { 1649 DBGL2 (("dreg\n")); 1650 (yyval.num) = DREG; 1651 } 1652 #line 1653 "itbl-parse.c" /* yacc.c:1648 */ 1653 break; 1654 1655 case 26: 1656 #line 416 "./itbl-parse.y" /* yacc.c:1648 */ 1657 { 1658 DBGL2 (("creg\n")); 1659 (yyval.num) = CREG; 1660 } 1661 #line 1662 "itbl-parse.c" /* yacc.c:1648 */ 1662 break; 1663 1664 case 27: 1665 #line 421 "./itbl-parse.y" /* yacc.c:1648 */ 1666 { 1667 DBGL2 (("greg\n")); 1668 (yyval.num) = GREG; 1669 } 1670 #line 1671 "itbl-parse.c" /* yacc.c:1648 */ 1671 break; 1672 1673 case 28: 1674 #line 429 "./itbl-parse.y" /* yacc.c:1648 */ 1675 { 1676 DBGL2 (("name=%s\n",(yyvsp[0].str))); 1677 (yyval.str) = (yyvsp[0].str); 1678 } 1679 #line 1680 "itbl-parse.c" /* yacc.c:1648 */ 1680 break; 1681 1682 case 29: 1683 #line 445 "./itbl-parse.y" /* yacc.c:1648 */ 1684 { 1685 DBGL2 (("val=x%x\n",(yyvsp[0].num))); 1686 (yyval.val) = (yyvsp[0].num); 1687 } 1688 #line 1689 "itbl-parse.c" /* yacc.c:1648 */ 1689 break; 1690 1691 1692 #line 1693 "itbl-parse.c" /* yacc.c:1648 */ 1693 default: break; 1694 } 1695 /* User semantic actions sometimes alter yychar, and that requires 1696 that yytoken be updated with the new translation. We take the 1697 approach of translating immediately before every use of yytoken. 1698 One alternative is translating here after every semantic action, 1699 but that translation would be missed if the semantic action invokes 1700 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1701 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1702 incorrect destructor might then be invoked immediately. In the 1703 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1704 to an incorrect destructor call or verbose syntax error message 1705 before the lookahead is translated. */ 1706 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1707 1708 YYPOPSTACK (yylen); 1709 yylen = 0; 1710 YY_STACK_PRINT (yyss, yyssp); 1711 1712 *++yyvsp = yyval; 1713 1714 /* Now 'shift' the result of the reduction. Determine what state 1715 that goes to, based on the state we popped back to and the rule 1716 number reduced by. */ 1717 1718 yyn = yyr1[yyn]; 1719 1720 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1721 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1722 yystate = yytable[yystate]; 1723 else 1724 yystate = yydefgoto[yyn - YYNTOKENS]; 1725 1726 goto yynewstate; 1727 1728 1729 /*--------------------------------------. 1730 | yyerrlab -- here on detecting error. | 1731 `--------------------------------------*/ 1732 yyerrlab: 1733 /* Make sure we have latest lookahead translation. See comments at 1734 user semantic actions for why this is necessary. */ 1735 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 1736 1737 /* If not already recovering from an error, report this error. */ 1738 if (!yyerrstatus) 1739 { 1740 ++yynerrs; 1741 #if ! YYERROR_VERBOSE 1742 yyerror (YY_("syntax error")); 1743 #else 1744 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1745 yyssp, yytoken) 1746 { 1747 char const *yymsgp = YY_("syntax error"); 1748 int yysyntax_error_status; 1749 yysyntax_error_status = YYSYNTAX_ERROR; 1750 if (yysyntax_error_status == 0) 1751 yymsgp = yymsg; 1752 else if (yysyntax_error_status == 1) 1753 { 1754 if (yymsg != yymsgbuf) 1755 YYSTACK_FREE (yymsg); 1756 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 1757 if (!yymsg) 1758 { 1759 yymsg = yymsgbuf; 1760 yymsg_alloc = sizeof yymsgbuf; 1761 yysyntax_error_status = 2; 1762 } 1763 else 1764 { 1765 yysyntax_error_status = YYSYNTAX_ERROR; 1766 yymsgp = yymsg; 1767 } 1768 } 1769 yyerror (yymsgp); 1770 if (yysyntax_error_status == 2) 1771 goto yyexhaustedlab; 1772 } 1773 # undef YYSYNTAX_ERROR 1774 #endif 1775 } 1776 1777 1778 1779 if (yyerrstatus == 3) 1780 { 1781 /* If just tried and failed to reuse lookahead token after an 1782 error, discard it. */ 1783 1784 if (yychar <= YYEOF) 1785 { 1786 /* Return failure if at end of input. */ 1787 if (yychar == YYEOF) 1788 YYABORT; 1789 } 1790 else 1791 { 1792 yydestruct ("Error: discarding", 1793 yytoken, &yylval); 1794 yychar = YYEMPTY; 1795 } 1796 } 1797 1798 /* Else will try to reuse lookahead token after shifting the error 1799 token. */ 1800 goto yyerrlab1; 1801 1802 1803 /*---------------------------------------------------. 1804 | yyerrorlab -- error raised explicitly by YYERROR. | 1805 `---------------------------------------------------*/ 1806 yyerrorlab: 1807 1808 /* Pacify compilers like GCC when the user code never invokes 1809 YYERROR and the label yyerrorlab therefore never appears in user 1810 code. */ 1811 if (/*CONSTCOND*/ 0) 1812 goto yyerrorlab; 1813 1814 /* Do not reclaim the symbols of the rule whose action triggered 1815 this YYERROR. */ 1816 YYPOPSTACK (yylen); 1817 yylen = 0; 1818 YY_STACK_PRINT (yyss, yyssp); 1819 yystate = *yyssp; 1820 goto yyerrlab1; 1821 1822 1823 /*-------------------------------------------------------------. 1824 | yyerrlab1 -- common code for both syntax error and YYERROR. | 1825 `-------------------------------------------------------------*/ 1826 yyerrlab1: 1827 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1828 1829 for (;;) 1830 { 1831 yyn = yypact[yystate]; 1832 if (!yypact_value_is_default (yyn)) 1833 { 1834 yyn += YYTERROR; 1835 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1836 { 1837 yyn = yytable[yyn]; 1838 if (0 < yyn) 1839 break; 1840 } 1841 } 1842 1843 /* Pop the current state because it cannot handle the error token. */ 1844 if (yyssp == yyss) 1845 YYABORT; 1846 1847 1848 yydestruct ("Error: popping", 1849 yystos[yystate], yyvsp); 1850 YYPOPSTACK (1); 1851 yystate = *yyssp; 1852 YY_STACK_PRINT (yyss, yyssp); 1853 } 1854 1855 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1856 *++yyvsp = yylval; 1857 YY_IGNORE_MAYBE_UNINITIALIZED_END 1858 1859 1860 /* Shift the error token. */ 1861 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1862 1863 yystate = yyn; 1864 goto yynewstate; 1865 1866 1867 /*-------------------------------------. 1868 | yyacceptlab -- YYACCEPT comes here. | 1869 `-------------------------------------*/ 1870 yyacceptlab: 1871 yyresult = 0; 1872 goto yyreturn; 1873 1874 /*-----------------------------------. 1875 | yyabortlab -- YYABORT comes here. | 1876 `-----------------------------------*/ 1877 yyabortlab: 1878 yyresult = 1; 1879 goto yyreturn; 1880 1881 #if !defined yyoverflow || YYERROR_VERBOSE 1882 /*-------------------------------------------------. 1883 | yyexhaustedlab -- memory exhaustion comes here. | 1884 `-------------------------------------------------*/ 1885 yyexhaustedlab: 1886 yyerror (YY_("memory exhausted")); 1887 yyresult = 2; 1888 /* Fall through. */ 1889 #endif 1890 1891 yyreturn: 1892 if (yychar != YYEMPTY) 1893 { 1894 /* Make sure we have latest lookahead translation. See comments at 1895 user semantic actions for why this is necessary. */ 1896 yytoken = YYTRANSLATE (yychar); 1897 yydestruct ("Cleanup: discarding lookahead", 1898 yytoken, &yylval); 1899 } 1900 /* Do not reclaim the symbols of the rule whose action triggered 1901 this YYABORT or YYACCEPT. */ 1902 YYPOPSTACK (yylen); 1903 YY_STACK_PRINT (yyss, yyssp); 1904 while (yyssp != yyss) 1905 { 1906 yydestruct ("Cleanup: popping", 1907 yystos[*yyssp], yyvsp); 1908 YYPOPSTACK (1); 1909 } 1910 #ifndef yyoverflow 1911 if (yyss != yyssa) 1912 YYSTACK_FREE (yyss); 1913 #endif 1914 #if YYERROR_VERBOSE 1915 if (yymsg != yymsgbuf) 1916 YYSTACK_FREE (yymsg); 1917 #endif 1918 return yyresult; 1919 } 1920 #line 450 "./itbl-parse.y" /* yacc.c:1907 */ 1921 1922 1923 static int 1924 yyerror (const char *msg) 1925 { 1926 printf ("line %d: %s\n", insntbl_line, msg); 1927 return 0; 1928 } 1929