OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-binutils/] [binutils-2.19.1/] [gas/] [itbl-parse.c] - Blame information for rev 17

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 jlechner
/* A Bison parser, made by GNU Bison 2.1.  */
2
 
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.
5
 
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.
10
 
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.
15
 
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.  */
20
 
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.  */
25
 
26
/* Written by Richard Stallman by simplifying the original so called
27
   ``semantic'' parser.  */
28
 
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.  */
35
 
36
/* Identify Bison output.  */
37
#define YYBISON 1
38
 
39
/* Bison version.  */
40
#define YYBISON_VERSION "2.1"
41
 
42
/* Skeleton name.  */
43
#define YYSKELETON_NAME "yacc.c"
44
 
45
/* Pure parsers.  */
46
#define YYPURE 0
47
 
48
/* Using locations.  */
49
#define YYLSP_NEEDED 0
50
 
51
 
52
 
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
69
   };
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
82
 
83
 
84
 
85
 
86
/* Copy the first part of user declarations.  */
87
#line 21 "itbl-parse.y"
88
 
89
 
90
/*
91
 
92
Yacc grammar for instruction table entries.
93
 
94
=======================================================================
95
Original Instruction table specification document:
96
 
97
            MIPS Coprocessor Table Specification
98
            ====================================
99
 
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.
108
 
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.
115
 
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.
119
 
120
Examples:
121
 
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
125
 
126
Only one table may be supplied during a single invocation of
127
the assembler.
128
 
129
 
130
Instruction classes
131
===================
132
 
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.
136
 
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
168
 
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.
175
 
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.
181
 
182
 
183
Table Grammar
184
=============
185
 
186
Here is the grammar for the coprocessor table:
187
 
188
            table -> entry*
189
 
190
            entry -> [z entrydef] [comment] '\n'
191
 
192
            entrydef -> type name val
193
            entrydef -> 'insn' name val funcdef ; type of entry (instruction)
194
 
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)
201
 
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
217
 
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
223
 
224
 
225
Examples
226
========
227
 
228
Example 1:
229
 
230
The table:
231
 
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
236
 
237
will allow the assembler to accept the following coprocessor instructions:
238
 
239
            LWC1 d1,0x100 ($2)
240
            fill
241
 
242
Here, the general purpose register "$2", and instruction "LWC1", are standard
243
mnemonics built-in to the MIPS assembler.
244
 
245
 
246
Example 2:
247
 
248
The table:
249
 
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.
256
 
257
will allow the assembler to accept the following coprocessor instruction:
258
 
259
            fee d3,c2,0x1
260
 
261
and will emit the object code:
262
 
263
            31-26  25 24-20 19-18  17-13 12-8  7-0
264
            COPz   CO fun                     dreg  creg  immed
265
            010011 1  11111 00       00011 10110 00000001
266
 
267
            0x4ff07601
268
 
269
 
270
Example 3:
271
 
272
The table:
273
 
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
277
 
278
will allow the assembler to accept the following coprocessor
279
instruction:
280
 
281
            fuu d3,c2
282
 
283
and will emit the object code:
284
 
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
288
 
289
            0x4ff07601
290
 
291
In this way, the programmer can force arbitrary bits of an instruction
292
to have predefined values.
293
 
294
=======================================================================
295
Additional notes:
296
 
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).
302
 
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.
306
 
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
311
 
312
FIXME! hex is ambiguous with any digit
313
 
314
*/
315
 
316
#include "as.h"
317
#include "itbl-lex.h"
318
#include "itbl-ops.h"
319
 
320
/* #define DEBUG */
321
 
322
#ifdef DEBUG
323
#ifndef DBG_LVL
324
#define DBG_LVL 1
325
#endif
326
#else
327
#define DBG_LVL 0
328
#endif
329
 
330
#if DBG_LVL >= 1
331
#define DBG(x) printf x
332
#else
333
#define DBG(x) 
334
#endif
335
 
336
#if DBG_LVL >= 2
337
#define DBGL2(x) printf x
338
#else
339
#define DBGL2(x) 
340
#endif
341
 
