blob: 330e8a58acd463ee3d451a538c30e52255bf30c4 [file] [log] [blame]
Chris Lattner00950542001-06-06 20:29:01 +00001
2/* A Bison parser, made from llvmAsmParser.y
3 by GNU Bison version 1.28 */
4
5#define YYBISON 1 /* Identify Bison output. */
6
7#define yyparse llvmAsmparse
8#define yylex llvmAsmlex
9#define yyerror llvmAsmerror
10#define yylval llvmAsmlval
11#define yychar llvmAsmchar
12#define yydebug llvmAsmdebug
13#define yynerrs llvmAsmnerrs
14#define ESINT64VAL 257
15#define EUINT64VAL 258
16#define SINTVAL 259
17#define UINTVAL 260
18#define VOID 261
19#define BOOL 262
20#define SBYTE 263
21#define UBYTE 264
22#define SHORT 265
23#define USHORT 266
24#define INT 267
25#define UINT 268
26#define LONG 269
27#define ULONG 270
28#define FLOAT 271
29#define DOUBLE 272
30#define STRING 273
31#define TYPE 274
32#define LABEL 275
33#define VAR_ID 276
34#define LABELSTR 277
35#define STRINGCONSTANT 278
36#define IMPLEMENTATION 279
37#define TRUE 280
38#define FALSE 281
39#define BEGINTOK 282
40#define END 283
41#define DECLARE 284
Chris Lattner09083092001-07-08 04:57:15 +000042#define TO 285
Chris Lattner027dcc52001-07-08 21:10:27 +000043#define RET 286
44#define BR 287
45#define SWITCH 288
46#define NOT 289
47#define ADD 290
48#define SUB 291
49#define MUL 292
50#define DIV 293
51#define REM 294
52#define SETLE 295
53#define SETGE 296
54#define SETLT 297
55#define SETGT 298
56#define SETEQ 299
57#define SETNE 300
58#define MALLOC 301
59#define ALLOCA 302
60#define FREE 303
61#define LOAD 304
62#define STORE 305
Chris Lattnerab5ac6b2001-07-08 23:22:50 +000063#define GETELEMENTPTR 306
64#define PHI 307
65#define CALL 308
66#define CAST 309
67#define SHL 310
68#define SHR 311
Chris Lattner00950542001-06-06 20:29:01 +000069
70#line 13 "llvmAsmParser.y"
71
72#include "ParserInternals.h"
73#include "llvm/BasicBlock.h"
74#include "llvm/Method.h"
75#include "llvm/SymbolTable.h"
76#include "llvm/Module.h"
77#include "llvm/Type.h"
78#include "llvm/DerivedTypes.h"
79#include "llvm/Assembly/Parser.h"
80#include "llvm/ConstantPool.h"
81#include "llvm/iTerminators.h"
82#include "llvm/iMemory.h"
83#include <list>
84#include <utility> // Get definition of pair class
Chris Lattner8896eda2001-07-09 19:38:36 +000085#include <algorithm> // Get definition of find_if
Chris Lattner00950542001-06-06 20:29:01 +000086#include <stdio.h> // This embarasment is due to our flex lexer...
87
Chris Lattner09083092001-07-08 04:57:15 +000088int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
89int yylex(); // declaration" of xxx warnings.
Chris Lattner00950542001-06-06 20:29:01 +000090int yyparse();
91
92static Module *ParserResult;
93const ToolCommandLine *CurOptions = 0;
94
95// This contains info used when building the body of a method. It is destroyed
96// when the method is completed.
97//
98typedef vector<Value *> ValueList; // Numbered defs
99static void ResolveDefinitions(vector<ValueList> &LateResolvers);
100
101static struct PerModuleInfo {
102 Module *CurrentModule;
103 vector<ValueList> Values; // Module level numbered definitions
104 vector<ValueList> LateResolveValues;
105
106 void ModuleDone() {
107 // If we could not resolve some blocks at parsing time (forward branches)
108 // resolve the branches now...
109 ResolveDefinitions(LateResolveValues);
110
111 Values.clear(); // Clear out method local definitions
112 CurrentModule = 0;
113 }
114} CurModule;
115
116static struct PerMethodInfo {
117 Method *CurrentMethod; // Pointer to current method being created
118
119 vector<ValueList> Values; // Keep track of numbered definitions
120 vector<ValueList> LateResolveValues;
121
122 inline PerMethodInfo() {
123 CurrentMethod = 0;
124 }
125
126 inline ~PerMethodInfo() {}
127
128 inline void MethodStart(Method *M) {
129 CurrentMethod = M;
130 }
131
132 void MethodDone() {
133 // If we could not resolve some blocks at parsing time (forward branches)
134 // resolve the branches now...
135 ResolveDefinitions(LateResolveValues);
136
137 Values.clear(); // Clear out method local definitions
138 CurrentMethod = 0;
139 }
140} CurMeth; // Info for the current method...
141
142
143//===----------------------------------------------------------------------===//
144// Code to handle definitions of all the types
145//===----------------------------------------------------------------------===//
146
147static void InsertValue(Value *D, vector<ValueList> &ValueTab = CurMeth.Values) {
148 if (!D->hasName()) { // Is this a numbered definition?
149 unsigned type = D->getType()->getUniqueID();
150 if (ValueTab.size() <= type)
151 ValueTab.resize(type+1, ValueList());
152 //printf("Values[%d][%d] = %d\n", type, ValueTab[type].size(), D);
153 ValueTab[type].push_back(D);
154 }
155}
156
157static Value *getVal(const Type *Type, ValID &D,
158 bool DoNotImprovise = false) {
159 switch (D.Type) {
160 case 0: { // Is it a numbered definition?
161 unsigned type = Type->getUniqueID();
162 unsigned Num = (unsigned)D.Num;
163
164 // Module constants occupy the lowest numbered slots...
165 if (type < CurModule.Values.size()) {
166 if (Num < CurModule.Values[type].size())
167 return CurModule.Values[type][Num];
168
169 Num -= CurModule.Values[type].size();
170 }
171
172 // Make sure that our type is within bounds
173 if (CurMeth.Values.size() <= type)
174 break;
175
176 // Check that the number is within bounds...
177 if (CurMeth.Values[type].size() <= Num)
178 break;
179
180 return CurMeth.Values[type][Num];
181 }
182 case 1: { // Is it a named definition?
183 string Name(D.Name);
184 SymbolTable *SymTab = 0;
185 if (CurMeth.CurrentMethod)
186 SymTab = CurMeth.CurrentMethod->getSymbolTable();
187 Value *N = SymTab ? SymTab->lookup(Type, Name) : 0;
188
189 if (N == 0) {
190 SymTab = CurModule.CurrentModule->getSymbolTable();
191 if (SymTab)
192 N = SymTab->lookup(Type, Name);
193 if (N == 0) break;
194 }
195
196 D.destroy(); // Free old strdup'd memory...
197 return N;
198 }
199
200 case 2: // Is it a constant pool reference??
201 case 3: // Is it an unsigned const pool reference?
202 case 4:{ // Is it a string const pool reference?
203 ConstPoolVal *CPV = 0;
204
205 // Check to make sure that "Type" is an integral type, and that our
206 // value will fit into the specified type...
207 switch (D.Type) {
208 case 2:
209 if (Type == Type::BoolTy) { // Special handling for boolean data
210 CPV = new ConstPoolBool(D.ConstPool64 != 0);
211 } else {
212 if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64))
213 ThrowException("Symbolic constant pool reference is invalid!");
214 CPV = new ConstPoolSInt(Type, D.ConstPool64);
215 }
216 break;
217 case 3:
218 if (!ConstPoolUInt::isValueValidForType(Type, D.UConstPool64)) {
219 if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64)) {
220 ThrowException("Symbolic constant pool reference is invalid!");
221 } else { // This is really a signed reference. Transmogrify.
222 CPV = new ConstPoolSInt(Type, D.ConstPool64);
223 }
224 } else {
225 CPV = new ConstPoolUInt(Type, D.UConstPool64);
226 }
227 break;
228 case 4:
229 cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n";
230 abort();
231 //CPV = new ConstPoolString(D.Name);
232 D.destroy(); // Free the string memory
233 break;
234 }
235 assert(CPV && "How did we escape creating a constant??");
236
237 // Scan through the constant table and see if we already have loaded this
238 // constant.
239 //
240 ConstantPool &CP = CurMeth.CurrentMethod ?
241 CurMeth.CurrentMethod->getConstantPool() :
242 CurModule.CurrentModule->getConstantPool();
243 ConstPoolVal *C = CP.find(CPV); // Already have this constant?
244 if (C) {
245 delete CPV; // Didn't need this after all, oh well.
246 return C; // Yup, we already have one, recycle it!
247 }
248 CP.insert(CPV);
249
250 // Success, everything is kosher. Lets go!
251 return CPV;
252 } // End of case 2,3,4
253 } // End of switch
254
255
256 // If we reached here, we referenced either a symbol that we don't know about
257 // or an id number that hasn't been read yet. We may be referencing something
258 // forward, so just create an entry to be resolved later and get to it...
259 //
260 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
261
262 // TODO: Attempt to coallecse nodes that are the same with previous ones.
263 Value *d = 0;
264 switch (Type->getPrimitiveID()) {
265 case Type::LabelTyID: d = new BBPlaceHolder(Type, D); break;
266 case Type::MethodTyID:
267 d = new MethPlaceHolder(Type, D);
268 InsertValue(d, CurModule.LateResolveValues);
269 return d;
270//case Type::ClassTyID: d = new ClassPlaceHolder(Type, D); break;
271 default: d = new DefPlaceHolder(Type, D); break;
272 }
273
274 assert(d != 0 && "How did we not make something?");
275 InsertValue(d, CurMeth.LateResolveValues);
276 return d;
277}
278
279
280//===----------------------------------------------------------------------===//
281// Code to handle forward references in instructions
282//===----------------------------------------------------------------------===//
283//
284// This code handles the late binding needed with statements that reference
285// values not defined yet... for example, a forward branch, or the PHI node for
286// a loop body.
287//
288// This keeps a table (CurMeth.LateResolveValues) of all such forward references
289// and back patchs after we are done.
290//
291
292// ResolveDefinitions - If we could not resolve some defs at parsing
293// time (forward branches, phi functions for loops, etc...) resolve the
294// defs now...
295//
296static void ResolveDefinitions(vector<ValueList> &LateResolvers) {
297 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
298 for (unsigned ty = 0; ty < LateResolvers.size(); ty++) {
299 while (!LateResolvers[ty].empty()) {
300 Value *V = LateResolvers[ty].back();
301 LateResolvers[ty].pop_back();
302 ValID &DID = getValIDFromPlaceHolder(V);
303
304 Value *TheRealValue = getVal(Type::getUniqueIDType(ty), DID, true);
305
306 if (TheRealValue == 0 && DID.Type == 1)
307 ThrowException("Reference to an invalid definition: '" +DID.getName() +
308 "' of type '" + V->getType()->getName() + "'");
309 else if (TheRealValue == 0)
310 ThrowException("Reference to an invalid definition: #" +itostr(DID.Num)+
311 " of type '" + V->getType()->getName() + "'");
312
313 V->replaceAllUsesWith(TheRealValue);
314 assert(V->use_empty());
315 delete V;
316 }
317 }
318
319 LateResolvers.clear();
320}
321
322// addConstValToConstantPool - This code is used to insert a constant into the
323// current constant pool. This is designed to make maximal (but not more than
324// possible) reuse (merging) of constants in the constant pool. This means that
325// multiple references to %4, for example will all get merged.
326//
327static ConstPoolVal *addConstValToConstantPool(ConstPoolVal *C) {
328 vector<ValueList> &ValTab = CurMeth.CurrentMethod ?
329 CurMeth.Values : CurModule.Values;
330 ConstantPool &CP = CurMeth.CurrentMethod ?
331 CurMeth.CurrentMethod->getConstantPool() :
332 CurModule.CurrentModule->getConstantPool();
333
334 if (ConstPoolVal *CPV = CP.find(C)) {
335 // Constant already in constant pool. Try to merge the two constants
336 if (CPV->hasName() && !C->hasName()) {
337 // Merge the two values, we inherit the existing CPV's name.
338 // InsertValue requires that the value have no name to insert correctly
339 // (because we want to fill the slot this constant would have filled)
340 //
341 string Name = CPV->getName();
342 CPV->setName("");
343 InsertValue(CPV, ValTab);
344 CPV->setName(Name);
345 delete C;
346 return CPV;
347 } else if (!CPV->hasName() && C->hasName()) {
348 // If we have a name on this value and there isn't one in the const
349 // pool val already, propogate it.
350 //
351 CPV->setName(C->getName());
352 delete C; // Sorry, you're toast
353 return CPV;
354 } else if (CPV->hasName() && C->hasName()) {
355 // Both values have distinct names. We cannot merge them.
356 CP.insert(C);
357 InsertValue(C, ValTab);
358 return C;
359 } else if (!CPV->hasName() && !C->hasName()) {
360 // Neither value has a name, trivially merge them.
361 InsertValue(CPV, ValTab);
362 delete C;
363 return CPV;
364 }
365
366 assert(0 && "Not reached!");
367 return 0;
368 } else { // No duplication of value.
369 CP.insert(C);
370 InsertValue(C, ValTab);
371 return C;
372 }
373}
374
Chris Lattner8896eda2001-07-09 19:38:36 +0000375
376struct EqualsType {
377 const Type *T;
378 inline EqualsType(const Type *t) { T = t; }
379 inline bool operator()(const ConstPoolVal *CPV) const {
380 return static_cast<const ConstPoolType*>(CPV)->getValue() == T;
381 }
382};
383
384
385// checkNewType - We have to be careful to add all types referenced by the
386// program to the constant pool of the method or module. Because of this, we
387// often want to check to make sure that types used are in the constant pool,
388// and add them if they aren't. That's what this function does.
389//
390static const Type *checkNewType(const Type *Ty) {
391 ConstantPool &CP = CurMeth.CurrentMethod ?
392 CurMeth.CurrentMethod->getConstantPool() :
393 CurModule.CurrentModule->getConstantPool();
394
395 // Get the type type plane...
396 ConstantPool::PlaneType &P = CP.getPlane(Type::TypeTy);
397 ConstantPool::PlaneType::const_iterator PI = find_if(P.begin(), P.end(),
398 EqualsType(Ty));
399 if (PI == P.end()) {
400 vector<ValueList> &ValTab = CurMeth.CurrentMethod ?
401 CurMeth.Values : CurModule.Values;
402 ConstPoolVal *CPT = new ConstPoolType(Ty);
403 CP.insert(CPT);
404 InsertValue(CPT, ValTab);
405 }
406 return Ty;
407}
408
409
Chris Lattner00950542001-06-06 20:29:01 +0000410//===----------------------------------------------------------------------===//
411// RunVMAsmParser - Define an interface to this parser
412//===----------------------------------------------------------------------===//
413//
414Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) {
415 llvmAsmin = F;
416 CurOptions = &Opts;
417 llvmAsmlineno = 1; // Reset the current line number...
418
419 CurModule.CurrentModule = new Module(); // Allocate a new module to read
420 yyparse(); // Parse the file.
421 Module *Result = ParserResult;
422 CurOptions = 0;
423 llvmAsmin = stdin; // F is about to go away, don't use it anymore...
424 ParserResult = 0;
425
426 return Result;
427}
428
429
Chris Lattner8896eda2001-07-09 19:38:36 +0000430#line 373 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +0000431typedef union {
432 Module *ModuleVal;
433 Method *MethodVal;
434 MethodArgument *MethArgVal;
435 BasicBlock *BasicBlockVal;
436 TerminatorInst *TermInstVal;
437 Instruction *InstVal;
438 ConstPoolVal *ConstVal;
439 const Type *TypeVal;
440
441 list<MethodArgument*> *MethodArgList;
442 list<Value*> *ValueList;
443 list<const Type*> *TypeList;
Chris Lattnerc24d2082001-06-11 15:04:20 +0000444 list<pair<Value*, BasicBlock*> > *PHIList; // Represent the RHS of PHI node
Chris Lattner00950542001-06-06 20:29:01 +0000445 list<pair<ConstPoolVal*, BasicBlock*> > *JumpTable;
446 vector<ConstPoolVal*> *ConstVector;
447
448 int64_t SInt64Val;
449 uint64_t UInt64Val;
450 int SIntVal;
451 unsigned UIntVal;
452
453 char *StrVal; // This memory is allocated by strdup!
454 ValID ValIDVal; // May contain memory allocated by strdup
455
456 Instruction::UnaryOps UnaryOpVal;
457 Instruction::BinaryOps BinaryOpVal;
458 Instruction::TermOps TermOpVal;
459 Instruction::MemoryOps MemOpVal;
Chris Lattner027dcc52001-07-08 21:10:27 +0000460 Instruction::OtherOps OtherOpVal;
Chris Lattner00950542001-06-06 20:29:01 +0000461} YYSTYPE;
462#include <stdio.h>
463
464#ifndef __cplusplus
465#ifndef __STDC__
466#define const
467#endif
468#endif
469
470
471
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000472#define YYFINAL 260
Chris Lattner00950542001-06-06 20:29:01 +0000473#define YYFLAG -32768
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000474#define YYNTBASE 68
Chris Lattner00950542001-06-06 20:29:01 +0000475
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000476#define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 106)
Chris Lattner00950542001-06-06 20:29:01 +0000477
478static const char yytranslate[] = { 0,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000482 2, 2, 2, 2, 2, 2, 2, 2, 2, 65,
483 66, 67, 2, 64, 2, 2, 2, 2, 2, 2,
Chris Lattner00950542001-06-06 20:29:01 +0000484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000485 58, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner00950542001-06-06 20:29:01 +0000486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000488 59, 2, 60, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner00950542001-06-06 20:29:01 +0000489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000490 2, 2, 2, 2, 2, 2, 2, 2, 2, 61,
491 2, 2, 62, 2, 63, 2, 2, 2, 2, 2,
Chris Lattner00950542001-06-06 20:29:01 +0000492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
505 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
506 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
507 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
508 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
Chris Lattner027dcc52001-07-08 21:10:27 +0000509 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000510 57
Chris Lattner00950542001-06-06 20:29:01 +0000511};
512
513#if YYDEBUG != 0
514static const short yyprhs[] = { 0,
515 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
516 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
517 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
518 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
Chris Lattner027dcc52001-07-08 21:10:27 +0000519 80, 82, 84, 86, 88, 91, 92, 95, 98, 101,
520 104, 107, 110, 117, 123, 132, 140, 147, 152, 156,
521 158, 162, 163, 165, 168, 171, 173, 174, 177, 181,
522 183, 185, 186, 192, 196, 199, 201, 203, 205, 207,
523 209, 211, 213, 215, 217, 222, 226, 230, 236, 240,
524 243, 246, 248, 252, 255, 258, 261, 265, 268, 269,
525 273, 276, 280, 290, 300, 307, 313, 316, 323, 331,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000526 334, 339, 341, 342, 348, 352, 359, 365, 368, 375,
527 377, 380, 381, 384, 390, 393, 399, 403, 408, 416
Chris Lattner00950542001-06-06 20:29:01 +0000528};
529
530static const short yyrhs[] = { 5,
531 0, 6, 0, 3, 0, 4, 0, 8, 0, 9,
532 0, 10, 0, 11, 0, 12, 0, 13, 0, 14,
533 0, 15, 0, 16, 0, 17, 0, 18, 0, 19,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000534 0, 20, 0, 21, 0, 70, 0, 7, 0, 35,
Chris Lattner027dcc52001-07-08 21:10:27 +0000535 0, 36, 0, 37, 0, 38, 0, 39, 0, 40,
536 0, 41, 0, 42, 0, 43, 0, 44, 0, 45,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000537 0, 46, 0, 56, 0, 57, 0, 15, 0, 13,
Chris Lattner027dcc52001-07-08 21:10:27 +0000538 0, 11, 0, 9, 0, 16, 0, 14, 0, 12,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000539 0, 10, 0, 75, 0, 76, 0, 22, 58, 0,
540 0, 75, 69, 0, 76, 4, 0, 8, 26, 0,
541 8, 27, 0, 19, 24, 0, 20, 70, 0, 59,
542 70, 60, 59, 80, 60, 0, 59, 70, 60, 59,
543 60, 0, 59, 4, 61, 70, 60, 59, 80, 60,
544 0, 59, 4, 61, 70, 60, 59, 60, 0, 62,
545 93, 63, 62, 80, 63, 0, 62, 63, 62, 63,
546 0, 80, 64, 79, 0, 79, 0, 81, 78, 79,
547 0, 0, 83, 0, 83, 90, 0, 81, 25, 0,
548 22, 0, 0, 70, 84, 0, 85, 64, 86, 0,
549 85, 0, 86, 0, 0, 71, 24, 65, 87, 66,
550 0, 88, 81, 28, 0, 94, 29, 0, 3, 0,
551 4, 0, 26, 0, 27, 0, 24, 0, 68, 0,
552 22, 0, 91, 0, 92, 0, 71, 65, 93, 66,
553 0, 71, 65, 66, 0, 59, 70, 60, 0, 59,
554 4, 61, 70, 60, 0, 62, 93, 63, 0, 62,
555 63, 0, 70, 67, 0, 70, 0, 93, 64, 70,
556 0, 94, 95, 0, 89, 95, 0, 96, 97, 0,
557 23, 96, 97, 0, 96, 99, 0, 0, 32, 70,
558 92, 0, 32, 7, 0, 33, 21, 92, 0, 33,
559 8, 92, 64, 21, 92, 64, 21, 92, 0, 34,
560 77, 92, 64, 21, 92, 59, 98, 60, 0, 98,
561 77, 91, 64, 21, 92, 0, 77, 91, 64, 21,
562 92, 0, 78, 103, 0, 70, 59, 92, 64, 92,
563 60, 0, 100, 64, 59, 92, 64, 92, 60, 0,
564 70, 92, 0, 101, 64, 70, 92, 0, 101, 0,
565 0, 73, 70, 92, 64, 92, 0, 72, 70, 92,
566 0, 74, 70, 92, 64, 70, 92, 0, 55, 70,
567 92, 31, 70, 0, 53, 100, 0, 54, 70, 92,
568 65, 102, 66, 0, 105, 0, 64, 80, 0, 0,
569 47, 70, 0, 47, 70, 64, 14, 92, 0, 48,
570 70, 0, 48, 70, 64, 14, 92, 0, 49, 70,
571 92, 0, 50, 70, 92, 104, 0, 51, 70, 92,
572 64, 70, 92, 104, 0, 52, 70, 92, 104, 0
Chris Lattner00950542001-06-06 20:29:01 +0000573};
574
575#endif
576
577#if YYDEBUG != 0
578static const short yyrline[] = { 0,
Chris Lattner8896eda2001-07-09 19:38:36 +0000579 470, 471, 478, 479, 490, 490, 490, 490, 490, 490,
580 490, 491, 491, 491, 491, 491, 491, 491, 494, 494,
581 499, 500, 500, 500, 500, 500, 501, 501, 501, 501,
582 501, 501, 502, 502, 506, 506, 506, 506, 507, 507,
Chris Lattnere98dda62001-07-14 06:10:16 +0000583 507, 507, 508, 508, 511, 514, 521, 526, 531, 534,
584 537, 543, 546, 559, 563, 581, 588, 596, 610, 613,
585 623, 640, 651, 658, 663, 672, 672, 674, 682, 686,
586 691, 694, 698, 725, 729, 738, 741, 744, 747, 750,
587 755, 758, 761, 768, 776, 781, 785, 788, 791, 796,
588 799, 804, 808, 813, 817, 826, 831, 840, 844, 848,
589 851, 854, 857, 862, 873, 881, 891, 899, 904, 911,
590 915, 921, 921, 923, 928, 933, 937, 940, 951, 988,
591 993, 995, 999, 1002, 1009, 1012, 1020, 1026, 1035, 1047
Chris Lattner00950542001-06-06 20:29:01 +0000592};
593#endif
594
595
596#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
597
598static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
599"EUINT64VAL","SINTVAL","UINTVAL","VOID","BOOL","SBYTE","UBYTE","SHORT","USHORT",
600"INT","UINT","LONG","ULONG","FLOAT","DOUBLE","STRING","TYPE","LABEL","VAR_ID",
601"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","TRUE","FALSE","BEGINTOK","END",
Chris Lattner027dcc52001-07-08 21:10:27 +0000602"DECLARE","TO","RET","BR","SWITCH","NOT","ADD","SUB","MUL","DIV","REM","SETLE",
603"SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE",
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000604"GETELEMENTPTR","PHI","CALL","CAST","SHL","SHR","'='","'['","']'","'x'","'{'",
605"'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps",
Chris Lattner027dcc52001-07-08 21:10:27 +0000606"BinaryOps","ShiftOps","SIntType","UIntType","IntType","OptAssign","ConstVal",
607"ConstVector","ConstPool","Module","MethodList","OptVAR_ID","ArgVal","ArgListH",
608"ArgList","MethodHeaderH","MethodHeader","Method","ConstValueRef","ValueRef",
609"TypeList","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst",
610"JumpTable","Inst","PHIList","ValueRefList","ValueRefListE","InstVal","UByteList",
611"MemoryInst", NULL
Chris Lattner00950542001-06-06 20:29:01 +0000612};
613#endif
614
615static const short yyr1[] = { 0,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000616 68, 68, 69, 69, 70, 70, 70, 70, 70, 70,
617 70, 70, 70, 70, 70, 70, 70, 70, 71, 71,
618 72, 73, 73, 73, 73, 73, 73, 73, 73, 73,
619 73, 73, 74, 74, 75, 75, 75, 75, 76, 76,
620 76, 76, 77, 77, 78, 78, 79, 79, 79, 79,
621 79, 79, 79, 79, 79, 79, 79, 79, 80, 80,
622 81, 81, 82, 83, 83, 84, 84, 85, 86, 86,
623 87, 87, 88, 89, 90, 91, 91, 91, 91, 91,
624 92, 92, 92, 70, 70, 70, 70, 70, 70, 70,
625 70, 93, 93, 94, 94, 95, 95, 96, 96, 97,
626 97, 97, 97, 97, 98, 98, 99, 100, 100, 101,
627 101, 102, 102, 103, 103, 103, 103, 103, 103, 103,
628 104, 104, 105, 105, 105, 105, 105, 105, 105, 105
Chris Lattner00950542001-06-06 20:29:01 +0000629};
630
631static const short yyr2[] = { 0,
632 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
633 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
634 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
635 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Chris Lattner027dcc52001-07-08 21:10:27 +0000636 1, 1, 1, 1, 2, 0, 2, 2, 2, 2,
637 2, 2, 6, 5, 8, 7, 6, 4, 3, 1,
638 3, 0, 1, 2, 2, 1, 0, 2, 3, 1,
639 1, 0, 5, 3, 2, 1, 1, 1, 1, 1,
640 1, 1, 1, 1, 4, 3, 3, 5, 3, 2,
641 2, 1, 3, 2, 2, 2, 3, 2, 0, 3,
642 2, 3, 9, 9, 6, 5, 2, 6, 7, 2,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000643 4, 1, 0, 5, 3, 6, 5, 2, 6, 1,
644 2, 0, 2, 5, 2, 5, 3, 4, 7, 4
Chris Lattner00950542001-06-06 20:29:01 +0000645};
646
Chris Lattner027dcc52001-07-08 21:10:27 +0000647static const short yydefact[] = { 62,
648 46, 63, 0, 65, 0, 76, 77, 1, 2, 20,
Chris Lattner00950542001-06-06 20:29:01 +0000649 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
Chris Lattner027dcc52001-07-08 21:10:27 +0000650 15, 16, 17, 18, 82, 80, 78, 79, 0, 0,
651 81, 19, 0, 62, 99, 64, 83, 84, 99, 45,
652 0, 38, 42, 37, 41, 36, 40, 35, 39, 0,
653 0, 0, 0, 0, 0, 61, 77, 19, 0, 90,
654 92, 0, 91, 0, 0, 46, 99, 95, 46, 75,
655 94, 49, 50, 51, 52, 77, 19, 0, 0, 3,
656 4, 47, 48, 0, 87, 89, 0, 72, 86, 0,
657 74, 46, 0, 0, 0, 0, 96, 98, 0, 0,
658 0, 0, 19, 93, 67, 70, 71, 0, 85, 97,
659 101, 19, 0, 0, 43, 44, 0, 21, 22, 23,
660 24, 25, 26, 27, 28, 29, 30, 31, 32, 0,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000661 0, 0, 0, 0, 0, 0, 0, 0, 33, 34,
662 0, 0, 0, 107, 120, 19, 0, 58, 0, 88,
663 66, 68, 0, 73, 100, 0, 102, 0, 123, 125,
664 19, 19, 19, 19, 19, 118, 19, 19, 19, 19,
665 19, 0, 54, 60, 0, 0, 69, 0, 0, 0,
666 0, 127, 122, 0, 122, 0, 0, 0, 0, 115,
667 0, 0, 0, 53, 0, 57, 0, 0, 0, 0,
668 0, 128, 0, 130, 0, 0, 113, 0, 0, 0,
669 56, 0, 59, 0, 0, 124, 126, 121, 19, 0,
670 0, 19, 112, 0, 117, 114, 19, 55, 0, 0,
671 122, 0, 0, 110, 0, 119, 116, 0, 0, 0,
672 129, 108, 0, 19, 103, 0, 104, 0, 109, 111,
673 0, 0, 0, 0, 106, 0, 105, 0, 0, 0
Chris Lattner00950542001-06-06 20:29:01 +0000674};
675
676static const short yydefgoto[] = { 31,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000677 82, 61, 59, 141, 142, 143, 54, 55, 117, 5,
678 174, 175, 1, 258, 2, 152, 106, 107, 108, 34,
679 35, 36, 37, 38, 62, 39, 68, 69, 97, 240,
680 98, 166, 223, 224, 144, 202, 145
Chris Lattner00950542001-06-06 20:29:01 +0000681};
682
683static const short yypact[] = {-32768,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000684 70, 321, -6,-32768, 90,-32768,-32768,-32768,-32768,-32768,
Chris Lattner00950542001-06-06 20:29:01 +0000685-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000686-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 381, 235,
687-32768, 45, -20,-32768, 98,-32768,-32768,-32768, 93,-32768,
688 67,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 56,
689 321, 406, 296, 181, 142,-32768, 97, -14, 96,-32768,
690 46, 123,-32768, 101, 210, 122,-32768,-32768, 135,-32768,
691-32768,-32768,-32768,-32768, 46, 111, 29, 112, 129,-32768,
692-32768,-32768,-32768, 321,-32768,-32768, 321, 321,-32768, 79,
693-32768, 135, 466, 13, 268, 461,-32768,-32768, 321, 118,
694 125, 119, 47, 46, 10, 126,-32768, 131,-32768,-32768,
695 133, 4, 52, 52,-32768,-32768, 52,-32768,-32768,-32768,
696-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 321,
697 321, 321, 321, 321, 321, 321, 321, 321,-32768,-32768,
698 321, 321, 321,-32768,-32768, 48, 3,-32768, 90,-32768,
699-32768,-32768, 321,-32768,-32768, 138,-32768, 139, 106, 115,
700 4, 4, 4, 4, 0, 140, 4, 4, 4, 4,
701 4, 148,-32768,-32768, 99, 132,-32768, 178, 189, 197,
702 221,-32768, 194, 196, 194, 52, 204, 199, 234,-32768,
703 202, 203, 28,-32768, 90,-32768, 52, 52, 52, 52,
704 90,-32768, 321,-32768, 206, 52, 321, 321, 52, 321,
705-32768, 100,-32768, 207, 209,-32768,-32768, 211, 4, 52,
706 222, 4, 223, 208, 46,-32768, 4,-32768, 252, 268,
707 194, 225, 52,-32768, 321,-32768,-32768, 52, 57, 435,
708-32768,-32768, 228, 4,-32768, 226,-32768, 57,-32768,-32768,
709 270, 229, 52, 271,-32768, 52,-32768, 289, 295,-32768
Chris Lattner00950542001-06-06 20:29:01 +0000710};
711
712static const short yypgoto[] = {-32768,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000713-32768, -2, 294,-32768,-32768,-32768, -93, -92, -205, -63,
714 -4, -129, 285,-32768,-32768,-32768,-32768, 168,-32768,-32768,
715-32768,-32768, -215, -44, 1,-32768, 305, 279, 257,-32768,
716-32768,-32768,-32768,-32768,-32768, -180,-32768
Chris Lattner00950542001-06-06 20:29:01 +0000717};
718
719
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000720#define YYLAST 528
Chris Lattner00950542001-06-06 20:29:01 +0000721
722
723static const short yytable[] = { 32,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000724 56, 115, 116, 64, 204, 96, 6, 7, 8, 9,
725 41, 42, 43, 44, 45, 46, 47, 48, 49, 176,
726 113, 50, 51, 246, 239, 25, 58, 26, 96, 27,
727 28, 151, 252, 114, 248, 41, 42, 43, 44, 45,
728 46, 47, 48, 49, 65, 85, 50, 51, 75, 77,
729 241, 40, 63, 79, 6, 7, 8, 9, 186, 6,
730 7, 52, 173, 212, 53, 90, 63, 155, 156, 157,
731 63, 218, 158, 25, -19, 26, 63, 27, 28, 74,
732 26, 103, 27, 28, 104, 105, 52, 211, 100, 53,
733 112, 3, 72, 73, 4, 63, 146, 41, 42, 43,
734 44, 45, 46, 47, 48, 49, 150, 172, 50, 51,
735 -19, 63, 63, 63, 63, 67, 182, 183, 184, 185,
736 67, 70, 188, 189, 190, 191, 192, 159, 160, 161,
737 162, 163, 164, 165, 167, 168, 115, 116, 169, 170,
738 171, 205, 87, 3, 109, 83, 115, 116, 52, 91,
739 105, 53, 214, 215, 216, 217, 3, 84, 194, 228,
740 65, 221, 195, 195, 226, 88, 93, 94, 95, 180,
741 -19, 99, 63, 101, 231, 232, 147, 234, 181, -19,
742 149, 63, 237, 80, 81, 86, 87, 148, 243, 153,
743 213, 102, 87, 245, 196, 195, 154, -20, 197, 250,
744 219, 178, 179, 187, 222, 225, 193, 227, 255, 198,
745 199, 257, 6, 7, 8, 9, 10, 11, 12, 13,
Chris Lattner027dcc52001-07-08 21:10:27 +0000746 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000747 24, 25, 244, 26, 200, 27, 28, 6, 7, 8,
Chris Lattner027dcc52001-07-08 21:10:27 +0000748 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000749 19, 20, 21, 22, 23, 24, 25, 201, 26, 203,
750 27, 28, 206, 207, 208, 209, 210, 230, 29, 220,
751 229, 30, 238, 236, 195, 89, 42, 43, 44, 45,
752 46, 47, 48, 49, 242, 233, 235, 249, 259, 251,
753 253, 256, 254, 29, 260, 33, 30, 60, 6, 7,
754 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
755 18, 19, 20, 21, 22, 23, 24, 25, 66, 26,
756 177, 27, 28, 6, 7, 8, 9, 10, 11, 12,
757 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
758 23, 24, 25, 71, 26, 92, 27, 28, 110, 0,
759 0, 0, 0, 0, 29, 0, 0, 30, 78, 0,
Chris Lattner00950542001-06-06 20:29:01 +0000760 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000761 0, 0, 0, 0, 0, 0, 0, 0, 0, 29,
762 0, 0, 30, 6, 57, 8, 9, 10, 11, 12,
763 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
764 23, 24, 25, 0, 26, 0, 27, 28, 6, 76,
765 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
766 18, 19, 20, 21, 22, 23, 24, 25, 0, 26,
767 0, 27, 28, 0, 0, 0, 0, 0, 0, 29,
768 0, 0, 30, 42, 43, 44, 45, 46, 47, 48,
769 49, 0, 0, 0, 0, 0, 0, 0, 0, 0,
770 0, 0, 0, 0, 29, 0, 0, 30, 6, 7,
771 8, 9, 111, 11, 12, 13, 14, 15, 16, 17,
772 18, 19, 20, 21, 22, 23, 24, 25, 0, 26,
773 0, 27, 28, 0, 247, 118, 119, 120, 121, 122,
774 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
775 133, 134, 135, 136, 137, 138, 139, 140, 0, 0,
776 0, 0, 0, 0, 29, 0, 0, 30
Chris Lattner00950542001-06-06 20:29:01 +0000777};
778
779static const short yycheck[] = { 2,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000780 5, 95, 95, 24, 185, 69, 3, 4, 5, 6,
781 8, 9, 10, 11, 12, 13, 14, 15, 16, 149,
782 8, 19, 20, 239, 230, 22, 29, 24, 92, 26,
783 27, 22, 248, 21, 240, 8, 9, 10, 11, 12,
784 13, 14, 15, 16, 65, 60, 19, 20, 51, 52,
785 231, 58, 67, 53, 3, 4, 5, 6, 59, 3,
786 4, 59, 60, 193, 62, 65, 67, 112, 113, 114,
787 67, 201, 117, 22, 65, 24, 67, 26, 27, 24,
788 24, 84, 26, 27, 87, 88, 59, 60, 60, 62,
789 93, 22, 26, 27, 25, 67, 99, 8, 9, 10,
790 11, 12, 13, 14, 15, 16, 60, 60, 19, 20,
791 65, 67, 67, 67, 67, 23, 161, 162, 163, 164,
792 23, 29, 167, 168, 169, 170, 171, 130, 131, 132,
793 133, 134, 135, 136, 137, 138, 230, 230, 141, 142,
794 143, 186, 64, 22, 66, 4, 240, 240, 59, 28,
795 153, 62, 197, 198, 199, 200, 22, 61, 60, 60,
796 65, 206, 64, 64, 209, 65, 32, 33, 34, 64,
797 65, 61, 67, 62, 219, 220, 59, 222, 64, 65,
798 62, 67, 227, 3, 4, 63, 64, 63, 233, 64,
799 195, 63, 64, 238, 63, 64, 66, 65, 21, 244,
800 203, 64, 64, 64, 207, 208, 59, 210, 253, 21,
801 14, 256, 3, 4, 5, 6, 7, 8, 9, 10,
Chris Lattner027dcc52001-07-08 21:10:27 +0000802 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000803 21, 22, 235, 24, 14, 26, 27, 3, 4, 5,
Chris Lattner027dcc52001-07-08 21:10:27 +0000804 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000805 16, 17, 18, 19, 20, 21, 22, 64, 24, 64,
806 26, 27, 59, 65, 31, 64, 64, 59, 59, 64,
807 64, 62, 21, 66, 64, 66, 9, 10, 11, 12,
808 13, 14, 15, 16, 60, 64, 64, 60, 0, 64,
809 21, 21, 64, 59, 0, 2, 62, 63, 3, 4,
810 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
811 15, 16, 17, 18, 19, 20, 21, 22, 34, 24,
812 153, 26, 27, 3, 4, 5, 6, 7, 8, 9,
813 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
814 20, 21, 22, 39, 24, 67, 26, 27, 92, -1,
815 -1, -1, -1, -1, 59, -1, -1, 62, 63, -1,
Chris Lattner00950542001-06-06 20:29:01 +0000816 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerab5ac6b2001-07-08 23:22:50 +0000817 -1, -1, -1, -1, -1, -1, -1, -1, -1, 59,
818 -1, -1, 62, 3, 4, 5, 6, 7, 8, 9,
819 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
820 20, 21, 22, -1, 24, -1, 26, 27, 3, 4,
821 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
822 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
823 -1, 26, 27, -1, -1, -1, -1, -1, -1, 59,
824 -1, -1, 62, 9, 10, 11, 12, 13, 14, 15,
825 16, -1, -1, -1, -1, -1, -1, -1, -1, -1,
826 -1, -1, -1, -1, 59, -1, -1, 62, 3, 4,
827 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
828 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
829 -1, 26, 27, -1, 60, 35, 36, 37, 38, 39,
830 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
831 50, 51, 52, 53, 54, 55, 56, 57, -1, -1,
832 -1, -1, -1, -1, 59, -1, -1, 62
Chris Lattner00950542001-06-06 20:29:01 +0000833};
834/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
835#line 3 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
836/* This file comes from bison-1.28. */
837
838/* Skeleton output parser for bison,
839 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
840
841 This program is free software; you can redistribute it and/or modify
842 it under the terms of the GNU General Public License as published by
843 the Free Software Foundation; either version 2, or (at your option)
844 any later version.
845
846 This program is distributed in the hope that it will be useful,
847 but WITHOUT ANY WARRANTY; without even the implied warranty of
848 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
849 GNU General Public License for more details.
850
851 You should have received a copy of the GNU General Public License
852 along with this program; if not, write to the Free Software
853 Foundation, Inc., 59 Temple Place - Suite 330,
854 Boston, MA 02111-1307, USA. */
855
856/* As a special exception, when this file is copied by Bison into a
857 Bison output file, you may use that output file without restriction.
858 This special exception was added by the Free Software Foundation
859 in version 1.24 of Bison. */
860
861/* This is the parser code that is written into each bison parser
862 when the %semantic_parser declaration is not specified in the grammar.
863 It was written by Richard Stallman by simplifying the hairy parser
864 used when %semantic_parser is specified. */
865
866#ifndef YYSTACK_USE_ALLOCA
867#ifdef alloca
868#define YYSTACK_USE_ALLOCA
869#else /* alloca not defined */
870#ifdef __GNUC__
871#define YYSTACK_USE_ALLOCA
872#define alloca __builtin_alloca
873#else /* not GNU C. */
874#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
875#define YYSTACK_USE_ALLOCA
876#include <alloca.h>
877#else /* not sparc */
878/* We think this test detects Watcom and Microsoft C. */
879/* This used to test MSDOS, but that is a bad idea
880 since that symbol is in the user namespace. */
881#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
882#if 0 /* No need for malloc.h, which pollutes the namespace;
883 instead, just don't use alloca. */
884#include <malloc.h>
885#endif
886#else /* not MSDOS, or __TURBOC__ */
887#if defined(_AIX)
888/* I don't know what this was needed for, but it pollutes the namespace.
889 So I turned it off. rms, 2 May 1997. */
890/* #include <malloc.h> */
891 #pragma alloca
892#define YYSTACK_USE_ALLOCA
893#else /* not MSDOS, or __TURBOC__, or _AIX */
894#if 0
895#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
896 and on HPUX 10. Eventually we can turn this on. */
897#define YYSTACK_USE_ALLOCA
898#define alloca __builtin_alloca
899#endif /* __hpux */
900#endif
901#endif /* not _AIX */
902#endif /* not MSDOS, or __TURBOC__ */
903#endif /* not sparc */
904#endif /* not GNU C */
905#endif /* alloca not defined */
906#endif /* YYSTACK_USE_ALLOCA not defined */
907
908#ifdef YYSTACK_USE_ALLOCA
909#define YYSTACK_ALLOC alloca
910#else
911#define YYSTACK_ALLOC malloc
912#endif
913
914/* Note: there must be only one dollar sign in this file.
915 It is replaced by the list of actions, each action
916 as one case of the switch. */
917
918#define yyerrok (yyerrstatus = 0)
919#define yyclearin (yychar = YYEMPTY)
920#define YYEMPTY -2
921#define YYEOF 0
922#define YYACCEPT goto yyacceptlab
923#define YYABORT goto yyabortlab
924#define YYERROR goto yyerrlab1
925/* Like YYERROR except do call yyerror.
926 This remains here temporarily to ease the
927 transition to the new meaning of YYERROR, for GCC.
928 Once GCC version 2 has supplanted version 1, this can go. */
929#define YYFAIL goto yyerrlab
930#define YYRECOVERING() (!!yyerrstatus)
931#define YYBACKUP(token, value) \
932do \
933 if (yychar == YYEMPTY && yylen == 1) \
934 { yychar = (token), yylval = (value); \
935 yychar1 = YYTRANSLATE (yychar); \
936 YYPOPSTACK; \
937 goto yybackup; \
938 } \
939 else \
940 { yyerror ("syntax error: cannot back up"); YYERROR; } \
941while (0)
942
943#define YYTERROR 1
944#define YYERRCODE 256
945
946#ifndef YYPURE
947#define YYLEX yylex()
948#endif
949
950#ifdef YYPURE
951#ifdef YYLSP_NEEDED
952#ifdef YYLEX_PARAM
953#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
954#else
955#define YYLEX yylex(&yylval, &yylloc)
956#endif
957#else /* not YYLSP_NEEDED */
958#ifdef YYLEX_PARAM
959#define YYLEX yylex(&yylval, YYLEX_PARAM)
960#else
961#define YYLEX yylex(&yylval)
962#endif
963#endif /* not YYLSP_NEEDED */
964#endif
965
966/* If nonreentrant, generate the variables here */
967
968#ifndef YYPURE
969
970int yychar; /* the lookahead symbol */
971YYSTYPE yylval; /* the semantic value of the */
972 /* lookahead symbol */
973
974#ifdef YYLSP_NEEDED
975YYLTYPE yylloc; /* location data for the lookahead */
976 /* symbol */
977#endif
978
979int yynerrs; /* number of parse errors so far */
980#endif /* not YYPURE */
981
982#if YYDEBUG != 0
983int yydebug; /* nonzero means print parse trace */
984/* Since this is uninitialized, it does not stop multiple parsers
985 from coexisting. */
986#endif
987
988/* YYINITDEPTH indicates the initial size of the parser's stacks */
989
990#ifndef YYINITDEPTH
991#define YYINITDEPTH 200
992#endif
993
994/* YYMAXDEPTH is the maximum size the stacks can grow to
995 (effective only if the built-in stack extension method is used). */
996
997#if YYMAXDEPTH == 0
998#undef YYMAXDEPTH
999#endif
1000
1001#ifndef YYMAXDEPTH
1002#define YYMAXDEPTH 10000
1003#endif
1004
1005/* Define __yy_memcpy. Note that the size argument
1006 should be passed with type unsigned int, because that is what the non-GCC
1007 definitions require. With GCC, __builtin_memcpy takes an arg
1008 of type size_t, but it can handle unsigned int. */
1009
1010#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
1011#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
1012#else /* not GNU C or C++ */
1013#ifndef __cplusplus
1014
1015/* This is the most reliable way to avoid incompatibilities
1016 in available built-in functions on various systems. */
1017static void
1018__yy_memcpy (to, from, count)
1019 char *to;
1020 char *from;
1021 unsigned int count;
1022{
1023 register char *f = from;
1024 register char *t = to;
1025 register int i = count;
1026
1027 while (i-- > 0)
1028 *t++ = *f++;
1029}
1030
1031#else /* __cplusplus */
1032
1033/* This is the most reliable way to avoid incompatibilities
1034 in available built-in functions on various systems. */
1035static void
1036__yy_memcpy (char *to, char *from, unsigned int count)
1037{
1038 register char *t = to;
1039 register char *f = from;
1040 register int i = count;
1041
1042 while (i-- > 0)
1043 *t++ = *f++;
1044}
1045
1046#endif
1047#endif
1048
1049#line 217 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
1050
1051/* The user can define YYPARSE_PARAM as the name of an argument to be passed
1052 into yyparse. The argument should have type void *.
1053 It should actually point to an object.
1054 Grammar actions can access the variable by casting it
1055 to the proper pointer type. */
1056
1057#ifdef YYPARSE_PARAM
1058#ifdef __cplusplus
1059#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1060#define YYPARSE_PARAM_DECL
1061#else /* not __cplusplus */
1062#define YYPARSE_PARAM_ARG YYPARSE_PARAM
1063#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1064#endif /* not __cplusplus */
1065#else /* not YYPARSE_PARAM */
1066#define YYPARSE_PARAM_ARG
1067#define YYPARSE_PARAM_DECL
1068#endif /* not YYPARSE_PARAM */
1069
1070/* Prevent warning if -Wstrict-prototypes. */
1071#ifdef __GNUC__
1072#ifdef YYPARSE_PARAM
1073int yyparse (void *);
1074#else
1075int yyparse (void);
1076#endif
1077#endif
1078
1079int
1080yyparse(YYPARSE_PARAM_ARG)
1081 YYPARSE_PARAM_DECL
1082{
1083 register int yystate;
1084 register int yyn;
1085 register short *yyssp;
1086 register YYSTYPE *yyvsp;
1087 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1088 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1089
1090 short yyssa[YYINITDEPTH]; /* the state stack */
1091 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1092
1093 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1094 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1095
1096#ifdef YYLSP_NEEDED
1097 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1098 YYLTYPE *yyls = yylsa;
1099 YYLTYPE *yylsp;
1100
1101#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1102#else
1103#define YYPOPSTACK (yyvsp--, yyssp--)
1104#endif
1105
1106 int yystacksize = YYINITDEPTH;
1107 int yyfree_stacks = 0;
1108
1109#ifdef YYPURE
1110 int yychar;
1111 YYSTYPE yylval;
1112 int yynerrs;
1113#ifdef YYLSP_NEEDED
1114 YYLTYPE yylloc;
1115#endif
1116#endif
1117
1118 YYSTYPE yyval; /* the variable used to return */
1119 /* semantic values from the action */
1120 /* routines */
1121
1122 int yylen;
1123
1124#if YYDEBUG != 0
1125 if (yydebug)
1126 fprintf(stderr, "Starting parse\n");
1127#endif
1128
1129 yystate = 0;
1130 yyerrstatus = 0;
1131 yynerrs = 0;
1132 yychar = YYEMPTY; /* Cause a token to be read. */
1133
1134 /* Initialize stack pointers.
1135 Waste one element of value and location stack
1136 so that they stay on the same level as the state stack.
1137 The wasted elements are never initialized. */
1138
1139 yyssp = yyss - 1;
1140 yyvsp = yyvs;
1141#ifdef YYLSP_NEEDED
1142 yylsp = yyls;
1143#endif
1144
1145/* Push a new state, which is found in yystate . */
1146/* In all cases, when you get here, the value and location stacks
1147 have just been pushed. so pushing a state here evens the stacks. */
1148yynewstate:
1149
1150 *++yyssp = yystate;
1151
1152 if (yyssp >= yyss + yystacksize - 1)
1153 {
1154 /* Give user a chance to reallocate the stack */
1155 /* Use copies of these so that the &'s don't force the real ones into memory. */
1156 YYSTYPE *yyvs1 = yyvs;
1157 short *yyss1 = yyss;
1158#ifdef YYLSP_NEEDED
1159 YYLTYPE *yyls1 = yyls;
1160#endif
1161
1162 /* Get the current used size of the three stacks, in elements. */
1163 int size = yyssp - yyss + 1;
1164
1165#ifdef yyoverflow
1166 /* Each stack pointer address is followed by the size of
1167 the data in use in that stack, in bytes. */
1168#ifdef YYLSP_NEEDED
1169 /* This used to be a conditional around just the two extra args,
1170 but that might be undefined if yyoverflow is a macro. */
1171 yyoverflow("parser stack overflow",
1172 &yyss1, size * sizeof (*yyssp),
1173 &yyvs1, size * sizeof (*yyvsp),
1174 &yyls1, size * sizeof (*yylsp),
1175 &yystacksize);
1176#else
1177 yyoverflow("parser stack overflow",
1178 &yyss1, size * sizeof (*yyssp),
1179 &yyvs1, size * sizeof (*yyvsp),
1180 &yystacksize);
1181#endif
1182
1183 yyss = yyss1; yyvs = yyvs1;
1184#ifdef YYLSP_NEEDED
1185 yyls = yyls1;
1186#endif
1187#else /* no yyoverflow */
1188 /* Extend the stack our own way. */
1189 if (yystacksize >= YYMAXDEPTH)
1190 {
1191 yyerror("parser stack overflow");
1192 if (yyfree_stacks)
1193 {
1194 free (yyss);
1195 free (yyvs);
1196#ifdef YYLSP_NEEDED
1197 free (yyls);
1198#endif
1199 }
1200 return 2;
1201 }
1202 yystacksize *= 2;
1203 if (yystacksize > YYMAXDEPTH)
1204 yystacksize = YYMAXDEPTH;
1205#ifndef YYSTACK_USE_ALLOCA
1206 yyfree_stacks = 1;
1207#endif
1208 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1209 __yy_memcpy ((char *)yyss, (char *)yyss1,
1210 size * (unsigned int) sizeof (*yyssp));
1211 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1212 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1213 size * (unsigned int) sizeof (*yyvsp));
1214#ifdef YYLSP_NEEDED
1215 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1216 __yy_memcpy ((char *)yyls, (char *)yyls1,
1217 size * (unsigned int) sizeof (*yylsp));
1218#endif
1219#endif /* no yyoverflow */
1220
1221 yyssp = yyss + size - 1;
1222 yyvsp = yyvs + size - 1;
1223#ifdef YYLSP_NEEDED
1224 yylsp = yyls + size - 1;
1225#endif
1226
1227#if YYDEBUG != 0
1228 if (yydebug)
1229 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1230#endif
1231
1232 if (yyssp >= yyss + yystacksize - 1)
1233 YYABORT;
1234 }
1235
1236#if YYDEBUG != 0
1237 if (yydebug)
1238 fprintf(stderr, "Entering state %d\n", yystate);
1239#endif
1240
1241 goto yybackup;
1242 yybackup:
1243
1244/* Do appropriate processing given the current state. */
1245/* Read a lookahead token if we need one and don't already have one. */
1246/* yyresume: */
1247
1248 /* First try to decide what to do without reference to lookahead token. */
1249
1250 yyn = yypact[yystate];
1251 if (yyn == YYFLAG)
1252 goto yydefault;
1253
1254 /* Not known => get a lookahead token if don't already have one. */
1255
1256 /* yychar is either YYEMPTY or YYEOF
1257 or a valid token in external form. */
1258
1259 if (yychar == YYEMPTY)
1260 {
1261#if YYDEBUG != 0
1262 if (yydebug)
1263 fprintf(stderr, "Reading a token: ");
1264#endif
1265 yychar = YYLEX;
1266 }
1267
1268 /* Convert token to internal form (in yychar1) for indexing tables with */
1269
1270 if (yychar <= 0) /* This means end of input. */
1271 {
1272 yychar1 = 0;
1273 yychar = YYEOF; /* Don't call YYLEX any more */
1274
1275#if YYDEBUG != 0
1276 if (yydebug)
1277 fprintf(stderr, "Now at end of input.\n");
1278#endif
1279 }
1280 else
1281 {
1282 yychar1 = YYTRANSLATE(yychar);
1283
1284#if YYDEBUG != 0
1285 if (yydebug)
1286 {
1287 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1288 /* Give the individual parser a way to print the precise meaning
1289 of a token, for further debugging info. */
1290#ifdef YYPRINT
1291 YYPRINT (stderr, yychar, yylval);
1292#endif
1293 fprintf (stderr, ")\n");
1294 }
1295#endif
1296 }
1297
1298 yyn += yychar1;
1299 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1300 goto yydefault;
1301
1302 yyn = yytable[yyn];
1303
1304 /* yyn is what to do for this token type in this state.
1305 Negative => reduce, -yyn is rule number.
1306 Positive => shift, yyn is new state.
1307 New state is final state => don't bother to shift,
1308 just return success.
1309 0, or most negative number => error. */
1310
1311 if (yyn < 0)
1312 {
1313 if (yyn == YYFLAG)
1314 goto yyerrlab;
1315 yyn = -yyn;
1316 goto yyreduce;
1317 }
1318 else if (yyn == 0)
1319 goto yyerrlab;
1320
1321 if (yyn == YYFINAL)
1322 YYACCEPT;
1323
1324 /* Shift the lookahead token. */
1325
1326#if YYDEBUG != 0
1327 if (yydebug)
1328 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1329#endif
1330
1331 /* Discard the token being shifted unless it is eof. */
1332 if (yychar != YYEOF)
1333 yychar = YYEMPTY;
1334
1335 *++yyvsp = yylval;
1336#ifdef YYLSP_NEEDED
1337 *++yylsp = yylloc;
1338#endif
1339
1340 /* count tokens shifted since error; after three, turn off error status. */
1341 if (yyerrstatus) yyerrstatus--;
1342
1343 yystate = yyn;
1344 goto yynewstate;
1345
1346/* Do the default action for the current state. */
1347yydefault:
1348
1349 yyn = yydefact[yystate];
1350 if (yyn == 0)
1351 goto yyerrlab;
1352
1353/* Do a reduction. yyn is the number of a rule to reduce with. */
1354yyreduce:
1355 yylen = yyr2[yyn];
1356 if (yylen > 0)
1357 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1358
1359#if YYDEBUG != 0
1360 if (yydebug)
1361 {
1362 int i;
1363
1364 fprintf (stderr, "Reducing via rule %d (line %d), ",
1365 yyn, yyrline[yyn]);
1366
1367 /* Print the symbols being reduced, and their result. */
1368 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1369 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1370 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1371 }
1372#endif
1373
1374
1375 switch (yyn) {
1376
1377case 2:
Chris Lattner8896eda2001-07-09 19:38:36 +00001378#line 471 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001379{
1380 if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
1381 ThrowException("Value too large for type!");
1382 yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
1383;
1384 break;}
1385case 4:
Chris Lattner8896eda2001-07-09 19:38:36 +00001386#line 479 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001387{
1388 if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
1389 ThrowException("Value too large for type!");
1390 yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
1391;
1392 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001393case 45:
Chris Lattnere98dda62001-07-14 06:10:16 +00001394#line 511 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001395{
1396 yyval.StrVal = yyvsp[-1].StrVal;
1397 ;
1398 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001399case 46:
Chris Lattnere98dda62001-07-14 06:10:16 +00001400#line 514 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001401{
1402 yyval.StrVal = 0;
1403 ;
1404 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001405case 47:
Chris Lattnere98dda62001-07-14 06:10:16 +00001406#line 521 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001407{ // integral constants
1408 if (!ConstPoolSInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val))
1409 ThrowException("Constant value doesn't fit in type!");
1410 yyval.ConstVal = new ConstPoolSInt(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val);
1411 ;
1412 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001413case 48:
Chris Lattnere98dda62001-07-14 06:10:16 +00001414#line 526 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001415{ // integral constants
1416 if (!ConstPoolUInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val))
1417 ThrowException("Constant value doesn't fit in type!");
1418 yyval.ConstVal = new ConstPoolUInt(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val);
1419 ;
1420 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001421case 49:
Chris Lattnere98dda62001-07-14 06:10:16 +00001422#line 531 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001423{ // Boolean constants
1424 yyval.ConstVal = new ConstPoolBool(true);
1425 ;
1426 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001427case 50:
Chris Lattnere98dda62001-07-14 06:10:16 +00001428#line 534 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001429{ // Boolean constants
1430 yyval.ConstVal = new ConstPoolBool(false);
1431 ;
1432 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001433case 51:
Chris Lattnere98dda62001-07-14 06:10:16 +00001434#line 537 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001435{ // String constants
1436 cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n";
1437 abort();
1438 //$$ = new ConstPoolString($2);
1439 free(yyvsp[0].StrVal);
1440 ;
1441 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001442case 52:
Chris Lattnere98dda62001-07-14 06:10:16 +00001443#line 543 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001444{ // Type constants
1445 yyval.ConstVal = new ConstPoolType(yyvsp[0].TypeVal);
1446 ;
1447 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001448case 53:
Chris Lattnere98dda62001-07-14 06:10:16 +00001449#line 546 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001450{ // Nonempty array constant
1451 // Verify all elements are correct type!
1452 const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal);
1453 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1454 if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1455 ThrowException("Element #" + utostr(i) + " is not of type '" +
1456 yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1457 (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1458 }
1459
1460 yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1461 delete yyvsp[-1].ConstVector;
1462 ;
1463 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001464case 54:
Chris Lattnere98dda62001-07-14 06:10:16 +00001465#line 559 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001466{ // Empty array constant
1467 vector<ConstPoolVal*> Empty;
1468 yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal), Empty);
1469 ;
1470 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001471case 55:
Chris Lattnere98dda62001-07-14 06:10:16 +00001472#line 563 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001473{
1474 // Verify all elements are correct type!
1475 const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal, (int)yyvsp[-6].UInt64Val);
1476 if (yyvsp[-6].UInt64Val != yyvsp[-1].ConstVector->size())
1477 ThrowException("Type mismatch: constant sized array initialized with " +
1478 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
1479 itostr((int)yyvsp[-6].UInt64Val) + "!");
1480
1481 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1482 if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1483 ThrowException("Element #" + utostr(i) + " is not of type '" +
1484 yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1485 (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1486 }
1487
1488 yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1489 delete yyvsp[-1].ConstVector;
1490 ;
1491 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001492case 56:
Chris Lattnere98dda62001-07-14 06:10:16 +00001493#line 581 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001494{
1495 if (yyvsp[-5].UInt64Val != 0)
1496 ThrowException("Type mismatch: constant sized array initialized with 0"
1497 " arguments, but has size of " + itostr((int)yyvsp[-5].UInt64Val) + "!");
1498 vector<ConstPoolVal*> Empty;
1499 yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal, 0), Empty);
1500 ;
1501 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001502case 57:
Chris Lattnere98dda62001-07-14 06:10:16 +00001503#line 588 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001504{
1505 StructType::ElementTypes Types(yyvsp[-4].TypeList->begin(), yyvsp[-4].TypeList->end());
1506 delete yyvsp[-4].TypeList;
1507
1508 const StructType *St = StructType::getStructType(Types);
1509 yyval.ConstVal = new ConstPoolStruct(St, *yyvsp[-1].ConstVector);
1510 delete yyvsp[-1].ConstVector;
1511 ;
1512 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001513case 58:
Chris Lattnere98dda62001-07-14 06:10:16 +00001514#line 596 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001515{
1516 const StructType *St =
1517 StructType::getStructType(StructType::ElementTypes());
1518 vector<ConstPoolVal*> Empty;
1519 yyval.ConstVal = new ConstPoolStruct(St, Empty);
1520 ;
1521 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001522case 59:
Chris Lattnere98dda62001-07-14 06:10:16 +00001523#line 610 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001524{
1525 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1526 ;
1527 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001528case 60:
Chris Lattnere98dda62001-07-14 06:10:16 +00001529#line 613 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001530{
1531 yyval.ConstVector = new vector<ConstPoolVal*>();
1532 yyval.ConstVector->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1533 ;
1534 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001535case 61:
Chris Lattnere98dda62001-07-14 06:10:16 +00001536#line 623 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001537{
1538 if (yyvsp[-1].StrVal) {
1539 yyvsp[0].ConstVal->setName(yyvsp[-1].StrVal);
1540 free(yyvsp[-1].StrVal);
1541 }
1542
1543 addConstValToConstantPool(yyvsp[0].ConstVal);
1544 ;
1545 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001546case 62:
Chris Lattnere98dda62001-07-14 06:10:16 +00001547#line 640 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001548{
1549 ;
1550 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001551case 63:
Chris Lattnere98dda62001-07-14 06:10:16 +00001552#line 651 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001553{
1554 yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
1555 CurModule.ModuleDone();
1556;
1557 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001558case 64:
Chris Lattnere98dda62001-07-14 06:10:16 +00001559#line 658 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001560{
1561 yyvsp[-1].ModuleVal->getMethodList().push_back(yyvsp[0].MethodVal);
1562 CurMeth.MethodDone();
1563 yyval.ModuleVal = yyvsp[-1].ModuleVal;
1564 ;
1565 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001566case 65:
Chris Lattnere98dda62001-07-14 06:10:16 +00001567#line 663 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001568{
1569 yyval.ModuleVal = CurModule.CurrentModule;
1570 ;
1571 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001572case 67:
Chris Lattnere98dda62001-07-14 06:10:16 +00001573#line 672 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001574{ yyval.StrVal = 0; ;
1575 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001576case 68:
Chris Lattnere98dda62001-07-14 06:10:16 +00001577#line 674 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001578{
1579 yyval.MethArgVal = new MethodArgument(yyvsp[-1].TypeVal);
1580 if (yyvsp[0].StrVal) { // Was the argument named?
1581 yyval.MethArgVal->setName(yyvsp[0].StrVal);
1582 free(yyvsp[0].StrVal); // The string was strdup'd, so free it now.
1583 }
1584;
1585 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001586case 69:
Chris Lattnere98dda62001-07-14 06:10:16 +00001587#line 682 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001588{
1589 yyval.MethodArgList = yyvsp[0].MethodArgList;
1590 yyvsp[0].MethodArgList->push_front(yyvsp[-2].MethArgVal);
1591 ;
1592 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001593case 70:
Chris Lattnere98dda62001-07-14 06:10:16 +00001594#line 686 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001595{
1596 yyval.MethodArgList = new list<MethodArgument*>();
1597 yyval.MethodArgList->push_front(yyvsp[0].MethArgVal);
1598 ;
1599 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001600case 71:
Chris Lattnere98dda62001-07-14 06:10:16 +00001601#line 691 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001602{
1603 yyval.MethodArgList = yyvsp[0].MethodArgList;
1604 ;
1605 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001606case 72:
Chris Lattnere98dda62001-07-14 06:10:16 +00001607#line 694 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001608{
1609 yyval.MethodArgList = 0;
1610 ;
1611 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001612case 73:
Chris Lattnere98dda62001-07-14 06:10:16 +00001613#line 698 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001614{
1615 MethodType::ParamTypes ParamTypeList;
1616 if (yyvsp[-1].MethodArgList)
Chris Lattner7fc9fe32001-06-27 23:41:11 +00001617 for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I)
Chris Lattner00950542001-06-06 20:29:01 +00001618 ParamTypeList.push_back((*I)->getType());
1619
1620 const MethodType *MT = MethodType::getMethodType(yyvsp[-4].TypeVal, ParamTypeList);
1621
1622 Method *M = new Method(MT, yyvsp[-3].StrVal);
1623 free(yyvsp[-3].StrVal); // Free strdup'd memory!
1624
1625 InsertValue(M, CurModule.Values);
1626
1627 CurMeth.MethodStart(M);
1628
1629 // Add all of the arguments we parsed to the method...
1630 if (yyvsp[-1].MethodArgList) { // Is null if empty...
1631 Method::ArgumentListType &ArgList = M->getArgumentList();
1632
Chris Lattner7fc9fe32001-06-27 23:41:11 +00001633 for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I) {
Chris Lattner00950542001-06-06 20:29:01 +00001634 InsertValue(*I);
1635 ArgList.push_back(*I);
1636 }
1637 delete yyvsp[-1].MethodArgList; // We're now done with the argument list
1638 }
1639;
1640 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001641case 74:
Chris Lattnere98dda62001-07-14 06:10:16 +00001642#line 725 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001643{
1644 yyval.MethodVal = CurMeth.CurrentMethod;
1645;
1646 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001647case 75:
Chris Lattnere98dda62001-07-14 06:10:16 +00001648#line 729 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001649{
1650 yyval.MethodVal = yyvsp[-1].MethodVal;
1651;
1652 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001653case 76:
Chris Lattnere98dda62001-07-14 06:10:16 +00001654#line 738 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001655{ // A reference to a direct constant
1656 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
1657 ;
1658 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001659case 77:
Chris Lattnere98dda62001-07-14 06:10:16 +00001660#line 741 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001661{
1662 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
1663 ;
1664 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001665case 78:
Chris Lattnere98dda62001-07-14 06:10:16 +00001666#line 744 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001667{
1668 yyval.ValIDVal = ValID::create((int64_t)1);
1669 ;
1670 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001671case 79:
Chris Lattnere98dda62001-07-14 06:10:16 +00001672#line 747 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001673{
1674 yyval.ValIDVal = ValID::create((int64_t)0);
1675 ;
1676 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001677case 80:
Chris Lattnere98dda62001-07-14 06:10:16 +00001678#line 750 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001679{ // Quoted strings work too... especially for methods
1680 yyval.ValIDVal = ValID::create_conststr(yyvsp[0].StrVal);
1681 ;
1682 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001683case 81:
Chris Lattnere98dda62001-07-14 06:10:16 +00001684#line 755 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001685{ // Is it an integer reference...?
1686 yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
1687 ;
1688 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001689case 82:
Chris Lattnere98dda62001-07-14 06:10:16 +00001690#line 758 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001691{ // It must be a named reference then...
1692 yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
1693 ;
1694 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001695case 83:
Chris Lattnere98dda62001-07-14 06:10:16 +00001696#line 761 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001697{
1698 yyval.ValIDVal = yyvsp[0].ValIDVal;
1699 ;
1700 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001701case 84:
Chris Lattnere98dda62001-07-14 06:10:16 +00001702#line 768 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001703{
1704 Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true);
1705 if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName());
Chris Lattner7fc9fe32001-06-27 23:41:11 +00001706
1707 // User defined type not in const pool!
1708 ConstPoolType *CPT = (ConstPoolType*)D->castConstantAsserting();
Chris Lattner00950542001-06-06 20:29:01 +00001709 yyval.TypeVal = CPT->getValue();
1710 ;
1711 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001712case 85:
Chris Lattnere98dda62001-07-14 06:10:16 +00001713#line 776 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001714{ // Method derived type?
1715 MethodType::ParamTypes Params(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1716 delete yyvsp[-1].TypeList;
Chris Lattner8896eda2001-07-09 19:38:36 +00001717 yyval.TypeVal = checkNewType(MethodType::getMethodType(yyvsp[-3].TypeVal, Params));
Chris Lattner00950542001-06-06 20:29:01 +00001718 ;
1719 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001720case 86:
Chris Lattnere98dda62001-07-14 06:10:16 +00001721#line 781 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001722{ // Method derived type?
1723 MethodType::ParamTypes Params; // Empty list
Chris Lattner8896eda2001-07-09 19:38:36 +00001724 yyval.TypeVal = checkNewType(MethodType::getMethodType(yyvsp[-2].TypeVal, Params));
Chris Lattner00950542001-06-06 20:29:01 +00001725 ;
1726 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001727case 87:
Chris Lattnere98dda62001-07-14 06:10:16 +00001728#line 785 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001729{
Chris Lattner8896eda2001-07-09 19:38:36 +00001730 yyval.TypeVal = checkNewType(ArrayType::getArrayType(yyvsp[-1].TypeVal));
Chris Lattner00950542001-06-06 20:29:01 +00001731 ;
1732 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001733case 88:
Chris Lattnere98dda62001-07-14 06:10:16 +00001734#line 788 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001735{
Chris Lattner8896eda2001-07-09 19:38:36 +00001736 yyval.TypeVal = checkNewType(ArrayType::getArrayType(yyvsp[-1].TypeVal, (int)yyvsp[-3].UInt64Val));
Chris Lattner00950542001-06-06 20:29:01 +00001737 ;
1738 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001739case 89:
Chris Lattnere98dda62001-07-14 06:10:16 +00001740#line 791 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001741{
1742 StructType::ElementTypes Elements(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1743 delete yyvsp[-1].TypeList;
Chris Lattner8896eda2001-07-09 19:38:36 +00001744 yyval.TypeVal = checkNewType(StructType::getStructType(Elements));
Chris Lattner00950542001-06-06 20:29:01 +00001745 ;
1746 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001747case 90:
Chris Lattnere98dda62001-07-14 06:10:16 +00001748#line 796 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001749{
Chris Lattner8896eda2001-07-09 19:38:36 +00001750 yyval.TypeVal = checkNewType(StructType::getStructType(StructType::ElementTypes()));
Chris Lattner00950542001-06-06 20:29:01 +00001751 ;
1752 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001753case 91:
Chris Lattnere98dda62001-07-14 06:10:16 +00001754#line 799 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001755{
Chris Lattner8896eda2001-07-09 19:38:36 +00001756 yyval.TypeVal = checkNewType(PointerType::getPointerType(yyvsp[-1].TypeVal));
Chris Lattner00950542001-06-06 20:29:01 +00001757 ;
1758 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001759case 92:
Chris Lattnere98dda62001-07-14 06:10:16 +00001760#line 804 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001761{
1762 yyval.TypeList = new list<const Type*>();
1763 yyval.TypeList->push_back(yyvsp[0].TypeVal);
1764 ;
1765 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001766case 93:
Chris Lattnere98dda62001-07-14 06:10:16 +00001767#line 808 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001768{
1769 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal);
1770 ;
1771 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001772case 94:
Chris Lattnere98dda62001-07-14 06:10:16 +00001773#line 813 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001774{
1775 yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1776 yyval.MethodVal = yyvsp[-1].MethodVal;
1777 ;
1778 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001779case 95:
Chris Lattnere98dda62001-07-14 06:10:16 +00001780#line 817 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001781{ // Do not allow methods with 0 basic blocks
1782 yyval.MethodVal = yyvsp[-1].MethodVal; // in them...
1783 yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1784 ;
1785 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001786case 96:
Chris Lattnere98dda62001-07-14 06:10:16 +00001787#line 826 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001788{
1789 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1790 InsertValue(yyvsp[-1].BasicBlockVal);
1791 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1792 ;
1793 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001794case 97:
Chris Lattnere98dda62001-07-14 06:10:16 +00001795#line 831 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001796{
1797 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1798 yyvsp[-1].BasicBlockVal->setName(yyvsp[-2].StrVal);
1799 free(yyvsp[-2].StrVal); // Free the strdup'd memory...
1800
1801 InsertValue(yyvsp[-1].BasicBlockVal);
1802 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1803 ;
1804 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001805case 98:
Chris Lattnere98dda62001-07-14 06:10:16 +00001806#line 840 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001807{
1808 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
1809 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1810 ;
1811 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001812case 99:
Chris Lattnere98dda62001-07-14 06:10:16 +00001813#line 844 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001814{
1815 yyval.BasicBlockVal = new BasicBlock();
1816 ;
1817 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001818case 100:
Chris Lattnere98dda62001-07-14 06:10:16 +00001819#line 848 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001820{ // Return with a result...
1821 yyval.TermInstVal = new ReturnInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1822 ;
1823 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001824case 101:
Chris Lattnere98dda62001-07-14 06:10:16 +00001825#line 851 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001826{ // Return with no result...
1827 yyval.TermInstVal = new ReturnInst();
1828 ;
1829 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001830case 102:
Chris Lattnere98dda62001-07-14 06:10:16 +00001831#line 854 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001832{ // Unconditional Branch...
1833 yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal));
1834 ;
1835 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001836case 103:
Chris Lattnere98dda62001-07-14 06:10:16 +00001837#line 857 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001838{
1839 yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal),
1840 (BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal),
1841 getVal(Type::BoolTy, yyvsp[-6].ValIDVal));
1842 ;
1843 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001844case 104:
Chris Lattnere98dda62001-07-14 06:10:16 +00001845#line 862 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001846{
1847 SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].TypeVal, yyvsp[-6].ValIDVal),
1848 (BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal));
1849 yyval.TermInstVal = S;
1850
1851 list<pair<ConstPoolVal*, BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
1852 end = yyvsp[-1].JumpTable->end();
Chris Lattner7fc9fe32001-06-27 23:41:11 +00001853 for (; I != end; ++I)
Chris Lattner00950542001-06-06 20:29:01 +00001854 S->dest_push_back(I->first, I->second);
1855 ;
1856 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001857case 105:
Chris Lattnere98dda62001-07-14 06:10:16 +00001858#line 873 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001859{
1860 yyval.JumpTable = yyvsp[-5].JumpTable;
1861 ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1862 if (V == 0)
1863 ThrowException("May only switch on a constant pool value!");
1864
1865 yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1866 ;
1867 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001868case 106:
Chris Lattnere98dda62001-07-14 06:10:16 +00001869#line 881 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001870{
1871 yyval.JumpTable = new list<pair<ConstPoolVal*, BasicBlock*> >();
1872 ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1873
1874 if (V == 0)
1875 ThrowException("May only switch on a constant pool value!");
1876
1877 yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1878 ;
1879 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001880case 107:
Chris Lattnere98dda62001-07-14 06:10:16 +00001881#line 891 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001882{
1883 if (yyvsp[-1].StrVal) // Is this definition named??
1884 yyvsp[0].InstVal->setName(yyvsp[-1].StrVal); // if so, assign the name...
1885
1886 InsertValue(yyvsp[0].InstVal);
1887 yyval.InstVal = yyvsp[0].InstVal;
1888;
1889 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001890case 108:
Chris Lattnere98dda62001-07-14 06:10:16 +00001891#line 899 "llvmAsmParser.y"
Chris Lattnerc24d2082001-06-11 15:04:20 +00001892{ // Used for PHI nodes
1893 yyval.PHIList = new list<pair<Value*, BasicBlock*> >();
1894 yyval.PHIList->push_back(make_pair(getVal(yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal),
1895 (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal)));
1896 ;
1897 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001898case 109:
Chris Lattnere98dda62001-07-14 06:10:16 +00001899#line 904 "llvmAsmParser.y"
Chris Lattnerc24d2082001-06-11 15:04:20 +00001900{
1901 yyval.PHIList = yyvsp[-6].PHIList;
1902 yyvsp[-6].PHIList->push_back(make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal),
1903 (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal)));
1904 ;
1905 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001906case 110:
Chris Lattnere98dda62001-07-14 06:10:16 +00001907#line 911 "llvmAsmParser.y"
Chris Lattnerc24d2082001-06-11 15:04:20 +00001908{ // Used for call statements...
Chris Lattner00950542001-06-06 20:29:01 +00001909 yyval.ValueList = new list<Value*>();
1910 yyval.ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1911 ;
1912 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001913case 111:
Chris Lattnere98dda62001-07-14 06:10:16 +00001914#line 915 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001915{
Chris Lattnerab5ac6b2001-07-08 23:22:50 +00001916 yyval.ValueList = yyvsp[-3].ValueList;
1917 yyvsp[-3].ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
Chris Lattner00950542001-06-06 20:29:01 +00001918 ;
1919 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001920case 113:
Chris Lattnere98dda62001-07-14 06:10:16 +00001921#line 921 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001922{ yyval.ValueList = 0; ;
1923 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001924case 114:
Chris Lattnere98dda62001-07-14 06:10:16 +00001925#line 923 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001926{
Chris Lattnerbebd60d2001-06-25 07:31:31 +00001927 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
Chris Lattner00950542001-06-06 20:29:01 +00001928 if (yyval.InstVal == 0)
1929 ThrowException("binary operator returned null!");
1930 ;
1931 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001932case 115:
Chris Lattnere98dda62001-07-14 06:10:16 +00001933#line 928 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001934{
Chris Lattnerbebd60d2001-06-25 07:31:31 +00001935 yyval.InstVal = UnaryOperator::create(yyvsp[-2].UnaryOpVal, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
Chris Lattner00950542001-06-06 20:29:01 +00001936 if (yyval.InstVal == 0)
1937 ThrowException("unary operator returned null!");
1938 ;
1939 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001940case 116:
Chris Lattnere98dda62001-07-14 06:10:16 +00001941#line 933 "llvmAsmParser.y"
Chris Lattner027dcc52001-07-08 21:10:27 +00001942{
1943 if (yyvsp[-1].TypeVal != Type::UByteTy) ThrowException("Shift amount must be ubyte!");
1944 yyval.InstVal = new ShiftInst(yyvsp[-5].OtherOpVal, getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal), getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1945 ;
1946 break;}
1947case 117:
Chris Lattnere98dda62001-07-14 06:10:16 +00001948#line 937 "llvmAsmParser.y"
Chris Lattner09083092001-07-08 04:57:15 +00001949{
Chris Lattner71496b32001-07-08 19:03:27 +00001950 yyval.InstVal = new CastInst(getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), yyvsp[0].TypeVal);
Chris Lattner09083092001-07-08 04:57:15 +00001951 ;
1952 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001953case 118:
Chris Lattnere98dda62001-07-14 06:10:16 +00001954#line 940 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001955{
Chris Lattnerc24d2082001-06-11 15:04:20 +00001956 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
1957 yyval.InstVal = new PHINode(Ty);
1958 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
1959 if (yyvsp[0].PHIList->front().first->getType() != Ty)
1960 ThrowException("All elements of a PHI node must be of the same type!");
1961 ((PHINode*)yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
1962 yyvsp[0].PHIList->pop_front();
Chris Lattner00950542001-06-06 20:29:01 +00001963 }
Chris Lattnerc24d2082001-06-11 15:04:20 +00001964 delete yyvsp[0].PHIList; // Free the list...
Chris Lattner00950542001-06-06 20:29:01 +00001965 ;
1966 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00001967case 119:
Chris Lattnere98dda62001-07-14 06:10:16 +00001968#line 951 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00001969{
1970 if (!yyvsp[-4].TypeVal->isMethodType())
1971 ThrowException("Can only call methods: invalid type '" +
1972 yyvsp[-4].TypeVal->getName() + "'!");
1973
1974 const MethodType *Ty = (const MethodType*)yyvsp[-4].TypeVal;
1975
1976 Value *V = getVal(Ty, yyvsp[-3].ValIDVal);
Chris Lattner7fc9fe32001-06-27 23:41:11 +00001977 if (!V->isMethod() || V->getType() != Ty)
Chris Lattner00950542001-06-06 20:29:01 +00001978 ThrowException("Cannot call: " + yyvsp[-3].ValIDVal.getName() + "!");
1979
1980 // Create or access a new type that corresponds to the function call...
1981 vector<Value *> Params;
1982
1983 if (yyvsp[-1].ValueList) {
1984 // Pull out just the arguments...
1985 Params.insert(Params.begin(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
1986 delete yyvsp[-1].ValueList;
1987
1988 // Loop through MethodType's arguments and ensure they are specified
1989 // correctly!
1990 //
1991 MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
1992 unsigned i;
1993 for (i = 0; i < Params.size() && I != Ty->getParamTypes().end(); ++i,++I){
1994 if (Params[i]->getType() != *I)
1995 ThrowException("Parameter " + utostr(i) + " is not of type '" +
1996 (*I)->getName() + "'!");
1997 }
1998
1999 if (i != Params.size() || I != Ty->getParamTypes().end())
2000 ThrowException("Invalid number of parameters detected!");
2001 }
2002
2003 // Create the call node...
2004 yyval.InstVal = new CallInst((Method*)V, Params);
2005 ;
2006 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00002007case 120:
Chris Lattnere98dda62001-07-14 06:10:16 +00002008#line 988 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00002009{
2010 yyval.InstVal = yyvsp[0].InstVal;
2011 ;
2012 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00002013case 121:
Chris Lattnere98dda62001-07-14 06:10:16 +00002014#line 993 "llvmAsmParser.y"
Chris Lattner027dcc52001-07-08 21:10:27 +00002015{
2016 yyval.ConstVector = yyvsp[0].ConstVector;
2017;
2018 break;}
2019case 122:
Chris Lattnere98dda62001-07-14 06:10:16 +00002020#line 995 "llvmAsmParser.y"
Chris Lattner027dcc52001-07-08 21:10:27 +00002021{
2022 yyval.ConstVector = new vector<ConstPoolVal*>();
2023;
2024 break;}
2025case 123:
Chris Lattnere98dda62001-07-14 06:10:16 +00002026#line 999 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00002027{
Chris Lattner8896eda2001-07-09 19:38:36 +00002028 yyval.InstVal = new MallocInst(checkNewType(PointerType::getPointerType(yyvsp[0].TypeVal)));
Chris Lattner00950542001-06-06 20:29:01 +00002029 ;
2030 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00002031case 124:
Chris Lattnere98dda62001-07-14 06:10:16 +00002032#line 1002 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00002033{
2034 if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
2035 ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
2036 " as unsized array!");
Chris Lattner8896eda2001-07-09 19:38:36 +00002037 const Type *Ty = checkNewType(PointerType::getPointerType(yyvsp[-3].TypeVal));
2038 yyval.InstVal = new MallocInst(Ty, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
Chris Lattner00950542001-06-06 20:29:01 +00002039 ;
2040 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00002041case 125:
Chris Lattnere98dda62001-07-14 06:10:16 +00002042#line 1009 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00002043{
Chris Lattner8896eda2001-07-09 19:38:36 +00002044 yyval.InstVal = new AllocaInst(checkNewType(PointerType::getPointerType(yyvsp[0].TypeVal)));
Chris Lattner00950542001-06-06 20:29:01 +00002045 ;
2046 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00002047case 126:
Chris Lattnere98dda62001-07-14 06:10:16 +00002048#line 1012 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00002049{
2050 if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
2051 ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
2052 " as unsized array!");
Chris Lattner8896eda2001-07-09 19:38:36 +00002053 const Type *Ty = checkNewType(PointerType::getPointerType(yyvsp[-3].TypeVal));
Chris Lattner00950542001-06-06 20:29:01 +00002054 Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
Chris Lattnerf0d0e9c2001-07-07 08:36:30 +00002055 yyval.InstVal = new AllocaInst(Ty, ArrSize);
Chris Lattner00950542001-06-06 20:29:01 +00002056 ;
2057 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00002058case 127:
Chris Lattnere98dda62001-07-14 06:10:16 +00002059#line 1020 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00002060{
2061 if (!yyvsp[-1].TypeVal->isPointerType())
2062 ThrowException("Trying to free nonpointer type " + yyvsp[-1].TypeVal->getName() + "!");
2063 yyval.InstVal = new FreeInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
2064 ;
2065 break;}
Chris Lattner027dcc52001-07-08 21:10:27 +00002066case 128:
Chris Lattnere98dda62001-07-14 06:10:16 +00002067#line 1026 "llvmAsmParser.y"
Chris Lattner027dcc52001-07-08 21:10:27 +00002068{
2069 if (!yyvsp[-2].TypeVal->isPointerType())
2070 ThrowException("Can't load from nonpointer type: " + yyvsp[-2].TypeVal->getName());
2071 if (LoadInst::getIndexedType(yyvsp[-2].TypeVal, *yyvsp[0].ConstVector) == 0)
2072 ThrowException("Invalid indices for load instruction!");
2073
2074 yyval.InstVal = new LoadInst(getVal(yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ConstVector);
2075 delete yyvsp[0].ConstVector; // Free the vector...
2076 ;
2077 break;}
Chris Lattnerab5ac6b2001-07-08 23:22:50 +00002078case 129:
Chris Lattnere98dda62001-07-14 06:10:16 +00002079#line 1035 "llvmAsmParser.y"
Chris Lattnerab5ac6b2001-07-08 23:22:50 +00002080{
2081 if (!yyvsp[-2].TypeVal->isPointerType())
2082 ThrowException("Can't store to a nonpointer type: " + yyvsp[-2].TypeVal->getName());
2083 const Type *ElTy = StoreInst::getIndexedType(yyvsp[-2].TypeVal, *yyvsp[0].ConstVector);
2084 if (ElTy == 0)
2085 ThrowException("Can't store into that field list!");
2086 if (ElTy != yyvsp[-5].TypeVal)
2087 ThrowException("Can't store '" + yyvsp[-5].TypeVal->getName() + "' into space of type '"+
2088 ElTy->getName() + "'!");
2089 yyval.InstVal = new StoreInst(getVal(yyvsp[-5].TypeVal, yyvsp[-4].ValIDVal), getVal(yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ConstVector);
2090 delete yyvsp[0].ConstVector;
2091 ;
2092 break;}
2093case 130:
Chris Lattnere98dda62001-07-14 06:10:16 +00002094#line 1047 "llvmAsmParser.y"
Chris Lattnerab5ac6b2001-07-08 23:22:50 +00002095{
2096 if (!yyvsp[-2].TypeVal->isPointerType())
2097 ThrowException("getelementptr insn requires pointer operand!");
2098 if (!GetElementPtrInst::getIndexedType(yyvsp[-2].TypeVal, *yyvsp[0].ConstVector, true))
2099 ThrowException("Can't get element ptr '" + yyvsp[-2].TypeVal->getName() + "'!");
2100 yyval.InstVal = new GetElementPtrInst(getVal(yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ConstVector);
2101 delete yyvsp[0].ConstVector;
Chris Lattner8896eda2001-07-09 19:38:36 +00002102 checkNewType(yyval.InstVal->getType());
Chris Lattnerab5ac6b2001-07-08 23:22:50 +00002103 ;
2104 break;}
Chris Lattner00950542001-06-06 20:29:01 +00002105}
2106 /* the action file gets copied in in place of this dollarsign */
2107#line 543 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
2108
2109 yyvsp -= yylen;
2110 yyssp -= yylen;
2111#ifdef YYLSP_NEEDED
2112 yylsp -= yylen;
2113#endif
2114
2115#if YYDEBUG != 0
2116 if (yydebug)
2117 {
2118 short *ssp1 = yyss - 1;
2119 fprintf (stderr, "state stack now");
2120 while (ssp1 != yyssp)
2121 fprintf (stderr, " %d", *++ssp1);
2122 fprintf (stderr, "\n");
2123 }
2124#endif
2125
2126 *++yyvsp = yyval;
2127
2128#ifdef YYLSP_NEEDED
2129 yylsp++;
2130 if (yylen == 0)
2131 {
2132 yylsp->first_line = yylloc.first_line;
2133 yylsp->first_column = yylloc.first_column;
2134 yylsp->last_line = (yylsp-1)->last_line;
2135 yylsp->last_column = (yylsp-1)->last_column;
2136 yylsp->text = 0;
2137 }
2138 else
2139 {
2140 yylsp->last_line = (yylsp+yylen-1)->last_line;
2141 yylsp->last_column = (yylsp+yylen-1)->last_column;
2142 }
2143#endif
2144
2145 /* Now "shift" the result of the reduction.
2146 Determine what state that goes to,
2147 based on the state we popped back to
2148 and the rule number reduced by. */
2149
2150 yyn = yyr1[yyn];
2151
2152 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2153 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2154 yystate = yytable[yystate];
2155 else
2156 yystate = yydefgoto[yyn - YYNTBASE];
2157
2158 goto yynewstate;
2159
2160yyerrlab: /* here on detecting error */
2161
2162 if (! yyerrstatus)
2163 /* If not already recovering from an error, report this error. */
2164 {
2165 ++yynerrs;
2166
2167#ifdef YYERROR_VERBOSE
2168 yyn = yypact[yystate];
2169
2170 if (yyn > YYFLAG && yyn < YYLAST)
2171 {
2172 int size = 0;
2173 char *msg;
2174 int x, count;
2175
2176 count = 0;
2177 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2178 for (x = (yyn < 0 ? -yyn : 0);
2179 x < (sizeof(yytname) / sizeof(char *)); x++)
2180 if (yycheck[x + yyn] == x)
2181 size += strlen(yytname[x]) + 15, count++;
2182 msg = (char *) malloc(size + 15);
2183 if (msg != 0)
2184 {
2185 strcpy(msg, "parse error");
2186
2187 if (count < 5)
2188 {
2189 count = 0;
2190 for (x = (yyn < 0 ? -yyn : 0);
2191 x < (sizeof(yytname) / sizeof(char *)); x++)
2192 if (yycheck[x + yyn] == x)
2193 {
2194 strcat(msg, count == 0 ? ", expecting `" : " or `");
2195 strcat(msg, yytname[x]);
2196 strcat(msg, "'");
2197 count++;
2198 }
2199 }
2200 yyerror(msg);
2201 free(msg);
2202 }
2203 else
2204 yyerror ("parse error; also virtual memory exceeded");
2205 }
2206 else
2207#endif /* YYERROR_VERBOSE */
2208 yyerror("parse error");
2209 }
2210
2211 goto yyerrlab1;
2212yyerrlab1: /* here on error raised explicitly by an action */
2213
2214 if (yyerrstatus == 3)
2215 {
2216 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2217
2218 /* return failure if at end of input */
2219 if (yychar == YYEOF)
2220 YYABORT;
2221
2222#if YYDEBUG != 0
2223 if (yydebug)
2224 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2225#endif
2226
2227 yychar = YYEMPTY;
2228 }
2229
2230 /* Else will try to reuse lookahead token
2231 after shifting the error token. */
2232
2233 yyerrstatus = 3; /* Each real token shifted decrements this */
2234
2235 goto yyerrhandle;
2236
2237yyerrdefault: /* current state does not do anything special for the error token. */
2238
2239#if 0
2240 /* This is wrong; only states that explicitly want error tokens
2241 should shift them. */
2242 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2243 if (yyn) goto yydefault;
2244#endif
2245
2246yyerrpop: /* pop the current state because it cannot handle the error token */
2247
2248 if (yyssp == yyss) YYABORT;
2249 yyvsp--;
2250 yystate = *--yyssp;
2251#ifdef YYLSP_NEEDED
2252 yylsp--;
2253#endif
2254
2255#if YYDEBUG != 0
2256 if (yydebug)
2257 {
2258 short *ssp1 = yyss - 1;
2259 fprintf (stderr, "Error: state stack now");
2260 while (ssp1 != yyssp)
2261 fprintf (stderr, " %d", *++ssp1);
2262 fprintf (stderr, "\n");
2263 }
2264#endif
2265
2266yyerrhandle:
2267
2268 yyn = yypact[yystate];
2269 if (yyn == YYFLAG)
2270 goto yyerrdefault;
2271
2272 yyn += YYTERROR;
2273 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2274 goto yyerrdefault;
2275
2276 yyn = yytable[yyn];
2277 if (yyn < 0)
2278 {
2279 if (yyn == YYFLAG)
2280 goto yyerrpop;
2281 yyn = -yyn;
2282 goto yyreduce;
2283 }
2284 else if (yyn == 0)
2285 goto yyerrpop;
2286
2287 if (yyn == YYFINAL)
2288 YYACCEPT;
2289
2290#if YYDEBUG != 0
2291 if (yydebug)
2292 fprintf(stderr, "Shifting error token, ");
2293#endif
2294
2295 *++yyvsp = yylval;
2296#ifdef YYLSP_NEEDED
2297 *++yylsp = yylloc;
2298#endif
2299
2300 yystate = yyn;
2301 goto yynewstate;
2302
2303 yyacceptlab:
2304 /* YYACCEPT comes here. */
2305 if (yyfree_stacks)
2306 {
2307 free (yyss);
2308 free (yyvs);
2309#ifdef YYLSP_NEEDED
2310 free (yyls);
2311#endif
2312 }
2313 return 0;
2314
2315 yyabortlab:
2316 /* YYABORT comes here. */
2317 if (yyfree_stacks)
2318 {
2319 free (yyss);
2320 free (yyvs);
2321#ifdef YYLSP_NEEDED
2322 free (yyls);
2323#endif
2324 }
2325 return 1;
2326}
Chris Lattnere98dda62001-07-14 06:10:16 +00002327#line 1057 "llvmAsmParser.y"
Chris Lattner00950542001-06-06 20:29:01 +00002328
Chris Lattner09083092001-07-08 04:57:15 +00002329int yyerror(const char *ErrorMsg) {
Chris Lattner00950542001-06-06 20:29:01 +00002330 ThrowException(string("Parse error: ") + ErrorMsg);
2331 return 0;
2332}