blob: 9ed36d0615bc67e5faacc095e0f41dacb8e8e3e3 [file] [log] [blame]
John Criswelld7881242006-01-17 17:01:34 +00001/* A Bison parser, made by GNU Bison 1.875. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
John Criswelld7881242006-01-17 17:01:34 +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
John Criswelld7881242006-01-17 17:01:34 +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
John Criswelld7881242006-01-17 17:01:34 +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
John Criswelld7881242006-01-17 17:01:34 +000051#define yylex Filelex
Reid Spencer68a24bd2005-08-27 18:50:39 +000052#define yyerror Fileerror
John Criswelld7881242006-01-17 17:01:34 +000053#define yylval Filelval
54#define yychar Filechar
Reid Spencer68a24bd2005-08-27 18:50:39 +000055#define yydebug Filedebug
56#define yynerrs Filenerrs
57
John Criswelld7881242006-01-17 17:01:34 +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/criswell/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
John Criswelld7881242006-01-17 17:01:34 +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/criswell/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;
John Criswelld7881242006-01-17 17:01:34 +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
John Criswelld7881242006-01-17 17:01:34 +0000324/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000325
326
John Criswelld7881242006-01-17 17:01:34 +0000327/* Line 214 of yacc.c. */
328#line 328 "FileParser.tab.c"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000329
John Criswelld7881242006-01-17 17:01:34 +0000330#if ! defined (yyoverflow) || YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +0000331
John Criswelld7881242006-01-17 17:01:34 +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
John Criswelld7881242006-01-17 17:01:34 +0000418#if defined (__STDC__) || defined (__cplusplus)
419 typedef signed char yysigned_char;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000420#else
John Criswelld7881242006-01-17 17:01:34 +0000421 typedef short yysigned_char;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000422#endif
423
John Criswelld7881242006-01-17 17:01:34 +0000424/* YYFINAL -- State number of the termination state. */
425#define YYFINAL 20
426/* YYLAST -- Last index in YYTABLE. */
427#define YYLAST 163
428
429/* YYNTOKENS -- Number of terminals. */
430#define YYNTOKENS 38
431/* YYNNTS -- Number of nonterminals. */
432#define YYNNTS 41
433/* YYNRULES -- Number of rules. */
434#define YYNRULES 89
435/* YYNRULES -- Number of states. */
436#define YYNSTATES 160
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 212, 214, 216, 217, 221, 222, 223, 230, 234, 236,
491 238, 243, 245, 249, 250, 255, 260, 263, 265, 268
492};
493
494/* YYRHS -- A `-1'-separated list of the rules' RHS. */
495static const yysigned_char yyrhs[] =
496{
497 78, 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 62, -1, 63, -1, 63, -1, -1, 58, 67, 55,
519 -1, -1, -1, 10, 64, 69, 61, 70, 66, -1,
520 11, 65, 66, -1, 68, -1, 71, -1, 19, 49,
521 25, 43, -1, 73, -1, 74, 34, 73, -1, -1,
522 13, 76, 74, 14, -1, 75, 27, 77, 28, -1,
523 75, 72, -1, 72, -1, 77, 72, -1, 77, -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, 561, 573, 573, 592, 594, 592, 600, 609, 609,
537 611, 616, 616, 619, 619, 622, 625, 629, 629, 631
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", "ObjectName", "ClassName", "DefName",
556 "ObjectBody", "@1", "ClassInst", "@2", "@3", "DefInst", "Object",
557 "LETItem", "LETList", "LETCommand", "@4", "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, 63,
583 64, 65, 67, 66, 69, 70, 68, 71, 72, 72,
584 73, 74, 74, 76, 75, 72, 72, 77, 77, 78
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, 1,
597 1, 1, 0, 3, 0, 0, 6, 3, 1, 1,
598 4, 1, 3, 0, 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, 83, 78, 79, 87, 0, 89, 0,
607 67, 69, 70, 74, 71, 60, 0, 0, 86, 88,
608 1, 65, 0, 72, 77, 43, 81, 0, 0, 11,
609 66, 75, 2, 56, 58, 61, 0, 0, 0, 84,
610 0, 85, 12, 0, 62, 0, 60, 0, 0, 52,
611 54, 73, 36, 42, 0, 0, 82, 6, 4, 3,
612 0, 0, 8, 9, 10, 0, 64, 11, 76, 0,
613 0, 0, 15, 21, 16, 17, 18, 45, 45, 0,
614 47, 0, 59, 11, 38, 0, 0, 44, 80, 0,
615 0, 13, 63, 0, 0, 0, 0, 0, 46, 0,
616 34, 0, 0, 0, 57, 0, 0, 55, 0, 53,
617 37, 39, 0, 0, 0, 49, 0, 0, 0, 0,
618 19, 23, 30, 35, 0, 0, 0, 24, 48, 43,
619 50, 41, 0, 5, 7, 14, 0, 0, 0, 20,
620 0, 32, 0, 25, 22, 26, 0, 40, 0, 0,
621 0, 31, 30, 0, 27, 28, 29, 33, 0, 51
622};
623
624/* YYDEFGOTO[NTERM-NUM]. */
625static const short yydefgoto[] =
626{
627 -1, 33, 65, 43, 115, 80, 141, 123, 124, 53,
628 54, 38, 97, 98, 44, 109, 83, 51, 34, 35,
629 23, 45, 30, 31, 11, 12, 13, 15, 24, 36,
630 4, 21, 46, 5, 6, 26, 27, 7, 16, 8,
631 9
632};
633
634/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
635 STATE-NUM. */
636#define YYPACT_NINF -82
637static const yysigned_char yypact[] =
638{
639 114, -12, -12, -82, -82, -82, -82, 4, 114, 16,
640 -82, -82, -82, -82, -82, -3, 10, 114, -82, -82,
641 -82, 12, 17, -82, -82, 14, -82, -9, -2, 35,
642 -82, -82, -82, 26, -82, 28, -14, 46, 42, -82,
643 10, -82, -82, 69, -82, 3, -3, 39, 17, -82,
644 -82, -82, -8, 36, 41, 39, -82, -82, -82, -82,
645 56, 57, -82, -82, -82, 66, -82, 35, -82, 52,
646 54, 58, -82, 72, -82, -82, -82, 39, 39, 87,
647 91, 9, -82, 6, -82, 108, 110, -82, 91, 111,
648 69, 105, -82, 39, 39, 39, 39, 103, 98, 104,
649 39, 46, 46, 116, -82, 39, 117, -82, 96, -82,
650 -82, -6, 113, 115, 39, -82, 65, 73, 74, 29,
651 -82, -82, 62, 106, 109, 118, 119, -82, 91, 14,
652 -82, -82, 120, -82, -82, 91, 39, 39, 39, -82,
653 121, -82, 39, -82, -82, -82, 122, -82, 82, 83,
654 90, -82, 62, 39, -82, -82, -82, -82, 15, -82
655};
656
657/* YYPGOTO[NTERM-NUM]. */
658static const short yypgoto[] =
659{
660 -82, -42, 53, -82, -82, -55, -7, -82, -82, -82,
661 -81, 19, 75, -45, -61, -82, -82, -82, 102, -82,
662 -82, -82, -82, -82, -82, 142, -82, -82, 112, -82,
663 -82, -82, -82, -82, -4, 123, -82, -82, -82, 134,
664 -82
665};
666
667/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
668 positive, shift that token. If negative, reduce the rule which
669 number is the opposite. If zero, do what YYDEFACT says.
670 If YYTABLE_NINF, syntax error. */
671#define YYTABLE_NINF -1
672static const unsigned char yytable[] =
673{
674 88, 64, 81, 18, 19, 39, 92, 10, 1, 2,
675 84, 3, 131, 49, 1, 2, 20, 3, 42, 106,
676 125, 126, 108, 50, 19, 40, 41, 66, 85, 25,
677 132, 17, 22, 104, 107, 29, 32, 67, 116, 117,
678 118, 37, 101, 105, 102, 122, 103, 42, 64, 47,
679 128, 119, 159, 139, 69, 70, 71, 72, 73, 135,
680 74, 75, 48, 105, 52, 76, 77, 55, 78, 87,
681 86, 79, 57, 58, 59, 60, 61, 62, 63, 89,
682 90, 148, 149, 150, 93, 91, 94, 152, 32, 101,
683 95, 102, 101, 103, 102, 96, 103, 140, 158, 136,
684 101, 101, 102, 102, 103, 103, 100, 137, 138, 101,
685 101, 102, 102, 103, 103, 154, 155, 101, 101, 102,
686 102, 103, 103, 156, 1, 2, 110, 3, 111, 112,
687 114, 120, 105, 130, 121, 127, 129, 133, 147, 134,
688 142, 151, 143, 113, 14, 157, 144, 153, 146, 145,
689 82, 28, 0, 99, 0, 0, 0, 0, 68, 0,
690 0, 0, 0, 56
691};
692
693static const short yycheck[] =
694{
695 55, 43, 47, 7, 8, 14, 67, 19, 10, 11,
696 18, 13, 18, 27, 10, 11, 0, 13, 12, 13,
697 101, 102, 83, 37, 28, 34, 28, 24, 36, 19,
698 36, 27, 35, 24, 28, 23, 19, 34, 93, 94,
699 95, 27, 27, 34, 29, 100, 31, 12, 90, 23,
700 105, 96, 37, 24, 15, 16, 17, 18, 19, 114,
701 21, 22, 34, 34, 18, 26, 27, 25, 29, 28,
702 34, 32, 3, 4, 5, 6, 7, 8, 9, 23,
703 23, 136, 137, 138, 32, 19, 32, 142, 19, 27,
704 32, 29, 27, 31, 29, 23, 31, 35, 153, 34,
705 27, 27, 29, 29, 31, 31, 19, 34, 34, 27,
706 27, 29, 29, 31, 31, 33, 33, 27, 27, 29,
707 29, 31, 31, 33, 10, 11, 18, 13, 18, 18,
708 25, 28, 34, 37, 30, 19, 19, 24, 18, 24,
709 34, 20, 33, 90, 2, 152, 28, 25, 129, 30,
710 48, 17, -1, 78, -1, -1, -1, -1, 46, -1,
711 -1, -1, -1, 40
712};
713
714/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
715 symbol of state STATE-NUM. */
716static const unsigned char yystos[] =
717{
718 0, 10, 11, 13, 68, 71, 72, 75, 77, 78,
719 19, 62, 63, 64, 63, 65, 76, 27, 72, 72,
720 0, 69, 35, 58, 66, 19, 73, 74, 77, 23,
721 60, 61, 19, 39, 56, 57, 67, 27, 49, 14,
722 34, 28, 12, 41, 52, 59, 70, 23, 34, 27,
723 37, 55, 18, 47, 48, 25, 73, 3, 4, 5,
724 6, 7, 8, 9, 39, 40, 24, 34, 66, 15,
725 16, 17, 18, 19, 21, 22, 26, 27, 29, 32,
726 43, 51, 56, 54, 18, 36, 34, 28, 43, 23,
727 23, 19, 52, 32, 32, 32, 23, 50, 51, 50,
728 19, 27, 29, 31, 24, 34, 13, 28, 52, 53,
729 18, 18, 18, 40, 25, 42, 43, 43, 43, 51,
730 28, 30, 43, 45, 46, 48, 48, 19, 43, 19,
731 37, 18, 36, 24, 24, 43, 34, 34, 34, 24,
732 35, 44, 34, 33, 28, 30, 49, 18, 43, 43,
733 43, 20, 43, 25, 33, 33, 33, 44, 43, 37
734};
735
736#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
737# define YYSIZE_T __SIZE_TYPE__
738#endif
739#if ! defined (YYSIZE_T) && defined (size_t)
740# define YYSIZE_T size_t
741#endif
742#if ! defined (YYSIZE_T)
743# if defined (__STDC__) || defined (__cplusplus)
744# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
745# define YYSIZE_T size_t
746# endif
747#endif
748#if ! defined (YYSIZE_T)
749# define YYSIZE_T unsigned int
750#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000751
752#define yyerrok (yyerrstatus = 0)
753#define yyclearin (yychar = YYEMPTY)
John Criswelld7881242006-01-17 17:01:34 +0000754#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000755#define YYEOF 0
John Criswelld7881242006-01-17 17:01:34 +0000756
Reid Spencer68a24bd2005-08-27 18:50:39 +0000757#define YYACCEPT goto yyacceptlab
John Criswelld7881242006-01-17 17:01:34 +0000758#define YYABORT goto yyabortlab
Chris Lattnerba4b1442005-09-08 18:22:57 +0000759#define YYERROR goto yyerrlab1
John Criswelld7881242006-01-17 17:01:34 +0000760
761
762/* Like YYERROR except do call yyerror. This remains here temporarily
763 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000764 Once GCC version 2 has supplanted version 1, this can go. */
John Criswelld7881242006-01-17 17:01:34 +0000765
Reid Spencer68a24bd2005-08-27 18:50:39 +0000766#define YYFAIL goto yyerrlab
John Criswelld7881242006-01-17 17:01:34 +0000767
Reid Spencer68a24bd2005-08-27 18:50:39 +0000768#define YYRECOVERING() (!!yyerrstatus)
John Criswelld7881242006-01-17 17:01:34 +0000769
770#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000771do \
772 if (yychar == YYEMPTY && yylen == 1) \
John Criswelld7881242006-01-17 17:01:34 +0000773 { \
774 yychar = (Token); \
775 yylval = (Value); \
776 yytoken = YYTRANSLATE (yychar); \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000777 YYPOPSTACK; \
778 goto yybackup; \
779 } \
780 else \
John Criswelld7881242006-01-17 17:01:34 +0000781 { \
782 yyerror ("syntax error: cannot back up");\
783 YYERROR; \
784 } \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000785while (0)
786
787#define YYTERROR 1
788#define YYERRCODE 256
789
John Criswelld7881242006-01-17 17:01:34 +0000790/* YYLLOC_DEFAULT -- Compute the default location (before the actions
791 are run). */
792
793#ifndef YYLLOC_DEFAULT
794# define YYLLOC_DEFAULT(Current, Rhs, N) \
795 Current.first_line = Rhs[1].first_line; \
796 Current.first_column = Rhs[1].first_column; \
797 Current.last_line = Rhs[N].last_line; \
798 Current.last_column = Rhs[N].last_column;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000799#endif
800
John Criswelld7881242006-01-17 17:01:34 +0000801/* YYLEX -- calling `yylex' with the right arguments. */
802
Reid Spencer68a24bd2005-08-27 18:50:39 +0000803#ifdef YYLEX_PARAM
John Criswelld7881242006-01-17 17:01:34 +0000804# define YYLEX yylex (YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000805#else
John Criswelld7881242006-01-17 17:01:34 +0000806# define YYLEX yylex ()
Chris Lattner8d354e92005-09-30 04:11:27 +0000807#endif
John Criswelld7881242006-01-17 17:01:34 +0000808
809/* Enable debugging if requested. */
810#if YYDEBUG
811
812# ifndef YYFPRINTF
813# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
814# define YYFPRINTF fprintf
815# endif
816
817# define YYDPRINTF(Args) \
818do { \
819 if (yydebug) \
820 YYFPRINTF Args; \
821} while (0)
822
823# define YYDSYMPRINT(Args) \
824do { \
825 if (yydebug) \
826 yysymprint Args; \
827} while (0)
828
829# define YYDSYMPRINTF(Title, Token, Value, Location) \
830do { \
831 if (yydebug) \
832 { \
833 YYFPRINTF (stderr, "%s ", Title); \
834 yysymprint (stderr, \
835 Token, Value); \
836 YYFPRINTF (stderr, "\n"); \
837 } \
838} while (0)
839
840/*------------------------------------------------------------------.
841| yy_stack_print -- Print the state stack from its BOTTOM up to its |
842| TOP (cinluded). |
843`------------------------------------------------------------------*/
844
845#if defined (__STDC__) || defined (__cplusplus)
846static void
847yy_stack_print (short *bottom, short *top)
Chris Lattner8d354e92005-09-30 04:11:27 +0000848#else
John Criswelld7881242006-01-17 17:01:34 +0000849static void
850yy_stack_print (bottom, top)
851 short *bottom;
852 short *top;
Chris Lattner8d354e92005-09-30 04:11:27 +0000853#endif
John Criswelld7881242006-01-17 17:01:34 +0000854{
855 YYFPRINTF (stderr, "Stack now");
856 for (/* Nothing. */; bottom <= top; ++bottom)
857 YYFPRINTF (stderr, " %d", *bottom);
858 YYFPRINTF (stderr, "\n");
859}
860
861# define YY_STACK_PRINT(Bottom, Top) \
862do { \
863 if (yydebug) \
864 yy_stack_print ((Bottom), (Top)); \
865} while (0)
866
867
868/*------------------------------------------------.
869| Report that the YYRULE is going to be reduced. |
870`------------------------------------------------*/
871
872#if defined (__STDC__) || defined (__cplusplus)
873static void
874yy_reduce_print (int yyrule)
875#else
876static void
877yy_reduce_print (yyrule)
878 int yyrule;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000879#endif
John Criswelld7881242006-01-17 17:01:34 +0000880{
881 int yyi;
882 unsigned int yylineno = yyrline[yyrule];
883 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
884 yyrule - 1, yylineno);
885 /* Print the symbols being reduced, and their result. */
886 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
887 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
888 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
889}
Chris Lattner2b931e82005-09-12 05:30:06 +0000890
John Criswelld7881242006-01-17 17:01:34 +0000891# define YY_REDUCE_PRINT(Rule) \
892do { \
893 if (yydebug) \
894 yy_reduce_print (Rule); \
895} while (0)
Chris Lattner2b931e82005-09-12 05:30:06 +0000896
John Criswelld7881242006-01-17 17:01:34 +0000897/* Nonzero means print parse trace. It is left uninitialized so that
898 multiple parsers can coexist. */
899int yydebug;
900#else /* !YYDEBUG */
901# define YYDPRINTF(Args)
902# define YYDSYMPRINT(Args)
903# define YYDSYMPRINTF(Title, Token, Value, Location)
904# define YY_STACK_PRINT(Bottom, Top)
905# define YY_REDUCE_PRINT(Rule)
906#endif /* !YYDEBUG */
Chris Lattner2b931e82005-09-12 05:30:06 +0000907
Chris Lattner2b931e82005-09-12 05:30:06 +0000908
John Criswelld7881242006-01-17 17:01:34 +0000909/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000910#ifndef YYINITDEPTH
John Criswelld7881242006-01-17 17:01:34 +0000911# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +0000912#endif
913
John Criswelld7881242006-01-17 17:01:34 +0000914/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
915 if the built-in stack extension method is used).
916
917 Do not make this value too large; the results are undefined if
918 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
919 evaluated with infinite-precision integer arithmetic. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000920
Chris Lattnerba4b1442005-09-08 18:22:57 +0000921#if YYMAXDEPTH == 0
John Criswelld7881242006-01-17 17:01:34 +0000922# undef YYMAXDEPTH
Reid Spencer68a24bd2005-08-27 18:50:39 +0000923#endif
924
925#ifndef YYMAXDEPTH
John Criswelld7881242006-01-17 17:01:34 +0000926# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +0000927#endif
John Criswelld7881242006-01-17 17:01:34 +0000928
Reid Spencer68a24bd2005-08-27 18:50:39 +0000929
930
John Criswelld7881242006-01-17 17:01:34 +0000931#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +0000932
John Criswelld7881242006-01-17 17:01:34 +0000933# ifndef yystrlen
934# if defined (__GLIBC__) && defined (_STRING_H)
935# define yystrlen strlen
936# else
937/* Return the length of YYSTR. */
938static YYSIZE_T
939# if defined (__STDC__) || defined (__cplusplus)
940yystrlen (const char *yystr)
941# else
942yystrlen (yystr)
943 const char *yystr;
944# endif
Chris Lattner8d354e92005-09-30 04:11:27 +0000945{
John Criswelld7881242006-01-17 17:01:34 +0000946 register const char *yys = yystr;
Chris Lattner8d354e92005-09-30 04:11:27 +0000947
John Criswelld7881242006-01-17 17:01:34 +0000948 while (*yys++ != '\0')
949 continue;
950
951 return yys - yystr - 1;
Chris Lattner8d354e92005-09-30 04:11:27 +0000952}
John Criswelld7881242006-01-17 17:01:34 +0000953# endif
954# endif
Chris Lattner8d354e92005-09-30 04:11:27 +0000955
John Criswelld7881242006-01-17 17:01:34 +0000956# ifndef yystpcpy
957# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
958# define yystpcpy stpcpy
959# else
960/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
961 YYDEST. */
962static char *
963# if defined (__STDC__) || defined (__cplusplus)
964yystpcpy (char *yydest, const char *yysrc)
965# else
966yystpcpy (yydest, yysrc)
967 char *yydest;
968 const char *yysrc;
969# endif
Chris Lattner8d354e92005-09-30 04:11:27 +0000970{
John Criswelld7881242006-01-17 17:01:34 +0000971 register char *yyd = yydest;
972 register const char *yys = yysrc;
Chris Lattner8d354e92005-09-30 04:11:27 +0000973
John Criswelld7881242006-01-17 17:01:34 +0000974 while ((*yyd++ = *yys++) != '\0')
975 continue;
976
977 return yyd - 1;
Chris Lattner8d354e92005-09-30 04:11:27 +0000978}
John Criswelld7881242006-01-17 17:01:34 +0000979# endif
980# endif
Chris Lattner8d354e92005-09-30 04:11:27 +0000981
John Criswelld7881242006-01-17 17:01:34 +0000982#endif /* !YYERROR_VERBOSE */
983
Chris Lattner2b931e82005-09-12 05:30:06 +0000984
985
John Criswelld7881242006-01-17 17:01:34 +0000986#if YYDEBUG
987/*--------------------------------.
988| Print this symbol on YYOUTPUT. |
989`--------------------------------*/
Chris Lattner2b931e82005-09-12 05:30:06 +0000990
John Criswelld7881242006-01-17 17:01:34 +0000991#if defined (__STDC__) || defined (__cplusplus)
992static void
993yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Chris Lattner8d354e92005-09-30 04:11:27 +0000994#else
John Criswelld7881242006-01-17 17:01:34 +0000995static void
996yysymprint (yyoutput, yytype, yyvaluep)
997 FILE *yyoutput;
998 int yytype;
999 YYSTYPE *yyvaluep;
Chris Lattner2b931e82005-09-12 05:30:06 +00001000#endif
Chris Lattner2b931e82005-09-12 05:30:06 +00001001{
John Criswelld7881242006-01-17 17:01:34 +00001002 /* Pacify ``unused variable'' warnings. */
1003 (void) yyvaluep;
1004
1005 if (yytype < YYNTOKENS)
1006 {
1007 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1008# ifdef YYPRINT
1009 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1010# endif
1011 }
1012 else
1013 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1014
1015 switch (yytype)
1016 {
1017 default:
1018 break;
1019 }
1020 YYFPRINTF (yyoutput, ")");
1021}
1022
1023#endif /* ! YYDEBUG */
1024/*-----------------------------------------------.
1025| Release the memory associated to this symbol. |
1026`-----------------------------------------------*/
1027
1028#if defined (__STDC__) || defined (__cplusplus)
1029static void
1030yydestruct (int yytype, YYSTYPE *yyvaluep)
1031#else
1032static void
1033yydestruct (yytype, yyvaluep)
1034 int yytype;
1035 YYSTYPE *yyvaluep;
1036#endif
1037{
1038 /* Pacify ``unused variable'' warnings. */
1039 (void) yyvaluep;
1040
1041 switch (yytype)
1042 {
1043
1044 default:
1045 break;
1046 }
1047}
1048
1049
1050/* Prevent warnings from -Wmissing-prototypes. */
1051
1052#ifdef YYPARSE_PARAM
1053# if defined (__STDC__) || defined (__cplusplus)
1054int yyparse (void *YYPARSE_PARAM);
1055# else
1056int yyparse ();
1057# endif
1058#else /* ! YYPARSE_PARAM */
1059#if defined (__STDC__) || defined (__cplusplus)
1060int yyparse (void);
1061#else
1062int yyparse ();
1063#endif
1064#endif /* ! YYPARSE_PARAM */
1065
1066
1067
1068/* The lookahead symbol. */
1069int yychar;
1070
1071/* The semantic value of the lookahead symbol. */
1072YYSTYPE yylval;
1073
1074/* Number of syntax errors so far. */
1075int yynerrs;
1076
1077
1078
1079/*----------.
1080| yyparse. |
1081`----------*/
1082
1083#ifdef YYPARSE_PARAM
1084# if defined (__STDC__) || defined (__cplusplus)
1085int yyparse (void *YYPARSE_PARAM)
1086# else
1087int yyparse (YYPARSE_PARAM)
1088 void *YYPARSE_PARAM;
1089# endif
1090#else /* ! YYPARSE_PARAM */
1091#if defined (__STDC__) || defined (__cplusplus)
1092int
1093yyparse (void)
1094#else
1095int
1096yyparse ()
1097
1098#endif
1099#endif
1100{
1101
Reid Spencer68a24bd2005-08-27 18:50:39 +00001102 register int yystate;
1103 register int yyn;
John Criswelld7881242006-01-17 17:01:34 +00001104 int yyresult;
1105 /* Number of tokens to shift before error messages enabled. */
1106 int yyerrstatus;
1107 /* Lookahead token as an internal (translated) token number. */
1108 int yytoken = 0;
1109
1110 /* Three stacks and their tools:
1111 `yyss': related to states,
1112 `yyvs': related to semantic values,
1113 `yyls': related to locations.
1114
1115 Refer to the stacks thru separate pointers, to allow yyoverflow
1116 to reallocate them elsewhere. */
1117
1118 /* The state stack. */
1119 short yyssa[YYINITDEPTH];
1120 short *yyss = yyssa;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001121 register short *yyssp;
John Criswelld7881242006-01-17 17:01:34 +00001122
1123 /* The semantic value stack. */
1124 YYSTYPE yyvsa[YYINITDEPTH];
1125 YYSTYPE *yyvs = yyvsa;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001126 register YYSTYPE *yyvsp;
1127
1128
1129
1130#define YYPOPSTACK (yyvsp--, yyssp--)
1131
John Criswelld7881242006-01-17 17:01:34 +00001132 YYSIZE_T yystacksize = YYINITDEPTH;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001133
John Criswelld7881242006-01-17 17:01:34 +00001134 /* The variables used to return semantic value and location from the
1135 action routines. */
1136 YYSTYPE yyval;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001137
1138
John Criswelld7881242006-01-17 17:01:34 +00001139 /* When reducing, the number of symbols on the RHS of the reduced
1140 rule. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001141 int yylen;
1142
John Criswelld7881242006-01-17 17:01:34 +00001143 YYDPRINTF ((stderr, "Starting parse\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001144
1145 yystate = 0;
1146 yyerrstatus = 0;
1147 yynerrs = 0;
1148 yychar = YYEMPTY; /* Cause a token to be read. */
1149
1150 /* Initialize stack pointers.
1151 Waste one element of value and location stack
1152 so that they stay on the same level as the state stack.
1153 The wasted elements are never initialized. */
1154
John Criswelld7881242006-01-17 17:01:34 +00001155 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001156 yyvsp = yyvs;
1157
John Criswelld7881242006-01-17 17:01:34 +00001158 goto yysetstate;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001159
John Criswelld7881242006-01-17 17:01:34 +00001160/*------------------------------------------------------------.
1161| yynewstate -- Push a new state, which is found in yystate. |
1162`------------------------------------------------------------*/
1163 yynewstate:
1164 /* In all cases, when you get here, the value and location stacks
1165 have just been pushed. so pushing a state here evens the stacks.
1166 */
1167 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001168
John Criswelld7881242006-01-17 17:01:34 +00001169 yysetstate:
1170 *yyssp = yystate;
1171
1172 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001173 {
1174 /* Get the current used size of the three stacks, in elements. */
John Criswelld7881242006-01-17 17:01:34 +00001175 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001176
1177#ifdef yyoverflow
John Criswelld7881242006-01-17 17:01:34 +00001178 {
1179 /* Give user a chance to reallocate the stack. Use copies of
1180 these so that the &'s don't force the real ones into
1181 memory. */
1182 YYSTYPE *yyvs1 = yyvs;
1183 short *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001184
John Criswelld7881242006-01-17 17:01:34 +00001185
1186 /* Each stack pointer address is followed by the size of the
1187 data in use in that stack, in bytes. This used to be a
1188 conditional around just the two extra args, but that might
1189 be undefined if yyoverflow is a macro. */
1190 yyoverflow ("parser stack overflow",
1191 &yyss1, yysize * sizeof (*yyssp),
1192 &yyvs1, yysize * sizeof (*yyvsp),
1193
1194 &yystacksize);
1195
1196 yyss = yyss1;
1197 yyvs = yyvs1;
1198 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001199#else /* no yyoverflow */
John Criswelld7881242006-01-17 17:01:34 +00001200# ifndef YYSTACK_RELOCATE
1201 goto yyoverflowlab;
1202# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00001203 /* Extend the stack our own way. */
John Criswelld7881242006-01-17 17:01:34 +00001204 if (YYMAXDEPTH <= yystacksize)
1205 goto yyoverflowlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001206 yystacksize *= 2;
John Criswelld7881242006-01-17 17:01:34 +00001207 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001208 yystacksize = YYMAXDEPTH;
John Criswelld7881242006-01-17 17:01:34 +00001209
1210 {
1211 short *yyss1 = yyss;
1212 union yyalloc *yyptr =
1213 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1214 if (! yyptr)
1215 goto yyoverflowlab;
1216 YYSTACK_RELOCATE (yyss);
1217 YYSTACK_RELOCATE (yyvs);
1218
1219# undef YYSTACK_RELOCATE
1220 if (yyss1 != yyssa)
1221 YYSTACK_FREE (yyss1);
1222 }
1223# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001224#endif /* no yyoverflow */
1225
John Criswelld7881242006-01-17 17:01:34 +00001226 yyssp = yyss + yysize - 1;
1227 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001228
1229
John Criswelld7881242006-01-17 17:01:34 +00001230 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1231 (unsigned long int) yystacksize));
1232
1233 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001234 YYABORT;
1235 }
1236
John Criswelld7881242006-01-17 17:01:34 +00001237 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001238
1239 goto yybackup;
John Criswelld7881242006-01-17 17:01:34 +00001240
1241/*-----------.
1242| yybackup. |
1243`-----------*/
1244yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +00001245
1246/* Do appropriate processing given the current state. */
1247/* Read a lookahead token if we need one and don't already have one. */
1248/* yyresume: */
1249
1250 /* First try to decide what to do without reference to lookahead token. */
1251
1252 yyn = yypact[yystate];
John Criswelld7881242006-01-17 17:01:34 +00001253 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001254 goto yydefault;
1255
1256 /* Not known => get a lookahead token if don't already have one. */
1257
John Criswelld7881242006-01-17 17:01:34 +00001258 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001259 if (yychar == YYEMPTY)
1260 {
John Criswelld7881242006-01-17 17:01:34 +00001261 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001262 yychar = YYLEX;
1263 }
1264
John Criswelld7881242006-01-17 17:01:34 +00001265 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001266 {
John Criswelld7881242006-01-17 17:01:34 +00001267 yychar = yytoken = YYEOF;
1268 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001269 }
1270 else
1271 {
John Criswelld7881242006-01-17 17:01:34 +00001272 yytoken = YYTRANSLATE (yychar);
1273 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001274 }
1275
John Criswelld7881242006-01-17 17:01:34 +00001276 /* If the proper action on seeing token YYTOKEN is to reduce or to
1277 detect an error, take that action. */
1278 yyn += yytoken;
1279 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001280 goto yydefault;
1281 yyn = yytable[yyn];
John Criswelld7881242006-01-17 17:01:34 +00001282 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001283 {
John Criswelld7881242006-01-17 17:01:34 +00001284 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001285 goto yyerrlab;
1286 yyn = -yyn;
1287 goto yyreduce;
1288 }
1289
1290 if (yyn == YYFINAL)
1291 YYACCEPT;
1292
1293 /* Shift the lookahead token. */
John Criswelld7881242006-01-17 17:01:34 +00001294 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
Reid Spencer68a24bd2005-08-27 18:50:39 +00001295
1296 /* Discard the token being shifted unless it is eof. */
1297 if (yychar != YYEOF)
1298 yychar = YYEMPTY;
1299
1300 *++yyvsp = yylval;
1301
John Criswelld7881242006-01-17 17:01:34 +00001302
1303 /* Count tokens shifted since error; after three, turn off error
1304 status. */
1305 if (yyerrstatus)
1306 yyerrstatus--;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001307
1308 yystate = yyn;
1309 goto yynewstate;
1310
Chris Lattner8d354e92005-09-30 04:11:27 +00001311
John Criswelld7881242006-01-17 17:01:34 +00001312/*-----------------------------------------------------------.
1313| yydefault -- do the default action for the current state. |
1314`-----------------------------------------------------------*/
1315yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00001316 yyn = yydefact[yystate];
1317 if (yyn == 0)
1318 goto yyerrlab;
John Criswelld7881242006-01-17 17:01:34 +00001319 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001320
John Criswelld7881242006-01-17 17:01:34 +00001321
1322/*-----------------------------.
1323| yyreduce -- Do a reduction. |
1324`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00001325yyreduce:
John Criswelld7881242006-01-17 17:01:34 +00001326 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001327 yylen = yyr2[yyn];
1328
John Criswelld7881242006-01-17 17:01:34 +00001329 /* If YYLEN is nonzero, implement the default value of the action:
1330 `$$ = $1'.
1331
1332 Otherwise, the following line sets YYVAL to garbage.
1333 This behavior is undocumented and Bison
1334 users should not rely upon it. Assigning to YYVAL
1335 unconditionally makes the parser a bit smaller, and it avoids a
1336 GCC warning that YYVAL may be used uninitialized. */
1337 yyval = yyvsp[1-yylen];
1338
1339
1340 YY_REDUCE_PRINT (yyn);
1341 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001342 {
John Criswelld7881242006-01-17 17:01:34 +00001343 case 2:
1344#line 223 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1345 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001346 yyval.Rec = Records.getClass(*yyvsp[0].StrVal);
1347 if (yyval.Rec == 0) {
1348 err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n";
1349 exit(1);
1350 }
1351 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001352 ;}
1353 break;
1354
1355 case 3:
1356#line 234 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1357 { // string type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001358 yyval.Ty = new StringRecTy();
John Criswelld7881242006-01-17 17:01:34 +00001359 ;}
1360 break;
1361
1362 case 4:
1363#line 236 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1364 { // bit type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001365 yyval.Ty = new BitRecTy();
John Criswelld7881242006-01-17 17:01:34 +00001366 ;}
1367 break;
1368
1369 case 5:
1370#line 238 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1371 { // bits<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001372 yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal);
John Criswelld7881242006-01-17 17:01:34 +00001373 ;}
1374 break;
1375
1376 case 6:
1377#line 240 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1378 { // int type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001379 yyval.Ty = new IntRecTy();
John Criswelld7881242006-01-17 17:01:34 +00001380 ;}
1381 break;
1382
1383 case 7:
1384#line 242 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1385 { // list<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001386 yyval.Ty = new ListRecTy(yyvsp[-1].Ty);
John Criswelld7881242006-01-17 17:01:34 +00001387 ;}
1388 break;
1389
1390 case 8:
1391#line 244 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1392 { // code type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001393 yyval.Ty = new CodeRecTy();
John Criswelld7881242006-01-17 17:01:34 +00001394 ;}
1395 break;
1396
1397 case 9:
1398#line 246 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1399 { // dag type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001400 yyval.Ty = new DagRecTy();
John Criswelld7881242006-01-17 17:01:34 +00001401 ;}
1402 break;
1403
1404 case 10:
1405#line 248 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1406 { // Record Type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001407 yyval.Ty = new RecordRecTy(yyvsp[0].Rec);
John Criswelld7881242006-01-17 17:01:34 +00001408 ;}
1409 break;
1410
1411 case 11:
1412#line 252 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1413 { yyval.IntVal = 0; ;}
1414 break;
1415
1416 case 12:
1417#line 252 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1418 { yyval.IntVal = 1; ;}
1419 break;
1420
1421 case 13:
1422#line 254 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1423 { yyval.Initializer = 0; ;}
1424 break;
1425
1426 case 14:
1427#line 254 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1428 { yyval.Initializer = yyvsp[0].Initializer; ;}
1429 break;
1430
1431 case 15:
1432#line 256 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1433 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001434 yyval.Initializer = new IntInit(yyvsp[0].IntVal);
John Criswelld7881242006-01-17 17:01:34 +00001435 ;}
1436 break;
1437
1438 case 16:
1439#line 258 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1440 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001441 yyval.Initializer = new StringInit(*yyvsp[0].StrVal);
1442 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001443 ;}
1444 break;
1445
1446 case 17:
1447#line 261 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1448 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001449 yyval.Initializer = new CodeInit(*yyvsp[0].StrVal);
1450 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001451 ;}
1452 break;
1453
1454 case 18:
1455#line 264 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1456 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001457 yyval.Initializer = new UnsetInit();
John Criswelld7881242006-01-17 17:01:34 +00001458 ;}
1459 break;
1460
1461 case 19:
1462#line 266 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1463 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001464 BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size());
1465 for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) {
1466 struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy());
1467 if (Bit == 0) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001468 err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i]
1469 << ") is not convertable to a bit!\n";
1470 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001471 }
1472 Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit);
1473 }
1474 yyval.Initializer = Init;
1475 delete yyvsp[-1].FieldList;
John Criswelld7881242006-01-17 17:01:34 +00001476 ;}
1477 break;
1478
1479 case 20:
1480#line 279 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1481 {
Chris Lattnerca572be2005-09-08 18:48:47 +00001482 // This is a CLASS<initvalslist> expression. This is supposed to synthesize
1483 // a new anonymous definition, deriving from CLASS<initvalslist> with no
1484 // body.
1485 Record *Class = Records.getClass(*yyvsp[-3].StrVal);
1486 if (!Class) {
1487 err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n";
1488 exit(1);
1489 }
1490 delete yyvsp[-3].StrVal;
1491
1492 static unsigned AnonCounter = 0;
1493 Record *OldRec = CurRec; // Save CurRec.
1494
1495 // Create the new record, set it as CurRec temporarily.
1496 CurRec = new Record("anonymous.val."+utostr(AnonCounter++));
1497 addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec.
1498 delete yyvsp[-1].FieldList; // Free up the template args.
1499
Chris Lattner751eabf2005-09-08 19:47:28 +00001500 CurRec->resolveReferences();
Chris Lattnerca572be2005-09-08 18:48:47 +00001501
1502 Records.addDef(CurRec);
1503
1504 // The result of the expression is a reference to the new record.
1505 yyval.Initializer = new DefInit(CurRec);
1506
1507 // Restore the old CurRec
1508 CurRec = OldRec;
John Criswelld7881242006-01-17 17:01:34 +00001509 ;}
1510 break;
1511
1512 case 21:
1513#line 307 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1514 {
Chris Lattner2b931e82005-09-12 05:30:06 +00001515 if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) {
1516 yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType());
1517 } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) {
1518 const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal);
1519 assert(RV && "Template arg doesn't exist??");
1520 yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType());
1521 } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) {
1522 yyval.Initializer = new DefInit(D);
1523 } else {
1524 err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n";
1525 exit(1);
1526 }
1527
1528 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001529 ;}
1530 break;
1531
1532 case 22:
1533#line 322 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1534 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001535 yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList);
1536 if (yyval.Initializer == 0) {
1537 err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n";
1538 exit(1);
1539 }
1540 delete yyvsp[-1].BitList;
John Criswelld7881242006-01-17 17:01:34 +00001541 ;}
1542 break;
1543
1544 case 23:
1545#line 329 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1546 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001547 yyval.Initializer = new ListInit(*yyvsp[-1].FieldList);
1548 delete yyvsp[-1].FieldList;
John Criswelld7881242006-01-17 17:01:34 +00001549 ;}
1550 break;
1551
1552 case 24:
1553#line 332 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1554 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001555 if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) {
1556 err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n";
1557 exit(1);
1558 }
1559 yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal);
1560 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001561 ;}
1562 break;
1563
1564 case 25:
1565#line 339 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1566 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001567 Record *D = Records.getDef(*yyvsp[-2].StrVal);
1568 if (D == 0) {
1569 err() << "Invalid def '" << *yyvsp[-2].StrVal << "'!\n";
1570 exit(1);
1571 }
1572 yyval.Initializer = new DagInit(D, *yyvsp[-1].DagValueList);
1573 delete yyvsp[-2].StrVal; delete yyvsp[-1].DagValueList;
John Criswelld7881242006-01-17 17:01:34 +00001574 ;}
1575 break;
1576
1577 case 26:
1578#line 347 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1579 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001580 std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end());
1581 yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList);
1582 if (yyval.Initializer == 0) {
1583 err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n";
1584 exit(1);
1585 }
1586 delete yyvsp[-1].BitList;
John Criswelld7881242006-01-17 17:01:34 +00001587 ;}
1588 break;
1589
1590 case 27:
1591#line 355 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1592 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001593 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SHL, yyvsp[-1].Initializer);
1594 if (yyval.Initializer == 0) {
1595 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1596 exit(1);
1597 }
John Criswelld7881242006-01-17 17:01:34 +00001598 ;}
1599 break;
1600
1601 case 28:
1602#line 361 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1603 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001604 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRA, yyvsp[-1].Initializer);
1605 if (yyval.Initializer == 0) {
1606 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1607 exit(1);
1608 }
John Criswelld7881242006-01-17 17:01:34 +00001609 ;}
1610 break;
1611
1612 case 29:
1613#line 367 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1614 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001615 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRL, yyvsp[-1].Initializer);
1616 if (yyval.Initializer == 0) {
1617 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1618 exit(1);
1619 }
John Criswelld7881242006-01-17 17:01:34 +00001620 ;}
1621 break;
1622
1623 case 30:
1624#line 375 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1625 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001626 yyval.StrVal = new std::string();
John Criswelld7881242006-01-17 17:01:34 +00001627 ;}
1628 break;
1629
1630 case 31:
1631#line 378 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1632 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001633 yyval.StrVal = yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001634 ;}
1635 break;
1636
1637 case 32:
1638#line 382 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1639 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001640 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
1641 yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1642 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001643 ;}
1644 break;
1645
1646 case 33:
1647#line 387 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1648 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001649 yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1650 delete yyvsp[0].StrVal;
1651 yyval.DagValueList = yyvsp[-3].DagValueList;
John Criswelld7881242006-01-17 17:01:34 +00001652 ;}
1653 break;
1654
1655 case 34:
1656#line 393 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1657 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001658 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
John Criswelld7881242006-01-17 17:01:34 +00001659 ;}
1660 break;
1661
1662 case 35:
1663#line 396 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1664 { yyval.DagValueList = yyvsp[0].DagValueList; ;}
1665 break;
1666
1667 case 36:
1668#line 399 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1669 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001670 yyval.BitList = new std::vector<unsigned>();
1671 yyval.BitList->push_back(yyvsp[0].IntVal);
John Criswelld7881242006-01-17 17:01:34 +00001672 ;}
1673 break;
1674
1675 case 37:
1676#line 402 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1677 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001678 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1679 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1680 exit(1);
1681 }
1682 yyval.BitList = new std::vector<unsigned>();
1683 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1684 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1685 yyval.BitList->push_back(i);
1686 } else {
1687 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1688 yyval.BitList->push_back(i);
1689 }
John Criswelld7881242006-01-17 17:01:34 +00001690 ;}
1691 break;
1692
1693 case 38:
1694#line 415 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1695 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001696 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1697 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1698 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1699 exit(1);
1700 }
1701 yyval.BitList = new std::vector<unsigned>();
1702 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1703 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1704 yyval.BitList->push_back(i);
1705 } else {
1706 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1707 yyval.BitList->push_back(i);
1708 }
John Criswelld7881242006-01-17 17:01:34 +00001709 ;}
1710 break;
1711
1712 case 39:
1713#line 429 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1714 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001715 (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal);
John Criswelld7881242006-01-17 17:01:34 +00001716 ;}
1717 break;
1718
1719 case 40:
1720#line 431 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1721 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001722 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1723 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1724 exit(1);
1725 }
1726 yyval.BitList = yyvsp[-4].BitList;
1727 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1728 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1729 yyval.BitList->push_back(i);
1730 } else {
1731 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1732 yyval.BitList->push_back(i);
1733 }
John Criswelld7881242006-01-17 17:01:34 +00001734 ;}
1735 break;
1736
1737 case 41:
1738#line 444 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1739 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001740 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1741 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1742 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1743 exit(1);
1744 }
1745 yyval.BitList = yyvsp[-3].BitList;
1746 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1747 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1748 yyval.BitList->push_back(i);
1749 } else {
1750 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1751 yyval.BitList->push_back(i);
1752 }
John Criswelld7881242006-01-17 17:01:34 +00001753 ;}
1754 break;
1755
1756 case 42:
1757#line 460 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1758 { yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;}
1759 break;
1760
1761 case 43:
1762#line 462 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1763 { yyval.BitList = 0; ;}
1764 break;
1765
1766 case 44:
1767#line 462 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1768 { yyval.BitList = yyvsp[-1].BitList; ;}
1769 break;
1770
1771 case 45:
1772#line 466 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1773 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001774 yyval.FieldList = new std::vector<Init*>();
John Criswelld7881242006-01-17 17:01:34 +00001775 ;}
1776 break;
1777
1778 case 46:
1779#line 468 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1780 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001781 yyval.FieldList = yyvsp[0].FieldList;
John Criswelld7881242006-01-17 17:01:34 +00001782 ;}
1783 break;
1784
1785 case 47:
1786#line 472 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1787 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001788 yyval.FieldList = new std::vector<Init*>();
1789 yyval.FieldList->push_back(yyvsp[0].Initializer);
John Criswelld7881242006-01-17 17:01:34 +00001790 ;}
1791 break;
1792
1793 case 48:
1794#line 475 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1795 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001796 (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer);
John Criswelld7881242006-01-17 17:01:34 +00001797 ;}
1798 break;
1799
1800 case 49:
1801#line 479 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1802 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001803 std::string DecName = *yyvsp[-1].StrVal;
1804 if (ParsingTemplateArgs)
1805 DecName = CurRec->getName() + ":" + DecName;
1806
1807 addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal));
1808 setValue(DecName, 0, yyvsp[0].Initializer);
1809 yyval.StrVal = new std::string(DecName);
John Criswelld7881242006-01-17 17:01:34 +00001810;}
1811 break;
1812
1813 case 50:
1814#line 489 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1815 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001816 delete yyvsp[-1].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001817;}
1818 break;
1819
1820 case 51:
1821#line 491 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1822 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001823 setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer);
1824 delete yyvsp[-4].StrVal;
1825 delete yyvsp[-3].BitList;
John Criswelld7881242006-01-17 17:01:34 +00001826;}
1827 break;
1828
1829 case 56:
1830#line 500 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1831 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001832 yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>());
John Criswelld7881242006-01-17 17:01:34 +00001833 ;}
1834 break;
1835
1836 case 57:
1837#line 502 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1838 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001839 yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList);
John Criswelld7881242006-01-17 17:01:34 +00001840 ;}
1841 break;
1842
1843 case 58:
1844#line 506 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1845 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001846 yyval.SubClassList = new std::vector<SubClassRefTy>();
1847 yyval.SubClassList->push_back(*yyvsp[0].SubClassRef);
1848 delete yyvsp[0].SubClassRef;
John Criswelld7881242006-01-17 17:01:34 +00001849 ;}
1850 break;
1851
1852 case 59:
1853#line 511 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1854 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001855 (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef);
1856 delete yyvsp[0].SubClassRef;
John Criswelld7881242006-01-17 17:01:34 +00001857 ;}
1858 break;
1859
1860 case 60:
1861#line 516 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1862 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001863 yyval.SubClassList = new std::vector<SubClassRefTy>();
John Criswelld7881242006-01-17 17:01:34 +00001864 ;}
1865 break;
1866
1867 case 61:
1868#line 519 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1869 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001870 yyval.SubClassList = yyvsp[0].SubClassList;
John Criswelld7881242006-01-17 17:01:34 +00001871 ;}
1872 break;
1873
1874 case 62:
1875#line 523 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1876 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001877 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1878 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001879;}
1880 break;
1881
1882 case 63:
1883#line 526 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1884 {
Chris Lattnerca572be2005-09-08 18:48:47 +00001885 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1886 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001887;}
1888 break;
1889
1890 case 64:
1891#line 531 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1892 {;}
1893 break;
1894
1895 case 67:
1896#line 534 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1897 { yyval.StrVal = yyvsp[0].StrVal; ;}
1898 break;
1899
1900 case 68:
1901#line 534 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1902 { yyval.StrVal = new std::string(); ;}
1903 break;
1904
1905 case 69:
1906#line 536 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1907 {
Chris Lattner8d354e92005-09-30 04:11:27 +00001908 static unsigned AnonCounter = 0;
1909 if (yyvsp[0].StrVal->empty())
1910 *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++);
Chris Lattner946ac932005-09-30 04:53:25 +00001911 yyval.StrVal = yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001912;}
1913 break;
1914
1915 case 70:
1916#line 543 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1917 {
Chris Lattner946ac932005-09-30 04:53:25 +00001918 // If a class of this name already exists, it must be a forward ref.
Chris Lattner88b7e6e2005-09-30 06:09:50 +00001919 if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) {
Chris Lattner946ac932005-09-30 04:53:25 +00001920 // If the body was previously defined, this is an error.
1921 if (!CurRec->getValues().empty() ||
1922 !CurRec->getSuperClasses().empty() ||
1923 !CurRec->getTemplateArgs().empty()) {
1924 err() << "Class '" << CurRec->getName() << "' already defined!\n";
1925 exit(1);
1926 }
1927 } else {
1928 // If this is the first reference to this class, create and add it.
1929 CurRec = new Record(*yyvsp[0].StrVal);
1930 Records.addClass(CurRec);
Chris Lattner8d354e92005-09-30 04:11:27 +00001931 }
Chris Lattner946ac932005-09-30 04:53:25 +00001932 delete yyvsp[0].StrVal;
John Criswelld7881242006-01-17 17:01:34 +00001933;}
1934 break;
1935
1936 case 71:
1937#line 561 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1938 {
Chris Lattner946ac932005-09-30 04:53:25 +00001939 CurRec = new Record(*yyvsp[0].StrVal);
1940 delete yyvsp[0].StrVal;
1941
Chris Lattner8d354e92005-09-30 04:11:27 +00001942 // Ensure redefinition doesn't happen.
1943 if (Records.getDef(CurRec->getName())) {
1944 err() << "Def '" << CurRec->getName() << "' already defined!\n";
1945 exit(1);
1946 }
1947 Records.addDef(CurRec);
John Criswelld7881242006-01-17 17:01:34 +00001948;}
1949 break;
1950
1951 case 72:
1952#line 573 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1953 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001954 for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001955 addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001956 // Delete the template arg values for the class
1957 delete (*yyvsp[0].SubClassList)[i].second;
1958 }
1959 delete yyvsp[0].SubClassList; // Delete the class list...
Chris Lattner0a284052005-09-30 04:42:56 +00001960
Chris Lattnerba4b1442005-09-08 18:22:57 +00001961 // Process any variables on the set stack...
1962 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001963 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
1964 setValue(LetStack[i][j].Name,
1965 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
1966 LetStack[i][j].Value);
John Criswelld7881242006-01-17 17:01:34 +00001967 ;}
1968 break;
1969
1970 case 73:
1971#line 587 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1972 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001973 yyval.Rec = CurRec;
1974 CurRec = 0;
John Criswelld7881242006-01-17 17:01:34 +00001975 ;}
1976 break;
1977
1978 case 74:
1979#line 592 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1980 {
Chris Lattner946ac932005-09-30 04:53:25 +00001981 ParsingTemplateArgs = true;
John Criswelld7881242006-01-17 17:01:34 +00001982 ;}
1983 break;
1984
1985 case 75:
1986#line 594 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1987 {
Chris Lattner946ac932005-09-30 04:53:25 +00001988 ParsingTemplateArgs = false;
John Criswelld7881242006-01-17 17:01:34 +00001989 ;}
1990 break;
1991
1992 case 76:
1993#line 596 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
1994 {
Chris Lattner0a284052005-09-30 04:42:56 +00001995 yyval.Rec = yyvsp[0].Rec;
John Criswelld7881242006-01-17 17:01:34 +00001996 ;}
1997 break;
1998
1999 case 77:
2000#line 600 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2001 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00002002 yyvsp[0].Rec->resolveReferences();
2003
Chris Lattnerca572be2005-09-08 18:48:47 +00002004 // If ObjectBody has template arguments, it's an error.
Chris Lattner0a284052005-09-30 04:42:56 +00002005 assert(yyvsp[0].Rec->getTemplateArgs().empty() && "How'd this get template args?");
Chris Lattner8d354e92005-09-30 04:11:27 +00002006 yyval.Rec = yyvsp[0].Rec;
John Criswelld7881242006-01-17 17:01:34 +00002007;}
2008 break;
2009
2010 case 80:
2011#line 611 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2012 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00002013 LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer));
2014 delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList;
John Criswelld7881242006-01-17 17:01:34 +00002015;}
2016 break;
2017
2018 case 83:
2019#line 619 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2020 { LetStack.push_back(std::vector<LetRecord>()); ;}
2021 break;
2022
2023 case 85:
2024#line 622 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2025 {
Chris Lattner946ac932005-09-30 04:53:25 +00002026 LetStack.pop_back();
John Criswelld7881242006-01-17 17:01:34 +00002027 ;}
2028 break;
2029
2030 case 86:
2031#line 625 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2032 {
Chris Lattner946ac932005-09-30 04:53:25 +00002033 LetStack.pop_back();
John Criswelld7881242006-01-17 17:01:34 +00002034 ;}
2035 break;
2036
2037 case 87:
2038#line 629 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2039 {;}
2040 break;
2041
2042 case 88:
2043#line 629 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2044 {;}
2045 break;
2046
2047 case 89:
2048#line 631 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
2049 {;}
2050 break;
2051
2052
2053 }
2054
2055/* Line 999 of yacc.c. */
2056#line 2056 "FileParser.tab.c"
Reid Spencer68a24bd2005-08-27 18:50:39 +00002057
2058 yyvsp -= yylen;
2059 yyssp -= yylen;
2060
John Criswelld7881242006-01-17 17:01:34 +00002061
2062 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002063
2064 *++yyvsp = yyval;
2065
2066
John Criswelld7881242006-01-17 17:01:34 +00002067 /* Now `shift' the result of the reduction. Determine what state
2068 that goes to, based on the state we popped back to and the rule
2069 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002070
2071 yyn = yyr1[yyn];
2072
John Criswelld7881242006-01-17 17:01:34 +00002073 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2074 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002075 yystate = yytable[yystate];
2076 else
John Criswelld7881242006-01-17 17:01:34 +00002077 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00002078
2079 goto yynewstate;
2080
2081
John Criswelld7881242006-01-17 17:01:34 +00002082/*------------------------------------.
2083| yyerrlab -- here on detecting error |
2084`------------------------------------*/
2085yyerrlab:
2086 /* If not already recovering from an error, report this error. */
2087 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002088 {
2089 ++yynerrs;
John Criswelld7881242006-01-17 17:01:34 +00002090#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002091 yyn = yypact[yystate];
2092
John Criswelld7881242006-01-17 17:01:34 +00002093 if (YYPACT_NINF < yyn && yyn < YYLAST)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002094 {
John Criswelld7881242006-01-17 17:01:34 +00002095 YYSIZE_T yysize = 0;
2096 int yytype = YYTRANSLATE (yychar);
2097 char *yymsg;
2098 int yyx, yycount;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002099
John Criswelld7881242006-01-17 17:01:34 +00002100 yycount = 0;
2101 /* Start YYX at -YYN if negative to avoid negative indexes in
2102 YYCHECK. */
2103 for (yyx = yyn < 0 ? -yyn : 0;
2104 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
2105 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2106 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
2107 yysize += yystrlen ("syntax error, unexpected ") + 1;
2108 yysize += yystrlen (yytname[yytype]);
2109 yymsg = (char *) YYSTACK_ALLOC (yysize);
2110 if (yymsg != 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002111 {
John Criswelld7881242006-01-17 17:01:34 +00002112 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2113 yyp = yystpcpy (yyp, yytname[yytype]);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002114
John Criswelld7881242006-01-17 17:01:34 +00002115 if (yycount < 5)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002116 {
John Criswelld7881242006-01-17 17:01:34 +00002117 yycount = 0;
2118 for (yyx = yyn < 0 ? -yyn : 0;
2119 yyx < (int) (sizeof (yytname) / sizeof (char *));
2120 yyx++)
2121 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002122 {
John Criswelld7881242006-01-17 17:01:34 +00002123 const char *yyq = ! yycount ? ", expecting " : " or ";
2124 yyp = yystpcpy (yyp, yyq);
2125 yyp = yystpcpy (yyp, yytname[yyx]);
2126 yycount++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002127 }
2128 }
John Criswelld7881242006-01-17 17:01:34 +00002129 yyerror (yymsg);
2130 YYSTACK_FREE (yymsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002131 }
2132 else
John Criswelld7881242006-01-17 17:01:34 +00002133 yyerror ("syntax error; also virtual memory exhausted");
Reid Spencer68a24bd2005-08-27 18:50:39 +00002134 }
2135 else
2136#endif /* YYERROR_VERBOSE */
John Criswelld7881242006-01-17 17:01:34 +00002137 yyerror ("syntax error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00002138 }
2139
John Criswelld7881242006-01-17 17:01:34 +00002140
Reid Spencer68a24bd2005-08-27 18:50:39 +00002141
2142 if (yyerrstatus == 3)
2143 {
John Criswelld7881242006-01-17 17:01:34 +00002144 /* If just tried and failed to reuse lookahead token after an
2145 error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002146
John Criswelld7881242006-01-17 17:01:34 +00002147 /* Return failure if at end of input. */
Chris Lattnerba4b1442005-09-08 18:22:57 +00002148 if (yychar == YYEOF)
John Criswelld7881242006-01-17 17:01:34 +00002149 {
2150 /* Pop the error token. */
2151 YYPOPSTACK;
2152 /* Pop the rest of the stack. */
2153 while (yyss < yyssp)
2154 {
2155 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2156 yydestruct (yystos[*yyssp], yyvsp);
2157 YYPOPSTACK;
2158 }
2159 YYABORT;
2160 }
2161
2162 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2163 yydestruct (yytoken, &yylval);
2164 yychar = YYEMPTY;
2165
2166 }
2167
2168 /* Else will try to reuse lookahead token after shifting the error
2169 token. */
2170 goto yyerrlab1;
2171
2172
2173/*----------------------------------------------------.
2174| yyerrlab1 -- error raised explicitly by an action. |
2175`----------------------------------------------------*/
2176yyerrlab1:
2177 yyerrstatus = 3; /* Each real token shifted decrements this. */
2178
2179 for (;;)
2180 {
2181 yyn = yypact[yystate];
2182 if (yyn != YYPACT_NINF)
2183 {
2184 yyn += YYTERROR;
2185 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2186 {
2187 yyn = yytable[yyn];
2188 if (0 < yyn)
2189 break;
2190 }
2191 }
2192
2193 /* Pop the current state because it cannot handle the error token. */
2194 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002195 YYABORT;
2196
John Criswelld7881242006-01-17 17:01:34 +00002197 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2198 yydestruct (yystos[yystate], yyvsp);
2199 yyvsp--;
2200 yystate = *--yyssp;
Chris Lattnerba4b1442005-09-08 18:22:57 +00002201
John Criswelld7881242006-01-17 17:01:34 +00002202 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002203 }
2204
2205 if (yyn == YYFINAL)
2206 YYACCEPT;
2207
John Criswelld7881242006-01-17 17:01:34 +00002208 YYDPRINTF ((stderr, "Shifting error token, "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002209
2210 *++yyvsp = yylval;
John Criswelld7881242006-01-17 17:01:34 +00002211
Reid Spencer68a24bd2005-08-27 18:50:39 +00002212
2213 yystate = yyn;
2214 goto yynewstate;
2215
Chris Lattner2b931e82005-09-12 05:30:06 +00002216
John Criswelld7881242006-01-17 17:01:34 +00002217/*-------------------------------------.
2218| yyacceptlab -- YYACCEPT comes here. |
2219`-------------------------------------*/
2220yyacceptlab:
2221 yyresult = 0;
2222 goto yyreturn;
2223
2224/*-----------------------------------.
2225| yyabortlab -- YYABORT comes here. |
2226`-----------------------------------*/
2227yyabortlab:
2228 yyresult = 1;
2229 goto yyreturn;
2230
2231#ifndef yyoverflow
2232/*----------------------------------------------.
2233| yyoverflowlab -- parser overflow comes here. |
2234`----------------------------------------------*/
2235yyoverflowlab:
2236 yyerror ("parser stack overflow");
2237 yyresult = 2;
2238 /* Fall through. */
Chris Lattner2b931e82005-09-12 05:30:06 +00002239#endif
John Criswelld7881242006-01-17 17:01:34 +00002240
2241yyreturn:
2242#ifndef yyoverflow
2243 if (yyss != yyssa)
2244 YYSTACK_FREE (yyss);
2245#endif
2246 return yyresult;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002247}
John Criswelld7881242006-01-17 17:01:34 +00002248
2249
2250#line 633 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +00002251
2252
2253int yyerror(const char *ErrorMsg) {
2254 err() << "Error parsing: " << ErrorMsg << "\n";
2255 exit(1);
2256}
John Criswelld7881242006-01-17 17:01:34 +00002257