342
static int sbit, ebit;
343
static struct itbl_entry *insn=0;
344
static int yyerror (const char *);
345
 
346
 
347
 
348
/* Enabling traces.  */
349
#ifndef YYDEBUG
350
# define YYDEBUG 0
351
#endif
352
 
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
360
 
361
/* Enabling the token table.  */
362
#ifndef YYTOKEN_TABLE
363
# define YYTOKEN_TABLE 0
364
#endif
365
 
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
380
 
381
 
382
 
383
/* Copy the second part of user declarations.  */
384
 
385
 
386
/* Line 219 of yacc.c.  */
387
#line 388 "itbl-parse.c"
388
 
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
402
 
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
414
 
415
#if ! defined (yyoverflow) || YYERROR_VERBOSE
416
 
417
/* The parser invokes alloca or malloc; define the necessary symbols.  */
418
 
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
432
 
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
467
}
468
#  endif
469
# endif
470
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
471
 
472
 
473
#if (! defined (yyoverflow) \
474
     && (! defined (__cplusplus) \
475
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
476
 
477
/* A type that is properly aligned for any stack member.  */
478
union yyalloc
479
{
480
  short int yyss;
481
  YYSTYPE yyvs;
482
  };
483
 
484
/* The size of the maximum gap between one aligned stack and the next.  */
485
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
486
 
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)
492
 
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                                        \
502
        {                                       \
503
          YYSIZE_T yyi;                         \
504
          for (yyi = 0; yyi < (Count); yyi++)    \
505
            (To)[yyi] = (From)[yyi];            \
506
        }                                       \
507
      while (0)
508
#  endif
509
# endif
510
 
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                                                                  \
518
      {                                                                 \
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);                          \
524
      }                                                                 \
525
    while (0)
526
 
527
#endif
528
 
529
#if defined (__STDC__) || defined (__cplusplus)
530
   typedef signed char yysigned_char;
531
#else
532
   typedef short int yysigned_char;
533
#endif
534
 
535
/* YYFINAL -- State number of the termination state. */
536
#define YYFINAL  9
537
/* YYLAST -- Last index in YYTABLE.  */
538
#define YYLAST   46
539
 
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
548
 
549
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
550
#define YYUNDEFTOK  2
551
#define YYMAXUTOK   267
552
 
553
#define YYTRANSLATE(YYX)                                                \
554
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
555
 
556
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
557
static const unsigned char yytranslate[] =
558
{
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
586
};
587
 
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[] =
592
{
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
596
};
597
 
598
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
599
static const yysigned_char yyrhs[] =
600
{
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,
609
      -1
610
};
611
 
612
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
613
static const unsigned short int yyrline[] =
614
{
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
618
};
619
#endif
620
 
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[] =
625
{
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
631
};
632
#endif
633
 
634
# ifdef YYPRINT
635
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
636
   token YYLEX-NUM.  */
637
static const unsigned short int yytoknum[] =
638
{
639
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
640
     265,   266,   267,    44,   124,    91,    93,    42,    58,    45
641
};
642
# endif
643
 
644
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
645
static const unsigned char yyr1[] =
646
{
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
650
};
651
 
652
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
653
static const unsigned char yyr2[] =
654
{
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
658
};
659
 
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[] =
664
{
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,
670
      16
671
};
672
 
673
/* YYDEFGOTO[NTERM-NUM]. */
674
static const yysigned_char yydefgoto[] =
675
{
676
      -1,     4,     5,     6,    32,    39,    40,    41,    31,    27,
677
      23,     7,    42,    17,    20
678
};
679
 
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[] =
684
{
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,
690
     -16
691
};
692
 
693
/* YYPGOTO[NTERM-NUM].  */
694
static const yysigned_char yypgoto[] =
695
{
696
     -16,   -16,    32,   -16,   -16,   -15,   -16,     2,    -3,    -8,
697
       4,   -16,    34,    27,    28
698
};
699
 
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[] =
706
{
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
712
};
713
 
