Sync setmode(3) with FreeBSD:
[dragonfly.git] / contrib / binutils-2.17 / gas / itbl-parse.c
blob0fd788f0521fffef98ecbe0cec10a490983ad34e
1 /* A Bison parser, made by GNU Bison 2.1. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
37 #define YYBISON 1
39 /* Bison version. */
40 #define YYBISON_VERSION "2.1"
42 /* Skeleton name. */
43 #define YYSKELETON_NAME "yacc.c"
45 /* Pure parsers. */
46 #define YYPURE 0
48 /* Using locations. */
49 #define YYLSP_NEEDED 0
53 /* Tokens. */
54 #ifndef YYTOKENTYPE
55 # define YYTOKENTYPE
56 /* Put the tokens into the symbol table, so that GDB and other debuggers
57 know about them. */
58 enum yytokentype {
59 DREG = 258,
60 CREG = 259,
61 GREG = 260,
62 IMMED = 261,
63 ADDR = 262,
64 INSN = 263,
65 NUM = 264,
66 ID = 265,
67 NL = 266,
68 PNUM = 267
70 #endif
71 /* Tokens. */
72 #define DREG 258
73 #define CREG 259
74 #define GREG 260
75 #define IMMED 261
76 #define ADDR 262
77 #define INSN 263
78 #define NUM 264
79 #define ID 265
80 #define NL 266
81 #define PNUM 267
86 /* Copy the first part of user declarations. */
87 #line 21 "itbl-parse.y"
90 /*
92 Yacc grammar for instruction table entries.
94 =======================================================================
95 Original Instruction table specification document:
97 MIPS Coprocessor Table Specification
98 ====================================
100 This document describes the format of the MIPS coprocessor table. The
101 table specifies a list of valid functions, data registers and control
102 registers that can be used in coprocessor instructions. This list,
103 together with the coprocessor instruction classes listed below,
104 specifies the complete list of coprocessor instructions that will
105 be recognized and assembled by the GNU assembler. In effect,
106 this makes the GNU assembler table-driven, where the table is
107 specified by the programmer.
109 The table is an ordinary text file that the GNU assembler reads when
110 it starts. Using the information in the table, the assembler
111 generates an internal list of valid coprocessor registers and
112 functions. The assembler uses this internal list in addition to the
113 standard MIPS registers and instructions which are built-in to the
114 assembler during code generation.
116 To specify the coprocessor table when invoking the GNU assembler, use
117 the command line option "--itbl file", where file is the
118 complete name of the table, including path and extension.
120 Examples:
122 gas -t cop.tbl test.s -o test.o
123 gas -t /usr/local/lib/cop.tbl test.s -o test.o
124 gas --itbl d:\gnu\data\cop.tbl test.s -o test.o
126 Only one table may be supplied during a single invocation of
127 the assembler.
130 Instruction classes
131 ===================
133 Below is a list of the valid coprocessor instruction classes for
134 any given coprocessor "z". These instructions are already recognized
135 by the assembler, and are listed here only for reference.
137 Class format instructions
138 -------------------------------------------------
139 Class1:
140 op base rt offset
141 LWCz rt,offset (base)
142 SWCz rt,offset (base)
143 Class2:
144 COPz sub rt rd 0
145 MTCz rt,rd
146 MFCz rt,rd
147 CTCz rt,rd
148 CFCz rt,rd
149 Class3:
150 COPz CO cofun
151 COPz cofun
152 Class4:
153 COPz BC br offset
154 BCzT offset
155 BCzF offset
156 Class5:
157 COPz sub rt rd 0
158 DMFCz rt,rd
159 DMTCz rt,rd
160 Class6:
161 op base rt offset
162 LDCz rt,offset (base)
163 SDCz rt,offset (base)
164 Class7:
165 COPz BC br offset
166 BCzTL offset
167 BCzFL offset
169 The coprocessor table defines coprocessor-specific registers that can
170 be used with all of the above classes of instructions, where
171 appropriate. It also defines additional coprocessor-specific
172 functions for Class3 (COPz cofun) instructions, Thus, the table allows
173 the programmer to use convenient mnemonics and operands for these
174 functions, instead of the COPz mmenmonic and cofun operand.
176 The names of the MIPS general registers and their aliases are defined
177 by the assembler and will be recognized as valid register names by the
178 assembler when used (where allowed) in coprocessor instructions.
179 However, the names and values of all coprocessor data and control
180 register mnemonics must be specified in the coprocessor table.
183 Table Grammar
184 =============
186 Here is the grammar for the coprocessor table:
188 table -> entry*
190 entry -> [z entrydef] [comment] '\n'
192 entrydef -> type name val
193 entrydef -> 'insn' name val funcdef ; type of entry (instruction)
195 z -> 'p'['0'..'3'] ; processor number
196 type -> ['dreg' | 'creg' | 'greg' ] ; type of entry (register)
197 ; 'dreg', 'creg' or 'greg' specifies a data, control, or general
198 ; register mnemonic, respectively
199 name -> [ltr|dec]* ; mnemonic of register/function
200 val -> [dec|hex] ; register/function number (integer constant)
202 funcdef -> frange flags fields
203 ; bitfield range for opcode
204 ; list of fields' formats
205 fields -> field*
206 field -> [','] ftype frange flags
207 flags -> ['*' flagexpr]
208 flagexpr -> '[' flagexpr ']'
209 flagexpr -> val '|' flagexpr
210 ftype -> [ type | 'immed' | 'addr' ]
211 ; 'immed' specifies an immediate value; see grammar for "val" above
212 ; 'addr' specifies a C identifier; name of symbol to be resolved at
213 ; link time
214 frange -> ':' val '-' val ; starting to ending bit positions, where
215 ; where 0 is least significant bit
216 frange -> (null) ; default range of 31-0 will be assumed
218 comment -> [';'|'#'] [char]*
219 char -> any printable character
220 ltr -> ['a'..'z'|'A'..'Z']
221 dec -> ['0'..'9']* ; value in decimal
222 hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']* ; value in hexadecimal
225 Examples
226 ========
228 Example 1:
230 The table:
232 p1 dreg d1 1 ; data register "d1" for COP1 has value 1
233 p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3
234 p3 func fill 0x1f:24-20 ; function "fill" for COP3 has value 31 and
235 ; no fields
237 will allow the assembler to accept the following coprocessor instructions:
239 LWC1 d1,0x100 ($2)
240 fill
242 Here, the general purpose register "$2", and instruction "LWC1", are standard
243 mnemonics built-in to the MIPS assembler.
246 Example 2:
248 The table:
250 p3 dreg d3 3 ; data register "d3" for COP3 has value 3
251 p3 creg c2 22 ; control register "c2" for COP3 has value 22
252 p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0
253 ; function "fee" for COP3 has value 31, and 3 fields
254 ; consisting of a data register, a control register,
255 ; and an immediate value.
257 will allow the assembler to accept the following coprocessor instruction:
259 fee d3,c2,0x1
261 and will emit the object code:
263 31-26 25 24-20 19-18 17-13 12-8 7-0
264 COPz CO fun dreg creg immed
265 010011 1 11111 00 00011 10110 00000001
267 0x4ff07601
270 Example 3:
272 The table:
274 p3 dreg d3 3 ; data register "d3" for COP3 has value 3
275 p3 creg c2 22 ; control register "c2" for COP3 has value 22
276 p3 func fuu 0x01f00001 dreg:17-13 creg:12-8
278 will allow the assembler to accept the following coprocessor
279 instruction:
281 fuu d3,c2
283 and will emit the object code:
285 31-26 25 24-20 19-18 17-13 12-8 7-0
286 COPz CO fun dreg creg
287 010011 1 11111 00 00011 10110 00000001
289 0x4ff07601
291 In this way, the programmer can force arbitrary bits of an instruction
292 to have predefined values.
294 =======================================================================
295 Additional notes:
297 Encoding of ranges:
298 To handle more than one bit position range within an instruction,
299 use 0s to mask out the ranges which don't apply.
300 May decide to modify the syntax to allow commas separate multiple
301 ranges within an instruction (range','range).
303 Changes in grammar:
304 The number of parms argument to the function entry
305 was deleted from the original format such that we now count the fields.
307 ----
308 FIXME! should really change lexical analyzer
309 to recognize 'dreg' etc. in context sensitive way.
310 Currently function names or mnemonics may be incorrectly parsed as keywords
312 FIXME! hex is ambiguous with any digit
316 #include <stdio.h>
317 #include "itbl-lex.h"
318 #include "itbl-ops.h"
320 /* #define DEBUG */
322 #ifdef DEBUG
323 #ifndef DBG_LVL
324 #define DBG_LVL 1
325 #endif
326 #else
327 #define DBG_LVL 0
328 #endif
330 #if DBG_LVL >= 1
331 #define DBG(x) printf x
332 #else
333 #define DBG(x)
334 #endif
336 #if DBG_LVL >= 2
337 #define DBGL2(x) printf x
338 #else
339 #define DBGL2(x)
340 #endif
342 static int sbit, ebit;
343 static struct itbl_entry *insn=0;
344 static int yyerror PARAMS ((const char *));
348 /* Enabling traces. */
349 #ifndef YYDEBUG
350 # define YYDEBUG 0
351 #endif
353 /* Enabling verbose error messages. */
354 #ifdef YYERROR_VERBOSE
355 # undef YYERROR_VERBOSE
356 # define YYERROR_VERBOSE 1
357 #else
358 # define YYERROR_VERBOSE 0
359 #endif
361 /* Enabling the token table. */
362 #ifndef YYTOKEN_TABLE
363 # define YYTOKEN_TABLE 0
364 #endif
366 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
367 #line 282 "itbl-parse.y"
368 typedef union YYSTYPE {
369 char *str;
370 int num;
371 int processor;
372 unsigned long val;
373 } YYSTYPE;
374 /* Line 196 of yacc.c. */
375 #line 376 "itbl-parse.c"
376 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
377 # define YYSTYPE_IS_DECLARED 1
378 # define YYSTYPE_IS_TRIVIAL 1
379 #endif
383 /* Copy the second part of user declarations. */
386 /* Line 219 of yacc.c. */
387 #line 388 "itbl-parse.c"
389 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
390 # define YYSIZE_T __SIZE_TYPE__
391 #endif
392 #if ! defined (YYSIZE_T) && defined (size_t)
393 # define YYSIZE_T size_t
394 #endif
395 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
396 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
397 # define YYSIZE_T size_t
398 #endif
399 #if ! defined (YYSIZE_T)
400 # define YYSIZE_T unsigned int
401 #endif
403 #ifndef YY_
404 # if YYENABLE_NLS
405 # if ENABLE_NLS
406 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
407 # define YY_(msgid) dgettext ("bison-runtime", msgid)
408 # endif
409 # endif
410 # ifndef YY_
411 # define YY_(msgid) msgid
412 # endif
413 #endif
415 #if ! defined (yyoverflow) || YYERROR_VERBOSE
417 /* The parser invokes alloca or malloc; define the necessary symbols. */
419 # ifdef YYSTACK_USE_ALLOCA
420 # if YYSTACK_USE_ALLOCA
421 # ifdef __GNUC__
422 # define YYSTACK_ALLOC __builtin_alloca
423 # else
424 # define YYSTACK_ALLOC alloca
425 # if defined (__STDC__) || defined (__cplusplus)
426 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
427 # define YYINCLUDED_STDLIB_H
428 # endif
429 # endif
430 # endif
431 # endif
433 # ifdef YYSTACK_ALLOC
434 /* Pacify GCC's `empty if-body' warning. */
435 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
436 # ifndef YYSTACK_ALLOC_MAXIMUM
437 /* The OS might guarantee only one guard page at the bottom of the stack,
438 and a page size can be as small as 4096 bytes. So we cannot safely
439 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
440 to allow for a few compiler-allocated temporary stack slots. */
441 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
442 # endif
443 # else
444 # define YYSTACK_ALLOC YYMALLOC
445 # define YYSTACK_FREE YYFREE
446 # ifndef YYSTACK_ALLOC_MAXIMUM
447 # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
448 # endif
449 # ifdef __cplusplus
450 extern "C" {
451 # endif
452 # ifndef YYMALLOC
453 # define YYMALLOC malloc
454 # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
455 && (defined (__STDC__) || defined (__cplusplus)))
456 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
457 # endif
458 # endif
459 # ifndef YYFREE
460 # define YYFREE free
461 # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
462 && (defined (__STDC__) || defined (__cplusplus)))
463 void free (void *); /* INFRINGES ON USER NAME SPACE */
464 # endif
465 # endif
466 # ifdef __cplusplus
468 # endif
469 # endif
470 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
473 #if (! defined (yyoverflow) \
474 && (! defined (__cplusplus) \
475 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
477 /* A type that is properly aligned for any stack member. */
478 union yyalloc
480 short int yyss;
481 YYSTYPE yyvs;
484 /* The size of the maximum gap between one aligned stack and the next. */
485 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
487 /* The size of an array large to enough to hold all stacks, each with
488 N elements. */
489 # define YYSTACK_BYTES(N) \
490 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
491 + YYSTACK_GAP_MAXIMUM)
493 /* Copy COUNT objects from FROM to TO. The source and destination do
494 not overlap. */
495 # ifndef YYCOPY
496 # if defined (__GNUC__) && 1 < __GNUC__
497 # define YYCOPY(To, From, Count) \
498 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
499 # else
500 # define YYCOPY(To, From, Count) \
501 do \
503 YYSIZE_T yyi; \
504 for (yyi = 0; yyi < (Count); yyi++) \
505 (To)[yyi] = (From)[yyi]; \
507 while (0)
508 # endif
509 # endif
511 /* Relocate STACK from its old location to the new one. The
512 local variables YYSIZE and YYSTACKSIZE give the old and new number of
513 elements in the stack, and YYPTR gives the new location of the
514 stack. Advance YYPTR to a properly aligned location for the next
515 stack. */
516 # define YYSTACK_RELOCATE(Stack) \
517 do \
519 YYSIZE_T yynewbytes; \
520 YYCOPY (&yyptr->Stack, Stack, yysize); \
521 Stack = &yyptr->Stack; \
522 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
523 yyptr += yynewbytes / sizeof (*yyptr); \
525 while (0)
527 #endif
529 #if defined (__STDC__) || defined (__cplusplus)
530 typedef signed char yysigned_char;
531 #else
532 typedef short int yysigned_char;
533 #endif
535 /* YYFINAL -- State number of the termination state. */
536 #define YYFINAL 9
537 /* YYLAST -- Last index in YYTABLE. */
538 #define YYLAST 46
540 /* YYNTOKENS -- Number of terminals. */
541 #define YYNTOKENS 20
542 /* YYNNTS -- Number of nonterminals. */
543 #define YYNNTS 15
544 /* YYNRULES -- Number of rules. */
545 #define YYNRULES 29
546 /* YYNRULES -- Number of states. */
547 #define YYNSTATES 51
549 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
550 #define YYUNDEFTOK 2
551 #define YYMAXUTOK 267
553 #define YYTRANSLATE(YYX) \
554 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
556 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
557 static const unsigned char yytranslate[] =
559 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 17, 2, 13, 19, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 18, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 15, 2, 16, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 14, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
585 5, 6, 7, 8, 9, 10, 11, 12
588 #if YYDEBUG
589 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
590 YYRHS. */
591 static const unsigned char yyprhs[] =
593 0, 0, 3, 5, 8, 9, 15, 16, 26, 28,
594 31, 35, 38, 39, 41, 43, 45, 49, 53, 57,
595 59, 62, 63, 68, 69, 71, 73, 75, 77, 79
598 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
599 static const yysigned_char yyrhs[] =
601 21, 0, -1, 22, -1, 23, 22, -1, -1, 31,
602 32, 33, 34, 11, -1, -1, 31, 8, 33, 34,
603 30, 29, 24, 25, 11, -1, 11, -1, 1, 11,
604 -1, 13, 27, 25, -1, 27, 25, -1, -1, 32,
605 -1, 7, -1, 6, -1, 26, 30, 29, -1, 9,
606 14, 28, -1, 15, 28, 16, -1, 9, -1, 17,
607 28, -1, -1, 18, 9, 19, 9, -1, -1, 12,
608 -1, 3, -1, 4, -1, 5, -1, 10, -1, 9,
612 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
613 static const unsigned short int yyrline[] =
615 0, 299, 299, 303, 304, 308, 315, 314, 323, 324,
616 328, 329, 330, 334, 339, 344, 352, 361, 365, 369,
617 376, 382, 388, 395, 402, 410, 415, 420, 428, 444
619 #endif
621 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
622 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
623 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
624 static const char *const yytname[] =
626 "$end", "error", "$undefined", "DREG", "CREG", "GREG", "IMMED", "ADDR",
627 "INSN", "NUM", "ID", "NL", "PNUM", "','", "'|'", "'['", "']'", "'*'",
628 "':'", "'-'", "$accept", "insntbl", "entrys", "entry", "@1",
629 "fieldspecs", "ftype", "fieldspec", "flagexpr", "flags", "range", "pnum",
630 "regtype", "name", "value", 0
632 #endif
634 # ifdef YYPRINT
635 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
636 token YYLEX-NUM. */
637 static const unsigned short int yytoknum[] =
639 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
640 265, 266, 267, 44, 124, 91, 93, 42, 58, 45
642 # endif
644 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
645 static const unsigned char yyr1[] =
647 0, 20, 21, 22, 22, 23, 24, 23, 23, 23,
648 25, 25, 25, 26, 26, 26, 27, 28, 28, 28,
649 29, 29, 30, 30, 31, 32, 32, 32, 33, 34
652 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
653 static const unsigned char yyr2[] =
655 0, 2, 1, 2, 0, 5, 0, 9, 1, 2,
656 3, 2, 0, 1, 1, 1, 3, 3, 3, 1,
657 2, 0, 4, 0, 1, 1, 1, 1, 1, 1
660 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
661 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
662 means the default is an error. */
663 static const unsigned char yydefact[] =
665 0, 0, 8, 24, 0, 2, 0, 0, 9, 1,
666 3, 25, 26, 27, 0, 0, 28, 0, 0, 29,
667 23, 0, 0, 21, 5, 0, 0, 6, 0, 19,
668 0, 20, 12, 22, 0, 0, 15, 14, 0, 0,
669 23, 12, 13, 17, 18, 12, 7, 21, 11, 10,
673 /* YYDEFGOTO[NTERM-NUM]. */
674 static const yysigned_char yydefgoto[] =
676 -1, 4, 5, 6, 32, 39, 40, 41, 31, 27,
677 23, 7, 42, 17, 20
680 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
681 STATE-NUM. */
682 #define YYPACT_NINF -16
683 static const yysigned_char yypact[] =
685 0, -9, -16, -16, 10, -16, 0, 12, -16, -16,
686 -16, -16, -16, -16, 3, 3, -16, 9, 9, -16,
687 11, 8, 19, 15, -16, 14, -6, -16, 25, 21,
688 -6, -16, 1, -16, -6, 20, -16, -16, 18, 26,
689 11, 1, -16, -16, -16, 1, -16, 15, -16, -16,
693 /* YYPGOTO[NTERM-NUM]. */
694 static const yysigned_char yypgoto[] =
696 -16, -16, 32, -16, -16, -15, -16, 2, -3, -8,
697 4, -16, 34, 27, 28
700 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
701 positive, shift that token. If negative, reduce the rule which
702 number is the opposite. If zero, do what YYDEFACT says.
703 If YYTABLE_NINF, syntax error. */
704 #define YYTABLE_NINF -5
705 static const yysigned_char yytable[] =
707 -4, 1, 8, 29, 11, 12, 13, 36, 37, 30,
708 9, 2, 3, 16, 38, 11, 12, 13, 19, 24,
709 14, 11, 12, 13, 36, 37, 48, 35, 25, 22,
710 49, 43, 26, 28, 33, 34, 44, 46, 10, 50,
711 45, 15, 18, 0, 47, 0, 21
714 static const yysigned_char yycheck[] =
716 0, 1, 11, 9, 3, 4, 5, 6, 7, 15,
717 0, 11, 12, 10, 13, 3, 4, 5, 9, 11,
718 8, 3, 4, 5, 6, 7, 41, 30, 9, 18,
719 45, 34, 17, 19, 9, 14, 16, 11, 6, 47,
720 38, 7, 15, -1, 40, -1, 18
723 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
724 symbol of state STATE-NUM. */
725 static const unsigned char yystos[] =
727 0, 1, 11, 12, 21, 22, 23, 31, 11, 0,
728 22, 3, 4, 5, 8, 32, 10, 33, 33, 9,
729 34, 34, 18, 30, 11, 9, 17, 29, 19, 9,
730 15, 28, 24, 9, 14, 28, 6, 7, 13, 25,
731 26, 27, 32, 28, 16, 27, 11, 30, 25, 25,
735 #define yyerrok (yyerrstatus = 0)
736 #define yyclearin (yychar = YYEMPTY)
737 #define YYEMPTY (-2)
738 #define YYEOF 0
740 #define YYACCEPT goto yyacceptlab
741 #define YYABORT goto yyabortlab
742 #define YYERROR goto yyerrorlab
745 /* Like YYERROR except do call yyerror. This remains here temporarily
746 to ease the transition to the new meaning of YYERROR, for GCC.
747 Once GCC version 2 has supplanted version 1, this can go. */
749 #define YYFAIL goto yyerrlab
751 #define YYRECOVERING() (!!yyerrstatus)
753 #define YYBACKUP(Token, Value) \
754 do \
755 if (yychar == YYEMPTY && yylen == 1) \
757 yychar = (Token); \
758 yylval = (Value); \
759 yytoken = YYTRANSLATE (yychar); \
760 YYPOPSTACK; \
761 goto yybackup; \
763 else \
765 yyerror (YY_("syntax error: cannot back up")); \
766 YYERROR; \
768 while (0)
771 #define YYTERROR 1
772 #define YYERRCODE 256
775 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
776 If N is 0, then set CURRENT to the empty location which ends
777 the previous symbol: RHS[0] (always defined). */
779 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
780 #ifndef YYLLOC_DEFAULT
781 # define YYLLOC_DEFAULT(Current, Rhs, N) \
782 do \
783 if (N) \
785 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
786 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
787 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
788 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
790 else \
792 (Current).first_line = (Current).last_line = \
793 YYRHSLOC (Rhs, 0).last_line; \
794 (Current).first_column = (Current).last_column = \
795 YYRHSLOC (Rhs, 0).last_column; \
797 while (0)
798 #endif
801 /* YY_LOCATION_PRINT -- Print the location on the stream.
802 This macro was not mandated originally: define only if we know
803 we won't break user code: when these are the locations we know. */
805 #ifndef YY_LOCATION_PRINT
806 # if YYLTYPE_IS_TRIVIAL
807 # define YY_LOCATION_PRINT(File, Loc) \
808 fprintf (File, "%d.%d-%d.%d", \
809 (Loc).first_line, (Loc).first_column, \
810 (Loc).last_line, (Loc).last_column)
811 # else
812 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
813 # endif
814 #endif
817 /* YYLEX -- calling `yylex' with the right arguments. */
819 #ifdef YYLEX_PARAM
820 # define YYLEX yylex (YYLEX_PARAM)
821 #else
822 # define YYLEX yylex ()
823 #endif
825 /* Enable debugging if requested. */
826 #if YYDEBUG
828 # ifndef YYFPRINTF
829 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
830 # define YYFPRINTF fprintf
831 # endif
833 # define YYDPRINTF(Args) \
834 do { \
835 if (yydebug) \
836 YYFPRINTF Args; \
837 } while (0)
839 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
840 do { \
841 if (yydebug) \
843 YYFPRINTF (stderr, "%s ", Title); \
844 yysymprint (stderr, \
845 Type, Value); \
846 YYFPRINTF (stderr, "\n"); \
848 } while (0)
850 /*------------------------------------------------------------------.
851 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
852 | TOP (included). |
853 `------------------------------------------------------------------*/
855 #if defined (__STDC__) || defined (__cplusplus)
856 static void
857 yy_stack_print (short int *bottom, short int *top)
858 #else
859 static void
860 yy_stack_print (bottom, top)
861 short int *bottom;
862 short int *top;
863 #endif
865 YYFPRINTF (stderr, "Stack now");
866 for (/* Nothing. */; bottom <= top; ++bottom)
867 YYFPRINTF (stderr, " %d", *bottom);
868 YYFPRINTF (stderr, "\n");
871 # define YY_STACK_PRINT(Bottom, Top) \
872 do { \
873 if (yydebug) \
874 yy_stack_print ((Bottom), (Top)); \
875 } while (0)
878 /*------------------------------------------------.
879 | Report that the YYRULE is going to be reduced. |
880 `------------------------------------------------*/
882 #if defined (__STDC__) || defined (__cplusplus)
883 static void
884 yy_reduce_print (int yyrule)
885 #else
886 static void
887 yy_reduce_print (yyrule)
888 int yyrule;
889 #endif
891 int yyi;
892 unsigned long int yylno = yyrline[yyrule];
893 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
894 yyrule - 1, yylno);
895 /* Print the symbols being reduced, and their result. */
896 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
897 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
898 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
901 # define YY_REDUCE_PRINT(Rule) \
902 do { \
903 if (yydebug) \
904 yy_reduce_print (Rule); \
905 } while (0)
907 /* Nonzero means print parse trace. It is left uninitialized so that
908 multiple parsers can coexist. */
909 int yydebug;
910 #else /* !YYDEBUG */
911 # define YYDPRINTF(Args)
912 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
913 # define YY_STACK_PRINT(Bottom, Top)
914 # define YY_REDUCE_PRINT(Rule)
915 #endif /* !YYDEBUG */
918 /* YYINITDEPTH -- initial size of the parser's stacks. */
919 #ifndef YYINITDEPTH
920 # define YYINITDEPTH 200
921 #endif
923 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
924 if the built-in stack extension method is used).
926 Do not make this value too large; the results are undefined if
927 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
928 evaluated with infinite-precision integer arithmetic. */
930 #ifndef YYMAXDEPTH
931 # define YYMAXDEPTH 10000
932 #endif
936 #if YYERROR_VERBOSE
938 # ifndef yystrlen
939 # if defined (__GLIBC__) && defined (_STRING_H)
940 # define yystrlen strlen
941 # else
942 /* Return the length of YYSTR. */
943 static YYSIZE_T
944 # if defined (__STDC__) || defined (__cplusplus)
945 yystrlen (const char *yystr)
946 # else
947 yystrlen (yystr)
948 const char *yystr;
949 # endif
951 const char *yys = yystr;
953 while (*yys++ != '\0')
954 continue;
956 return yys - yystr - 1;
958 # endif
959 # endif
961 # ifndef yystpcpy
962 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
963 # define yystpcpy stpcpy
964 # else
965 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
966 YYDEST. */
967 static char *
968 # if defined (__STDC__) || defined (__cplusplus)
969 yystpcpy (char *yydest, const char *yysrc)
970 # else
971 yystpcpy (yydest, yysrc)
972 char *yydest;
973 const char *yysrc;
974 # endif
976 char *yyd = yydest;
977 const char *yys = yysrc;
979 while ((*yyd++ = *yys++) != '\0')
980 continue;
982 return yyd - 1;
984 # endif
985 # endif
987 # ifndef yytnamerr
988 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
989 quotes and backslashes, so that it's suitable for yyerror. The
990 heuristic is that double-quoting is unnecessary unless the string
991 contains an apostrophe, a comma, or backslash (other than
992 backslash-backslash). YYSTR is taken from yytname. If YYRES is
993 null, do not copy; instead, return the length of what the result
994 would have been. */
995 static YYSIZE_T
996 yytnamerr (char *yyres, const char *yystr)
998 if (*yystr == '"')
1000 size_t yyn = 0;
1001 char const *yyp = yystr;
1003 for (;;)
1004 switch (*++yyp)
1006 case '\'':
1007 case ',':
1008 goto do_not_strip_quotes;
1010 case '\\':
1011 if (*++yyp != '\\')
1012 goto do_not_strip_quotes;
1013 /* Fall through. */
1014 default:
1015 if (yyres)
1016 yyres[yyn] = *yyp;
1017 yyn++;
1018 break;
1020 case '"':
1021 if (yyres)
1022 yyres[yyn] = '\0';
1023 return yyn;
1025 do_not_strip_quotes: ;
1028 if (! yyres)
1029 return yystrlen (yystr);
1031 return yystpcpy (yyres, yystr) - yyres;
1033 # endif
1035 #endif /* YYERROR_VERBOSE */
1039 #if YYDEBUG
1040 /*--------------------------------.
1041 | Print this symbol on YYOUTPUT. |
1042 `--------------------------------*/
1044 #if defined (__STDC__) || defined (__cplusplus)
1045 static void
1046 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1047 #else
1048 static void
1049 yysymprint (yyoutput, yytype, yyvaluep)
1050 FILE *yyoutput;
1051 int yytype;
1052 YYSTYPE *yyvaluep;
1053 #endif
1055 /* Pacify ``unused variable'' warnings. */
1056 (void) yyvaluep;
1058 if (yytype < YYNTOKENS)
1059 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1060 else
1061 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1064 # ifdef YYPRINT
1065 if (yytype < YYNTOKENS)
1066 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1067 # endif
1068 switch (yytype)
1070 default:
1071 break;
1073 YYFPRINTF (yyoutput, ")");
1076 #endif /* ! YYDEBUG */
1077 /*-----------------------------------------------.
1078 | Release the memory associated to this symbol. |
1079 `-----------------------------------------------*/
1081 #if defined (__STDC__) || defined (__cplusplus)
1082 static void
1083 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1084 #else
1085 static void
1086 yydestruct (yymsg, yytype, yyvaluep)
1087 const char *yymsg;
1088 int yytype;
1089 YYSTYPE *yyvaluep;
1090 #endif
1092 /* Pacify ``unused variable'' warnings. */
1093 (void) yyvaluep;
1095 if (!yymsg)
1096 yymsg = "Deleting";
1097 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1099 switch (yytype)
1102 default:
1103 break;
1108 /* Prevent warnings from -Wmissing-prototypes. */
1110 #ifdef YYPARSE_PARAM
1111 # if defined (__STDC__) || defined (__cplusplus)
1112 int yyparse (void *YYPARSE_PARAM);
1113 # else
1114 int yyparse ();
1115 # endif
1116 #else /* ! YYPARSE_PARAM */
1117 #if defined (__STDC__) || defined (__cplusplus)
1118 int yyparse (void);
1119 #else
1120 int yyparse ();
1121 #endif
1122 #endif /* ! YYPARSE_PARAM */
1126 /* The look-ahead symbol. */
1127 int yychar;
1129 /* The semantic value of the look-ahead symbol. */
1130 YYSTYPE yylval;
1132 /* Number of syntax errors so far. */
1133 int yynerrs;
1137 /*----------.
1138 | yyparse. |
1139 `----------*/
1141 #ifdef YYPARSE_PARAM
1142 # if defined (__STDC__) || defined (__cplusplus)
1143 int yyparse (void *YYPARSE_PARAM)
1144 # else
1145 int yyparse (YYPARSE_PARAM)
1146 void *YYPARSE_PARAM;
1147 # endif
1148 #else /* ! YYPARSE_PARAM */
1149 #if defined (__STDC__) || defined (__cplusplus)
1151 yyparse (void)
1152 #else
1154 yyparse ()
1156 #endif
1157 #endif
1160 int yystate;
1161 int yyn;
1162 int yyresult;
1163 /* Number of tokens to shift before error messages enabled. */
1164 int yyerrstatus;
1165 /* Look-ahead token as an internal (translated) token number. */
1166 int yytoken = 0;
1168 /* Three stacks and their tools:
1169 `yyss': related to states,
1170 `yyvs': related to semantic values,
1171 `yyls': related to locations.
1173 Refer to the stacks thru separate pointers, to allow yyoverflow
1174 to reallocate them elsewhere. */
1176 /* The state stack. */
1177 short int yyssa[YYINITDEPTH];
1178 short int *yyss = yyssa;
1179 short int *yyssp;
1181 /* The semantic value stack. */
1182 YYSTYPE yyvsa[YYINITDEPTH];
1183 YYSTYPE *yyvs = yyvsa;
1184 YYSTYPE *yyvsp;
1188 #define YYPOPSTACK (yyvsp--, yyssp--)
1190 YYSIZE_T yystacksize = YYINITDEPTH;
1192 /* The variables used to return semantic value and location from the
1193 action routines. */
1194 YYSTYPE yyval;
1197 /* When reducing, the number of symbols on the RHS of the reduced
1198 rule. */
1199 int yylen;
1201 YYDPRINTF ((stderr, "Starting parse\n"));
1203 yystate = 0;
1204 yyerrstatus = 0;
1205 yynerrs = 0;
1206 yychar = YYEMPTY; /* Cause a token to be read. */
1208 /* Initialize stack pointers.
1209 Waste one element of value and location stack
1210 so that they stay on the same level as the state stack.
1211 The wasted elements are never initialized. */
1213 yyssp = yyss;
1214 yyvsp = yyvs;
1216 goto yysetstate;
1218 /*------------------------------------------------------------.
1219 | yynewstate -- Push a new state, which is found in yystate. |
1220 `------------------------------------------------------------*/
1221 yynewstate:
1222 /* In all cases, when you get here, the value and location stacks
1223 have just been pushed. so pushing a state here evens the stacks.
1225 yyssp++;
1227 yysetstate:
1228 *yyssp = yystate;
1230 if (yyss + yystacksize - 1 <= yyssp)
1232 /* Get the current used size of the three stacks, in elements. */
1233 YYSIZE_T yysize = yyssp - yyss + 1;
1235 #ifdef yyoverflow
1237 /* Give user a chance to reallocate the stack. Use copies of
1238 these so that the &'s don't force the real ones into
1239 memory. */
1240 YYSTYPE *yyvs1 = yyvs;
1241 short int *yyss1 = yyss;
1244 /* Each stack pointer address is followed by the size of the
1245 data in use in that stack, in bytes. This used to be a
1246 conditional around just the two extra args, but that might
1247 be undefined if yyoverflow is a macro. */
1248 yyoverflow (YY_("memory exhausted"),
1249 &yyss1, yysize * sizeof (*yyssp),
1250 &yyvs1, yysize * sizeof (*yyvsp),
1252 &yystacksize);
1254 yyss = yyss1;
1255 yyvs = yyvs1;
1257 #else /* no yyoverflow */
1258 # ifndef YYSTACK_RELOCATE
1259 goto yyexhaustedlab;
1260 # else
1261 /* Extend the stack our own way. */
1262 if (YYMAXDEPTH <= yystacksize)
1263 goto yyexhaustedlab;
1264 yystacksize *= 2;
1265 if (YYMAXDEPTH < yystacksize)
1266 yystacksize = YYMAXDEPTH;
1269 short int *yyss1 = yyss;
1270 union yyalloc *yyptr =
1271 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1272 if (! yyptr)
1273 goto yyexhaustedlab;
1274 YYSTACK_RELOCATE (yyss);
1275 YYSTACK_RELOCATE (yyvs);
1277 # undef YYSTACK_RELOCATE
1278 if (yyss1 != yyssa)
1279 YYSTACK_FREE (yyss1);
1281 # endif
1282 #endif /* no yyoverflow */
1284 yyssp = yyss + yysize - 1;
1285 yyvsp = yyvs + yysize - 1;
1288 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1289 (unsigned long int) yystacksize));
1291 if (yyss + yystacksize - 1 <= yyssp)
1292 YYABORT;
1295 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1297 goto yybackup;
1299 /*-----------.
1300 | yybackup. |
1301 `-----------*/
1302 yybackup:
1304 /* Do appropriate processing given the current state. */
1305 /* Read a look-ahead token if we need one and don't already have one. */
1306 /* yyresume: */
1308 /* First try to decide what to do without reference to look-ahead token. */
1310 yyn = yypact[yystate];
1311 if (yyn == YYPACT_NINF)
1312 goto yydefault;
1314 /* Not known => get a look-ahead token if don't already have one. */
1316 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1317 if (yychar == YYEMPTY)
1319 YYDPRINTF ((stderr, "Reading a token: "));
1320 yychar = YYLEX;
1323 if (yychar <= YYEOF)
1325 yychar = yytoken = YYEOF;
1326 YYDPRINTF ((stderr, "Now at end of input.\n"));
1328 else
1330 yytoken = YYTRANSLATE (yychar);
1331 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1334 /* If the proper action on seeing token YYTOKEN is to reduce or to
1335 detect an error, take that action. */
1336 yyn += yytoken;
1337 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1338 goto yydefault;
1339 yyn = yytable[yyn];
1340 if (yyn <= 0)
1342 if (yyn == 0 || yyn == YYTABLE_NINF)
1343 goto yyerrlab;
1344 yyn = -yyn;
1345 goto yyreduce;
1348 if (yyn == YYFINAL)
1349 YYACCEPT;
1351 /* Shift the look-ahead token. */
1352 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1354 /* Discard the token being shifted unless it is eof. */
1355 if (yychar != YYEOF)
1356 yychar = YYEMPTY;
1358 *++yyvsp = yylval;
1361 /* Count tokens shifted since error; after three, turn off error
1362 status. */
1363 if (yyerrstatus)
1364 yyerrstatus--;
1366 yystate = yyn;
1367 goto yynewstate;
1370 /*-----------------------------------------------------------.
1371 | yydefault -- do the default action for the current state. |
1372 `-----------------------------------------------------------*/
1373 yydefault:
1374 yyn = yydefact[yystate];
1375 if (yyn == 0)
1376 goto yyerrlab;
1377 goto yyreduce;
1380 /*-----------------------------.
1381 | yyreduce -- Do a reduction. |
1382 `-----------------------------*/
1383 yyreduce:
1384 /* yyn is the number of a rule to reduce with. */
1385 yylen = yyr2[yyn];
1387 /* If YYLEN is nonzero, implement the default value of the action:
1388 `$$ = $1'.
1390 Otherwise, the following line sets YYVAL to garbage.
1391 This behavior is undocumented and Bison
1392 users should not rely upon it. Assigning to YYVAL
1393 unconditionally makes the parser a bit smaller, and it avoids a
1394 GCC warning that YYVAL may be used uninitialized. */
1395 yyval = yyvsp[1-yylen];
1398 YY_REDUCE_PRINT (yyn);
1399 switch (yyn)
1401 case 5:
1402 #line 309 "itbl-parse.y"
1404 DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n",
1405 insntbl_line, (yyvsp[-4].num), (yyvsp[-3].num), (yyvsp[-2].str), (yyvsp[-1].val)));
1406 itbl_add_reg ((yyvsp[-4].num), (yyvsp[-3].num), (yyvsp[-2].str), (yyvsp[-1].val));
1408 break;
1410 case 6:
1411 #line 315 "itbl-parse.y"
1413 DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x",
1414 insntbl_line, (yyvsp[-5].num), (yyvsp[-3].str), (yyvsp[-2].val)));
1415 DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, (yyvsp[0].val)));
1416 insn=itbl_add_insn ((yyvsp[-5].num), (yyvsp[-3].str), (yyvsp[-2].val), sbit, ebit, (yyvsp[0].val));
1418 break;
1420 case 7:
1421 #line 322 "itbl-parse.y"
1423 break;
1425 case 13:
1426 #line 335 "itbl-parse.y"
1428 DBGL2 (("ftype\n"));
1429 (yyval.num) = (yyvsp[0].num);
1431 break;
1433 case 14:
1434 #line 340 "itbl-parse.y"
1436 DBGL2 (("addr\n"));
1437 (yyval.num) = ADDR;
1439 break;
1441 case 15:
1442 #line 345 "itbl-parse.y"
1444 DBGL2 (("immed\n"));
1445 (yyval.num) = IMMED;
1447 break;
1449 case 16:
1450 #line 353 "itbl-parse.y"
1452 DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n",
1453 insntbl_line, (yyvsp[-2].num), sbit, ebit, (yyvsp[0].val)));
1454 itbl_add_operand (insn, (yyvsp[-2].num), sbit, ebit, (yyvsp[0].val));
1456 break;
1458 case 17:
1459 #line 362 "itbl-parse.y"
1461 (yyval.val) = (yyvsp[-2].num) | (yyvsp[0].val);
1463 break;
1465 case 18:
1466 #line 366 "itbl-parse.y"
1468 (yyval.val) = (yyvsp[-1].val);
1470 break;
1472 case 19:
1473 #line 370 "itbl-parse.y"
1475 (yyval.val) = (yyvsp[0].num);
1477 break;
1479 case 20:
1480 #line 377 "itbl-parse.y"
1482 DBGL2 (("flags=%d\n", (yyvsp[0].val)));
1483 (yyval.val) = (yyvsp[0].val);
1485 break;
1487 case 21:
1488 #line 382 "itbl-parse.y"
1490 (yyval.val) = 0;
1492 break;
1494 case 22:
1495 #line 389 "itbl-parse.y"
1497 DBGL2 (("range %d %d\n", (yyvsp[-2].num), (yyvsp[0].num)));
1498 sbit = (yyvsp[-2].num);
1499 ebit = (yyvsp[0].num);
1501 break;
1503 case 23:
1504 #line 395 "itbl-parse.y"
1506 sbit = 31;
1507 ebit = 0;
1509 break;
1511 case 24:
1512 #line 403 "itbl-parse.y"
1514 DBGL2 (("pnum=%d\n",(yyvsp[0].num)));
1515 (yyval.num) = (yyvsp[0].num);
1517 break;
1519 case 25:
1520 #line 411 "itbl-parse.y"
1522 DBGL2 (("dreg\n"));
1523 (yyval.num) = DREG;
1525 break;
1527 case 26:
1528 #line 416 "itbl-parse.y"
1530 DBGL2 (("creg\n"));
1531 (yyval.num) = CREG;
1533 break;
1535 case 27:
1536 #line 421 "itbl-parse.y"
1538 DBGL2 (("greg\n"));
1539 (yyval.num) = GREG;
1541 break;
1543 case 28:
1544 #line 429 "itbl-parse.y"
1546 DBGL2 (("name=%s\n",(yyvsp[0].str)));
1547 (yyval.str) = (yyvsp[0].str);
1549 break;
1551 case 29:
1552 #line 445 "itbl-parse.y"
1554 DBGL2 (("val=x%x\n",(yyvsp[0].num)));
1555 (yyval.val) = (yyvsp[0].num);
1557 break;
1560 default: break;
1563 /* Line 1126 of yacc.c. */
1564 #line 1565 "itbl-parse.c"
1566 yyvsp -= yylen;
1567 yyssp -= yylen;
1570 YY_STACK_PRINT (yyss, yyssp);
1572 *++yyvsp = yyval;
1575 /* Now `shift' the result of the reduction. Determine what state
1576 that goes to, based on the state we popped back to and the rule
1577 number reduced by. */
1579 yyn = yyr1[yyn];
1581 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1582 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1583 yystate = yytable[yystate];
1584 else
1585 yystate = yydefgoto[yyn - YYNTOKENS];
1587 goto yynewstate;
1590 /*------------------------------------.
1591 | yyerrlab -- here on detecting error |
1592 `------------------------------------*/
1593 yyerrlab:
1594 /* If not already recovering from an error, report this error. */
1595 if (!yyerrstatus)
1597 ++yynerrs;
1598 #if YYERROR_VERBOSE
1599 yyn = yypact[yystate];
1601 if (YYPACT_NINF < yyn && yyn < YYLAST)
1603 int yytype = YYTRANSLATE (yychar);
1604 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1605 YYSIZE_T yysize = yysize0;
1606 YYSIZE_T yysize1;
1607 int yysize_overflow = 0;
1608 char *yymsg = 0;
1609 # define YYERROR_VERBOSE_ARGS_MAXIMUM 5
1610 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1611 int yyx;
1613 #if 0
1614 /* This is so xgettext sees the translatable formats that are
1615 constructed on the fly. */
1616 YY_("syntax error, unexpected %s");
1617 YY_("syntax error, unexpected %s, expecting %s");
1618 YY_("syntax error, unexpected %s, expecting %s or %s");
1619 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1620 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1621 #endif
1622 char *yyfmt;
1623 char const *yyf;
1624 static char const yyunexpected[] = "syntax error, unexpected %s";
1625 static char const yyexpecting[] = ", expecting %s";
1626 static char const yyor[] = " or %s";
1627 char yyformat[sizeof yyunexpected
1628 + sizeof yyexpecting - 1
1629 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1630 * (sizeof yyor - 1))];
1631 char const *yyprefix = yyexpecting;
1633 /* Start YYX at -YYN if negative to avoid negative indexes in
1634 YYCHECK. */
1635 int yyxbegin = yyn < 0 ? -yyn : 0;
1637 /* Stay within bounds of both yycheck and yytname. */
1638 int yychecklim = YYLAST - yyn;
1639 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1640 int yycount = 1;
1642 yyarg[0] = yytname[yytype];
1643 yyfmt = yystpcpy (yyformat, yyunexpected);
1645 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1646 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1648 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1650 yycount = 1;
1651 yysize = yysize0;
1652 yyformat[sizeof yyunexpected - 1] = '\0';
1653 break;
1655 yyarg[yycount++] = yytname[yyx];
1656 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1657 yysize_overflow |= yysize1 < yysize;
1658 yysize = yysize1;
1659 yyfmt = yystpcpy (yyfmt, yyprefix);
1660 yyprefix = yyor;
1663 yyf = YY_(yyformat);
1664 yysize1 = yysize + yystrlen (yyf);
1665 yysize_overflow |= yysize1 < yysize;
1666 yysize = yysize1;
1668 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1669 yymsg = (char *) YYSTACK_ALLOC (yysize);
1670 if (yymsg)
1672 /* Avoid sprintf, as that infringes on the user's name space.
1673 Don't have undefined behavior even if the translation
1674 produced a string with the wrong number of "%s"s. */
1675 char *yyp = yymsg;
1676 int yyi = 0;
1677 while ((*yyp = *yyf))
1679 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1681 yyp += yytnamerr (yyp, yyarg[yyi++]);
1682 yyf += 2;
1684 else
1686 yyp++;
1687 yyf++;
1690 yyerror (yymsg);
1691 YYSTACK_FREE (yymsg);
1693 else
1695 yyerror (YY_("syntax error"));
1696 goto yyexhaustedlab;
1699 else
1700 #endif /* YYERROR_VERBOSE */
1701 yyerror (YY_("syntax error"));
1706 if (yyerrstatus == 3)
1708 /* If just tried and failed to reuse look-ahead token after an
1709 error, discard it. */
1711 if (yychar <= YYEOF)
1713 /* Return failure if at end of input. */
1714 if (yychar == YYEOF)
1715 YYABORT;
1717 else
1719 yydestruct ("Error: discarding", yytoken, &yylval);
1720 yychar = YYEMPTY;
1724 /* Else will try to reuse look-ahead token after shifting the error
1725 token. */
1726 goto yyerrlab1;
1729 /*---------------------------------------------------.
1730 | yyerrorlab -- error raised explicitly by YYERROR. |
1731 `---------------------------------------------------*/
1732 yyerrorlab:
1734 /* Pacify compilers like GCC when the user code never invokes
1735 YYERROR and the label yyerrorlab therefore never appears in user
1736 code. */
1737 if (0)
1738 goto yyerrorlab;
1740 yyvsp -= yylen;
1741 yyssp -= yylen;
1742 yystate = *yyssp;
1743 goto yyerrlab1;
1746 /*-------------------------------------------------------------.
1747 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1748 `-------------------------------------------------------------*/
1749 yyerrlab1:
1750 yyerrstatus = 3; /* Each real token shifted decrements this. */
1752 for (;;)
1754 yyn = yypact[yystate];
1755 if (yyn != YYPACT_NINF)
1757 yyn += YYTERROR;
1758 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1760 yyn = yytable[yyn];
1761 if (0 < yyn)
1762 break;
1766 /* Pop the current state because it cannot handle the error token. */
1767 if (yyssp == yyss)
1768 YYABORT;
1771 yydestruct ("Error: popping", yystos[yystate], yyvsp);
1772 YYPOPSTACK;
1773 yystate = *yyssp;
1774 YY_STACK_PRINT (yyss, yyssp);
1777 if (yyn == YYFINAL)
1778 YYACCEPT;
1780 *++yyvsp = yylval;
1783 /* Shift the error token. */
1784 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1786 yystate = yyn;
1787 goto yynewstate;
1790 /*-------------------------------------.
1791 | yyacceptlab -- YYACCEPT comes here. |
1792 `-------------------------------------*/
1793 yyacceptlab:
1794 yyresult = 0;
1795 goto yyreturn;
1797 /*-----------------------------------.
1798 | yyabortlab -- YYABORT comes here. |
1799 `-----------------------------------*/
1800 yyabortlab:
1801 yyresult = 1;
1802 goto yyreturn;
1804 #ifndef yyoverflow
1805 /*-------------------------------------------------.
1806 | yyexhaustedlab -- memory exhaustion comes here. |
1807 `-------------------------------------------------*/
1808 yyexhaustedlab:
1809 yyerror (YY_("memory exhausted"));
1810 yyresult = 2;
1811 /* Fall through. */
1812 #endif
1814 yyreturn:
1815 if (yychar != YYEOF && yychar != YYEMPTY)
1816 yydestruct ("Cleanup: discarding lookahead",
1817 yytoken, &yylval);
1818 while (yyssp != yyss)
1820 yydestruct ("Cleanup: popping",
1821 yystos[*yyssp], yyvsp);
1822 YYPOPSTACK;
1824 #ifndef yyoverflow
1825 if (yyss != yyssa)
1826 YYSTACK_FREE (yyss);
1827 #endif
1828 return yyresult;
1832 #line 450 "itbl-parse.y"
1835 static int
1836 yyerror (msg)
1837 const char *msg;
1839 printf ("line %d: %s\n", insntbl_line, msg);
1840 return 0;