blob: d700e0ee0e2f3f70c077b2bacf13fed200468d6d [file] [log] [blame]
Reid Spencer68a24bd2005-08-27 18:50:39 +00001
Chris Lattnerba4b1442005-09-08 18:22:57 +00002/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y
3 by GNU Bison version 1.28 */
Reid Spencer68a24bd2005-08-27 18:50:39 +00004
Chris Lattnerba4b1442005-09-08 18:22:57 +00005#define YYBISON 1 /* Identify Bison output. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006
Reid Spencer68a24bd2005-08-27 18:50:39 +00007#define yyparse Fileparse
Chris Lattnerba4b1442005-09-08 18:22:57 +00008#define yylex Filelex
Reid Spencer68a24bd2005-08-27 18:50:39 +00009#define yyerror Fileerror
Chris Lattnerba4b1442005-09-08 18:22:57 +000010#define yylval Filelval
11#define yychar Filechar
Reid Spencer68a24bd2005-08-27 18:50:39 +000012#define yydebug Filedebug
13#define yynerrs Filenerrs
Chris Lattnerba4b1442005-09-08 18:22:57 +000014#define INT 257
15#define BIT 258
16#define STRING 259
17#define BITS 260
18#define LIST 261
19#define CODE 262
20#define DAG 263
21#define CLASS 264
22#define DEF 265
23#define FIELD 266
24#define LET 267
25#define IN 268
26#define SHLTOK 269
27#define SRATOK 270
28#define SRLTOK 271
29#define INTVAL 272
30#define ID 273
31#define VARNAME 274
32#define STRVAL 275
33#define CODEFRAGMENT 276
Reid Spencer68a24bd2005-08-27 18:50:39 +000034
Chris Lattnerba4b1442005-09-08 18:22:57 +000035#line 14 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +000036
37#include "Record.h"
38#include "llvm/ADT/StringExtras.h"
39#include <algorithm>
40#include <cstdio>
41#define YYERROR_VERBOSE 1
42
43int yyerror(const char *ErrorMsg);
44int yylex();
45
46namespace llvm {
47
48extern int Filelineno;
49static Record *CurRec = 0;
50static bool ParsingTemplateArgs = false;
51
52typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
53
54struct LetRecord {
55 std::string Name;
56 std::vector<unsigned> Bits;
57 Init *Value;
58 bool HasBits;
59 LetRecord(const std::string &N, std::vector<unsigned> *B, Init *V)
60 : Name(N), Value(V), HasBits(B != 0) {
61 if (HasBits) Bits = *B;
62 }
63};
64
65static std::vector<std::vector<LetRecord> > LetStack;
66
67
68extern std::ostream &err();
69
70static void addValue(const RecordVal &RV) {
71 if (RecordVal *ERV = CurRec->getValue(RV.getName())) {
72 // The value already exists in the class, treat this as a set...
73 if (ERV->setValue(RV.getValue())) {
74 err() << "New definition of '" << RV.getName() << "' of type '"
75 << *RV.getType() << "' is incompatible with previous "
76 << "definition of type '" << *ERV->getType() << "'!\n";
77 exit(1);
78 }
79 } else {
80 CurRec->addValue(RV);
81 }
82}
83
84static void addSuperClass(Record *SC) {
85 if (CurRec->isSubClassOf(SC)) {
86 err() << "Already subclass of '" << SC->getName() << "'!\n";
87 exit(1);
88 }
89 CurRec->addSuperClass(SC);
90}
91
92static void setValue(const std::string &ValName,
93 std::vector<unsigned> *BitList, Init *V) {
94 if (!V) return;
95
96 RecordVal *RV = CurRec->getValue(ValName);
97 if (RV == 0) {
98 err() << "Value '" << ValName << "' unknown!\n";
99 exit(1);
100 }
101
102 // Do not allow assignments like 'X = X'. This will just cause infinite loops
103 // in the resolution machinery.
104 if (!BitList)
105 if (VarInit *VI = dynamic_cast<VarInit*>(V))
106 if (VI->getName() == ValName)
107 return;
108
109 // If we are assigning to a subset of the bits in the value... then we must be
110 // assigning to a field of BitsRecTy, which must have a BitsInit
111 // initializer...
112 //
113 if (BitList) {
114 BitsInit *CurVal = dynamic_cast<BitsInit*>(RV->getValue());
115 if (CurVal == 0) {
116 err() << "Value '" << ValName << "' is not a bits type!\n";
117 exit(1);
118 }
119
120 // Convert the incoming value to a bits type of the appropriate size...
121 Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size()));
122 if (BI == 0) {
123 V->convertInitializerTo(new BitsRecTy(BitList->size()));
124 err() << "Initializer '" << *V << "' not compatible with bit range!\n";
125 exit(1);
126 }
127
128 // We should have a BitsInit type now...
129 assert(dynamic_cast<BitsInit*>(BI) != 0 || &(std::cerr << *BI) == 0);
130 BitsInit *BInit = (BitsInit*)BI;
131
132 BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
133
134 // Loop over bits, assigning values as appropriate...
135 for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
136 unsigned Bit = (*BitList)[i];
137 if (NewVal->getBit(Bit)) {
138 err() << "Cannot set bit #" << Bit << " of value '" << ValName
139 << "' more than once!\n";
140 exit(1);
141 }
142 NewVal->setBit(Bit, BInit->getBit(i));
143 }
144
145 for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
146 if (NewVal->getBit(i) == 0)
147 NewVal->setBit(i, CurVal->getBit(i));
148
149 V = NewVal;
150 }
151
152 if (RV->setValue(V)) {
153 err() << "Value '" << ValName << "' of type '" << *RV->getType()
154 << "' is incompatible with initializer '" << *V << "'!\n";
155 exit(1);
156 }
157}
158
159// addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's
160// template arguments.
161static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
162 // Add all of the values in the subclass into the current class...
163 const std::vector<RecordVal> &Vals = SC->getValues();
164 for (unsigned i = 0, e = Vals.size(); i != e; ++i)
165 addValue(Vals[i]);
166
167 const std::vector<std::string> &TArgs = SC->getTemplateArgs();
168
169 // Ensure that an appropriate number of template arguments are specified...
170 if (TArgs.size() < TemplateArgs.size()) {
171 err() << "ERROR: More template args specified than expected!\n";
172 exit(1);
173 } else { // This class expects template arguments...
174 // Loop over all of the template arguments, setting them to the specified
175 // value or leaving them as the default if necessary.
176 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
177 if (i < TemplateArgs.size()) { // A value is specified for this temp-arg?
Chris Lattnerba4b1442005-09-08 18:22:57 +0000178 // Set it now.
179 setValue(TArgs[i], 0, TemplateArgs[i]);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000180
181 // Resolve it next.
182 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
183
184
185 // Now remove it.
186 CurRec->removeValue(TArgs[i]);
187
188 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000189 err() << "ERROR: Value not specified for template argument #"
190 << i << " (" << TArgs[i] << ") of subclass '" << SC->getName()
191 << "'!\n";
192 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000193 }
194 }
195 }
196
197 // Since everything went well, we can now set the "superclass" list for the
198 // current record.
199 const std::vector<Record*> &SCs = SC->getSuperClasses();
200 for (unsigned i = 0, e = SCs.size(); i != e; ++i)
201 addSuperClass(SCs[i]);
202 addSuperClass(SC);
203}
204
205} // End llvm namespace
206
207using namespace llvm;
208
209
Chris Lattnerba4b1442005-09-08 18:22:57 +0000210#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
211typedef union {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000212 std::string* StrVal;
213 int IntVal;
214 llvm::RecTy* Ty;
215 llvm::Init* Initializer;
216 std::vector<llvm::Init*>* FieldList;
217 std::vector<unsigned>* BitList;
218 llvm::Record* Rec;
219 SubClassRefTy* SubClassRef;
220 std::vector<SubClassRefTy>* SubClassList;
221 std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
222} YYSTYPE;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000223#include <stdio.h>
224
225#ifndef __cplusplus
226#ifndef __STDC__
227#define const
228#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000229#endif
230
231
232
Chris Lattnerca572be2005-09-08 18:48:47 +0000233#define YYFINAL 155
Chris Lattnerba4b1442005-09-08 18:22:57 +0000234#define YYFLAG -32768
235#define YYNTBASE 38
Reid Spencer68a24bd2005-08-27 18:50:39 +0000236
Chris Lattnerba4b1442005-09-08 18:22:57 +0000237#define YYTRANSLATE(x) ((unsigned)(x) <= 276 ? yytranslate[x] : 74)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000238
Chris Lattnerba4b1442005-09-08 18:22:57 +0000239static const char yytranslate[] = { 0,
240 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
241 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
242 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
243 2, 2, 2, 2, 2, 2, 2, 2, 2, 32,
244 33, 2, 2, 34, 36, 31, 2, 2, 2, 2,
245 2, 2, 2, 2, 2, 2, 2, 35, 37, 23,
246 25, 24, 26, 2, 2, 2, 2, 2, 2, 2,
247 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
248 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
249 29, 2, 30, 2, 2, 2, 2, 2, 2, 2,
250 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
251 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
252 2, 2, 27, 2, 28, 2, 2, 2, 2, 2,
253 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
254 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
255 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
256 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
257 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
258 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
259 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
260 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
261 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
262 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
263 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
264 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
265 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
266 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
267 17, 18, 19, 20, 21, 22
268};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000269
Chris Lattnerba4b1442005-09-08 18:22:57 +0000270#if YYDEBUG != 0
271static const short yyprhs[] = { 0,
272 0, 2, 4, 6, 11, 13, 18, 20, 22, 24,
273 25, 27, 28, 31, 33, 35, 37, 39, 43, 45,
Chris Lattnerca572be2005-09-08 18:48:47 +0000274 50, 55, 59, 63, 68, 73, 80, 87, 94, 95,
275 98, 101, 106, 107, 109, 111, 115, 118, 122, 128,
276 133, 135, 136, 140, 141, 143, 145, 149, 154, 157,
277 164, 165, 168, 170, 174, 176, 181, 183, 187, 188,
278 191, 193, 197, 201, 202, 204, 206, 207, 208, 209,
279 216, 219, 222, 224, 226, 231, 233, 237, 238, 243,
280 248, 251, 253, 256
Chris Lattnerba4b1442005-09-08 18:22:57 +0000281};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000282
Chris Lattnerba4b1442005-09-08 18:22:57 +0000283static const short yyrhs[] = { 19,
284 0, 5, 0, 4, 0, 6, 23, 18, 24, 0,
285 3, 0, 7, 23, 39, 24, 0, 8, 0, 9,
286 0, 38, 0, 0, 12, 0, 0, 25, 42, 0,
287 18, 0, 21, 0, 22, 0, 26, 0, 27, 49,
Chris Lattnerca572be2005-09-08 18:48:47 +0000288 28, 0, 19, 0, 19, 23, 50, 24, 0, 42,
289 27, 47, 28, 0, 29, 49, 30, 0, 42, 31,
290 19, 0, 32, 19, 45, 33, 0, 42, 29, 47,
291 30, 0, 15, 32, 42, 34, 42, 33, 0, 16,
292 32, 42, 34, 42, 33, 0, 17, 32, 42, 34,
293 42, 33, 0, 0, 35, 20, 0, 42, 43, 0,
294 44, 34, 42, 43, 0, 0, 44, 0, 18, 0,
295 18, 36, 18, 0, 18, 18, 0, 46, 34, 18,
296 0, 46, 34, 18, 36, 18, 0, 46, 34, 18,
297 18, 0, 46, 0, 0, 27, 47, 28, 0, 0,
298 50, 0, 42, 0, 50, 34, 42, 0, 40, 39,
299 19, 41, 0, 51, 37, 0, 13, 19, 48, 25,
300 42, 37, 0, 0, 53, 52, 0, 37, 0, 27,
301 53, 28, 0, 38, 0, 38, 23, 50, 24, 0,
302 55, 0, 56, 34, 55, 0, 0, 35, 56, 0,
303 51, 0, 58, 34, 51, 0, 23, 58, 24, 0,
304 0, 59, 0, 19, 0, 0, 0, 0, 61, 63,
305 60, 57, 64, 54, 0, 10, 62, 0, 11, 62,
306 0, 65, 0, 66, 0, 19, 48, 25, 42, 0,
307 68, 0, 69, 34, 68, 0, 0, 13, 71, 69,
308 14, 0, 70, 27, 72, 28, 0, 70, 67, 0,
309 67, 0, 72, 67, 0, 72, 0
Chris Lattnerba4b1442005-09-08 18:22:57 +0000310};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000311
312#endif
313
Chris Lattnerba4b1442005-09-08 18:22:57 +0000314#if YYDEBUG != 0
315static const short yyrline[] = { 0,
316 223, 234, 236, 238, 240, 242, 244, 246, 248, 252,
317 252, 254, 254, 256, 258, 261, 264, 266, 279, 294,
Chris Lattnerca572be2005-09-08 18:48:47 +0000318 322, 329, 332, 339, 347, 355, 361, 367, 375, 378,
319 382, 387, 393, 396, 399, 402, 415, 429, 431, 444,
320 460, 462, 462, 466, 468, 472, 475, 479, 489, 491,
321 497, 497, 498, 498, 500, 502, 506, 511, 516, 519,
322 523, 526, 531, 532, 532, 534, 534, 536, 543, 558,
323 563, 571, 589, 589, 591, 596, 596, 599, 599, 602,
324 605, 609, 609, 611
Chris Lattnerba4b1442005-09-08 18:22:57 +0000325};
326#endif
327
328
329#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
330
331static const char * const yytname[] = { "$","error","$undefined.","INT","BIT",
332"STRING","BITS","LIST","CODE","DAG","CLASS","DEF","FIELD","LET","IN","SHLTOK",
333"SRATOK","SRLTOK","INTVAL","ID","VARNAME","STRVAL","CODEFRAGMENT","'<'","'>'",
334"'='","'?'","'{'","'}'","'['","']'","'.'","'('","')'","','","':'","'-'","';'",
335"ClassID","Type","OptPrefix","OptValue","Value","OptVarName","DagArgListNE",
336"DagArgList","RBitList","BitList","OptBitList","ValueList","ValueListNE","Declaration",
337"BodyItem","BodyList","Body","SubClassRef","ClassListNE","ClassList","DeclListNE",
338"TemplateArgList","OptTemplateArgList","OptID","ObjectBody","@1","@2","ClassInst",
339"DefInst","Object","LETItem","LETList","LETCommand","@3","ObjectList","File", NULL
340};
341#endif
342
343static const short yyr1[] = { 0,
344 38, 39, 39, 39, 39, 39, 39, 39, 39, 40,
345 40, 41, 41, 42, 42, 42, 42, 42, 42, 42,
Chris Lattnerca572be2005-09-08 18:48:47 +0000346 42, 42, 42, 42, 42, 42, 42, 42, 43, 43,
347 44, 44, 45, 45, 46, 46, 46, 46, 46, 46,
348 47, 48, 48, 49, 49, 50, 50, 51, 52, 52,
349 53, 53, 54, 54, 55, 55, 56, 56, 57, 57,
350 58, 58, 59, 60, 60, 61, 61, 63, 64, 62,
351 65, 66, 67, 67, 68, 69, 69, 71, 70, 67,
352 67, 72, 72, 73
Chris Lattnerba4b1442005-09-08 18:22:57 +0000353};
354
355static const short yyr2[] = { 0,
356 1, 1, 1, 4, 1, 4, 1, 1, 1, 0,
357 1, 0, 2, 1, 1, 1, 1, 3, 1, 4,
Chris Lattnerca572be2005-09-08 18:48:47 +0000358 4, 3, 3, 4, 4, 6, 6, 6, 0, 2,
359 2, 4, 0, 1, 1, 3, 2, 3, 5, 4,
360 1, 0, 3, 0, 1, 1, 3, 4, 2, 6,
361 0, 2, 1, 3, 1, 4, 1, 3, 0, 2,
362 1, 3, 3, 0, 1, 1, 0, 0, 0, 6,
363 2, 2, 1, 1, 4, 1, 3, 0, 4, 4,
364 2, 1, 2, 1
Chris Lattnerba4b1442005-09-08 18:22:57 +0000365};
366
367static const short yydefact[] = { 0,
Chris Lattnerca572be2005-09-08 18:48:47 +0000368 67, 67, 78, 73, 74, 82, 0, 84, 66, 68,
369 71, 72, 0, 0, 81, 83, 64, 42, 76, 0,
370 0, 10, 65, 59, 0, 0, 79, 0, 80, 11,
371 0, 61, 0, 0, 69, 35, 41, 0, 0, 77,
Chris Lattnerba4b1442005-09-08 18:22:57 +0000372 5, 3, 2, 0, 0, 7, 8, 1, 9, 0,
Chris Lattnerca572be2005-09-08 18:48:47 +0000373 63, 10, 55, 57, 60, 0, 37, 0, 0, 43,
374 0, 0, 0, 14, 19, 15, 16, 17, 44, 44,
375 0, 75, 0, 0, 12, 62, 0, 0, 51, 53,
376 70, 36, 38, 0, 0, 0, 0, 46, 0, 45,
377 0, 33, 0, 0, 0, 0, 0, 0, 48, 0,
378 58, 10, 40, 0, 0, 0, 0, 0, 18, 0,
379 22, 29, 34, 0, 0, 0, 23, 4, 6, 13,
380 56, 0, 54, 0, 52, 39, 0, 0, 0, 20,
381 47, 0, 31, 0, 24, 21, 25, 42, 49, 0,
382 0, 0, 30, 29, 0, 26, 27, 28, 32, 0,
383 0, 50, 0, 0, 0
Chris Lattnerba4b1442005-09-08 18:22:57 +0000384};
385
386static const short yydefgoto[] = { 49,
Chris Lattnerca572be2005-09-08 18:48:47 +0000387 50, 31, 99, 88, 133, 113, 114, 37, 38, 26,
388 89, 90, 32, 125, 102, 81, 54, 55, 35, 33,
Chris Lattnerba4b1442005-09-08 18:22:57 +0000389 23, 24, 10, 11, 17, 56, 4, 5, 6, 19,
Chris Lattnerca572be2005-09-08 18:48:47 +0000390 20, 7, 13, 8, 153
Chris Lattnerba4b1442005-09-08 18:22:57 +0000391};
392
Chris Lattnerca572be2005-09-08 18:48:47 +0000393static const short yypact[] = { 45,
394 -10, -10,-32768,-32768,-32768,-32768, 4, 45,-32768,-32768,
395-32768,-32768, -3, 45,-32768,-32768, 12, -7,-32768, -12,
396 -5, 24,-32768, 39, 23, 25,-32768, -3,-32768,-32768,
397 57,-32768, 15, 64,-32768, -15, 51, 58, 11,-32768,
398-32768,-32768,-32768, 68, 70,-32768,-32768,-32768,-32768, 78,
399-32768, 24, 80,-32768, 67, 17,-32768, 89, 91,-32768,
400 94, 95, 96,-32768, 98,-32768,-32768,-32768, 11, 11,
401 104, 93, 107, 57, 105,-32768, 11, 64,-32768,-32768,
402-32768,-32768, -11, 11, 11, 11, 11, 93, 101, 97,
403 102, 11, 23, 23, 114, 110, 111, 11,-32768, 18,
404-32768, 6,-32768, 118, 53, 65, 71, 33,-32768, 11,
405-32768, 46, 103, 106, 112, 108,-32768,-32768,-32768, 93,
406-32768, 122,-32768, 109,-32768,-32768, 11, 11, 11,-32768,
407 93, 123,-32768, 11,-32768,-32768,-32768, -7,-32768, 77,
408 85, 86,-32768, 46, 117,-32768,-32768,-32768,-32768, 11,
409 41,-32768, 144, 145,-32768
Chris Lattnerba4b1442005-09-08 18:22:57 +0000410};
411
412static const short yypgoto[] = { -30,
Chris Lattnerca572be2005-09-08 18:48:47 +0000413 73,-32768,-32768, -39, 5,-32768,-32768,-32768, -81, 10,
414 81, -8, -51,-32768,-32768,-32768, 72,-32768,-32768,-32768,
415-32768,-32768,-32768, 150,-32768,-32768,-32768,-32768, 3, 125,
416-32768,-32768,-32768, 140,-32768
Chris Lattnerba4b1442005-09-08 18:22:57 +0000417};
418
419
Chris Lattnerca572be2005-09-08 18:48:47 +0000420#define YYLAST 154
Chris Lattnerba4b1442005-09-08 18:22:57 +0000421
422
423static const short yytable[] = { 72,
Chris Lattnerca572be2005-09-08 18:48:47 +0000424 76, 27, 57, 53, 1, 2, 103, 3, 9, 15,
425 16, 115, 116, 1, 2, 18, 3, 30, 122, 25,
426 58, 28, 29, 16, 104, 61, 62, 63, 64, 65,
427 14, 66, 67, 123, 22, 30, 68, 69, 51, 70,
428 36, 121, 71, 79, 105, 106, 107, 53, 52, 39,
429 124, 110, 112, 80, 1, 2, 130, 3, 120, 41,
430 42, 43, 44, 45, 46, 47, 110, 93, 100, 94,
431 131, 95, 93, 34, 94, 48, 95, 152, 108, 93,
432 132, 94, 48, 95, 59, 60, 127, 140, 141, 142,
433 73, 93, 74, 94, 144, 95, 75, 93, 128, 94,
434 78, 95, 77, 93, 129, 94, 82, 95, 83, 146,
435 151, 93, 93, 94, 94, 95, 95, 147, 148, 93,
436 87, 94, 92, 95, 96, 84, 85, 86, 109, 98,
437 110, 111, 117, 118, 119, 126, 134, 137, 135, 136,
438 138, 150, 143, 154, 155, 139, 97, 145, 149, 101,
439 91, 12, 40, 21
Chris Lattnerba4b1442005-09-08 18:22:57 +0000440};
441
442static const short yycheck[] = { 39,
443 52, 14, 18, 34, 10, 11, 18, 13, 19, 7,
Chris Lattnerca572be2005-09-08 18:48:47 +0000444 8, 93, 94, 10, 11, 19, 13, 12, 13, 27,
Chris Lattnerba4b1442005-09-08 18:22:57 +0000445 36, 34, 28, 21, 36, 15, 16, 17, 18, 19,
446 27, 21, 22, 28, 23, 12, 26, 27, 24, 29,
Chris Lattnerca572be2005-09-08 18:48:47 +0000447 18, 24, 32, 27, 84, 85, 86, 78, 34, 25,
448 102, 34, 92, 37, 10, 11, 24, 13, 98, 3,
449 4, 5, 6, 7, 8, 9, 34, 27, 77, 29,
450 110, 31, 27, 35, 29, 19, 31, 37, 87, 27,
451 35, 29, 19, 31, 34, 28, 34, 127, 128, 129,
452 23, 27, 23, 29, 134, 31, 19, 27, 34, 29,
453 34, 31, 23, 27, 34, 29, 18, 31, 18, 33,
454 150, 27, 27, 29, 29, 31, 31, 33, 33, 27,
455 23, 29, 19, 31, 18, 32, 32, 32, 28, 25,
456 34, 30, 19, 24, 24, 18, 34, 30, 33, 28,
457 19, 25, 20, 0, 0, 37, 74, 138, 144, 78,
458 70, 2, 28, 14
Chris Lattnerba4b1442005-09-08 18:22:57 +0000459};
460/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
461#line 3 "/usr/share/bison.simple"
462/* This file comes from bison-1.28. */
463
464/* Skeleton output parser for bison,
465 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
466
467 This program is free software; you can redistribute it and/or modify
468 it under the terms of the GNU General Public License as published by
469 the Free Software Foundation; either version 2, or (at your option)
470 any later version.
471
472 This program is distributed in the hope that it will be useful,
473 but WITHOUT ANY WARRANTY; without even the implied warranty of
474 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
475 GNU General Public License for more details.
476
477 You should have received a copy of the GNU General Public License
478 along with this program; if not, write to the Free Software
479 Foundation, Inc., 59 Temple Place - Suite 330,
480 Boston, MA 02111-1307, USA. */
481
482/* As a special exception, when this file is copied by Bison into a
483 Bison output file, you may use that output file without restriction.
484 This special exception was added by the Free Software Foundation
485 in version 1.24 of Bison. */
486
487/* This is the parser code that is written into each bison parser
488 when the %semantic_parser declaration is not specified in the grammar.
489 It was written by Richard Stallman by simplifying the hairy parser
490 used when %semantic_parser is specified. */
491
492#ifndef YYSTACK_USE_ALLOCA
493#ifdef alloca
494#define YYSTACK_USE_ALLOCA
495#else /* alloca not defined */
496#ifdef __GNUC__
497#define YYSTACK_USE_ALLOCA
498#define alloca __builtin_alloca
499#else /* not GNU C. */
500#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
501#define YYSTACK_USE_ALLOCA
502#include <alloca.h>
503#else /* not sparc */
504/* We think this test detects Watcom and Microsoft C. */
505/* This used to test MSDOS, but that is a bad idea
506 since that symbol is in the user namespace. */
507#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
508#if 0 /* No need for malloc.h, which pollutes the namespace;
509 instead, just don't use alloca. */
510#include <malloc.h>
511#endif
512#else /* not MSDOS, or __TURBOC__ */
513#if defined(_AIX)
514/* I don't know what this was needed for, but it pollutes the namespace.
515 So I turned it off. rms, 2 May 1997. */
516/* #include <malloc.h> */
517 #pragma alloca
518#define YYSTACK_USE_ALLOCA
519#else /* not MSDOS, or __TURBOC__, or _AIX */
520#if 0
521#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
522 and on HPUX 10. Eventually we can turn this on. */
523#define YYSTACK_USE_ALLOCA
524#define alloca __builtin_alloca
525#endif /* __hpux */
526#endif
527#endif /* not _AIX */
528#endif /* not MSDOS, or __TURBOC__ */
529#endif /* not sparc */
530#endif /* not GNU C */
531#endif /* alloca not defined */
532#endif /* YYSTACK_USE_ALLOCA not defined */
533
534#ifdef YYSTACK_USE_ALLOCA
535#define YYSTACK_ALLOC alloca
Reid Spencer68a24bd2005-08-27 18:50:39 +0000536#else
Chris Lattnerba4b1442005-09-08 18:22:57 +0000537#define YYSTACK_ALLOC malloc
Reid Spencer68a24bd2005-08-27 18:50:39 +0000538#endif
539
Chris Lattnerba4b1442005-09-08 18:22:57 +0000540/* Note: there must be only one dollar sign in this file.
541 It is replaced by the list of actions, each action
542 as one case of the switch. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000543
544#define yyerrok (yyerrstatus = 0)
545#define yyclearin (yychar = YYEMPTY)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000546#define YYEMPTY -2
Reid Spencer68a24bd2005-08-27 18:50:39 +0000547#define YYEOF 0
Reid Spencer68a24bd2005-08-27 18:50:39 +0000548#define YYACCEPT goto yyacceptlab
Chris Lattnerba4b1442005-09-08 18:22:57 +0000549#define YYABORT goto yyabortlab
550#define YYERROR goto yyerrlab1
551/* Like YYERROR except do call yyerror.
552 This remains here temporarily to ease the
553 transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000554 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000555#define YYFAIL goto yyerrlab
Reid Spencer68a24bd2005-08-27 18:50:39 +0000556#define YYRECOVERING() (!!yyerrstatus)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000557#define YYBACKUP(token, value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000558do \
559 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattnerba4b1442005-09-08 18:22:57 +0000560 { yychar = (token), yylval = (value); \
561 yychar1 = YYTRANSLATE (yychar); \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000562 YYPOPSTACK; \
563 goto yybackup; \
564 } \
565 else \
Chris Lattnerba4b1442005-09-08 18:22:57 +0000566 { yyerror ("syntax error: cannot back up"); YYERROR; } \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000567while (0)
568
569#define YYTERROR 1
570#define YYERRCODE 256
571
Chris Lattnerba4b1442005-09-08 18:22:57 +0000572#ifndef YYPURE
573#define YYLEX yylex()
Reid Spencer68a24bd2005-08-27 18:50:39 +0000574#endif
575
Chris Lattnerba4b1442005-09-08 18:22:57 +0000576#ifdef YYPURE
577#ifdef YYLSP_NEEDED
Reid Spencer68a24bd2005-08-27 18:50:39 +0000578#ifdef YYLEX_PARAM
Chris Lattnerba4b1442005-09-08 18:22:57 +0000579#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000580#else
Chris Lattnerba4b1442005-09-08 18:22:57 +0000581#define YYLEX yylex(&yylval, &yylloc)
582#endif
583#else /* not YYLSP_NEEDED */
584#ifdef YYLEX_PARAM
585#define YYLEX yylex(&yylval, YYLEX_PARAM)
586#else
587#define YYLEX yylex(&yylval)
588#endif
589#endif /* not YYLSP_NEEDED */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000590#endif
591
Chris Lattnerba4b1442005-09-08 18:22:57 +0000592/* If nonreentrant, generate the variables here */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000593
Chris Lattnerba4b1442005-09-08 18:22:57 +0000594#ifndef YYPURE
Reid Spencer68a24bd2005-08-27 18:50:39 +0000595
Chris Lattnerba4b1442005-09-08 18:22:57 +0000596int yychar; /* the lookahead symbol */
597YYSTYPE yylval; /* the semantic value of the */
598 /* lookahead symbol */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000599
Chris Lattnerba4b1442005-09-08 18:22:57 +0000600#ifdef YYLSP_NEEDED
601YYLTYPE yylloc; /* location data for the lookahead */
602 /* symbol */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000603#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000604
Chris Lattnerba4b1442005-09-08 18:22:57 +0000605int yynerrs; /* number of parse errors so far */
606#endif /* not YYPURE */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000607
Chris Lattnerba4b1442005-09-08 18:22:57 +0000608#if YYDEBUG != 0
609int yydebug; /* nonzero means print parse trace */
610/* Since this is uninitialized, it does not stop multiple parsers
611 from coexisting. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000612#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000613
Chris Lattnerba4b1442005-09-08 18:22:57 +0000614/* YYINITDEPTH indicates the initial size of the parser's stacks */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000615
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616#ifndef YYINITDEPTH
Chris Lattnerba4b1442005-09-08 18:22:57 +0000617#define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +0000618#endif
619
Chris Lattnerba4b1442005-09-08 18:22:57 +0000620/* YYMAXDEPTH is the maximum size the stacks can grow to
621 (effective only if the built-in stack extension method is used). */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000622
Chris Lattnerba4b1442005-09-08 18:22:57 +0000623#if YYMAXDEPTH == 0
624#undef YYMAXDEPTH
Reid Spencer68a24bd2005-08-27 18:50:39 +0000625#endif
626
627#ifndef YYMAXDEPTH
Chris Lattnerba4b1442005-09-08 18:22:57 +0000628#define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +0000629#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000630
Chris Lattnerba4b1442005-09-08 18:22:57 +0000631/* Define __yy_memcpy. Note that the size argument
632 should be passed with type unsigned int, because that is what the non-GCC
633 definitions require. With GCC, __builtin_memcpy takes an arg
634 of type size_t, but it can handle unsigned int. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000635
Chris Lattnerba4b1442005-09-08 18:22:57 +0000636#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
637#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
638#else /* not GNU C or C++ */
639#ifndef __cplusplus
Reid Spencer68a24bd2005-08-27 18:50:39 +0000640
Chris Lattnerba4b1442005-09-08 18:22:57 +0000641/* This is the most reliable way to avoid incompatibilities
642 in available built-in functions on various systems. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000643static void
Chris Lattnerba4b1442005-09-08 18:22:57 +0000644__yy_memcpy (to, from, count)
645 char *to;
646 char *from;
647 unsigned int count;
648{
649 register char *f = from;
650 register char *t = to;
651 register int i = count;
652
653 while (i-- > 0)
654 *t++ = *f++;
655}
656
657#else /* __cplusplus */
658
659/* This is the most reliable way to avoid incompatibilities
660 in available built-in functions on various systems. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000661static void
Chris Lattnerba4b1442005-09-08 18:22:57 +0000662__yy_memcpy (char *to, char *from, unsigned int count)
663{
664 register char *t = to;
665 register char *f = from;
666 register int i = count;
667
668 while (i-- > 0)
669 *t++ = *f++;
670}
671
Reid Spencer68a24bd2005-08-27 18:50:39 +0000672#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000673#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000674
Chris Lattnerba4b1442005-09-08 18:22:57 +0000675#line 217 "/usr/share/bison.simple"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000676
Chris Lattnerba4b1442005-09-08 18:22:57 +0000677/* The user can define YYPARSE_PARAM as the name of an argument to be passed
678 into yyparse. The argument should have type void *.
679 It should actually point to an object.
680 Grammar actions can access the variable by casting it
681 to the proper pointer type. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000682
683#ifdef YYPARSE_PARAM
Chris Lattnerba4b1442005-09-08 18:22:57 +0000684#ifdef __cplusplus
685#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
686#define YYPARSE_PARAM_DECL
687#else /* not __cplusplus */
688#define YYPARSE_PARAM_ARG YYPARSE_PARAM
689#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
690#endif /* not __cplusplus */
691#else /* not YYPARSE_PARAM */
692#define YYPARSE_PARAM_ARG
693#define YYPARSE_PARAM_DECL
694#endif /* not YYPARSE_PARAM */
695
696/* Prevent warning if -Wstrict-prototypes. */
697#ifdef __GNUC__
698#ifdef YYPARSE_PARAM
699int yyparse (void *);
700#else
Reid Spencer68a24bd2005-08-27 18:50:39 +0000701int yyparse (void);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000702#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +0000703#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000704
Reid Spencer68a24bd2005-08-27 18:50:39 +0000705int
Chris Lattnerba4b1442005-09-08 18:22:57 +0000706yyparse(YYPARSE_PARAM_ARG)
707 YYPARSE_PARAM_DECL
Reid Spencer68a24bd2005-08-27 18:50:39 +0000708{
Reid Spencer68a24bd2005-08-27 18:50:39 +0000709 register int yystate;
710 register int yyn;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000711 register short *yyssp;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000712 register YYSTYPE *yyvsp;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000713 int yyerrstatus; /* number of tokens to shift before error messages enabled */
714 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000715
Chris Lattnerba4b1442005-09-08 18:22:57 +0000716 short yyssa[YYINITDEPTH]; /* the state stack */
717 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000718
Chris Lattnerba4b1442005-09-08 18:22:57 +0000719 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
720 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000721
Chris Lattnerba4b1442005-09-08 18:22:57 +0000722#ifdef YYLSP_NEEDED
723 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
724 YYLTYPE *yyls = yylsa;
725 YYLTYPE *yylsp;
726
727#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
728#else
Reid Spencer68a24bd2005-08-27 18:50:39 +0000729#define YYPOPSTACK (yyvsp--, yyssp--)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000730#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000731
Chris Lattnerba4b1442005-09-08 18:22:57 +0000732 int yystacksize = YYINITDEPTH;
733 int yyfree_stacks = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000734
Chris Lattnerba4b1442005-09-08 18:22:57 +0000735#ifdef YYPURE
736 int yychar;
737 YYSTYPE yylval;
738 int yynerrs;
739#ifdef YYLSP_NEEDED
740 YYLTYPE yylloc;
741#endif
742#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000743
Chris Lattnerba4b1442005-09-08 18:22:57 +0000744 YYSTYPE yyval; /* the variable used to return */
745 /* semantic values from the action */
746 /* routines */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000747
Reid Spencer68a24bd2005-08-27 18:50:39 +0000748 int yylen;
749
Chris Lattnerba4b1442005-09-08 18:22:57 +0000750#if YYDEBUG != 0
751 if (yydebug)
752 fprintf(stderr, "Starting parse\n");
753#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000754
755 yystate = 0;
756 yyerrstatus = 0;
757 yynerrs = 0;
758 yychar = YYEMPTY; /* Cause a token to be read. */
759
760 /* Initialize stack pointers.
761 Waste one element of value and location stack
762 so that they stay on the same level as the state stack.
763 The wasted elements are never initialized. */
764
Chris Lattnerba4b1442005-09-08 18:22:57 +0000765 yyssp = yyss - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000766 yyvsp = yyvs;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000767#ifdef YYLSP_NEEDED
768 yylsp = yyls;
769#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000770
Chris Lattnerba4b1442005-09-08 18:22:57 +0000771/* Push a new state, which is found in yystate . */
772/* In all cases, when you get here, the value and location stacks
773 have just been pushed. so pushing a state here evens the stacks. */
774yynewstate:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000775
Chris Lattnerba4b1442005-09-08 18:22:57 +0000776 *++yyssp = yystate;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000777
Chris Lattnerba4b1442005-09-08 18:22:57 +0000778 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000779 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000780 /* Give user a chance to reallocate the stack */
781 /* Use copies of these so that the &'s don't force the real ones into memory. */
782 YYSTYPE *yyvs1 = yyvs;
783 short *yyss1 = yyss;
784#ifdef YYLSP_NEEDED
785 YYLTYPE *yyls1 = yyls;
786#endif
787
Reid Spencer68a24bd2005-08-27 18:50:39 +0000788 /* Get the current used size of the three stacks, in elements. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000789 int size = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000790
791#ifdef yyoverflow
Chris Lattnerba4b1442005-09-08 18:22:57 +0000792 /* Each stack pointer address is followed by the size of
793 the data in use in that stack, in bytes. */
794#ifdef YYLSP_NEEDED
795 /* This used to be a conditional around just the two extra args,
796 but that might be undefined if yyoverflow is a macro. */
797 yyoverflow("parser stack overflow",
798 &yyss1, size * sizeof (*yyssp),
799 &yyvs1, size * sizeof (*yyvsp),
800 &yyls1, size * sizeof (*yylsp),
801 &yystacksize);
802#else
803 yyoverflow("parser stack overflow",
804 &yyss1, size * sizeof (*yyssp),
805 &yyvs1, size * sizeof (*yyvsp),
806 &yystacksize);
807#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000808
Chris Lattnerba4b1442005-09-08 18:22:57 +0000809 yyss = yyss1; yyvs = yyvs1;
810#ifdef YYLSP_NEEDED
811 yyls = yyls1;
812#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000813#else /* no yyoverflow */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000814 /* Extend the stack our own way. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000815 if (yystacksize >= YYMAXDEPTH)
816 {
817 yyerror("parser stack overflow");
818 if (yyfree_stacks)
819 {
820 free (yyss);
821 free (yyvs);
822#ifdef YYLSP_NEEDED
823 free (yyls);
824#endif
825 }
826 return 2;
827 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000828 yystacksize *= 2;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000829 if (yystacksize > YYMAXDEPTH)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000830 yystacksize = YYMAXDEPTH;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000831#ifndef YYSTACK_USE_ALLOCA
832 yyfree_stacks = 1;
833#endif
834 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
835 __yy_memcpy ((char *)yyss, (char *)yyss1,
836 size * (unsigned int) sizeof (*yyssp));
837 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
838 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
839 size * (unsigned int) sizeof (*yyvsp));
840#ifdef YYLSP_NEEDED
841 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
842 __yy_memcpy ((char *)yyls, (char *)yyls1,
843 size * (unsigned int) sizeof (*yylsp));
844#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000845#endif /* no yyoverflow */
846
Chris Lattnerba4b1442005-09-08 18:22:57 +0000847 yyssp = yyss + size - 1;
848 yyvsp = yyvs + size - 1;
849#ifdef YYLSP_NEEDED
850 yylsp = yyls + size - 1;
851#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000852
Chris Lattnerba4b1442005-09-08 18:22:57 +0000853#if YYDEBUG != 0
854 if (yydebug)
855 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
856#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000857
Chris Lattnerba4b1442005-09-08 18:22:57 +0000858 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000859 YYABORT;
860 }
861
Chris Lattnerba4b1442005-09-08 18:22:57 +0000862#if YYDEBUG != 0
863 if (yydebug)
864 fprintf(stderr, "Entering state %d\n", yystate);
865#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000866
867 goto yybackup;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000868 yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000869
870/* Do appropriate processing given the current state. */
871/* Read a lookahead token if we need one and don't already have one. */
872/* yyresume: */
873
874 /* First try to decide what to do without reference to lookahead token. */
875
876 yyn = yypact[yystate];
Chris Lattnerba4b1442005-09-08 18:22:57 +0000877 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000878 goto yydefault;
879
880 /* Not known => get a lookahead token if don't already have one. */
881
Chris Lattnerba4b1442005-09-08 18:22:57 +0000882 /* yychar is either YYEMPTY or YYEOF
883 or a valid token in external form. */
884
Reid Spencer68a24bd2005-08-27 18:50:39 +0000885 if (yychar == YYEMPTY)
886 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000887#if YYDEBUG != 0
888 if (yydebug)
889 fprintf(stderr, "Reading a token: ");
890#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000891 yychar = YYLEX;
892 }
893
Chris Lattnerba4b1442005-09-08 18:22:57 +0000894 /* Convert token to internal form (in yychar1) for indexing tables with */
895
896 if (yychar <= 0) /* This means end of input. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000897 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000898 yychar1 = 0;
899 yychar = YYEOF; /* Don't call YYLEX any more */
900
901#if YYDEBUG != 0
902 if (yydebug)
903 fprintf(stderr, "Now at end of input.\n");
904#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000905 }
906 else
907 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000908 yychar1 = YYTRANSLATE(yychar);
909
910#if YYDEBUG != 0
911 if (yydebug)
912 {
913 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
914 /* Give the individual parser a way to print the precise meaning
915 of a token, for further debugging info. */
916#ifdef YYPRINT
917 YYPRINT (stderr, yychar, yylval);
918#endif
919 fprintf (stderr, ")\n");
920 }
921#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000922 }
923
Chris Lattnerba4b1442005-09-08 18:22:57 +0000924 yyn += yychar1;
925 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000926 goto yydefault;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000927
Reid Spencer68a24bd2005-08-27 18:50:39 +0000928 yyn = yytable[yyn];
Chris Lattnerba4b1442005-09-08 18:22:57 +0000929
930 /* yyn is what to do for this token type in this state.
931 Negative => reduce, -yyn is rule number.
932 Positive => shift, yyn is new state.
933 New state is final state => don't bother to shift,
934 just return success.
935 0, or most negative number => error. */
936
937 if (yyn < 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000938 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000939 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000940 goto yyerrlab;
941 yyn = -yyn;
942 goto yyreduce;
943 }
Chris Lattnerba4b1442005-09-08 18:22:57 +0000944 else if (yyn == 0)
945 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000946
947 if (yyn == YYFINAL)
948 YYACCEPT;
949
950 /* Shift the lookahead token. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000951
952#if YYDEBUG != 0
953 if (yydebug)
954 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
955#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000956
957 /* Discard the token being shifted unless it is eof. */
958 if (yychar != YYEOF)
959 yychar = YYEMPTY;
960
961 *++yyvsp = yylval;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000962#ifdef YYLSP_NEEDED
963 *++yylsp = yylloc;
964#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000965
Chris Lattnerba4b1442005-09-08 18:22:57 +0000966 /* count tokens shifted since error; after three, turn off error status. */
967 if (yyerrstatus) yyerrstatus--;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000968
969 yystate = yyn;
970 goto yynewstate;
971
Chris Lattnerba4b1442005-09-08 18:22:57 +0000972/* Do the default action for the current state. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000973yydefault:
Chris Lattnerba4b1442005-09-08 18:22:57 +0000974
Reid Spencer68a24bd2005-08-27 18:50:39 +0000975 yyn = yydefact[yystate];
976 if (yyn == 0)
977 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000978
Chris Lattnerba4b1442005-09-08 18:22:57 +0000979/* Do a reduction. yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000980yyreduce:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000981 yylen = yyr2[yyn];
Chris Lattnerba4b1442005-09-08 18:22:57 +0000982 if (yylen > 0)
983 yyval = yyvsp[1-yylen]; /* implement default value of the action */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000984
Chris Lattnerba4b1442005-09-08 18:22:57 +0000985#if YYDEBUG != 0
986 if (yydebug)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000987 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000988 int i;
989
990 fprintf (stderr, "Reducing via rule %d (line %d), ",
991 yyn, yyrline[yyn]);
992
993 /* Print the symbols being reduced, and their result. */
994 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
995 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
996 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
997 }
998#endif
999
1000
1001 switch (yyn) {
1002
1003case 1:
1004#line 223 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1005{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001006 yyval.Rec = Records.getClass(*yyvsp[0].StrVal);
1007 if (yyval.Rec == 0) {
1008 err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n";
1009 exit(1);
1010 }
1011 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001012 ;
1013 break;}
1014case 2:
1015#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1016{ // string type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001017 yyval.Ty = new StringRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001018 ;
1019 break;}
1020case 3:
1021#line 236 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1022{ // bit type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001023 yyval.Ty = new BitRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001024 ;
1025 break;}
1026case 4:
1027#line 238 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1028{ // bits<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001029 yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001030 ;
1031 break;}
1032case 5:
1033#line 240 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1034{ // int type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001035 yyval.Ty = new IntRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001036 ;
1037 break;}
1038case 6:
1039#line 242 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1040{ // list<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001041 yyval.Ty = new ListRecTy(yyvsp[-1].Ty);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001042 ;
1043 break;}
1044case 7:
1045#line 244 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1046{ // code type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001047 yyval.Ty = new CodeRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001048 ;
1049 break;}
1050case 8:
1051#line 246 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1052{ // dag type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001053 yyval.Ty = new DagRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001054 ;
1055 break;}
1056case 9:
1057#line 248 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1058{ // Record Type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001059 yyval.Ty = new RecordRecTy(yyvsp[0].Rec);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001060 ;
1061 break;}
1062case 10:
1063#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1064{ yyval.IntVal = 0; ;
1065 break;}
1066case 11:
1067#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1068{ yyval.IntVal = 1; ;
1069 break;}
1070case 12:
1071#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1072{ yyval.Initializer = 0; ;
1073 break;}
1074case 13:
1075#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1076{ yyval.Initializer = yyvsp[0].Initializer; ;
1077 break;}
1078case 14:
1079#line 256 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1080{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001081 yyval.Initializer = new IntInit(yyvsp[0].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001082 ;
1083 break;}
1084case 15:
1085#line 258 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1086{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001087 yyval.Initializer = new StringInit(*yyvsp[0].StrVal);
1088 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001089 ;
1090 break;}
1091case 16:
1092#line 261 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1093{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001094 yyval.Initializer = new CodeInit(*yyvsp[0].StrVal);
1095 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001096 ;
1097 break;}
1098case 17:
1099#line 264 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1100{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001101 yyval.Initializer = new UnsetInit();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001102 ;
1103 break;}
1104case 18:
1105#line 266 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1106{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001107 BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size());
1108 for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) {
1109 struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy());
1110 if (Bit == 0) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001111 err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i]
1112 << ") is not convertable to a bit!\n";
1113 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001114 }
1115 Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit);
1116 }
1117 yyval.Initializer = Init;
1118 delete yyvsp[-1].FieldList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001119 ;
1120 break;}
1121case 19:
1122#line 279 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1123{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001124 if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) {
1125 yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType());
1126 } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) {
1127 const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal);
1128 assert(RV && "Template arg doesn't exist??");
1129 yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType());
1130 } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) {
1131 yyval.Initializer = new DefInit(D);
1132 } else {
1133 err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n";
1134 exit(1);
1135 }
1136
1137 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001138 ;
1139 break;}
1140case 20:
1141#line 294 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1142{
Chris Lattnerca572be2005-09-08 18:48:47 +00001143 // This is a CLASS<initvalslist> expression. This is supposed to synthesize
1144 // a new anonymous definition, deriving from CLASS<initvalslist> with no
1145 // body.
1146 Record *Class = Records.getClass(*yyvsp[-3].StrVal);
1147 if (!Class) {
1148 err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n";
1149 exit(1);
1150 }
1151 delete yyvsp[-3].StrVal;
1152
1153 static unsigned AnonCounter = 0;
1154 Record *OldRec = CurRec; // Save CurRec.
1155
1156 // Create the new record, set it as CurRec temporarily.
1157 CurRec = new Record("anonymous.val."+utostr(AnonCounter++));
1158 addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec.
1159 delete yyvsp[-1].FieldList; // Free up the template args.
1160
Chris Lattner751eabf2005-09-08 19:47:28 +00001161 CurRec->resolveReferences();
Chris Lattnerca572be2005-09-08 18:48:47 +00001162
1163 Records.addDef(CurRec);
1164
1165 // The result of the expression is a reference to the new record.
1166 yyval.Initializer = new DefInit(CurRec);
1167
1168 // Restore the old CurRec
1169 CurRec = OldRec;
1170 ;
1171 break;}
1172case 21:
1173#line 322 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1174{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001175 yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList);
1176 if (yyval.Initializer == 0) {
1177 err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n";
1178 exit(1);
1179 }
1180 delete yyvsp[-1].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001181 ;
1182 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001183case 22:
1184#line 329 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001185{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001186 yyval.Initializer = new ListInit(*yyvsp[-1].FieldList);
1187 delete yyvsp[-1].FieldList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001188 ;
1189 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001190case 23:
1191#line 332 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001192{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001193 if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) {
1194 err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n";
1195 exit(1);
1196 }
1197 yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal);
1198 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001199 ;
1200 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001201case 24:
1202#line 339 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001203{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001204 Record *D = Records.getDef(*yyvsp[-2].StrVal);
1205 if (D == 0) {
1206 err() << "Invalid def '" << *yyvsp[-2].StrVal << "'!\n";
1207 exit(1);
1208 }
1209 yyval.Initializer = new DagInit(D, *yyvsp[-1].DagValueList);
1210 delete yyvsp[-2].StrVal; delete yyvsp[-1].DagValueList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001211 ;
1212 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001213case 25:
1214#line 347 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001215{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001216 std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end());
1217 yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList);
1218 if (yyval.Initializer == 0) {
1219 err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n";
1220 exit(1);
1221 }
1222 delete yyvsp[-1].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001223 ;
1224 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001225case 26:
1226#line 355 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001227{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001228 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SHL, yyvsp[-1].Initializer);
1229 if (yyval.Initializer == 0) {
1230 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1231 exit(1);
1232 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001233 ;
1234 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001235case 27:
1236#line 361 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001237{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001238 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRA, yyvsp[-1].Initializer);
1239 if (yyval.Initializer == 0) {
1240 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1241 exit(1);
1242 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001243 ;
1244 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001245case 28:
1246#line 367 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001247{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001248 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRL, yyvsp[-1].Initializer);
1249 if (yyval.Initializer == 0) {
1250 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1251 exit(1);
1252 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001253 ;
1254 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001255case 29:
1256#line 375 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001257{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001258 yyval.StrVal = new std::string();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001259 ;
1260 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001261case 30:
1262#line 378 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001263{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001264 yyval.StrVal = yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001265 ;
1266 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001267case 31:
1268#line 382 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001269{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001270 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
1271 yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1272 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001273 ;
1274 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001275case 32:
1276#line 387 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001277{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001278 yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1279 delete yyvsp[0].StrVal;
1280 yyval.DagValueList = yyvsp[-3].DagValueList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001281 ;
1282 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001283case 33:
1284#line 393 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001285{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001286 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001287 ;
1288 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001289case 34:
1290#line 396 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001291{ yyval.DagValueList = yyvsp[0].DagValueList; ;
1292 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001293case 35:
1294#line 399 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001295{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001296 yyval.BitList = new std::vector<unsigned>();
1297 yyval.BitList->push_back(yyvsp[0].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001298 ;
1299 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001300case 36:
1301#line 402 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001302{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001303 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1304 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1305 exit(1);
1306 }
1307 yyval.BitList = new std::vector<unsigned>();
1308 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1309 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1310 yyval.BitList->push_back(i);
1311 } else {
1312 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1313 yyval.BitList->push_back(i);
1314 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001315 ;
1316 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001317case 37:
1318#line 415 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001319{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001320 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1321 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1322 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1323 exit(1);
1324 }
1325 yyval.BitList = new std::vector<unsigned>();
1326 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1327 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1328 yyval.BitList->push_back(i);
1329 } else {
1330 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1331 yyval.BitList->push_back(i);
1332 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001333 ;
1334 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001335case 38:
1336#line 429 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001337{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001338 (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001339 ;
1340 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001341case 39:
1342#line 431 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001343{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001344 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1345 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1346 exit(1);
1347 }
1348 yyval.BitList = yyvsp[-4].BitList;
1349 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1350 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1351 yyval.BitList->push_back(i);
1352 } else {
1353 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1354 yyval.BitList->push_back(i);
1355 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001356 ;
1357 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001358case 40:
1359#line 444 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001360{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001361 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1362 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1363 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1364 exit(1);
1365 }
1366 yyval.BitList = yyvsp[-3].BitList;
1367 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1368 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1369 yyval.BitList->push_back(i);
1370 } else {
1371 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1372 yyval.BitList->push_back(i);
1373 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001374 ;
1375 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001376case 41:
1377#line 460 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001378{ yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;
1379 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001380case 42:
1381#line 462 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001382{ yyval.BitList = 0; ;
1383 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001384case 43:
1385#line 462 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001386{ yyval.BitList = yyvsp[-1].BitList; ;
1387 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001388case 44:
1389#line 466 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001390{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001391 yyval.FieldList = new std::vector<Init*>();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001392 ;
1393 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001394case 45:
1395#line 468 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001396{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001397 yyval.FieldList = yyvsp[0].FieldList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001398 ;
1399 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001400case 46:
1401#line 472 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001402{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001403 yyval.FieldList = new std::vector<Init*>();
1404 yyval.FieldList->push_back(yyvsp[0].Initializer);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001405 ;
1406 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001407case 47:
1408#line 475 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001409{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001410 (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001411 ;
1412 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001413case 48:
1414#line 479 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001415{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001416 std::string DecName = *yyvsp[-1].StrVal;
1417 if (ParsingTemplateArgs)
1418 DecName = CurRec->getName() + ":" + DecName;
1419
1420 addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal));
1421 setValue(DecName, 0, yyvsp[0].Initializer);
1422 yyval.StrVal = new std::string(DecName);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001423;
1424 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001425case 49:
1426#line 489 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001427{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001428 delete yyvsp[-1].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001429;
1430 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001431case 50:
1432#line 491 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001433{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001434 setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer);
1435 delete yyvsp[-4].StrVal;
1436 delete yyvsp[-3].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001437;
1438 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001439case 55:
1440#line 500 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001441{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001442 yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>());
Chris Lattnerba4b1442005-09-08 18:22:57 +00001443 ;
1444 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001445case 56:
1446#line 502 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001447{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001448 yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001449 ;
1450 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001451case 57:
1452#line 506 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001453{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001454 yyval.SubClassList = new std::vector<SubClassRefTy>();
1455 yyval.SubClassList->push_back(*yyvsp[0].SubClassRef);
1456 delete yyvsp[0].SubClassRef;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001457 ;
1458 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001459case 58:
1460#line 511 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001461{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001462 (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef);
1463 delete yyvsp[0].SubClassRef;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001464 ;
1465 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001466case 59:
1467#line 516 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001468{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001469 yyval.SubClassList = new std::vector<SubClassRefTy>();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001470 ;
1471 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001472case 60:
1473#line 519 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001474{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001475 yyval.SubClassList = yyvsp[0].SubClassList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001476 ;
1477 break;}
Chris Lattnerba4b1442005-09-08 18:22:57 +00001478case 61:
Chris Lattnerca572be2005-09-08 18:48:47 +00001479#line 523 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001480{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001481 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1482 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001483;
1484 break;}
1485case 62:
Chris Lattnerca572be2005-09-08 18:48:47 +00001486#line 526 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1487{
1488 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1489 delete yyvsp[0].StrVal;
1490;
1491 break;}
1492case 63:
1493#line 531 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001494{;
1495 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001496case 66:
1497#line 534 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001498{ yyval.StrVal = yyvsp[0].StrVal; ;
1499 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001500case 67:
1501#line 534 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001502{ yyval.StrVal = new std::string(); ;
1503 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001504case 68:
1505#line 536 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001506{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001507 static unsigned AnonCounter = 0;
1508 if (yyvsp[0].StrVal->empty())
1509 *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++);
1510 CurRec = new Record(*yyvsp[0].StrVal);
1511 delete yyvsp[0].StrVal;
1512 ParsingTemplateArgs = true;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001513 ;
1514 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001515case 69:
1516#line 543 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001517{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001518 ParsingTemplateArgs = false;
1519 for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001520 addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001521 // Delete the template arg values for the class
1522 delete (*yyvsp[0].SubClassList)[i].second;
1523 }
1524 delete yyvsp[0].SubClassList; // Delete the class list...
1525
Chris Lattnerba4b1442005-09-08 18:22:57 +00001526 // Process any variables on the set stack...
1527 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001528 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
1529 setValue(LetStack[i][j].Name,
1530 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
1531 LetStack[i][j].Value);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001532 ;
1533 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001534case 70:
1535#line 558 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001536{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001537 yyval.Rec = CurRec;
1538 CurRec = 0;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001539 ;
1540 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001541case 71:
1542#line 563 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001543{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001544 if (Records.getClass(yyvsp[0].Rec->getName())) {
1545 err() << "Class '" << yyvsp[0].Rec->getName() << "' already defined!\n";
1546 exit(1);
1547 }
1548 Records.addClass(yyval.Rec = yyvsp[0].Rec);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001549;
1550 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001551case 72:
1552#line 571 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001553{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001554 yyvsp[0].Rec->resolveReferences();
1555
Chris Lattnerca572be2005-09-08 18:48:47 +00001556 // If ObjectBody has template arguments, it's an error.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001557 if (!yyvsp[0].Rec->getTemplateArgs().empty()) {
1558 err() << "Def '" << yyvsp[0].Rec->getName()
1559 << "' is not permitted to have template arguments!\n";
1560 exit(1);
1561 }
Chris Lattnerca572be2005-09-08 18:48:47 +00001562 // Ensure redefinition doesn't happen.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001563 if (Records.getDef(yyvsp[0].Rec->getName())) {
1564 err() << "Def '" << yyvsp[0].Rec->getName() << "' already defined!\n";
1565 exit(1);
1566 }
1567 Records.addDef(yyval.Rec = yyvsp[0].Rec);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001568;
1569 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001570case 75:
1571#line 591 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001572{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001573 LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer));
1574 delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001575;
1576 break;}
Chris Lattnerca572be2005-09-08 18:48:47 +00001577case 78:
1578#line 599 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001579{ LetStack.push_back(std::vector<LetRecord>()); ;
1580 break;}
Chris Lattnerba4b1442005-09-08 18:22:57 +00001581case 80:
Chris Lattnerca572be2005-09-08 18:48:47 +00001582#line 602 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001583{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001584 LetStack.pop_back();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001585 ;
1586 break;}
1587case 81:
Chris Lattnerca572be2005-09-08 18:48:47 +00001588#line 605 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1589{
1590 LetStack.pop_back();
1591 ;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001592 break;}
1593case 82:
Chris Lattnerca572be2005-09-08 18:48:47 +00001594#line 609 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001595{;
1596 break;}
1597case 83:
Chris Lattnerca572be2005-09-08 18:48:47 +00001598#line 609 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1599{;
1600 break;}
1601case 84:
1602#line 611 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerba4b1442005-09-08 18:22:57 +00001603{;
1604 break;}
1605}
1606 /* the action file gets copied in in place of this dollarsign */
1607#line 543 "/usr/share/bison.simple"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001608
1609 yyvsp -= yylen;
1610 yyssp -= yylen;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001611#ifdef YYLSP_NEEDED
1612 yylsp -= yylen;
1613#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001614
Chris Lattnerba4b1442005-09-08 18:22:57 +00001615#if YYDEBUG != 0
1616 if (yydebug)
1617 {
1618 short *ssp1 = yyss - 1;
1619 fprintf (stderr, "state stack now");
1620 while (ssp1 != yyssp)
1621 fprintf (stderr, " %d", *++ssp1);
1622 fprintf (stderr, "\n");
1623 }
1624#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001625
1626 *++yyvsp = yyval;
1627
Chris Lattnerba4b1442005-09-08 18:22:57 +00001628#ifdef YYLSP_NEEDED
1629 yylsp++;
1630 if (yylen == 0)
1631 {
1632 yylsp->first_line = yylloc.first_line;
1633 yylsp->first_column = yylloc.first_column;
1634 yylsp->last_line = (yylsp-1)->last_line;
1635 yylsp->last_column = (yylsp-1)->last_column;
1636 yylsp->text = 0;
1637 }
1638 else
1639 {
1640 yylsp->last_line = (yylsp+yylen-1)->last_line;
1641 yylsp->last_column = (yylsp+yylen-1)->last_column;
1642 }
1643#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001644
Chris Lattnerba4b1442005-09-08 18:22:57 +00001645 /* Now "shift" the result of the reduction.
1646 Determine what state that goes to,
1647 based on the state we popped back to
1648 and the rule number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001649
1650 yyn = yyr1[yyn];
1651
Chris Lattnerba4b1442005-09-08 18:22:57 +00001652 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1653 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001654 yystate = yytable[yystate];
1655 else
Chris Lattnerba4b1442005-09-08 18:22:57 +00001656 yystate = yydefgoto[yyn - YYNTBASE];
Reid Spencer68a24bd2005-08-27 18:50:39 +00001657
1658 goto yynewstate;
1659
Chris Lattnerba4b1442005-09-08 18:22:57 +00001660yyerrlab: /* here on detecting error */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001661
Chris Lattnerba4b1442005-09-08 18:22:57 +00001662 if (! yyerrstatus)
1663 /* If not already recovering from an error, report this error. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001664 {
1665 ++yynerrs;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001666
1667#ifdef YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00001668 yyn = yypact[yystate];
1669
Chris Lattnerba4b1442005-09-08 18:22:57 +00001670 if (yyn > YYFLAG && yyn < YYLAST)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001671 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001672 int size = 0;
1673 char *msg;
1674 int x, count;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001675
Chris Lattnerba4b1442005-09-08 18:22:57 +00001676 count = 0;
1677 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1678 for (x = (yyn < 0 ? -yyn : 0);
1679 x < (sizeof(yytname) / sizeof(char *)); x++)
1680 if (yycheck[x + yyn] == x)
1681 size += strlen(yytname[x]) + 15, count++;
1682 msg = (char *) malloc(size + 15);
1683 if (msg != 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001684 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001685 strcpy(msg, "parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001686
Chris Lattnerba4b1442005-09-08 18:22:57 +00001687 if (count < 5)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001688 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001689 count = 0;
1690 for (x = (yyn < 0 ? -yyn : 0);
1691 x < (sizeof(yytname) / sizeof(char *)); x++)
1692 if (yycheck[x + yyn] == x)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001693 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001694 strcat(msg, count == 0 ? ", expecting `" : " or `");
1695 strcat(msg, yytname[x]);
1696 strcat(msg, "'");
1697 count++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001698 }
1699 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001700 yyerror(msg);
1701 free(msg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001702 }
1703 else
Chris Lattnerba4b1442005-09-08 18:22:57 +00001704 yyerror ("parse error; also virtual memory exceeded");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001705 }
1706 else
1707#endif /* YYERROR_VERBOSE */
Chris Lattnerba4b1442005-09-08 18:22:57 +00001708 yyerror("parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001709 }
1710
Chris Lattnerba4b1442005-09-08 18:22:57 +00001711 goto yyerrlab1;
1712yyerrlab1: /* here on error raised explicitly by an action */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001713
1714 if (yyerrstatus == 3)
1715 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001716 /* if just tried and failed to reuse lookahead token after an error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001717
Chris Lattnerba4b1442005-09-08 18:22:57 +00001718 /* return failure if at end of input */
1719 if (yychar == YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001720 YYABORT;
1721
Chris Lattnerba4b1442005-09-08 18:22:57 +00001722#if YYDEBUG != 0
1723 if (yydebug)
1724 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1725#endif
1726
1727 yychar = YYEMPTY;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001728 }
1729
Chris Lattnerba4b1442005-09-08 18:22:57 +00001730 /* Else will try to reuse lookahead token
1731 after shifting the error token. */
1732
1733 yyerrstatus = 3; /* Each real token shifted decrements this */
1734
1735 goto yyerrhandle;
1736
1737yyerrdefault: /* current state does not do anything special for the error token. */
1738
1739#if 0
1740 /* This is wrong; only states that explicitly want error tokens
1741 should shift them. */
1742 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1743 if (yyn) goto yydefault;
1744#endif
1745
1746yyerrpop: /* pop the current state because it cannot handle the error token */
1747
1748 if (yyssp == yyss) YYABORT;
1749 yyvsp--;
1750 yystate = *--yyssp;
1751#ifdef YYLSP_NEEDED
1752 yylsp--;
1753#endif
1754
1755#if YYDEBUG != 0
1756 if (yydebug)
1757 {
1758 short *ssp1 = yyss - 1;
1759 fprintf (stderr, "Error: state stack now");
1760 while (ssp1 != yyssp)
1761 fprintf (stderr, " %d", *++ssp1);
1762 fprintf (stderr, "\n");
1763 }
1764#endif
1765
1766yyerrhandle:
1767
1768 yyn = yypact[yystate];
1769 if (yyn == YYFLAG)
1770 goto yyerrdefault;
1771
1772 yyn += YYTERROR;
1773 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1774 goto yyerrdefault;
1775
1776 yyn = yytable[yyn];
1777 if (yyn < 0)
1778 {
1779 if (yyn == YYFLAG)
1780 goto yyerrpop;
1781 yyn = -yyn;
1782 goto yyreduce;
1783 }
1784 else if (yyn == 0)
1785 goto yyerrpop;
1786
Reid Spencer68a24bd2005-08-27 18:50:39 +00001787 if (yyn == YYFINAL)
1788 YYACCEPT;
1789
Chris Lattnerba4b1442005-09-08 18:22:57 +00001790#if YYDEBUG != 0
1791 if (yydebug)
1792 fprintf(stderr, "Shifting error token, ");
1793#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001794
1795 *++yyvsp = yylval;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001796#ifdef YYLSP_NEEDED
1797 *++yylsp = yylloc;
1798#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001799
1800 yystate = yyn;
1801 goto yynewstate;
1802
Chris Lattnerba4b1442005-09-08 18:22:57 +00001803 yyacceptlab:
1804 /* YYACCEPT comes here. */
1805 if (yyfree_stacks)
1806 {
1807 free (yyss);
1808 free (yyvs);
1809#ifdef YYLSP_NEEDED
1810 free (yyls);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001811#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +00001812 }
1813 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001814
Chris Lattnerba4b1442005-09-08 18:22:57 +00001815 yyabortlab:
1816 /* YYABORT comes here. */
1817 if (yyfree_stacks)
1818 {
1819 free (yyss);
1820 free (yyvs);
1821#ifdef YYLSP_NEEDED
1822 free (yyls);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001823#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +00001824 }
1825 return 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001826}
Chris Lattnerca572be2005-09-08 18:48:47 +00001827#line 613 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001828
1829
1830int yyerror(const char *ErrorMsg) {
1831 err() << "Error parsing: " << ErrorMsg << "\n";
1832 exit(1);
1833}