714
static const yysigned_char yycheck[] =
715
{
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
721
};
722
 
723
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
724
   symbol of state STATE-NUM.  */
725
static const unsigned char yystos[] =
726
{
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,
732
      29
733
};
734
 
735
#define yyerrok         (yyerrstatus = 0)
736
#define yyclearin       (yychar = YYEMPTY)
737
#define YYEMPTY         (-2)
738
#define YYEOF           0
739
 
740
#define YYACCEPT        goto yyacceptlab
741
#define YYABORT         goto yyabortlab
742
#define YYERROR         goto yyerrorlab
743
 
744
 
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.  */
748
 
749
#define YYFAIL          goto yyerrlab
750
 
751
#define YYRECOVERING()  (!!yyerrstatus)
752
 
753
#define YYBACKUP(Token, Value)                                  \
754
do                                                              \
755
  if (yychar == YYEMPTY && yylen == 1)                          \
756
    {                                                           \
757
      yychar = (Token);                                         \
758
      yylval = (Value);                                         \
759
      yytoken = YYTRANSLATE (yychar);                           \
760
      YYPOPSTACK;                                               \
761
      goto yybackup;                                            \
762
    }                                                           \
763
  else                                                          \
764
    {                                                           \
765
      yyerror (YY_("syntax error: cannot back up")); \
766
      YYERROR;                                                  \
767
    }                                                           \
768
while (0)
769
 
770
 
771
#define YYTERROR        1
772
#define YYERRCODE       256
773
 
774
 
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).  */
778
 
779
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
780
#ifndef YYLLOC_DEFAULT
781
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
782
    do                                                                  \
783
      if (N)                                                            \
784
        {                                                               \
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;       \
789
        }                                                               \
790
      else                                                              \
791
        {                                                               \
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;                               \
796
        }                                                               \
797
    while (0)
798
#endif
799
 
800
 
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.  */
804
 
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
815
 
816
 
817
/* YYLEX -- calling `yylex' with the right arguments.  */
818
 
819
#ifdef YYLEX_PARAM
820
# define YYLEX yylex (YYLEX_PARAM)
821
#else
822
# define YYLEX yylex ()
823
#endif
824
 
825
/* Enable debugging if requested.  */
826
#if YYDEBUG
827
 
828
# ifndef YYFPRINTF
829
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
830
#  define YYFPRINTF fprintf
831
# endif
832
 
833
# define YYDPRINTF(Args)                        \
834
do {                                            \
835
  if (yydebug)                                  \
836
    YYFPRINTF Args;                             \
837
} while (0)
838
 
839
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)          \
840
do {                                                            \
841
  if (yydebug)                                                  \
842
    {                                                           \
843
      YYFPRINTF (stderr, "%s ", Title);                         \
844
      yysymprint (stderr,                                       \
845
                  Type, Value); \
846
      YYFPRINTF (stderr, "\n");                                 \
847
    }                                                           \
848
} while (0)
849
 
850
/*------------------------------------------------------------------.
851
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
852
| TOP (included).                                                   |
853
`------------------------------------------------------------------*/
854
 
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
864
{
865
  YYFPRINTF (stderr, "Stack now");
866
  for (/* Nothing. */; bottom <= top; ++bottom)
867
    YYFPRINTF (stderr, " %d", *bottom);
868
  YYFPRINTF (stderr, "\n");
869
}
870
 
871
# define YY_STACK_PRINT(Bottom, Top)                            \
872
do {                                                            \
873
  if (yydebug)                                                  \
874
    yy_stack_print ((Bottom), (Top));                           \
875
} while (0)
876
 
877
 
878
/*------------------------------------------------.
879
| Report that the YYRULE is going to be reduced.  |
880
`------------------------------------------------*/
881
 
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
890
{
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]]);
899
}
900
 
901
# define YY_REDUCE_PRINT(Rule)          \
902
do {                                    \
903
  if (yydebug)                          \
904
    yy_reduce_print (Rule);             \
905
} while (0)
906
 
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 */
916
 
