blob: af813b51863db6c14e1decb44cf93a25c0673ae6 [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 Lattnerba4b1442005-09-08 18:22:57 +0000233#define YYFINAL 152
234#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,
274 50, 54, 58, 63, 68, 75, 82, 89, 90, 93,
275 96, 101, 102, 104, 106, 110, 113, 117, 123, 128,
276 130, 131, 135, 136, 138, 140, 144, 149, 152, 159,
277 160, 163, 165, 169, 171, 176, 178, 182, 183, 186,
278 188, 192, 196, 197, 199, 201, 202, 203, 204, 211,
279 214, 217, 219, 221, 226, 228, 232, 233, 238, 243,
280 246, 248, 251
281};
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,
288 28, 0, 19, 0, 42, 27, 47, 28, 0, 29,
289 49, 30, 0, 42, 31, 19, 0, 32, 19, 45,
290 33, 0, 42, 29, 47, 30, 0, 15, 32, 42,
291 34, 42, 33, 0, 16, 32, 42, 34, 42, 33,
292 0, 17, 32, 42, 34, 42, 33, 0, 0, 35,
293 20, 0, 42, 43, 0, 44, 34, 42, 43, 0,
294 0, 44, 0, 18, 0, 18, 36, 18, 0, 18,
295 18, 0, 46, 34, 18, 0, 46, 34, 18, 36,
296 18, 0, 46, 34, 18, 18, 0, 46, 0, 0,
297 27, 47, 28, 0, 0, 50, 0, 42, 0, 50,
298 34, 42, 0, 40, 39, 19, 41, 0, 51, 37,
299 0, 13, 19, 48, 25, 42, 37, 0, 0, 53,
300 52, 0, 37, 0, 27, 53, 28, 0, 38, 0,
301 38, 23, 50, 24, 0, 55, 0, 56, 34, 55,
302 0, 0, 35, 56, 0, 51, 0, 58, 34, 51,
303 0, 23, 58, 24, 0, 0, 59, 0, 19, 0,
304 0, 0, 0, 61, 63, 60, 57, 64, 54, 0,
305 10, 62, 0, 11, 62, 0, 65, 0, 66, 0,
306 19, 48, 25, 42, 0, 68, 0, 69, 34, 68,
307 0, 0, 13, 71, 69, 14, 0, 70, 27, 72,
308 28, 0, 70, 67, 0, 67, 0, 72, 67, 0,
309 72, 0
310};
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,
318 301, 304, 311, 319, 327, 333, 339, 347, 350, 354,
319 359, 365, 368, 371, 374, 387, 401, 403, 416, 432,
320 434, 434, 438, 440, 444, 447, 451, 461, 463, 469,
321 469, 470, 470, 472, 474, 478, 483, 488, 491, 495,
322 498, 503, 504, 504, 506, 506, 508, 515, 530, 535,
323 543, 560, 560, 562, 567, 567, 570, 570, 573, 576,
324 580, 580, 582
325};
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,
346 42, 42, 42, 42, 42, 42, 42, 43, 43, 44,
347 44, 45, 45, 46, 46, 46, 46, 46, 46, 47,
348 48, 48, 49, 49, 50, 50, 51, 52, 52, 53,
349 53, 54, 54, 55, 55, 56, 56, 57, 57, 58,
350 58, 59, 60, 60, 61, 61, 63, 64, 62, 65,
351 66, 67, 67, 68, 69, 69, 71, 70, 67, 67,
352 72, 72, 73
353};
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,
358 3, 3, 4, 4, 6, 6, 6, 0, 2, 2,
359 4, 0, 1, 1, 3, 2, 3, 5, 4, 1,
360 0, 3, 0, 1, 1, 3, 4, 2, 6, 0,
361 2, 1, 3, 1, 4, 1, 3, 0, 2, 1,
362 3, 3, 0, 1, 1, 0, 0, 0, 6, 2,
363 2, 1, 1, 4, 1, 3, 0, 4, 4, 2,
364 1, 2, 1
365};
366
367static const short yydefact[] = { 0,
368 66, 66, 77, 72, 73, 81, 0, 83, 65, 67,
369 70, 71, 0, 0, 80, 82, 63, 41, 75, 0,
370 0, 10, 64, 58, 0, 0, 78, 0, 79, 11,
371 0, 60, 0, 0, 68, 34, 40, 0, 0, 76,
372 5, 3, 2, 0, 0, 7, 8, 1, 9, 0,
373 62, 10, 54, 56, 59, 0, 36, 0, 0, 42,
374 0, 0, 0, 14, 19, 15, 16, 17, 43, 43,
375 0, 74, 0, 0, 12, 61, 0, 0, 50, 52,
376 69, 35, 37, 0, 0, 0, 45, 0, 44, 0,
377 32, 0, 0, 0, 0, 0, 0, 47, 0, 57,
378 10, 39, 0, 0, 0, 0, 18, 0, 21, 28,
379 33, 0, 0, 0, 22, 4, 6, 13, 55, 0,
380 53, 0, 51, 38, 0, 0, 0, 46, 0, 30,
381 0, 23, 20, 24, 41, 48, 0, 0, 0, 29,
382 28, 0, 25, 26, 27, 31, 0, 0, 49, 0,
383 0, 0
384};
385
386static const short yydefgoto[] = { 49,
387 50, 31, 98, 87, 130, 111, 112, 37, 38, 26,
388 88, 89, 32, 123, 101, 81, 54, 55, 35, 33,
389 23, 24, 10, 11, 17, 56, 4, 5, 6, 19,
390 20, 7, 13, 8, 150
391};
392
393static const short yypact[] = { 61,
394 -10, -10,-32768,-32768,-32768,-32768, 4, 61,-32768,-32768,
395-32768,-32768, -3, 61,-32768,-32768, 12, -7,-32768, -12,
396 -5, 24,-32768, 7, 38, 42,-32768, -3,-32768,-32768,
397 56,-32768, 15, 54,-32768, -15, 49, 66, 11,-32768,
398-32768,-32768,-32768, 67, 75,-32768,-32768,-32768,-32768, 81,
399-32768, 24, 78,-32768, 70, 14,-32768, 88, 99,-32768,
400 87, 89, 90,-32768,-32768,-32768,-32768,-32768, 11, 11,
401 101, 26, 105, 56, 100,-32768, 11, 54,-32768,-32768,
402-32768,-32768, -11, 11, 11, 11, 26, 96, 92, 97,
403 11, 38, 38, 109, 106, 107, 11,-32768, 20,-32768,
404 6,-32768, 111, 62, 68, 76,-32768, 11,-32768, 50,
405 98, 102, 108, 103,-32768,-32768,-32768, 26,-32768, 115,
406-32768, 104,-32768,-32768, 11, 11, 11, 26, 117,-32768,
407 11,-32768,-32768,-32768, -7,-32768, 51, 82, 85,-32768,
408 50, 113,-32768,-32768,-32768,-32768, 11, 39,-32768, 139,
409 140,-32768
410};
411
412static const short yypgoto[] = { -30,
413 69,-32768,-32768, -39, 1,-32768,-32768,-32768, -80, 9,
414 77, 71, -51,-32768,-32768,-32768, 72,-32768,-32768,-32768,
415-32768,-32768,-32768, 143,-32768,-32768,-32768,-32768, 3, 118,
416-32768,-32768,-32768, 135,-32768
417};
418
419
420#define YYLAST 150
421
422
423static const short yytable[] = { 72,
424 76, 27, 57, 53, 1, 2, 102, 3, 9, 15,
425 16, 113, 114, 1, 2, 18, 3, 30, 120, 25,
426 58, 28, 29, 16, 103, 61, 62, 63, 64, 65,
427 14, 66, 67, 121, 22, 30, 68, 69, 51, 70,
428 79, 34, 71, 119, 104, 105, 106, 53, 52, 122,
429 80, 110, 92, 108, 93, 36, 94, 118, 41, 42,
430 43, 44, 45, 46, 47, 92, 39, 93, 128, 94,
431 1, 2, 48, 3, 48, 149, 92, 92, 93, 93,
432 94, 94, 59, 143, 129, 137, 138, 139, 92, 73,
433 93, 141, 94, 60, 92, 125, 93, 74, 94, 75,
434 77, 126, 92, 78, 93, 82, 94, 148, 92, 127,
435 93, 92, 94, 93, 144, 94, 83, 145, 84, 91,
436 85, 86, 95, 107, 97, 108, 109, 115, 124, 116,
437 117, 131, 134, 135, 132, 133, 140, 147, 151, 152,
438 136, 146, 96, 142, 12, 40, 90, 99, 21, 100
439};
440
441static const short yycheck[] = { 39,
442 52, 14, 18, 34, 10, 11, 18, 13, 19, 7,
443 8, 92, 93, 10, 11, 19, 13, 12, 13, 27,
444 36, 34, 28, 21, 36, 15, 16, 17, 18, 19,
445 27, 21, 22, 28, 23, 12, 26, 27, 24, 29,
446 27, 35, 32, 24, 84, 85, 86, 78, 34, 101,
447 37, 91, 27, 34, 29, 18, 31, 97, 3, 4,
448 5, 6, 7, 8, 9, 27, 25, 29, 108, 31,
449 10, 11, 19, 13, 19, 37, 27, 27, 29, 29,
450 31, 31, 34, 33, 35, 125, 126, 127, 27, 23,
451 29, 131, 31, 28, 27, 34, 29, 23, 31, 19,
452 23, 34, 27, 34, 29, 18, 31, 147, 27, 34,
453 29, 27, 31, 29, 33, 31, 18, 33, 32, 19,
454 32, 32, 18, 28, 25, 34, 30, 19, 18, 24,
455 24, 34, 30, 19, 33, 28, 20, 25, 0, 0,
456 37, 141, 74, 135, 2, 28, 70, 77, 14, 78
457};
458/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
459#line 3 "/usr/share/bison.simple"
460/* This file comes from bison-1.28. */
461
462/* Skeleton output parser for bison,
463 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
464
465 This program is free software; you can redistribute it and/or modify
466 it under the terms of the GNU General Public License as published by
467 the Free Software Foundation; either version 2, or (at your option)
468 any later version.
469
470 This program is distributed in the hope that it will be useful,
471 but WITHOUT ANY WARRANTY; without even the implied warranty of
472 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
473 GNU General Public License for more details.
474
475 You should have received a copy of the GNU General Public License
476 along with this program; if not, write to the Free Software
477 Foundation, Inc., 59 Temple Place - Suite 330,
478 Boston, MA 02111-1307, USA. */
479
480/* As a special exception, when this file is copied by Bison into a
481 Bison output file, you may use that output file without restriction.
482 This special exception was added by the Free Software Foundation
483 in version 1.24 of Bison. */
484
485/* This is the parser code that is written into each bison parser
486 when the %semantic_parser declaration is not specified in the grammar.
487 It was written by Richard Stallman by simplifying the hairy parser
488 used when %semantic_parser is specified. */
489
490#ifndef YYSTACK_USE_ALLOCA
491#ifdef alloca
492#define YYSTACK_USE_ALLOCA
493#else /* alloca not defined */
494#ifdef __GNUC__
495#define YYSTACK_USE_ALLOCA
496#define alloca __builtin_alloca
497#else /* not GNU C. */
498#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
499#define YYSTACK_USE_ALLOCA
500#include <alloca.h>
501#else /* not sparc */
502/* We think this test detects Watcom and Microsoft C. */
503/* This used to test MSDOS, but that is a bad idea
504 since that symbol is in the user namespace. */
505#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
506#if 0 /* No need for malloc.h, which pollutes the namespace;
507 instead, just don't use alloca. */
508#include <malloc.h>
509#endif
510#else /* not MSDOS, or __TURBOC__ */
511#if defined(_AIX)
512/* I don't know what this was needed for, but it pollutes the namespace.
513 So I turned it off. rms, 2 May 1997. */
514/* #include <malloc.h> */
515 #pragma alloca
516#define YYSTACK_USE_ALLOCA
517#else /* not MSDOS, or __TURBOC__, or _AIX */
518#if 0
519#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
520 and on HPUX 10. Eventually we can turn this on. */
521#define YYSTACK_USE_ALLOCA
522#define alloca __builtin_alloca
523#endif /* __hpux */
524#endif
525#endif /* not _AIX */
526#endif /* not MSDOS, or __TURBOC__ */
527#endif /* not sparc */
528#endif /* not GNU C */
529#endif /* alloca not defined */
530#endif /* YYSTACK_USE_ALLOCA not defined */
531
532#ifdef YYSTACK_USE_ALLOCA
533#define YYSTACK_ALLOC alloca
Reid Spencer68a24bd2005-08-27 18:50:39 +0000534#else
Chris Lattnerba4b1442005-09-08 18:22:57 +0000535#define YYSTACK_ALLOC malloc
Reid Spencer68a24bd2005-08-27 18:50:39 +0000536#endif
537
Chris Lattnerba4b1442005-09-08 18:22:57 +0000538/* Note: there must be only one dollar sign in this file.
539 It is replaced by the list of actions, each action
540 as one case of the switch. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000541
542#define yyerrok (yyerrstatus = 0)
543#define yyclearin (yychar = YYEMPTY)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000544#define YYEMPTY -2
Reid Spencer68a24bd2005-08-27 18:50:39 +0000545#define YYEOF 0
Reid Spencer68a24bd2005-08-27 18:50:39 +0000546#define YYACCEPT goto yyacceptlab
Chris Lattnerba4b1442005-09-08 18:22:57 +0000547#define YYABORT goto yyabortlab
548#define YYERROR goto yyerrlab1
549/* Like YYERROR except do call yyerror.
550 This remains here temporarily to ease the
551 transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000552 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000553#define YYFAIL goto yyerrlab
Reid Spencer68a24bd2005-08-27 18:50:39 +0000554#define YYRECOVERING() (!!yyerrstatus)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000555#define YYBACKUP(token, value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000556do \
557 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattnerba4b1442005-09-08 18:22:57 +0000558 { yychar = (token), yylval = (value); \
559 yychar1 = YYTRANSLATE (yychar); \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000560 YYPOPSTACK; \
561 goto yybackup; \
562 } \
563 else \
Chris Lattnerba4b1442005-09-08 18:22:57 +0000564 { yyerror ("syntax error: cannot back up"); YYERROR; } \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000565while (0)
566
567#define YYTERROR 1
568#define YYERRCODE 256
569
Chris Lattnerba4b1442005-09-08 18:22:57 +0000570#ifndef YYPURE
571#define YYLEX yylex()
Reid Spencer68a24bd2005-08-27 18:50:39 +0000572#endif
573
Chris Lattnerba4b1442005-09-08 18:22:57 +0000574#ifdef YYPURE
575#ifdef YYLSP_NEEDED
Reid Spencer68a24bd2005-08-27 18:50:39 +0000576#ifdef YYLEX_PARAM
Chris Lattnerba4b1442005-09-08 18:22:57 +0000577#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000578#else
Chris Lattnerba4b1442005-09-08 18:22:57 +0000579#define YYLEX yylex(&yylval, &yylloc)
580#endif
581#else /* not YYLSP_NEEDED */
582#ifdef YYLEX_PARAM
583#define YYLEX yylex(&yylval, YYLEX_PARAM)
584#else
585#define YYLEX yylex(&yylval)
586#endif
587#endif /* not YYLSP_NEEDED */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000588#endif
589
Chris Lattnerba4b1442005-09-08 18:22:57 +0000590/* If nonreentrant, generate the variables here */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000591
Chris Lattnerba4b1442005-09-08 18:22:57 +0000592#ifndef YYPURE
Reid Spencer68a24bd2005-08-27 18:50:39 +0000593
Chris Lattnerba4b1442005-09-08 18:22:57 +0000594int yychar; /* the lookahead symbol */
595YYSTYPE yylval; /* the semantic value of the */
596 /* lookahead symbol */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000597
Chris Lattnerba4b1442005-09-08 18:22:57 +0000598#ifdef YYLSP_NEEDED
599YYLTYPE yylloc; /* location data for the lookahead */
600 /* symbol */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000601#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000602
Chris Lattnerba4b1442005-09-08 18:22:57 +0000603int yynerrs; /* number of parse errors so far */
604#endif /* not YYPURE */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000605
Chris Lattnerba4b1442005-09-08 18:22:57 +0000606#if YYDEBUG != 0
607int yydebug; /* nonzero means print parse trace */
608/* Since this is uninitialized, it does not stop multiple parsers
609 from coexisting. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000610#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000611
Chris Lattnerba4b1442005-09-08 18:22:57 +0000612/* YYINITDEPTH indicates the initial size of the parser's stacks */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000613
Reid Spencer68a24bd2005-08-27 18:50:39 +0000614#ifndef YYINITDEPTH
Chris Lattnerba4b1442005-09-08 18:22:57 +0000615#define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616#endif
617
Chris Lattnerba4b1442005-09-08 18:22:57 +0000618/* YYMAXDEPTH is the maximum size the stacks can grow to
619 (effective only if the built-in stack extension method is used). */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000620
Chris Lattnerba4b1442005-09-08 18:22:57 +0000621#if YYMAXDEPTH == 0
622#undef YYMAXDEPTH
Reid Spencer68a24bd2005-08-27 18:50:39 +0000623#endif
624
625#ifndef YYMAXDEPTH
Chris Lattnerba4b1442005-09-08 18:22:57 +0000626#define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +0000627#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000628
Chris Lattnerba4b1442005-09-08 18:22:57 +0000629/* Define __yy_memcpy. Note that the size argument
630 should be passed with type unsigned int, because that is what the non-GCC
631 definitions require. With GCC, __builtin_memcpy takes an arg
632 of type size_t, but it can handle unsigned int. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000633
Chris Lattnerba4b1442005-09-08 18:22:57 +0000634#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
635#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
636#else /* not GNU C or C++ */
637#ifndef __cplusplus
Reid Spencer68a24bd2005-08-27 18:50:39 +0000638
Chris Lattnerba4b1442005-09-08 18:22:57 +0000639/* This is the most reliable way to avoid incompatibilities
640 in available built-in functions on various systems. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000641static void
Chris Lattnerba4b1442005-09-08 18:22:57 +0000642__yy_memcpy (to, from, count)
643 char *to;
644 char *from;
645 unsigned int count;
646{
647 register char *f = from;
648 register char *t = to;
649 register int i = count;
650
651 while (i-- > 0)
652 *t++ = *f++;
653}
654
655#else /* __cplusplus */
656
657/* This is the most reliable way to avoid incompatibilities
658 in available built-in functions on various systems. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000659static void
Chris Lattnerba4b1442005-09-08 18:22:57 +0000660__yy_memcpy (char *to, char *from, unsigned int count)
661{
662 register char *t = to;
663 register char *f = from;
664 register int i = count;
665
666 while (i-- > 0)
667 *t++ = *f++;
668}
669
Reid Spencer68a24bd2005-08-27 18:50:39 +0000670#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000671#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000672
Chris Lattnerba4b1442005-09-08 18:22:57 +0000673#line 217 "/usr/share/bison.simple"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000674
Chris Lattnerba4b1442005-09-08 18:22:57 +0000675/* The user can define YYPARSE_PARAM as the name of an argument to be passed
676 into yyparse. The argument should have type void *.
677 It should actually point to an object.
678 Grammar actions can access the variable by casting it
679 to the proper pointer type. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000680
681#ifdef YYPARSE_PARAM
Chris Lattnerba4b1442005-09-08 18:22:57 +0000682#ifdef __cplusplus
683#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
684#define YYPARSE_PARAM_DECL
685#else /* not __cplusplus */
686#define YYPARSE_PARAM_ARG YYPARSE_PARAM
687#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
688#endif /* not __cplusplus */
689#else /* not YYPARSE_PARAM */
690#define YYPARSE_PARAM_ARG
691#define YYPARSE_PARAM_DECL
692#endif /* not YYPARSE_PARAM */
693
694/* Prevent warning if -Wstrict-prototypes. */
695#ifdef __GNUC__
696#ifdef YYPARSE_PARAM
697int yyparse (void *);
698#else
Reid Spencer68a24bd2005-08-27 18:50:39 +0000699int yyparse (void);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000700#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +0000701#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000702
Reid Spencer68a24bd2005-08-27 18:50:39 +0000703int
Chris Lattnerba4b1442005-09-08 18:22:57 +0000704yyparse(YYPARSE_PARAM_ARG)
705 YYPARSE_PARAM_DECL
Reid Spencer68a24bd2005-08-27 18:50:39 +0000706{
Reid Spencer68a24bd2005-08-27 18:50:39 +0000707 register int yystate;
708 register int yyn;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000709 register short *yyssp;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000710 register YYSTYPE *yyvsp;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000711 int yyerrstatus; /* number of tokens to shift before error messages enabled */
712 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000713
Chris Lattnerba4b1442005-09-08 18:22:57 +0000714 short yyssa[YYINITDEPTH]; /* the state stack */
715 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000716
Chris Lattnerba4b1442005-09-08 18:22:57 +0000717 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
718 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000719
Chris Lattnerba4b1442005-09-08 18:22:57 +0000720#ifdef YYLSP_NEEDED
721 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
722 YYLTYPE *yyls = yylsa;
723 YYLTYPE *yylsp;
724
725#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
726#else
Reid Spencer68a24bd2005-08-27 18:50:39 +0000727#define YYPOPSTACK (yyvsp--, yyssp--)
Chris Lattnerba4b1442005-09-08 18:22:57 +0000728#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000729
Chris Lattnerba4b1442005-09-08 18:22:57 +0000730 int yystacksize = YYINITDEPTH;
731 int yyfree_stacks = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000732
Chris Lattnerba4b1442005-09-08 18:22:57 +0000733#ifdef YYPURE
734 int yychar;
735 YYSTYPE yylval;
736 int yynerrs;
737#ifdef YYLSP_NEEDED
738 YYLTYPE yylloc;
739#endif
740#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000741
Chris Lattnerba4b1442005-09-08 18:22:57 +0000742 YYSTYPE yyval; /* the variable used to return */
743 /* semantic values from the action */
744 /* routines */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000745
Reid Spencer68a24bd2005-08-27 18:50:39 +0000746 int yylen;
747
Chris Lattnerba4b1442005-09-08 18:22:57 +0000748#if YYDEBUG != 0
749 if (yydebug)
750 fprintf(stderr, "Starting parse\n");
751#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000752
753 yystate = 0;
754 yyerrstatus = 0;
755 yynerrs = 0;
756 yychar = YYEMPTY; /* Cause a token to be read. */
757
758 /* Initialize stack pointers.
759 Waste one element of value and location stack
760 so that they stay on the same level as the state stack.
761 The wasted elements are never initialized. */
762
Chris Lattnerba4b1442005-09-08 18:22:57 +0000763 yyssp = yyss - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000764 yyvsp = yyvs;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000765#ifdef YYLSP_NEEDED
766 yylsp = yyls;
767#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000768
Chris Lattnerba4b1442005-09-08 18:22:57 +0000769/* Push a new state, which is found in yystate . */
770/* In all cases, when you get here, the value and location stacks
771 have just been pushed. so pushing a state here evens the stacks. */
772yynewstate:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000773
Chris Lattnerba4b1442005-09-08 18:22:57 +0000774 *++yyssp = yystate;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000775
Chris Lattnerba4b1442005-09-08 18:22:57 +0000776 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000777 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000778 /* Give user a chance to reallocate the stack */
779 /* Use copies of these so that the &'s don't force the real ones into memory. */
780 YYSTYPE *yyvs1 = yyvs;
781 short *yyss1 = yyss;
782#ifdef YYLSP_NEEDED
783 YYLTYPE *yyls1 = yyls;
784#endif
785
Reid Spencer68a24bd2005-08-27 18:50:39 +0000786 /* Get the current used size of the three stacks, in elements. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000787 int size = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000788
789#ifdef yyoverflow
Chris Lattnerba4b1442005-09-08 18:22:57 +0000790 /* Each stack pointer address is followed by the size of
791 the data in use in that stack, in bytes. */
792#ifdef YYLSP_NEEDED
793 /* This used to be a conditional around just the two extra args,
794 but that might be undefined if yyoverflow is a macro. */
795 yyoverflow("parser stack overflow",
796 &yyss1, size * sizeof (*yyssp),
797 &yyvs1, size * sizeof (*yyvsp),
798 &yyls1, size * sizeof (*yylsp),
799 &yystacksize);
800#else
801 yyoverflow("parser stack overflow",
802 &yyss1, size * sizeof (*yyssp),
803 &yyvs1, size * sizeof (*yyvsp),
804 &yystacksize);
805#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000806
Chris Lattnerba4b1442005-09-08 18:22:57 +0000807 yyss = yyss1; yyvs = yyvs1;
808#ifdef YYLSP_NEEDED
809 yyls = yyls1;
810#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000811#else /* no yyoverflow */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000812 /* Extend the stack our own way. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000813 if (yystacksize >= YYMAXDEPTH)
814 {
815 yyerror("parser stack overflow");
816 if (yyfree_stacks)
817 {
818 free (yyss);
819 free (yyvs);
820#ifdef YYLSP_NEEDED
821 free (yyls);
822#endif
823 }
824 return 2;
825 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000826 yystacksize *= 2;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000827 if (yystacksize > YYMAXDEPTH)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000828 yystacksize = YYMAXDEPTH;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000829#ifndef YYSTACK_USE_ALLOCA
830 yyfree_stacks = 1;
831#endif
832 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
833 __yy_memcpy ((char *)yyss, (char *)yyss1,
834 size * (unsigned int) sizeof (*yyssp));
835 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
836 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
837 size * (unsigned int) sizeof (*yyvsp));
838#ifdef YYLSP_NEEDED
839 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
840 __yy_memcpy ((char *)yyls, (char *)yyls1,
841 size * (unsigned int) sizeof (*yylsp));
842#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000843#endif /* no yyoverflow */
844
Chris Lattnerba4b1442005-09-08 18:22:57 +0000845 yyssp = yyss + size - 1;
846 yyvsp = yyvs + size - 1;
847#ifdef YYLSP_NEEDED
848 yylsp = yyls + size - 1;
849#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000850
Chris Lattnerba4b1442005-09-08 18:22:57 +0000851#if YYDEBUG != 0
852 if (yydebug)
853 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
854#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000855
Chris Lattnerba4b1442005-09-08 18:22:57 +0000856 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000857 YYABORT;
858 }
859
Chris Lattnerba4b1442005-09-08 18:22:57 +0000860#if YYDEBUG != 0
861 if (yydebug)
862 fprintf(stderr, "Entering state %d\n", yystate);
863#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000864
865 goto yybackup;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000866 yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000867
868/* Do appropriate processing given the current state. */
869/* Read a lookahead token if we need one and don't already have one. */
870/* yyresume: */
871
872 /* First try to decide what to do without reference to lookahead token. */
873
874 yyn = yypact[yystate];
Chris Lattnerba4b1442005-09-08 18:22:57 +0000875 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000876 goto yydefault;
877
878 /* Not known => get a lookahead token if don't already have one. */
879
Chris Lattnerba4b1442005-09-08 18:22:57 +0000880 /* yychar is either YYEMPTY or YYEOF
881 or a valid token in external form. */
882
Reid Spencer68a24bd2005-08-27 18:50:39 +0000883 if (yychar == YYEMPTY)
884 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000885#if YYDEBUG != 0
886 if (yydebug)
887 fprintf(stderr, "Reading a token: ");
888#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000889 yychar = YYLEX;
890 }
891
Chris Lattnerba4b1442005-09-08 18:22:57 +0000892 /* Convert token to internal form (in yychar1) for indexing tables with */
893
894 if (yychar <= 0) /* This means end of input. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000895 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000896 yychar1 = 0;
897 yychar = YYEOF; /* Don't call YYLEX any more */
898
899#if YYDEBUG != 0
900 if (yydebug)
901 fprintf(stderr, "Now at end of input.\n");
902#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000903 }
904 else
905 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000906 yychar1 = YYTRANSLATE(yychar);
907
908#if YYDEBUG != 0
909 if (yydebug)
910 {
911 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
912 /* Give the individual parser a way to print the precise meaning
913 of a token, for further debugging info. */
914#ifdef YYPRINT
915 YYPRINT (stderr, yychar, yylval);
916#endif
917 fprintf (stderr, ")\n");
918 }
919#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000920 }
921
Chris Lattnerba4b1442005-09-08 18:22:57 +0000922 yyn += yychar1;
923 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000924 goto yydefault;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000925
Reid Spencer68a24bd2005-08-27 18:50:39 +0000926 yyn = yytable[yyn];
Chris Lattnerba4b1442005-09-08 18:22:57 +0000927
928 /* yyn is what to do for this token type in this state.
929 Negative => reduce, -yyn is rule number.
930 Positive => shift, yyn is new state.
931 New state is final state => don't bother to shift,
932 just return success.
933 0, or most negative number => error. */
934
935 if (yyn < 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000936 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000937 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000938 goto yyerrlab;
939 yyn = -yyn;
940 goto yyreduce;
941 }
Chris Lattnerba4b1442005-09-08 18:22:57 +0000942 else if (yyn == 0)
943 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000944
945 if (yyn == YYFINAL)
946 YYACCEPT;
947
948 /* Shift the lookahead token. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000949
950#if YYDEBUG != 0
951 if (yydebug)
952 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
953#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000954
955 /* Discard the token being shifted unless it is eof. */
956 if (yychar != YYEOF)
957 yychar = YYEMPTY;
958
959 *++yyvsp = yylval;
Chris Lattnerba4b1442005-09-08 18:22:57 +0000960#ifdef YYLSP_NEEDED
961 *++yylsp = yylloc;
962#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000963
Chris Lattnerba4b1442005-09-08 18:22:57 +0000964 /* count tokens shifted since error; after three, turn off error status. */
965 if (yyerrstatus) yyerrstatus--;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000966
967 yystate = yyn;
968 goto yynewstate;
969
Chris Lattnerba4b1442005-09-08 18:22:57 +0000970/* Do the default action for the current state. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000971yydefault:
Chris Lattnerba4b1442005-09-08 18:22:57 +0000972
Reid Spencer68a24bd2005-08-27 18:50:39 +0000973 yyn = yydefact[yystate];
974 if (yyn == 0)
975 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000976
Chris Lattnerba4b1442005-09-08 18:22:57 +0000977/* Do a reduction. yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000978yyreduce:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000979 yylen = yyr2[yyn];
Chris Lattnerba4b1442005-09-08 18:22:57 +0000980 if (yylen > 0)
981 yyval = yyvsp[1-yylen]; /* implement default value of the action */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000982
Chris Lattnerba4b1442005-09-08 18:22:57 +0000983#if YYDEBUG != 0
984 if (yydebug)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000985 {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000986 int i;
987
988 fprintf (stderr, "Reducing via rule %d (line %d), ",
989 yyn, yyrline[yyn]);
990
991 /* Print the symbols being reduced, and their result. */
992 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
993 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
994 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
995 }
996#endif
997
998
999 switch (yyn) {
1000
1001case 1:
1002#line 223 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1003{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001004 yyval.Rec = Records.getClass(*yyvsp[0].StrVal);
1005 if (yyval.Rec == 0) {
1006 err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n";
1007 exit(1);
1008 }
1009 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001010 ;
1011 break;}
1012case 2:
1013#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1014{ // string type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001015 yyval.Ty = new StringRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001016 ;
1017 break;}
1018case 3:
1019#line 236 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1020{ // bit type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001021 yyval.Ty = new BitRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001022 ;
1023 break;}
1024case 4:
1025#line 238 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1026{ // bits<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001027 yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001028 ;
1029 break;}
1030case 5:
1031#line 240 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1032{ // int type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001033 yyval.Ty = new IntRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001034 ;
1035 break;}
1036case 6:
1037#line 242 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1038{ // list<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001039 yyval.Ty = new ListRecTy(yyvsp[-1].Ty);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001040 ;
1041 break;}
1042case 7:
1043#line 244 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1044{ // code type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001045 yyval.Ty = new CodeRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001046 ;
1047 break;}
1048case 8:
1049#line 246 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1050{ // dag type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001051 yyval.Ty = new DagRecTy();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001052 ;
1053 break;}
1054case 9:
1055#line 248 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1056{ // Record Type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001057 yyval.Ty = new RecordRecTy(yyvsp[0].Rec);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001058 ;
1059 break;}
1060case 10:
1061#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1062{ yyval.IntVal = 0; ;
1063 break;}
1064case 11:
1065#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1066{ yyval.IntVal = 1; ;
1067 break;}
1068case 12:
1069#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1070{ yyval.Initializer = 0; ;
1071 break;}
1072case 13:
1073#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1074{ yyval.Initializer = yyvsp[0].Initializer; ;
1075 break;}
1076case 14:
1077#line 256 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1078{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001079 yyval.Initializer = new IntInit(yyvsp[0].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001080 ;
1081 break;}
1082case 15:
1083#line 258 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1084{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001085 yyval.Initializer = new StringInit(*yyvsp[0].StrVal);
1086 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001087 ;
1088 break;}
1089case 16:
1090#line 261 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1091{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001092 yyval.Initializer = new CodeInit(*yyvsp[0].StrVal);
1093 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001094 ;
1095 break;}
1096case 17:
1097#line 264 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1098{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001099 yyval.Initializer = new UnsetInit();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001100 ;
1101 break;}
1102case 18:
1103#line 266 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1104{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001105 BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size());
1106 for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) {
1107 struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy());
1108 if (Bit == 0) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001109 err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i]
1110 << ") is not convertable to a bit!\n";
1111 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001112 }
1113 Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit);
1114 }
1115 yyval.Initializer = Init;
1116 delete yyvsp[-1].FieldList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001117 ;
1118 break;}
1119case 19:
1120#line 279 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1121{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001122 if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) {
1123 yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType());
1124 } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) {
1125 const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal);
1126 assert(RV && "Template arg doesn't exist??");
1127 yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType());
1128 } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) {
1129 yyval.Initializer = new DefInit(D);
1130 } else {
1131 err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n";
1132 exit(1);
1133 }
1134
1135 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001136 ;
1137 break;}
1138case 20:
1139#line 294 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1140{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001141 yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList);
1142 if (yyval.Initializer == 0) {
1143 err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n";
1144 exit(1);
1145 }
1146 delete yyvsp[-1].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001147 ;
1148 break;}
1149case 21:
1150#line 301 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1151{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001152 yyval.Initializer = new ListInit(*yyvsp[-1].FieldList);
1153 delete yyvsp[-1].FieldList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001154 ;
1155 break;}
1156case 22:
1157#line 304 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1158{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001159 if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) {
1160 err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n";
1161 exit(1);
1162 }
1163 yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal);
1164 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001165 ;
1166 break;}
1167case 23:
1168#line 311 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1169{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001170 Record *D = Records.getDef(*yyvsp[-2].StrVal);
1171 if (D == 0) {
1172 err() << "Invalid def '" << *yyvsp[-2].StrVal << "'!\n";
1173 exit(1);
1174 }
1175 yyval.Initializer = new DagInit(D, *yyvsp[-1].DagValueList);
1176 delete yyvsp[-2].StrVal; delete yyvsp[-1].DagValueList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001177 ;
1178 break;}
1179case 24:
1180#line 319 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1181{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001182 std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end());
1183 yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList);
1184 if (yyval.Initializer == 0) {
1185 err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n";
1186 exit(1);
1187 }
1188 delete yyvsp[-1].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001189 ;
1190 break;}
1191case 25:
1192#line 327 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1193{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001194 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SHL, yyvsp[-1].Initializer);
1195 if (yyval.Initializer == 0) {
1196 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1197 exit(1);
1198 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001199 ;
1200 break;}
1201case 26:
1202#line 333 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1203{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001204 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRA, yyvsp[-1].Initializer);
1205 if (yyval.Initializer == 0) {
1206 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1207 exit(1);
1208 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001209 ;
1210 break;}
1211case 27:
1212#line 339 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1213{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001214 yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRL, yyvsp[-1].Initializer);
1215 if (yyval.Initializer == 0) {
1216 err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n";
1217 exit(1);
1218 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001219 ;
1220 break;}
1221case 28:
1222#line 347 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1223{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001224 yyval.StrVal = new std::string();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001225 ;
1226 break;}
1227case 29:
1228#line 350 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1229{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001230 yyval.StrVal = yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001231 ;
1232 break;}
1233case 30:
1234#line 354 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1235{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001236 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
1237 yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1238 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001239 ;
1240 break;}
1241case 31:
1242#line 359 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1243{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001244 yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1245 delete yyvsp[0].StrVal;
1246 yyval.DagValueList = yyvsp[-3].DagValueList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001247 ;
1248 break;}
1249case 32:
1250#line 365 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1251{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001252 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001253 ;
1254 break;}
1255case 33:
1256#line 368 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1257{ yyval.DagValueList = yyvsp[0].DagValueList; ;
1258 break;}
1259case 34:
1260#line 371 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1261{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001262 yyval.BitList = new std::vector<unsigned>();
1263 yyval.BitList->push_back(yyvsp[0].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001264 ;
1265 break;}
1266case 35:
1267#line 374 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1268{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001269 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1270 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1271 exit(1);
1272 }
1273 yyval.BitList = new std::vector<unsigned>();
1274 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1275 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1276 yyval.BitList->push_back(i);
1277 } else {
1278 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1279 yyval.BitList->push_back(i);
1280 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001281 ;
1282 break;}
1283case 36:
1284#line 387 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1285{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001286 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1287 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1288 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1289 exit(1);
1290 }
1291 yyval.BitList = new std::vector<unsigned>();
1292 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1293 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1294 yyval.BitList->push_back(i);
1295 } else {
1296 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1297 yyval.BitList->push_back(i);
1298 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001299 ;
1300 break;}
1301case 37:
1302#line 401 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1303{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001304 (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001305 ;
1306 break;}
1307case 38:
1308#line 403 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1309{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001310 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1311 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1312 exit(1);
1313 }
1314 yyval.BitList = yyvsp[-4].BitList;
1315 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1316 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1317 yyval.BitList->push_back(i);
1318 } else {
1319 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1320 yyval.BitList->push_back(i);
1321 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001322 ;
1323 break;}
1324case 39:
1325#line 416 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1326{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001327 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1328 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1329 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1330 exit(1);
1331 }
1332 yyval.BitList = yyvsp[-3].BitList;
1333 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1334 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1335 yyval.BitList->push_back(i);
1336 } else {
1337 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1338 yyval.BitList->push_back(i);
1339 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001340 ;
1341 break;}
1342case 40:
1343#line 432 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1344{ yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;
1345 break;}
1346case 41:
1347#line 434 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1348{ yyval.BitList = 0; ;
1349 break;}
1350case 42:
1351#line 434 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1352{ yyval.BitList = yyvsp[-1].BitList; ;
1353 break;}
1354case 43:
1355#line 438 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1356{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001357 yyval.FieldList = new std::vector<Init*>();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001358 ;
1359 break;}
1360case 44:
1361#line 440 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1362{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001363 yyval.FieldList = yyvsp[0].FieldList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001364 ;
1365 break;}
1366case 45:
1367#line 444 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1368{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001369 yyval.FieldList = new std::vector<Init*>();
1370 yyval.FieldList->push_back(yyvsp[0].Initializer);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001371 ;
1372 break;}
1373case 46:
1374#line 447 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1375{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001376 (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001377 ;
1378 break;}
1379case 47:
1380#line 451 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1381{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001382 std::string DecName = *yyvsp[-1].StrVal;
1383 if (ParsingTemplateArgs)
1384 DecName = CurRec->getName() + ":" + DecName;
1385
1386 addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal));
1387 setValue(DecName, 0, yyvsp[0].Initializer);
1388 yyval.StrVal = new std::string(DecName);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001389;
1390 break;}
1391case 48:
1392#line 461 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1393{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001394 delete yyvsp[-1].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001395;
1396 break;}
1397case 49:
1398#line 463 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1399{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001400 setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer);
1401 delete yyvsp[-4].StrVal;
1402 delete yyvsp[-3].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001403;
1404 break;}
1405case 54:
1406#line 472 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1407{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001408 yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>());
Chris Lattnerba4b1442005-09-08 18:22:57 +00001409 ;
1410 break;}
1411case 55:
1412#line 474 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1413{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001414 yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001415 ;
1416 break;}
1417case 56:
1418#line 478 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1419{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001420 yyval.SubClassList = new std::vector<SubClassRefTy>();
1421 yyval.SubClassList->push_back(*yyvsp[0].SubClassRef);
1422 delete yyvsp[0].SubClassRef;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001423 ;
1424 break;}
1425case 57:
1426#line 483 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1427{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001428 (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef);
1429 delete yyvsp[0].SubClassRef;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001430 ;
1431 break;}
1432case 58:
1433#line 488 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1434{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001435 yyval.SubClassList = new std::vector<SubClassRefTy>();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001436 ;
1437 break;}
1438case 59:
1439#line 491 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1440{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001441 yyval.SubClassList = yyvsp[0].SubClassList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001442 ;
1443 break;}
1444case 60:
1445#line 495 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1446{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001447 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1448 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001449;
1450 break;}
1451case 61:
1452#line 498 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1453{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001454 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1455 delete yyvsp[0].StrVal;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001456;
1457 break;}
1458case 62:
1459#line 503 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1460{;
1461 break;}
1462case 65:
1463#line 506 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1464{ yyval.StrVal = yyvsp[0].StrVal; ;
1465 break;}
1466case 66:
1467#line 506 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1468{ yyval.StrVal = new std::string(); ;
1469 break;}
1470case 67:
1471#line 508 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1472{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001473 static unsigned AnonCounter = 0;
1474 if (yyvsp[0].StrVal->empty())
1475 *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++);
1476 CurRec = new Record(*yyvsp[0].StrVal);
1477 delete yyvsp[0].StrVal;
1478 ParsingTemplateArgs = true;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001479 ;
1480 break;}
1481case 68:
1482#line 515 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1483{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001484 ParsingTemplateArgs = false;
1485 for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001486 addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001487 // Delete the template arg values for the class
1488 delete (*yyvsp[0].SubClassList)[i].second;
1489 }
1490 delete yyvsp[0].SubClassList; // Delete the class list...
1491
Chris Lattnerba4b1442005-09-08 18:22:57 +00001492 // Process any variables on the set stack...
1493 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001494 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
1495 setValue(LetStack[i][j].Name,
1496 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
1497 LetStack[i][j].Value);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001498 ;
1499 break;}
1500case 69:
1501#line 530 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1502{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001503 yyval.Rec = CurRec;
1504 CurRec = 0;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001505 ;
1506 break;}
1507case 70:
1508#line 535 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1509{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001510 if (Records.getClass(yyvsp[0].Rec->getName())) {
1511 err() << "Class '" << yyvsp[0].Rec->getName() << "' already defined!\n";
1512 exit(1);
1513 }
1514 Records.addClass(yyval.Rec = yyvsp[0].Rec);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001515;
1516 break;}
1517case 71:
1518#line 543 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1519{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001520 yyvsp[0].Rec->resolveReferences();
1521
1522 if (!yyvsp[0].Rec->getTemplateArgs().empty()) {
1523 err() << "Def '" << yyvsp[0].Rec->getName()
1524 << "' is not permitted to have template arguments!\n";
1525 exit(1);
1526 }
1527 // If ObjectBody has template arguments, it's an error.
1528 if (Records.getDef(yyvsp[0].Rec->getName())) {
1529 err() << "Def '" << yyvsp[0].Rec->getName() << "' already defined!\n";
1530 exit(1);
1531 }
1532 Records.addDef(yyval.Rec = yyvsp[0].Rec);
Chris Lattnerba4b1442005-09-08 18:22:57 +00001533;
1534 break;}
1535case 74:
1536#line 562 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1537{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001538 LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer));
1539 delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001540;
1541 break;}
1542case 77:
1543#line 570 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1544{ LetStack.push_back(std::vector<LetRecord>()); ;
1545 break;}
1546case 79:
1547#line 573 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1548{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001549 LetStack.pop_back();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001550 ;
1551 break;}
1552case 80:
1553#line 576 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1554{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001555 LetStack.pop_back();
Chris Lattnerba4b1442005-09-08 18:22:57 +00001556 ;
1557 break;}
1558case 81:
1559#line 580 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1560{;
1561 break;}
1562case 82:
1563#line 580 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1564{;
1565 break;}
1566case 83:
1567#line 582 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1568{;
1569 break;}
1570}
1571 /* the action file gets copied in in place of this dollarsign */
1572#line 543 "/usr/share/bison.simple"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001573
1574 yyvsp -= yylen;
1575 yyssp -= yylen;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001576#ifdef YYLSP_NEEDED
1577 yylsp -= yylen;
1578#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001579
Chris Lattnerba4b1442005-09-08 18:22:57 +00001580#if YYDEBUG != 0
1581 if (yydebug)
1582 {
1583 short *ssp1 = yyss - 1;
1584 fprintf (stderr, "state stack now");
1585 while (ssp1 != yyssp)
1586 fprintf (stderr, " %d", *++ssp1);
1587 fprintf (stderr, "\n");
1588 }
1589#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001590
1591 *++yyvsp = yyval;
1592
Chris Lattnerba4b1442005-09-08 18:22:57 +00001593#ifdef YYLSP_NEEDED
1594 yylsp++;
1595 if (yylen == 0)
1596 {
1597 yylsp->first_line = yylloc.first_line;
1598 yylsp->first_column = yylloc.first_column;
1599 yylsp->last_line = (yylsp-1)->last_line;
1600 yylsp->last_column = (yylsp-1)->last_column;
1601 yylsp->text = 0;
1602 }
1603 else
1604 {
1605 yylsp->last_line = (yylsp+yylen-1)->last_line;
1606 yylsp->last_column = (yylsp+yylen-1)->last_column;
1607 }
1608#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001609
Chris Lattnerba4b1442005-09-08 18:22:57 +00001610 /* Now "shift" the result of the reduction.
1611 Determine what state that goes to,
1612 based on the state we popped back to
1613 and the rule number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001614
1615 yyn = yyr1[yyn];
1616
Chris Lattnerba4b1442005-09-08 18:22:57 +00001617 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1618 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001619 yystate = yytable[yystate];
1620 else
Chris Lattnerba4b1442005-09-08 18:22:57 +00001621 yystate = yydefgoto[yyn - YYNTBASE];
Reid Spencer68a24bd2005-08-27 18:50:39 +00001622
1623 goto yynewstate;
1624
Chris Lattnerba4b1442005-09-08 18:22:57 +00001625yyerrlab: /* here on detecting error */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001626
Chris Lattnerba4b1442005-09-08 18:22:57 +00001627 if (! yyerrstatus)
1628 /* If not already recovering from an error, report this error. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001629 {
1630 ++yynerrs;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001631
1632#ifdef YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00001633 yyn = yypact[yystate];
1634
Chris Lattnerba4b1442005-09-08 18:22:57 +00001635 if (yyn > YYFLAG && yyn < YYLAST)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001636 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001637 int size = 0;
1638 char *msg;
1639 int x, count;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001640
Chris Lattnerba4b1442005-09-08 18:22:57 +00001641 count = 0;
1642 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1643 for (x = (yyn < 0 ? -yyn : 0);
1644 x < (sizeof(yytname) / sizeof(char *)); x++)
1645 if (yycheck[x + yyn] == x)
1646 size += strlen(yytname[x]) + 15, count++;
1647 msg = (char *) malloc(size + 15);
1648 if (msg != 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001649 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001650 strcpy(msg, "parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001651
Chris Lattnerba4b1442005-09-08 18:22:57 +00001652 if (count < 5)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001653 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001654 count = 0;
1655 for (x = (yyn < 0 ? -yyn : 0);
1656 x < (sizeof(yytname) / sizeof(char *)); x++)
1657 if (yycheck[x + yyn] == x)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001658 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001659 strcat(msg, count == 0 ? ", expecting `" : " or `");
1660 strcat(msg, yytname[x]);
1661 strcat(msg, "'");
1662 count++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001663 }
1664 }
Chris Lattnerba4b1442005-09-08 18:22:57 +00001665 yyerror(msg);
1666 free(msg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001667 }
1668 else
Chris Lattnerba4b1442005-09-08 18:22:57 +00001669 yyerror ("parse error; also virtual memory exceeded");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001670 }
1671 else
1672#endif /* YYERROR_VERBOSE */
Chris Lattnerba4b1442005-09-08 18:22:57 +00001673 yyerror("parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001674 }
1675
Chris Lattnerba4b1442005-09-08 18:22:57 +00001676 goto yyerrlab1;
1677yyerrlab1: /* here on error raised explicitly by an action */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001678
1679 if (yyerrstatus == 3)
1680 {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001681 /* if just tried and failed to reuse lookahead token after an error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001682
Chris Lattnerba4b1442005-09-08 18:22:57 +00001683 /* return failure if at end of input */
1684 if (yychar == YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001685 YYABORT;
1686
Chris Lattnerba4b1442005-09-08 18:22:57 +00001687#if YYDEBUG != 0
1688 if (yydebug)
1689 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1690#endif
1691
1692 yychar = YYEMPTY;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001693 }
1694
Chris Lattnerba4b1442005-09-08 18:22:57 +00001695 /* Else will try to reuse lookahead token
1696 after shifting the error token. */
1697
1698 yyerrstatus = 3; /* Each real token shifted decrements this */
1699
1700 goto yyerrhandle;
1701
1702yyerrdefault: /* current state does not do anything special for the error token. */
1703
1704#if 0
1705 /* This is wrong; only states that explicitly want error tokens
1706 should shift them. */
1707 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1708 if (yyn) goto yydefault;
1709#endif
1710
1711yyerrpop: /* pop the current state because it cannot handle the error token */
1712
1713 if (yyssp == yyss) YYABORT;
1714 yyvsp--;
1715 yystate = *--yyssp;
1716#ifdef YYLSP_NEEDED
1717 yylsp--;
1718#endif
1719
1720#if YYDEBUG != 0
1721 if (yydebug)
1722 {
1723 short *ssp1 = yyss - 1;
1724 fprintf (stderr, "Error: state stack now");
1725 while (ssp1 != yyssp)
1726 fprintf (stderr, " %d", *++ssp1);
1727 fprintf (stderr, "\n");
1728 }
1729#endif
1730
1731yyerrhandle:
1732
1733 yyn = yypact[yystate];
1734 if (yyn == YYFLAG)
1735 goto yyerrdefault;
1736
1737 yyn += YYTERROR;
1738 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1739 goto yyerrdefault;
1740
1741 yyn = yytable[yyn];
1742 if (yyn < 0)
1743 {
1744 if (yyn == YYFLAG)
1745 goto yyerrpop;
1746 yyn = -yyn;
1747 goto yyreduce;
1748 }
1749 else if (yyn == 0)
1750 goto yyerrpop;
1751
Reid Spencer68a24bd2005-08-27 18:50:39 +00001752 if (yyn == YYFINAL)
1753 YYACCEPT;
1754
Chris Lattnerba4b1442005-09-08 18:22:57 +00001755#if YYDEBUG != 0
1756 if (yydebug)
1757 fprintf(stderr, "Shifting error token, ");
1758#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001759
1760 *++yyvsp = yylval;
Chris Lattnerba4b1442005-09-08 18:22:57 +00001761#ifdef YYLSP_NEEDED
1762 *++yylsp = yylloc;
1763#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001764
1765 yystate = yyn;
1766 goto yynewstate;
1767
Chris Lattnerba4b1442005-09-08 18:22:57 +00001768 yyacceptlab:
1769 /* YYACCEPT comes here. */
1770 if (yyfree_stacks)
1771 {
1772 free (yyss);
1773 free (yyvs);
1774#ifdef YYLSP_NEEDED
1775 free (yyls);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001776#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +00001777 }
1778 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001779
Chris Lattnerba4b1442005-09-08 18:22:57 +00001780 yyabortlab:
1781 /* YYABORT comes here. */
1782 if (yyfree_stacks)
1783 {
1784 free (yyss);
1785 free (yyvs);
1786#ifdef YYLSP_NEEDED
1787 free (yyls);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001788#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +00001789 }
1790 return 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001791}
Chris Lattnerba4b1442005-09-08 18:22:57 +00001792#line 584 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001793
1794
1795int yyerror(const char *ErrorMsg) {
1796 err() << "Error parsing: " << ErrorMsg << "\n";
1797 exit(1);
1798}