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