917
 
918
/* YYINITDEPTH -- initial size of the parser's stacks.  */
919
#ifndef YYINITDEPTH
920
# define YYINITDEPTH 200
921
#endif
922
 
923
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
924
   if the built-in stack extension method is used).
925
 
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.  */
929
 
930
#ifndef YYMAXDEPTH
931
# define YYMAXDEPTH 10000
932
#endif
933
 
934
 
935
 
936
#if YYERROR_VERBOSE
937
 
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
950
{
951
  const char *yys = yystr;
952
 
953
  while (*yys++ != '\0')
954
    continue;
955
 
956
  return yys - yystr - 1;
957
}
958
#  endif
959
# endif
960
 
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
975
{
976
  char *yyd = yydest;
977
  const char *yys = yysrc;
978
 
979
  while ((*yyd++ = *yys++) != '\0')
980
    continue;
981
 
982
  return yyd - 1;
983
}
984
#  endif
985
# endif
986
 
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)
997
{
998
  if (*yystr == '"')
999
    {
1000
      size_t yyn = 0;
1001
      char const *yyp = yystr;
1002
 
1003
      for (;;)
1004
        switch (*++yyp)
1005
          {
1006
          case '\'':
1007
          case ',':
1008
            goto do_not_strip_quotes;
1009
 
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;
1019
 
1020
          case '"':
1021
            if (yyres)
1022
              yyres[yyn] = '\0';
1023
            return yyn;
1024
          }
1025
    do_not_strip_quotes: ;
1026
    }
1027
 
1028
  if (! yyres)
1029
    return yystrlen (yystr);
1030
 
1031
  return yystpcpy (yyres, yystr) - yyres;
1032
}
1033
# endif
1034
 
1035
#endif /* YYERROR_VERBOSE */
1036
 
1037
 
1038
 
1039
#if YYDEBUG
1040
/*--------------------------------.
1041
| Print this symbol on YYOUTPUT.  |
1042
`--------------------------------*/
1043
 
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
1054
{
1055
  /* Pacify ``unused variable'' warnings.  */
1056
  (void) yyvaluep;
1057
 
1058
  if (yytype < YYNTOKENS)
1059
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1060
  else
1061
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1062
 
1063
 
1064
# ifdef YYPRINT
1065
  if (yytype < YYNTOKENS)
1066
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1067
# endif
1068
  switch (yytype)
1069
    {
1070
      default:
1071
        break;
1072
    }
1073
  YYFPRINTF (yyoutput, ")");
1074
}
1075
 
1076
#endif /* ! YYDEBUG */
1077
/*-----------------------------------------------.
1078
| Release the memory associated to this symbol.  |
1079
`-----------------------------------------------*/
1080
 
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
1091
{
1092
  /* Pacify ``unused variable'' warnings.  */
1093
  (void) yyvaluep;
1094
 
1095
  if (!yymsg)
1096
    yymsg = "Deleting";
1097
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1098
 
1099
  switch (yytype)
1100
    {
1101
 
1102
      default:
1103
        break;
1104
    }
1105
}
1106
 
1107
 
1108
/* Prevent warnings from -Wmissing-prototypes.  */
1109
 
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 */
1123
 
1124
 
1125
 
1126
/* The look-ahead symbol.  */
1127
int yychar;
1128
 
1129
/* The semantic value of the look-ahead symbol.  */
1130
YYSTYPE yylval;
1131
 
1132
/* Number of syntax errors so far.  */
1133
int yynerrs;
1134
 
1135
 
1136
 
1137
/*----------.
1138
| yyparse.  |
1139
`----------*/
1140
 
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)
1150
int
1151
yyparse (void)
1152
#else
1153
int
1154
yyparse ()
1155
    ;
