blob: d510a9d2d9d5c6cad22f17c7a7829fe4c64fd647 [file] [log] [blame]
Chris Lattner2b931e82005-09-12 05:30:06 +00001/* A Bison parser, made by GNU Bison 1.875. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Chris Lattner2b931e82005-09-12 05:30:06 +00003/* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005
Chris Lattner2b931e82005-09-12 05:30:06 +00006 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.
Reid Spencer68a24bd2005-08-27 18:50:39 +000010
Chris Lattner2b931e82005-09-12 05:30:06 +000011 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/* If NAME_PREFIX is specified substitute the variables and functions
49 names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000050#define yyparse Fileparse
Chris Lattner2b931e82005-09-12 05:30:06 +000051#define yylex Filelex
Reid Spencer68a24bd2005-08-27 18:50:39 +000052#define yyerror Fileerror
Chris Lattner2b931e82005-09-12 05:30:06 +000053#define yylval Filelval
54#define yychar Filechar
Reid Spencer68a24bd2005-08-27 18:50:39 +000055#define yydebug Filedebug
56#define yynerrs Filenerrs
57
Chris Lattner2b931e82005-09-12 05:30:06 +000058
59/* Tokens. */
60#ifndef YYTOKENTYPE
61# define YYTOKENTYPE
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
63 know about them. */
64 enum yytokentype {
65 INT = 258,
66 BIT = 259,
67 STRING = 260,
68 BITS = 261,
69 LIST = 262,
70 CODE = 263,
71 DAG = 264,
72 CLASS = 265,
73 DEF = 266,
74 FIELD = 267,
75 LET = 268,
76 IN = 269,
77 SHLTOK = 270,
78 SRATOK = 271,
79 SRLTOK = 272,
80 INTVAL = 273,
81 ID = 274,
82 VARNAME = 275,
83 STRVAL = 276,
84 CODEFRAGMENT = 277
85 };
86#endif
87#define INT 258
88#define BIT 259
89#define STRING 260
90#define BITS 261
91#define LIST 262
92#define CODE 263
93#define DAG 264
94#define CLASS 265
95#define DEF 266
96#define FIELD 267
97#define LET 268
98#define IN 269
99#define SHLTOK 270
100#define SRATOK 271
101#define SRLTOK 272
102#define INTVAL 273
103#define ID 274
104#define VARNAME 275
105#define STRVAL 276
106#define CODEFRAGMENT 277
107
108
109
110
111/* Copy the first part of user declarations. */
112#line 14 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000113
114#include "Record.h"
115#include "llvm/ADT/StringExtras.h"
116#include <algorithm>
117#include <cstdio>
118#define YYERROR_VERBOSE 1
119
120int yyerror(const char *ErrorMsg);
121int yylex();
122
123namespace llvm {
124
125extern int Filelineno;
126static Record *CurRec = 0;
127static bool ParsingTemplateArgs = false;
128
129typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
130
131struct LetRecord {
132 std::string Name;
133 std::vector<unsigned> Bits;
134 Init *Value;
135 bool HasBits;
136 LetRecord(const std::string &N, std::vector<unsigned> *B, Init *V)
137 : Name(N), Value(V), HasBits(B != 0) {
138 if (HasBits) Bits = *B;
139 }
140};
141
142static std::vector<std::vector<LetRecord> > LetStack;
143
144
145extern std::ostream &err();
146
147static void addValue(const RecordVal &RV) {
148 if (RecordVal *ERV = CurRec->getValue(RV.getName())) {
149 // The value already exists in the class, treat this as a set...
150 if (ERV->setValue(RV.getValue())) {
151 err() << "New definition of '" << RV.getName() << "' of type '"
152 << *RV.getType() << "' is incompatible with previous "
153 << "definition of type '" << *ERV->getType() << "'!\n";
154 exit(1);
155 }
156 } else {
157 CurRec->addValue(RV);
158 }
159}
160
161static void addSuperClass(Record *SC) {
162 if (CurRec->isSubClassOf(SC)) {
163 err() << "Already subclass of '" << SC->getName() << "'!\n";
164 exit(1);
165 }
166 CurRec->addSuperClass(SC);
167}
168
169static void setValue(const std::string &ValName,
170 std::vector<unsigned> *BitList, Init *V) {
171 if (!V) return;
172
173 RecordVal *RV = CurRec->getValue(ValName);
174 if (RV == 0) {
175 err() << "Value '" << ValName << "' unknown!\n";
176 exit(1);
177 }
178
179 // Do not allow assignments like 'X = X'. This will just cause infinite loops
180 // in the resolution machinery.
181 if (!BitList)
182 if (VarInit *VI = dynamic_cast<VarInit*>(V))
183 if (VI->getName() == ValName)
184 return;
185
186 // If we are assigning to a subset of the bits in the value... then we must be
187 // assigning to a field of BitsRecTy, which must have a BitsInit
188 // initializer...
189 //
190 if (BitList) {
191 BitsInit *CurVal = dynamic_cast<BitsInit*>(RV->getValue());
192 if (CurVal == 0) {
193 err() << "Value '" << ValName << "' is not a bits type!\n";
194 exit(1);
195 }
196
197 // Convert the incoming value to a bits type of the appropriate size...
198 Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size()));
199 if (BI == 0) {
200 V->convertInitializerTo(new BitsRecTy(BitList->size()));
201 err() << "Initializer '" << *V << "' not compatible with bit range!\n";
202 exit(1);
203 }
204
205 // We should have a BitsInit type now...
206 assert(dynamic_cast<BitsInit*>(BI) != 0 || &(std::cerr << *BI) == 0);
207 BitsInit *BInit = (BitsInit*)BI;
208
209 BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
210
211 // Loop over bits, assigning values as appropriate...
212 for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
213 unsigned Bit = (*BitList)[i];
214 if (NewVal->getBit(Bit)) {
215 err() << "Cannot set bit #" << Bit << " of value '" << ValName
216 << "' more than once!\n";
217 exit(1);
218 }
219 NewVal->setBit(Bit, BInit->getBit(i));
220 }
221
222 for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
223 if (NewVal->getBit(i) == 0)
224 NewVal->setBit(i, CurVal->getBit(i));
225
226 V = NewVal;
227 }
228
229 if (RV->setValue(V)) {
230 err() << "Value '" << ValName << "' of type '" << *RV->getType()
231 << "' is incompatible with initializer '" << *V << "'!\n";
232 exit(1);
233 }
234}
235
236// addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's
237// template arguments.
238static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
239 // Add all of the values in the subclass into the current class...
240 const std::vector<RecordVal> &Vals = SC->getValues();
241 for (unsigned i = 0, e = Vals.size(); i != e; ++i)
242 addValue(Vals[i]);
243
244 const std::vector<std::string> &TArgs = SC->getTemplateArgs();
245
246 // Ensure that an appropriate number of template arguments are specified...
247 if (TArgs.size() < TemplateArgs.size()) {
248 err() << "ERROR: More template args specified than expected!\n";
249 exit(1);
250 } else { // This class expects template arguments...
251 // Loop over all of the template arguments, setting them to the specified
252 // value or leaving them as the default if necessary.
253 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
254 if (i < TemplateArgs.size()) { // A value is specified for this temp-arg?
Chris Lattnerba4b1442005-09-08 18:22:57 +0000255 // Set it now.
256 setValue(TArgs[i], 0, TemplateArgs[i]);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000257
258 // Resolve it next.
259 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
260
261
262 // Now remove it.
263 CurRec->removeValue(TArgs[i]);
264
265 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000266 err() << "ERROR: Value not specified for template argument #"
267 << i << " (" << TArgs[i] << ") of subclass '" << SC->getName()
268 << "'!\n";
269 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000270 }
271 }
272 }
273
274 // Since everything went well, we can now set the "superclass" list for the
275 // current record.
276 const std::vector<Record*> &SCs = SC->getSuperClasses();
277 for (unsigned i = 0, e = SCs.size(); i != e; ++i)
278 addSuperClass(SCs[i]);
279 addSuperClass(SC);
280}
281
282} // End llvm namespace
283
284using namespace llvm;
285
286
Chris Lattner2b931e82005-09-12 05:30:06 +0000287
288/* Enabling traces. */
289#ifndef YYDEBUG
290# define YYDEBUG 0
291#endif
292
293/* Enabling verbose error messages. */
294#ifdef YYERROR_VERBOSE
295# undef YYERROR_VERBOSE
296# define YYERROR_VERBOSE 1
297#else
298# define YYERROR_VERBOSE 0
299#endif
300
301#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
302#line 189 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
303typedef union YYSTYPE {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000304 std::string* StrVal;
305 int IntVal;
306 llvm::RecTy* Ty;
307 llvm::Init* Initializer;
308 std::vector<llvm::Init*>* FieldList;
309 std::vector<unsigned>* BitList;
310 llvm::Record* Rec;
311 SubClassRefTy* SubClassRef;
312 std::vector<SubClassRefTy>* SubClassList;
313 std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
314} YYSTYPE;
Chris Lattner2b931e82005-09-12 05:30:06 +0000315/* Line 191 of yacc.c. */
316#line 316 "FileParser.tab.c"
317# define yystype YYSTYPE /* obsolescent; will be withdrawn */
318# define YYSTYPE_IS_DECLARED 1
319# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +0000320#endif
321
322
323
Chris Lattner2b931e82005-09-12 05:30:06 +0000324/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000325
326
Chris Lattner2b931e82005-09-12 05:30:06 +0000327/* Line 214 of yacc.c. */
328#line 328 "FileParser.tab.c"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000329
Chris Lattner2b931e82005-09-12 05:30:06 +0000330#if ! defined (yyoverflow) || YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +0000331
Chris Lattner2b931e82005-09-12 05:30:06 +0000332/* The parser invokes alloca or malloc; define the necessary symbols. */
333
334# if YYSTACK_USE_ALLOCA
335# define YYSTACK_ALLOC alloca
336# else
337# ifndef YYSTACK_USE_ALLOCA
338# if defined (alloca) || defined (_ALLOCA_H)
339# define YYSTACK_ALLOC alloca
340# else
341# ifdef __GNUC__
342# define YYSTACK_ALLOC __builtin_alloca
343# endif
344# endif
345# endif
346# endif
347
348# ifdef YYSTACK_ALLOC
349 /* Pacify GCC's `empty if-body' warning. */
350# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
351# else
352# if defined (__STDC__) || defined (__cplusplus)
353# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
354# define YYSIZE_T size_t
355# endif
356# define YYSTACK_ALLOC malloc
357# define YYSTACK_FREE free
358# endif
359#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
360
361
362#if (! defined (yyoverflow) \
363 && (! defined (__cplusplus) \
364 || (YYSTYPE_IS_TRIVIAL)))
365
366/* A type that is properly aligned for any stack member. */
367union yyalloc
368{
369 short yyss;
370 YYSTYPE yyvs;
371 };
372
373/* The size of the maximum gap between one aligned stack and the next. */
374# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
375
376/* The size of an array large to enough to hold all stacks, each with
377 N elements. */
378# define YYSTACK_BYTES(N) \
379 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
380 + YYSTACK_GAP_MAXIMUM)
381
382/* Copy COUNT objects from FROM to TO. The source and destination do
383 not overlap. */
384# ifndef YYCOPY
385# if 1 < __GNUC__
386# define YYCOPY(To, From, Count) \
387 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
388# else
389# define YYCOPY(To, From, Count) \
390 do \
391 { \
392 register YYSIZE_T yyi; \
393 for (yyi = 0; yyi < (Count); yyi++) \
394 (To)[yyi] = (From)[yyi]; \
395 } \
396 while (0)
397# endif
398# endif
399
400/* Relocate STACK from its old location to the new one. The
401 local variables YYSIZE and YYSTACKSIZE give the old and new number of
402 elements in the stack, and YYPTR gives the new location of the
403 stack. Advance YYPTR to a properly aligned location for the next
404 stack. */
405# define YYSTACK_RELOCATE(Stack) \
406 do \
407 { \
408 YYSIZE_T yynewbytes; \
409 YYCOPY (&yyptr->Stack, Stack, yysize); \
410 Stack = &yyptr->Stack; \
411 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
412 yyptr += yynewbytes / sizeof (*yyptr); \
413 } \
414 while (0)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000415
416#endif
417
Chris Lattner2b931e82005-09-12 05:30:06 +0000418#if defined (__STDC__) || defined (__cplusplus)
419 typedef signed char yysigned_char;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000420#else
Chris Lattner2b931e82005-09-12 05:30:06 +0000421 typedef short yysigned_char;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000422#endif
423
Chris Lattner2b931e82005-09-12 05:30:06 +0000424/* YYFINAL -- State number of the termination state. */
425#define YYFINAL 18
426/* YYLAST -- Last index in YYTABLE. */
427#define YYLAST 153
428
429/* YYNTOKENS -- Number of terminals. */
430#define YYNTOKENS 38
431/* YYNNTS -- Number of nonterminals. */
432#define YYNNTS 37
433/* YYNRULES -- Number of rules. */
434#define YYNRULES 85
435/* YYNRULES -- Number of states. */
436#define YYNSTATES 155
437
438/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
439#define YYUNDEFTOK 2
440#define YYMAXUTOK 277
441
442#define YYTRANSLATE(YYX) \
443 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
444
445/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
446static const unsigned char yytranslate[] =
447{
448 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 32, 33, 2, 2, 34, 36, 31, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 35, 37,
454 23, 25, 24, 26, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 29, 2, 30, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 27, 2, 28, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
474 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
475 15, 16, 17, 18, 19, 20, 21, 22
476};
477
478#if YYDEBUG
479/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
480 YYRHS. */
481static const unsigned short yyprhs[] =
482{
483 0, 0, 3, 5, 7, 9, 14, 16, 21, 23,
484 25, 27, 28, 30, 31, 34, 36, 38, 40, 42,
485 46, 51, 53, 58, 62, 66, 71, 76, 83, 90,
486 97, 98, 101, 104, 109, 110, 112, 114, 118, 121,
487 125, 131, 136, 138, 139, 143, 144, 146, 148, 152,
488 157, 160, 167, 168, 171, 173, 177, 179, 184, 186,
489 190, 191, 194, 196, 200, 204, 205, 207, 209, 210,
490 211, 212, 219, 222, 225, 227, 229, 234, 236, 240,
491 241, 246, 251, 254, 256, 259
492};
493
494/* YYRHS -- A `-1'-separated list of the rules' RHS. */
495static const yysigned_char yyrhs[] =
496{
497 74, 0, -1, 19, -1, 5, -1, 4, -1, 6,
498 23, 18, 24, -1, 3, -1, 7, 23, 40, 24,
499 -1, 8, -1, 9, -1, 39, -1, -1, 12, -1,
500 -1, 25, 43, -1, 18, -1, 21, -1, 22, -1,
501 26, -1, 27, 50, 28, -1, 19, 23, 51, 24,
502 -1, 19, -1, 43, 27, 48, 28, -1, 29, 50,
503 30, -1, 43, 31, 19, -1, 32, 19, 46, 33,
504 -1, 43, 29, 48, 30, -1, 15, 32, 43, 34,
505 43, 33, -1, 16, 32, 43, 34, 43, 33, -1,
506 17, 32, 43, 34, 43, 33, -1, -1, 35, 20,
507 -1, 43, 44, -1, 45, 34, 43, 44, -1, -1,
508 45, -1, 18, -1, 18, 36, 18, -1, 18, 18,
509 -1, 47, 34, 18, -1, 47, 34, 18, 36, 18,
510 -1, 47, 34, 18, 18, -1, 47, -1, -1, 27,
511 48, 28, -1, -1, 51, -1, 43, -1, 51, 34,
512 43, -1, 41, 40, 19, 42, -1, 52, 37, -1,
513 13, 19, 49, 25, 43, 37, -1, -1, 54, 53,
514 -1, 37, -1, 27, 54, 28, -1, 39, -1, 39,
515 23, 51, 24, -1, 56, -1, 57, 34, 56, -1,
516 -1, 35, 57, -1, 52, -1, 59, 34, 52, -1,
517 23, 59, 24, -1, -1, 60, -1, 19, -1, -1,
518 -1, -1, 62, 64, 61, 58, 65, 55, -1, 10,
519 63, -1, 11, 63, -1, 66, -1, 67, -1, 19,
520 49, 25, 43, -1, 69, -1, 70, 34, 69, -1,
521 -1, 13, 72, 70, 14, -1, 71, 27, 73, 28,
522 -1, 71, 68, -1, 68, -1, 73, 68, -1, 73,
523 -1
524};
525
526/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
527static const unsigned short yyrline[] =
528{
529 0, 223, 223, 234, 236, 238, 240, 242, 244, 246,
530 248, 252, 252, 254, 254, 256, 258, 261, 264, 266,
531 279, 307, 322, 329, 332, 339, 347, 355, 361, 367,
532 375, 378, 382, 387, 393, 396, 399, 402, 415, 429,
533 431, 444, 460, 462, 462, 466, 468, 472, 475, 479,
534 489, 491, 497, 497, 498, 498, 500, 502, 506, 511,
535 516, 519, 523, 526, 531, 532, 532, 534, 534, 536,
536 543, 536, 563, 571, 589, 589, 591, 596, 596, 599,
537 599, 602, 605, 609, 609, 611
538};
539#endif
540
541#if YYDEBUG || YYERROR_VERBOSE
542/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
543 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
544static const char *const yytname[] =
545{
546 "$end", "error", "$undefined", "INT", "BIT", "STRING", "BITS", "LIST",
547 "CODE", "DAG", "CLASS", "DEF", "FIELD", "LET", "IN", "SHLTOK", "SRATOK",
548 "SRLTOK", "INTVAL", "ID", "VARNAME", "STRVAL", "CODEFRAGMENT", "'<'",
549 "'>'", "'='", "'?'", "'{'", "'}'", "'['", "']'", "'.'", "'('", "')'",
550 "','", "':'", "'-'", "';'", "$accept", "ClassID", "Type", "OptPrefix",
551 "OptValue", "Value", "OptVarName", "DagArgListNE", "DagArgList",
552 "RBitList", "BitList", "OptBitList", "ValueList", "ValueListNE",
553 "Declaration", "BodyItem", "BodyList", "Body", "SubClassRef",
554 "ClassListNE", "ClassList", "DeclListNE", "TemplateArgList",
555 "OptTemplateArgList", "OptID", "ObjectBody", "@1", "@2", "ClassInst",
556 "DefInst", "Object", "LETItem", "LETList", "LETCommand", "@3",
557 "ObjectList", "File", 0
558};
559#endif
560
561# ifdef YYPRINT
562/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
563 token YYLEX-NUM. */
564static const unsigned short yytoknum[] =
565{
566 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
567 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
568 275, 276, 277, 60, 62, 61, 63, 123, 125, 91,
569 93, 46, 40, 41, 44, 58, 45, 59
570};
571# endif
572
573/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
574static const unsigned char yyr1[] =
575{
576 0, 38, 39, 40, 40, 40, 40, 40, 40, 40,
577 40, 41, 41, 42, 42, 43, 43, 43, 43, 43,
578 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
579 44, 44, 45, 45, 46, 46, 47, 47, 47, 47,
580 47, 47, 48, 49, 49, 50, 50, 51, 51, 52,
581 53, 53, 54, 54, 55, 55, 56, 56, 57, 57,
582 58, 58, 59, 59, 60, 61, 61, 62, 62, 64,
583 65, 63, 66, 67, 68, 68, 69, 70, 70, 72,
584 71, 68, 68, 73, 73, 74
585};
586
587/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
588static const unsigned char yyr2[] =
589{
590 0, 2, 1, 1, 1, 4, 1, 4, 1, 1,
591 1, 0, 1, 0, 2, 1, 1, 1, 1, 3,
592 4, 1, 4, 3, 3, 4, 4, 6, 6, 6,
593 0, 2, 2, 4, 0, 1, 1, 3, 2, 3,
594 5, 4, 1, 0, 3, 0, 1, 1, 3, 4,
595 2, 6, 0, 2, 1, 3, 1, 4, 1, 3,
596 0, 2, 1, 3, 3, 0, 1, 1, 0, 0,
597 0, 6, 2, 2, 1, 1, 4, 1, 3, 0,
598 4, 4, 2, 1, 2, 1
599};
600
601/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
602 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
603 means the default is an error. */
604static const unsigned char yydefact[] =
605{
606 0, 68, 68, 79, 74, 75, 83, 0, 85, 0,
607 67, 69, 72, 73, 0, 0, 82, 84, 1, 65,
608 43, 77, 0, 0, 11, 66, 60, 0, 0, 80,
609 0, 81, 12, 0, 62, 0, 0, 70, 36, 42,
610 0, 0, 78, 6, 4, 3, 0, 0, 8, 9,
611 2, 10, 0, 64, 11, 56, 58, 61, 0, 38,
612 0, 0, 44, 0, 0, 0, 15, 21, 16, 17,
613 18, 45, 45, 0, 76, 0, 0, 13, 63, 0,
614 0, 52, 54, 71, 37, 39, 0, 0, 0, 0,
615 47, 0, 46, 0, 34, 0, 0, 0, 0, 0,
616 0, 49, 0, 59, 11, 41, 0, 0, 0, 0,
617 0, 19, 0, 23, 30, 35, 0, 0, 0, 24,
618 5, 7, 14, 57, 0, 55, 0, 53, 40, 0,
619 0, 0, 20, 48, 0, 32, 0, 25, 22, 26,
620 43, 50, 0, 0, 0, 31, 30, 0, 27, 28,
621 29, 33, 0, 0, 51
622};
623
624/* YYDEFGOTO[NTERM-NUM]. */
625static const short yydefgoto[] =
626{
627 -1, 51, 52, 33, 101, 90, 135, 115, 116, 39,
628 40, 28, 91, 92, 34, 127, 104, 83, 56, 57,
629 37, 35, 25, 26, 11, 12, 19, 58, 4, 5,
630 6, 21, 22, 7, 14, 8, 9
631};
632
633/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
634 STATE-NUM. */
635#define YYPACT_NINF -61
636static const yysigned_char yypact[] =
637{
638 45, -7, -7, -61, -61, -61, -61, 4, 45, 24,
639 -61, -61, -61, -61, 31, 45, -61, -61, -61, 29,
640 46, -61, -12, -5, 62, -61, 40, 63, 68, -61,
641 31, -61, -61, 57, -61, -14, 78, -61, -15, 67,
642 75, 11, -61, -61, -61, -61, 84, 96, -61, -61,
643 -61, -61, 90, -61, 62, 97, -61, 87, 12, -61,
644 104, 105, -61, 92, 93, 94, -61, 106, -61, -61,
645 -61, 11, 11, 108, 86, 110, 57, 107, -61, 11,
646 78, -61, -61, -61, -61, -11, 11, 11, 11, 11,
647 86, 102, 99, 101, 11, 63, 63, 115, 111, 112,
648 11, -61, 20, -61, 6, -61, 119, -18, 65, 71,
649 43, -61, 11, -61, 56, 109, 113, 114, 117, -61,
650 -61, -61, 86, -61, 120, -61, 103, -61, -61, 11,
651 11, 11, -61, 86, 118, -61, 11, -61, -61, -61,
652 46, -61, 53, 77, 85, -61, 56, 116, -61, -61,
653 -61, -61, 11, 41, -61
654};
655
656/* YYPGOTO[NTERM-NUM]. */
657static const short yypgoto[] =
658{
659 -61, -32, 69, -61, -61, -41, -2, -61, -61, -61,
660 -60, 8, 79, -10, -53, -61, -61, -61, 70, -61,
661 -61, -61, -61, -61, -61, 147, -61, -61, -61, -61,
662 34, 122, -61, -61, -61, 138, -61
663};
664
665/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
666 positive, shift that token. If negative, reduce the rule which
667 number is the opposite. If zero, do what YYDEFACT says.
668 If YYTABLE_NINF, syntax error. */
669#define YYTABLE_NINF -1
670static const unsigned char yytable[] =
671{
672 74, 78, 29, 59, 55, 1, 2, 105, 3, 95,
673 53, 96, 10, 97, 1, 2, 129, 3, 32, 124,
674 54, 60, 30, 31, 18, 106, 63, 64, 65, 66,
675 67, 15, 68, 69, 125, 117, 118, 70, 71, 81,
676 72, 16, 17, 73, 123, 107, 108, 109, 55, 82,
677 20, 126, 24, 114, 112, 1, 2, 17, 3, 122,
678 43, 44, 45, 46, 47, 48, 49, 132, 95, 102,
679 96, 133, 97, 27, 32, 36, 50, 112, 154, 110,
680 95, 38, 96, 95, 97, 96, 148, 97, 142, 143,
681 144, 134, 95, 41, 96, 146, 97, 50, 95, 130,
682 96, 61, 97, 62, 95, 131, 96, 75, 97, 77,
683 149, 153, 95, 95, 96, 96, 97, 97, 150, 76,
684 79, 80, 84, 85, 86, 87, 88, 94, 98, 89,
685 111, 113, 100, 112, 119, 120, 121, 128, 145, 140,
686 141, 152, 138, 136, 151, 99, 137, 139, 147, 13,
687 103, 93, 42, 23
688};
689
690static const unsigned char yycheck[] =
691{
692 41, 54, 14, 18, 36, 10, 11, 18, 13, 27,
693 24, 29, 19, 31, 10, 11, 34, 13, 12, 13,
694 34, 36, 34, 28, 0, 36, 15, 16, 17, 18,
695 19, 27, 21, 22, 28, 95, 96, 26, 27, 27,
696 29, 7, 8, 32, 24, 86, 87, 88, 80, 37,
697 19, 104, 23, 94, 34, 10, 11, 23, 13, 100,
698 3, 4, 5, 6, 7, 8, 9, 24, 27, 79,
699 29, 112, 31, 27, 12, 35, 19, 34, 37, 89,
700 27, 18, 29, 27, 31, 29, 33, 31, 129, 130,
701 131, 35, 27, 25, 29, 136, 31, 19, 27, 34,
702 29, 34, 31, 28, 27, 34, 29, 23, 31, 19,
703 33, 152, 27, 27, 29, 29, 31, 31, 33, 23,
704 23, 34, 18, 18, 32, 32, 32, 19, 18, 23,
705 28, 30, 25, 34, 19, 24, 24, 18, 20, 19,
706 37, 25, 28, 34, 146, 76, 33, 30, 140, 2,
707 80, 72, 30, 15
708};
709
710/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
711 symbol of state STATE-NUM. */
712static const unsigned char yystos[] =
713{
714 0, 10, 11, 13, 66, 67, 68, 71, 73, 74,
715 19, 62, 63, 63, 72, 27, 68, 68, 0, 64,
716 19, 69, 70, 73, 23, 60, 61, 27, 49, 14,
717 34, 28, 12, 41, 52, 59, 35, 58, 18, 47,
718 48, 25, 69, 3, 4, 5, 6, 7, 8, 9,
719 19, 39, 40, 24, 34, 39, 56, 57, 65, 18,
720 36, 34, 28, 15, 16, 17, 18, 19, 21, 22,
721 26, 27, 29, 32, 43, 23, 23, 19, 52, 23,
722 34, 27, 37, 55, 18, 18, 32, 32, 32, 23,
723 43, 50, 51, 50, 19, 27, 29, 31, 18, 40,
724 25, 42, 51, 56, 54, 18, 36, 43, 43, 43,
725 51, 28, 34, 30, 43, 45, 46, 48, 48, 19,
726 24, 24, 43, 24, 13, 28, 52, 53, 18, 34,
727 34, 34, 24, 43, 35, 44, 34, 33, 28, 30,
728 19, 37, 43, 43, 43, 20, 43, 49, 33, 33,
729 33, 44, 25, 43, 37
730};
731
732#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
733# define YYSIZE_T __SIZE_TYPE__
734#endif
735#if ! defined (YYSIZE_T) && defined (size_t)
736# define YYSIZE_T size_t
737#endif
738#if ! defined (YYSIZE_T)
739# if defined (__STDC__) || defined (__cplusplus)
740# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
741# define YYSIZE_T size_t
742# endif
743#endif
744#if ! defined (YYSIZE_T)
745# define YYSIZE_T unsigned int
746#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000747
748#define yyerrok (yyerrstatus = 0)
749#define yyclearin (yychar = YYEMPTY)
Chris Lattner2b931e82005-09-12 05:30:06 +0000750#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000751#define YYEOF 0
Chris Lattner2b931e82005-09-12 05:30:06 +0000752
Reid Spencer68a24bd2005-08-27 18:50:39 +0000753#define YYACCEPT goto yyacceptlab
Chris Lattner2b931e82005-09-12 05:30:06 +0000754#define YYABORT goto yyabortlab
Chris Lattnerba4b1442005-09-08 18:22:57 +0000755#define YYERROR goto yyerrlab1
Chris Lattner2b931e82005-09-12 05:30:06 +0000756
757
758/* Like YYERROR except do call yyerror. This remains here temporarily
759 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000760 Once GCC version 2 has supplanted version 1, this can go. */
Chris Lattner2b931e82005-09-12 05:30:06 +0000761
Reid Spencer68a24bd2005-08-27 18:50:39 +0000762#define YYFAIL goto yyerrlab
Chris Lattner2b931e82005-09-12 05:30:06 +0000763
Reid Spencer68a24bd2005-08-27 18:50:39 +0000764#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner2b931e82005-09-12 05:30:06 +0000765
766#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000767do \
768 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner2b931e82005-09-12 05:30:06 +0000769 { \
770 yychar = (Token); \
771 yylval = (Value); \
772 yytoken = YYTRANSLATE (yychar); \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000773 YYPOPSTACK; \
774 goto yybackup; \
775 } \
776 else \
Chris Lattner2b931e82005-09-12 05:30:06 +0000777 { \
778 yyerror ("syntax error: cannot back up");\
779 YYERROR; \
780 } \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000781while (0)
782
783#define YYTERROR 1
784#define YYERRCODE 256
785
Chris Lattner2b931e82005-09-12 05:30:06 +0000786/* YYLLOC_DEFAULT -- Compute the default location (before the actions
787 are run). */
788
789#ifndef YYLLOC_DEFAULT
790# define YYLLOC_DEFAULT(Current, Rhs, N) \
791 Current.first_line = Rhs[1].first_line; \
792 Current.first_column = Rhs[1].first_column; \
793 Current.last_line = Rhs[N].last_line; \
794 Current.last_column = Rhs[N].last_column;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000795#endif
796
Chris Lattner2b931e82005-09-12 05:30:06 +0000797/* YYLEX -- calling `yylex' with the right arguments. */
798
Reid Spencer68a24bd2005-08-27 18:50:39 +0000799#ifdef YYLEX_PARAM
Chris Lattner2b931e82005-09-12 05:30:06 +0000800# define YYLEX yylex (YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000801#else
Chris Lattner2b931e82005-09-12 05:30:06 +0000802# define YYLEX yylex ()
Chris Lattnerba4b1442005-09-08 18:22:57 +0000803#endif
Chris Lattner2b931e82005-09-12 05:30:06 +0000804
805/* Enable debugging if requested. */
806#if YYDEBUG
807
808# ifndef YYFPRINTF
809# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
810# define YYFPRINTF fprintf
811# endif
812
813# define YYDPRINTF(Args) \
814do { \
815 if (yydebug) \
816 YYFPRINTF Args; \
817} while (0)
818
819# define YYDSYMPRINT(Args) \
820do { \
821 if (yydebug) \
822 yysymprint Args; \
823} while (0)
824
825# define YYDSYMPRINTF(Title, Token, Value, Location) \
826do { \
827 if (yydebug) \
828 { \
829 YYFPRINTF (stderr, "%s ", Title); \
830 yysymprint (stderr, \
831 Token, Value); \
832 YYFPRINTF (stderr, "\n"); \
833 } \
834} while (0)
835
836/*------------------------------------------------------------------.
837| yy_stack_print -- Print the state stack from its BOTTOM up to its |
838| TOP (cinluded). |
839`------------------------------------------------------------------*/
840
841#if defined (__STDC__) || defined (__cplusplus)
842static void
843yy_stack_print (short *bottom, short *top)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000844#else
Chris Lattner2b931e82005-09-12 05:30:06 +0000845static void
846yy_stack_print (bottom, top)
847 short *bottom;
848 short *top;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000849#endif
Chris Lattner2b931e82005-09-12 05:30:06 +0000850{
851 YYFPRINTF (stderr, "Stack now");
852 for (/* Nothing. */; bottom <= top; ++bottom)
853 YYFPRINTF (stderr, " %d", *bottom);
854 YYFPRINTF (stderr, "\n");
855}
856
857# define YY_STACK_PRINT(Bottom, Top) \
858do { \
859 if (yydebug) \
860 yy_stack_print ((Bottom), (Top)); \
861} while (0)
862
863
864/*------------------------------------------------.
865| Report that the YYRULE is going to be reduced. |
866`------------------------------------------------*/
867
868#if defined (__STDC__) || defined (__cplusplus)
869static void
870yy_reduce_print (int yyrule)
871#else
872static void
873yy_reduce_print (yyrule)
874 int yyrule;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000875#endif
Chris Lattner2b931e82005-09-12 05:30:06 +0000876{
877 int yyi;
878 unsigned int yylineno = yyrline[yyrule];
879 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
880 yyrule - 1, yylineno);
881 /* Print the symbols being reduced, and their result. */
882 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
883 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
884 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
885}
Reid Spencer68a24bd2005-08-27 18:50:39 +0000886
Chris Lattner2b931e82005-09-12 05:30:06 +0000887# define YY_REDUCE_PRINT(Rule) \
888do { \
889 if (yydebug) \
890 yy_reduce_print (Rule); \
891} while (0)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000892
Chris Lattner2b931e82005-09-12 05:30:06 +0000893/* Nonzero means print parse trace. It is left uninitialized so that
894 multiple parsers can coexist. */
895int yydebug;
896#else /* !YYDEBUG */
897# define YYDPRINTF(Args)
898# define YYDSYMPRINT(Args)
899# define YYDSYMPRINTF(Title, Token, Value, Location)
900# define YY_STACK_PRINT(Bottom, Top)
901# define YY_REDUCE_PRINT(Rule)
902#endif /* !YYDEBUG */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000903
Reid Spencer68a24bd2005-08-27 18:50:39 +0000904
Chris Lattner2b931e82005-09-12 05:30:06 +0000905/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000906#ifndef YYINITDEPTH
Chris Lattner2b931e82005-09-12 05:30:06 +0000907# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +0000908#endif
909
Chris Lattner2b931e82005-09-12 05:30:06 +0000910/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
911 if the built-in stack extension method is used).
912
913 Do not make this value too large; the results are undefined if
914 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
915 evaluated with infinite-precision integer arithmetic. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000916
Chris Lattnerba4b1442005-09-08 18:22:57 +0000917#if YYMAXDEPTH == 0
Chris Lattner2b931e82005-09-12 05:30:06 +0000918# undef YYMAXDEPTH
Reid Spencer68a24bd2005-08-27 18:50:39 +0000919#endif
920
921#ifndef YYMAXDEPTH
Chris Lattner2b931e82005-09-12 05:30:06 +0000922# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +0000923#endif
Chris Lattner2b931e82005-09-12 05:30:06 +0000924
Reid Spencer68a24bd2005-08-27 18:50:39 +0000925
926
Chris Lattner2b931e82005-09-12 05:30:06 +0000927#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +0000928
Chris Lattner2b931e82005-09-12 05:30:06 +0000929# ifndef yystrlen
930# if defined (__GLIBC__) && defined (_STRING_H)
931# define yystrlen strlen
932# else
933/* Return the length of YYSTR. */
934static YYSIZE_T
935# if defined (__STDC__) || defined (__cplusplus)
936yystrlen (const char *yystr)
937# else
938yystrlen (yystr)
939 const char *yystr;
940# endif
Chris Lattnerba4b1442005-09-08 18:22:57 +0000941{
Chris Lattner2b931e82005-09-12 05:30:06 +0000942 register const char *yys = yystr;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000943
Chris Lattner2b931e82005-09-12 05:30:06 +0000944 while (*yys++ != '\0')
945 continue;
946
947 return yys - yystr - 1;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000948}
Chris Lattner2b931e82005-09-12 05:30:06 +0000949# endif
950# endif
Chris Lattnerba4b1442005-09-08 18:22:57 +0000951
Chris Lattner2b931e82005-09-12 05:30:06 +0000952# ifndef yystpcpy
953# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
954# define yystpcpy stpcpy
955# else
956/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
957 YYDEST. */
958static char *
959# if defined (__STDC__) || defined (__cplusplus)
960yystpcpy (char *yydest, const char *yysrc)
961# else
962yystpcpy (yydest, yysrc)
963 char *yydest;
964 const char *yysrc;
965# endif
Chris Lattnerba4b1442005-09-08 18:22:57 +0000966{
Chris Lattner2b931e82005-09-12 05:30:06 +0000967 register char *yyd = yydest;
968 register const char *yys = yysrc;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000969
Chris Lattner2b931e82005-09-12 05:30:06 +0000970 while ((*yyd++ = *yys++) != '\0')
971 continue;
972
973 return yyd - 1;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000974}
Chris Lattner2b931e82005-09-12 05:30:06 +0000975# endif
976# endif
Chris Lattnerba4b1442005-09-08 18:22:57 +0000977
Chris Lattner2b931e82005-09-12 05:30:06 +0000978#endif /* !YYERROR_VERBOSE */
979
Reid Spencer68a24bd2005-08-27 18:50:39 +0000980
981
Chris Lattner2b931e82005-09-12 05:30:06 +0000982#if YYDEBUG
983/*--------------------------------.
984| Print this symbol on YYOUTPUT. |
985`--------------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +0000986
Chris Lattner2b931e82005-09-12 05:30:06 +0000987#if defined (__STDC__) || defined (__cplusplus)
988static void
989yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000990#else
Chris Lattner2b931e82005-09-12 05:30:06 +0000991static void
992yysymprint (yyoutput, yytype, yyvaluep)
993 FILE *yyoutput;
994 int yytype;
995 YYSTYPE *yyvaluep;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000996#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000997{
Chris Lattner2b931e82005-09-12 05:30:06 +0000998 /* Pacify ``unused variable'' warnings. */
999 (void) yyvaluep;
1000
1001 if (yytype < YYNTOKENS)
1002 {
1003 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1004# ifdef YYPRINT
1005 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1006# endif
1007 }
1008 else
1009 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1010
1011 switch (yytype)
1012 {
1013 default:
1014 break;
1015 }
1016 YYFPRINTF (yyoutput, ")");
1017}
1018
1019#endif /* ! YYDEBUG */
1020/*-----------------------------------------------.
1021| Release the memory associated to this symbol. |
1022`-----------------------------------------------*/
1023
1024#if defined (__STDC__) || defined (__cplusplus)
1025static void
1026yydestruct (int yytype, YYSTYPE *yyvaluep)
1027#else
1028static void
1029yydestruct (yytype, yyvaluep)
1030 int yytype;
1031 YYSTYPE *yyvaluep;
1032#endif
1033{
1034 /* Pacify ``unused variable'' warnings. */
1035 (void) yyvaluep;
1036
1037 switch (yytype)
1038 {
1039
1040 default:
1041 break;
1042 }
1043}
1044
1045
1046/* Prevent warnings from -Wmissing-prototypes. */
1047
1048#ifdef YYPARSE_PARAM
1049# if defined (__STDC__) || defined (__cplusplus)
1050int yyparse (void *YYPARSE_PARAM);
1051# else
1052int yyparse ();
1053# endif
1054#else /* ! YYPARSE_PARAM */
1055#if defined (__STDC__) || defined (__cplusplus)
1056int yyparse (void);
1057#else
1058int yyparse ();
1059#endif
1060#endif /* ! YYPARSE_PARAM */
1061
1062
1063
1064/* The lookahead symbol. */
1065int yychar;
1066
1067/* The semantic value of the lookahead symbol. */
1068YYSTYPE yylval;
1069
1070/* Number of syntax errors so far. */
1071int yynerrs;
1072
1073
1074
1075/*----------.
1076| yyparse. |
1077`----------*/
1078
1079#ifdef YYPARSE_PARAM
1080# if defined (__STDC__) || defined (__cplusplus)
1081int yyparse (void *YYPARSE_PARAM)
1082# else
1083int yyparse (YYPARSE_PARAM)
1084 void *YYPARSE_PARAM;
1085# endif
1086#else /* ! YYPARSE_PARAM */
1087#if defined (__STDC__) || defined (__cplusplus)
1088int
1089yyparse (void)
1090#else
1091int
1092yyparse ()
1093
1094#endif
1095#endif
1096{
1097
Reid Spencer68a24bd2005-08-27 18:50:39 +00001098 register int yystate;
1099 register int yyn;
Chris Lattner2b931e82005-09-12 05:30:06 +00001100 int yyresult;
1101 /* Number of tokens to shift before error messages enabled. */
1102 int yyerrstatus;
1103 /* Lookahead token as an internal (translated) token number. */
1104 int yytoken = 0;
1105
1106 /* Three stacks and their tools:
1107 `yyss': related to states,
1108 `yyvs': related to semantic values,
1109 `yyls': related to locations.
1110
1111 Refer to the stacks thru separate pointers, to allow yyoverflow
1112 to reallocate them elsewhere. */
1113
1114 /* The state stack. */
1115 short yyssa[YYINITDEPTH];
1116 short *yyss = yyssa;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001117 register short *yyssp;
Chris Lattner2b931e82005-09-12 05:30:06 +00001118
1119 /* The semantic value stack. */
1120 YYSTYPE yyvsa[YYINITDEPTH];
1121 YYSTYPE *yyvs = yyvsa;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001122 register YYSTYPE *yyvsp;
1123
1124
1125
1126#define YYPOPSTACK (yyvsp--, yyssp--)
1127
Chris Lattner2b931e82005-09-12 05:30:06 +00001128 YYSIZE_T yystacksize = YYINITDEPTH;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001129
Chris Lattner2b931e82005-09-12 05:30:06 +00001130 /* The variables used to return semantic value and location from the
1131 action routines. */
1132 YYSTYPE yyval;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001133
1134
Chris Lattner2b931e82005-09-12 05:30:06 +00001135 /* When reducing, the number of symbols on the RHS of the reduced
1136 rule. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001137 int yylen;
1138
Chris Lattner2b931e82005-09-12 05:30:06 +00001139 YYDPRINTF ((stderr, "Starting parse\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001140
1141 yystate = 0;
1142 yyerrstatus = 0;
1143 yynerrs = 0;
1144 yychar = YYEMPTY; /* Cause a token to be read. */
1145
1146 /* Initialize stack pointers.
1147 Waste one element of value and location stack
1148 so that they stay on the same level as the state stack.
1149 The wasted elements are never initialized. */
1150
Chris Lattner2b931e82005-09-12 05:30:06 +00001151 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001152 yyvsp = yyvs;
1153
Chris Lattner2b931e82005-09-12 05:30:06 +00001154 goto yysetstate;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001155
Chris Lattner2b931e82005-09-12 05:30:06 +00001156/*------------------------------------------------------------.
1157| yynewstate -- Push a new state, which is found in yystate. |
1158`------------------------------------------------------------*/
1159 yynewstate:
1160 /* In all cases, when you get here, the value and location stacks
1161 have just been pushed. so pushing a state here evens the stacks.
1162 */
1163 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001164
Chris Lattner2b931e82005-09-12 05:30:06 +00001165 yysetstate:
1166 *yyssp = yystate;
1167
1168 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001169 {
1170 /* Get the current used size of the three stacks, in elements. */
Chris Lattner2b931e82005-09-12 05:30:06 +00001171 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001172
1173#ifdef yyoverflow
Chris Lattner2b931e82005-09-12 05:30:06 +00001174 {
1175 /* Give user a chance to reallocate the stack. Use copies of
1176 these so that the &'s don't force the real ones into
1177 memory. */
1178 YYSTYPE *yyvs1 = yyvs;
1179 short *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001180
Chris Lattner2b931e82005-09-12 05:30:06 +00001181
1182 /* Each stack pointer address is followed by the size of the
1183 data in use in that stack, in bytes. This used to be a
1184 conditional around just the two extra args, but that might
1185 be undefined if yyoverflow is a macro. */
1186 yyoverflow ("parser stack overflow",
1187 &yyss1, yysize * sizeof (*yyssp),
1188 &yyvs1, yysize * sizeof (*yyvsp),
1189
1190 &yystacksize);
1191
1192 yyss = yyss1;
1193 yyvs = yyvs1;
1194 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001195#else /* no yyoverflow */
Chris Lattner2b931e82005-09-12 05:30:06 +00001196# ifndef YYSTACK_RELOCATE
1197 goto yyoverflowlab;
1198# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00001199 /* Extend the stack our own way. */
Chris Lattner2b931e82005-09-12 05:30:06 +00001200 if (YYMAXDEPTH <= yystacksize)
1201 goto yyoverflowlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001202 yystacksize *= 2;
Chris Lattner2b931e82005-09-12 05:30:06 +00001203 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001204 yystacksize = YYMAXDEPTH;
Chris Lattner2b931e82005-09-12 05:30:06 +00001205
1206 {
1207 short *yyss1 = yyss;
1208 union yyalloc *yyptr =
1209 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1210 if (! yyptr)
1211 goto yyoverflowlab;
1212 YYSTACK_RELOCATE (yyss);
1213 YYSTACK_RELOCATE (yyvs);
1214
1215# undef YYSTACK_RELOCATE
1216 if (yyss1 != yyssa)
1217 YYSTACK_FREE (yyss1);
1218 }
1219# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001220#endif /* no yyoverflow */
1221
Chris Lattner2b931e82005-09-12 05:30:06 +00001222 yyssp = yyss + yysize - 1;
1223 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001224
1225
Chris Lattner2b931e82005-09-12 05:30:06 +00001226 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1227 (unsigned long int) yystacksize));
1228
1229 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001230 YYABORT;
1231 }
1232
Chris Lattner2b931e82005-09-12 05:30:06 +00001233 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001234
1235 goto yybackup;
Chris Lattner2b931e82005-09-12 05:30:06 +00001236
1237/*-----------.
1238| yybackup. |
1239`-----------*/
1240yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +00001241
1242/* Do appropriate processing given the current state. */
1243/* Read a lookahead token if we need one and don't already have one. */
1244/* yyresume: */
1245
1246 /* First try to decide what to do without reference to lookahead token. */
1247
1248 yyn = yypact[yystate];
Chris Lattner2b931e82005-09-12 05:30:06 +00001249 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001250 goto yydefault;
1251
1252 /* Not known => get a lookahead token if don't already have one. */
1253
Chris Lattner2b931e82005-09-12 05:30:06 +00001254 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001255 if (yychar == YYEMPTY)
1256 {
Chris Lattner2b931e82005-09-12 05:30:06 +00001257 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001258 yychar = YYLEX;
1259 }
1260
Chris Lattner2b931e82005-09-12 05:30:06 +00001261 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001262 {
Chris Lattner2b931e82005-09-12 05:30:06 +00001263 yychar = yytoken = YYEOF;
1264 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001265 }
1266 else
1267 {
Chris Lattner2b931e82005-09-12 05:30:06 +00001268 yytoken = YYTRANSLATE (yychar);
1269 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001270 }
1271
Chris Lattner2b931e82005-09-12 05:30:06 +00001272 /* If the proper action on seeing token YYTOKEN is to reduce or to
1273 detect an error, take that action. */
1274 yyn += yytoken;
1275 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001276 goto yydefault;
1277 yyn = yytable[yyn];
Chris Lattner2b931e82005-09-12 05:30:06 +00001278 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001279 {
Chris Lattner2b931e82005-09-12 05:30:06 +00001280 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001281 goto yyerrlab;
1282 yyn = -yyn;
1283 goto yyreduce;
1284 }
1285
1286 if (yyn == YYFINAL)
1287 YYACCEPT;
1288
1289 /* Shift the lookahead token. */
Chris Lattner2b931e82005-09-12 05:30:06 +00001290 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001291
1292 /* Discard the token being shifted unless it is eof. */
1293 if (yychar != YYEOF)
1294 yychar = YYEMPTY;
1295
1296 *++yyvsp = yylval;
1297
Chris Lattner2b931e82005-09-12 05:30:06 +00001298
1299 /* Count tokens shifted since error; after three, turn off error
1300 status. */
1301 if (yyerrstatus)
1302 yyerrstatus--;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001303
1304 yystate = yyn;
1305 goto yynewstate;
1306
Chris Lattnerba4b1442005-09-08 18:22:57 +00001307
Chris Lattner2b931e82005-09-12 05:30:06 +00001308/*-----------------------------------------------------------.
1309| yydefault -- do the default action for the current state. |
1310`-----------------------------------------------------------*/
1311yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00001312 yyn = yydefact[yystate];
1313 if (yyn == 0)
1314 goto yyerrlab;
Chris Lattner2b931e82005-09-12 05:30:06 +00001315 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001316
Chris Lattner2b931e82005-09-12 05:30:06 +00001317
1318/*-----------------------------.
1319| yyreduce -- Do a reduction. |
1320`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00001321yyreduce:
Chris Lattner2b931e82005-09-12 05:30:06 +00001322 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001323 yylen = yyr2[yyn];
1324
Chris Lattner2b931e82005-09-12 05:30:06 +00001325 /* If YYLEN is nonzero, implement the default value of the action:
1326 `$$ = $1'.
1327
1328 Otherwise, the following line sets YYVAL to garbage.
1329 This behavior is undocumented and Bison
1330 users should not rely upon it. Assigning to YYVAL
1331 unconditionally makes the parser a bit smaller, and it avoids a
1332 GCC warning that YYVAL may be used uninitialized. */
1333 yyval = yyvsp[1-yylen];
1334
1335
1336 YY_REDUCE_PRINT (yyn);
1337 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001338 {
Chris Lattner2b931e82005-09-12 05:30:06 +00001339 case 2:
1340#line 223 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1341 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001342 yyval.Rec = Records.getClass(*yyvsp[0].StrVal);
1343 if (yyval.Rec == 0) {
1344 err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n";
1345 exit(1);
1346 }
1347 delete yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001348 ;}
1349 break;
1350
1351 case 3:
1352#line 234 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1353 { // string type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001354 yyval.Ty = new StringRecTy();
Chris Lattner2b931e82005-09-12 05:30:06 +00001355 ;}
1356 break;
1357
1358 case 4:
1359#line 236 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1360 { // bit type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001361 yyval.Ty = new BitRecTy();
Chris Lattner2b931e82005-09-12 05:30:06 +00001362 ;}
1363 break;
1364
1365 case 5:
1366#line 238 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1367 { // bits<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001368 yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal);
Chris Lattner2b931e82005-09-12 05:30:06 +00001369 ;}
1370 break;
1371
1372 case 6:
1373#line 240 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1374 { // int type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001375 yyval.Ty = new IntRecTy();
Chris Lattner2b931e82005-09-12 05:30:06 +00001376 ;}
1377 break;
1378
1379 case 7:
1380#line 242 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1381 { // list<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001382 yyval.Ty = new ListRecTy(yyvsp[-1].Ty);
Chris Lattner2b931e82005-09-12 05:30:06 +00001383 ;}
1384 break;
1385
1386 case 8:
1387#line 244 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1388 { // code type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001389 yyval.Ty = new CodeRecTy();
Chris Lattner2b931e82005-09-12 05:30:06 +00001390 ;}
1391 break;
1392
1393 case 9:
1394#line 246 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1395 { // dag type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001396 yyval.Ty = new DagRecTy();
Chris Lattner2b931e82005-09-12 05:30:06 +00001397 ;}
1398 break;
1399
1400 case 10:
1401#line 248 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1402 { // Record Type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001403 yyval.Ty = new RecordRecTy(yyvsp[0].Rec);
Chris Lattner2b931e82005-09-12 05:30:06 +00001404 ;}
1405 break;
1406
1407 case 11:
1408#line 252 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1409 { yyval.IntVal = 0; ;}
1410 break;
1411
1412 case 12:
1413#line 252 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1414 { yyval.IntVal = 1; ;}
1415 break;
1416
1417 case 13:
1418#line 254 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1419 { yyval.Initializer = 0; ;}
1420 break;
1421
1422 case 14:
1423#line 254 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1424 { yyval.Initializer = yyvsp[0].Initializer; ;}
1425 break;
1426
1427 case 15:
1428#line 256 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1429 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001430 yyval.Initializer = new IntInit(yyvsp[0].IntVal);
Chris Lattner2b931e82005-09-12 05:30:06 +00001431 ;}
1432 break;
1433
1434 case 16:
1435#line 258 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1436 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001437 yyval.Initializer = new StringInit(*yyvsp[0].StrVal);
1438 delete yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001439 ;}
1440 break;
1441
1442 case 17:
1443#line 261 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1444 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001445 yyval.Initializer = new CodeInit(*yyvsp[0].StrVal);
1446 delete yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001447 ;}
1448 break;
1449
1450 case 18:
1451#line 264 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1452 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001453 yyval.Initializer = new UnsetInit();
Chris Lattner2b931e82005-09-12 05:30:06 +00001454 ;}
1455 break;
1456
1457 case 19:
1458#line 266 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1459 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001460 BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size());
1461 for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) {
1462 struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy());
1463 if (Bit == 0) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001464 err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i]
1465 << ") is not convertable to a bit!\n";
1466 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001467 }
1468 Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit);
1469 }
1470 yyval.Initializer = Init;
1471 delete yyvsp[-1].FieldList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001472 ;}
1473 break;
1474
1475 case 20:
1476#line 279 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1477 {
Chris Lattnerca572be2005-09-08 18:48:47 +00001478 // This is a CLASS<initvalslist> expression. This is supposed to synthesize
1479 // a new anonymous definition, deriving from CLASS<initvalslist> with no
1480 // body.
1481 Record *Class = Records.getClass(*yyvsp[-3].StrVal);
1482 if (!Class) {
1483 err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n";
1484 exit(1);
1485 }
1486 delete yyvsp[-3].StrVal;
1487
1488 static unsigned AnonCounter = 0;
1489 Record *OldRec = CurRec; // Save CurRec.
1490
1491 // Create the new record, set it as CurRec temporarily.
1492 CurRec = new Record("anonymous.val."+utostr(AnonCounter++));
1493 addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec.
1494 delete yyvsp[-1].FieldList; // Free up the template args.
1495
Chris Lattner751eabf2005-09-08 19:47:28 +00001496 CurRec->resolveReferences();
Chris Lattnerca572be2005-09-08 18:48:47 +00001497
1498 Records.addDef(CurRec);
1499
1500 // The result of the expression is a reference to the new record.
1501 yyval.Initializer = new DefInit(CurRec);
1502
1503 // Restore the old CurRec
1504 CurRec = OldRec;
Chris Lattner2b931e82005-09-12 05:30:06 +00001505 ;}
1506 break;
1507
1508 case 21:
1509#line 307 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1510 {
1511 if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) {
1512 yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType());
1513 } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) {
1514 const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal);
1515 assert(RV && "Template arg doesn't exist??");
1516 yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType());
1517 } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) {
1518 yyval.Initializer = new DefInit(D);
1519 } else {
1520 err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n";
1521 exit(1);
1522 }
1523
1524 delete yyvsp[0].StrVal;
1525 ;}
1526 break;
1527
1528 case 22:
1529#line 322 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1530 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001531 yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList);
1532 if (yyval.Initializer == 0) {
1533 err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n";
1534 exit(1);
1535 }
1536 delete yyvsp[-1].BitList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001537 ;}
1538 break;
1539
1540 case 23:
1541#line 329 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1542 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001543 yyval.Initializer = new ListInit(*yyvsp[-1].FieldList);
1544 delete yyvsp[-1].FieldList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001545 ;}
1546 break;
1547
1548 case 24:
1549#line 332 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1550 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001551 if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) {
1552 err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n";
1553 exit(1);
1554 }
1555 yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal);
1556 delete yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001557 ;}
1558 break;
1559
1560 case 25:
1561#line 339 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1562 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001563 Record *D = Records.getDef(*yyvsp[-2].StrVal);
1564 if (D == 0) {
1565 err() << "Invalid def '" << *yyvsp[-2].StrVal << "'!\n";
1566 exit(1);
1567 }
1568 yyval.Initializer = new DagInit(D, *yyvsp[-1].DagValueList);
1569 delete yyvsp[-2].StrVal; delete yyvsp[-1].DagValueList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001570 ;}
1571 break;
1572
1573 case 26:
1574#line 347 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1575 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001576 std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end());
1577 yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList);
1578 if (yyval.Initializer == 0) {
1579 err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n";
1580 exit(1);
1581 }
1582 delete yyvsp[-1].BitList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001583 ;}
1584 break;
1585
1586 case 27:
1587#line 355 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1588 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001589 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SHL, yyvsp[-1].Initializer);
1590 if (yyval.Initializer == 0) {
1591 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1592 exit(1);
1593 }
Chris Lattner2b931e82005-09-12 05:30:06 +00001594 ;}
1595 break;
1596
1597 case 28:
1598#line 361 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1599 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001600 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRA, yyvsp[-1].Initializer);
1601 if (yyval.Initializer == 0) {
1602 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1603 exit(1);
1604 }
Chris Lattner2b931e82005-09-12 05:30:06 +00001605 ;}
1606 break;
1607
1608 case 29:
1609#line 367 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1610 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001611 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRL, yyvsp[-1].Initializer);
1612 if (yyval.Initializer == 0) {
1613 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1614 exit(1);
1615 }
Chris Lattner2b931e82005-09-12 05:30:06 +00001616 ;}
1617 break;
1618
1619 case 30:
1620#line 375 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1621 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001622 yyval.StrVal = new std::string();
Chris Lattner2b931e82005-09-12 05:30:06 +00001623 ;}
1624 break;
1625
1626 case 31:
1627#line 378 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1628 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001629 yyval.StrVal = yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001630 ;}
1631 break;
1632
1633 case 32:
1634#line 382 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1635 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001636 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
1637 yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1638 delete yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001639 ;}
1640 break;
1641
1642 case 33:
1643#line 387 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1644 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001645 yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1646 delete yyvsp[0].StrVal;
1647 yyval.DagValueList = yyvsp[-3].DagValueList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001648 ;}
1649 break;
1650
1651 case 34:
1652#line 393 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1653 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001654 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
Chris Lattner2b931e82005-09-12 05:30:06 +00001655 ;}
1656 break;
1657
1658 case 35:
1659#line 396 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1660 { yyval.DagValueList = yyvsp[0].DagValueList; ;}
1661 break;
1662
1663 case 36:
1664#line 399 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1665 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001666 yyval.BitList = new std::vector<unsigned>();
1667 yyval.BitList->push_back(yyvsp[0].IntVal);
Chris Lattner2b931e82005-09-12 05:30:06 +00001668 ;}
1669 break;
1670
1671 case 37:
1672#line 402 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1673 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001674 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1675 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1676 exit(1);
1677 }
1678 yyval.BitList = new std::vector<unsigned>();
1679 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1680 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1681 yyval.BitList->push_back(i);
1682 } else {
1683 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1684 yyval.BitList->push_back(i);
1685 }
Chris Lattner2b931e82005-09-12 05:30:06 +00001686 ;}
1687 break;
1688
1689 case 38:
1690#line 415 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1691 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001692 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1693 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1694 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1695 exit(1);
1696 }
1697 yyval.BitList = new std::vector<unsigned>();
1698 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1699 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1700 yyval.BitList->push_back(i);
1701 } else {
1702 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1703 yyval.BitList->push_back(i);
1704 }
Chris Lattner2b931e82005-09-12 05:30:06 +00001705 ;}
1706 break;
1707
1708 case 39:
1709#line 429 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1710 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001711 (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal);
Chris Lattner2b931e82005-09-12 05:30:06 +00001712 ;}
1713 break;
1714
1715 case 40:
1716#line 431 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1717 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001718 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1719 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1720 exit(1);
1721 }
1722 yyval.BitList = yyvsp[-4].BitList;
1723 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1724 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1725 yyval.BitList->push_back(i);
1726 } else {
1727 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1728 yyval.BitList->push_back(i);
1729 }
Chris Lattner2b931e82005-09-12 05:30:06 +00001730 ;}
1731 break;
1732
1733 case 41:
1734#line 444 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1735 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001736 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1737 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1738 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1739 exit(1);
1740 }
1741 yyval.BitList = yyvsp[-3].BitList;
1742 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1743 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1744 yyval.BitList->push_back(i);
1745 } else {
1746 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1747 yyval.BitList->push_back(i);
1748 }
Chris Lattner2b931e82005-09-12 05:30:06 +00001749 ;}
1750 break;
1751
1752 case 42:
1753#line 460 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1754 { yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;}
1755 break;
1756
1757 case 43:
1758#line 462 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1759 { yyval.BitList = 0; ;}
1760 break;
1761
1762 case 44:
1763#line 462 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1764 { yyval.BitList = yyvsp[-1].BitList; ;}
1765 break;
1766
1767 case 45:
1768#line 466 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1769 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001770 yyval.FieldList = new std::vector<Init*>();
Chris Lattner2b931e82005-09-12 05:30:06 +00001771 ;}
1772 break;
1773
1774 case 46:
1775#line 468 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1776 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001777 yyval.FieldList = yyvsp[0].FieldList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001778 ;}
1779 break;
1780
1781 case 47:
1782#line 472 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1783 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001784 yyval.FieldList = new std::vector<Init*>();
1785 yyval.FieldList->push_back(yyvsp[0].Initializer);
Chris Lattner2b931e82005-09-12 05:30:06 +00001786 ;}
1787 break;
1788
1789 case 48:
1790#line 475 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1791 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001792 (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer);
Chris Lattner2b931e82005-09-12 05:30:06 +00001793 ;}
1794 break;
1795
1796 case 49:
1797#line 479 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1798 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001799 std::string DecName = *yyvsp[-1].StrVal;
1800 if (ParsingTemplateArgs)
1801 DecName = CurRec->getName() + ":" + DecName;
1802
1803 addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal));
1804 setValue(DecName, 0, yyvsp[0].Initializer);
1805 yyval.StrVal = new std::string(DecName);
Chris Lattner2b931e82005-09-12 05:30:06 +00001806;}
1807 break;
1808
1809 case 50:
1810#line 489 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1811 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001812 delete yyvsp[-1].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001813;}
1814 break;
1815
1816 case 51:
1817#line 491 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1818 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001819 setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer);
1820 delete yyvsp[-4].StrVal;
1821 delete yyvsp[-3].BitList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001822;}
1823 break;
1824
1825 case 56:
1826#line 500 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1827 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001828 yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>());
Chris Lattner2b931e82005-09-12 05:30:06 +00001829 ;}
1830 break;
1831
1832 case 57:
1833#line 502 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1834 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001835 yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList);
Chris Lattner2b931e82005-09-12 05:30:06 +00001836 ;}
1837 break;
1838
1839 case 58:
1840#line 506 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1841 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001842 yyval.SubClassList = new std::vector<SubClassRefTy>();
1843 yyval.SubClassList->push_back(*yyvsp[0].SubClassRef);
1844 delete yyvsp[0].SubClassRef;
Chris Lattner2b931e82005-09-12 05:30:06 +00001845 ;}
1846 break;
1847
1848 case 59:
1849#line 511 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1850 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001851 (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef);
1852 delete yyvsp[0].SubClassRef;
Chris Lattner2b931e82005-09-12 05:30:06 +00001853 ;}
1854 break;
1855
1856 case 60:
1857#line 516 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1858 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001859 yyval.SubClassList = new std::vector<SubClassRefTy>();
Chris Lattner2b931e82005-09-12 05:30:06 +00001860 ;}
1861 break;
1862
1863 case 61:
1864#line 519 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1865 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001866 yyval.SubClassList = yyvsp[0].SubClassList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001867 ;}
1868 break;
1869
1870 case 62:
1871#line 523 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1872 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001873 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1874 delete yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001875;}
1876 break;
1877
1878 case 63:
1879#line 526 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1880 {
Chris Lattnerca572be2005-09-08 18:48:47 +00001881 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1882 delete yyvsp[0].StrVal;
Chris Lattner2b931e82005-09-12 05:30:06 +00001883;}
1884 break;
1885
1886 case 64:
1887#line 531 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1888 {;}
1889 break;
1890
1891 case 67:
1892#line 534 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1893 { yyval.StrVal = yyvsp[0].StrVal; ;}
1894 break;
1895
1896 case 68:
1897#line 534 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1898 { yyval.StrVal = new std::string(); ;}
1899 break;
1900
1901 case 69:
1902#line 536 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1903 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001904 static unsigned AnonCounter = 0;
1905 if (yyvsp[0].StrVal->empty())
1906 *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++);
1907 CurRec = new Record(*yyvsp[0].StrVal);
1908 delete yyvsp[0].StrVal;
1909 ParsingTemplateArgs = true;
Chris Lattner2b931e82005-09-12 05:30:06 +00001910 ;}
1911 break;
1912
1913 case 70:
1914#line 543 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1915 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001916 ParsingTemplateArgs = false;
1917 for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001918 addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001919 // Delete the template arg values for the class
1920 delete (*yyvsp[0].SubClassList)[i].second;
1921 }
1922 delete yyvsp[0].SubClassList; // Delete the class list...
1923
Chris Lattnerba4b1442005-09-08 18:22:57 +00001924 // Process any variables on the set stack...
1925 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001926 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
1927 setValue(LetStack[i][j].Name,
1928 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
1929 LetStack[i][j].Value);
Chris Lattner2b931e82005-09-12 05:30:06 +00001930 ;}
1931 break;
1932
1933 case 71:
1934#line 558 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1935 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001936 yyval.Rec = CurRec;
1937 CurRec = 0;
Chris Lattner2b931e82005-09-12 05:30:06 +00001938 ;}
1939 break;
1940
1941 case 72:
1942#line 563 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1943 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001944 if (Records.getClass(yyvsp[0].Rec->getName())) {
1945 err() << "Class '" << yyvsp[0].Rec->getName() << "' already defined!\n";
1946 exit(1);
1947 }
1948 Records.addClass(yyval.Rec = yyvsp[0].Rec);
Chris Lattner2b931e82005-09-12 05:30:06 +00001949;}
1950 break;
1951
1952 case 73:
1953#line 571 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1954 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001955 yyvsp[0].Rec->resolveReferences();
1956
Chris Lattnerca572be2005-09-08 18:48:47 +00001957 // If ObjectBody has template arguments, it's an error.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001958 if (!yyvsp[0].Rec->getTemplateArgs().empty()) {
1959 err() << "Def '" << yyvsp[0].Rec->getName()
1960 << "' is not permitted to have template arguments!\n";
1961 exit(1);
1962 }
Chris Lattnerca572be2005-09-08 18:48:47 +00001963 // Ensure redefinition doesn't happen.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001964 if (Records.getDef(yyvsp[0].Rec->getName())) {
1965 err() << "Def '" << yyvsp[0].Rec->getName() << "' already defined!\n";
1966 exit(1);
1967 }
1968 Records.addDef(yyval.Rec = yyvsp[0].Rec);
Chris Lattner2b931e82005-09-12 05:30:06 +00001969;}
1970 break;
1971
1972 case 76:
1973#line 591 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1974 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001975 LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer));
1976 delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList;
Chris Lattner2b931e82005-09-12 05:30:06 +00001977;}
1978 break;
1979
1980 case 79:
1981#line 599 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1982 { LetStack.push_back(std::vector<LetRecord>()); ;}
1983 break;
1984
1985 case 81:
1986#line 602 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1987 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001988 LetStack.pop_back();
Chris Lattner2b931e82005-09-12 05:30:06 +00001989 ;}
1990 break;
1991
1992 case 82:
1993#line 605 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
1994 {
Chris Lattnerca572be2005-09-08 18:48:47 +00001995 LetStack.pop_back();
Chris Lattner2b931e82005-09-12 05:30:06 +00001996 ;}
1997 break;
1998
1999 case 83:
2000#line 609 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
2001 {;}
2002 break;
2003
2004 case 84:
2005#line 609 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
2006 {;}
2007 break;
2008
2009 case 85:
2010#line 611 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
2011 {;}
2012 break;
2013
2014
2015 }
2016
2017/* Line 999 of yacc.c. */
2018#line 2018 "FileParser.tab.c"
Reid Spencer68a24bd2005-08-27 18:50:39 +00002019
2020 yyvsp -= yylen;
2021 yyssp -= yylen;
2022
Chris Lattner2b931e82005-09-12 05:30:06 +00002023
2024 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002025
2026 *++yyvsp = yyval;
2027
2028
Chris Lattner2b931e82005-09-12 05:30:06 +00002029 /* Now `shift' the result of the reduction. Determine what state
2030 that goes to, based on the state we popped back to and the rule
2031 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002032
2033 yyn = yyr1[yyn];
2034
Chris Lattner2b931e82005-09-12 05:30:06 +00002035 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2036 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002037 yystate = yytable[yystate];
2038 else
Chris Lattner2b931e82005-09-12 05:30:06 +00002039 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00002040
2041 goto yynewstate;
2042
2043
Chris Lattner2b931e82005-09-12 05:30:06 +00002044/*------------------------------------.
2045| yyerrlab -- here on detecting error |
2046`------------------------------------*/
2047yyerrlab:
2048 /* If not already recovering from an error, report this error. */
2049 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002050 {
2051 ++yynerrs;
Chris Lattner2b931e82005-09-12 05:30:06 +00002052#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002053 yyn = yypact[yystate];
2054
Chris Lattner2b931e82005-09-12 05:30:06 +00002055 if (YYPACT_NINF < yyn && yyn < YYLAST)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002056 {
Chris Lattner2b931e82005-09-12 05:30:06 +00002057 YYSIZE_T yysize = 0;
2058 int yytype = YYTRANSLATE (yychar);
2059 char *yymsg;
2060 int yyx, yycount;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002061
Chris Lattner2b931e82005-09-12 05:30:06 +00002062 yycount = 0;
2063 /* Start YYX at -YYN if negative to avoid negative indexes in
2064 YYCHECK. */
2065 for (yyx = yyn < 0 ? -yyn : 0;
2066 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
2067 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2068 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
2069 yysize += yystrlen ("syntax error, unexpected ") + 1;
2070 yysize += yystrlen (yytname[yytype]);
2071 yymsg = (char *) YYSTACK_ALLOC (yysize);
2072 if (yymsg != 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002073 {
Chris Lattner2b931e82005-09-12 05:30:06 +00002074 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2075 yyp = yystpcpy (yyp, yytname[yytype]);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002076
Chris Lattner2b931e82005-09-12 05:30:06 +00002077 if (yycount < 5)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002078 {
Chris Lattner2b931e82005-09-12 05:30:06 +00002079 yycount = 0;
2080 for (yyx = yyn < 0 ? -yyn : 0;
2081 yyx < (int) (sizeof (yytname) / sizeof (char *));
2082 yyx++)
2083 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002084 {
Chris Lattner2b931e82005-09-12 05:30:06 +00002085 const char *yyq = ! yycount ? ", expecting " : " or ";
2086 yyp = yystpcpy (yyp, yyq);
2087 yyp = yystpcpy (yyp, yytname[yyx]);
2088 yycount++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002089 }
2090 }
Chris Lattner2b931e82005-09-12 05:30:06 +00002091 yyerror (yymsg);
2092 YYSTACK_FREE (yymsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002093 }
2094 else
Chris Lattner2b931e82005-09-12 05:30:06 +00002095 yyerror ("syntax error; also virtual memory exhausted");
Reid Spencer68a24bd2005-08-27 18:50:39 +00002096 }
2097 else
2098#endif /* YYERROR_VERBOSE */
Chris Lattner2b931e82005-09-12 05:30:06 +00002099 yyerror ("syntax error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00002100 }
2101
Chris Lattner2b931e82005-09-12 05:30:06 +00002102
Reid Spencer68a24bd2005-08-27 18:50:39 +00002103
2104 if (yyerrstatus == 3)
2105 {
Chris Lattner2b931e82005-09-12 05:30:06 +00002106 /* If just tried and failed to reuse lookahead token after an
2107 error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002108
Chris Lattner2b931e82005-09-12 05:30:06 +00002109 /* Return failure if at end of input. */
Chris Lattnerba4b1442005-09-08 18:22:57 +00002110 if (yychar == YYEOF)
Chris Lattner2b931e82005-09-12 05:30:06 +00002111 {
2112 /* Pop the error token. */
2113 YYPOPSTACK;
2114 /* Pop the rest of the stack. */
2115 while (yyss < yyssp)
2116 {
2117 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2118 yydestruct (yystos[*yyssp], yyvsp);
2119 YYPOPSTACK;
2120 }
2121 YYABORT;
2122 }
2123
2124 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2125 yydestruct (yytoken, &yylval);
2126 yychar = YYEMPTY;
2127
2128 }
2129
2130 /* Else will try to reuse lookahead token after shifting the error
2131 token. */
2132 goto yyerrlab1;
2133
2134
2135/*----------------------------------------------------.
2136| yyerrlab1 -- error raised explicitly by an action. |
2137`----------------------------------------------------*/
2138yyerrlab1:
2139 yyerrstatus = 3; /* Each real token shifted decrements this. */
2140
2141 for (;;)
2142 {
2143 yyn = yypact[yystate];
2144 if (yyn != YYPACT_NINF)
2145 {
2146 yyn += YYTERROR;
2147 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2148 {
2149 yyn = yytable[yyn];
2150 if (0 < yyn)
2151 break;
2152 }
2153 }
2154
2155 /* Pop the current state because it cannot handle the error token. */
2156 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002157 YYABORT;
2158
Chris Lattner2b931e82005-09-12 05:30:06 +00002159 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2160 yydestruct (yystos[yystate], yyvsp);
2161 yyvsp--;
2162 yystate = *--yyssp;
Chris Lattnerba4b1442005-09-08 18:22:57 +00002163
Chris Lattner2b931e82005-09-12 05:30:06 +00002164 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002165 }
2166
2167 if (yyn == YYFINAL)
2168 YYACCEPT;
2169
Chris Lattner2b931e82005-09-12 05:30:06 +00002170 YYDPRINTF ((stderr, "Shifting error token, "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002171
2172 *++yyvsp = yylval;
Chris Lattner2b931e82005-09-12 05:30:06 +00002173
Reid Spencer68a24bd2005-08-27 18:50:39 +00002174
2175 yystate = yyn;
2176 goto yynewstate;
2177
Reid Spencer68a24bd2005-08-27 18:50:39 +00002178
Chris Lattner2b931e82005-09-12 05:30:06 +00002179/*-------------------------------------.
2180| yyacceptlab -- YYACCEPT comes here. |
2181`-------------------------------------*/
2182yyacceptlab:
2183 yyresult = 0;
2184 goto yyreturn;
2185
2186/*-----------------------------------.
2187| yyabortlab -- YYABORT comes here. |
2188`-----------------------------------*/
2189yyabortlab:
2190 yyresult = 1;
2191 goto yyreturn;
2192
2193#ifndef yyoverflow
2194/*----------------------------------------------.
2195| yyoverflowlab -- parser overflow comes here. |
2196`----------------------------------------------*/
2197yyoverflowlab:
2198 yyerror ("parser stack overflow");
2199 yyresult = 2;
2200 /* Fall through. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002201#endif
Chris Lattner2b931e82005-09-12 05:30:06 +00002202
2203yyreturn:
2204#ifndef yyoverflow
2205 if (yyss != yyssa)
2206 YYSTACK_FREE (yyss);
2207#endif
2208 return yyresult;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002209}
Chris Lattner2b931e82005-09-12 05:30:06 +00002210
2211
2212#line 613 "/home/vadve/lattner/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +00002213
2214
2215int yyerror(const char *ErrorMsg) {
2216 err() << "Error parsing: " << ErrorMsg << "\n";
2217 exit(1);
2218}
Chris Lattner2b931e82005-09-12 05:30:06 +00002219