blob: 97045c5ee48f22e3d812bd2a9ed5a89429a3d8c5 [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
Chris Lattner27627382006-09-01 21:14:42 +000023#define MULTICLASS 266
24#define DEFM 267
25#define FIELD 268
26#define LET 269
27#define IN 270
28#define SHLTOK 271
29#define SRATOK 272
30#define SRLTOK 273
31#define STRCONCATTOK 274
32#define INTVAL 275
33#define ID 276
34#define VARNAME 277
35#define STRVAL 278
36#define CODEFRAGMENT 279
Reid Spencer68a24bd2005-08-27 18:50:39 +000037
Chris Lattner81779692006-03-30 22:51:12 +000038#line 14 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +000039
40#include "Record.h"
41#include "llvm/ADT/StringExtras.h"
42#include <algorithm>
43#include <cstdio>
44#define YYERROR_VERBOSE 1
45
46int yyerror(const char *ErrorMsg);
47int yylex();
48
49namespace llvm {
Chris Lattner27627382006-09-01 21:14:42 +000050 struct MultiClass {
51 Record Rec; // Placeholder for template args and Name.
52 std::vector<Record*> DefPrototypes;
53
54 MultiClass(const std::string &Name) : Rec(Name) {}
55 };
Reid Spencer68a24bd2005-08-27 18:50:39 +000056
Chris Lattner27627382006-09-01 21:14:42 +000057
58static std::map<std::string, MultiClass*> MultiClasses;
59
Reid Spencer68a24bd2005-08-27 18:50:39 +000060extern int Filelineno;
Chris Lattner27627382006-09-01 21:14:42 +000061static MultiClass *CurMultiClass = 0; // Set while parsing a multiclass.
62static std::string *CurDefmPrefix = 0; // Set while parsing defm.
Reid Spencer68a24bd2005-08-27 18:50:39 +000063static Record *CurRec = 0;
64static bool ParsingTemplateArgs = false;
65
66typedef std::pair<Record*, std::vector<Init*>*> SubClassRefTy;
67
68struct LetRecord {
69 std::string Name;
70 std::vector<unsigned> Bits;
71 Init *Value;
72 bool HasBits;
73 LetRecord(const std::string &N, std::vector<unsigned> *B, Init *V)
74 : Name(N), Value(V), HasBits(B != 0) {
75 if (HasBits) Bits = *B;
76 }
77};
78
79static std::vector<std::vector<LetRecord> > LetStack;
80
81
82extern std::ostream &err();
83
Chris Lattner27627382006-09-01 21:14:42 +000084/// getActiveRec - If inside a def/class definition, return the def/class.
85/// Otherwise, if within a multidef, return it.
86static Record *getActiveRec() {
87 return CurRec ? CurRec : &CurMultiClass->Rec;
88}
89
Reid Spencer68a24bd2005-08-27 18:50:39 +000090static void addValue(const RecordVal &RV) {
Chris Lattner27627382006-09-01 21:14:42 +000091 Record *TheRec = getActiveRec();
92
93 if (RecordVal *ERV = TheRec->getValue(RV.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +000094 // The value already exists in the class, treat this as a set...
95 if (ERV->setValue(RV.getValue())) {
96 err() << "New definition of '" << RV.getName() << "' of type '"
97 << *RV.getType() << "' is incompatible with previous "
98 << "definition of type '" << *ERV->getType() << "'!\n";
99 exit(1);
100 }
101 } else {
Chris Lattner27627382006-09-01 21:14:42 +0000102 TheRec->addValue(RV);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000103 }
104}
105
106static void addSuperClass(Record *SC) {
107 if (CurRec->isSubClassOf(SC)) {
108 err() << "Already subclass of '" << SC->getName() << "'!\n";
109 exit(1);
110 }
111 CurRec->addSuperClass(SC);
112}
113
114static void setValue(const std::string &ValName,
Chris Lattner81779692006-03-30 22:51:12 +0000115 std::vector<unsigned> *BitList, Init *V) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000116 if (!V) return;
117
118 RecordVal *RV = CurRec->getValue(ValName);
119 if (RV == 0) {
120 err() << "Value '" << ValName << "' unknown!\n";
121 exit(1);
122 }
123
124 // Do not allow assignments like 'X = X'. This will just cause infinite loops
125 // in the resolution machinery.
126 if (!BitList)
127 if (VarInit *VI = dynamic_cast<VarInit*>(V))
128 if (VI->getName() == ValName)
129 return;
130
131 // If we are assigning to a subset of the bits in the value... then we must be
132 // assigning to a field of BitsRecTy, which must have a BitsInit
133 // initializer...
134 //
135 if (BitList) {
136 BitsInit *CurVal = dynamic_cast<BitsInit*>(RV->getValue());
137 if (CurVal == 0) {
138 err() << "Value '" << ValName << "' is not a bits type!\n";
139 exit(1);
140 }
141
142 // Convert the incoming value to a bits type of the appropriate size...
143 Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size()));
144 if (BI == 0) {
145 V->convertInitializerTo(new BitsRecTy(BitList->size()));
146 err() << "Initializer '" << *V << "' not compatible with bit range!\n";
147 exit(1);
148 }
149
150 // We should have a BitsInit type now...
151 assert(dynamic_cast<BitsInit*>(BI) != 0 || &(std::cerr << *BI) == 0);
152 BitsInit *BInit = (BitsInit*)BI;
153
154 BitsInit *NewVal = new BitsInit(CurVal->getNumBits());
155
156 // Loop over bits, assigning values as appropriate...
157 for (unsigned i = 0, e = BitList->size(); i != e; ++i) {
158 unsigned Bit = (*BitList)[i];
159 if (NewVal->getBit(Bit)) {
160 err() << "Cannot set bit #" << Bit << " of value '" << ValName
161 << "' more than once!\n";
162 exit(1);
163 }
164 NewVal->setBit(Bit, BInit->getBit(i));
165 }
166
167 for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i)
168 if (NewVal->getBit(i) == 0)
169 NewVal->setBit(i, CurVal->getBit(i));
170
171 V = NewVal;
172 }
173
174 if (RV->setValue(V)) {
175 err() << "Value '" << ValName << "' of type '" << *RV->getType()
176 << "' is incompatible with initializer '" << *V << "'!\n";
177 exit(1);
178 }
179}
180
181// addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's
182// template arguments.
183static void addSubClass(Record *SC, const std::vector<Init*> &TemplateArgs) {
184 // Add all of the values in the subclass into the current class...
185 const std::vector<RecordVal> &Vals = SC->getValues();
186 for (unsigned i = 0, e = Vals.size(); i != e; ++i)
187 addValue(Vals[i]);
188
189 const std::vector<std::string> &TArgs = SC->getTemplateArgs();
190
191 // Ensure that an appropriate number of template arguments are specified...
192 if (TArgs.size() < TemplateArgs.size()) {
193 err() << "ERROR: More template args specified than expected!\n";
194 exit(1);
Chris Lattner27627382006-09-01 21:14:42 +0000195 }
196
197 // Loop over all of the template arguments, setting them to the specified
198 // value or leaving them as the default if necessary.
199 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
200 if (i < TemplateArgs.size()) { // A value is specified for this temp-arg?
201 // Set it now.
202 setValue(TArgs[i], 0, TemplateArgs[i]);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000203
Chris Lattner27627382006-09-01 21:14:42 +0000204 // Resolve it next.
205 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
206
207
208 // Now remove it.
209 CurRec->removeValue(TArgs[i]);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000210
Chris Lattner27627382006-09-01 21:14:42 +0000211 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
212 err() << "ERROR: Value not specified for template argument #"
213 << i << " (" << TArgs[i] << ") of subclass '" << SC->getName()
214 << "'!\n";
215 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000216 }
217 }
218
219 // Since everything went well, we can now set the "superclass" list for the
220 // current record.
Chris Lattner27627382006-09-01 21:14:42 +0000221 const std::vector<Record*> &SCs = SC->getSuperClasses();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000222 for (unsigned i = 0, e = SCs.size(); i != e; ++i)
223 addSuperClass(SCs[i]);
224 addSuperClass(SC);
225}
226
227} // End llvm namespace
228
229using namespace llvm;
230
231
Chris Lattner27627382006-09-01 21:14:42 +0000232#line 208 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +0000233typedef union {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000234 std::string* StrVal;
235 int IntVal;
236 llvm::RecTy* Ty;
237 llvm::Init* Initializer;
238 std::vector<llvm::Init*>* FieldList;
239 std::vector<unsigned>* BitList;
240 llvm::Record* Rec;
Chris Lattner27627382006-09-01 21:14:42 +0000241 std::vector<llvm::Record*>* RecList;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000242 SubClassRefTy* SubClassRef;
243 std::vector<SubClassRefTy>* SubClassList;
244 std::vector<std::pair<llvm::Init*, std::string> >* DagValueList;
245} YYSTYPE;
Chris Lattner81779692006-03-30 22:51:12 +0000246#include <stdio.h>
247
248#ifndef __cplusplus
249#ifndef __STDC__
250#define const
251#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000252#endif
253
254
255
Chris Lattner27627382006-09-01 21:14:42 +0000256#define YYFINAL 188
Chris Lattner81779692006-03-30 22:51:12 +0000257#define YYFLAG -32768
Chris Lattner27627382006-09-01 21:14:42 +0000258#define YYNTBASE 41
Reid Spencer68a24bd2005-08-27 18:50:39 +0000259
Chris Lattner27627382006-09-01 21:14:42 +0000260#define YYTRANSLATE(x) ((unsigned)(x) <= 279 ? yytranslate[x] : 90)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000261
Chris Lattner81779692006-03-30 22:51:12 +0000262static const char yytranslate[] = { 0,
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,
Chris Lattner27627382006-09-01 21:14:42 +0000266 2, 2, 2, 2, 2, 2, 2, 2, 2, 35,
267 36, 2, 2, 37, 39, 34, 2, 2, 2, 2,
268 2, 2, 2, 2, 2, 2, 2, 38, 40, 26,
269 28, 27, 29, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner81779692006-03-30 22:51:12 +0000270 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
271 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner27627382006-09-01 21:14:42 +0000272 32, 2, 33, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner81779692006-03-30 22:51:12 +0000273 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
274 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner27627382006-09-01 21:14:42 +0000275 2, 2, 30, 2, 31, 2, 2, 2, 2, 2,
Chris Lattner81779692006-03-30 22:51:12 +0000276 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
277 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
278 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
279 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
280 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
281 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
282 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
283 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
284 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
285 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
286 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
288 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
289 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
Chris Lattner27627382006-09-01 21:14:42 +0000290 17, 18, 19, 20, 21, 22, 23, 24, 25
Chris Lattner81779692006-03-30 22:51:12 +0000291};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000292
Chris Lattner81779692006-03-30 22:51:12 +0000293#if YYDEBUG != 0
294static const short yyprhs[] = { 0,
295 0, 2, 4, 6, 11, 13, 18, 20, 22, 24,
296 25, 27, 28, 31, 33, 35, 37, 39, 41, 43,
297 47, 52, 57, 61, 65, 70, 75, 82, 89, 96,
Chris Lattnerb8316912006-03-31 21:54:11 +0000298 103, 104, 107, 110, 115, 116, 118, 120, 124, 127,
299 131, 137, 142, 144, 145, 149, 150, 152, 154, 158,
300 163, 166, 173, 174, 177, 179, 183, 185, 190, 192,
301 196, 197, 200, 202, 206, 210, 211, 213, 215, 216,
302 218, 220, 222, 223, 227, 228, 229, 236, 240, 242,
Chris Lattner27627382006-09-01 21:14:42 +0000303 244, 247, 249, 250, 251, 260, 261, 268, 270, 272,
304 274, 276, 281, 283, 287, 288, 293, 298, 301, 303,
305 306
Chris Lattner81779692006-03-30 22:51:12 +0000306};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000307
Chris Lattner27627382006-09-01 21:14:42 +0000308static const short yyrhs[] = { 22,
309 0, 5, 0, 4, 0, 6, 26, 21, 27, 0,
310 3, 0, 7, 26, 42, 27, 0, 8, 0, 9,
311 0, 41, 0, 0, 14, 0, 0, 28, 46, 0,
312 22, 0, 45, 0, 21, 0, 24, 0, 25, 0,
313 29, 0, 30, 53, 31, 0, 22, 26, 54, 27,
314 0, 46, 30, 51, 31, 0, 32, 53, 33, 0,
315 46, 34, 22, 0, 35, 45, 49, 36, 0, 46,
316 32, 51, 33, 0, 17, 35, 46, 37, 46, 36,
317 0, 18, 35, 46, 37, 46, 36, 0, 19, 35,
318 46, 37, 46, 36, 0, 20, 35, 46, 37, 46,
319 36, 0, 0, 38, 23, 0, 46, 47, 0, 48,
320 37, 46, 47, 0, 0, 48, 0, 21, 0, 21,
321 39, 21, 0, 21, 21, 0, 50, 37, 21, 0,
322 50, 37, 21, 39, 21, 0, 50, 37, 21, 21,
323 0, 50, 0, 0, 30, 51, 31, 0, 0, 54,
324 0, 46, 0, 54, 37, 46, 0, 43, 42, 22,
325 44, 0, 55, 40, 0, 15, 22, 52, 28, 46,
326 40, 0, 0, 57, 56, 0, 40, 0, 30, 57,
327 31, 0, 41, 0, 41, 26, 54, 27, 0, 59,
328 0, 60, 37, 59, 0, 0, 38, 60, 0, 55,
329 0, 62, 37, 55, 0, 26, 62, 27, 0, 0,
330 63, 0, 22, 0, 0, 65, 0, 66, 0, 66,
331 0, 0, 61, 70, 58, 0, 0, 0, 10, 67,
332 72, 64, 73, 69, 0, 11, 68, 69, 0, 74,
333 0, 75, 0, 76, 75, 0, 22, 0, 0, 0,
334 12, 77, 79, 64, 80, 30, 76, 31, 0, 0,
335 13, 22, 82, 38, 59, 40, 0, 71, 0, 74,
336 0, 78, 0, 81, 0, 22, 52, 28, 46, 0,
337 84, 0, 85, 37, 84, 0, 0, 15, 87, 85,
338 16, 0, 86, 30, 88, 31, 0, 86, 83, 0,
339 83, 0, 88, 83, 0, 88, 0
Chris Lattner81779692006-03-30 22:51:12 +0000340};
Reid Spencer68a24bd2005-08-27 18:50:39 +0000341
342#endif
343
Chris Lattner81779692006-03-30 22:51:12 +0000344#if YYDEBUG != 0
345static const short yyrline[] = { 0,
Chris Lattner27627382006-09-01 21:14:42 +0000346 244, 266, 268, 270, 272, 274, 276, 278, 280, 284,
347 284, 286, 286, 288, 311, 313, 315, 318, 321, 323,
348 336, 364, 371, 374, 381, 384, 392, 394, 396, 398,
349 402, 405, 409, 414, 420, 423, 426, 429, 442, 456,
350 458, 471, 487, 489, 489, 493, 495, 499, 502, 506,
351 523, 525, 531, 531, 532, 532, 534, 536, 540, 545,
352 550, 553, 557, 560, 565, 566, 566, 568, 568, 570,
353 577, 595, 620, 634, 639, 641, 643, 647, 656, 670,
354 673, 677, 688, 690, 692, 697, 697, 759, 759, 760,
355 760, 762, 767, 767, 770, 770, 773, 776, 780, 780,
356 782
Chris Lattner81779692006-03-30 22:51:12 +0000357};
358#endif
359
360
361#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
362
363static const char * const yytname[] = { "$","error","$undefined.","INT","BIT",
Chris Lattner27627382006-09-01 21:14:42 +0000364"STRING","BITS","LIST","CODE","DAG","CLASS","DEF","MULTICLASS","DEFM","FIELD",
365"LET","IN","SHLTOK","SRATOK","SRLTOK","STRCONCATTOK","INTVAL","ID","VARNAME",
366"STRVAL","CODEFRAGMENT","'<'","'>'","'='","'?'","'{'","'}'","'['","']'","'.'",
367"'('","')'","','","':'","'-'","';'","ClassID","Type","OptPrefix","OptValue",
368"IDValue","Value","OptVarName","DagArgListNE","DagArgList","RBitList","BitList",
369"OptBitList","ValueList","ValueListNE","Declaration","BodyItem","BodyList","Body",
370"SubClassRef","ClassListNE","ClassList","DeclListNE","TemplateArgList","OptTemplateArgList",
371"OptID","ObjectName","ClassName","DefName","ObjectBody","@1","ClassInst","@2",
372"@3","DefInst","MultiClassDef","MultiClassBody","MultiClassName","MultiClassInst",
373"@4","@5","DefMInst","@6","Object","LETItem","LETList","LETCommand","@7","ObjectList",
374"File", NULL
Chris Lattner81779692006-03-30 22:51:12 +0000375};
376#endif
377
378static const short yyr1[] = { 0,
Chris Lattner27627382006-09-01 21:14:42 +0000379 41, 42, 42, 42, 42, 42, 42, 42, 42, 43,
380 43, 44, 44, 45, 46, 46, 46, 46, 46, 46,
381 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
382 47, 47, 48, 48, 49, 49, 50, 50, 50, 50,
383 50, 50, 51, 52, 52, 53, 53, 54, 54, 55,
384 56, 56, 57, 57, 58, 58, 59, 59, 60, 60,
385 61, 61, 62, 62, 63, 64, 64, 65, 65, 66,
386 67, 68, 70, 69, 72, 73, 71, 74, 75, 76,
387 76, 77, 79, 80, 78, 82, 81, 83, 83, 83,
388 83, 84, 85, 85, 87, 86, 83, 83, 88, 88,
389 89
Chris Lattner81779692006-03-30 22:51:12 +0000390};
391
392static const short yyr2[] = { 0,
393 1, 1, 1, 4, 1, 4, 1, 1, 1, 0,
394 1, 0, 2, 1, 1, 1, 1, 1, 1, 3,
Chris Lattnerb8316912006-03-31 21:54:11 +0000395 4, 4, 3, 3, 4, 4, 6, 6, 6, 6,
396 0, 2, 2, 4, 0, 1, 1, 3, 2, 3,
397 5, 4, 1, 0, 3, 0, 1, 1, 3, 4,
398 2, 6, 0, 2, 1, 3, 1, 4, 1, 3,
399 0, 2, 1, 3, 3, 0, 1, 1, 0, 1,
400 1, 1, 0, 3, 0, 0, 6, 3, 1, 1,
Chris Lattner27627382006-09-01 21:14:42 +0000401 2, 1, 0, 0, 8, 0, 6, 1, 1, 1,
402 1, 4, 1, 3, 0, 4, 4, 2, 1, 2,
403 1
Chris Lattner81779692006-03-30 22:51:12 +0000404};
405
406static const short yydefact[] = { 0,
Chris Lattner27627382006-09-01 21:14:42 +0000407 69, 69, 0, 0, 95, 88, 89, 90, 91, 99,
408 0, 101, 68, 70, 71, 75, 72, 61, 82, 83,
409 86, 0, 0, 98, 100, 66, 0, 73, 78, 66,
410 0, 44, 93, 0, 0, 10, 67, 76, 1, 57,
411 59, 62, 0, 84, 0, 0, 0, 96, 0, 97,
412 11, 0, 63, 0, 61, 0, 0, 53, 55, 74,
413 0, 0, 37, 43, 0, 0, 94, 5, 3, 2,
414 0, 0, 7, 8, 9, 0, 65, 10, 77, 0,
415 0, 0, 0, 16, 14, 17, 18, 19, 46, 46,
416 0, 15, 48, 0, 60, 10, 0, 87, 39, 0,
417 0, 45, 92, 0, 0, 12, 64, 0, 0, 0,
418 0, 0, 0, 47, 0, 14, 35, 0, 0, 0,
419 58, 0, 0, 56, 0, 54, 79, 80, 0, 38,
420 40, 0, 0, 0, 50, 0, 0, 0, 0, 0,
421 20, 23, 31, 36, 0, 0, 0, 24, 49, 44,
422 51, 85, 81, 42, 0, 4, 6, 13, 0, 0,
Chris Lattnerb8316912006-03-31 21:54:11 +0000423 0, 0, 21, 0, 33, 0, 25, 22, 26, 0,
424 41, 0, 0, 0, 0, 32, 31, 0, 27, 28,
425 29, 30, 34, 0, 52, 0, 0, 0
Chris Lattner81779692006-03-30 22:51:12 +0000426};
427
Chris Lattner27627382006-09-01 21:14:42 +0000428static const short yydefgoto[] = { 40,
429 76, 52, 135, 92, 93, 165, 144, 145, 64, 65,
430 47, 113, 114, 53, 126, 96, 60, 41, 42, 28,
431 54, 37, 38, 14, 15, 16, 18, 29, 43, 6,
432 26, 55, 7, 128, 129, 20, 8, 30, 61, 9,
433 31, 10, 33, 34, 11, 22, 12, 186
Chris Lattner81779692006-03-30 22:51:12 +0000434};
435
Chris Lattner27627382006-09-01 21:14:42 +0000436static const short yypact[] = { 129,
437 3, 3, 11, 19,-32768,-32768,-32768,-32768,-32768,-32768,
438 2, 129,-32768,-32768,-32768,-32768,-32768, 29,-32768,-32768,
439-32768, 24, 129,-32768,-32768, 43, 31,-32768,-32768, 43,
440 40, 50,-32768, -6, -4, 69,-32768,-32768,-32768, 59,
441-32768, 61, 10,-32768, 31, 81, 78,-32768, 24,-32768,
442-32768, 15,-32768, 12, 29, 41, 31,-32768,-32768,-32768,
443 84, 68, 8, 83, 87, 41,-32768,-32768,-32768,-32768,
444 111, 120,-32768,-32768,-32768, 126,-32768, 69,-32768, 114,
445 115, 116, 117,-32768, 127,-32768,-32768,-32768, 41, 41,
446 132,-32768, 113, 27,-32768, 60, 144,-32768,-32768, 135,
447 136,-32768, 113, 137, 15, 131,-32768, 41, 41, 41,
448 41, 41, 130, 123, 133,-32768, 41, 81, 81, 140,
449-32768, 41, 141,-32768, 124,-32768,-32768,-32768, 5,-32768,
450 9, 138, 142, 41,-32768, 67, 73, 79, 85, 45,
451-32768,-32768, 54, 134, 139, 143, 145,-32768, 113, 50,
452-32768,-32768,-32768,-32768, 146,-32768,-32768, 113, 41, 41,
453 41, 41,-32768, 147,-32768, 41,-32768,-32768,-32768, 148,
454-32768, 91, 94, 99, 102,-32768, 54, 41,-32768,-32768,
455-32768,-32768,-32768, 47,-32768, 168, 172,-32768
Chris Lattner81779692006-03-30 22:51:12 +0000456};
457
Chris Lattner27627382006-09-01 21:14:42 +0000458static const short yypgoto[] = { -50,
459 72,-32768,-32768, 82, -66, 4,-32768,-32768,-32768, -29,
460 30, 89, -55, -44,-32768,-32768,-32768, -19,-32768,-32768,
461-32768,-32768, 152,-32768, 181,-32768,-32768, 149,-32768,-32768,
462-32768,-32768, -94, 55,-32768,-32768,-32768,-32768,-32768,-32768,
463-32768, -7, 150,-32768,-32768,-32768, 162,-32768
Chris Lattner81779692006-03-30 22:51:12 +0000464};
465
466
Chris Lattner27627382006-09-01 21:14:42 +0000467#define YYLAST 204
Chris Lattner81779692006-03-30 22:51:12 +0000468
469
Chris Lattner27627382006-09-01 21:14:42 +0000470static const short yytable[] = { 103,
471 94, 75, 127, 24, 25, 1, 2, 3, 4, 48,
472 5, 1, 2, 3, 4, 2, 5, 68, 69, 70,
473 71, 72, 73, 74, 13, 62, 50, 25, 99, 154,
474 49, 23, 19, 107, 127, 152, 39, 95, 77, 58,
475 21, 136, 137, 138, 139, 32, 100, 155, 78, 59,
476 143, 125, 39, 121, 75, 149, 140, 80, 81, 82,
477 83, 84, 85, 122, 86, 87, 27, 158, 36, 88,
478 89, 163, 90, 51, 123, 91, 118, 45, 119, 46,
479 120, 122, 51, 118, 56, 119, 185, 120, 146, 147,
480 124, 164, 172, 173, 174, 175, 118, 57, 119, 177,
481 120, 63, 118, 159, 119, 66, 120, 98, 118, 160,
482 119, 184, 120, 97, 118, 161, 119, 102, 120, 101,
483 118, 162, 119, 118, 120, 119, 179, 120, 118, 180,
484 119, 118, 120, 119, 181, 120, 104, 182, 1, 2,
485 3, 4, 118, 5, 119, 105, 120, 106, 108, 109,
486 110, 111, 112, 116, 2, 130, 131, 132, 134, 122,
487 141, 148, 150, 151, 156, 142, 171, 187, 157, 176,
488 166, 188, 117, 168, 167, 178, 133, 169, 115, 170,
489 183, 44, 17, 153, 35, 0, 0, 0, 0, 0,
490 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
491 0, 0, 0, 79
Chris Lattner81779692006-03-30 22:51:12 +0000492};
493
Chris Lattner27627382006-09-01 21:14:42 +0000494static const short yycheck[] = { 66,
495 56, 52, 97, 11, 12, 10, 11, 12, 13, 16,
496 15, 10, 11, 12, 13, 11, 15, 3, 4, 5,
497 6, 7, 8, 9, 22, 45, 31, 35, 21, 21,
498 37, 30, 22, 78, 129, 31, 22, 57, 27, 30,
499 22, 108, 109, 110, 111, 22, 39, 39, 37, 40,
500 117, 96, 22, 27, 105, 122, 112, 17, 18, 19,
501 20, 21, 22, 37, 24, 25, 38, 134, 26, 29,
502 30, 27, 32, 14, 15, 35, 30, 38, 32, 30,
503 34, 37, 14, 30, 26, 32, 40, 34, 118, 119,
504 31, 38, 159, 160, 161, 162, 30, 37, 32, 166,
505 34, 21, 30, 37, 32, 28, 34, 40, 30, 37,
506 32, 178, 34, 30, 30, 37, 32, 31, 34, 37,
507 30, 37, 32, 30, 34, 32, 36, 34, 30, 36,
508 32, 30, 34, 32, 36, 34, 26, 36, 10, 11,
509 12, 13, 30, 15, 32, 26, 34, 22, 35, 35,
510 35, 35, 26, 22, 11, 21, 21, 21, 28, 37,
511 31, 22, 22, 40, 27, 33, 21, 0, 27, 23,
512 37, 0, 91, 31, 36, 28, 105, 33, 90, 150,
513 177, 30, 2, 129, 23, -1, -1, -1, -1, -1,
514 -1, -1, -1, -1, -1, -1, -1, -1, 49, -1,
515 -1, -1, -1, 55
Chris Lattner81779692006-03-30 22:51:12 +0000516};
517/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
518#line 3 "/usr/share/bison.simple"
519/* This file comes from bison-1.28. */
520
521/* Skeleton output parser for bison,
522 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
523
524 This program is free software; you can redistribute it and/or modify
525 it under the terms of the GNU General Public License as published by
526 the Free Software Foundation; either version 2, or (at your option)
527 any later version.
528
529 This program is distributed in the hope that it will be useful,
530 but WITHOUT ANY WARRANTY; without even the implied warranty of
531 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
532 GNU General Public License for more details.
533
534 You should have received a copy of the GNU General Public License
535 along with this program; if not, write to the Free Software
536 Foundation, Inc., 59 Temple Place - Suite 330,
537 Boston, MA 02111-1307, USA. */
538
539/* As a special exception, when this file is copied by Bison into a
540 Bison output file, you may use that output file without restriction.
541 This special exception was added by the Free Software Foundation
542 in version 1.24 of Bison. */
543
544/* This is the parser code that is written into each bison parser
545 when the %semantic_parser declaration is not specified in the grammar.
546 It was written by Richard Stallman by simplifying the hairy parser
547 used when %semantic_parser is specified. */
548
549#ifndef YYSTACK_USE_ALLOCA
550#ifdef alloca
551#define YYSTACK_USE_ALLOCA
552#else /* alloca not defined */
553#ifdef __GNUC__
554#define YYSTACK_USE_ALLOCA
555#define alloca __builtin_alloca
556#else /* not GNU C. */
557#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
558#define YYSTACK_USE_ALLOCA
559#include <alloca.h>
560#else /* not sparc */
561/* We think this test detects Watcom and Microsoft C. */
562/* This used to test MSDOS, but that is a bad idea
563 since that symbol is in the user namespace. */
564#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
565#if 0 /* No need for malloc.h, which pollutes the namespace;
566 instead, just don't use alloca. */
567#include <malloc.h>
568#endif
569#else /* not MSDOS, or __TURBOC__ */
570#if defined(_AIX)
571/* I don't know what this was needed for, but it pollutes the namespace.
572 So I turned it off. rms, 2 May 1997. */
573/* #include <malloc.h> */
574 #pragma alloca
575#define YYSTACK_USE_ALLOCA
576#else /* not MSDOS, or __TURBOC__, or _AIX */
577#if 0
578#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
579 and on HPUX 10. Eventually we can turn this on. */
580#define YYSTACK_USE_ALLOCA
581#define alloca __builtin_alloca
582#endif /* __hpux */
583#endif
584#endif /* not _AIX */
585#endif /* not MSDOS, or __TURBOC__ */
586#endif /* not sparc */
587#endif /* not GNU C */
588#endif /* alloca not defined */
589#endif /* YYSTACK_USE_ALLOCA not defined */
590
591#ifdef YYSTACK_USE_ALLOCA
592#define YYSTACK_ALLOC alloca
Reid Spencer68a24bd2005-08-27 18:50:39 +0000593#else
Chris Lattner81779692006-03-30 22:51:12 +0000594#define YYSTACK_ALLOC malloc
Reid Spencer68a24bd2005-08-27 18:50:39 +0000595#endif
596
Chris Lattner81779692006-03-30 22:51:12 +0000597/* Note: there must be only one dollar sign in this file.
598 It is replaced by the list of actions, each action
599 as one case of the switch. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000600
601#define yyerrok (yyerrstatus = 0)
602#define yyclearin (yychar = YYEMPTY)
Chris Lattner81779692006-03-30 22:51:12 +0000603#define YYEMPTY -2
Reid Spencer68a24bd2005-08-27 18:50:39 +0000604#define YYEOF 0
Reid Spencer68a24bd2005-08-27 18:50:39 +0000605#define YYACCEPT goto yyacceptlab
Chris Lattner81779692006-03-30 22:51:12 +0000606#define YYABORT goto yyabortlab
Chris Lattnerba4b1442005-09-08 18:22:57 +0000607#define YYERROR goto yyerrlab1
Chris Lattner81779692006-03-30 22:51:12 +0000608/* Like YYERROR except do call yyerror.
609 This remains here temporarily to ease the
610 transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000611 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000612#define YYFAIL goto yyerrlab
Reid Spencer68a24bd2005-08-27 18:50:39 +0000613#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner81779692006-03-30 22:51:12 +0000614#define YYBACKUP(token, value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000615do \
616 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner81779692006-03-30 22:51:12 +0000617 { yychar = (token), yylval = (value); \
618 yychar1 = YYTRANSLATE (yychar); \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000619 YYPOPSTACK; \
620 goto yybackup; \
621 } \
622 else \
Chris Lattner81779692006-03-30 22:51:12 +0000623 { yyerror ("syntax error: cannot back up"); YYERROR; } \
Reid Spencer68a24bd2005-08-27 18:50:39 +0000624while (0)
625
626#define YYTERROR 1
627#define YYERRCODE 256
628
Chris Lattner81779692006-03-30 22:51:12 +0000629#ifndef YYPURE
630#define YYLEX yylex()
Reid Spencer68a24bd2005-08-27 18:50:39 +0000631#endif
632
Chris Lattner81779692006-03-30 22:51:12 +0000633#ifdef YYPURE
634#ifdef YYLSP_NEEDED
Reid Spencer68a24bd2005-08-27 18:50:39 +0000635#ifdef YYLEX_PARAM
Chris Lattner81779692006-03-30 22:51:12 +0000636#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000637#else
Chris Lattner81779692006-03-30 22:51:12 +0000638#define YYLEX yylex(&yylval, &yylloc)
639#endif
640#else /* not YYLSP_NEEDED */
641#ifdef YYLEX_PARAM
642#define YYLEX yylex(&yylval, YYLEX_PARAM)
643#else
644#define YYLEX yylex(&yylval)
645#endif
646#endif /* not YYLSP_NEEDED */
Chris Lattner8d354e92005-09-30 04:11:27 +0000647#endif
John Criswelld7881242006-01-17 17:01:34 +0000648
Chris Lattner81779692006-03-30 22:51:12 +0000649/* If nonreentrant, generate the variables here */
John Criswelld7881242006-01-17 17:01:34 +0000650
Chris Lattner81779692006-03-30 22:51:12 +0000651#ifndef YYPURE
John Criswelld7881242006-01-17 17:01:34 +0000652
Chris Lattner81779692006-03-30 22:51:12 +0000653int yychar; /* the lookahead symbol */
654YYSTYPE yylval; /* the semantic value of the */
655 /* lookahead symbol */
John Criswelld7881242006-01-17 17:01:34 +0000656
Chris Lattner81779692006-03-30 22:51:12 +0000657#ifdef YYLSP_NEEDED
658YYLTYPE yylloc; /* location data for the lookahead */
659 /* symbol */
Chris Lattner8d354e92005-09-30 04:11:27 +0000660#endif
John Criswelld7881242006-01-17 17:01:34 +0000661
Chris Lattner81779692006-03-30 22:51:12 +0000662int yynerrs; /* number of parse errors so far */
663#endif /* not YYPURE */
John Criswelld7881242006-01-17 17:01:34 +0000664
Chris Lattner81779692006-03-30 22:51:12 +0000665#if YYDEBUG != 0
666int yydebug; /* nonzero means print parse trace */
667/* Since this is uninitialized, it does not stop multiple parsers
668 from coexisting. */
Chris Lattnerba4b1442005-09-08 18:22:57 +0000669#endif
Chris Lattner2b931e82005-09-12 05:30:06 +0000670
Chris Lattner81779692006-03-30 22:51:12 +0000671/* YYINITDEPTH indicates the initial size of the parser's stacks */
Chris Lattner2b931e82005-09-12 05:30:06 +0000672
Reid Spencer68a24bd2005-08-27 18:50:39 +0000673#ifndef YYINITDEPTH
Chris Lattner81779692006-03-30 22:51:12 +0000674#define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +0000675#endif
676
Chris Lattner81779692006-03-30 22:51:12 +0000677/* YYMAXDEPTH is the maximum size the stacks can grow to
678 (effective only if the built-in stack extension method is used). */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000679
Chris Lattnerba4b1442005-09-08 18:22:57 +0000680#if YYMAXDEPTH == 0
Chris Lattner81779692006-03-30 22:51:12 +0000681#undef YYMAXDEPTH
Reid Spencer68a24bd2005-08-27 18:50:39 +0000682#endif
683
684#ifndef YYMAXDEPTH
Chris Lattner81779692006-03-30 22:51:12 +0000685#define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +0000686#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000687
Chris Lattner81779692006-03-30 22:51:12 +0000688/* Define __yy_memcpy. Note that the size argument
689 should be passed with type unsigned int, because that is what the non-GCC
690 definitions require. With GCC, __builtin_memcpy takes an arg
691 of type size_t, but it can handle unsigned int. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000692
Chris Lattner81779692006-03-30 22:51:12 +0000693#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
694#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
695#else /* not GNU C or C++ */
696#ifndef __cplusplus
Reid Spencer68a24bd2005-08-27 18:50:39 +0000697
Chris Lattner81779692006-03-30 22:51:12 +0000698/* This is the most reliable way to avoid incompatibilities
699 in available built-in functions on various systems. */
John Criswelld7881242006-01-17 17:01:34 +0000700static void
Chris Lattner81779692006-03-30 22:51:12 +0000701__yy_memcpy (to, from, count)
702 char *to;
703 char *from;
704 unsigned int count;
705{
706 register char *f = from;
707 register char *t = to;
708 register int i = count;
709
710 while (i-- > 0)
711 *t++ = *f++;
712}
713
714#else /* __cplusplus */
715
716/* This is the most reliable way to avoid incompatibilities
717 in available built-in functions on various systems. */
John Criswelld7881242006-01-17 17:01:34 +0000718static void
Chris Lattner81779692006-03-30 22:51:12 +0000719__yy_memcpy (char *to, char *from, unsigned int count)
720{
721 register char *t = to;
722 register char *f = from;
723 register int i = count;
724
725 while (i-- > 0)
726 *t++ = *f++;
727}
728
Chris Lattner2b931e82005-09-12 05:30:06 +0000729#endif
John Criswelld7881242006-01-17 17:01:34 +0000730#endif
John Criswelld7881242006-01-17 17:01:34 +0000731
Chris Lattner81779692006-03-30 22:51:12 +0000732#line 217 "/usr/share/bison.simple"
John Criswelld7881242006-01-17 17:01:34 +0000733
Chris Lattner81779692006-03-30 22:51:12 +0000734/* The user can define YYPARSE_PARAM as the name of an argument to be passed
735 into yyparse. The argument should have type void *.
736 It should actually point to an object.
737 Grammar actions can access the variable by casting it
738 to the proper pointer type. */
John Criswelld7881242006-01-17 17:01:34 +0000739
740#ifdef YYPARSE_PARAM
Chris Lattner81779692006-03-30 22:51:12 +0000741#ifdef __cplusplus
742#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
743#define YYPARSE_PARAM_DECL
744#else /* not __cplusplus */
745#define YYPARSE_PARAM_ARG YYPARSE_PARAM
746#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
747#endif /* not __cplusplus */
748#else /* not YYPARSE_PARAM */
749#define YYPARSE_PARAM_ARG
750#define YYPARSE_PARAM_DECL
751#endif /* not YYPARSE_PARAM */
752
753/* Prevent warning if -Wstrict-prototypes. */
754#ifdef __GNUC__
755#ifdef YYPARSE_PARAM
756int yyparse (void *);
757#else
John Criswelld7881242006-01-17 17:01:34 +0000758int yyparse (void);
John Criswelld7881242006-01-17 17:01:34 +0000759#endif
Chris Lattner81779692006-03-30 22:51:12 +0000760#endif
John Criswelld7881242006-01-17 17:01:34 +0000761
John Criswelld7881242006-01-17 17:01:34 +0000762int
Chris Lattner81779692006-03-30 22:51:12 +0000763yyparse(YYPARSE_PARAM_ARG)
764 YYPARSE_PARAM_DECL
John Criswelld7881242006-01-17 17:01:34 +0000765{
Reid Spencer68a24bd2005-08-27 18:50:39 +0000766 register int yystate;
767 register int yyn;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000768 register short *yyssp;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000769 register YYSTYPE *yyvsp;
Chris Lattner81779692006-03-30 22:51:12 +0000770 int yyerrstatus; /* number of tokens to shift before error messages enabled */
771 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000772
Chris Lattner81779692006-03-30 22:51:12 +0000773 short yyssa[YYINITDEPTH]; /* the state stack */
774 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000775
Chris Lattner81779692006-03-30 22:51:12 +0000776 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
777 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000778
Chris Lattner81779692006-03-30 22:51:12 +0000779#ifdef YYLSP_NEEDED
780 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
781 YYLTYPE *yyls = yylsa;
782 YYLTYPE *yylsp;
783
784#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
785#else
Reid Spencer68a24bd2005-08-27 18:50:39 +0000786#define YYPOPSTACK (yyvsp--, yyssp--)
Chris Lattner81779692006-03-30 22:51:12 +0000787#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000788
Chris Lattner81779692006-03-30 22:51:12 +0000789 int yystacksize = YYINITDEPTH;
790 int yyfree_stacks = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000791
Chris Lattner81779692006-03-30 22:51:12 +0000792#ifdef YYPURE
793 int yychar;
794 YYSTYPE yylval;
795 int yynerrs;
796#ifdef YYLSP_NEEDED
797 YYLTYPE yylloc;
798#endif
799#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000800
Chris Lattner81779692006-03-30 22:51:12 +0000801 YYSTYPE yyval; /* the variable used to return */
802 /* semantic values from the action */
803 /* routines */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000804
Reid Spencer68a24bd2005-08-27 18:50:39 +0000805 int yylen;
806
Chris Lattner81779692006-03-30 22:51:12 +0000807#if YYDEBUG != 0
808 if (yydebug)
809 fprintf(stderr, "Starting parse\n");
810#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000811
812 yystate = 0;
813 yyerrstatus = 0;
814 yynerrs = 0;
815 yychar = YYEMPTY; /* Cause a token to be read. */
816
817 /* Initialize stack pointers.
818 Waste one element of value and location stack
819 so that they stay on the same level as the state stack.
820 The wasted elements are never initialized. */
821
Chris Lattner81779692006-03-30 22:51:12 +0000822 yyssp = yyss - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000823 yyvsp = yyvs;
Chris Lattner81779692006-03-30 22:51:12 +0000824#ifdef YYLSP_NEEDED
825 yylsp = yyls;
826#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000827
Chris Lattner81779692006-03-30 22:51:12 +0000828/* Push a new state, which is found in yystate . */
829/* In all cases, when you get here, the value and location stacks
830 have just been pushed. so pushing a state here evens the stacks. */
831yynewstate:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000832
Chris Lattner81779692006-03-30 22:51:12 +0000833 *++yyssp = yystate;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000834
Chris Lattner81779692006-03-30 22:51:12 +0000835 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000836 {
Chris Lattner81779692006-03-30 22:51:12 +0000837 /* Give user a chance to reallocate the stack */
838 /* Use copies of these so that the &'s don't force the real ones into memory. */
839 YYSTYPE *yyvs1 = yyvs;
840 short *yyss1 = yyss;
841#ifdef YYLSP_NEEDED
842 YYLTYPE *yyls1 = yyls;
843#endif
844
Reid Spencer68a24bd2005-08-27 18:50:39 +0000845 /* Get the current used size of the three stacks, in elements. */
Chris Lattner81779692006-03-30 22:51:12 +0000846 int size = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000847
848#ifdef yyoverflow
Chris Lattner81779692006-03-30 22:51:12 +0000849 /* Each stack pointer address is followed by the size of
850 the data in use in that stack, in bytes. */
851#ifdef YYLSP_NEEDED
852 /* This used to be a conditional around just the two extra args,
853 but that might be undefined if yyoverflow is a macro. */
854 yyoverflow("parser stack overflow",
855 &yyss1, size * sizeof (*yyssp),
856 &yyvs1, size * sizeof (*yyvsp),
857 &yyls1, size * sizeof (*yylsp),
858 &yystacksize);
859#else
860 yyoverflow("parser stack overflow",
861 &yyss1, size * sizeof (*yyssp),
862 &yyvs1, size * sizeof (*yyvsp),
863 &yystacksize);
864#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000865
Chris Lattner81779692006-03-30 22:51:12 +0000866 yyss = yyss1; yyvs = yyvs1;
867#ifdef YYLSP_NEEDED
868 yyls = yyls1;
869#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000870#else /* no yyoverflow */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000871 /* Extend the stack our own way. */
Chris Lattner81779692006-03-30 22:51:12 +0000872 if (yystacksize >= YYMAXDEPTH)
873 {
874 yyerror("parser stack overflow");
875 if (yyfree_stacks)
876 {
877 free (yyss);
878 free (yyvs);
879#ifdef YYLSP_NEEDED
880 free (yyls);
881#endif
882 }
883 return 2;
884 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000885 yystacksize *= 2;
Chris Lattner81779692006-03-30 22:51:12 +0000886 if (yystacksize > YYMAXDEPTH)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000887 yystacksize = YYMAXDEPTH;
Chris Lattner81779692006-03-30 22:51:12 +0000888#ifndef YYSTACK_USE_ALLOCA
889 yyfree_stacks = 1;
890#endif
891 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
892 __yy_memcpy ((char *)yyss, (char *)yyss1,
893 size * (unsigned int) sizeof (*yyssp));
894 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
895 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
896 size * (unsigned int) sizeof (*yyvsp));
897#ifdef YYLSP_NEEDED
898 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
899 __yy_memcpy ((char *)yyls, (char *)yyls1,
900 size * (unsigned int) sizeof (*yylsp));
901#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000902#endif /* no yyoverflow */
903
Chris Lattner81779692006-03-30 22:51:12 +0000904 yyssp = yyss + size - 1;
905 yyvsp = yyvs + size - 1;
906#ifdef YYLSP_NEEDED
907 yylsp = yyls + size - 1;
908#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000909
Chris Lattner81779692006-03-30 22:51:12 +0000910#if YYDEBUG != 0
911 if (yydebug)
912 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
913#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000914
Chris Lattner81779692006-03-30 22:51:12 +0000915 if (yyssp >= yyss + yystacksize - 1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000916 YYABORT;
917 }
918
Chris Lattner81779692006-03-30 22:51:12 +0000919#if YYDEBUG != 0
920 if (yydebug)
921 fprintf(stderr, "Entering state %d\n", yystate);
922#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000923
924 goto yybackup;
Chris Lattner81779692006-03-30 22:51:12 +0000925 yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +0000926
927/* Do appropriate processing given the current state. */
928/* Read a lookahead token if we need one and don't already have one. */
929/* yyresume: */
930
931 /* First try to decide what to do without reference to lookahead token. */
932
933 yyn = yypact[yystate];
Chris Lattner81779692006-03-30 22:51:12 +0000934 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000935 goto yydefault;
936
937 /* Not known => get a lookahead token if don't already have one. */
938
Chris Lattner81779692006-03-30 22:51:12 +0000939 /* yychar is either YYEMPTY or YYEOF
940 or a valid token in external form. */
941
Reid Spencer68a24bd2005-08-27 18:50:39 +0000942 if (yychar == YYEMPTY)
943 {
Chris Lattner81779692006-03-30 22:51:12 +0000944#if YYDEBUG != 0
945 if (yydebug)
946 fprintf(stderr, "Reading a token: ");
947#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000948 yychar = YYLEX;
949 }
950
Chris Lattner81779692006-03-30 22:51:12 +0000951 /* Convert token to internal form (in yychar1) for indexing tables with */
952
953 if (yychar <= 0) /* This means end of input. */
Reid Spencer68a24bd2005-08-27 18:50:39 +0000954 {
Chris Lattner81779692006-03-30 22:51:12 +0000955 yychar1 = 0;
956 yychar = YYEOF; /* Don't call YYLEX any more */
957
958#if YYDEBUG != 0
959 if (yydebug)
960 fprintf(stderr, "Now at end of input.\n");
961#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000962 }
963 else
964 {
Chris Lattner81779692006-03-30 22:51:12 +0000965 yychar1 = YYTRANSLATE(yychar);
966
967#if YYDEBUG != 0
968 if (yydebug)
969 {
970 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
971 /* Give the individual parser a way to print the precise meaning
972 of a token, for further debugging info. */
973#ifdef YYPRINT
974 YYPRINT (stderr, yychar, yylval);
975#endif
976 fprintf (stderr, ")\n");
977 }
978#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000979 }
980
Chris Lattner81779692006-03-30 22:51:12 +0000981 yyn += yychar1;
982 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000983 goto yydefault;
Chris Lattner81779692006-03-30 22:51:12 +0000984
Reid Spencer68a24bd2005-08-27 18:50:39 +0000985 yyn = yytable[yyn];
Chris Lattner81779692006-03-30 22:51:12 +0000986
987 /* yyn is what to do for this token type in this state.
988 Negative => reduce, -yyn is rule number.
989 Positive => shift, yyn is new state.
990 New state is final state => don't bother to shift,
991 just return success.
992 0, or most negative number => error. */
993
994 if (yyn < 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000995 {
Chris Lattner81779692006-03-30 22:51:12 +0000996 if (yyn == YYFLAG)
Reid Spencer68a24bd2005-08-27 18:50:39 +0000997 goto yyerrlab;
998 yyn = -yyn;
999 goto yyreduce;
1000 }
Chris Lattner81779692006-03-30 22:51:12 +00001001 else if (yyn == 0)
1002 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001003
1004 if (yyn == YYFINAL)
1005 YYACCEPT;
1006
1007 /* Shift the lookahead token. */
Chris Lattner81779692006-03-30 22:51:12 +00001008
1009#if YYDEBUG != 0
1010 if (yydebug)
1011 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1012#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001013
1014 /* Discard the token being shifted unless it is eof. */
1015 if (yychar != YYEOF)
1016 yychar = YYEMPTY;
1017
1018 *++yyvsp = yylval;
Chris Lattner81779692006-03-30 22:51:12 +00001019#ifdef YYLSP_NEEDED
1020 *++yylsp = yylloc;
1021#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001022
Chris Lattner81779692006-03-30 22:51:12 +00001023 /* count tokens shifted since error; after three, turn off error status. */
1024 if (yyerrstatus) yyerrstatus--;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001025
1026 yystate = yyn;
1027 goto yynewstate;
1028
Chris Lattner81779692006-03-30 22:51:12 +00001029/* Do the default action for the current state. */
John Criswelld7881242006-01-17 17:01:34 +00001030yydefault:
Chris Lattner81779692006-03-30 22:51:12 +00001031
Reid Spencer68a24bd2005-08-27 18:50:39 +00001032 yyn = yydefact[yystate];
1033 if (yyn == 0)
1034 goto yyerrlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001035
Chris Lattner81779692006-03-30 22:51:12 +00001036/* Do a reduction. yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001037yyreduce:
Reid Spencer68a24bd2005-08-27 18:50:39 +00001038 yylen = yyr2[yyn];
Chris Lattner81779692006-03-30 22:51:12 +00001039 if (yylen > 0)
1040 yyval = yyvsp[1-yylen]; /* implement default value of the action */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001041
Chris Lattner81779692006-03-30 22:51:12 +00001042#if YYDEBUG != 0
1043 if (yydebug)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001044 {
Chris Lattner81779692006-03-30 22:51:12 +00001045 int i;
1046
1047 fprintf (stderr, "Reducing via rule %d (line %d), ",
1048 yyn, yyrline[yyn]);
1049
1050 /* Print the symbols being reduced, and their result. */
1051 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1052 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1053 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1054 }
1055#endif
1056
1057
1058 switch (yyn) {
1059
1060case 1:
Chris Lattner27627382006-09-01 21:14:42 +00001061#line 244 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001062{
Chris Lattner27627382006-09-01 21:14:42 +00001063 if (CurDefmPrefix) {
1064 // If CurDefmPrefix is set, we're parsing a defm, which means that this is
1065 // actually the name of a multiclass.
1066 MultiClass *MC = MultiClasses[*yyvsp[0].StrVal];
1067 if (MC == 0) {
1068 err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n";
1069 exit(1);
1070 }
1071 yyval.Rec = &MC->Rec;
1072 } else {
1073 yyval.Rec = Records.getClass(*yyvsp[0].StrVal);
1074 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001075 if (yyval.Rec == 0) {
1076 err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n";
1077 exit(1);
1078 }
1079 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001080 ;
1081 break;}
1082case 2:
Chris Lattner27627382006-09-01 21:14:42 +00001083#line 266 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001084{ // string type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001085 yyval.Ty = new StringRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001086 ;
1087 break;}
1088case 3:
Chris Lattner27627382006-09-01 21:14:42 +00001089#line 268 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001090{ // bit type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001091 yyval.Ty = new BitRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001092 ;
1093 break;}
1094case 4:
Chris Lattner27627382006-09-01 21:14:42 +00001095#line 270 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001096{ // bits<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001097 yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001098 ;
1099 break;}
1100case 5:
Chris Lattner27627382006-09-01 21:14:42 +00001101#line 272 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001102{ // int type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001103 yyval.Ty = new IntRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001104 ;
1105 break;}
1106case 6:
Chris Lattner27627382006-09-01 21:14:42 +00001107#line 274 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001108{ // list<x> type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001109 yyval.Ty = new ListRecTy(yyvsp[-1].Ty);
Chris Lattner81779692006-03-30 22:51:12 +00001110 ;
1111 break;}
1112case 7:
Chris Lattner27627382006-09-01 21:14:42 +00001113#line 276 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001114{ // code type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001115 yyval.Ty = new CodeRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001116 ;
1117 break;}
1118case 8:
Chris Lattner27627382006-09-01 21:14:42 +00001119#line 278 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001120{ // dag type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001121 yyval.Ty = new DagRecTy();
Chris Lattner81779692006-03-30 22:51:12 +00001122 ;
1123 break;}
1124case 9:
Chris Lattner27627382006-09-01 21:14:42 +00001125#line 280 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001126{ // Record Type
Reid Spencer68a24bd2005-08-27 18:50:39 +00001127 yyval.Ty = new RecordRecTy(yyvsp[0].Rec);
Chris Lattner81779692006-03-30 22:51:12 +00001128 ;
1129 break;}
1130case 10:
Chris Lattner27627382006-09-01 21:14:42 +00001131#line 284 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001132{ yyval.IntVal = 0; ;
1133 break;}
1134case 11:
Chris Lattner27627382006-09-01 21:14:42 +00001135#line 284 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001136{ yyval.IntVal = 1; ;
1137 break;}
1138case 12:
Chris Lattner27627382006-09-01 21:14:42 +00001139#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001140{ yyval.Initializer = 0; ;
1141 break;}
1142case 13:
Chris Lattner27627382006-09-01 21:14:42 +00001143#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001144{ yyval.Initializer = yyvsp[0].Initializer; ;
1145 break;}
1146case 14:
Chris Lattner27627382006-09-01 21:14:42 +00001147#line 288 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001148{
1149 if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) {
1150 yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType());
1151 } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) {
1152 const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal);
1153 assert(RV && "Template arg doesn't exist??");
1154 yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType());
Chris Lattner27627382006-09-01 21:14:42 +00001155 } else if (CurMultiClass &&
1156 CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal)) {
1157 std::string Name = CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal;
1158 const RecordVal *RV = CurMultiClass->Rec.getValue(Name);
1159 assert(RV && "Template arg doesn't exist??");
1160 yyval.Initializer = new VarInit(Name, RV->getType());
Chris Lattner81779692006-03-30 22:51:12 +00001161 } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) {
1162 yyval.Initializer = new DefInit(D);
1163 } else {
1164 err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n";
1165 exit(1);
1166 }
1167
1168 delete yyvsp[0].StrVal;
1169;
1170 break;}
1171case 15:
Chris Lattner27627382006-09-01 21:14:42 +00001172#line 311 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001173{
1174 yyval.Initializer = yyvsp[0].Initializer;
1175 ;
1176 break;}
1177case 16:
Chris Lattner27627382006-09-01 21:14:42 +00001178#line 313 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001179{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001180 yyval.Initializer = new IntInit(yyvsp[0].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001181 ;
1182 break;}
1183case 17:
Chris Lattner27627382006-09-01 21:14:42 +00001184#line 315 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001185{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001186 yyval.Initializer = new StringInit(*yyvsp[0].StrVal);
1187 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001188 ;
1189 break;}
1190case 18:
Chris Lattner27627382006-09-01 21:14:42 +00001191#line 318 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001192{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001193 yyval.Initializer = new CodeInit(*yyvsp[0].StrVal);
1194 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001195 ;
1196 break;}
1197case 19:
Chris Lattner27627382006-09-01 21:14:42 +00001198#line 321 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001199{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001200 yyval.Initializer = new UnsetInit();
Chris Lattner81779692006-03-30 22:51:12 +00001201 ;
1202 break;}
1203case 20:
Chris Lattner27627382006-09-01 21:14:42 +00001204#line 323 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001205{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001206 BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size());
1207 for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) {
1208 struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy());
1209 if (Bit == 0) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001210 err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i]
1211 << ") is not convertable to a bit!\n";
1212 exit(1);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001213 }
1214 Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit);
1215 }
1216 yyval.Initializer = Init;
1217 delete yyvsp[-1].FieldList;
Chris Lattner81779692006-03-30 22:51:12 +00001218 ;
1219 break;}
1220case 21:
Chris Lattner27627382006-09-01 21:14:42 +00001221#line 336 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001222{
Chris Lattnerca572be2005-09-08 18:48:47 +00001223 // This is a CLASS<initvalslist> expression. This is supposed to synthesize
1224 // a new anonymous definition, deriving from CLASS<initvalslist> with no
1225 // body.
1226 Record *Class = Records.getClass(*yyvsp[-3].StrVal);
1227 if (!Class) {
1228 err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n";
1229 exit(1);
1230 }
1231 delete yyvsp[-3].StrVal;
1232
1233 static unsigned AnonCounter = 0;
1234 Record *OldRec = CurRec; // Save CurRec.
1235
1236 // Create the new record, set it as CurRec temporarily.
1237 CurRec = new Record("anonymous.val."+utostr(AnonCounter++));
1238 addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec.
1239 delete yyvsp[-1].FieldList; // Free up the template args.
1240
Chris Lattner751eabf2005-09-08 19:47:28 +00001241 CurRec->resolveReferences();
Chris Lattnerca572be2005-09-08 18:48:47 +00001242
1243 Records.addDef(CurRec);
1244
1245 // The result of the expression is a reference to the new record.
1246 yyval.Initializer = new DefInit(CurRec);
1247
1248 // Restore the old CurRec
1249 CurRec = OldRec;
Chris Lattner81779692006-03-30 22:51:12 +00001250 ;
1251 break;}
1252case 22:
Chris Lattner27627382006-09-01 21:14:42 +00001253#line 364 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001254{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001255 yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList);
1256 if (yyval.Initializer == 0) {
1257 err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n";
1258 exit(1);
1259 }
1260 delete yyvsp[-1].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001261 ;
1262 break;}
1263case 23:
Chris Lattner27627382006-09-01 21:14:42 +00001264#line 371 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001265{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001266 yyval.Initializer = new ListInit(*yyvsp[-1].FieldList);
1267 delete yyvsp[-1].FieldList;
Chris Lattner81779692006-03-30 22:51:12 +00001268 ;
1269 break;}
1270case 24:
Chris Lattner27627382006-09-01 21:14:42 +00001271#line 374 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001272{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001273 if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) {
1274 err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n";
1275 exit(1);
1276 }
1277 yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal);
1278 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001279 ;
1280 break;}
1281case 25:
Chris Lattner27627382006-09-01 21:14:42 +00001282#line 381 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001283{
1284 yyval.Initializer = new DagInit(yyvsp[-2].Initializer, *yyvsp[-1].DagValueList);
1285 delete yyvsp[-1].DagValueList;
1286 ;
1287 break;}
1288case 26:
Chris Lattner27627382006-09-01 21:14:42 +00001289#line 384 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001290{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001291 std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end());
1292 yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList);
1293 if (yyval.Initializer == 0) {
1294 err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n";
1295 exit(1);
1296 }
1297 delete yyvsp[-1].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001298 ;
1299 break;}
1300case 27:
Chris Lattner27627382006-09-01 21:14:42 +00001301#line 392 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001302{
Chris Lattnerb8316912006-03-31 21:54:11 +00001303 yyval.Initializer = (new BinOpInit(BinOpInit::SHL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
Chris Lattner81779692006-03-30 22:51:12 +00001304 ;
1305 break;}
1306case 28:
Chris Lattner27627382006-09-01 21:14:42 +00001307#line 394 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001308{
Chris Lattnerb8316912006-03-31 21:54:11 +00001309 yyval.Initializer = (new BinOpInit(BinOpInit::SRA, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
Chris Lattner81779692006-03-30 22:51:12 +00001310 ;
1311 break;}
1312case 29:
Chris Lattner27627382006-09-01 21:14:42 +00001313#line 396 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001314{
Chris Lattnerb8316912006-03-31 21:54:11 +00001315 yyval.Initializer = (new BinOpInit(BinOpInit::SRL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
Chris Lattner81779692006-03-30 22:51:12 +00001316 ;
1317 break;}
1318case 30:
Chris Lattner27627382006-09-01 21:14:42 +00001319#line 398 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerb8316912006-03-31 21:54:11 +00001320{
1321 yyval.Initializer = (new BinOpInit(BinOpInit::STRCONCAT, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold();
1322 ;
1323 break;}
1324case 31:
Chris Lattner27627382006-09-01 21:14:42 +00001325#line 402 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001326{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001327 yyval.StrVal = new std::string();
Chris Lattner81779692006-03-30 22:51:12 +00001328 ;
1329 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001330case 32:
Chris Lattner27627382006-09-01 21:14:42 +00001331#line 405 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001332{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001333 yyval.StrVal = yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001334 ;
1335 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001336case 33:
Chris Lattner27627382006-09-01 21:14:42 +00001337#line 409 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001338{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001339 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
1340 yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1341 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001342 ;
1343 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001344case 34:
Chris Lattner27627382006-09-01 21:14:42 +00001345#line 414 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001346{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001347 yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal));
1348 delete yyvsp[0].StrVal;
1349 yyval.DagValueList = yyvsp[-3].DagValueList;
Chris Lattner81779692006-03-30 22:51:12 +00001350 ;
1351 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001352case 35:
Chris Lattner27627382006-09-01 21:14:42 +00001353#line 420 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001354{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001355 yyval.DagValueList = new std::vector<std::pair<Init*, std::string> >();
Chris Lattner81779692006-03-30 22:51:12 +00001356 ;
1357 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001358case 36:
Chris Lattner27627382006-09-01 21:14:42 +00001359#line 423 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001360{ yyval.DagValueList = yyvsp[0].DagValueList; ;
1361 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001362case 37:
Chris Lattner27627382006-09-01 21:14:42 +00001363#line 426 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001364{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001365 yyval.BitList = new std::vector<unsigned>();
1366 yyval.BitList->push_back(yyvsp[0].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001367 ;
1368 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001369case 38:
Chris Lattner27627382006-09-01 21:14:42 +00001370#line 429 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001371{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001372 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1373 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1374 exit(1);
1375 }
1376 yyval.BitList = new std::vector<unsigned>();
1377 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1378 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1379 yyval.BitList->push_back(i);
1380 } else {
1381 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1382 yyval.BitList->push_back(i);
1383 }
Chris Lattner81779692006-03-30 22:51:12 +00001384 ;
1385 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001386case 39:
Chris Lattner27627382006-09-01 21:14:42 +00001387#line 442 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001388{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001389 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1390 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1391 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1392 exit(1);
1393 }
1394 yyval.BitList = new std::vector<unsigned>();
1395 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1396 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1397 yyval.BitList->push_back(i);
1398 } else {
1399 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1400 yyval.BitList->push_back(i);
1401 }
Chris Lattner81779692006-03-30 22:51:12 +00001402 ;
1403 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001404case 40:
Chris Lattner27627382006-09-01 21:14:42 +00001405#line 456 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001406{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001407 (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal);
Chris Lattner81779692006-03-30 22:51:12 +00001408 ;
1409 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001410case 41:
Chris Lattner27627382006-09-01 21:14:42 +00001411#line 458 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001412{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001413 if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) {
1414 err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1415 exit(1);
1416 }
1417 yyval.BitList = yyvsp[-4].BitList;
1418 if (yyvsp[-2].IntVal < yyvsp[0].IntVal) {
1419 for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i)
1420 yyval.BitList->push_back(i);
1421 } else {
1422 for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i)
1423 yyval.BitList->push_back(i);
1424 }
Chris Lattner81779692006-03-30 22:51:12 +00001425 ;
1426 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001427case 42:
Chris Lattner27627382006-09-01 21:14:42 +00001428#line 471 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001429{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001430 yyvsp[0].IntVal = -yyvsp[0].IntVal;
1431 if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) {
1432 err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n";
1433 exit(1);
1434 }
1435 yyval.BitList = yyvsp[-3].BitList;
1436 if (yyvsp[-1].IntVal < yyvsp[0].IntVal) {
1437 for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i)
1438 yyval.BitList->push_back(i);
1439 } else {
1440 for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i)
1441 yyval.BitList->push_back(i);
1442 }
Chris Lattner81779692006-03-30 22:51:12 +00001443 ;
1444 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001445case 43:
Chris Lattner27627382006-09-01 21:14:42 +00001446#line 487 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001447{ yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;
1448 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001449case 44:
Chris Lattner27627382006-09-01 21:14:42 +00001450#line 489 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001451{ yyval.BitList = 0; ;
1452 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001453case 45:
Chris Lattner27627382006-09-01 21:14:42 +00001454#line 489 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001455{ yyval.BitList = yyvsp[-1].BitList; ;
1456 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001457case 46:
Chris Lattner27627382006-09-01 21:14:42 +00001458#line 493 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001459{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001460 yyval.FieldList = new std::vector<Init*>();
Chris Lattner81779692006-03-30 22:51:12 +00001461 ;
1462 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001463case 47:
Chris Lattner27627382006-09-01 21:14:42 +00001464#line 495 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001465{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001466 yyval.FieldList = yyvsp[0].FieldList;
Chris Lattner81779692006-03-30 22:51:12 +00001467 ;
1468 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001469case 48:
Chris Lattner27627382006-09-01 21:14:42 +00001470#line 499 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001471{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001472 yyval.FieldList = new std::vector<Init*>();
1473 yyval.FieldList->push_back(yyvsp[0].Initializer);
Chris Lattner81779692006-03-30 22:51:12 +00001474 ;
1475 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001476case 49:
Chris Lattner27627382006-09-01 21:14:42 +00001477#line 502 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001478{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001479 (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer);
Chris Lattner81779692006-03-30 22:51:12 +00001480 ;
1481 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001482case 50:
Chris Lattner27627382006-09-01 21:14:42 +00001483#line 506 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001484{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001485 std::string DecName = *yyvsp[-1].StrVal;
Chris Lattner27627382006-09-01 21:14:42 +00001486 if (ParsingTemplateArgs) {
1487 if (CurRec) {
1488 DecName = CurRec->getName() + ":" + DecName;
1489 } else {
1490 assert(CurMultiClass);
1491 }
1492 if (CurMultiClass)
1493 DecName = CurMultiClass->Rec.getName() + "::" + DecName;
1494 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001495
1496 addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal));
1497 setValue(DecName, 0, yyvsp[0].Initializer);
1498 yyval.StrVal = new std::string(DecName);
Chris Lattner81779692006-03-30 22:51:12 +00001499;
1500 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001501case 51:
Chris Lattner27627382006-09-01 21:14:42 +00001502#line 523 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001503{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001504 delete yyvsp[-1].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001505;
1506 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001507case 52:
Chris Lattner27627382006-09-01 21:14:42 +00001508#line 525 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001509{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001510 setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer);
1511 delete yyvsp[-4].StrVal;
1512 delete yyvsp[-3].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001513;
1514 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001515case 57:
Chris Lattner27627382006-09-01 21:14:42 +00001516#line 534 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001517{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001518 yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector<Init*>());
Chris Lattner81779692006-03-30 22:51:12 +00001519 ;
1520 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001521case 58:
Chris Lattner27627382006-09-01 21:14:42 +00001522#line 536 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001523{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001524 yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList);
Chris Lattner81779692006-03-30 22:51:12 +00001525 ;
1526 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001527case 59:
Chris Lattner27627382006-09-01 21:14:42 +00001528#line 540 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001529{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001530 yyval.SubClassList = new std::vector<SubClassRefTy>();
1531 yyval.SubClassList->push_back(*yyvsp[0].SubClassRef);
1532 delete yyvsp[0].SubClassRef;
Chris Lattner81779692006-03-30 22:51:12 +00001533 ;
1534 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001535case 60:
Chris Lattner27627382006-09-01 21:14:42 +00001536#line 545 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001537{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001538 (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef);
1539 delete yyvsp[0].SubClassRef;
Chris Lattner81779692006-03-30 22:51:12 +00001540 ;
1541 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001542case 61:
Chris Lattner27627382006-09-01 21:14:42 +00001543#line 550 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001544{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001545 yyval.SubClassList = new std::vector<SubClassRefTy>();
Chris Lattner81779692006-03-30 22:51:12 +00001546 ;
1547 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001548case 62:
Chris Lattner27627382006-09-01 21:14:42 +00001549#line 553 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001550{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001551 yyval.SubClassList = yyvsp[0].SubClassList;
Chris Lattner81779692006-03-30 22:51:12 +00001552 ;
1553 break;}
Chris Lattner81779692006-03-30 22:51:12 +00001554case 63:
Chris Lattner27627382006-09-01 21:14:42 +00001555#line 557 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001556{
Chris Lattner27627382006-09-01 21:14:42 +00001557 getActiveRec()->addTemplateArg(*yyvsp[0].StrVal);
Chris Lattnerca572be2005-09-08 18:48:47 +00001558 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001559;
1560 break;}
1561case 64:
Chris Lattner27627382006-09-01 21:14:42 +00001562#line 560 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerb8316912006-03-31 21:54:11 +00001563{
Chris Lattner27627382006-09-01 21:14:42 +00001564 getActiveRec()->addTemplateArg(*yyvsp[0].StrVal);
Chris Lattnerb8316912006-03-31 21:54:11 +00001565 delete yyvsp[0].StrVal;
1566;
1567 break;}
1568case 65:
Chris Lattner27627382006-09-01 21:14:42 +00001569#line 565 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001570{;
1571 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001572case 68:
Chris Lattner27627382006-09-01 21:14:42 +00001573#line 568 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001574{ yyval.StrVal = yyvsp[0].StrVal; ;
1575 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001576case 69:
Chris Lattner27627382006-09-01 21:14:42 +00001577#line 568 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001578{ yyval.StrVal = new std::string(); ;
1579 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001580case 70:
Chris Lattner27627382006-09-01 21:14:42 +00001581#line 570 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001582{
Chris Lattner8d354e92005-09-30 04:11:27 +00001583 static unsigned AnonCounter = 0;
1584 if (yyvsp[0].StrVal->empty())
1585 *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++);
Chris Lattner946ac932005-09-30 04:53:25 +00001586 yyval.StrVal = yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001587;
1588 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001589case 71:
Chris Lattner27627382006-09-01 21:14:42 +00001590#line 577 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001591{
Chris Lattner946ac932005-09-30 04:53:25 +00001592 // If a class of this name already exists, it must be a forward ref.
Chris Lattner88b7e6e2005-09-30 06:09:50 +00001593 if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) {
Chris Lattner946ac932005-09-30 04:53:25 +00001594 // If the body was previously defined, this is an error.
1595 if (!CurRec->getValues().empty() ||
1596 !CurRec->getSuperClasses().empty() ||
1597 !CurRec->getTemplateArgs().empty()) {
1598 err() << "Class '" << CurRec->getName() << "' already defined!\n";
1599 exit(1);
1600 }
1601 } else {
1602 // If this is the first reference to this class, create and add it.
1603 CurRec = new Record(*yyvsp[0].StrVal);
1604 Records.addClass(CurRec);
Chris Lattner8d354e92005-09-30 04:11:27 +00001605 }
Chris Lattner946ac932005-09-30 04:53:25 +00001606 delete yyvsp[0].StrVal;
Chris Lattner81779692006-03-30 22:51:12 +00001607;
1608 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001609case 72:
Chris Lattner27627382006-09-01 21:14:42 +00001610#line 595 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001611{
Chris Lattner946ac932005-09-30 04:53:25 +00001612 CurRec = new Record(*yyvsp[0].StrVal);
1613 delete yyvsp[0].StrVal;
1614
Chris Lattner27627382006-09-01 21:14:42 +00001615 if (!CurMultiClass) {
1616 // Top-level def definition.
1617
1618 // Ensure redefinition doesn't happen.
1619 if (Records.getDef(CurRec->getName())) {
1620 err() << "def '" << CurRec->getName() << "' already defined!\n";
1621 exit(1);
1622 }
1623 Records.addDef(CurRec);
1624 } else {
1625 // Otherwise, a def inside a multiclass, add it to the multiclass.
1626 for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); i != e; ++i)
1627 if (CurMultiClass->DefPrototypes[i]->getName() == CurRec->getName()) {
1628 err() << "def '" << CurRec->getName()
1629 << "' already defined in this multiclass!\n";
1630 exit(1);
1631 }
1632 CurMultiClass->DefPrototypes.push_back(CurRec);
Chris Lattner8d354e92005-09-30 04:11:27 +00001633 }
Chris Lattner81779692006-03-30 22:51:12 +00001634;
1635 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001636case 73:
Chris Lattner27627382006-09-01 21:14:42 +00001637#line 620 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001638{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001639 for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) {
Chris Lattnerba4b1442005-09-08 18:22:57 +00001640 addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001641 // Delete the template arg values for the class
1642 delete (*yyvsp[0].SubClassList)[i].second;
1643 }
1644 delete yyvsp[0].SubClassList; // Delete the class list...
Chris Lattner0a284052005-09-30 04:42:56 +00001645
Chris Lattnerba4b1442005-09-08 18:22:57 +00001646 // Process any variables on the set stack...
1647 for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001648 for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
1649 setValue(LetStack[i][j].Name,
1650 LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0,
1651 LetStack[i][j].Value);
Chris Lattner81779692006-03-30 22:51:12 +00001652 ;
1653 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001654case 74:
Chris Lattner27627382006-09-01 21:14:42 +00001655#line 634 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001656{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001657 yyval.Rec = CurRec;
1658 CurRec = 0;
Chris Lattner81779692006-03-30 22:51:12 +00001659 ;
1660 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001661case 75:
Chris Lattner27627382006-09-01 21:14:42 +00001662#line 639 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001663{
Chris Lattner946ac932005-09-30 04:53:25 +00001664 ParsingTemplateArgs = true;
Chris Lattner81779692006-03-30 22:51:12 +00001665 ;
1666 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001667case 76:
Chris Lattner27627382006-09-01 21:14:42 +00001668#line 641 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001669{
Chris Lattner946ac932005-09-30 04:53:25 +00001670 ParsingTemplateArgs = false;
Chris Lattner81779692006-03-30 22:51:12 +00001671 ;
1672 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001673case 77:
Chris Lattner27627382006-09-01 21:14:42 +00001674#line 643 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001675{
Chris Lattner0a284052005-09-30 04:42:56 +00001676 yyval.Rec = yyvsp[0].Rec;
Chris Lattner81779692006-03-30 22:51:12 +00001677 ;
1678 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001679case 78:
Chris Lattner27627382006-09-01 21:14:42 +00001680#line 647 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001681{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001682 yyvsp[0].Rec->resolveReferences();
1683
Chris Lattnerca572be2005-09-08 18:48:47 +00001684 // If ObjectBody has template arguments, it's an error.
Chris Lattner0a284052005-09-30 04:42:56 +00001685 assert(yyvsp[0].Rec->getTemplateArgs().empty() && "How'd this get template args?");
Chris Lattner8d354e92005-09-30 04:11:27 +00001686 yyval.Rec = yyvsp[0].Rec;
Chris Lattner81779692006-03-30 22:51:12 +00001687;
1688 break;}
Chris Lattner27627382006-09-01 21:14:42 +00001689case 79:
1690#line 656 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1691{
1692 yyval.Rec = yyvsp[0].Rec;
1693 // Copy the template arguments for the multiclass into the def.
1694 const std::vector<std::string> &TArgs = CurMultiClass->Rec.getTemplateArgs();
1695
1696 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
1697 const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]);
1698 assert(RV && "Template arg doesn't exist?");
1699 yyval.Rec->addValue(*RV);
1700 }
1701;
1702 break;}
1703case 80:
1704#line 670 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1705{
1706 yyval.RecList = new std::vector<Record*>();
1707 yyval.RecList->push_back(yyvsp[0].Rec);
1708;
1709 break;}
Chris Lattnerb8316912006-03-31 21:54:11 +00001710case 81:
Chris Lattner27627382006-09-01 21:14:42 +00001711#line 673 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1712{
1713 yyval.RecList->push_back(yyvsp[0].Rec);
1714;
1715 break;}
1716case 82:
1717#line 677 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1718{
1719 MultiClass *&MCE = MultiClasses[*yyvsp[0].StrVal];
1720 if (MCE) {
1721 err() << "multiclass '" << *yyvsp[0].StrVal << "' already defined!\n";
1722 exit(1);
1723 }
1724 MCE = CurMultiClass = new MultiClass(*yyvsp[0].StrVal);
1725 delete yyvsp[0].StrVal;
1726;
1727 break;}
1728case 83:
1729#line 688 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1730{
1731 ParsingTemplateArgs = true;
1732 ;
1733 break;}
1734case 84:
1735#line 690 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1736{
1737 ParsingTemplateArgs = false;
1738 ;
1739 break;}
1740case 85:
1741#line 692 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1742{
1743 CurMultiClass = 0;
1744;
1745 break;}
1746case 86:
1747#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1748{ CurDefmPrefix = yyvsp[0].StrVal; ;
1749 break;}
1750case 87:
1751#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1752{
1753 // To instantiate a multiclass, we need to first get the multiclass, then
1754 // instantiate each def contained in the multiclass with the SubClassRef
1755 // template parameters.
1756 MultiClass *MC = MultiClasses[yyvsp[-1].SubClassRef->first->getName()];
1757 assert(MC && "Didn't lookup multiclass correctly?");
1758 std::vector<Init*> &TemplateVals = *yyvsp[-1].SubClassRef->second;
1759 delete yyvsp[-1].SubClassRef;
1760
1761 // Verify that the correct number of template arguments were specified.
1762 const std::vector<std::string> &TArgs = MC->Rec.getTemplateArgs();
1763 if (TArgs.size() < TemplateVals.size()) {
1764 err() << "ERROR: More template args specified than multiclass expects!\n";
1765 exit(1);
1766 }
1767
1768 // Loop over all the def's in the multiclass, instantiating each one.
1769 for (unsigned i = 0, e = MC->DefPrototypes.size(); i != e; ++i) {
1770 Record *DefProto = MC->DefPrototypes[i];
1771
1772 // Add the suffix to the defm name to get the new name.
1773 assert(CurRec == 0 && "A def is current?");
1774 CurRec = new Record(*yyvsp[-4].StrVal + DefProto->getName());
1775
1776 addSubClass(DefProto, std::vector<Init*>());
1777
1778 // Loop over all of the template arguments, setting them to the specified
1779 // value or leaving them as the default if necessary.
1780 for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
1781 if (i < TemplateVals.size()) { // A value is specified for this temp-arg?
1782 // Set it now.
1783 setValue(TArgs[i], 0, TemplateVals[i]);
1784
1785 // Resolve it next.
1786 CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
1787
1788 // Now remove it.
1789 CurRec->removeValue(TArgs[i]);
1790
1791 } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
1792 err() << "ERROR: Value not specified for template argument #"
1793 << i << " (" << TArgs[i] << ") of multiclassclass '"
1794 << MC->Rec.getName() << "'!\n";
1795 exit(1);
1796 }
1797 }
1798
1799 // Ensure redefinition doesn't happen.
1800 if (Records.getDef(CurRec->getName())) {
1801 err() << "def '" << CurRec->getName() << "' already defined, "
1802 << "instantiating defm '" << *yyvsp[-4].StrVal << "' with subdef '"
1803 << DefProto->getName() << "'!\n";
1804 exit(1);
1805 }
1806 Records.addDef(CurRec);
1807 CurRec = 0;
1808 }
1809
1810 delete &TemplateVals;
1811 delete yyvsp[-4].StrVal;
1812;
1813 break;}
1814case 88:
1815#line 759 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1816{;
1817 break;}
1818case 89:
1819#line 759 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
1820{;
1821 break;}
1822case 92:
1823#line 762 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001824{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001825 LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer));
1826 delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList;
Chris Lattner81779692006-03-30 22:51:12 +00001827;
1828 break;}
Chris Lattner27627382006-09-01 21:14:42 +00001829case 95:
1830#line 770 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001831{ LetStack.push_back(std::vector<LetRecord>()); ;
1832 break;}
Chris Lattner27627382006-09-01 21:14:42 +00001833case 97:
1834#line 773 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001835{
Chris Lattner946ac932005-09-30 04:53:25 +00001836 LetStack.pop_back();
Chris Lattner81779692006-03-30 22:51:12 +00001837 ;
1838 break;}
Chris Lattner27627382006-09-01 21:14:42 +00001839case 98:
1840#line 776 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattnerb8316912006-03-31 21:54:11 +00001841{
1842 LetStack.pop_back();
1843 ;
Chris Lattner81779692006-03-30 22:51:12 +00001844 break;}
Chris Lattner27627382006-09-01 21:14:42 +00001845case 99:
1846#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001847{;
1848 break;}
Chris Lattner27627382006-09-01 21:14:42 +00001849case 100:
1850#line 780 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Chris Lattner81779692006-03-30 22:51:12 +00001851{;
1852 break;}
1853}
1854 /* the action file gets copied in in place of this dollarsign */
1855#line 543 "/usr/share/bison.simple"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001856
1857 yyvsp -= yylen;
1858 yyssp -= yylen;
Chris Lattner81779692006-03-30 22:51:12 +00001859#ifdef YYLSP_NEEDED
1860 yylsp -= yylen;
1861#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001862
Chris Lattner81779692006-03-30 22:51:12 +00001863#if YYDEBUG != 0
1864 if (yydebug)
1865 {
1866 short *ssp1 = yyss - 1;
1867 fprintf (stderr, "state stack now");
1868 while (ssp1 != yyssp)
1869 fprintf (stderr, " %d", *++ssp1);
1870 fprintf (stderr, "\n");
1871 }
1872#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001873
1874 *++yyvsp = yyval;
1875
Chris Lattner81779692006-03-30 22:51:12 +00001876#ifdef YYLSP_NEEDED
1877 yylsp++;
1878 if (yylen == 0)
1879 {
1880 yylsp->first_line = yylloc.first_line;
1881 yylsp->first_column = yylloc.first_column;
1882 yylsp->last_line = (yylsp-1)->last_line;
1883 yylsp->last_column = (yylsp-1)->last_column;
1884 yylsp->text = 0;
1885 }
1886 else
1887 {
1888 yylsp->last_line = (yylsp+yylen-1)->last_line;
1889 yylsp->last_column = (yylsp+yylen-1)->last_column;
1890 }
1891#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001892
Chris Lattner81779692006-03-30 22:51:12 +00001893 /* Now "shift" the result of the reduction.
1894 Determine what state that goes to,
1895 based on the state we popped back to
1896 and the rule number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001897
1898 yyn = yyr1[yyn];
1899
Chris Lattner81779692006-03-30 22:51:12 +00001900 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1901 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001902 yystate = yytable[yystate];
1903 else
Chris Lattner81779692006-03-30 22:51:12 +00001904 yystate = yydefgoto[yyn - YYNTBASE];
Reid Spencer68a24bd2005-08-27 18:50:39 +00001905
1906 goto yynewstate;
1907
Chris Lattner81779692006-03-30 22:51:12 +00001908yyerrlab: /* here on detecting error */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001909
Chris Lattner81779692006-03-30 22:51:12 +00001910 if (! yyerrstatus)
1911 /* If not already recovering from an error, report this error. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001912 {
1913 ++yynerrs;
Chris Lattner81779692006-03-30 22:51:12 +00001914
1915#ifdef YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00001916 yyn = yypact[yystate];
1917
Chris Lattner81779692006-03-30 22:51:12 +00001918 if (yyn > YYFLAG && yyn < YYLAST)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001919 {
Chris Lattner81779692006-03-30 22:51:12 +00001920 int size = 0;
1921 char *msg;
1922 int x, count;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001923
Chris Lattner81779692006-03-30 22:51:12 +00001924 count = 0;
1925 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1926 for (x = (yyn < 0 ? -yyn : 0);
1927 x < (sizeof(yytname) / sizeof(char *)); x++)
1928 if (yycheck[x + yyn] == x)
1929 size += strlen(yytname[x]) + 15, count++;
1930 msg = (char *) malloc(size + 15);
1931 if (msg != 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001932 {
Chris Lattner81779692006-03-30 22:51:12 +00001933 strcpy(msg, "parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001934
Chris Lattner81779692006-03-30 22:51:12 +00001935 if (count < 5)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001936 {
Chris Lattner81779692006-03-30 22:51:12 +00001937 count = 0;
1938 for (x = (yyn < 0 ? -yyn : 0);
1939 x < (sizeof(yytname) / sizeof(char *)); x++)
1940 if (yycheck[x + yyn] == x)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001941 {
Chris Lattner81779692006-03-30 22:51:12 +00001942 strcat(msg, count == 0 ? ", expecting `" : " or `");
1943 strcat(msg, yytname[x]);
1944 strcat(msg, "'");
1945 count++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001946 }
1947 }
Chris Lattner81779692006-03-30 22:51:12 +00001948 yyerror(msg);
1949 free(msg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001950 }
1951 else
Chris Lattner81779692006-03-30 22:51:12 +00001952 yyerror ("parse error; also virtual memory exceeded");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001953 }
1954 else
1955#endif /* YYERROR_VERBOSE */
Chris Lattner81779692006-03-30 22:51:12 +00001956 yyerror("parse error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001957 }
1958
Chris Lattner81779692006-03-30 22:51:12 +00001959 goto yyerrlab1;
1960yyerrlab1: /* here on error raised explicitly by an action */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001961
1962 if (yyerrstatus == 3)
1963 {
Chris Lattner81779692006-03-30 22:51:12 +00001964 /* if just tried and failed to reuse lookahead token after an error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001965
Chris Lattner81779692006-03-30 22:51:12 +00001966 /* return failure if at end of input */
Chris Lattnerba4b1442005-09-08 18:22:57 +00001967 if (yychar == YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00001968 YYABORT;
1969
Chris Lattner81779692006-03-30 22:51:12 +00001970#if YYDEBUG != 0
1971 if (yydebug)
1972 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1973#endif
Chris Lattnerba4b1442005-09-08 18:22:57 +00001974
Chris Lattner81779692006-03-30 22:51:12 +00001975 yychar = YYEMPTY;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001976 }
1977
Chris Lattner81779692006-03-30 22:51:12 +00001978 /* Else will try to reuse lookahead token
1979 after shifting the error token. */
1980
1981 yyerrstatus = 3; /* Each real token shifted decrements this */
1982
1983 goto yyerrhandle;
1984
1985yyerrdefault: /* current state does not do anything special for the error token. */
1986
1987#if 0
1988 /* This is wrong; only states that explicitly want error tokens
1989 should shift them. */
1990 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1991 if (yyn) goto yydefault;
1992#endif
1993
1994yyerrpop: /* pop the current state because it cannot handle the error token */
1995
1996 if (yyssp == yyss) YYABORT;
1997 yyvsp--;
1998 yystate = *--yyssp;
1999#ifdef YYLSP_NEEDED
2000 yylsp--;
2001#endif
2002
2003#if YYDEBUG != 0
2004 if (yydebug)
2005 {
2006 short *ssp1 = yyss - 1;
2007 fprintf (stderr, "Error: state stack now");
2008 while (ssp1 != yyssp)
2009 fprintf (stderr, " %d", *++ssp1);
2010 fprintf (stderr, "\n");
2011 }
2012#endif
2013
2014yyerrhandle:
2015
2016 yyn = yypact[yystate];
2017 if (yyn == YYFLAG)
2018 goto yyerrdefault;
2019
2020 yyn += YYTERROR;
2021 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2022 goto yyerrdefault;
2023
2024 yyn = yytable[yyn];
2025 if (yyn < 0)
2026 {
2027 if (yyn == YYFLAG)
2028 goto yyerrpop;
2029 yyn = -yyn;
2030 goto yyreduce;
2031 }
2032 else if (yyn == 0)
2033 goto yyerrpop;
2034
Reid Spencer68a24bd2005-08-27 18:50:39 +00002035 if (yyn == YYFINAL)
2036 YYACCEPT;
2037
Chris Lattner81779692006-03-30 22:51:12 +00002038#if YYDEBUG != 0
2039 if (yydebug)
2040 fprintf(stderr, "Shifting error token, ");
2041#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00002042
2043 *++yyvsp = yylval;
Chris Lattner81779692006-03-30 22:51:12 +00002044#ifdef YYLSP_NEEDED
2045 *++yylsp = yylloc;
2046#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00002047
2048 yystate = yyn;
2049 goto yynewstate;
2050
Chris Lattner81779692006-03-30 22:51:12 +00002051 yyacceptlab:
2052 /* YYACCEPT comes here. */
2053 if (yyfree_stacks)
2054 {
2055 free (yyss);
2056 free (yyvs);
2057#ifdef YYLSP_NEEDED
2058 free (yyls);
Chris Lattner2b931e82005-09-12 05:30:06 +00002059#endif
Chris Lattner81779692006-03-30 22:51:12 +00002060 }
2061 return 0;
John Criswelld7881242006-01-17 17:01:34 +00002062
Chris Lattner81779692006-03-30 22:51:12 +00002063 yyabortlab:
2064 /* YYABORT comes here. */
2065 if (yyfree_stacks)
2066 {
2067 free (yyss);
2068 free (yyvs);
2069#ifdef YYLSP_NEEDED
2070 free (yyls);
John Criswelld7881242006-01-17 17:01:34 +00002071#endif
Chris Lattner81779692006-03-30 22:51:12 +00002072 }
2073 return 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002074}
Chris Lattner27627382006-09-01 21:14:42 +00002075#line 784 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +00002076
2077
2078int yyerror(const char *ErrorMsg) {
2079 err() << "Error parsing: " << ErrorMsg << "\n";
2080 exit(1);
2081}