1156
#endif
1157
#endif
1158
{
1159
 
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;
1167
 
1168
  /* Three stacks and their tools:
1169
     `yyss': related to states,
1170
     `yyvs': related to semantic values,
1171
     `yyls': related to locations.
1172
 
1173
     Refer to the stacks thru separate pointers, to allow yyoverflow
1174
     to reallocate them elsewhere.  */
1175
 
1176
  /* The state stack.  */
1177
  short int yyssa[YYINITDEPTH];
1178
  short int *yyss = yyssa;
1179
  short int *yyssp;
1180
 
1181
  /* The semantic value stack.  */
1182
  YYSTYPE yyvsa[YYINITDEPTH];
1183
  YYSTYPE *yyvs = yyvsa;
1184
  YYSTYPE *yyvsp;
1185
 
1186
 
1187
 
1188
#define YYPOPSTACK   (yyvsp--, yyssp--)
1189
 
1190
  YYSIZE_T yystacksize = YYINITDEPTH;
1191
 
1192
  /* The variables used to return semantic value and location from the
1193
     action routines.  */
1194
  YYSTYPE yyval;
1195
 
1196
 
1197
  /* When reducing, the number of symbols on the RHS of the reduced
1198
     rule.  */
1199
  int yylen;
1200
 
1201
  YYDPRINTF ((stderr, "Starting parse\n"));
1202
 
1203
  yystate = 0;
1204
  yyerrstatus = 0;
1205
  yynerrs = 0;
1206
  yychar = YYEMPTY;             /* Cause a token to be read.  */
1207
 
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.  */
1212
 
1213
  yyssp = yyss;
1214
  yyvsp = yyvs;
1215
 
1216
  goto yysetstate;
1217
 
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.
1224
     */
1225
  yyssp++;
1226
 
1227
 yysetstate:
1228
  *yyssp = yystate;
1229
 
1230
  if (yyss + yystacksize - 1 <= yyssp)
1231
    {
1232
      /* Get the current used size of the three stacks, in elements.  */
1233
      YYSIZE_T yysize = yyssp - yyss + 1;
1234
 
1235
#ifdef yyoverflow
1236
      {
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;
1242
 
1243
 
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),
1251
 
1252
                    &yystacksize);
1253
 
1254
        yyss = yyss1;
1255
        yyvs = yyvs1;
1256
      }
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;
1267
 
1268
      {
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);
1276
 
1277
#  undef YYSTACK_RELOCATE
1278
        if (yyss1 != yyssa)
1279
          YYSTACK_FREE (yyss1);
1280
      }
1281
# endif
1282
#endif /* no yyoverflow */
1283
 
1284
      yyssp = yyss + yysize - 1;
1285
      yyvsp = yyvs + yysize - 1;
1286
 
1287
 
1288
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1289
                  (unsigned long int) yystacksize));
1290
 
1291
      if (yyss + yystacksize - 1 <= yyssp)
1292
        YYABORT;
1293
    }
1294
 
1295
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1296
 
1297
  goto yybackup;
1298
 
1299
/*-----------.
1300
| yybackup.  |
1301
`-----------*/
1302
yybackup:
1303
 
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: */
1307
 
1308
  /* First try to decide what to do without reference to look-ahead token.  */
1309
 
1310
  yyn = yypact[yystate];
1311
  if (yyn == YYPACT_NINF)
1312
    goto yydefault;
1313
 
1314
  /* Not known => get a look-ahead token if don't already have one.  */
1315
 
1316
  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
1317
  if (yychar == YYEMPTY)
1318
    {
1319
      YYDPRINTF ((stderr, "Reading a token: "));
1320
      yychar = YYLEX;
1321
    }
1322
 
1323
  if (yychar <= YYEOF)
1324
    {
1325
      yychar = yytoken = YYEOF;
1326
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1327
    }
1328
  else
1329
    {
1330
      yytoken = YYTRANSLATE (yychar);
1331
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1332
    }
1333
 
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)
1341
    {
1342
      if (yyn == 0 || yyn == YYTABLE_NINF)
1343
        goto yyerrlab;
1344
      yyn = -yyn;
1345
      goto yyreduce;
1346
    }
1347
 
1348
  if (yyn == YYFINAL)
1349
    YYACCEPT;
1350
 
