Implemented shl, shl, & load instructions
[oota-llvm.git] / lib / AsmParser / llvmAsmParser.cpp
1
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
42 #define TO      285
43 #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
63 #define GETFIELD        306
64 #define PUTFIELD        307
65 #define PHI     308
66 #define CALL    309
67 #define CAST    310
68 #define SHL     311
69 #define SHR     312
70
71 #line 13 "llvmAsmParser.y"
72
73 #include "ParserInternals.h"
74 #include "llvm/BasicBlock.h"
75 #include "llvm/Method.h"
76 #include "llvm/SymbolTable.h"
77 #include "llvm/Module.h"
78 #include "llvm/Type.h"
79 #include "llvm/DerivedTypes.h"
80 #include "llvm/Assembly/Parser.h"
81 #include "llvm/ConstantPool.h"
82 #include "llvm/iTerminators.h"
83 #include "llvm/iMemory.h"
84 #include <list>
85 #include <utility>            // Get definition of pair class
86 #include <stdio.h>            // This embarasment is due to our flex lexer...
87
88 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit 
89 int yylex();                       // declaration" of xxx warnings.
90 int yyparse();
91
92 static Module *ParserResult;
93 const 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 //
98 typedef vector<Value *> ValueList;           // Numbered defs
99 static void ResolveDefinitions(vector<ValueList> &LateResolvers);
100
101 static 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
116 static 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
147 static 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
157 static 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 //
296 static 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 //
327 static 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
375 //===----------------------------------------------------------------------===//
376 //            RunVMAsmParser - Define an interface to this parser
377 //===----------------------------------------------------------------------===//
378 //
379 Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) {
380   llvmAsmin = F;
381   CurOptions = &Opts;
382   llvmAsmlineno = 1;      // Reset the current line number...
383
384   CurModule.CurrentModule = new Module();  // Allocate a new module to read
385   yyparse();       // Parse the file.
386   Module *Result = ParserResult;
387   CurOptions = 0;
388   llvmAsmin = stdin;    // F is about to go away, don't use it anymore...
389   ParserResult = 0;
390
391   return Result;
392 }
393
394
395 #line 337 "llvmAsmParser.y"
396 typedef union {
397   Module                  *ModuleVal;
398   Method                  *MethodVal;
399   MethodArgument          *MethArgVal;
400   BasicBlock              *BasicBlockVal;
401   TerminatorInst          *TermInstVal;
402   Instruction             *InstVal;
403   ConstPoolVal            *ConstVal;
404   const Type              *TypeVal;
405
406   list<MethodArgument*>   *MethodArgList;
407   list<Value*>            *ValueList;
408   list<const Type*>       *TypeList;
409   list<pair<Value*, BasicBlock*> > *PHIList;   // Represent the RHS of PHI node
410   list<pair<ConstPoolVal*, BasicBlock*> > *JumpTable;
411   vector<ConstPoolVal*>   *ConstVector;
412
413   int64_t                  SInt64Val;
414   uint64_t                 UInt64Val;
415   int                      SIntVal;
416   unsigned                 UIntVal;
417
418   char                    *StrVal;   // This memory is allocated by strdup!
419   ValID                    ValIDVal; // May contain memory allocated by strdup
420
421   Instruction::UnaryOps    UnaryOpVal;
422   Instruction::BinaryOps   BinaryOpVal;
423   Instruction::TermOps     TermOpVal;
424   Instruction::MemoryOps   MemOpVal;
425   Instruction::OtherOps    OtherOpVal;
426 } YYSTYPE;
427 #include <stdio.h>
428
429 #ifndef __cplusplus
430 #ifndef __STDC__
431 #define const
432 #endif
433 #endif
434
435
436
437 #define YYFINAL         248
438 #define YYFLAG          -32768
439 #define YYNTBASE        69
440
441 #define YYTRANSLATE(x) ((unsigned)(x) <= 312 ? yytranslate[x] : 107)
442
443 static const char yytranslate[] = {     0,
444      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
445      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
446      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
447      2,     2,     2,     2,     2,     2,     2,     2,     2,    66,
448     67,    68,     2,    65,     2,     2,     2,     2,     2,     2,
449      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
450     59,     2,     2,     2,     2,     2,     2,     2,     2,     2,
451      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
452      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
453     60,     2,    61,     2,     2,     2,     2,     2,     2,     2,
454      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
455      2,     2,     2,     2,     2,     2,     2,     2,     2,    62,
456      2,     2,    63,     2,    64,     2,     2,     2,     2,     2,
457      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
458      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
459      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
460      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
461      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
462      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
463      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
464      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
465      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
466      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
467      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
468      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
469      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
470      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
471     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
472     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
473     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
474     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
475     57,    58
476 };
477
478 #if YYDEBUG != 0
479 static const short yyprhs[] = {     0,
480      0,     2,     4,     6,     8,    10,    12,    14,    16,    18,
481     20,    22,    24,    26,    28,    30,    32,    34,    36,    38,
482     40,    42,    44,    46,    48,    50,    52,    54,    56,    58,
483     60,    62,    64,    66,    68,    70,    72,    74,    76,    78,
484     80,    82,    84,    86,    88,    91,    92,    95,    98,   101,
485    104,   107,   110,   117,   123,   132,   140,   147,   152,   156,
486    158,   162,   163,   165,   168,   171,   173,   174,   177,   181,
487    183,   185,   186,   192,   196,   199,   201,   203,   205,   207,
488    209,   211,   213,   215,   217,   222,   226,   230,   236,   240,
489    243,   246,   248,   252,   255,   258,   261,   265,   268,   269,
490    273,   276,   280,   290,   300,   307,   313,   316,   323,   331,
491    334,   338,   340,   341,   347,   351,   358,   364,   367,   374,
492    376,   379,   380,   383,   389,   392,   398,   402
493 };
494
495 static const short yyrhs[] = {     5,
496      0,     6,     0,     3,     0,     4,     0,     8,     0,     9,
497      0,    10,     0,    11,     0,    12,     0,    13,     0,    14,
498      0,    15,     0,    16,     0,    17,     0,    18,     0,    19,
499      0,    20,     0,    21,     0,    71,     0,     7,     0,    35,
500      0,    36,     0,    37,     0,    38,     0,    39,     0,    40,
501      0,    41,     0,    42,     0,    43,     0,    44,     0,    45,
502      0,    46,     0,    57,     0,    58,     0,    15,     0,    13,
503      0,    11,     0,     9,     0,    16,     0,    14,     0,    12,
504      0,    10,     0,    76,     0,    77,     0,    22,    59,     0,
505      0,    76,    70,     0,    77,     4,     0,     8,    26,     0,
506      8,    27,     0,    19,    24,     0,    20,    71,     0,    60,
507     71,    61,    60,    81,    61,     0,    60,    71,    61,    60,
508     61,     0,    60,     4,    62,    71,    61,    60,    81,    61,
509      0,    60,     4,    62,    71,    61,    60,    61,     0,    63,
510     94,    64,    63,    81,    64,     0,    63,    64,    63,    64,
511      0,    81,    65,    80,     0,    80,     0,    82,    79,    80,
512      0,     0,    84,     0,    84,    91,     0,    82,    25,     0,
513     22,     0,     0,    71,    85,     0,    86,    65,    87,     0,
514     86,     0,    87,     0,     0,    72,    24,    66,    88,    67,
515      0,    89,    82,    28,     0,    95,    29,     0,     3,     0,
516      4,     0,    26,     0,    27,     0,    24,     0,    69,     0,
517     22,     0,    92,     0,    93,     0,    72,    66,    94,    67,
518      0,    72,    66,    67,     0,    60,    71,    61,     0,    60,
519      4,    62,    71,    61,     0,    63,    94,    64,     0,    63,
520     64,     0,    71,    68,     0,    71,     0,    94,    65,    71,
521      0,    95,    96,     0,    90,    96,     0,    97,    98,     0,
522     23,    97,    98,     0,    97,   100,     0,     0,    32,    71,
523     93,     0,    32,     7,     0,    33,    21,    93,     0,    33,
524      8,    93,    65,    21,    93,    65,    21,    93,     0,    34,
525     78,    93,    65,    21,    93,    60,    99,    61,     0,    99,
526     78,    92,    65,    21,    93,     0,    78,    92,    65,    21,
527     93,     0,    79,   104,     0,    71,    60,    93,    65,    93,
528     61,     0,   101,    65,    60,    93,    65,    93,    61,     0,
529     71,    93,     0,   102,    65,    93,     0,   102,     0,     0,
530     74,    71,    93,    65,    93,     0,    73,    71,    93,     0,
531     75,    71,    93,    65,    71,    93,     0,    56,    71,    93,
532     31,    71,     0,    54,   101,     0,    55,    71,    93,    66,
533    103,    67,     0,   106,     0,    65,    81,     0,     0,    47,
534     71,     0,    47,    71,    65,    14,    93,     0,    48,    71,
535      0,    48,    71,    65,    14,    93,     0,    49,    71,    93,
536      0,    50,    71,    93,   105,     0
537 };
538
539 #endif
540
541 #if YYDEBUG != 0
542 static const short yyrline[] = { 0,
543    434,   435,   442,   443,   454,   454,   454,   454,   454,   454,
544    454,   455,   455,   455,   455,   455,   455,   455,   458,   458,
545    463,   464,   464,   464,   464,   464,   465,   465,   465,   465,
546    465,   465,   466,   466,   470,   470,   470,   470,   471,   471,
547    471,   471,   472,   472,   474,   477,   481,   486,   491,   494,
548    497,   503,   506,   519,   523,   541,   548,   556,   570,   573,
549    579,   587,   598,   603,   608,   617,   617,   619,   627,   631,
550    636,   639,   643,   670,   674,   683,   686,   689,   692,   695,
551    700,   703,   706,   713,   721,   726,   730,   733,   736,   741,
552    744,   749,   753,   758,   762,   771,   776,   785,   789,   793,
553    796,   799,   802,   807,   818,   826,   836,   844,   849,   856,
554    860,   866,   866,   868,   873,   878,   882,   885,   896,   933,
555    938,   940,   944,   949,   958,   963,   972,   978
556 };
557 #endif
558
559
560 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
561
562 static const char * const yytname[] = {   "$","error","$undefined.","ESINT64VAL",
563 "EUINT64VAL","SINTVAL","UINTVAL","VOID","BOOL","SBYTE","UBYTE","SHORT","USHORT",
564 "INT","UINT","LONG","ULONG","FLOAT","DOUBLE","STRING","TYPE","LABEL","VAR_ID",
565 "LABELSTR","STRINGCONSTANT","IMPLEMENTATION","TRUE","FALSE","BEGINTOK","END",
566 "DECLARE","TO","RET","BR","SWITCH","NOT","ADD","SUB","MUL","DIV","REM","SETLE",
567 "SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE",
568 "GETFIELD","PUTFIELD","PHI","CALL","CAST","SHL","SHR","'='","'['","']'","'x'",
569 "'{'","'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps",
570 "BinaryOps","ShiftOps","SIntType","UIntType","IntType","OptAssign","ConstVal",
571 "ConstVector","ConstPool","Module","MethodList","OptVAR_ID","ArgVal","ArgListH",
572 "ArgList","MethodHeaderH","MethodHeader","Method","ConstValueRef","ValueRef",
573 "TypeList","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst",
574 "JumpTable","Inst","PHIList","ValueRefList","ValueRefListE","InstVal","UByteList",
575 "MemoryInst", NULL
576 };
577 #endif
578
579 static const short yyr1[] = {     0,
580     69,    69,    70,    70,    71,    71,    71,    71,    71,    71,
581     71,    71,    71,    71,    71,    71,    71,    71,    72,    72,
582     73,    74,    74,    74,    74,    74,    74,    74,    74,    74,
583     74,    74,    75,    75,    76,    76,    76,    76,    77,    77,
584     77,    77,    78,    78,    79,    79,    80,    80,    80,    80,
585     80,    80,    80,    80,    80,    80,    80,    80,    81,    81,
586     82,    82,    83,    84,    84,    85,    85,    86,    87,    87,
587     88,    88,    89,    90,    91,    92,    92,    92,    92,    92,
588     93,    93,    93,    71,    71,    71,    71,    71,    71,    71,
589     71,    94,    94,    95,    95,    96,    96,    97,    97,    98,
590     98,    98,    98,    98,    99,    99,   100,   101,   101,   102,
591    102,   103,   103,   104,   104,   104,   104,   104,   104,   104,
592    105,   105,   106,   106,   106,   106,   106,   106
593 };
594
595 static const short yyr2[] = {     0,
596      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
597      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
598      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
599      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
600      1,     1,     1,     1,     2,     0,     2,     2,     2,     2,
601      2,     2,     6,     5,     8,     7,     6,     4,     3,     1,
602      3,     0,     1,     2,     2,     1,     0,     2,     3,     1,
603      1,     0,     5,     3,     2,     1,     1,     1,     1,     1,
604      1,     1,     1,     1,     4,     3,     3,     5,     3,     2,
605      2,     1,     3,     2,     2,     2,     3,     2,     0,     3,
606      2,     3,     9,     9,     6,     5,     2,     6,     7,     2,
607      3,     1,     0,     5,     3,     6,     5,     2,     6,     1,
608      2,     0,     2,     5,     2,     5,     3,     4
609 };
610
611 static const short yydefact[] = {    62,
612     46,    63,     0,    65,     0,    76,    77,     1,     2,    20,
613      5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
614     15,    16,    17,    18,    82,    80,    78,    79,     0,     0,
615     81,    19,     0,    62,    99,    64,    83,    84,    99,    45,
616      0,    38,    42,    37,    41,    36,    40,    35,    39,     0,
617      0,     0,     0,     0,     0,    61,    77,    19,     0,    90,
618     92,     0,    91,     0,     0,    46,    99,    95,    46,    75,
619     94,    49,    50,    51,    52,    77,    19,     0,     0,     3,
620      4,    47,    48,     0,    87,    89,     0,    72,    86,     0,
621     74,    46,     0,     0,     0,     0,    96,    98,     0,     0,
622      0,     0,    19,    93,    67,    70,    71,     0,    85,    97,
623    101,    19,     0,     0,    43,    44,     0,    21,    22,    23,
624     24,    25,    26,    27,    28,    29,    30,    31,    32,     0,
625      0,     0,     0,     0,     0,     0,    33,    34,     0,     0,
626      0,   107,   120,    19,     0,    58,     0,    88,    66,    68,
627      0,    73,   100,     0,   102,     0,   123,   125,    19,    19,
628     19,   118,    19,    19,    19,    19,    19,     0,    54,    60,
629      0,     0,    69,     0,     0,     0,     0,   127,   122,     0,
630      0,     0,     0,   115,     0,     0,     0,    53,     0,    57,
631      0,     0,     0,     0,     0,   128,     0,     0,   113,     0,
632      0,     0,    56,     0,    59,     0,     0,   124,   126,   121,
633      0,     0,    19,   112,     0,   117,   114,    19,    55,     0,
634      0,     0,     0,   110,     0,   119,   116,     0,     0,     0,
635    108,     0,   111,   103,     0,   104,     0,   109,     0,     0,
636      0,     0,   106,     0,   105,     0,     0,     0
637 };
638
639 static const short yydefgoto[] = {    31,
640     82,    61,    59,   139,   140,   141,    54,    55,   117,     5,
641    170,   171,     1,   246,     2,   150,   106,   107,   108,    34,
642     35,    36,    37,    38,    62,    39,    68,    69,    97,   230,
643     98,   162,   214,   215,   142,   196,   143
644 };
645
646 static const short yypact[] = {-32768,
647     19,   342,   -51,-32768,    99,-32768,-32768,-32768,-32768,-32768,
648 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
649 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   403,   255,
650 -32768,    -3,   -18,-32768,   142,-32768,-32768,-32768,    55,-32768,
651     68,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   117,
652    342,   428,   317,   118,   163,-32768,   131,    59,   112,-32768,
653     11,    61,-32768,   129,   230,    95,-32768,-32768,   124,-32768,
654 -32768,-32768,-32768,-32768,    11,   134,    82,   139,    96,-32768,
655 -32768,-32768,-32768,   342,-32768,-32768,   342,   342,-32768,    75,
656 -32768,   124,   489,    16,   160,   482,-32768,-32768,   342,   143,
657    140,   144,   116,    11,    21,   145,-32768,   138,-32768,-32768,
658    146,    -1,    66,    66,-32768,-32768,    66,-32768,-32768,-32768,
659 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   342,
660    342,   342,   342,   342,   342,   342,-32768,-32768,   342,   342,
661    342,-32768,-32768,   122,    20,-32768,    99,-32768,-32768,-32768,
662    342,-32768,-32768,   149,-32768,   150,    98,   126,    -1,    -1,
663      6,   152,    -1,    -1,    -1,    -1,    -1,   148,-32768,-32768,
664    -54,   123,-32768,   188,   197,   205,   206,-32768,   156,    66,
665    162,   157,   193,-32768,   161,   165,    43,-32768,    99,-32768,
666     66,    66,    66,    66,    99,-32768,   166,    66,   342,   342,
667     66,   342,-32768,   -19,-32768,   190,   167,-32768,-32768,   213,
668     66,   215,    -1,   218,   158,    11,-32768,    -1,-32768,   207,
669    160,   192,    66,-32768,    66,-32768,-32768,    66,    72,     3,
670 -32768,   223,-32768,-32768,   220,-32768,    72,-32768,   265,   222,
671     66,   267,-32768,    66,-32768,   289,   291,-32768
672 };
673
674 static const short yypgoto[] = {-32768,
675 -32768,    -2,   290,-32768,-32768,-32768,   -86,   -85,  -183,   -47,
676     -4,  -127,   260,-32768,-32768,-32768,-32768,   147,-32768,-32768,
677 -32768,-32768,  -113,   -12,     8,-32768,   256,   229,   208,-32768,
678 -32768,-32768,-32768,-32768,-32768,-32768,-32768
679 };
680
681
682 #define YYLAST          552
683
684
685 static const short yytable[] = {    32,
686     56,     6,     7,     8,     9,    64,   188,    40,   115,   116,
687    189,    42,    43,    44,    45,    46,    47,    48,    49,   172,
688     25,    96,    26,   113,    27,    28,    58,    41,    42,    43,
689     44,    45,    46,    47,    48,    49,   114,   229,    50,    51,
690      3,   219,   149,     4,    96,   189,   237,    65,    75,    77,
691     41,    42,    43,    44,    45,    46,    47,    48,    49,   204,
692     79,    50,    51,   236,    63,   180,    63,   210,     6,     7,
693      8,     9,    90,    63,     6,     7,   -19,    67,    63,    52,
694    169,   103,    53,    70,   104,   105,   -19,    25,    63,    26,
695    112,    27,    28,    72,    73,    26,   144,    27,    28,   153,
696    154,   155,    52,   203,   156,    53,    41,    42,    43,    44,
697     45,    46,    47,    48,    49,   235,     3,    50,    51,    85,
698     80,    81,    91,   240,    86,    87,    63,   157,   158,   159,
699    160,   161,   163,   164,   115,   116,   165,   166,   167,    87,
700     74,   109,   100,   115,   116,     3,   178,   179,   105,    63,
701    182,   183,   184,   185,   186,    93,    94,    95,    52,   102,
702     87,    53,   176,   -19,    67,    63,    83,   197,    42,    43,
703     44,    45,    46,    47,    48,    49,   148,    65,   206,   207,
704    208,   209,   168,    63,   205,   212,   190,   189,   217,    63,
705    177,   -19,    84,    63,    88,    99,   213,   216,   222,   218,
706    224,   101,   145,   146,   152,   227,   147,   187,   191,   151,
707    232,   -20,   233,   174,   175,   234,   181,   192,   193,   194,
708    195,   198,   199,   200,   226,   201,   221,   228,   243,   202,
709    211,   245,     6,     7,     8,     9,    10,    11,    12,    13,
710     14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
711     24,    25,   231,    26,   220,    27,    28,     6,     7,     8,
712      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
713     19,    20,    21,    22,    23,    24,    25,   189,    26,   223,
714     27,    28,   225,   238,   239,   241,   242,   244,   247,    29,
715    248,    33,    30,    66,    71,    92,    89,   173,     0,   110,
716      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
717      0,     0,     0,     0,    29,     0,     0,    30,    60,     6,
718      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
719     17,    18,    19,    20,    21,    22,    23,    24,    25,     0,
720     26,     0,    27,    28,     6,     7,     8,     9,    10,    11,
721     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
722     22,    23,    24,    25,     0,    26,     0,    27,    28,     0,
723      0,     0,     0,     0,     0,     0,    29,     0,     0,    30,
724     78,     0,     0,     0,     0,     0,     0,     0,     0,     0,
725      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
726      0,    29,     0,     0,    30,     6,    57,     8,     9,    10,
727     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
728     21,    22,    23,    24,    25,     0,    26,     0,    27,    28,
729      6,    76,     8,     9,    10,    11,    12,    13,    14,    15,
730     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
731      0,    26,     0,    27,    28,     0,     0,     0,     0,     0,
732      0,     0,    29,     0,     0,    30,     0,     0,     0,     0,
733      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
734      0,     0,     0,     0,     0,     0,     0,    29,     0,     0,
735     30,     6,     7,     8,     9,   111,    11,    12,    13,    14,
736     15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
737     25,     0,    26,     0,    27,    28,   118,   119,   120,   121,
738    122,   123,   124,   125,   126,   127,   128,   129,   130,   131,
739    132,   133,     0,     0,     0,   134,   135,   136,   137,   138,
740      0,     0,     0,     0,     0,     0,     0,     0,    29,     0,
741      0,    30
742 };
743
744 static const short yycheck[] = {     2,
745      5,     3,     4,     5,     6,    24,    61,    59,    95,    95,
746     65,     9,    10,    11,    12,    13,    14,    15,    16,   147,
747     22,    69,    24,     8,    26,    27,    29,     8,     9,    10,
748     11,    12,    13,    14,    15,    16,    21,   221,    19,    20,
749     22,    61,    22,    25,    92,    65,   230,    66,    51,    52,
750      8,     9,    10,    11,    12,    13,    14,    15,    16,   187,
751     53,    19,    20,    61,    68,    60,    68,   195,     3,     4,
752      5,     6,    65,    68,     3,     4,    66,    23,    68,    60,
753     61,    84,    63,    29,    87,    88,    66,    22,    68,    24,
754     93,    26,    27,    26,    27,    24,    99,    26,    27,   112,
755    113,   114,    60,    61,   117,    63,     8,     9,    10,    11,
756     12,    13,    14,    15,    16,   229,    22,    19,    20,    61,
757      3,     4,    28,   237,    64,    65,    68,   130,   131,   132,
758    133,   134,   135,   136,   221,   221,   139,   140,   141,    65,
759     24,    67,    61,   230,   230,    22,   159,   160,   151,    68,
760    163,   164,   165,   166,   167,    32,    33,    34,    60,    64,
761     65,    63,    65,    66,    23,    68,     4,   180,     9,    10,
762     11,    12,    13,    14,    15,    16,    61,    66,   191,   192,
763    193,   194,    61,    68,   189,   198,    64,    65,   201,    68,
764     65,    66,    62,    68,    66,    62,   199,   200,   211,   202,
765    213,    63,    60,    64,    67,   218,    63,    60,    21,    65,
766    223,    66,   225,    65,    65,   228,    65,    21,    14,    14,
767     65,    60,    66,    31,    67,    65,    60,    21,   241,    65,
768     65,   244,     3,     4,     5,     6,     7,     8,     9,    10,
769     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
770     21,    22,    61,    24,    65,    26,    27,     3,     4,     5,
771      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
772     16,    17,    18,    19,    20,    21,    22,    65,    24,    65,
773     26,    27,    65,    61,    65,    21,    65,    21,     0,    60,
774      0,     2,    63,    34,    39,    67,    67,   151,    -1,    92,
775     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
776     -1,    -1,    -1,    -1,    60,    -1,    -1,    63,    64,     3,
777      4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
778     14,    15,    16,    17,    18,    19,    20,    21,    22,    -1,
779     24,    -1,    26,    27,     3,     4,     5,     6,     7,     8,
780      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
781     19,    20,    21,    22,    -1,    24,    -1,    26,    27,    -1,
782     -1,    -1,    -1,    -1,    -1,    -1,    60,    -1,    -1,    63,
783     64,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
784     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
785     -1,    60,    -1,    -1,    63,     3,     4,     5,     6,     7,
786      8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
787     18,    19,    20,    21,    22,    -1,    24,    -1,    26,    27,
788      3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
789     13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
790     -1,    24,    -1,    26,    27,    -1,    -1,    -1,    -1,    -1,
791     -1,    -1,    60,    -1,    -1,    63,    -1,    -1,    -1,    -1,
792     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
793     -1,    -1,    -1,    -1,    -1,    -1,    -1,    60,    -1,    -1,
794     63,     3,     4,     5,     6,     7,     8,     9,    10,    11,
795     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
796     22,    -1,    24,    -1,    26,    27,    35,    36,    37,    38,
797     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
798     49,    50,    -1,    -1,    -1,    54,    55,    56,    57,    58,
799     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    60,    -1,
800     -1,    63
801 };
802 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
803 #line 3 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
804 /* This file comes from bison-1.28.  */
805
806 /* Skeleton output parser for bison,
807    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
808
809    This program is free software; you can redistribute it and/or modify
810    it under the terms of the GNU General Public License as published by
811    the Free Software Foundation; either version 2, or (at your option)
812    any later version.
813
814    This program is distributed in the hope that it will be useful,
815    but WITHOUT ANY WARRANTY; without even the implied warranty of
816    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
817    GNU General Public License for more details.
818
819    You should have received a copy of the GNU General Public License
820    along with this program; if not, write to the Free Software
821    Foundation, Inc., 59 Temple Place - Suite 330,
822    Boston, MA 02111-1307, USA.  */
823
824 /* As a special exception, when this file is copied by Bison into a
825    Bison output file, you may use that output file without restriction.
826    This special exception was added by the Free Software Foundation
827    in version 1.24 of Bison.  */
828
829 /* This is the parser code that is written into each bison parser
830   when the %semantic_parser declaration is not specified in the grammar.
831   It was written by Richard Stallman by simplifying the hairy parser
832   used when %semantic_parser is specified.  */
833
834 #ifndef YYSTACK_USE_ALLOCA
835 #ifdef alloca
836 #define YYSTACK_USE_ALLOCA
837 #else /* alloca not defined */
838 #ifdef __GNUC__
839 #define YYSTACK_USE_ALLOCA
840 #define alloca __builtin_alloca
841 #else /* not GNU C.  */
842 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
843 #define YYSTACK_USE_ALLOCA
844 #include <alloca.h>
845 #else /* not sparc */
846 /* We think this test detects Watcom and Microsoft C.  */
847 /* This used to test MSDOS, but that is a bad idea
848    since that symbol is in the user namespace.  */
849 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
850 #if 0 /* No need for malloc.h, which pollutes the namespace;
851          instead, just don't use alloca.  */
852 #include <malloc.h>
853 #endif
854 #else /* not MSDOS, or __TURBOC__ */
855 #if defined(_AIX)
856 /* I don't know what this was needed for, but it pollutes the namespace.
857    So I turned it off.   rms, 2 May 1997.  */
858 /* #include <malloc.h>  */
859  #pragma alloca
860 #define YYSTACK_USE_ALLOCA
861 #else /* not MSDOS, or __TURBOC__, or _AIX */
862 #if 0
863 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
864                  and on HPUX 10.  Eventually we can turn this on.  */
865 #define YYSTACK_USE_ALLOCA
866 #define alloca __builtin_alloca
867 #endif /* __hpux */
868 #endif
869 #endif /* not _AIX */
870 #endif /* not MSDOS, or __TURBOC__ */
871 #endif /* not sparc */
872 #endif /* not GNU C */
873 #endif /* alloca not defined */
874 #endif /* YYSTACK_USE_ALLOCA not defined */
875
876 #ifdef YYSTACK_USE_ALLOCA
877 #define YYSTACK_ALLOC alloca
878 #else
879 #define YYSTACK_ALLOC malloc
880 #endif
881
882 /* Note: there must be only one dollar sign in this file.
883    It is replaced by the list of actions, each action
884    as one case of the switch.  */
885
886 #define yyerrok         (yyerrstatus = 0)
887 #define yyclearin       (yychar = YYEMPTY)
888 #define YYEMPTY         -2
889 #define YYEOF           0
890 #define YYACCEPT        goto yyacceptlab
891 #define YYABORT         goto yyabortlab
892 #define YYERROR         goto yyerrlab1
893 /* Like YYERROR except do call yyerror.
894    This remains here temporarily to ease the
895    transition to the new meaning of YYERROR, for GCC.
896    Once GCC version 2 has supplanted version 1, this can go.  */
897 #define YYFAIL          goto yyerrlab
898 #define YYRECOVERING()  (!!yyerrstatus)
899 #define YYBACKUP(token, value) \
900 do                                                              \
901   if (yychar == YYEMPTY && yylen == 1)                          \
902     { yychar = (token), yylval = (value);                       \
903       yychar1 = YYTRANSLATE (yychar);                           \
904       YYPOPSTACK;                                               \
905       goto yybackup;                                            \
906     }                                                           \
907   else                                                          \
908     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
909 while (0)
910
911 #define YYTERROR        1
912 #define YYERRCODE       256
913
914 #ifndef YYPURE
915 #define YYLEX           yylex()
916 #endif
917
918 #ifdef YYPURE
919 #ifdef YYLSP_NEEDED
920 #ifdef YYLEX_PARAM
921 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
922 #else
923 #define YYLEX           yylex(&yylval, &yylloc)
924 #endif
925 #else /* not YYLSP_NEEDED */
926 #ifdef YYLEX_PARAM
927 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
928 #else
929 #define YYLEX           yylex(&yylval)
930 #endif
931 #endif /* not YYLSP_NEEDED */
932 #endif
933
934 /* If nonreentrant, generate the variables here */
935
936 #ifndef YYPURE
937
938 int     yychar;                 /*  the lookahead symbol                */
939 YYSTYPE yylval;                 /*  the semantic value of the           */
940                                 /*  lookahead symbol                    */
941
942 #ifdef YYLSP_NEEDED
943 YYLTYPE yylloc;                 /*  location data for the lookahead     */
944                                 /*  symbol                              */
945 #endif
946
947 int yynerrs;                    /*  number of parse errors so far       */
948 #endif  /* not YYPURE */
949
950 #if YYDEBUG != 0
951 int yydebug;                    /*  nonzero means print parse trace     */
952 /* Since this is uninitialized, it does not stop multiple parsers
953    from coexisting.  */
954 #endif
955
956 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
957
958 #ifndef YYINITDEPTH
959 #define YYINITDEPTH 200
960 #endif
961
962 /*  YYMAXDEPTH is the maximum size the stacks can grow to
963     (effective only if the built-in stack extension method is used).  */
964
965 #if YYMAXDEPTH == 0
966 #undef YYMAXDEPTH
967 #endif
968
969 #ifndef YYMAXDEPTH
970 #define YYMAXDEPTH 10000
971 #endif
972 \f
973 /* Define __yy_memcpy.  Note that the size argument
974    should be passed with type unsigned int, because that is what the non-GCC
975    definitions require.  With GCC, __builtin_memcpy takes an arg
976    of type size_t, but it can handle unsigned int.  */
977
978 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
979 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
980 #else                           /* not GNU C or C++ */
981 #ifndef __cplusplus
982
983 /* This is the most reliable way to avoid incompatibilities
984    in available built-in functions on various systems.  */
985 static void
986 __yy_memcpy (to, from, count)
987      char *to;
988      char *from;
989      unsigned int count;
990 {
991   register char *f = from;
992   register char *t = to;
993   register int i = count;
994
995   while (i-- > 0)
996     *t++ = *f++;
997 }
998
999 #else /* __cplusplus */
1000
1001 /* This is the most reliable way to avoid incompatibilities
1002    in available built-in functions on various systems.  */
1003 static void
1004 __yy_memcpy (char *to, char *from, unsigned int count)
1005 {
1006   register char *t = to;
1007   register char *f = from;
1008   register int i = count;
1009
1010   while (i-- > 0)
1011     *t++ = *f++;
1012 }
1013
1014 #endif
1015 #endif
1016 \f
1017 #line 217 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
1018
1019 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
1020    into yyparse.  The argument should have type void *.
1021    It should actually point to an object.
1022    Grammar actions can access the variable by casting it
1023    to the proper pointer type.  */
1024
1025 #ifdef YYPARSE_PARAM
1026 #ifdef __cplusplus
1027 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1028 #define YYPARSE_PARAM_DECL
1029 #else /* not __cplusplus */
1030 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
1031 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1032 #endif /* not __cplusplus */
1033 #else /* not YYPARSE_PARAM */
1034 #define YYPARSE_PARAM_ARG
1035 #define YYPARSE_PARAM_DECL
1036 #endif /* not YYPARSE_PARAM */
1037
1038 /* Prevent warning if -Wstrict-prototypes.  */
1039 #ifdef __GNUC__
1040 #ifdef YYPARSE_PARAM
1041 int yyparse (void *);
1042 #else
1043 int yyparse (void);
1044 #endif
1045 #endif
1046
1047 int
1048 yyparse(YYPARSE_PARAM_ARG)
1049      YYPARSE_PARAM_DECL
1050 {
1051   register int yystate;
1052   register int yyn;
1053   register short *yyssp;
1054   register YYSTYPE *yyvsp;
1055   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
1056   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
1057
1058   short yyssa[YYINITDEPTH];     /*  the state stack                     */
1059   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
1060
1061   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
1062   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
1063
1064 #ifdef YYLSP_NEEDED
1065   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
1066   YYLTYPE *yyls = yylsa;
1067   YYLTYPE *yylsp;
1068
1069 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
1070 #else
1071 #define YYPOPSTACK   (yyvsp--, yyssp--)
1072 #endif
1073
1074   int yystacksize = YYINITDEPTH;
1075   int yyfree_stacks = 0;
1076
1077 #ifdef YYPURE
1078   int yychar;
1079   YYSTYPE yylval;
1080   int yynerrs;
1081 #ifdef YYLSP_NEEDED
1082   YYLTYPE yylloc;
1083 #endif
1084 #endif
1085
1086   YYSTYPE yyval;                /*  the variable used to return         */
1087                                 /*  semantic values from the action     */
1088                                 /*  routines                            */
1089
1090   int yylen;
1091
1092 #if YYDEBUG != 0
1093   if (yydebug)
1094     fprintf(stderr, "Starting parse\n");
1095 #endif
1096
1097   yystate = 0;
1098   yyerrstatus = 0;
1099   yynerrs = 0;
1100   yychar = YYEMPTY;             /* Cause a token to be read.  */
1101
1102   /* Initialize stack pointers.
1103      Waste one element of value and location stack
1104      so that they stay on the same level as the state stack.
1105      The wasted elements are never initialized.  */
1106
1107   yyssp = yyss - 1;
1108   yyvsp = yyvs;
1109 #ifdef YYLSP_NEEDED
1110   yylsp = yyls;
1111 #endif
1112
1113 /* Push a new state, which is found in  yystate  .  */
1114 /* In all cases, when you get here, the value and location stacks
1115    have just been pushed. so pushing a state here evens the stacks.  */
1116 yynewstate:
1117
1118   *++yyssp = yystate;
1119
1120   if (yyssp >= yyss + yystacksize - 1)
1121     {
1122       /* Give user a chance to reallocate the stack */
1123       /* Use copies of these so that the &'s don't force the real ones into memory. */
1124       YYSTYPE *yyvs1 = yyvs;
1125       short *yyss1 = yyss;
1126 #ifdef YYLSP_NEEDED
1127       YYLTYPE *yyls1 = yyls;
1128 #endif
1129
1130       /* Get the current used size of the three stacks, in elements.  */
1131       int size = yyssp - yyss + 1;
1132
1133 #ifdef yyoverflow
1134       /* Each stack pointer address is followed by the size of
1135          the data in use in that stack, in bytes.  */
1136 #ifdef YYLSP_NEEDED
1137       /* This used to be a conditional around just the two extra args,
1138          but that might be undefined if yyoverflow is a macro.  */
1139       yyoverflow("parser stack overflow",
1140                  &yyss1, size * sizeof (*yyssp),
1141                  &yyvs1, size * sizeof (*yyvsp),
1142                  &yyls1, size * sizeof (*yylsp),
1143                  &yystacksize);
1144 #else
1145       yyoverflow("parser stack overflow",
1146                  &yyss1, size * sizeof (*yyssp),
1147                  &yyvs1, size * sizeof (*yyvsp),
1148                  &yystacksize);
1149 #endif
1150
1151       yyss = yyss1; yyvs = yyvs1;
1152 #ifdef YYLSP_NEEDED
1153       yyls = yyls1;
1154 #endif
1155 #else /* no yyoverflow */
1156       /* Extend the stack our own way.  */
1157       if (yystacksize >= YYMAXDEPTH)
1158         {
1159           yyerror("parser stack overflow");
1160           if (yyfree_stacks)
1161             {
1162               free (yyss);
1163               free (yyvs);
1164 #ifdef YYLSP_NEEDED
1165               free (yyls);
1166 #endif
1167             }
1168           return 2;
1169         }
1170       yystacksize *= 2;
1171       if (yystacksize > YYMAXDEPTH)
1172         yystacksize = YYMAXDEPTH;
1173 #ifndef YYSTACK_USE_ALLOCA
1174       yyfree_stacks = 1;
1175 #endif
1176       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1177       __yy_memcpy ((char *)yyss, (char *)yyss1,
1178                    size * (unsigned int) sizeof (*yyssp));
1179       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1180       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1181                    size * (unsigned int) sizeof (*yyvsp));
1182 #ifdef YYLSP_NEEDED
1183       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1184       __yy_memcpy ((char *)yyls, (char *)yyls1,
1185                    size * (unsigned int) sizeof (*yylsp));
1186 #endif
1187 #endif /* no yyoverflow */
1188
1189       yyssp = yyss + size - 1;
1190       yyvsp = yyvs + size - 1;
1191 #ifdef YYLSP_NEEDED
1192       yylsp = yyls + size - 1;
1193 #endif
1194
1195 #if YYDEBUG != 0
1196       if (yydebug)
1197         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1198 #endif
1199
1200       if (yyssp >= yyss + yystacksize - 1)
1201         YYABORT;
1202     }
1203
1204 #if YYDEBUG != 0
1205   if (yydebug)
1206     fprintf(stderr, "Entering state %d\n", yystate);
1207 #endif
1208
1209   goto yybackup;
1210  yybackup:
1211
1212 /* Do appropriate processing given the current state.  */
1213 /* Read a lookahead token if we need one and don't already have one.  */
1214 /* yyresume: */
1215
1216   /* First try to decide what to do without reference to lookahead token.  */
1217
1218   yyn = yypact[yystate];
1219   if (yyn == YYFLAG)
1220     goto yydefault;
1221
1222   /* Not known => get a lookahead token if don't already have one.  */
1223
1224   /* yychar is either YYEMPTY or YYEOF
1225      or a valid token in external form.  */
1226
1227   if (yychar == YYEMPTY)
1228     {
1229 #if YYDEBUG != 0
1230       if (yydebug)
1231         fprintf(stderr, "Reading a token: ");
1232 #endif
1233       yychar = YYLEX;
1234     }
1235
1236   /* Convert token to internal form (in yychar1) for indexing tables with */
1237
1238   if (yychar <= 0)              /* This means end of input. */
1239     {
1240       yychar1 = 0;
1241       yychar = YYEOF;           /* Don't call YYLEX any more */
1242
1243 #if YYDEBUG != 0
1244       if (yydebug)
1245         fprintf(stderr, "Now at end of input.\n");
1246 #endif
1247     }
1248   else
1249     {
1250       yychar1 = YYTRANSLATE(yychar);
1251
1252 #if YYDEBUG != 0
1253       if (yydebug)
1254         {
1255           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1256           /* Give the individual parser a way to print the precise meaning
1257              of a token, for further debugging info.  */
1258 #ifdef YYPRINT
1259           YYPRINT (stderr, yychar, yylval);
1260 #endif
1261           fprintf (stderr, ")\n");
1262         }
1263 #endif
1264     }
1265
1266   yyn += yychar1;
1267   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1268     goto yydefault;
1269
1270   yyn = yytable[yyn];
1271
1272   /* yyn is what to do for this token type in this state.
1273      Negative => reduce, -yyn is rule number.
1274      Positive => shift, yyn is new state.
1275        New state is final state => don't bother to shift,
1276        just return success.
1277      0, or most negative number => error.  */
1278
1279   if (yyn < 0)
1280     {
1281       if (yyn == YYFLAG)
1282         goto yyerrlab;
1283       yyn = -yyn;
1284       goto yyreduce;
1285     }
1286   else if (yyn == 0)
1287     goto yyerrlab;
1288
1289   if (yyn == YYFINAL)
1290     YYACCEPT;
1291
1292   /* Shift the lookahead token.  */
1293
1294 #if YYDEBUG != 0
1295   if (yydebug)
1296     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1297 #endif
1298
1299   /* Discard the token being shifted unless it is eof.  */
1300   if (yychar != YYEOF)
1301     yychar = YYEMPTY;
1302
1303   *++yyvsp = yylval;
1304 #ifdef YYLSP_NEEDED
1305   *++yylsp = yylloc;
1306 #endif
1307
1308   /* count tokens shifted since error; after three, turn off error status.  */
1309   if (yyerrstatus) yyerrstatus--;
1310
1311   yystate = yyn;
1312   goto yynewstate;
1313
1314 /* Do the default action for the current state.  */
1315 yydefault:
1316
1317   yyn = yydefact[yystate];
1318   if (yyn == 0)
1319     goto yyerrlab;
1320
1321 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
1322 yyreduce:
1323   yylen = yyr2[yyn];
1324   if (yylen > 0)
1325     yyval = yyvsp[1-yylen]; /* implement default value of the action */
1326
1327 #if YYDEBUG != 0
1328   if (yydebug)
1329     {
1330       int i;
1331
1332       fprintf (stderr, "Reducing via rule %d (line %d), ",
1333                yyn, yyrline[yyn]);
1334
1335       /* Print the symbols being reduced, and their result.  */
1336       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1337         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1338       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1339     }
1340 #endif
1341
1342
1343   switch (yyn) {
1344
1345 case 2:
1346 #line 435 "llvmAsmParser.y"
1347 {
1348   if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX)     // Outside of my range!
1349     ThrowException("Value too large for type!");
1350   yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
1351 ;
1352     break;}
1353 case 4:
1354 #line 443 "llvmAsmParser.y"
1355 {
1356   if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX)     // Outside of my range!
1357     ThrowException("Value too large for type!");
1358   yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
1359 ;
1360     break;}
1361 case 45:
1362 #line 474 "llvmAsmParser.y"
1363 {
1364     yyval.StrVal = yyvsp[-1].StrVal;
1365   ;
1366     break;}
1367 case 46:
1368 #line 477 "llvmAsmParser.y"
1369
1370     yyval.StrVal = 0; 
1371   ;
1372     break;}
1373 case 47:
1374 #line 481 "llvmAsmParser.y"
1375 {     // integral constants
1376     if (!ConstPoolSInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val))
1377       ThrowException("Constant value doesn't fit in type!");
1378     yyval.ConstVal = new ConstPoolSInt(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val);
1379   ;
1380     break;}
1381 case 48:
1382 #line 486 "llvmAsmParser.y"
1383 {           // integral constants
1384     if (!ConstPoolUInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val))
1385       ThrowException("Constant value doesn't fit in type!");
1386     yyval.ConstVal = new ConstPoolUInt(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val);
1387   ;
1388     break;}
1389 case 49:
1390 #line 491 "llvmAsmParser.y"
1391 {                     // Boolean constants
1392     yyval.ConstVal = new ConstPoolBool(true);
1393   ;
1394     break;}
1395 case 50:
1396 #line 494 "llvmAsmParser.y"
1397 {                    // Boolean constants
1398     yyval.ConstVal = new ConstPoolBool(false);
1399   ;
1400     break;}
1401 case 51:
1402 #line 497 "llvmAsmParser.y"
1403 {         // String constants
1404     cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n";
1405     abort();
1406     //$$ = new ConstPoolString($2);
1407     free(yyvsp[0].StrVal);
1408   ;
1409     break;}
1410 case 52:
1411 #line 503 "llvmAsmParser.y"
1412 {                    // Type constants
1413     yyval.ConstVal = new ConstPoolType(yyvsp[0].TypeVal);
1414   ;
1415     break;}
1416 case 53:
1417 #line 506 "llvmAsmParser.y"
1418 {      // Nonempty array constant
1419     // Verify all elements are correct type!
1420     const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal);
1421     for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1422       if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1423         ThrowException("Element #" + utostr(i) + " is not of type '" + 
1424                        yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1425                        (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1426     }
1427
1428     yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1429     delete yyvsp[-1].ConstVector;
1430   ;
1431     break;}
1432 case 54:
1433 #line 519 "llvmAsmParser.y"
1434 {                  // Empty array constant
1435     vector<ConstPoolVal*> Empty;
1436     yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal), Empty);
1437   ;
1438     break;}
1439 case 55:
1440 #line 523 "llvmAsmParser.y"
1441 {
1442     // Verify all elements are correct type!
1443     const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal, (int)yyvsp[-6].UInt64Val);
1444     if (yyvsp[-6].UInt64Val != yyvsp[-1].ConstVector->size())
1445       ThrowException("Type mismatch: constant sized array initialized with " +
1446                      utostr(yyvsp[-1].ConstVector->size()) +  " arguments, but has size of " + 
1447                      itostr((int)yyvsp[-6].UInt64Val) + "!");
1448
1449     for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1450       if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1451         ThrowException("Element #" + utostr(i) + " is not of type '" + 
1452                        yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1453                        (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1454     }
1455
1456     yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1457     delete yyvsp[-1].ConstVector;
1458   ;
1459     break;}
1460 case 56:
1461 #line 541 "llvmAsmParser.y"
1462 {
1463     if (yyvsp[-5].UInt64Val != 0) 
1464       ThrowException("Type mismatch: constant sized array initialized with 0"
1465                      " arguments, but has size of " + itostr((int)yyvsp[-5].UInt64Val) + "!");
1466     vector<ConstPoolVal*> Empty;
1467     yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal, 0), Empty);
1468   ;
1469     break;}
1470 case 57:
1471 #line 548 "llvmAsmParser.y"
1472 {
1473     StructType::ElementTypes Types(yyvsp[-4].TypeList->begin(), yyvsp[-4].TypeList->end());
1474     delete yyvsp[-4].TypeList;
1475
1476     const StructType *St = StructType::getStructType(Types);
1477     yyval.ConstVal = new ConstPoolStruct(St, *yyvsp[-1].ConstVector);
1478     delete yyvsp[-1].ConstVector;
1479   ;
1480     break;}
1481 case 58:
1482 #line 556 "llvmAsmParser.y"
1483 {
1484     const StructType *St = 
1485       StructType::getStructType(StructType::ElementTypes());
1486     vector<ConstPoolVal*> Empty;
1487     yyval.ConstVal = new ConstPoolStruct(St, Empty);
1488   ;
1489     break;}
1490 case 59:
1491 #line 570 "llvmAsmParser.y"
1492 {
1493     (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1494   ;
1495     break;}
1496 case 60:
1497 #line 573 "llvmAsmParser.y"
1498 {
1499     yyval.ConstVector = new vector<ConstPoolVal*>();
1500     yyval.ConstVector->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1501   ;
1502     break;}
1503 case 61:
1504 #line 579 "llvmAsmParser.y"
1505
1506     if (yyvsp[-1].StrVal) {
1507       yyvsp[0].ConstVal->setName(yyvsp[-1].StrVal);
1508       free(yyvsp[-1].StrVal);
1509     }
1510
1511     addConstValToConstantPool(yyvsp[0].ConstVal);
1512   ;
1513     break;}
1514 case 62:
1515 #line 587 "llvmAsmParser.y"
1516
1517   ;
1518     break;}
1519 case 63:
1520 #line 598 "llvmAsmParser.y"
1521 {
1522   yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
1523   CurModule.ModuleDone();
1524 ;
1525     break;}
1526 case 64:
1527 #line 603 "llvmAsmParser.y"
1528 {
1529     yyvsp[-1].ModuleVal->getMethodList().push_back(yyvsp[0].MethodVal);
1530     CurMeth.MethodDone();
1531     yyval.ModuleVal = yyvsp[-1].ModuleVal;
1532   ;
1533     break;}
1534 case 65:
1535 #line 608 "llvmAsmParser.y"
1536 {
1537     yyval.ModuleVal = CurModule.CurrentModule;
1538   ;
1539     break;}
1540 case 67:
1541 #line 617 "llvmAsmParser.y"
1542 { yyval.StrVal = 0; ;
1543     break;}
1544 case 68:
1545 #line 619 "llvmAsmParser.y"
1546 {
1547   yyval.MethArgVal = new MethodArgument(yyvsp[-1].TypeVal);
1548   if (yyvsp[0].StrVal) {      // Was the argument named?
1549     yyval.MethArgVal->setName(yyvsp[0].StrVal); 
1550     free(yyvsp[0].StrVal);    // The string was strdup'd, so free it now.
1551   }
1552 ;
1553     break;}
1554 case 69:
1555 #line 627 "llvmAsmParser.y"
1556 {
1557     yyval.MethodArgList = yyvsp[0].MethodArgList;
1558     yyvsp[0].MethodArgList->push_front(yyvsp[-2].MethArgVal);
1559   ;
1560     break;}
1561 case 70:
1562 #line 631 "llvmAsmParser.y"
1563 {
1564     yyval.MethodArgList = new list<MethodArgument*>();
1565     yyval.MethodArgList->push_front(yyvsp[0].MethArgVal);
1566   ;
1567     break;}
1568 case 71:
1569 #line 636 "llvmAsmParser.y"
1570 {
1571     yyval.MethodArgList = yyvsp[0].MethodArgList;
1572   ;
1573     break;}
1574 case 72:
1575 #line 639 "llvmAsmParser.y"
1576 {
1577     yyval.MethodArgList = 0;
1578   ;
1579     break;}
1580 case 73:
1581 #line 643 "llvmAsmParser.y"
1582 {
1583   MethodType::ParamTypes ParamTypeList;
1584   if (yyvsp[-1].MethodArgList)
1585     for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I)
1586       ParamTypeList.push_back((*I)->getType());
1587
1588   const MethodType *MT = MethodType::getMethodType(yyvsp[-4].TypeVal, ParamTypeList);
1589
1590   Method *M = new Method(MT, yyvsp[-3].StrVal);
1591   free(yyvsp[-3].StrVal);  // Free strdup'd memory!
1592
1593   InsertValue(M, CurModule.Values);
1594
1595   CurMeth.MethodStart(M);
1596
1597   // Add all of the arguments we parsed to the method...
1598   if (yyvsp[-1].MethodArgList) {        // Is null if empty...
1599     Method::ArgumentListType &ArgList = M->getArgumentList();
1600
1601     for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I) {
1602       InsertValue(*I);
1603       ArgList.push_back(*I);
1604     }
1605     delete yyvsp[-1].MethodArgList;                     // We're now done with the argument list
1606   }
1607 ;
1608     break;}
1609 case 74:
1610 #line 670 "llvmAsmParser.y"
1611 {
1612   yyval.MethodVal = CurMeth.CurrentMethod;
1613 ;
1614     break;}
1615 case 75:
1616 #line 674 "llvmAsmParser.y"
1617 {
1618   yyval.MethodVal = yyvsp[-1].MethodVal;
1619 ;
1620     break;}
1621 case 76:
1622 #line 683 "llvmAsmParser.y"
1623 {    // A reference to a direct constant
1624     yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
1625   ;
1626     break;}
1627 case 77:
1628 #line 686 "llvmAsmParser.y"
1629 {
1630     yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
1631   ;
1632     break;}
1633 case 78:
1634 #line 689 "llvmAsmParser.y"
1635 {
1636     yyval.ValIDVal = ValID::create((int64_t)1);
1637   ;
1638     break;}
1639 case 79:
1640 #line 692 "llvmAsmParser.y"
1641 {
1642     yyval.ValIDVal = ValID::create((int64_t)0);
1643   ;
1644     break;}
1645 case 80:
1646 #line 695 "llvmAsmParser.y"
1647 {        // Quoted strings work too... especially for methods
1648     yyval.ValIDVal = ValID::create_conststr(yyvsp[0].StrVal);
1649   ;
1650     break;}
1651 case 81:
1652 #line 700 "llvmAsmParser.y"
1653 {           // Is it an integer reference...?
1654     yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
1655   ;
1656     break;}
1657 case 82:
1658 #line 703 "llvmAsmParser.y"
1659 {                // It must be a named reference then...
1660     yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
1661   ;
1662     break;}
1663 case 83:
1664 #line 706 "llvmAsmParser.y"
1665 {
1666     yyval.ValIDVal = yyvsp[0].ValIDVal;
1667   ;
1668     break;}
1669 case 84:
1670 #line 713 "llvmAsmParser.y"
1671 {
1672     Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true);
1673     if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName());
1674
1675     // User defined type not in const pool!
1676     ConstPoolType *CPT = (ConstPoolType*)D->castConstantAsserting();
1677     yyval.TypeVal = CPT->getValue();
1678   ;
1679     break;}
1680 case 85:
1681 #line 721 "llvmAsmParser.y"
1682 {               // Method derived type?
1683     MethodType::ParamTypes Params(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1684     delete yyvsp[-1].TypeList;
1685     yyval.TypeVal = MethodType::getMethodType(yyvsp[-3].TypeVal, Params);
1686   ;
1687     break;}
1688 case 86:
1689 #line 726 "llvmAsmParser.y"
1690 {               // Method derived type?
1691     MethodType::ParamTypes Params;     // Empty list
1692     yyval.TypeVal = MethodType::getMethodType(yyvsp[-2].TypeVal, Params);
1693   ;
1694     break;}
1695 case 87:
1696 #line 730 "llvmAsmParser.y"
1697 {
1698     yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal);
1699   ;
1700     break;}
1701 case 88:
1702 #line 733 "llvmAsmParser.y"
1703 {
1704     yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal, (int)yyvsp[-3].UInt64Val);
1705   ;
1706     break;}
1707 case 89:
1708 #line 736 "llvmAsmParser.y"
1709 {
1710     StructType::ElementTypes Elements(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1711     delete yyvsp[-1].TypeList;
1712     yyval.TypeVal = StructType::getStructType(Elements);
1713   ;
1714     break;}
1715 case 90:
1716 #line 741 "llvmAsmParser.y"
1717 {
1718     yyval.TypeVal = StructType::getStructType(StructType::ElementTypes());
1719   ;
1720     break;}
1721 case 91:
1722 #line 744 "llvmAsmParser.y"
1723 {
1724     yyval.TypeVal = PointerType::getPointerType(yyvsp[-1].TypeVal);
1725   ;
1726     break;}
1727 case 92:
1728 #line 749 "llvmAsmParser.y"
1729 {
1730     yyval.TypeList = new list<const Type*>();
1731     yyval.TypeList->push_back(yyvsp[0].TypeVal);
1732   ;
1733     break;}
1734 case 93:
1735 #line 753 "llvmAsmParser.y"
1736 {
1737     (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal);
1738   ;
1739     break;}
1740 case 94:
1741 #line 758 "llvmAsmParser.y"
1742 {
1743     yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1744     yyval.MethodVal = yyvsp[-1].MethodVal;
1745   ;
1746     break;}
1747 case 95:
1748 #line 762 "llvmAsmParser.y"
1749 { // Do not allow methods with 0 basic blocks   
1750     yyval.MethodVal = yyvsp[-1].MethodVal;                  // in them...
1751     yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1752   ;
1753     break;}
1754 case 96:
1755 #line 771 "llvmAsmParser.y"
1756 {
1757     yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1758     InsertValue(yyvsp[-1].BasicBlockVal);
1759     yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1760   ;
1761     break;}
1762 case 97:
1763 #line 776 "llvmAsmParser.y"
1764 {
1765     yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1766     yyvsp[-1].BasicBlockVal->setName(yyvsp[-2].StrVal);
1767     free(yyvsp[-2].StrVal);         // Free the strdup'd memory...
1768
1769     InsertValue(yyvsp[-1].BasicBlockVal);
1770     yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1771   ;
1772     break;}
1773 case 98:
1774 #line 785 "llvmAsmParser.y"
1775 {
1776     yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
1777     yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1778   ;
1779     break;}
1780 case 99:
1781 #line 789 "llvmAsmParser.y"
1782 {
1783     yyval.BasicBlockVal = new BasicBlock();
1784   ;
1785     break;}
1786 case 100:
1787 #line 793 "llvmAsmParser.y"
1788 {              // Return with a result...
1789     yyval.TermInstVal = new ReturnInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1790   ;
1791     break;}
1792 case 101:
1793 #line 796 "llvmAsmParser.y"
1794 {                                       // Return with no result...
1795     yyval.TermInstVal = new ReturnInst();
1796   ;
1797     break;}
1798 case 102:
1799 #line 799 "llvmAsmParser.y"
1800 {                         // Unconditional Branch...
1801     yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal));
1802   ;
1803     break;}
1804 case 103:
1805 #line 802 "llvmAsmParser.y"
1806 {  
1807     yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal), 
1808                         (BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal),
1809                         getVal(Type::BoolTy, yyvsp[-6].ValIDVal));
1810   ;
1811     break;}
1812 case 104:
1813 #line 807 "llvmAsmParser.y"
1814 {
1815     SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].TypeVal, yyvsp[-6].ValIDVal), 
1816                                    (BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal));
1817     yyval.TermInstVal = S;
1818
1819     list<pair<ConstPoolVal*, BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(), 
1820                                                       end = yyvsp[-1].JumpTable->end();
1821     for (; I != end; ++I)
1822       S->dest_push_back(I->first, I->second);
1823   ;
1824     break;}
1825 case 105:
1826 #line 818 "llvmAsmParser.y"
1827 {
1828     yyval.JumpTable = yyvsp[-5].JumpTable;
1829     ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1830     if (V == 0)
1831       ThrowException("May only switch on a constant pool value!");
1832
1833     yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1834   ;
1835     break;}
1836 case 106:
1837 #line 826 "llvmAsmParser.y"
1838 {
1839     yyval.JumpTable = new list<pair<ConstPoolVal*, BasicBlock*> >();
1840     ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1841
1842     if (V == 0)
1843       ThrowException("May only switch on a constant pool value!");
1844
1845     yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1846   ;
1847     break;}
1848 case 107:
1849 #line 836 "llvmAsmParser.y"
1850 {
1851   if (yyvsp[-1].StrVal)              // Is this definition named??
1852     yyvsp[0].InstVal->setName(yyvsp[-1].StrVal);   // if so, assign the name...
1853
1854   InsertValue(yyvsp[0].InstVal);
1855   yyval.InstVal = yyvsp[0].InstVal;
1856 ;
1857     break;}
1858 case 108:
1859 #line 844 "llvmAsmParser.y"
1860 {    // Used for PHI nodes
1861     yyval.PHIList = new list<pair<Value*, BasicBlock*> >();
1862     yyval.PHIList->push_back(make_pair(getVal(yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal), 
1863                             (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal)));
1864   ;
1865     break;}
1866 case 109:
1867 #line 849 "llvmAsmParser.y"
1868 {
1869     yyval.PHIList = yyvsp[-6].PHIList;
1870     yyvsp[-6].PHIList->push_back(make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal),
1871                             (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal)));
1872   ;
1873     break;}
1874 case 110:
1875 #line 856 "llvmAsmParser.y"
1876 {    // Used for call statements...
1877     yyval.ValueList = new list<Value*>();
1878     yyval.ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1879   ;
1880     break;}
1881 case 111:
1882 #line 860 "llvmAsmParser.y"
1883 {
1884     yyval.ValueList = yyvsp[-2].ValueList;
1885     yyvsp[-2].ValueList->push_back(getVal(yyvsp[-2].ValueList->front()->getType(), yyvsp[0].ValIDVal));
1886   ;
1887     break;}
1888 case 113:
1889 #line 866 "llvmAsmParser.y"
1890 { yyval.ValueList = 0; ;
1891     break;}
1892 case 114:
1893 #line 868 "llvmAsmParser.y"
1894 {
1895     yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
1896     if (yyval.InstVal == 0)
1897       ThrowException("binary operator returned null!");
1898   ;
1899     break;}
1900 case 115:
1901 #line 873 "llvmAsmParser.y"
1902 {
1903     yyval.InstVal = UnaryOperator::create(yyvsp[-2].UnaryOpVal, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1904     if (yyval.InstVal == 0)
1905       ThrowException("unary operator returned null!");
1906   ;
1907     break;}
1908 case 116:
1909 #line 878 "llvmAsmParser.y"
1910 {
1911     if (yyvsp[-1].TypeVal != Type::UByteTy) ThrowException("Shift amount must be ubyte!");
1912     yyval.InstVal = new ShiftInst(yyvsp[-5].OtherOpVal, getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal), getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1913   ;
1914     break;}
1915 case 117:
1916 #line 882 "llvmAsmParser.y"
1917 {
1918     yyval.InstVal = new CastInst(getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), yyvsp[0].TypeVal);
1919   ;
1920     break;}
1921 case 118:
1922 #line 885 "llvmAsmParser.y"
1923 {
1924     const Type *Ty = yyvsp[0].PHIList->front().first->getType();
1925     yyval.InstVal = new PHINode(Ty);
1926     while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
1927       if (yyvsp[0].PHIList->front().first->getType() != Ty) 
1928         ThrowException("All elements of a PHI node must be of the same type!");
1929       ((PHINode*)yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
1930       yyvsp[0].PHIList->pop_front();
1931     }
1932     delete yyvsp[0].PHIList;  // Free the list...
1933   ;
1934     break;}
1935 case 119:
1936 #line 896 "llvmAsmParser.y"
1937 {
1938     if (!yyvsp[-4].TypeVal->isMethodType())
1939       ThrowException("Can only call methods: invalid type '" + 
1940                      yyvsp[-4].TypeVal->getName() + "'!");
1941
1942     const MethodType *Ty = (const MethodType*)yyvsp[-4].TypeVal;
1943
1944     Value *V = getVal(Ty, yyvsp[-3].ValIDVal);
1945     if (!V->isMethod() || V->getType() != Ty)
1946       ThrowException("Cannot call: " + yyvsp[-3].ValIDVal.getName() + "!");
1947
1948     // Create or access a new type that corresponds to the function call...
1949     vector<Value *> Params;
1950
1951     if (yyvsp[-1].ValueList) {
1952       // Pull out just the arguments...
1953       Params.insert(Params.begin(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
1954       delete yyvsp[-1].ValueList;
1955
1956       // Loop through MethodType's arguments and ensure they are specified
1957       // correctly!
1958       //
1959       MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
1960       unsigned i;
1961       for (i = 0; i < Params.size() && I != Ty->getParamTypes().end(); ++i,++I){
1962         if (Params[i]->getType() != *I)
1963           ThrowException("Parameter " + utostr(i) + " is not of type '" + 
1964                          (*I)->getName() + "'!");
1965       }
1966
1967       if (i != Params.size() || I != Ty->getParamTypes().end())
1968         ThrowException("Invalid number of parameters detected!");
1969     }
1970
1971     // Create the call node...
1972     yyval.InstVal = new CallInst((Method*)V, Params);
1973   ;
1974     break;}
1975 case 120:
1976 #line 933 "llvmAsmParser.y"
1977 {
1978     yyval.InstVal = yyvsp[0].InstVal;
1979   ;
1980     break;}
1981 case 121:
1982 #line 938 "llvmAsmParser.y"
1983
1984   yyval.ConstVector = yyvsp[0].ConstVector; 
1985 ;
1986     break;}
1987 case 122:
1988 #line 940 "llvmAsmParser.y"
1989
1990   yyval.ConstVector = new vector<ConstPoolVal*>(); 
1991 ;
1992     break;}
1993 case 123:
1994 #line 944 "llvmAsmParser.y"
1995 {
1996     const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal);
1997     addConstValToConstantPool(new ConstPoolType(Ty));
1998     yyval.InstVal = new MallocInst(Ty);
1999   ;
2000     break;}
2001 case 124:
2002 #line 949 "llvmAsmParser.y"
2003 {
2004     if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
2005       ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() + 
2006                      " as unsized array!");
2007     const Type *Ty = PointerType::getPointerType(yyvsp[-3].TypeVal);
2008     addConstValToConstantPool(new ConstPoolType(Ty));
2009     Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
2010     yyval.InstVal = new MallocInst(Ty, ArrSize);
2011   ;
2012     break;}
2013 case 125:
2014 #line 958 "llvmAsmParser.y"
2015 {
2016     const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal);
2017     addConstValToConstantPool(new ConstPoolType(Ty));
2018     yyval.InstVal = new AllocaInst(Ty);
2019   ;
2020     break;}
2021 case 126:
2022 #line 963 "llvmAsmParser.y"
2023 {
2024     if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
2025       ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() + 
2026                      " as unsized array!");
2027     const Type *Ty = PointerType::getPointerType(yyvsp[-3].TypeVal);
2028     addConstValToConstantPool(new ConstPoolType(Ty));
2029     Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
2030     yyval.InstVal = new AllocaInst(Ty, ArrSize);
2031   ;
2032     break;}
2033 case 127:
2034 #line 972 "llvmAsmParser.y"
2035 {
2036     if (!yyvsp[-1].TypeVal->isPointerType())
2037       ThrowException("Trying to free nonpointer type " + yyvsp[-1].TypeVal->getName() + "!");
2038     yyval.InstVal = new FreeInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
2039   ;
2040     break;}
2041 case 128:
2042 #line 978 "llvmAsmParser.y"
2043 {
2044     if (!yyvsp[-2].TypeVal->isPointerType())
2045       ThrowException("Can't load from nonpointer type: " + yyvsp[-2].TypeVal->getName());
2046     if (LoadInst::getIndexedType(yyvsp[-2].TypeVal, *yyvsp[0].ConstVector) == 0)
2047       ThrowException("Invalid indices for load instruction!");
2048
2049     yyval.InstVal = new LoadInst(getVal(yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ConstVector);
2050     delete yyvsp[0].ConstVector;   // Free the vector...
2051   ;
2052     break;}
2053 }
2054    /* the action file gets copied in in place of this dollarsign */
2055 #line 543 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
2056 \f
2057   yyvsp -= yylen;
2058   yyssp -= yylen;
2059 #ifdef YYLSP_NEEDED
2060   yylsp -= yylen;
2061 #endif
2062
2063 #if YYDEBUG != 0
2064   if (yydebug)
2065     {
2066       short *ssp1 = yyss - 1;
2067       fprintf (stderr, "state stack now");
2068       while (ssp1 != yyssp)
2069         fprintf (stderr, " %d", *++ssp1);
2070       fprintf (stderr, "\n");
2071     }
2072 #endif
2073
2074   *++yyvsp = yyval;
2075
2076 #ifdef YYLSP_NEEDED
2077   yylsp++;
2078   if (yylen == 0)
2079     {
2080       yylsp->first_line = yylloc.first_line;
2081       yylsp->first_column = yylloc.first_column;
2082       yylsp->last_line = (yylsp-1)->last_line;
2083       yylsp->last_column = (yylsp-1)->last_column;
2084       yylsp->text = 0;
2085     }
2086   else
2087     {
2088       yylsp->last_line = (yylsp+yylen-1)->last_line;
2089       yylsp->last_column = (yylsp+yylen-1)->last_column;
2090     }
2091 #endif
2092
2093   /* Now "shift" the result of the reduction.
2094      Determine what state that goes to,
2095      based on the state we popped back to
2096      and the rule number reduced by.  */
2097
2098   yyn = yyr1[yyn];
2099
2100   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2101   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2102     yystate = yytable[yystate];
2103   else
2104     yystate = yydefgoto[yyn - YYNTBASE];
2105
2106   goto yynewstate;
2107
2108 yyerrlab:   /* here on detecting error */
2109
2110   if (! yyerrstatus)
2111     /* If not already recovering from an error, report this error.  */
2112     {
2113       ++yynerrs;
2114
2115 #ifdef YYERROR_VERBOSE
2116       yyn = yypact[yystate];
2117
2118       if (yyn > YYFLAG && yyn < YYLAST)
2119         {
2120           int size = 0;
2121           char *msg;
2122           int x, count;
2123
2124           count = 0;
2125           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
2126           for (x = (yyn < 0 ? -yyn : 0);
2127                x < (sizeof(yytname) / sizeof(char *)); x++)
2128             if (yycheck[x + yyn] == x)
2129               size += strlen(yytname[x]) + 15, count++;
2130           msg = (char *) malloc(size + 15);
2131           if (msg != 0)
2132             {
2133               strcpy(msg, "parse error");
2134
2135               if (count < 5)
2136                 {
2137                   count = 0;
2138                   for (x = (yyn < 0 ? -yyn : 0);
2139                        x < (sizeof(yytname) / sizeof(char *)); x++)
2140                     if (yycheck[x + yyn] == x)
2141                       {
2142                         strcat(msg, count == 0 ? ", expecting `" : " or `");
2143                         strcat(msg, yytname[x]);
2144                         strcat(msg, "'");
2145                         count++;
2146                       }
2147                 }
2148               yyerror(msg);
2149               free(msg);
2150             }
2151           else
2152             yyerror ("parse error; also virtual memory exceeded");
2153         }
2154       else
2155 #endif /* YYERROR_VERBOSE */
2156         yyerror("parse error");
2157     }
2158
2159   goto yyerrlab1;
2160 yyerrlab1:   /* here on error raised explicitly by an action */
2161
2162   if (yyerrstatus == 3)
2163     {
2164       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
2165
2166       /* return failure if at end of input */
2167       if (yychar == YYEOF)
2168         YYABORT;
2169
2170 #if YYDEBUG != 0
2171       if (yydebug)
2172         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2173 #endif
2174
2175       yychar = YYEMPTY;
2176     }
2177
2178   /* Else will try to reuse lookahead token
2179      after shifting the error token.  */
2180
2181   yyerrstatus = 3;              /* Each real token shifted decrements this */
2182
2183   goto yyerrhandle;
2184
2185 yyerrdefault:  /* current state does not do anything special for the error token. */
2186
2187 #if 0
2188   /* This is wrong; only states that explicitly want error tokens
2189      should shift them.  */
2190   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
2191   if (yyn) goto yydefault;
2192 #endif
2193
2194 yyerrpop:   /* pop the current state because it cannot handle the error token */
2195
2196   if (yyssp == yyss) YYABORT;
2197   yyvsp--;
2198   yystate = *--yyssp;
2199 #ifdef YYLSP_NEEDED
2200   yylsp--;
2201 #endif
2202
2203 #if YYDEBUG != 0
2204   if (yydebug)
2205     {
2206       short *ssp1 = yyss - 1;
2207       fprintf (stderr, "Error: state stack now");
2208       while (ssp1 != yyssp)
2209         fprintf (stderr, " %d", *++ssp1);
2210       fprintf (stderr, "\n");
2211     }
2212 #endif
2213
2214 yyerrhandle:
2215
2216   yyn = yypact[yystate];
2217   if (yyn == YYFLAG)
2218     goto yyerrdefault;
2219
2220   yyn += YYTERROR;
2221   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2222     goto yyerrdefault;
2223
2224   yyn = yytable[yyn];
2225   if (yyn < 0)
2226     {
2227       if (yyn == YYFLAG)
2228         goto yyerrpop;
2229       yyn = -yyn;
2230       goto yyreduce;
2231     }
2232   else if (yyn == 0)
2233     goto yyerrpop;
2234
2235   if (yyn == YYFINAL)
2236     YYACCEPT;
2237
2238 #if YYDEBUG != 0
2239   if (yydebug)
2240     fprintf(stderr, "Shifting error token, ");
2241 #endif
2242
2243   *++yyvsp = yylval;
2244 #ifdef YYLSP_NEEDED
2245   *++yylsp = yylloc;
2246 #endif
2247
2248   yystate = yyn;
2249   goto yynewstate;
2250
2251  yyacceptlab:
2252   /* YYACCEPT comes here.  */
2253   if (yyfree_stacks)
2254     {
2255       free (yyss);
2256       free (yyvs);
2257 #ifdef YYLSP_NEEDED
2258       free (yyls);
2259 #endif
2260     }
2261   return 0;
2262
2263  yyabortlab:
2264   /* YYABORT comes here.  */
2265   if (yyfree_stacks)
2266     {
2267       free (yyss);
2268       free (yyvs);
2269 #ifdef YYLSP_NEEDED
2270       free (yyls);
2271 #endif
2272     }
2273   return 1;
2274 }
2275 #line 988 "llvmAsmParser.y"
2276
2277 int yyerror(const char *ErrorMsg) {
2278   ThrowException(string("Parse error: ") + ErrorMsg);
2279   return 0;
2280 }