blob: c8fd87da98398ce6be36ebde32083798b593b3d0 [file] [log] [blame]
Reid Spencer68a24bd2005-08-27 18:50:39 +00001
Chris Lattner81779692006-03-30 22:51:12 +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 Lattner81779692006-03-30 22:51:12 +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 Lattner81779692006-03-30 22:51:12 +00008#define yylex Filelex
Reid Spencer68a24bd2005-08-27 18:50:39 +00009#define yyerror Fileerror
Chris Lattner81779692006-03-30 22:51:12 +000010#define yylval Filelval
11#define yychar Filechar
Reid Spencer68a24bd2005-08-27 18:50:39 +000012#define yydebug Filedebug
13#define yynerrs Filenerrs
Chris Lattner81779692006-03-30 22:51:12 +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
Chris Lattnerb8316912006-03-31 21:54:11 +000029#define STRCONCATTOK 272
30#define INTVAL 273
31#define ID 274
32#define VARNAME 275
33#define STRVAL 276
34#define CODEFRAGMENT 277
Reid Spencer68a24bd2005-08-27 18:50:39 +000035
Chris Lattner81779692006-03-30 22:51:12 +000036#line 14 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +000037
38#include "Record.h"
39#include "llvm/ADT/StringExtras.h"
40#include <algorithm>
41#include <cstdio>
42#define YYERROR_VERBOSE 1
43
44int yyerror(const char *ErrorMsg);
45int yylex();
46
47namespace llvm {
48
49extern int Filelineno;
50static Record *CurRec = 0;
51static bool ParsingTemplateArgs = false;
52
53typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
54
55struct LetRecord {
56 std::string Name;
57 std::vector<unsigned> Bits;
58 Init *Value;
59 bool HasBits;
60 LetRecord(const std::string &N, std::vector<unsigned> *B, Init *V)
61 : Name(N), Value(V), HasBits(B != 0) {
62 if (HasBits) Bits = *B;
63 }
64};
65
66static std::vector<std::vector<LetRecord> > LetStack;
67
68
69extern std::ostream &err();
70
71static void addValue(const RecordVal &RV) {
72 if (RecordVal *ERV = CurRec->getValue(RV.getName())) {
73 // The value already exists in the class, treat this as a set...
74 if (ERV->setValue(RV.getValue())) {
75 err() << "New definition of '" << RV.getName() << "' of type '"
76 << *RV.getType() << "' is incompatible with previous "
77 << "definition of type '" << *ERV->getType() << "'!\n";
78 exit(1);
79 }
80 } else {
81 CurRec->addValue(RV);
82 }
83}
84
85static void addSuperClass(Record *SC) {
86 if (CurRec->isSubClassOf(SC)) {
87 err() << "Already subclass of '" << SC->getName() << "'!\n";
88 exit(1);
89 }
90 CurRec->addSuperClass(SC);
91}
92
93static void setValue(const std::string &ValName,
Chris Lattner81779692006-03-30 22:51:12 +000094 std::vector<unsigned> *BitList, Init *V) {
Reid Spencer68a24bd2005-08-27 18:50:39 +000095 if (!V) return;
96
97 RecordVal *RV = CurRec->getValue(ValName);
98 if (RV == 0) {
99 err() << "Value '" << ValName << "' unknown!\n";
100 exit(1);
101 }
102
103 // Do not allow assignments like 'X = X'. This will just cause infinite loops
104 // in the resolution machinery.
105 if (!BitList)
106 if (VarInit *VI = dynamic_cast<VarInit*>(V))
107 if (VI->getName() == ValName)
108 return;
109
110 // If we are assigning to a subset of the bits in the value... then we must be
111 // assigning to a field of BitsRecTy, which must have a BitsInit
112 // initializer...
113 //
114 if (BitList) {
115 BitsInit *CurVal = dynamic_cast<BitsInit*>(RV->getValue());
116 if (CurVal == 0) {
117 err() << "Value '" << ValName << "' is not a bits type!\n";
118 exit(1);
119 }
120
121 // Convert the incoming value to a bits type of the appropriate size...
122 Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size()));
123 if (BI == 0) {
124 V->convertInitializerTo(new BitsRecTy(BitList->size()));
125 err() << "Initializer '" << *V << "' not compatible with bit range!\n";
126 exit(1);
127 }
128
129 // We should have a BitsInit type now...
130 assert(dynamic_cast<BitsInit*>(BI) != 0 || &(std::cerr << *BI) == 0);
131 BitsInit *BInit = (BitsInit*)BI;
132
133 BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
134
135 // Loop over bits, assigning values as appropriate...
136 for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
137 unsigned Bit = (*BitList)[i];
138 if (NewVal->getBit(Bit)) {
139 err() << "Cannot set bit #" << Bit << " of value '" << ValName
140 << "' more than once!\n";
141 exit(1);
142 }
143 NewVal->setBit(Bit, BInit->getBit(i));
144 }
145
146 for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
147 if (NewVal->getBit(i) == 0)
148 NewVal->setBit(i, CurVal->getBit(i));
149
150 V = NewVal;
151 }
152
153 if (RV->setValue(V)) {
154 err() << "Value '" << ValName << "' of type '" << *RV->getType()
155 << "' is incompatible with initializer '" << *V << "'!\n";
156 exit(1);
157 }
158}
159
160// addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's
161// template arguments.
162static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
163 // Add all of the values in the subclass into the current class...
164 const std::vector<RecordVal> &Vals = SC->getValues();
165 for (unsigned i = 0, e = Vals.size(); i != e; ++i)
166 addValue(Vals[i]);
167
168 const std::vector<std::string> &TArgs = SC->getTemplateArgs();
169
170 // Ensure that an appropriate number of template arguments are specified...
171 if (TArgs.size() < TemplateArgs.size()) {
172 err() << "ERROR: More template args specified than expected!\n";
173 exit(1);
174 } else { // This class expects template arguments...
175 // Loop over all of the template arguments, setting them to the specified
176 // value or leaving them as the default if necessary.
177 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
178 if (i < TemplateArgs.size()) { // A value is specified for this temp-arg?
Chris Lattnerba4b1442005-09-08 18:22:57 +0000179 // Set it now.
180 setValue(TArgs[i], 0, TemplateArgs[i]);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000181
182 // Resolve it next.
183 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
184
185
186 // Now remove it.
187 CurRec->removeValue(TArgs[i]);
188
189 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
Chris Lattnerba4b1442005-09-08 18:22:57 +0000190 err() << "ERROR: Value not specified for template argument #"
191 << i << " (" << TArgs[i] << ") of subclass '" << SC->getName()
192 << "'!\n";
193 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000194 }
195 }
196 }
197
198 // Since everything went well, we can now set the "superclass" list for the
199 // current record.
200 const std::vector<Record*> &SCs = SC->getSuperClasses();
201 for (unsigned i = 0, e = SCs.size(); i != e; ++i)
202 addSuperClass(SCs[i]);
203 addSuperClass(SC);
204}
205
206} // End llvm namespace
207
208using namespace llvm;
209
210
Chris Lattner81779692006-03-30 22:51:12 +0000211#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
212typedef union {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000213 std::string* StrVal;
214 int IntVal;
215 llvm::RecTy* Ty;
216 llvm::Init* Initializer;
217 std::vector<llvm::Init*>* FieldList;
218 std::vector<unsigned>* BitList;
219 llvm::Record* Rec;
220 SubClassRefTy* SubClassRef;
221 std::vector<SubClassRefTy>* SubClassList;
222 std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
223} YYSTYPE;
Chris Lattner81779692006-03-30 22:51:12 +0000224#include <stdio.h>
225
226#ifndef __cplusplus
227#ifndef __STDC__
228#define const
229#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000230#endif
231
232
233
Chris Lattnerb8316912006-03-31 21:54:11 +0000234#define YYFINAL 168
Chris Lattner81779692006-03-30 22:51:12 +0000235#define YYFLAG -32768
Chris Lattnerb8316912006-03-31 21:54:11 +0000236#define YYNTBASE 39
Reid Spencer68a24bd2005-08-27 18:50:39 +0000237
Chris Lattnerb8316912006-03-31 21:54:11 +0000238#define YYTRANSLATE(x) ((unsigned)(x) <= 277 ? yytranslate[x] : 80)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000239
Chris Lattner81779692006-03-30 22:51:12 +0000240static const char yytranslate[] = { 0,
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, 2,
Chris Lattnerb8316912006-03-31 21:54:11 +0000244 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
245 34, 2, 2, 35, 37, 32, 2, 2, 2, 2,
246 2, 2, 2, 2, 2, 2, 2, 36, 38, 24,
247 26, 25, 27, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner81779692006-03-30 22:51:12 +0000248 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
249 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattnerb8316912006-03-31 21:54:11 +0000250 30, 2, 31, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner81779692006-03-30 22:51:12 +0000251 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
252 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattnerb8316912006-03-31 21:54:11 +0000253 2, 2, 28, 2, 29, 2, 2, 2, 2, 2,
Chris Lattner81779692006-03-30 22:51:12 +0000254 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, 2, 2, 2, 2, 2,
266 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
267 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
Chris Lattnerb8316912006-03-31 21:54:11 +0000268 17, 18, 19, 20, 21, 22, 23
Chris Lattner81779692006-03-30 22:51:12 +0000269};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000270
Chris Lattner81779692006-03-30 22:51:12 +0000271#if YYDEBUG != 0
272static const short yyprhs[] = { 0,
273 0, 2, 4, 6, 11, 13, 18, 20, 22, 24,
274 25, 27, 28, 31, 33, 35, 37, 39, 41, 43,
275 47, 52, 57, 61, 65, 70, 75, 82, 89, 96,
Chris Lattnerb8316912006-03-31 21:54:11 +0000276 103, 104, 107, 110, 115, 116, 118, 120, 124, 127,
277 131, 137, 142, 144, 145, 149, 150, 152, 154, 158,
278 163, 166, 173, 174, 177, 179, 183, 185, 190, 192,
279 196, 197, 200, 202, 206, 210, 211, 213, 215, 216,
280 218, 220, 222, 223, 227, 228, 229, 236, 240, 242,
281 244, 249, 251, 255, 256, 261, 266, 269, 271, 274
Chris Lattner81779692006-03-30 22:51:12 +0000282};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000283
Chris Lattnerb8316912006-03-31 21:54:11 +0000284static const short yyrhs[] = { 20,
285 0, 5, 0, 4, 0, 6, 24, 19, 25, 0,
286 3, 0, 7, 24, 40, 25, 0, 8, 0, 9,
287 0, 39, 0, 0, 12, 0, 0, 26, 44, 0,
288 20, 0, 43, 0, 19, 0, 22, 0, 23, 0,
289 27, 0, 28, 51, 29, 0, 20, 24, 52, 25,
290 0, 44, 28, 49, 29, 0, 30, 51, 31, 0,
291 44, 32, 20, 0, 33, 43, 47, 34, 0, 44,
292 30, 49, 31, 0, 15, 33, 44, 35, 44, 34,
293 0, 16, 33, 44, 35, 44, 34, 0, 17, 33,
294 44, 35, 44, 34, 0, 18, 33, 44, 35, 44,
295 34, 0, 0, 36, 21, 0, 44, 45, 0, 46,
296 35, 44, 45, 0, 0, 46, 0, 19, 0, 19,
297 37, 19, 0, 19, 19, 0, 48, 35, 19, 0,
298 48, 35, 19, 37, 19, 0, 48, 35, 19, 19,
299 0, 48, 0, 0, 28, 49, 29, 0, 0, 52,
300 0, 44, 0, 52, 35, 44, 0, 41, 40, 20,
301 42, 0, 53, 38, 0, 13, 20, 50, 26, 44,
302 38, 0, 0, 55, 54, 0, 38, 0, 28, 55,
303 29, 0, 39, 0, 39, 24, 52, 25, 0, 57,
304 0, 58, 35, 57, 0, 0, 36, 58, 0, 53,
305 0, 60, 35, 53, 0, 24, 60, 25, 0, 0,
306 61, 0, 20, 0, 0, 63, 0, 64, 0, 64,
307 0, 0, 59, 68, 56, 0, 0, 0, 10, 65,
308 70, 62, 71, 67, 0, 11, 66, 67, 0, 69,
309 0, 72, 0, 20, 50, 26, 44, 0, 74, 0,
310 75, 35, 74, 0, 0, 13, 77, 75, 14, 0,
311 76, 28, 78, 29, 0, 76, 73, 0, 73, 0,
312 78, 73, 0, 78, 0
Chris Lattner81779692006-03-30 22:51:12 +0000313};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000314
315#endif
316
Chris Lattner81779692006-03-30 22:51:12 +0000317#if YYDEBUG != 0
318static const short yyrline[] = { 0,
319 223, 234, 236, 238, 240, 242, 244, 246, 248, 252,
320 252, 254, 254, 256, 273, 275, 277, 280, 283, 285,
Chris Lattnerb8316912006-03-31 21:54:11 +0000321 298, 326, 333, 336, 343, 346, 354, 356, 358, 360,
322 364, 367, 371, 376, 382, 385, 388, 391, 404, 418,
323 420, 433, 449, 451, 451, 455, 457, 461, 464, 468,
324 478, 480, 486, 486, 487, 487, 489, 491, 495, 500,
325 505, 508, 512, 515, 520, 521, 521, 523, 523, 525,
326 532, 550, 562, 576, 581, 583, 585, 589, 598, 598,
327 600, 605, 605, 608, 608, 611, 614, 618, 618, 620
Chris Lattner81779692006-03-30 22:51:12 +0000328};
329#endif
330
331
332#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
333
334static const char * const yytname[] = { "$","error","$undefined.","INT","BIT",
335"STRING","BITS","LIST","CODE","DAG","CLASS","DEF","FIELD","LET","IN","SHLTOK",
Chris Lattnerb8316912006-03-31 21:54:11 +0000336"SRATOK","SRLTOK","STRCONCATTOK","INTVAL","ID","VARNAME","STRVAL","CODEFRAGMENT",
337"'<'","'>'","'='","'?'","'{'","'}'","'['","']'","'.'","'('","')'","','","':'",
338"'-'","';'","ClassID","Type","OptPrefix","OptValue","IDValue","Value","OptVarName",
339"DagArgListNE","DagArgList","RBitList","BitList","OptBitList","ValueList","ValueListNE",
340"Declaration","BodyItem","BodyList","Body","SubClassRef","ClassListNE","ClassList",
341"DeclListNE","TemplateArgList","OptTemplateArgList","OptID","ObjectName","ClassName",
342"DefName","ObjectBody","@1","ClassInst","@2","@3","DefInst","Object","LETItem",
343"LETList","LETCommand","@4","ObjectList","File", NULL
Chris Lattner81779692006-03-30 22:51:12 +0000344};
345#endif
346
347static const short yyr1[] = { 0,
Chris Lattnerb8316912006-03-31 21:54:11 +0000348 39, 40, 40, 40, 40, 40, 40, 40, 40, 41,
349 41, 42, 42, 43, 44, 44, 44, 44, 44, 44,
350 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
351 45, 45, 46, 46, 47, 47, 48, 48, 48, 48,
352 48, 48, 49, 50, 50, 51, 51, 52, 52, 53,
353 54, 54, 55, 55, 56, 56, 57, 57, 58, 58,
354 59, 59, 60, 60, 61, 62, 62, 63, 63, 64,
355 65, 66, 68, 67, 70, 71, 69, 72, 73, 73,
356 74, 75, 75, 77, 76, 73, 73, 78, 78, 79
Chris Lattner81779692006-03-30 22:51:12 +0000357};
358
359static const short yyr2[] = { 0,
360 1, 1, 1, 4, 1, 4, 1, 1, 1, 0,
361 1, 0, 2, 1, 1, 1, 1, 1, 1, 3,
Chris Lattnerb8316912006-03-31 21:54:11 +0000362 4, 4, 3, 3, 4, 4, 6, 6, 6, 6,
363 0, 2, 2, 4, 0, 1, 1, 3, 2, 3,
364 5, 4, 1, 0, 3, 0, 1, 1, 3, 4,
365 2, 6, 0, 2, 1, 3, 1, 4, 1, 3,
366 0, 2, 1, 3, 3, 0, 1, 1, 0, 1,
367 1, 1, 0, 3, 0, 0, 6, 3, 1, 1,
368 4, 1, 3, 0, 4, 4, 2, 1, 2, 1
Chris Lattner81779692006-03-30 22:51:12 +0000369};
370
371static const short yydefact[] = { 0,
Chris Lattnerb8316912006-03-31 21:54:11 +0000372 69, 69, 84, 79, 80, 88, 0, 90, 68, 70,
373 71, 75, 72, 61, 0, 0, 87, 89, 66, 0,
374 73, 78, 44, 82, 0, 0, 10, 67, 76, 1,
375 57, 59, 62, 0, 0, 0, 85, 0, 86, 11,
376 0, 63, 0, 61, 0, 0, 53, 55, 74, 37,
377 43, 0, 0, 83, 5, 3, 2, 0, 0, 7,
378 8, 9, 0, 65, 10, 77, 0, 0, 0, 0,
379 16, 14, 17, 18, 19, 46, 46, 0, 15, 48,
380 0, 60, 10, 39, 0, 0, 45, 81, 0, 0,
381 12, 64, 0, 0, 0, 0, 0, 0, 47, 0,
382 14, 35, 0, 0, 0, 58, 0, 0, 56, 0,
383 54, 38, 40, 0, 0, 0, 50, 0, 0, 0,
384 0, 0, 20, 23, 31, 36, 0, 0, 0, 24,
385 49, 44, 51, 42, 0, 4, 6, 13, 0, 0,
386 0, 0, 21, 0, 33, 0, 25, 22, 26, 0,
387 41, 0, 0, 0, 0, 32, 31, 0, 27, 28,
388 29, 30, 34, 0, 52, 0, 0, 0
Chris Lattner81779692006-03-30 22:51:12 +0000389};
390
391static const short yydefgoto[] = { 31,
Chris Lattnerb8316912006-03-31 21:54:11 +0000392 63, 41, 117, 79, 80, 145, 126, 127, 51, 52,
393 36, 98, 99, 42, 111, 83, 49, 32, 33, 21,
Chris Lattner81779692006-03-30 22:51:12 +0000394 43, 28, 29, 10, 11, 12, 14, 22, 34, 4,
Chris Lattnerb8316912006-03-31 21:54:11 +0000395 19, 44, 5, 6, 24, 25, 7, 15, 8, 166
Chris Lattner81779692006-03-30 22:51:12 +0000396};
397
Chris Lattnerb8316912006-03-31 21:54:11 +0000398static const short yypact[] = { 67,
399 -14, -14,-32768,-32768,-32768,-32768, 19, 67,-32768,-32768,
400-32768,-32768,-32768, -3, 63, 67,-32768,-32768, 60, 65,
401-32768,-32768, 7,-32768, -11, -6, 79,-32768,-32768,-32768,
402 71,-32768, 4, -16, 82, 73,-32768, 63,-32768,-32768,
403 61,-32768, 11, -3, -2, 65,-32768,-32768,-32768, 0,
404 72, 98, -2,-32768,-32768,-32768,-32768, 105, 106,-32768,
405-32768,-32768, 111,-32768, 79,-32768, 99, 100, 101, 102,
406-32768, 112,-32768,-32768,-32768, -2, -2, 117,-32768, 96,
407 23,-32768, 32,-32768, 119, 120,-32768, 96, 121, 61,
408 115,-32768, -2, -2, -2, -2, -2, 113, 108, 114,
409-32768, -2, 82, 82, 124,-32768, -2, 126,-32768, 109,
410-32768,-32768, 15, 123, 125, -2,-32768, 27, 62, 68,
411 74, 25,-32768,-32768, 43, 116, 118, 127, 122,-32768,
412 96, 7,-32768,-32768, 130,-32768,-32768, 96, -2, -2,
413 -2, -2,-32768, 133,-32768, -2,-32768,-32768,-32768, 129,
414-32768, 80, 83, 88, 91,-32768, 43, -2,-32768,-32768,
415-32768,-32768,-32768, 44,-32768, 157, 158,-32768
Chris Lattner81779692006-03-30 22:51:12 +0000416};
417
418static const short yypgoto[] = { -39,
Chris Lattnerb8316912006-03-31 21:54:11 +0000419 69,-32768,-32768, 84, -53, 3,-32768,-32768,-32768, -93,
420 29, 86, -44, -27,-32768,-32768,-32768, 128,-32768,-32768,
421-32768,-32768,-32768,-32768, 162,-32768,-32768, 131,-32768,-32768,
422-32768,-32768,-32768, 1, 132,-32768,-32768,-32768, 149,-32768
Chris Lattner81779692006-03-30 22:51:12 +0000423};
424
425
Chris Lattnerb8316912006-03-31 21:54:11 +0000426#define YYLAST 175
Chris Lattner81779692006-03-30 22:51:12 +0000427
428
Chris Lattnerb8316912006-03-31 21:54:11 +0000429static const short yytable[] = { 88,
430 81, 62, 37, 1, 2, 9, 3, 17, 18, 128,
431 129, 47, 67, 68, 69, 70, 71, 72, 84, 73,
432 74, 48, 39, 38, 75, 76, 18, 77, 1, 2,
433 78, 3, 20, 134, 35, 64, 85, 92, 46, 118,
434 119, 120, 121, 40, 108, 65, 16, 106, 125, 143,
435 62, 135, 122, 131, 103, 110, 104, 107, 105, 107,
436 109, 139, 138, 55, 56, 57, 58, 59, 60, 61,
437 103, 103, 104, 104, 105, 105, 1, 2, 144, 3,
438 30, 165, 23, 27, 30, 152, 153, 154, 155, 103,
439 40, 104, 157, 105, 45, 103, 140, 104, 53, 105,
440 50, 103, 141, 104, 164, 105, 86, 103, 142, 104,
441 103, 105, 104, 159, 105, 103, 160, 104, 103, 105,
442 104, 161, 105, 103, 162, 104, 87, 105, 89, 90,
443 91, 93, 94, 95, 96, 97, 101, 112, 113, 114,
444 116, 123, 107, 130, 124, 132, 133, 136, 151, 137,
445 146, 147, 149, 156, 158, 148, 167, 168, 115, 163,
446 150, 102, 100, 13, 26, 0, 0, 0, 0, 54,
447 0, 0, 0, 82, 66
Chris Lattner81779692006-03-30 22:51:12 +0000448};
449
450static const short yycheck[] = { 53,
Chris Lattnerb8316912006-03-31 21:54:11 +0000451 45, 41, 14, 10, 11, 20, 13, 7, 8, 103,
452 104, 28, 15, 16, 17, 18, 19, 20, 19, 22,
453 23, 38, 29, 35, 27, 28, 26, 30, 10, 11,
454 33, 13, 36, 19, 28, 25, 37, 65, 35, 93,
455 94, 95, 96, 12, 13, 35, 28, 25, 102, 25,
456 90, 37, 97, 107, 28, 83, 30, 35, 32, 35,
457 29, 35, 116, 3, 4, 5, 6, 7, 8, 9,
458 28, 28, 30, 30, 32, 32, 10, 11, 36, 13,
459 20, 38, 20, 24, 20, 139, 140, 141, 142, 28,
460 12, 30, 146, 32, 24, 28, 35, 30, 26, 32,
461 19, 28, 35, 30, 158, 32, 35, 28, 35, 30,
462 28, 32, 30, 34, 32, 28, 34, 30, 28, 32,
463 30, 34, 32, 28, 34, 30, 29, 32, 24, 24,
464 20, 33, 33, 33, 33, 24, 20, 19, 19, 19,
465 26, 29, 35, 20, 31, 20, 38, 25, 19, 25,
466 35, 34, 31, 21, 26, 29, 0, 0, 90, 157,
467 132, 78, 77, 2, 16, -1, -1, -1, -1, 38,
468 -1, -1, -1, 46, 44
Chris Lattner81779692006-03-30 22:51:12 +0000469};
470/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
471#line 3 "/usr/share/bison.simple"
472/* This file comes from bison-1.28. */
473
474/* Skeleton output parser for bison,
475 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
476
477 This program is free software; you can redistribute it and/or modify
478 it under the terms of the GNU General Public License as published by
479 the Free Software Foundation; either version 2, or (at your option)
480 any later version.
481
482 This program is distributed in the hope that it will be useful,
483 but WITHOUT ANY WARRANTY; without even the implied warranty of
484 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
485 GNU General Public License for more details.
486
487 You should have received a copy of the GNU General Public License
488 along with this program; if not, write to the Free Software
489 Foundation, Inc., 59 Temple Place - Suite 330,
490 Boston, MA 02111-1307, USA. */
491
492/* As a special exception, when this file is copied by Bison into a
493 Bison output file, you may use that output file without restriction.
494 This special exception was added by the Free Software Foundation
495 in version 1.24 of Bison. */
496
497/* This is the parser code that is written into each bison parser
498 when the %semantic_parser declaration is not specified in the grammar.
499 It was written by Richard Stallman by simplifying the hairy parser
500 used when %semantic_parser is specified. */
501
502#ifndef YYSTACK_USE_ALLOCA
503#ifdef alloca
504#define YYSTACK_USE_ALLOCA
505#else /* alloca not defined */
506#ifdef __GNUC__
507#define YYSTACK_USE_ALLOCA
508#define alloca __builtin_alloca
509#else /* not GNU C. */
510#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
511#define YYSTACK_USE_ALLOCA
512#include <alloca.h>
513#else /* not sparc */
514/* We think this test detects Watcom and Microsoft C. */
515/* This used to test MSDOS, but that is a bad idea
516 since that symbol is in the user namespace. */
517#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
518#if 0 /* No need for malloc.h, which pollutes the namespace;
519 instead, just don't use alloca. */
520#include <malloc.h>
521#endif
522#else /* not MSDOS, or __TURBOC__ */
523#if defined(_AIX)
524/* I don't know what this was needed for, but it pollutes the namespace.
525 So I turned it off. rms, 2 May 1997. */
526/* #include <malloc.h> */
527 #pragma alloca
528#define YYSTACK_USE_ALLOCA
529#else /* not MSDOS, or __TURBOC__, or _AIX */
530#if 0
531#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
532 and on HPUX 10. Eventually we can turn this on. */
533#define YYSTACK_USE_ALLOCA
534#define alloca __builtin_alloca
535#endif /* __hpux */
536#endif
537#endif /* not _AIX */
538#endif /* not MSDOS, or __TURBOC__ */
539#endif /* not sparc */
540#endif /* not GNU C */
541#endif /* alloca not defined */
542#endif /* YYSTACK_USE_ALLOCA not defined */
543
544#ifdef YYSTACK_USE_ALLOCA
545#define YYSTACK_ALLOC alloca
Reid Spencer68a24bd2005-08-27 18:50:39 +0000546#else
Chris Lattner81779692006-03-30 22:51:12 +0000547#define YYSTACK_ALLOC malloc
Reid Spencer68a24bd2005-08-27 18:50:39 +0000548#endif
549
Chris Lattner81779692006-03-30 22:51:12 +0000550/* Note: there must be only one dollar sign in this file.
551 It is replaced by the list of actions, each action
552 as one case of the switch. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000553
554#define yyerrok (yyerrstatus = 0)
555#define yyclearin (yychar = YYEMPTY)
Chris Lattner81779692006-03-30 22:51:12 +0000556#define YYEMPTY -2
Reid Spencer68a24bd2005-08-27 18:50:39 +0000557#define YYEOF 0
Reid Spencer68a24bd2005-08-27 18:50:39 +0000558#define YYACCEPT goto yyacceptlab
Chris Lattner81779692006-03-30 22:51:12 +0000559#define YYABORT goto yyabortlab
Chris Lattnerba4b1442005-09-08 18:22:57 +0000560#define YYERROR goto yyerrlab1
Chris Lattner81779692006-03-30 22:51:12 +0000561/* Like YYERROR except do call yyerror.
562 This remains here temporarily to ease the
563 transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000564 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000565#define YYFAIL goto yyerrlab
Reid Spencer68a24bd2005-08-27 18:50:39 +0000566#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner81779692006-03-30 22:51:12 +0000567#define YYBACKUP(token, value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000568do \
569 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner81779692006-03-30 22:51:12 +0000570 { yychar = (token), yylval = (value); \
571 yychar1 = YYTRANSLATE (yychar); \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000572 YYPOPSTACK; \
573 goto yybackup; \
574 } \
575 else \
Chris Lattner81779692006-03-30 22:51:12 +0000576 { yyerror ("syntax error: cannot back up"); YYERROR; } \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000577while (0)
578
579#define YYTERROR 1
580#define YYERRCODE 256
581
Chris Lattner81779692006-03-30 22:51:12 +0000582#ifndef YYPURE
583#define YYLEX yylex()
Reid Spencer68a24bd2005-08-27 18:50:39 +0000584#endif
585
Chris Lattner81779692006-03-30 22:51:12 +0000586#ifdef YYPURE
587#ifdef YYLSP_NEEDED
Reid Spencer68a24bd2005-08-27 18:50:39 +0000588#ifdef YYLEX_PARAM
Chris Lattner81779692006-03-30 22:51:12 +0000589#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000590#else
Chris Lattner81779692006-03-30 22:51:12 +0000591#define YYLEX yylex(&yylval, &yylloc)
592#endif
593#else /* not YYLSP_NEEDED */
594#ifdef YYLEX_PARAM
595#define YYLEX yylex(&yylval, YYLEX_PARAM)
596#else
597#define YYLEX yylex(&yylval)
598#endif
599#endif /* not YYLSP_NEEDED */
Chris Lattner8d354e92005-09-30 04:11:27 +0000600#endif
John Criswelld7881242006-01-17 17:01:34 +0000601
Chris Lattner81779692006-03-30 22:51:12 +0000602/* If nonreentrant, generate the variables here */
John Criswelld7881242006-01-17 17:01:34 +0000603
Chris Lattner81779692006-03-30 22:51:12 +0000604#ifndef YYPURE
John Criswelld7881242006-01-17 17:01:34 +0000605
Chris Lattner81779692006-03-30 22:51:12 +0000606int yychar; /* the lookahead symbol */
607YYSTYPE yylval; /* the semantic value of the */
608 /* lookahead symbol */
John Criswelld7881242006-01-17 17:01:34 +0000609
Chris Lattner81779692006-03-30 22:51:12 +0000610#ifdef YYLSP_NEEDED
611YYLTYPE yylloc; /* location data for the lookahead */
612 /* symbol */
Chris Lattner8d354e92005-09-30 04:11:27 +0000613#endif
John Criswelld7881242006-01-17 17:01:34 +0000614
Chris Lattner81779692006-03-30 22:51:12 +0000615int yynerrs; /* number of parse errors so far */
616#endif /* not YYPURE */
John Criswelld7881242006-01-17 17:01:34 +0000617
Chris Lattner81779692006-03-30 22:51:12 +0000618#if YYDEBUG != 0
619int yydebug; /* nonzero means print parse trace */
620/* Since this is uninitialized, it does not stop multiple parsers
621 from coexisting. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000622#endif
Chris Lattner2b931e82005-09-12 05:30:06 +0000623
Chris Lattner81779692006-03-30 22:51:12 +0000624/* YYINITDEPTH indicates the initial size of the parser's stacks */
Chris Lattner2b931e82005-09-12 05:30:06 +0000625
Reid Spencer68a24bd2005-08-27 18:50:39 +0000626#ifndef YYINITDEPTH
Chris Lattner81779692006-03-30 22:51:12 +0000627#define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +0000628#endif
629
Chris Lattner81779692006-03-30 22:51:12 +0000630/* YYMAXDEPTH is the maximum size the stacks can grow to
631 (effective only if the built-in stack extension method is used). */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000632
Chris Lattnerba4b1442005-09-08 18:22:57 +0000633#if YYMAXDEPTH == 0
Chris Lattner81779692006-03-30 22:51:12 +0000634#undef YYMAXDEPTH
Reid Spencer68a24bd2005-08-27 18:50:39 +0000635#endif
636
637#ifndef YYMAXDEPTH
Chris Lattner81779692006-03-30 22:51:12 +0000638#define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +0000639#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000640
Chris Lattner81779692006-03-30 22:51:12 +0000641/* Define __yy_memcpy. Note that the size argument
642 should be passed with type unsigned int, because that is what the non-GCC
643 definitions require. With GCC, __builtin_memcpy takes an arg
644 of type size_t, but it can handle unsigned int. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000645
Chris Lattner81779692006-03-30 22:51:12 +0000646#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
647#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
648#else /* not GNU C or C++ */
649#ifndef __cplusplus
Reid Spencer68a24bd2005-08-27 18:50:39 +0000650
Chris Lattner81779692006-03-30 22:51:12 +0000651/* This is the most reliable way to avoid incompatibilities
652 in available built-in functions on various systems. */
John Criswelld7881242006-01-17 17:01:34 +0000653static void
Chris Lattner81779692006-03-30 22:51:12 +0000654__yy_memcpy (to, from, count)
655 char *to;
656 char *from;
657 unsigned int count;
658{
659 register char *f = from;
660 register char *t = to;
661 register int i = count;
662
663 while (i-- > 0)
664 *t++ = *f++;
665}
666
667#else /* __cplusplus */
668
669/* This is the most reliable way to avoid incompatibilities
670 in available built-in functions on various systems. */
John Criswelld7881242006-01-17 17:01:34 +0000671static void
Chris Lattner81779692006-03-30 22:51:12 +0000672__yy_memcpy (char *to, char *from, unsigned int count)
673{
674 register char *t = to;
675 register char *f = from;
676 register int i = count;
677
678 while (i-- > 0)
679 *t++ = *f++;
680}
681
Chris Lattner2b931e82005-09-12 05:30:06 +0000682#endif
John Criswelld7881242006-01-17 17:01:34 +0000683#endif
John Criswelld7881242006-01-17 17:01:34 +0000684
Chris Lattner81779692006-03-30 22:51:12 +0000685#line 217 "/usr/share/bison.simple"
John Criswelld7881242006-01-17 17:01:34 +0000686
Chris Lattner81779692006-03-30 22:51:12 +0000687/* The user can define YYPARSE_PARAM as the name of an argument to be passed
688 into yyparse. The argument should have type void *.
689 It should actually point to an object.
690 Grammar actions can access the variable by casting it
691 to the proper pointer type. */
John Criswelld7881242006-01-17 17:01:34 +0000692
693#ifdef YYPARSE_PARAM
Chris Lattner81779692006-03-30 22:51:12 +0000694#ifdef __cplusplus
695#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
696#define YYPARSE_PARAM_DECL
697#else /* not __cplusplus */
698#define YYPARSE_PARAM_ARG YYPARSE_PARAM
699#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
700#endif /* not __cplusplus */
701#else /* not YYPARSE_PARAM */
702#define YYPARSE_PARAM_ARG
703#define YYPARSE_PARAM_DECL
704#endif /* not YYPARSE_PARAM */
705
706/* Prevent warning if -Wstrict-prototypes. */
707#ifdef __GNUC__
708#ifdef YYPARSE_PARAM
709int yyparse (void *);
710#else
John Criswelld7881242006-01-17 17:01:34 +0000711int yyparse (void);
John Criswelld7881242006-01-17 17:01:34 +0000712#endif
Chris Lattner81779692006-03-30 22:51:12 +0000713#endif
John Criswelld7881242006-01-17 17:01:34 +0000714
John Criswelld7881242006-01-17 17:01:34 +0000715int
Chris Lattner81779692006-03-30 22:51:12 +0000716yyparse(YYPARSE_PARAM_ARG)
717 YYPARSE_PARAM_DECL
John Criswelld7881242006-01-17 17:01:34 +0000718{
Reid Spencer68a24bd2005-08-27 18:50:39 +0000719 register int yystate;
720 register int yyn;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000721 register short *yyssp;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000722 register YYSTYPE *yyvsp;
Chris Lattner81779692006-03-30 22:51:12 +0000723 int yyerrstatus; /* number of tokens to shift before error messages enabled */
724 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000725
Chris Lattner81779692006-03-30 22:51:12 +0000726 short yyssa[YYINITDEPTH]; /* the state stack */
727 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000728
Chris Lattner81779692006-03-30 22:51:12 +0000729 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
730 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000731
Chris Lattner81779692006-03-30 22:51:12 +0000732#ifdef YYLSP_NEEDED
733 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
734 YYLTYPE *yyls = yylsa;
735 YYLTYPE *yylsp;
736
737#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
738#else
Reid Spencer68a24bd2005-08-27 18:50:39 +0000739#define YYPOPSTACK (yyvsp--, yyssp--)
Chris Lattner81779692006-03-30 22:51:12 +0000740#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000741
Chris Lattner81779692006-03-30 22:51:12 +0000742 int yystacksize = YYINITDEPTH;
743 int yyfree_stacks = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000744
Chris Lattner81779692006-03-30 22:51:12 +0000745#ifdef YYPURE
746 int yychar;
747 YYSTYPE yylval;
748 int yynerrs;
749#ifdef YYLSP_NEEDED
750 YYLTYPE yylloc;
751#endif
752#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000753
Chris Lattner81779692006-03-30 22:51:12 +0000754 YYSTYPE yyval; /* the variable used to return */
755 /* semantic values from the action */
756 /* routines */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000757
Reid Spencer68a24bd2005-08-27 18:50:39 +0000758 int yylen;
759
Chris Lattner81779692006-03-30 22:51:12 +0000760#if YYDEBUG != 0
761 if (yydebug)
762 fprintf(stderr, "Starting parse\n");
763#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000764
765 yystate = 0;
766 yyerrstatus = 0;
767 yynerrs = 0;
768 yychar = YYEMPTY; /* Cause a token to be read. */
769
770 /* Initialize stack pointers.
771 Waste one element of value and location stack
772 so that they stay on the same level as the state stack.
773 The wasted elements are never initialized. */
774
Chris Lattner81779692006-03-30 22:51:12 +0000775 yyssp = yyss - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000776 yyvsp = yyvs;
Chris Lattner81779692006-03-30 22:51:12 +0000777#ifdef YYLSP_NEEDED
778 yylsp = yyls;
779#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000780
Chris Lattner81779692006-03-30 22:51:12 +0000781/* Push a new state, which is found in yystate . */
782/* In all cases, when you get here, the value and location stacks
783 have just been pushed. so pushing a state here evens the stacks. */
784yynewstate:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000785
Chris Lattner81779692006-03-30 22:51:12 +0000786 *++yyssp = yystate;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000787
Chris Lattner81779692006-03-30 22:51:12 +0000788 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000789 {
Chris Lattner81779692006-03-30 22:51:12 +0000790 /* Give user a chance to reallocate the stack */
791 /* Use copies of these so that the &'s don't force the real ones into memory. */
792 YYSTYPE *yyvs1 = yyvs;
793 short *yyss1 = yyss;
794#ifdef YYLSP_NEEDED
795 YYLTYPE *yyls1 = yyls;
796#endif
797
Reid Spencer68a24bd2005-08-27 18:50:39 +0000798 /* Get the current used size of the three stacks, in elements. */
Chris Lattner81779692006-03-30 22:51:12 +0000799 int size = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000800
801#ifdef yyoverflow
Chris Lattner81779692006-03-30 22:51:12 +0000802 /* Each stack pointer address is followed by the size of
803 the data in use in that stack, in bytes. */
804#ifdef YYLSP_NEEDED
805 /* This used to be a conditional around just the two extra args,
806 but that might be undefined if yyoverflow is a macro. */
807 yyoverflow("parser stack overflow",
808 &yyss1, size * sizeof (*yyssp),
809 &yyvs1, size * sizeof (*yyvsp),
810 &yyls1, size * sizeof (*yylsp),
811 &yystacksize);
812#else
813 yyoverflow("parser stack overflow",
814 &yyss1, size * sizeof (*yyssp),
815 &yyvs1, size * sizeof (*yyvsp),
816 &yystacksize);
817#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000818
Chris Lattner81779692006-03-30 22:51:12 +0000819 yyss = yyss1; yyvs = yyvs1;
820#ifdef YYLSP_NEEDED
821 yyls = yyls1;
822#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000823#else /* no yyoverflow */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000824 /* Extend the stack our own way. */
Chris Lattner81779692006-03-30 22:51:12 +0000825 if (yystacksize >= YYMAXDEPTH)
826 {
827 yyerror("parser stack overflow");
828 if (yyfree_stacks)
829 {
830 free (yyss);
831 free (yyvs);
832#ifdef YYLSP_NEEDED
833 free (yyls);
834#endif
835 }
836 return 2;
837 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000838 yystacksize *= 2;
Chris Lattner81779692006-03-30 22:51:12 +0000839 if (yystacksize > YYMAXDEPTH)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000840 yystacksize = YYMAXDEPTH;
Chris Lattner81779692006-03-30 22:51:12 +0000841#ifndef YYSTACK_USE_ALLOCA
842 yyfree_stacks = 1;
843#endif
844 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
845 __yy_memcpy ((char *)yyss, (char *)yyss1,
846 size * (unsigned int) sizeof (*yyssp));
847 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
848 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
849 size * (unsigned int) sizeof (*yyvsp));
850#ifdef YYLSP_NEEDED
851 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
852 __yy_memcpy ((char *)yyls, (char *)yyls1,
853 size * (unsigned int) sizeof (*yylsp));
854#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000855#endif /* no yyoverflow */
856
Chris Lattner81779692006-03-30 22:51:12 +0000857 yyssp = yyss + size - 1;
858 yyvsp = yyvs + size - 1;
859#ifdef YYLSP_NEEDED
860 yylsp = yyls + size - 1;
861#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000862
Chris Lattner81779692006-03-30 22:51:12 +0000863#if YYDEBUG != 0
864 if (yydebug)
865 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
866#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000867
Chris Lattner81779692006-03-30 22:51:12 +0000868 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000869 YYABORT;
870 }
871
Chris Lattner81779692006-03-30 22:51:12 +0000872#if YYDEBUG != 0
873 if (yydebug)
874 fprintf(stderr, "Entering state %d\n", yystate);
875#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000876
877 goto yybackup;
Chris Lattner81779692006-03-30 22:51:12 +0000878 yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000879
880/* Do appropriate processing given the current state. */
881/* Read a lookahead token if we need one and don't already have one. */
882/* yyresume: */
883
884 /* First try to decide what to do without reference to lookahead token. */
885
886 yyn = yypact[yystate];
Chris Lattner81779692006-03-30 22:51:12 +0000887 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000888 goto yydefault;
889
890 /* Not known => get a lookahead token if don't already have one. */
891
Chris Lattner81779692006-03-30 22:51:12 +0000892 /* yychar is either YYEMPTY or YYEOF
893 or a valid token in external form. */
894
Reid Spencer68a24bd2005-08-27 18:50:39 +0000895 if (yychar == YYEMPTY)
896 {
Chris Lattner81779692006-03-30 22:51:12 +0000897#if YYDEBUG != 0
898 if (yydebug)
899 fprintf(stderr, "Reading a token: ");
900#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000901 yychar = YYLEX;
902 }
903
Chris Lattner81779692006-03-30 22:51:12 +0000904 /* Convert token to internal form (in yychar1) for indexing tables with */
905
906 if (yychar <= 0) /* This means end of input. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000907 {
Chris Lattner81779692006-03-30 22:51:12 +0000908 yychar1 = 0;
909 yychar = YYEOF; /* Don't call YYLEX any more */
910
911#if YYDEBUG != 0
912 if (yydebug)
913 fprintf(stderr, "Now at end of input.\n");
914#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000915 }
916 else
917 {
Chris Lattner81779692006-03-30 22:51:12 +0000918 yychar1 = YYTRANSLATE(yychar);
919
920#if YYDEBUG != 0
921 if (yydebug)
922 {
923 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
924 /* Give the individual parser a way to print the precise meaning
925 of a token, for further debugging info. */
926#ifdef YYPRINT
927 YYPRINT (stderr, yychar, yylval);
928#endif
929 fprintf (stderr, ")\n");
930 }
931#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000932 }
933
Chris Lattner81779692006-03-30 22:51:12 +0000934 yyn += yychar1;
935 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000936 goto yydefault;
Chris Lattner81779692006-03-30 22:51:12 +0000937
Reid Spencer68a24bd2005-08-27 18:50:39 +0000938 yyn = yytable[yyn];
Chris Lattner81779692006-03-30 22:51:12 +0000939
940 /* yyn is what to do for this token type in this state.
941 Negative => reduce, -yyn is rule number.
942 Positive => shift, yyn is new state.
943 New state is final state => don't bother to shift,
944 just return success.
945 0, or most negative number => error. */
946
947 if (yyn < 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000948 {
Chris Lattner81779692006-03-30 22:51:12 +0000949 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000950 goto yyerrlab;
951 yyn = -yyn;
952 goto yyreduce;
953 }
Chris Lattner81779692006-03-30 22:51:12 +0000954 else if (yyn == 0)
955 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000956
957 if (yyn == YYFINAL)
958 YYACCEPT;
959
960 /* Shift the lookahead token. */
Chris Lattner81779692006-03-30 22:51:12 +0000961
962#if YYDEBUG != 0
963 if (yydebug)
964 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
965#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000966
967 /* Discard the token being shifted unless it is eof. */
968 if (yychar != YYEOF)
969 yychar = YYEMPTY;
970
971 *++yyvsp = yylval;
Chris Lattner81779692006-03-30 22:51:12 +0000972#ifdef YYLSP_NEEDED
973 *++yylsp = yylloc;
974#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000975
Chris Lattner81779692006-03-30 22:51:12 +0000976 /* count tokens shifted since error; after three, turn off error status. */
977 if (yyerrstatus) yyerrstatus--;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000978
979 yystate = yyn;
980 goto yynewstate;
981
Chris Lattner81779692006-03-30 22:51:12 +0000982/* Do the default action for the current state. */
John Criswelld7881242006-01-17 17:01:34 +0000983yydefault:
Chris Lattner81779692006-03-30 22:51:12 +0000984
Reid Spencer68a24bd2005-08-27 18:50:39 +0000985 yyn = yydefact[yystate];
986 if (yyn == 0)
987 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000988
Chris Lattner81779692006-03-30 22:51:12 +0000989/* Do a reduction. yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000990yyreduce:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000991 yylen = yyr2[yyn];
Chris Lattner81779692006-03-30 22:51:12 +0000992 if (yylen > 0)
993 yyval = yyvsp[1-yylen]; /* implement default value of the action */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000994
Chris Lattner81779692006-03-30 22:51:12 +0000995#if YYDEBUG != 0
996 if (yydebug)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000997 {
Chris Lattner81779692006-03-30 22:51:12 +0000998 int i;
999
1000 fprintf (stderr, "Reducing via rule %d (line %d), ",
1001 yyn, yyrline[yyn]);
1002
1003 /* Print the symbols being reduced, and their result. */
1004 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1005 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1006 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1007 }
1008#endif
1009
1010
1011 switch (yyn) {
1012
1013case 1:
1014#line 223 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1015{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001016 yyval.Rec = Records.getClass(*yyvsp[0].StrVal);
1017 if (yyval.Rec == 0) {
1018 err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n";
1019 exit(1);
1020 }
1021 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001022 ;
1023 break;}
1024case 2:
1025#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1026{ // string type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001027 yyval.Ty = new StringRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001028 ;
1029 break;}
1030case 3:
1031#line 236 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1032{ // bit type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001033 yyval.Ty = new BitRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001034 ;
1035 break;}
1036case 4:
1037#line 238 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1038{ // bits<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001039 yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001040 ;
1041 break;}
1042case 5:
1043#line 240 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1044{ // int type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001045 yyval.Ty = new IntRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001046 ;
1047 break;}
1048case 6:
1049#line 242 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1050{ // list<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001051 yyval.Ty = new ListRecTy(yyvsp[-1].Ty);
Chris Lattner81779692006-03-30 22:51:12 +00001052 ;
1053 break;}
1054case 7:
1055#line 244 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1056{ // code type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001057 yyval.Ty = new CodeRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001058 ;
1059 break;}
1060case 8:
1061#line 246 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1062{ // dag type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001063 yyval.Ty = new DagRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001064 ;
1065 break;}
1066case 9:
1067#line 248 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1068{ // Record Type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001069 yyval.Ty = new RecordRecTy(yyvsp[0].Rec);
Chris Lattner81779692006-03-30 22:51:12 +00001070 ;
1071 break;}
1072case 10:
1073#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1074{ yyval.IntVal = 0; ;
1075 break;}
1076case 11:
1077#line 252 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1078{ yyval.IntVal = 1; ;
1079 break;}
1080case 12:
1081#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1082{ yyval.Initializer = 0; ;
1083 break;}
1084case 13:
1085#line 254 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1086{ yyval.Initializer = yyvsp[0].Initializer; ;
1087 break;}
1088case 14:
1089#line 256 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1090{
1091 if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) {
1092 yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType());
1093 } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) {
1094 const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal);
1095 assert(RV && "Template arg doesn't exist??");
1096 yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType());
1097 } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) {
1098 yyval.Initializer = new DefInit(D);
1099 } else {
1100 err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n";
1101 exit(1);
1102 }
1103
1104 delete yyvsp[0].StrVal;
1105;
1106 break;}
1107case 15:
1108#line 273 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1109{
1110 yyval.Initializer = yyvsp[0].Initializer;
1111 ;
1112 break;}
1113case 16:
1114#line 275 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1115{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001116 yyval.Initializer = new IntInit(yyvsp[0].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001117 ;
1118 break;}
1119case 17:
1120#line 277 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1121{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001122 yyval.Initializer = new StringInit(*yyvsp[0].StrVal);
1123 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001124 ;
1125 break;}
1126case 18:
1127#line 280 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1128{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001129 yyval.Initializer = new CodeInit(*yyvsp[0].StrVal);
1130 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001131 ;
1132 break;}
1133case 19:
1134#line 283 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1135{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001136 yyval.Initializer = new UnsetInit();
Chris Lattner81779692006-03-30 22:51:12 +00001137 ;
1138 break;}
1139case 20:
1140#line 285 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1141{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001142 BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size());
1143 for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) {
1144 struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy());
1145 if (Bit == 0) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001146 err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i]
1147 << ") is not convertable to a bit!\n";
1148 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001149 }
1150 Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit);
1151 }
1152 yyval.Initializer = Init;
1153 delete yyvsp[-1].FieldList;
Chris Lattner81779692006-03-30 22:51:12 +00001154 ;
1155 break;}
1156case 21:
1157#line 298 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1158{
Chris Lattnerca572be2005-09-08 18:48:47 +00001159 // This is a CLASS<initvalslist> expression. This is supposed to synthesize
1160 // a new anonymous definition, deriving from CLASS<initvalslist> with no
1161 // body.
1162 Record *Class = Records.getClass(*yyvsp[-3].StrVal);
1163 if (!Class) {
1164 err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n";
1165 exit(1);
1166 }
1167 delete yyvsp[-3].StrVal;
1168
1169 static unsigned AnonCounter = 0;
1170 Record *OldRec = CurRec; // Save CurRec.
1171
1172 // Create the new record, set it as CurRec temporarily.
1173 CurRec = new Record("anonymous.val."+utostr(AnonCounter++));
1174 addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec.
1175 delete yyvsp[-1].FieldList; // Free up the template args.
1176
Chris Lattner751eabf2005-09-08 19:47:28 +00001177 CurRec->resolveReferences();
Chris Lattnerca572be2005-09-08 18:48:47 +00001178
1179 Records.addDef(CurRec);
1180
1181 // The result of the expression is a reference to the new record.
1182 yyval.Initializer = new DefInit(CurRec);
1183
1184 // Restore the old CurRec
1185 CurRec = OldRec;
Chris Lattner81779692006-03-30 22:51:12 +00001186 ;
1187 break;}
1188case 22:
1189#line 326 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1190{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001191 yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList);
1192 if (yyval.Initializer == 0) {
1193 err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n";
1194 exit(1);
1195 }
1196 delete yyvsp[-1].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001197 ;
1198 break;}
1199case 23:
1200#line 333 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1201{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001202 yyval.Initializer = new ListInit(*yyvsp[-1].FieldList);
1203 delete yyvsp[-1].FieldList;
Chris Lattner81779692006-03-30 22:51:12 +00001204 ;
1205 break;}
1206case 24:
1207#line 336 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1208{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001209 if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) {
1210 err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n";
1211 exit(1);
1212 }
1213 yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal);
1214 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001215 ;
1216 break;}
1217case 25:
1218#line 343 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1219{
1220 yyval.Initializer = new DagInit(yyvsp[-2].Initializer, *yyvsp[-1].DagValueList);
1221 delete yyvsp[-1].DagValueList;
1222 ;
1223 break;}
1224case 26:
1225#line 346 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1226{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001227 std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end());
1228 yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList);
1229 if (yyval.Initializer == 0) {
1230 err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n";
1231 exit(1);
1232 }
1233 delete yyvsp[-1].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001234 ;
1235 break;}
1236case 27:
1237#line 354 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1238{
Chris Lattnerb8316912006-03-31 21:54:11 +00001239 yyval.Initializer = (new BinOpInit(BinOpInit::SHL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
Chris Lattner81779692006-03-30 22:51:12 +00001240 ;
1241 break;}
1242case 28:
Chris Lattnerb8316912006-03-31 21:54:11 +00001243#line 356 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001244{
Chris Lattnerb8316912006-03-31 21:54:11 +00001245 yyval.Initializer = (new BinOpInit(BinOpInit::SRA, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
Chris Lattner81779692006-03-30 22:51:12 +00001246 ;
1247 break;}
1248case 29:
Chris Lattnerb8316912006-03-31 21:54:11 +00001249#line 358 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001250{
Chris Lattnerb8316912006-03-31 21:54:11 +00001251 yyval.Initializer = (new BinOpInit(BinOpInit::SRL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
Chris Lattner81779692006-03-30 22:51:12 +00001252 ;
1253 break;}
1254case 30:
Chris Lattnerb8316912006-03-31 21:54:11 +00001255#line 360 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1256{
1257 yyval.Initializer = (new BinOpInit(BinOpInit::STRCONCAT, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
1258 ;
1259 break;}
1260case 31:
1261#line 364 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001262{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001263 yyval.StrVal = new std::string();
Chris Lattner81779692006-03-30 22:51:12 +00001264 ;
1265 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001266case 32:
1267#line 367 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001268{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001269 yyval.StrVal = yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001270 ;
1271 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001272case 33:
1273#line 371 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001274{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001275 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
1276 yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1277 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001278 ;
1279 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001280case 34:
1281#line 376 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001282{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001283 yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1284 delete yyvsp[0].StrVal;
1285 yyval.DagValueList = yyvsp[-3].DagValueList;
Chris Lattner81779692006-03-30 22:51:12 +00001286 ;
1287 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001288case 35:
1289#line 382 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001290{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001291 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
Chris Lattner81779692006-03-30 22:51:12 +00001292 ;
1293 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001294case 36:
1295#line 385 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001296{ yyval.DagValueList = yyvsp[0].DagValueList; ;
1297 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001298case 37:
1299#line 388 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001300{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001301 yyval.BitList = new std::vector<unsigned>();
1302 yyval.BitList->push_back(yyvsp[0].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001303 ;
1304 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001305case 38:
1306#line 391 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001307{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001308 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1309 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1310 exit(1);
1311 }
1312 yyval.BitList = new std::vector<unsigned>();
1313 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1314 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1315 yyval.BitList->push_back(i);
1316 } else {
1317 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1318 yyval.BitList->push_back(i);
1319 }
Chris Lattner81779692006-03-30 22:51:12 +00001320 ;
1321 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001322case 39:
1323#line 404 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001324{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001325 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1326 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1327 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1328 exit(1);
1329 }
1330 yyval.BitList = new std::vector<unsigned>();
1331 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1332 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1333 yyval.BitList->push_back(i);
1334 } else {
1335 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1336 yyval.BitList->push_back(i);
1337 }
Chris Lattner81779692006-03-30 22:51:12 +00001338 ;
1339 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001340case 40:
1341#line 418 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001342{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001343 (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001344 ;
1345 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001346case 41:
1347#line 420 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001348{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001349 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1350 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1351 exit(1);
1352 }
1353 yyval.BitList = yyvsp[-4].BitList;
1354 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1355 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1356 yyval.BitList->push_back(i);
1357 } else {
1358 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1359 yyval.BitList->push_back(i);
1360 }
Chris Lattner81779692006-03-30 22:51:12 +00001361 ;
1362 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001363case 42:
1364#line 433 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001365{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001366 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1367 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1368 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1369 exit(1);
1370 }
1371 yyval.BitList = yyvsp[-3].BitList;
1372 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1373 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1374 yyval.BitList->push_back(i);
1375 } else {
1376 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1377 yyval.BitList->push_back(i);
1378 }
Chris Lattner81779692006-03-30 22:51:12 +00001379 ;
1380 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001381case 43:
1382#line 449 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001383{ yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;
1384 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001385case 44:
1386#line 451 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001387{ yyval.BitList = 0; ;
1388 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001389case 45:
1390#line 451 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001391{ yyval.BitList = yyvsp[-1].BitList; ;
1392 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001393case 46:
1394#line 455 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001395{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001396 yyval.FieldList = new std::vector<Init*>();
Chris Lattner81779692006-03-30 22:51:12 +00001397 ;
1398 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001399case 47:
1400#line 457 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001401{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001402 yyval.FieldList = yyvsp[0].FieldList;
Chris Lattner81779692006-03-30 22:51:12 +00001403 ;
1404 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001405case 48:
1406#line 461 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001407{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001408 yyval.FieldList = new std::vector<Init*>();
1409 yyval.FieldList->push_back(yyvsp[0].Initializer);
Chris Lattner81779692006-03-30 22:51:12 +00001410 ;
1411 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001412case 49:
1413#line 464 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001414{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001415 (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer);
Chris Lattner81779692006-03-30 22:51:12 +00001416 ;
1417 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001418case 50:
1419#line 468 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001420{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001421 std::string DecName = *yyvsp[-1].StrVal;
1422 if (ParsingTemplateArgs)
1423 DecName = CurRec->getName() + ":" + DecName;
1424
1425 addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal));
1426 setValue(DecName, 0, yyvsp[0].Initializer);
1427 yyval.StrVal = new std::string(DecName);
Chris Lattner81779692006-03-30 22:51:12 +00001428;
1429 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001430case 51:
1431#line 478 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001432{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001433 delete yyvsp[-1].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001434;
1435 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001436case 52:
1437#line 480 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001438{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001439 setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer);
1440 delete yyvsp[-4].StrVal;
1441 delete yyvsp[-3].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001442;
1443 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001444case 57:
1445#line 489 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001446{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001447 yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>());
Chris Lattner81779692006-03-30 22:51:12 +00001448 ;
1449 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001450case 58:
1451#line 491 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001452{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001453 yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList);
Chris Lattner81779692006-03-30 22:51:12 +00001454 ;
1455 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001456case 59:
1457#line 495 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001458{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001459 yyval.SubClassList = new std::vector<SubClassRefTy>();
1460 yyval.SubClassList->push_back(*yyvsp[0].SubClassRef);
1461 delete yyvsp[0].SubClassRef;
Chris Lattner81779692006-03-30 22:51:12 +00001462 ;
1463 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001464case 60:
1465#line 500 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001466{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001467 (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef);
1468 delete yyvsp[0].SubClassRef;
Chris Lattner81779692006-03-30 22:51:12 +00001469 ;
1470 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001471case 61:
1472#line 505 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001473{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001474 yyval.SubClassList = new std::vector<SubClassRefTy>();
Chris Lattner81779692006-03-30 22:51:12 +00001475 ;
1476 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001477case 62:
1478#line 508 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001479{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001480 yyval.SubClassList = yyvsp[0].SubClassList;
Chris Lattner81779692006-03-30 22:51:12 +00001481 ;
1482 break;}
Chris Lattner81779692006-03-30 22:51:12 +00001483case 63:
Chris Lattnerb8316912006-03-31 21:54:11 +00001484#line 512 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001485{
Chris Lattnerca572be2005-09-08 18:48:47 +00001486 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1487 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001488;
1489 break;}
1490case 64:
Chris Lattnerb8316912006-03-31 21:54:11 +00001491#line 515 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1492{
1493 CurRec->addTemplateArg(*yyvsp[0].StrVal);
1494 delete yyvsp[0].StrVal;
1495;
1496 break;}
1497case 65:
1498#line 520 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001499{;
1500 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001501case 68:
1502#line 523 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001503{ yyval.StrVal = yyvsp[0].StrVal; ;
1504 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001505case 69:
1506#line 523 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001507{ yyval.StrVal = new std::string(); ;
1508 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001509case 70:
1510#line 525 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001511{
Chris Lattner8d354e92005-09-30 04:11:27 +00001512 static unsigned AnonCounter = 0;
1513 if (yyvsp[0].StrVal->empty())
1514 *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++);
Chris Lattner946ac932005-09-30 04:53:25 +00001515 yyval.StrVal = yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001516;
1517 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001518case 71:
1519#line 532 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001520{
Chris Lattner946ac932005-09-30 04:53:25 +00001521 // If a class of this name already exists, it must be a forward ref.
Chris Lattner88b7e6e2005-09-30 06:09:50 +00001522 if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) {
Chris Lattner946ac932005-09-30 04:53:25 +00001523 // If the body was previously defined, this is an error.
1524 if (!CurRec->getValues().empty() ||
1525 !CurRec->getSuperClasses().empty() ||
1526 !CurRec->getTemplateArgs().empty()) {
1527 err() << "Class '" << CurRec->getName() << "' already defined!\n";
1528 exit(1);
1529 }
1530 } else {
1531 // If this is the first reference to this class, create and add it.
1532 CurRec = new Record(*yyvsp[0].StrVal);
1533 Records.addClass(CurRec);
Chris Lattner8d354e92005-09-30 04:11:27 +00001534 }
Chris Lattner946ac932005-09-30 04:53:25 +00001535 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001536;
1537 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001538case 72:
1539#line 550 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001540{
Chris Lattner946ac932005-09-30 04:53:25 +00001541 CurRec = new Record(*yyvsp[0].StrVal);
1542 delete yyvsp[0].StrVal;
1543
Chris Lattner8d354e92005-09-30 04:11:27 +00001544 // Ensure redefinition doesn't happen.
1545 if (Records.getDef(CurRec->getName())) {
1546 err() << "Def '" << CurRec->getName() << "' already defined!\n";
1547 exit(1);
1548 }
1549 Records.addDef(CurRec);
Chris Lattner81779692006-03-30 22:51:12 +00001550;
1551 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001552case 73:
1553#line 562 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001554{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001555 for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001556 addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001557 // Delete the template arg values for the class
1558 delete (*yyvsp[0].SubClassList)[i].second;
1559 }
1560 delete yyvsp[0].SubClassList; // Delete the class list...
Chris Lattner0a284052005-09-30 04:42:56 +00001561
Chris Lattnerba4b1442005-09-08 18:22:57 +00001562 // Process any variables on the set stack...
1563 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001564 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
1565 setValue(LetStack[i][j].Name,
1566 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
1567 LetStack[i][j].Value);
Chris Lattner81779692006-03-30 22:51:12 +00001568 ;
1569 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001570case 74:
1571#line 576 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001572{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001573 yyval.Rec = CurRec;
1574 CurRec = 0;
Chris Lattner81779692006-03-30 22:51:12 +00001575 ;
1576 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001577case 75:
1578#line 581 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001579{
Chris Lattner946ac932005-09-30 04:53:25 +00001580 ParsingTemplateArgs = true;
Chris Lattner81779692006-03-30 22:51:12 +00001581 ;
1582 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001583case 76:
1584#line 583 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001585{
Chris Lattner946ac932005-09-30 04:53:25 +00001586 ParsingTemplateArgs = false;
Chris Lattner81779692006-03-30 22:51:12 +00001587 ;
1588 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001589case 77:
1590#line 585 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001591{
Chris Lattner0a284052005-09-30 04:42:56 +00001592 yyval.Rec = yyvsp[0].Rec;
Chris Lattner81779692006-03-30 22:51:12 +00001593 ;
1594 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001595case 78:
1596#line 589 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001597{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001598 yyvsp[0].Rec->resolveReferences();
1599
Chris Lattnerca572be2005-09-08 18:48:47 +00001600 // If ObjectBody has template arguments, it's an error.
Chris Lattner0a284052005-09-30 04:42:56 +00001601 assert(yyvsp[0].Rec->getTemplateArgs().empty() && "How'd this get template args?");
Chris Lattner8d354e92005-09-30 04:11:27 +00001602 yyval.Rec = yyvsp[0].Rec;
Chris Lattner81779692006-03-30 22:51:12 +00001603;
1604 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001605case 81:
1606#line 600 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001607{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001608 LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer));
1609 delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001610;
1611 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001612case 84:
1613#line 608 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001614{ LetStack.push_back(std::vector<LetRecord>()); ;
1615 break;}
Chris Lattner81779692006-03-30 22:51:12 +00001616case 86:
Chris Lattnerb8316912006-03-31 21:54:11 +00001617#line 611 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001618{
Chris Lattner946ac932005-09-30 04:53:25 +00001619 LetStack.pop_back();
Chris Lattner81779692006-03-30 22:51:12 +00001620 ;
1621 break;}
1622case 87:
Chris Lattnerb8316912006-03-31 21:54:11 +00001623#line 614 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1624{
1625 LetStack.pop_back();
1626 ;
Chris Lattner81779692006-03-30 22:51:12 +00001627 break;}
1628case 88:
Chris Lattnerb8316912006-03-31 21:54:11 +00001629#line 618 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001630{;
1631 break;}
1632case 89:
Chris Lattnerb8316912006-03-31 21:54:11 +00001633#line 618 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1634{;
1635 break;}
1636case 90:
1637#line 620 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001638{;
1639 break;}
1640}
1641 /* the action file gets copied in in place of this dollarsign */
1642#line 543 "/usr/share/bison.simple"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001643
1644 yyvsp -= yylen;
1645 yyssp -= yylen;
Chris Lattner81779692006-03-30 22:51:12 +00001646#ifdef YYLSP_NEEDED
1647 yylsp -= yylen;
1648#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001649
Chris Lattner81779692006-03-30 22:51:12 +00001650#if YYDEBUG != 0
1651 if (yydebug)
1652 {
1653 short *ssp1 = yyss - 1;
1654 fprintf (stderr, "state stack now");
1655 while (ssp1 != yyssp)
1656 fprintf (stderr, " %d", *++ssp1);
1657 fprintf (stderr, "\n");
1658 }
1659#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001660
1661 *++yyvsp = yyval;
1662
Chris Lattner81779692006-03-30 22:51:12 +00001663#ifdef YYLSP_NEEDED
1664 yylsp++;
1665 if (yylen == 0)
1666 {
1667 yylsp->first_line = yylloc.first_line;
1668 yylsp->first_column = yylloc.first_column;
1669 yylsp->last_line = (yylsp-1)->last_line;
1670 yylsp->last_column = (yylsp-1)->last_column;
1671 yylsp->text = 0;
1672 }
1673 else
1674 {
1675 yylsp->last_line = (yylsp+yylen-1)->last_line;
1676 yylsp->last_column = (yylsp+yylen-1)->last_column;
1677 }
1678#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001679
Chris Lattner81779692006-03-30 22:51:12 +00001680 /* Now "shift" the result of the reduction.
1681 Determine what state that goes to,
1682 based on the state we popped back to
1683 and the rule number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001684
1685 yyn = yyr1[yyn];
1686
Chris Lattner81779692006-03-30 22:51:12 +00001687 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1688 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001689 yystate = yytable[yystate];
1690 else
Chris Lattner81779692006-03-30 22:51:12 +00001691 yystate = yydefgoto[yyn - YYNTBASE];
Reid Spencer68a24bd2005-08-27 18:50:39 +00001692
1693 goto yynewstate;
1694
Chris Lattner81779692006-03-30 22:51:12 +00001695yyerrlab: /* here on detecting error */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001696
Chris Lattner81779692006-03-30 22:51:12 +00001697 if (! yyerrstatus)
1698 /* If not already recovering from an error, report this error. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001699 {
1700 ++yynerrs;
Chris Lattner81779692006-03-30 22:51:12 +00001701
1702#ifdef YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00001703 yyn = yypact[yystate];
1704
Chris Lattner81779692006-03-30 22:51:12 +00001705 if (yyn > YYFLAG && yyn < YYLAST)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001706 {
Chris Lattner81779692006-03-30 22:51:12 +00001707 int size = 0;
1708 char *msg;
1709 int x, count;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001710
Chris Lattner81779692006-03-30 22:51:12 +00001711 count = 0;
1712 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1713 for (x = (yyn < 0 ? -yyn : 0);
1714 x < (sizeof(yytname) / sizeof(char *)); x++)
1715 if (yycheck[x + yyn] == x)
1716 size += strlen(yytname[x]) + 15, count++;
1717 msg = (char *) malloc(size + 15);
1718 if (msg != 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001719 {
Chris Lattner81779692006-03-30 22:51:12 +00001720 strcpy(msg, "parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001721
Chris Lattner81779692006-03-30 22:51:12 +00001722 if (count < 5)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001723 {
Chris Lattner81779692006-03-30 22:51:12 +00001724 count = 0;
1725 for (x = (yyn < 0 ? -yyn : 0);
1726 x < (sizeof(yytname) / sizeof(char *)); x++)
1727 if (yycheck[x + yyn] == x)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001728 {
Chris Lattner81779692006-03-30 22:51:12 +00001729 strcat(msg, count == 0 ? ", expecting `" : " or `");
1730 strcat(msg, yytname[x]);
1731 strcat(msg, "'");
1732 count++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001733 }
1734 }
Chris Lattner81779692006-03-30 22:51:12 +00001735 yyerror(msg);
1736 free(msg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001737 }
1738 else
Chris Lattner81779692006-03-30 22:51:12 +00001739 yyerror ("parse error; also virtual memory exceeded");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001740 }
1741 else
1742#endif /* YYERROR_VERBOSE */
Chris Lattner81779692006-03-30 22:51:12 +00001743 yyerror("parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001744 }
1745
Chris Lattner81779692006-03-30 22:51:12 +00001746 goto yyerrlab1;
1747yyerrlab1: /* here on error raised explicitly by an action */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001748
1749 if (yyerrstatus == 3)
1750 {
Chris Lattner81779692006-03-30 22:51:12 +00001751 /* if just tried and failed to reuse lookahead token after an error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001752
Chris Lattner81779692006-03-30 22:51:12 +00001753 /* return failure if at end of input */
Chris Lattnerba4b1442005-09-08 18:22:57 +00001754 if (yychar == YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001755 YYABORT;
1756
Chris Lattner81779692006-03-30 22:51:12 +00001757#if YYDEBUG != 0
1758 if (yydebug)
1759 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1760#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +00001761
Chris Lattner81779692006-03-30 22:51:12 +00001762 yychar = YYEMPTY;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001763 }
1764
Chris Lattner81779692006-03-30 22:51:12 +00001765 /* Else will try to reuse lookahead token
1766 after shifting the error token. */
1767
1768 yyerrstatus = 3; /* Each real token shifted decrements this */
1769
1770 goto yyerrhandle;
1771
1772yyerrdefault: /* current state does not do anything special for the error token. */
1773
1774#if 0
1775 /* This is wrong; only states that explicitly want error tokens
1776 should shift them. */
1777 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1778 if (yyn) goto yydefault;
1779#endif
1780
1781yyerrpop: /* pop the current state because it cannot handle the error token */
1782
1783 if (yyssp == yyss) YYABORT;
1784 yyvsp--;
1785 yystate = *--yyssp;
1786#ifdef YYLSP_NEEDED
1787 yylsp--;
1788#endif
1789
1790#if YYDEBUG != 0
1791 if (yydebug)
1792 {
1793 short *ssp1 = yyss - 1;
1794 fprintf (stderr, "Error: state stack now");
1795 while (ssp1 != yyssp)
1796 fprintf (stderr, " %d", *++ssp1);
1797 fprintf (stderr, "\n");
1798 }
1799#endif
1800
1801yyerrhandle:
1802
1803 yyn = yypact[yystate];
1804 if (yyn == YYFLAG)
1805 goto yyerrdefault;
1806
1807 yyn += YYTERROR;
1808 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1809 goto yyerrdefault;
1810
1811 yyn = yytable[yyn];
1812 if (yyn < 0)
1813 {
1814 if (yyn == YYFLAG)
1815 goto yyerrpop;
1816 yyn = -yyn;
1817 goto yyreduce;
1818 }
1819 else if (yyn == 0)
1820 goto yyerrpop;
1821
Reid Spencer68a24bd2005-08-27 18:50:39 +00001822 if (yyn == YYFINAL)
1823 YYACCEPT;
1824
Chris Lattner81779692006-03-30 22:51:12 +00001825#if YYDEBUG != 0
1826 if (yydebug)
1827 fprintf(stderr, "Shifting error token, ");
1828#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001829
1830 *++yyvsp = yylval;
Chris Lattner81779692006-03-30 22:51:12 +00001831#ifdef YYLSP_NEEDED
1832 *++yylsp = yylloc;
1833#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001834
1835 yystate = yyn;
1836 goto yynewstate;
1837
Chris Lattner81779692006-03-30 22:51:12 +00001838 yyacceptlab:
1839 /* YYACCEPT comes here. */
1840 if (yyfree_stacks)
1841 {
1842 free (yyss);
1843 free (yyvs);
1844#ifdef YYLSP_NEEDED
1845 free (yyls);
Chris Lattner2b931e82005-09-12 05:30:06 +00001846#endif
Chris Lattner81779692006-03-30 22:51:12 +00001847 }
1848 return 0;
John Criswelld7881242006-01-17 17:01:34 +00001849
Chris Lattner81779692006-03-30 22:51:12 +00001850 yyabortlab:
1851 /* YYABORT comes here. */
1852 if (yyfree_stacks)
1853 {
1854 free (yyss);
1855 free (yyvs);
1856#ifdef YYLSP_NEEDED
1857 free (yyls);
John Criswelld7881242006-01-17 17:01:34 +00001858#endif
Chris Lattner81779692006-03-30 22:51:12 +00001859 }
1860 return 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001861}
Chris Lattnerb8316912006-03-31 21:54:11 +00001862#line 622 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001863
1864
1865int yyerror(const char *ErrorMsg) {
1866 err() << "Error parsing: " << ErrorMsg << "\n";
1867 exit(1);
1868}