1351
  /* Shift the look-ahead token.  */
1352
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1353
 
1354
  /* Discard the token being shifted unless it is eof.  */
1355
  if (yychar != YYEOF)
1356
    yychar = YYEMPTY;
1357
 
1358
  *++yyvsp = yylval;
1359
 
1360
 
1361
  /* Count tokens shifted since error; after three, turn off error
1362
     status.  */
1363
  if (yyerrstatus)
1364
    yyerrstatus--;
1365
 
1366
  yystate = yyn;
1367
  goto yynewstate;
1368
 
1369
 
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;
1378
 
1379
 
1380
/*-----------------------------.
1381
| yyreduce -- Do a reduction.  |
1382
`-----------------------------*/
1383
yyreduce:
1384
  /* yyn is the number of a rule to reduce with.  */
1385
  yylen = yyr2[yyn];
1386
 
1387
  /* If YYLEN is nonzero, implement the default value of the action:
1388
     `$$ = $1'.
1389
 
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];
1396
 
1397
 
1398
  YY_REDUCE_PRINT (yyn);
1399
  switch (yyn)
1400
    {
1401
        case 5:
1402
#line 309 "itbl-parse.y"
1403
    {
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));
1407
          }
1408
    break;
1409
 
1410
  case 6:
1411
#line 315 "itbl-parse.y"
1412
    {
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));
1417
          }
1418
    break;
1419
 
1420
  case 7:
1421
#line 322 "itbl-parse.y"
1422
    {}
1423
    break;
1424
 
1425
  case 13:
1426
#line 335 "itbl-parse.y"
1427
    {
1428
            DBGL2 (("ftype\n"));
1429
            (yyval.num) = (yyvsp[0].num);
1430
          }
1431
    break;
1432
 
1433
  case 14:
1434
#line 340 "itbl-parse.y"
1435
    {
1436
            DBGL2 (("addr\n"));
1437
            (yyval.num) = ADDR;
1438
          }
1439
    break;
1440
 
1441
  case 15:
1442
#line 345 "itbl-parse.y"
1443
    {
1444
            DBGL2 (("immed\n"));
1445
            (yyval.num) = IMMED;
1446
          }
1447
    break;
1448
 
1449
  case 16:
1450
#line 353 "itbl-parse.y"
1451
    {
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));
1455
          }
1456
    break;
1457
 
1458
  case 17:
1459
#line 362 "itbl-parse.y"
1460
    {
1461
            (yyval.val) = (yyvsp[-2].num) | (yyvsp[0].val);
1462
          }
1463
    break;
1464
 
1465
  case 18:
1466
#line 366 "itbl-parse.y"
1467
    {
1468
            (yyval.val) = (yyvsp[-1].val);
1469
          }
1470
    break;
1471
 
1472
  case 19:
1473
#line 370 "itbl-parse.y"
1474
    {
1475
            (yyval.val) = (yyvsp[0].num);
1476
          }
1477
    break;
1478
 
1479
  case 20:
1480
#line 377 "itbl-parse.y"
1481
    {
1482
            DBGL2 (("flags=%d\n", (yyvsp[0].val)));
1483
            (yyval.val) = (yyvsp[0].val);
1484
          }
1485
    break;
1486
 
1487
  case 21:
1488
#line 382 "itbl-parse.y"
1489
    {
1490
            (yyval.val) = 0;
1491
          }
1492
    break;
1493
 
1494
  case 22:
1495
#line 389 "itbl-parse.y"
1496
    {
1497
            DBGL2 (("range %d %d\n", (yyvsp[-2].num), (yyvsp[0].num)));
1498
            sbit = (yyvsp[-2].num);
1499
            ebit = (yyvsp[0].num);
1500
          }
1501
    break;
1502
 
1503
  case 23:
1504
#line 395 "itbl-parse.y"
1505
    {
1506
            sbit = 31;
1507
            ebit = 0;
1508
          }
1509
    break;
1510
 
1511
  case 24:
1512
#line 403 "itbl-parse.y"
1513
    {
1514
            DBGL2 (("pnum=%d\n",(yyvsp[0].num)));
1515
            (yyval.num) = (yyvsp[0].num);
1516
          }
1517
    break;
1518
 
1519
  case 25:
1520
#line 411 "itbl-parse.y"
1521
    {
1522
            DBGL2 (("dreg\n"));
1523
            (yyval.num) = DREG;
1524
          }
1525
    break;
1526
 
1527
  case 26:
1528
#line 416 "itbl-parse.y"
1529
    {
1530
            DBGL2 (("creg\n"));
1531
            (yyval.num) = CREG;
1532
          }
1533
    break;
1534
 
1535
  case 27:
1536
#line 421 "itbl-parse.y"
1537
    {
1538
            DBGL2 (("greg\n"));
1539
            (yyval.num) = GREG;
1540
          }
1541
    break;
1542
 
1543
  case 28:
1544
#line 429 "itbl-parse.y"
1545
    {
1546
            DBGL2 (("name=%s\n",(yyvsp[0].str)));
1547
            (yyval.str) = (yyvsp[0].str);
1548
          }
1549
    break;
1550
 
1551
  case 29:
1552
#line 445 "itbl-parse.y"
1553
    {
1554
            DBGL2 (("val=x%x\n",(yyvsp[0].num)));
1555
            (yyval.val) = (yyvsp[0].num);
1556
          }
1557
    break;
1558
 
1559
 
1560
      default: break;
1561
    }
1562
 
1563
/* Line 1126 of yacc.c.  */
1564
#line 1565 "itbl-parse.c"
1565
 
