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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [gas/] [itbl-parse.c] - Blame information for rev 308

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

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

powered by: WebSVN 2.1.0

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