1566
  yyvsp -= yylen;
1567
  yyssp -= yylen;
1568
 
1569
 
1570
  YY_STACK_PRINT (yyss, yyssp);
1571
 
1572
  *++yyvsp = yyval;
1573
 
1574
 
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.  */
1578
 
1579
  yyn = yyr1[yyn];
1580
 
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];
1586
 
1587
  goto yynewstate;
1588
 
1589
 
1590
/*------------------------------------.
1591
| yyerrlab -- here on detecting error |
1592
`------------------------------------*/
1593
yyerrlab:
1594
  /* If not already recovering from an error, report this error.  */
1595
  if (!yyerrstatus)
1596
    {
1597
      ++yynerrs;
1598
#if YYERROR_VERBOSE
1599
      yyn = yypact[yystate];
1600
 
1601
      if (YYPACT_NINF < yyn && yyn < YYLAST)
1602
        {
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;
1612
 
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;
1632
 
1633
          /* Start YYX at -YYN if negative to avoid negative indexes in
1634
             YYCHECK.  */
1635
          int yyxbegin = yyn < 0 ? -yyn : 0;
1636
 
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;
1641
 
1642
          yyarg[0] = yytname[yytype];
1643
          yyfmt = yystpcpy (yyformat, yyunexpected);
1644
 
1645
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1646
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1647
              {
1648
                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1649
                  {
1650
                    yycount = 1;
1651
                    yysize = yysize0;
1652
                    yyformat[sizeof yyunexpected - 1] = '\0';
1653
                    break;
1654
                  }
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;
1661
              }
1662
 
1663
          yyf = YY_(yyformat);
1664
          yysize1 = yysize + yystrlen (yyf);
1665
          yysize_overflow |= yysize1 < yysize;
1666
          yysize = yysize1;
1667
 
1668
          if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
1669
            yymsg = (char *) YYSTACK_ALLOC (yysize);
1670
          if (yymsg)
1671
            {
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))
1678
                {
1679
                  if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1680
                    {
1681
                      yyp += yytnamerr (yyp, yyarg[yyi++]);
1682
                      yyf += 2;
1683
                    }
1684
                  else
1685
                    {
1686
                      yyp++;
1687
                      yyf++;
1688
                    }
1689
                }
1690
              yyerror (yymsg);
1691
              YYSTACK_FREE (yymsg);
1692
            }
1693
          else
1694
            {
1695
              yyerror (YY_("syntax error"));
1696
              goto yyexhaustedlab;
1697
            }
1698
        }
1699
      else
1700
#endif /* YYERROR_VERBOSE */
1701
        yyerror (YY_("syntax error"));
1702
    }
1703
 
1704
 
1705
 
1706
  if (yyerrstatus == 3)
1707
    {
1708
      /* If just tried and failed to reuse look-ahead token after an
1709
         error, discard it.  */
1710
 
1711
      if (yychar <= YYEOF)
1712
        {
1713
          /* Return failure if at end of input.  */
1714
          if (yychar == YYEOF)
1715
            YYABORT;
1716
        }
1717
      else
1718
        {
1719
          yydestruct ("Error: discarding", yytoken, &yylval);
1720
          yychar = YYEMPTY;
1721
        }
1722
    }
1723
 
1724
  /* Else will try to reuse look-ahead token after shifting the error
1725
     token.  */
1726
  goto yyerrlab1;
1727
 
1728
 
1729
/*---------------------------------------------------.
1730
| yyerrorlab -- error raised explicitly by YYERROR.  |
1731
`---------------------------------------------------*/
1732
yyerrorlab:
1733
 
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;
1739
 
1740
yyvsp -= yylen;
1741
  yyssp -= yylen;
1742
  yystate = *yyssp;
1743
  goto yyerrlab1;
1744
 
1745
 
1746
/*-------------------------------------------------------------.
1747
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1748
`-------------------------------------------------------------*/
1749
yyerrlab1:
1750
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1751
 
1752
  for (;;)
1753
    {
1754
      yyn = yypact[yystate];
1755
      if (yyn != YYPACT_NINF)
1756
        {
1757
          yyn += YYTERROR;
1758
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1759
            {
1760
              yyn = yytable[yyn];
1761
              if (0 < yyn)
1762
                break;
1763
            }
1764
        }
1765
 
1766
      /* Pop the current state because it cannot handle the error token.  */
1767
      if (yyssp == yyss)
1768
        YYABORT;
1769
 
1770
 
1771
      yydestruct ("Error: popping", yystos[yystate], yyvsp);
1772
      YYPOPSTACK;
1773
      yystate = *yyssp;
1774
      YY_STACK_PRINT (yyss, yyssp);
1775
    }
1776
 
1777
  if (yyn == YYFINAL)
1778
    YYACCEPT;
1779
 
1780
  *++yyvsp = yylval;
1781
 
1782
 
1783
  /* Shift the error token. */
1784
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1785
 
1786
  yystate = yyn;
1787
  goto yynewstate;
1788
 
1789
 
1790
/*-------------------------------------.
1791
| yyacceptlab -- YYACCEPT comes here.  |
1792
`-------------------------------------*/
1793
yyacceptlab:
1794
  yyresult = 0;
1795
  goto yyreturn;
1796
 
1797
/*-----------------------------------.
1798
| yyabortlab -- YYABORT comes here.  |
1799
`-----------------------------------*/
1800
yyabortlab:
1801
  yyresult = 1;
1802
  goto yyreturn;
1803
 
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
1813
 
1814
yyreturn:
1815
  if (yychar != YYEOF && yychar != YYEMPTY)
1816
     yydestruct ("Cleanup: discarding lookahead",
1817
                 yytoken, &yylval);
1818
  while (yyssp != yyss)
1819
    {
1820
      yydestruct ("Cleanup: popping",
1821
                  yystos[*yyssp], yyvsp);
1822
      YYPOPSTACK;
1823
    }
1824
#ifndef yyoverflow
1825
  if (yyss != yyssa)
1826
    YYSTACK_FREE (yyss);
1827
#endif
1828
  return yyresult;
1829
}
1830
 
1831
 
1832
#line 450 "itbl-parse.y"
1833
 
1834
 
1835
static int
1836
yyerror (msg)
1837
     const char *msg;
1838
{
1839
  printf ("line %d: %s\n", insntbl_line, msg);
1840
  return 0;
1841
}
1842
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.