Add support for the new "target data" information in .ll files. This provides
[oota-llvm.git] / lib / AsmParser / llvmAsmParser.cpp.cvs
1
2 /*  A Bison parser, made from /Users/resistor/llvm/src/llvm/lib/AsmParser/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 FPVAL   261
19 #define VOID    262
20 #define BOOL    263
21 #define SBYTE   264
22 #define UBYTE   265
23 #define SHORT   266
24 #define USHORT  267
25 #define INT     268
26 #define UINT    269
27 #define LONG    270
28 #define ULONG   271
29 #define FLOAT   272
30 #define DOUBLE  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 ZEROINITIALIZER 280
38 #define TRUETOK 281
39 #define FALSETOK        282
40 #define BEGINTOK        283
41 #define ENDTOK  284
42 #define DECLARE 285
43 #define GLOBAL  286
44 #define CONSTANT        287
45 #define SECTION 288
46 #define VOLATILE        289
47 #define TO      290
48 #define DOTDOTDOT       291
49 #define NULL_TOK        292
50 #define UNDEF   293
51 #define CONST   294
52 #define INTERNAL        295
53 #define LINKONCE        296
54 #define WEAK    297
55 #define APPENDING       298
56 #define DLLIMPORT       299
57 #define DLLEXPORT       300
58 #define EXTERN_WEAK     301
59 #define OPAQUE  302
60 #define NOT     303
61 #define EXTERNAL        304
62 #define TARGET  305
63 #define TRIPLE  306
64 #define ENDIAN  307
65 #define POINTERSIZE     308
66 #define LITTLE  309
67 #define BIG     310
68 #define ALIGN   311
69 #define DEPLIBS 312
70 #define CALL    313
71 #define TAIL    314
72 #define ASM_TOK 315
73 #define MODULE  316
74 #define SIDEEFFECT      317
75 #define CC_TOK  318
76 #define CCC_TOK 319
77 #define CSRETCC_TOK     320
78 #define FASTCC_TOK      321
79 #define COLDCC_TOK      322
80 #define X86_STDCALLCC_TOK       323
81 #define X86_FASTCALLCC_TOK      324
82 #define DATA    325
83 #define RET     326
84 #define BR      327
85 #define SWITCH  328
86 #define INVOKE  329
87 #define UNWIND  330
88 #define UNREACHABLE     331
89 #define ADD     332
90 #define SUB     333
91 #define MUL     334
92 #define DIV     335
93 #define REM     336
94 #define AND     337
95 #define OR      338
96 #define XOR     339
97 #define SETLE   340
98 #define SETGE   341
99 #define SETLT   342
100 #define SETGT   343
101 #define SETEQ   344
102 #define SETNE   345
103 #define MALLOC  346
104 #define ALLOCA  347
105 #define FREE    348
106 #define LOAD    349
107 #define STORE   350
108 #define GETELEMENTPTR   351
109 #define PHI_TOK 352
110 #define CAST    353
111 #define SELECT  354
112 #define SHL     355
113 #define SHR     356
114 #define VAARG   357
115 #define EXTRACTELEMENT  358
116 #define INSERTELEMENT   359
117 #define SHUFFLEVECTOR   360
118 #define VAARG_old       361
119 #define VANEXT_old      362
120
121 #line 14 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
122
123 #include "ParserInternals.h"
124 #include "llvm/CallingConv.h"
125 #include "llvm/InlineAsm.h"
126 #include "llvm/Instructions.h"
127 #include "llvm/Module.h"
128 #include "llvm/SymbolTable.h"
129 #include "llvm/Assembly/AutoUpgrade.h"
130 #include "llvm/Support/GetElementPtrTypeIterator.h"
131 #include "llvm/ADT/STLExtras.h"
132 #include "llvm/Support/MathExtras.h"
133 #include <algorithm>
134 #include <iostream>
135 #include <list>
136 #include <utility>
137
138 // The following is a gross hack. In order to rid the libAsmParser library of
139 // exceptions, we have to have a way of getting the yyparse function to go into
140 // an error situation. So, whenever we want an error to occur, the GenerateError
141 // function (see bottom of file) sets TriggerError. Then, at the end of each 
142 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR 
143 // (a goto) to put YACC in error state. Furthermore, several calls to 
144 // GenerateError are made from inside productions and they must simulate the
145 // previous exception behavior by exiting the production immediately. We have
146 // replaced these with the GEN_ERROR macro which calls GeneratError and then
147 // immediately invokes YYERROR. This would be so much cleaner if it was a 
148 // recursive descent parser.
149 static bool TriggerError = false;
150 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
151 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
152
153 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
154 int yylex();                       // declaration" of xxx warnings.
155 int yyparse();
156
157 namespace llvm {
158   std::string CurFilename;
159 }
160 using namespace llvm;
161
162 static Module *ParserResult;
163
164 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
165 // relating to upreferences in the input stream.
166 //
167 //#define DEBUG_UPREFS 1
168 #ifdef DEBUG_UPREFS
169 #define UR_OUT(X) std::cerr << X
170 #else
171 #define UR_OUT(X)
172 #endif
173
174 #define YYERROR_VERBOSE 1
175
176 static bool ObsoleteVarArgs;
177 static bool NewVarArgs;
178 static BasicBlock *CurBB;
179 static GlobalVariable *CurGV;
180
181
182 // This contains info used when building the body of a function.  It is
183 // destroyed when the function is completed.
184 //
185 typedef std::vector<Value *> ValueList;           // Numbered defs
186 static void 
187 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
188                    std::map<const Type *,ValueList> *FutureLateResolvers = 0);
189
190 static struct PerModuleInfo {
191   Module *CurrentModule;
192   std::map<const Type *, ValueList> Values; // Module level numbered definitions
193   std::map<const Type *,ValueList> LateResolveValues;
194   std::vector<PATypeHolder>    Types;
195   std::map<ValID, PATypeHolder> LateResolveTypes;
196
197   /// PlaceHolderInfo - When temporary placeholder objects are created, remember
198   /// how they were referenced and on which line of the input they came from so
199   /// that we can resolve them later and print error messages as appropriate.
200   std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
201
202   // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
203   // references to global values.  Global values may be referenced before they
204   // are defined, and if so, the temporary object that they represent is held
205   // here.  This is used for forward references of GlobalValues.
206   //
207   typedef std::map<std::pair<const PointerType *,
208                              ValID>, GlobalValue*> GlobalRefsType;
209   GlobalRefsType GlobalRefs;
210
211   void ModuleDone() {
212     // If we could not resolve some functions at function compilation time
213     // (calls to functions before they are defined), resolve them now...  Types
214     // are resolved when the constant pool has been completely parsed.
215     //
216     ResolveDefinitions(LateResolveValues);
217     if (TriggerError)
218       return;
219
220     // Check to make sure that all global value forward references have been
221     // resolved!
222     //
223     if (!GlobalRefs.empty()) {
224       std::string UndefinedReferences = "Unresolved global references exist:\n";
225
226       for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
227            I != E; ++I) {
228         UndefinedReferences += "  " + I->first.first->getDescription() + " " +
229                                I->first.second.getName() + "\n";
230       }
231       GenerateError(UndefinedReferences);
232       return;
233     }
234
235     // Look for intrinsic functions and CallInst that need to be upgraded
236     for (Module::iterator FI = CurrentModule->begin(),
237          FE = CurrentModule->end(); FI != FE; )
238       UpgradeCallsToIntrinsic(FI++);
239
240     Values.clear();         // Clear out function local definitions
241     Types.clear();
242     CurrentModule = 0;
243   }
244
245   // GetForwardRefForGlobal - Check to see if there is a forward reference
246   // for this global.  If so, remove it from the GlobalRefs map and return it.
247   // If not, just return null.
248   GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
249     // Check to see if there is a forward reference to this global variable...
250     // if there is, eliminate it and patch the reference to use the new def'n.
251     GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
252     GlobalValue *Ret = 0;
253     if (I != GlobalRefs.end()) {
254       Ret = I->second;
255       GlobalRefs.erase(I);
256     }
257     return Ret;
258   }
259 } CurModule;
260
261 static struct PerFunctionInfo {
262   Function *CurrentFunction;     // Pointer to current function being created
263
264   std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
265   std::map<const Type*, ValueList> LateResolveValues;
266   bool isDeclare;                    // Is this function a forward declararation?
267   GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
268
269   /// BBForwardRefs - When we see forward references to basic blocks, keep
270   /// track of them here.
271   std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
272   std::vector<BasicBlock*> NumberedBlocks;
273   unsigned NextBBNum;
274
275   inline PerFunctionInfo() {
276     CurrentFunction = 0;
277     isDeclare = false;
278     Linkage = GlobalValue::ExternalLinkage;    
279   }
280
281   inline void FunctionStart(Function *M) {
282     CurrentFunction = M;
283     NextBBNum = 0;
284   }
285
286   void FunctionDone() {
287     NumberedBlocks.clear();
288
289     // Any forward referenced blocks left?
290     if (!BBForwardRefs.empty()) {
291       GenerateError("Undefined reference to label " +
292                      BBForwardRefs.begin()->first->getName());
293       return;
294     }
295
296     // Resolve all forward references now.
297     ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
298
299     Values.clear();         // Clear out function local definitions
300     CurrentFunction = 0;
301     isDeclare = false;
302     Linkage = GlobalValue::ExternalLinkage;
303   }
304 } CurFun;  // Info for the current function...
305
306 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
307
308
309 //===----------------------------------------------------------------------===//
310 //               Code to handle definitions of all the types
311 //===----------------------------------------------------------------------===//
312
313 static int InsertValue(Value *V,
314                   std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
315   if (V->hasName()) return -1;           // Is this a numbered definition?
316
317   // Yes, insert the value into the value table...
318   ValueList &List = ValueTab[V->getType()];
319   List.push_back(V);
320   return List.size()-1;
321 }
322
323 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
324   switch (D.Type) {
325   case ValID::NumberVal:               // Is it a numbered definition?
326     // Module constants occupy the lowest numbered slots...
327     if ((unsigned)D.Num < CurModule.Types.size())
328       return CurModule.Types[(unsigned)D.Num];
329     break;
330   case ValID::NameVal:                 // Is it a named definition?
331     if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
332       D.destroy();  // Free old strdup'd memory...
333       return N;
334     }
335     break;
336   default:
337     GenerateError("Internal parser error: Invalid symbol type reference!");
338     return 0;
339   }
340
341   // If we reached here, we referenced either a symbol that we don't know about
342   // or an id number that hasn't been read yet.  We may be referencing something
343   // forward, so just create an entry to be resolved later and get to it...
344   //
345   if (DoNotImprovise) return 0;  // Do we just want a null to be returned?
346
347
348   if (inFunctionScope()) {
349     if (D.Type == ValID::NameVal) {
350       GenerateError("Reference to an undefined type: '" + D.getName() + "'");
351       return 0;
352     } else {
353       GenerateError("Reference to an undefined type: #" + itostr(D.Num));
354       return 0;
355     }
356   }
357
358   std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
359   if (I != CurModule.LateResolveTypes.end())
360     return I->second;
361
362   Type *Typ = OpaqueType::get();
363   CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
364   return Typ;
365  }
366
367 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
368   SymbolTable &SymTab =
369     inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
370                         CurModule.CurrentModule->getSymbolTable();
371   return SymTab.lookup(Ty, Name);
372 }
373
374 // getValNonImprovising - Look up the value specified by the provided type and
375 // the provided ValID.  If the value exists and has already been defined, return
376 // it.  Otherwise return null.
377 //
378 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
379   if (isa<FunctionType>(Ty)) {
380     GenerateError("Functions are not values and "
381                    "must be referenced as pointers");
382     return 0;
383   }
384
385   switch (D.Type) {
386   case ValID::NumberVal: {                 // Is it a numbered definition?
387     unsigned Num = (unsigned)D.Num;
388
389     // Module constants occupy the lowest numbered slots...
390     std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
391     if (VI != CurModule.Values.end()) {
392       if (Num < VI->second.size())
393         return VI->second[Num];
394       Num -= VI->second.size();
395     }
396
397     // Make sure that our type is within bounds
398     VI = CurFun.Values.find(Ty);
399     if (VI == CurFun.Values.end()) return 0;
400
401     // Check that the number is within bounds...
402     if (VI->second.size() <= Num) return 0;
403
404     return VI->second[Num];
405   }
406
407   case ValID::NameVal: {                // Is it a named definition?
408     Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
409     if (N == 0) return 0;
410
411     D.destroy();  // Free old strdup'd memory...
412     return N;
413   }
414
415   // Check to make sure that "Ty" is an integral type, and that our
416   // value will fit into the specified type...
417   case ValID::ConstSIntVal:    // Is it a constant pool reference??
418     if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
419       GenerateError("Signed integral constant '" +
420                      itostr(D.ConstPool64) + "' is invalid for type '" +
421                      Ty->getDescription() + "'!");
422       return 0;
423     }
424     return ConstantSInt::get(Ty, D.ConstPool64);
425
426   case ValID::ConstUIntVal:     // Is it an unsigned const pool reference?
427     if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) {
428       if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
429         GenerateError("Integral constant '" + utostr(D.UConstPool64) +
430                        "' is invalid or out of range!");
431         return 0;
432       } else {     // This is really a signed reference.  Transmogrify.
433         return ConstantSInt::get(Ty, D.ConstPool64);
434       }
435     } else {
436       return ConstantUInt::get(Ty, D.UConstPool64);
437     }
438
439   case ValID::ConstFPVal:        // Is it a floating point const pool reference?
440     if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
441       GenerateError("FP constant invalid for type!!");
442       return 0;
443     }
444     return ConstantFP::get(Ty, D.ConstPoolFP);
445
446   case ValID::ConstNullVal:      // Is it a null value?
447     if (!isa<PointerType>(Ty)) {
448       GenerateError("Cannot create a a non pointer null!");
449       return 0;
450     }
451     return ConstantPointerNull::get(cast<PointerType>(Ty));
452
453   case ValID::ConstUndefVal:      // Is it an undef value?
454     return UndefValue::get(Ty);
455
456   case ValID::ConstZeroVal:      // Is it a zero value?
457     return Constant::getNullValue(Ty);
458     
459   case ValID::ConstantVal:       // Fully resolved constant?
460     if (D.ConstantValue->getType() != Ty) {
461       GenerateError("Constant expression type different from required type!");
462       return 0;
463     }
464     return D.ConstantValue;
465
466   case ValID::InlineAsmVal: {    // Inline asm expression
467     const PointerType *PTy = dyn_cast<PointerType>(Ty);
468     const FunctionType *FTy =
469       PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
470     if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
471       GenerateError("Invalid type for asm constraint string!");
472       return 0;
473     }
474     InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
475                                    D.IAD->HasSideEffects);
476     D.destroy();   // Free InlineAsmDescriptor.
477     return IA;
478   }
479   default:
480     assert(0 && "Unhandled case!");
481     return 0;
482   }   // End of switch
483
484   assert(0 && "Unhandled case!");
485   return 0;
486 }
487
488 // getVal - This function is identical to getValNonImprovising, except that if a
489 // value is not already defined, it "improvises" by creating a placeholder var
490 // that looks and acts just like the requested variable.  When the value is
491 // defined later, all uses of the placeholder variable are replaced with the
492 // real thing.
493 //
494 static Value *getVal(const Type *Ty, const ValID &ID) {
495   if (Ty == Type::LabelTy) {
496     GenerateError("Cannot use a basic block here");
497     return 0;
498   }
499
500   // See if the value has already been defined.
501   Value *V = getValNonImprovising(Ty, ID);
502   if (V) return V;
503   if (TriggerError) return 0;
504
505   if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
506     GenerateError("Invalid use of a composite type!");
507     return 0;
508   }
509
510   // If we reached here, we referenced either a symbol that we don't know about
511   // or an id number that hasn't been read yet.  We may be referencing something
512   // forward, so just create an entry to be resolved later and get to it...
513   //
514   V = new Argument(Ty);
515
516   // Remember where this forward reference came from.  FIXME, shouldn't we try
517   // to recycle these things??
518   CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
519                                                                llvmAsmlineno)));
520
521   if (inFunctionScope())
522     InsertValue(V, CurFun.LateResolveValues);
523   else
524     InsertValue(V, CurModule.LateResolveValues);
525   return V;
526 }
527
528 /// getBBVal - This is used for two purposes:
529 ///  * If isDefinition is true, a new basic block with the specified ID is being
530 ///    defined.
531 ///  * If isDefinition is true, this is a reference to a basic block, which may
532 ///    or may not be a forward reference.
533 ///
534 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
535   assert(inFunctionScope() && "Can't get basic block at global scope!");
536
537   std::string Name;
538   BasicBlock *BB = 0;
539   switch (ID.Type) {
540   default: 
541     GenerateError("Illegal label reference " + ID.getName());
542     return 0;
543   case ValID::NumberVal:                // Is it a numbered definition?
544     if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
545       CurFun.NumberedBlocks.resize(ID.Num+1);
546     BB = CurFun.NumberedBlocks[ID.Num];
547     break;
548   case ValID::NameVal:                  // Is it a named definition?
549     Name = ID.Name;
550     if (Value *N = CurFun.CurrentFunction->
551                    getSymbolTable().lookup(Type::LabelTy, Name))
552       BB = cast<BasicBlock>(N);
553     break;
554   }
555
556   // See if the block has already been defined.
557   if (BB) {
558     // If this is the definition of the block, make sure the existing value was
559     // just a forward reference.  If it was a forward reference, there will be
560     // an entry for it in the PlaceHolderInfo map.
561     if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
562       // The existing value was a definition, not a forward reference.
563       GenerateError("Redefinition of label " + ID.getName());
564       return 0;
565     }
566
567     ID.destroy();                       // Free strdup'd memory.
568     return BB;
569   }
570
571   // Otherwise this block has not been seen before.
572   BB = new BasicBlock("", CurFun.CurrentFunction);
573   if (ID.Type == ValID::NameVal) {
574     BB->setName(ID.Name);
575   } else {
576     CurFun.NumberedBlocks[ID.Num] = BB;
577   }
578
579   // If this is not a definition, keep track of it so we can use it as a forward
580   // reference.
581   if (!isDefinition) {
582     // Remember where this forward reference came from.
583     CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
584   } else {
585     // The forward declaration could have been inserted anywhere in the
586     // function: insert it into the correct place now.
587     CurFun.CurrentFunction->getBasicBlockList().remove(BB);
588     CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
589   }
590   ID.destroy();
591   return BB;
592 }
593
594
595 //===----------------------------------------------------------------------===//
596 //              Code to handle forward references in instructions
597 //===----------------------------------------------------------------------===//
598 //
599 // This code handles the late binding needed with statements that reference
600 // values not defined yet... for example, a forward branch, or the PHI node for
601 // a loop body.
602 //
603 // This keeps a table (CurFun.LateResolveValues) of all such forward references
604 // and back patchs after we are done.
605 //
606
607 // ResolveDefinitions - If we could not resolve some defs at parsing
608 // time (forward branches, phi functions for loops, etc...) resolve the
609 // defs now...
610 //
611 static void 
612 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
613                    std::map<const Type*,ValueList> *FutureLateResolvers) {
614   // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
615   for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
616          E = LateResolvers.end(); LRI != E; ++LRI) {
617     ValueList &List = LRI->second;
618     while (!List.empty()) {
619       Value *V = List.back();
620       List.pop_back();
621
622       std::map<Value*, std::pair<ValID, int> >::iterator PHI =
623         CurModule.PlaceHolderInfo.find(V);
624       assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
625
626       ValID &DID = PHI->second.first;
627
628       Value *TheRealValue = getValNonImprovising(LRI->first, DID);
629       if (TriggerError)
630         return;
631       if (TheRealValue) {
632         V->replaceAllUsesWith(TheRealValue);
633         delete V;
634         CurModule.PlaceHolderInfo.erase(PHI);
635       } else if (FutureLateResolvers) {
636         // Functions have their unresolved items forwarded to the module late
637         // resolver table
638         InsertValue(V, *FutureLateResolvers);
639       } else {
640         if (DID.Type == ValID::NameVal) {
641           GenerateError("Reference to an invalid definition: '" +DID.getName()+
642                          "' of type '" + V->getType()->getDescription() + "'",
643                          PHI->second.second);
644           return;
645         } else {
646           GenerateError("Reference to an invalid definition: #" +
647                          itostr(DID.Num) + " of type '" +
648                          V->getType()->getDescription() + "'",
649                          PHI->second.second);
650           return;
651         }
652       }
653     }
654   }
655
656   LateResolvers.clear();
657 }
658
659 // ResolveTypeTo - A brand new type was just declared.  This means that (if
660 // name is not null) things referencing Name can be resolved.  Otherwise, things
661 // refering to the number can be resolved.  Do this now.
662 //
663 static void ResolveTypeTo(char *Name, const Type *ToTy) {
664   ValID D;
665   if (Name) D = ValID::create(Name);
666   else      D = ValID::create((int)CurModule.Types.size());
667
668   std::map<ValID, PATypeHolder>::iterator I =
669     CurModule.LateResolveTypes.find(D);
670   if (I != CurModule.LateResolveTypes.end()) {
671     ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
672     CurModule.LateResolveTypes.erase(I);
673   }
674 }
675
676 // setValueName - Set the specified value to the name given.  The name may be
677 // null potentially, in which case this is a noop.  The string passed in is
678 // assumed to be a malloc'd string buffer, and is free'd by this function.
679 //
680 static void setValueName(Value *V, char *NameStr) {
681   if (NameStr) {
682     std::string Name(NameStr);      // Copy string
683     free(NameStr);                  // Free old string
684
685     if (V->getType() == Type::VoidTy) {
686       GenerateError("Can't assign name '" + Name+"' to value with void type!");
687       return;
688     }
689
690     assert(inFunctionScope() && "Must be in function scope!");
691     SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
692     if (ST.lookup(V->getType(), Name)) {
693       GenerateError("Redefinition of value named '" + Name + "' in the '" +
694                      V->getType()->getDescription() + "' type plane!");
695       return;
696     }
697
698     // Set the name.
699     V->setName(Name);
700   }
701 }
702
703 /// ParseGlobalVariable - Handle parsing of a global.  If Initializer is null,
704 /// this is a declaration, otherwise it is a definition.
705 static GlobalVariable *
706 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
707                     bool isConstantGlobal, const Type *Ty,
708                     Constant *Initializer) {
709   if (isa<FunctionType>(Ty)) {
710     GenerateError("Cannot declare global vars of function type!");
711     return 0;
712   }
713
714   const PointerType *PTy = PointerType::get(Ty);
715
716   std::string Name;
717   if (NameStr) {
718     Name = NameStr;      // Copy string
719     free(NameStr);       // Free old string
720   }
721
722   // See if this global value was forward referenced.  If so, recycle the
723   // object.
724   ValID ID;
725   if (!Name.empty()) {
726     ID = ValID::create((char*)Name.c_str());
727   } else {
728     ID = ValID::create((int)CurModule.Values[PTy].size());
729   }
730
731   if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
732     // Move the global to the end of the list, from whereever it was
733     // previously inserted.
734     GlobalVariable *GV = cast<GlobalVariable>(FWGV);
735     CurModule.CurrentModule->getGlobalList().remove(GV);
736     CurModule.CurrentModule->getGlobalList().push_back(GV);
737     GV->setInitializer(Initializer);
738     GV->setLinkage(Linkage);
739     GV->setConstant(isConstantGlobal);
740     InsertValue(GV, CurModule.Values);
741     return GV;
742   }
743
744   // If this global has a name, check to see if there is already a definition
745   // of this global in the module.  If so, merge as appropriate.  Note that
746   // this is really just a hack around problems in the CFE.  :(
747   if (!Name.empty()) {
748     // We are a simple redefinition of a value, check to see if it is defined
749     // the same as the old one.
750     if (GlobalVariable *EGV =
751                 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
752       // We are allowed to redefine a global variable in two circumstances:
753       // 1. If at least one of the globals is uninitialized or
754       // 2. If both initializers have the same value.
755       //
756       if (!EGV->hasInitializer() || !Initializer ||
757           EGV->getInitializer() == Initializer) {
758
759         // Make sure the existing global version gets the initializer!  Make
760         // sure that it also gets marked const if the new version is.
761         if (Initializer && !EGV->hasInitializer())
762           EGV->setInitializer(Initializer);
763         if (isConstantGlobal)
764           EGV->setConstant(true);
765         EGV->setLinkage(Linkage);
766         return EGV;
767       }
768
769       GenerateError("Redefinition of global variable named '" + Name +
770                      "' in the '" + Ty->getDescription() + "' type plane!");
771       return 0;
772     }
773   }
774
775   // Otherwise there is no existing GV to use, create one now.
776   GlobalVariable *GV =
777     new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
778                        CurModule.CurrentModule);
779   InsertValue(GV, CurModule.Values);
780   return GV;
781 }
782
783 // setTypeName - Set the specified type to the name given.  The name may be
784 // null potentially, in which case this is a noop.  The string passed in is
785 // assumed to be a malloc'd string buffer, and is freed by this function.
786 //
787 // This function returns true if the type has already been defined, but is
788 // allowed to be redefined in the specified context.  If the name is a new name
789 // for the type plane, it is inserted and false is returned.
790 static bool setTypeName(const Type *T, char *NameStr) {
791   assert(!inFunctionScope() && "Can't give types function-local names!");
792   if (NameStr == 0) return false;
793  
794   std::string Name(NameStr);      // Copy string
795   free(NameStr);                  // Free old string
796
797   // We don't allow assigning names to void type
798   if (T == Type::VoidTy) {
799     GenerateError("Can't assign name '" + Name + "' to the void type!");
800     return false;
801   }
802
803   // Set the type name, checking for conflicts as we do so.
804   bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
805
806   if (AlreadyExists) {   // Inserting a name that is already defined???
807     const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
808     assert(Existing && "Conflict but no matching type?");
809
810     // There is only one case where this is allowed: when we are refining an
811     // opaque type.  In this case, Existing will be an opaque type.
812     if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
813       // We ARE replacing an opaque type!
814       const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
815       return true;
816     }
817
818     // Otherwise, this is an attempt to redefine a type. That's okay if
819     // the redefinition is identical to the original. This will be so if
820     // Existing and T point to the same Type object. In this one case we
821     // allow the equivalent redefinition.
822     if (Existing == T) return true;  // Yes, it's equal.
823
824     // Any other kind of (non-equivalent) redefinition is an error.
825     GenerateError("Redefinition of type named '" + Name + "' in the '" +
826                    T->getDescription() + "' type plane!");
827   }
828
829   return false;
830 }
831
832 //===----------------------------------------------------------------------===//
833 // Code for handling upreferences in type names...
834 //
835
836 // TypeContains - Returns true if Ty directly contains E in it.
837 //
838 static bool TypeContains(const Type *Ty, const Type *E) {
839   return std::find(Ty->subtype_begin(), Ty->subtype_end(),
840                    E) != Ty->subtype_end();
841 }
842
843 namespace {
844   struct UpRefRecord {
845     // NestingLevel - The number of nesting levels that need to be popped before
846     // this type is resolved.
847     unsigned NestingLevel;
848
849     // LastContainedTy - This is the type at the current binding level for the
850     // type.  Every time we reduce the nesting level, this gets updated.
851     const Type *LastContainedTy;
852
853     // UpRefTy - This is the actual opaque type that the upreference is
854     // represented with.
855     OpaqueType *UpRefTy;
856
857     UpRefRecord(unsigned NL, OpaqueType *URTy)
858       : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
859   };
860 }
861
862 // UpRefs - A list of the outstanding upreferences that need to be resolved.
863 static std::vector<UpRefRecord> UpRefs;
864
865 /// HandleUpRefs - Every time we finish a new layer of types, this function is
866 /// called.  It loops through the UpRefs vector, which is a list of the
867 /// currently active types.  For each type, if the up reference is contained in
868 /// the newly completed type, we decrement the level count.  When the level
869 /// count reaches zero, the upreferenced type is the type that is passed in:
870 /// thus we can complete the cycle.
871 ///
872 static PATypeHolder HandleUpRefs(const Type *ty) {
873   // If Ty isn't abstract, or if there are no up-references in it, then there is
874   // nothing to resolve here.
875   if (!ty->isAbstract() || UpRefs.empty()) return ty;
876   
877   PATypeHolder Ty(ty);
878   UR_OUT("Type '" << Ty->getDescription() <<
879          "' newly formed.  Resolving upreferences.\n" <<
880          UpRefs.size() << " upreferences active!\n");
881
882   // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
883   // to zero), we resolve them all together before we resolve them to Ty.  At
884   // the end of the loop, if there is anything to resolve to Ty, it will be in
885   // this variable.
886   OpaqueType *TypeToResolve = 0;
887
888   for (unsigned i = 0; i != UpRefs.size(); ++i) {
889     UR_OUT("  UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
890            << UpRefs[i].second->getDescription() << ") = "
891            << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
892     if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
893       // Decrement level of upreference
894       unsigned Level = --UpRefs[i].NestingLevel;
895       UpRefs[i].LastContainedTy = Ty;
896       UR_OUT("  Uplevel Ref Level = " << Level << "\n");
897       if (Level == 0) {                     // Upreference should be resolved!
898         if (!TypeToResolve) {
899           TypeToResolve = UpRefs[i].UpRefTy;
900         } else {
901           UR_OUT("  * Resolving upreference for "
902                  << UpRefs[i].second->getDescription() << "\n";
903                  std::string OldName = UpRefs[i].UpRefTy->getDescription());
904           UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
905           UR_OUT("  * Type '" << OldName << "' refined upreference to: "
906                  << (const void*)Ty << ", " << Ty->getDescription() << "\n");
907         }
908         UpRefs.erase(UpRefs.begin()+i);     // Remove from upreference list...
909         --i;                                // Do not skip the next element...
910       }
911     }
912   }
913
914   if (TypeToResolve) {
915     UR_OUT("  * Resolving upreference for "
916            << UpRefs[i].second->getDescription() << "\n";
917            std::string OldName = TypeToResolve->getDescription());
918     TypeToResolve->refineAbstractTypeTo(Ty);
919   }
920
921   return Ty;
922 }
923
924
925 // common code from the two 'RunVMAsmParser' functions
926 static Module* RunParser(Module * M) {
927
928   llvmAsmlineno = 1;      // Reset the current line number...
929   ObsoleteVarArgs = false;
930   NewVarArgs = false;
931   CurModule.CurrentModule = M;
932
933   // Check to make sure the parser succeeded
934   if (yyparse()) {
935     if (ParserResult)
936       delete ParserResult;
937     return 0;
938   }
939
940   // Check to make sure that parsing produced a result
941   if (!ParserResult)
942     return 0;
943
944   // Reset ParserResult variable while saving its value for the result.
945   Module *Result = ParserResult;
946   ParserResult = 0;
947
948   //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
949   {
950     Function* F;
951     if ((F = Result->getNamedFunction("llvm.va_start"))
952         && F->getFunctionType()->getNumParams() == 0)
953       ObsoleteVarArgs = true;
954     if((F = Result->getNamedFunction("llvm.va_copy"))
955        && F->getFunctionType()->getNumParams() == 1)
956       ObsoleteVarArgs = true;
957   }
958
959   if (ObsoleteVarArgs && NewVarArgs) {
960     GenerateError(
961       "This file is corrupt: it uses both new and old style varargs");
962     return 0;
963   }
964
965   if(ObsoleteVarArgs) {
966     if(Function* F = Result->getNamedFunction("llvm.va_start")) {
967       if (F->arg_size() != 0) {
968         GenerateError("Obsolete va_start takes 0 argument!");
969         return 0;
970       }
971       
972       //foo = va_start()
973       // ->
974       //bar = alloca typeof(foo)
975       //va_start(bar)
976       //foo = load bar
977
978       const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
979       const Type* ArgTy = F->getFunctionType()->getReturnType();
980       const Type* ArgTyPtr = PointerType::get(ArgTy);
981       Function* NF = Result->getOrInsertFunction("llvm.va_start", 
982                                                  RetTy, ArgTyPtr, (Type *)0);
983
984       while (!F->use_empty()) {
985         CallInst* CI = cast<CallInst>(F->use_back());
986         AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
987         new CallInst(NF, bar, "", CI);
988         Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
989         CI->replaceAllUsesWith(foo);
990         CI->getParent()->getInstList().erase(CI);
991       }
992       Result->getFunctionList().erase(F);
993     }
994     
995     if(Function* F = Result->getNamedFunction("llvm.va_end")) {
996       if(F->arg_size() != 1) {
997         GenerateError("Obsolete va_end takes 1 argument!");
998         return 0;
999       }
1000
1001       //vaend foo
1002       // ->
1003       //bar = alloca 1 of typeof(foo)
1004       //vaend bar
1005       const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1006       const Type* ArgTy = F->getFunctionType()->getParamType(0);
1007       const Type* ArgTyPtr = PointerType::get(ArgTy);
1008       Function* NF = Result->getOrInsertFunction("llvm.va_end", 
1009                                                  RetTy, ArgTyPtr, (Type *)0);
1010
1011       while (!F->use_empty()) {
1012         CallInst* CI = cast<CallInst>(F->use_back());
1013         AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1014         new StoreInst(CI->getOperand(1), bar, CI);
1015         new CallInst(NF, bar, "", CI);
1016         CI->getParent()->getInstList().erase(CI);
1017       }
1018       Result->getFunctionList().erase(F);
1019     }
1020
1021     if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1022       if(F->arg_size() != 1) {
1023         GenerateError("Obsolete va_copy takes 1 argument!");
1024         return 0;
1025       }
1026       //foo = vacopy(bar)
1027       // ->
1028       //a = alloca 1 of typeof(foo)
1029       //b = alloca 1 of typeof(foo)
1030       //store bar -> b
1031       //vacopy(a, b)
1032       //foo = load a
1033       
1034       const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1035       const Type* ArgTy = F->getFunctionType()->getReturnType();
1036       const Type* ArgTyPtr = PointerType::get(ArgTy);
1037       Function* NF = Result->getOrInsertFunction("llvm.va_copy", 
1038                                                  RetTy, ArgTyPtr, ArgTyPtr,
1039                                                  (Type *)0);
1040
1041       while (!F->use_empty()) {
1042         CallInst* CI = cast<CallInst>(F->use_back());
1043         AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1044         AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1045         new StoreInst(CI->getOperand(1), b, CI);
1046         new CallInst(NF, a, b, "", CI);
1047         Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1048         CI->replaceAllUsesWith(foo);
1049         CI->getParent()->getInstList().erase(CI);
1050       }
1051       Result->getFunctionList().erase(F);
1052     }
1053   }
1054
1055   return Result;
1056 }
1057
1058 //===----------------------------------------------------------------------===//
1059 //            RunVMAsmParser - Define an interface to this parser
1060 //===----------------------------------------------------------------------===//
1061 //
1062 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1063   set_scan_file(F);
1064
1065   CurFilename = Filename;
1066   return RunParser(new Module(CurFilename));
1067 }
1068
1069 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1070   set_scan_string(AsmString);
1071
1072   CurFilename = "from_memory";
1073   if (M == NULL) {
1074     return RunParser(new Module (CurFilename));
1075   } else {
1076     return RunParser(M);
1077   }
1078 }
1079
1080
1081 #line 974 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
1082 typedef union {
1083   llvm::Module                           *ModuleVal;
1084   llvm::Function                         *FunctionVal;
1085   std::pair<llvm::PATypeHolder*, char*>  *ArgVal;
1086   llvm::BasicBlock                       *BasicBlockVal;
1087   llvm::TerminatorInst                   *TermInstVal;
1088   llvm::Instruction                      *InstVal;
1089   llvm::Constant                         *ConstVal;
1090
1091   const llvm::Type                       *PrimType;
1092   llvm::PATypeHolder                     *TypeVal;
1093   llvm::Value                            *ValueVal;
1094
1095   std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1096   std::vector<llvm::Value*>              *ValueList;
1097   std::list<llvm::PATypeHolder>          *TypeList;
1098   // Represent the RHS of PHI node
1099   std::list<std::pair<llvm::Value*,
1100                       llvm::BasicBlock*> > *PHIList;
1101   std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1102   std::vector<llvm::Constant*>           *ConstVector;
1103
1104   llvm::GlobalValue::LinkageTypes         Linkage;
1105   int64_t                           SInt64Val;
1106   uint64_t                          UInt64Val;
1107   int                               SIntVal;
1108   unsigned                          UIntVal;
1109   double                            FPVal;
1110   bool                              BoolVal;
1111
1112   char                             *StrVal;   // This memory is strdup'd!
1113   llvm::ValID                             ValIDVal; // strdup'd memory maybe!
1114
1115   llvm::Instruction::BinaryOps            BinaryOpVal;
1116   llvm::Instruction::TermOps              TermOpVal;
1117   llvm::Instruction::MemoryOps            MemOpVal;
1118   llvm::Instruction::OtherOps             OtherOpVal;
1119   llvm::Module::Endianness                Endianness;
1120 } YYSTYPE;
1121 #include <stdio.h>
1122
1123 #ifndef __cplusplus
1124 #ifndef __STDC__
1125 #define const
1126 #endif
1127 #endif
1128
1129
1130
1131 #define YYFINAL         517
1132 #define YYFLAG          -32768
1133 #define YYNTBASE        123
1134
1135 #define YYTRANSLATE(x) ((unsigned)(x) <= 362 ? yytranslate[x] : 197)
1136
1137 static const char yytranslate[] = {     0,
1138      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1139      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1140      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1141      2,     2,     2,     2,     2,     2,     2,     2,     2,   112,
1142    113,   121,     2,   110,     2,     2,     2,     2,     2,     2,
1143      2,     2,     2,     2,     2,     2,     2,     2,     2,   117,
1144    109,   118,     2,     2,     2,     2,     2,     2,     2,     2,
1145      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1146      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1147    114,   111,   116,     2,     2,     2,     2,     2,   122,     2,
1148      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1149      2,     2,     2,     2,     2,     2,     2,     2,     2,   115,
1150      2,     2,   119,     2,   120,     2,     2,     2,     2,     2,
1151      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1152      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1153      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1154      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1155      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1156      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1157      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1158      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1159      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1160      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1161      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1162      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1163      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
1164      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
1165     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
1166     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
1167     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
1168     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
1169     57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1170     67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
1171     77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
1172     87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
1173     97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
1174    107,   108
1175 };
1176
1177 #if YYDEBUG != 0
1178 static const short yyprhs[] = {     0,
1179      0,     2,     4,     6,     8,    10,    12,    14,    16,    18,
1180     20,    22,    24,    26,    28,    30,    32,    34,    36,    38,
1181     40,    42,    44,    46,    48,    50,    52,    54,    56,    58,
1182     60,    62,    64,    67,    68,    70,    72,    74,    76,    78,
1183     80,    82,    83,    84,    86,    88,    90,    92,    94,    96,
1184     99,   100,   103,   104,   108,   111,   112,   114,   115,   119,
1185    121,   124,   126,   128,   130,   132,   134,   136,   138,   140,
1186    142,   144,   146,   148,   150,   152,   154,   156,   158,   160,
1187    162,   164,   166,   169,   174,   180,   186,   190,   193,   196,
1188    198,   202,   204,   208,   210,   211,   216,   220,   224,   229,
1189    234,   238,   241,   244,   247,   250,   253,   256,   259,   262,
1190    265,   268,   275,   281,   290,   297,   304,   311,   318,   325,
1191    334,   343,   347,   349,   351,   353,   355,   358,   361,   366,
1192    369,   371,   376,   379,   384,   385,   393,   394,   402,   403,
1193    411,   412,   420,   424,   429,   430,   432,   434,   436,   440,
1194    444,   448,   452,   456,   460,   462,   463,   465,   467,   469,
1195    470,   473,   477,   479,   481,   485,   487,   488,   497,   499,
1196    501,   505,   507,   509,   512,   513,   515,   517,   518,   523,
1197    524,   526,   528,   530,   532,   534,   536,   538,   540,   542,
1198    546,   548,   554,   556,   558,   560,   562,   565,   568,   571,
1199    575,   578,   579,   581,   584,   587,   591,   601,   611,   620,
1200    634,   636,   638,   645,   651,   654,   661,   669,   671,   675,
1201    677,   678,   681,   683,   689,   695,   701,   704,   709,   714,
1202    721,   726,   731,   736,   741,   748,   755,   758,   766,   768,
1203    771,   772,   774,   775,   779,   786,   790,   797,   800,   805,
1204    812
1205 };
1206
1207 static const short yyrhs[] = {     5,
1208      0,     6,     0,     3,     0,     4,     0,    78,     0,    79,
1209      0,    80,     0,    81,     0,    82,     0,    83,     0,    84,
1210      0,    85,     0,    86,     0,    87,     0,    88,     0,    89,
1211      0,    90,     0,    91,     0,   101,     0,   102,     0,    16,
1212      0,    14,     0,    12,     0,    10,     0,    17,     0,    15,
1213      0,    13,     0,    11,     0,   129,     0,   130,     0,    18,
1214      0,    19,     0,   165,   109,     0,     0,    41,     0,    42,
1215      0,    43,     0,    44,     0,    45,     0,    46,     0,    47,
1216      0,     0,     0,    65,     0,    66,     0,    67,     0,    68,
1217      0,    69,     0,    70,     0,    64,     4,     0,     0,    57,
1218      4,     0,     0,   110,    57,     4,     0,    34,    24,     0,
1219      0,   138,     0,     0,   110,   141,   140,     0,   138,     0,
1220     57,     4,     0,   144,     0,     8,     0,   146,     0,     8,
1221      0,   146,     0,     9,     0,    10,     0,    11,     0,    12,
1222      0,    13,     0,    14,     0,    15,     0,    16,     0,    17,
1223      0,    18,     0,    19,     0,    20,     0,    21,     0,    48,
1224      0,   145,     0,   180,     0,   111,     4,     0,   143,   112,
1225    148,   113,     0,   114,     4,   115,   146,   116,     0,   117,
1226      4,   115,   146,   118,     0,   119,   147,   120,     0,   119,
1227    120,     0,   146,   121,     0,   146,     0,   147,   110,   146,
1228      0,   147,     0,   147,   110,    37,     0,    37,     0,     0,
1229    144,   114,   151,   116,     0,   144,   114,   116,     0,   144,
1230    122,    24,     0,   144,   117,   151,   118,     0,   144,   119,
1231    151,   120,     0,   144,   119,   120,     0,   144,    38,     0,
1232    144,    39,     0,   144,   180,     0,   144,   150,     0,   144,
1233     26,     0,   129,   124,     0,   130,     4,     0,     9,    27,
1234      0,     9,    28,     0,   132,     7,     0,    99,   112,   149,
1235     36,   144,   113,     0,    97,   112,   149,   194,   113,     0,
1236    100,   112,   149,   110,   149,   110,   149,   113,     0,   125,
1237    112,   149,   110,   149,   113,     0,   126,   112,   149,   110,
1238    149,   113,     0,   127,   112,   149,   110,   149,   113,     0,
1239    128,   112,   149,   110,   149,   113,     0,   104,   112,   149,
1240    110,   149,   113,     0,   105,   112,   149,   110,   149,   110,
1241    149,   113,     0,   106,   112,   149,   110,   149,   110,   149,
1242    113,     0,   151,   110,   149,     0,   149,     0,    32,     0,
1243     33,     0,   154,     0,   154,   174,     0,   154,   176,     0,
1244    154,    62,    61,   160,     0,   154,    25,     0,   155,     0,
1245    155,   133,    20,   142,     0,   155,   176,     0,   155,    62,
1246     61,   160,     0,     0,   155,   133,   134,   152,   149,   156,
1247    140,     0,     0,   155,   133,    50,   152,   144,   157,   140,
1248      0,     0,   155,   133,    45,   152,   144,   158,   140,     0,
1249      0,   155,   133,    47,   152,   144,   159,   140,     0,   155,
1250     51,   162,     0,   155,    58,   109,   163,     0,     0,    24,
1251      0,    56,     0,    55,     0,    53,   109,   161,     0,    54,
1252    109,     4,     0,    52,   109,    24,     0,    71,   109,    24,
1253      0,   114,   164,   116,     0,   164,   110,    24,     0,    24,
1254      0,     0,    22,     0,    24,     0,   165,     0,     0,   144,
1255    166,     0,   168,   110,   167,     0,   167,     0,   168,     0,
1256    168,   110,    37,     0,    37,     0,     0,   135,   142,   165,
1257    112,   169,   113,   139,   136,     0,    29,     0,   119,     0,
1258    134,   170,   171,     0,    30,     0,   120,     0,   183,   173,
1259      0,     0,    45,     0,    47,     0,     0,    31,   177,   175,
1260    170,     0,     0,    63,     0,     3,     0,     4,     0,     7,
1261      0,    27,     0,    28,     0,    38,     0,    39,     0,    26,
1262      0,   117,   151,   118,     0,   150,     0,    61,   178,    24,
1263    110,    24,     0,   123,     0,   165,     0,   180,     0,   179,
1264      0,   144,   181,     0,   183,   184,     0,   172,   184,     0,
1265    185,   133,   186,     0,   185,   188,     0,     0,    23,     0,
1266     72,   182,     0,    72,     8,     0,    73,    21,   181,     0,
1267     73,     9,   181,   110,    21,   181,   110,    21,   181,     0,
1268     74,   131,   181,   110,    21,   181,   114,   187,   116,     0,
1269     74,   131,   181,   110,    21,   181,   114,   116,     0,    75,
1270    135,   142,   181,   112,   191,   113,    36,    21,   181,    76,
1271     21,   181,     0,    76,     0,    77,     0,   187,   131,   179,
1272    110,    21,   181,     0,   131,   179,   110,    21,   181,     0,
1273    133,   193,     0,   144,   114,   181,   110,   181,   116,     0,
1274    189,   110,   114,   181,   110,   181,   116,     0,   182,     0,
1275    190,   110,   182,     0,   190,     0,     0,    60,    59,     0,
1276     59,     0,   125,   144,   181,   110,   181,     0,   126,   144,
1277    181,   110,   181,     0,   127,   144,   181,   110,   181,     0,
1278     49,   182,     0,   128,   182,   110,   182,     0,    99,   182,
1279     36,   144,     0,   100,   182,   110,   182,   110,   182,     0,
1280    103,   182,   110,   144,     0,   107,   182,   110,   144,     0,
1281    108,   182,   110,   144,     0,   104,   182,   110,   182,     0,
1282    105,   182,   110,   182,   110,   182,     0,   106,   182,   110,
1283    182,   110,   182,     0,    98,   189,     0,   192,   135,   142,
1284    181,   112,   191,   113,     0,   196,     0,   110,   190,     0,
1285      0,    35,     0,     0,    92,   144,   137,     0,    92,   144,
1286    110,    15,   181,   137,     0,    93,   144,   137,     0,    93,
1287    144,   110,    15,   181,   137,     0,    94,   182,     0,   195,
1288     95,   144,   181,     0,   195,    96,   182,   110,   144,   181,
1289      0,    97,   144,   181,   194,     0
1290 };
1291
1292 #endif
1293
1294 #if YYDEBUG != 0
1295 static const short yyrline[] = { 0,
1296   1097,  1098,  1106,  1107,  1117,  1117,  1117,  1117,  1117,  1118,
1297   1118,  1118,  1119,  1119,  1119,  1119,  1119,  1119,  1121,  1121,
1298   1125,  1125,  1125,  1125,  1126,  1126,  1126,  1126,  1127,  1127,
1299   1128,  1128,  1131,  1135,  1140,  1140,  1141,  1142,  1143,  1144,
1300   1145,  1146,  1149,  1149,  1150,  1151,  1152,  1153,  1154,  1155,
1301   1165,  1165,  1172,  1172,  1181,  1189,  1189,  1195,  1195,  1197,
1302   1202,  1216,  1216,  1217,  1217,  1219,  1229,  1229,  1229,  1229,
1303   1229,  1229,  1229,  1230,  1230,  1230,  1230,  1230,  1230,  1231,
1304   1235,  1239,  1247,  1255,  1268,  1273,  1285,  1295,  1299,  1310,
1305   1315,  1321,  1322,  1326,  1330,  1341,  1367,  1381,  1411,  1437,
1306   1458,  1471,  1481,  1486,  1547,  1554,  1563,  1569,  1575,  1579,
1307   1583,  1591,  1602,  1634,  1642,  1664,  1675,  1681,  1689,  1695,
1308   1701,  1710,  1714,  1722,  1722,  1732,  1740,  1745,  1749,  1753,
1309   1757,  1772,  1794,  1797,  1800,  1805,  1808,  1812,  1816,  1820,
1310   1824,  1829,  1833,  1836,  1839,  1843,  1856,  1857,  1859,  1863,
1311   1872,  1877,  1883,  1885,  1890,  1895,  1904,  1904,  1905,  1905,
1312   1907,  1914,  1920,  1927,  1931,  1937,  1942,  1947,  2042,  2042,
1313   2044,  2052,  2052,  2054,  2059,  2059,  2060,  2063,  2063,  2073,
1314   2077,  2082,  2086,  2090,  2094,  2098,  2102,  2106,  2110,  2114,
1315   2139,  2143,  2157,  2161,  2167,  2167,  2173,  2178,  2182,  2191,
1316   2202,  2207,  2219,  2232,  2236,  2240,  2245,  2254,  2273,  2282,
1317   2338,  2342,  2349,  2360,  2373,  2382,  2391,  2401,  2405,  2412,
1318   2412,  2414,  2418,  2423,  2439,  2454,  2468,  2481,  2489,  2497,
1319   2505,  2511,  2531,  2554,  2560,  2566,  2572,  2587,  2646,  2653,
1320   2656,  2661,  2665,  2672,  2677,  2683,  2688,  2694,  2702,  2714,
1321   2729
1322 };
1323 #endif
1324
1325
1326 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1327
1328 static const char * const yytname[] = {   "$","error","$undefined.","ESINT64VAL",
1329 "EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT",
1330 "USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID",
1331 "LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK",
1332 "BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO",
1333 "DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING",
1334 "DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE",
1335 "ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK",
1336 "MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK","COLDCC_TOK",
1337 "X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATA","RET","BR","SWITCH","INVOKE",
1338 "UNWIND","UNREACHABLE","ADD","SUB","MUL","DIV","REM","AND","OR","XOR","SETLE",
1339 "SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE",
1340 "GETELEMENTPTR","PHI_TOK","CAST","SELECT","SHL","SHR","VAARG","EXTRACTELEMENT",
1341 "INSERTELEMENT","SHUFFLEVECTOR","VAARG_old","VANEXT_old","'='","','","'\\\\'",
1342 "'('","')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'*'","'c'","INTVAL","EINT64VAL",
1343 "ArithmeticOps","LogicalOps","SetCondOps","ShiftOps","SIntType","UIntType","IntType",
1344 "FPType","OptAssign","OptLinkage","OptCallingConv","OptAlign","OptCAlign","SectionString",
1345 "OptSection","GlobalVarAttributes","GlobalVarAttribute","TypesV","UpRTypesV",
1346 "Types","PrimType","UpRTypes","TypeListI","ArgTypeListI","ConstVal","ConstExpr",
1347 "ConstVector","GlobalType","Module","FunctionList","ConstPool","@1","@2","@3",
1348 "@4","AsmBlock","BigOrLittle","TargetDefinition","LibrariesDefinition","LibList",
1349 "Name","OptName","ArgVal","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader",
1350 "END","Function","FnDeclareLinkage","FunctionProto","@5","OptSideEffect","ConstValueRef",
1351 "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
1352 "BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","ValueRefListE",
1353 "OptTailCall","InstVal","IndexList","OptVolatile","MemoryInst", NULL
1354 };
1355 #endif
1356
1357 static const short yyr1[] = {     0,
1358    123,   123,   124,   124,   125,   125,   125,   125,   125,   126,
1359    126,   126,   127,   127,   127,   127,   127,   127,   128,   128,
1360    129,   129,   129,   129,   130,   130,   130,   130,   131,   131,
1361    132,   132,   133,   133,   134,   134,   134,   134,   134,   134,
1362    134,   134,   135,   135,   135,   135,   135,   135,   135,   135,
1363    136,   136,   137,   137,   138,   139,   139,   140,   140,   141,
1364    141,   142,   142,   143,   143,   144,   145,   145,   145,   145,
1365    145,   145,   145,   145,   145,   145,   145,   145,   145,   146,
1366    146,   146,   146,   146,   146,   146,   146,   146,   146,   147,
1367    147,   148,   148,   148,   148,   149,   149,   149,   149,   149,
1368    149,   149,   149,   149,   149,   149,   149,   149,   149,   149,
1369    149,   150,   150,   150,   150,   150,   150,   150,   150,   150,
1370    150,   151,   151,   152,   152,   153,   154,   154,   154,   154,
1371    154,   155,   155,   155,   156,   155,   157,   155,   158,   155,
1372    159,   155,   155,   155,   155,   160,   161,   161,   162,   162,
1373    162,   162,   163,   164,   164,   164,   165,   165,   166,   166,
1374    167,   168,   168,   169,   169,   169,   169,   170,   171,   171,
1375    172,   173,   173,   174,   175,   175,   175,   177,   176,   178,
1376    178,   179,   179,   179,   179,   179,   179,   179,   179,   179,
1377    179,   179,   180,   180,   181,   181,   182,   183,   183,   184,
1378    185,   185,   185,   186,   186,   186,   186,   186,   186,   186,
1379    186,   186,   187,   187,   188,   189,   189,   190,   190,   191,
1380    191,   192,   192,   193,   193,   193,   193,   193,   193,   193,
1381    193,   193,   193,   193,   193,   193,   193,   193,   193,   194,
1382    194,   195,   195,   196,   196,   196,   196,   196,   196,   196,
1383    196
1384 };
1385
1386 static const short yyr2[] = {     0,
1387      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1388      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1389      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1390      1,     1,     2,     0,     1,     1,     1,     1,     1,     1,
1391      1,     0,     0,     1,     1,     1,     1,     1,     1,     2,
1392      0,     2,     0,     3,     2,     0,     1,     0,     3,     1,
1393      2,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1394      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1395      1,     1,     2,     4,     5,     5,     3,     2,     2,     1,
1396      3,     1,     3,     1,     0,     4,     3,     3,     4,     4,
1397      3,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1398      2,     6,     5,     8,     6,     6,     6,     6,     6,     8,
1399      8,     3,     1,     1,     1,     1,     2,     2,     4,     2,
1400      1,     4,     2,     4,     0,     7,     0,     7,     0,     7,
1401      0,     7,     3,     4,     0,     1,     1,     1,     3,     3,
1402      3,     3,     3,     3,     1,     0,     1,     1,     1,     0,
1403      2,     3,     1,     1,     3,     1,     0,     8,     1,     1,
1404      3,     1,     1,     2,     0,     1,     1,     0,     4,     0,
1405      1,     1,     1,     1,     1,     1,     1,     1,     1,     3,
1406      1,     5,     1,     1,     1,     1,     2,     2,     2,     3,
1407      2,     0,     1,     2,     2,     3,     9,     9,     8,    13,
1408      1,     1,     6,     5,     2,     6,     7,     1,     3,     1,
1409      0,     2,     1,     5,     5,     5,     2,     4,     4,     6,
1410      4,     4,     4,     4,     6,     6,     2,     7,     1,     2,
1411      0,     1,     0,     3,     6,     3,     6,     2,     4,     6,
1412      4
1413 };
1414
1415 static const short yydefact[] = {   145,
1416     42,   131,   130,   178,    35,    36,    37,    38,    39,    40,
1417     41,     0,    43,   202,   127,   128,   202,   157,   158,     0,
1418      0,     0,    42,     0,   133,   175,     0,     0,    44,    45,
1419     46,    47,    48,    49,     0,     0,   203,   199,    34,   172,
1420    173,   174,   198,     0,     0,     0,     0,   143,     0,     0,
1421      0,     0,     0,     0,     0,    33,   176,   177,    43,   146,
1422    129,    50,     1,     2,    63,    67,    68,    69,    70,    71,
1423     72,    73,    74,    75,    76,    77,    78,    79,    80,     0,
1424      0,     0,     0,   193,     0,     0,    62,    81,    66,   194,
1425     82,   169,   170,   171,   243,   201,     0,     0,     0,     0,
1426    156,   144,   134,   132,   124,   125,     0,     0,     0,     0,
1427    179,    83,     0,     0,    65,    88,    90,     0,     0,    95,
1428     89,   242,     0,   223,     0,     0,     0,     0,    43,   211,
1429    212,     5,     6,     7,     8,     9,    10,    11,    12,    13,
1430     14,    15,    16,    17,    18,     0,     0,     0,     0,     0,
1431      0,     0,    19,    20,     0,     0,     0,     0,     0,     0,
1432      0,     0,     0,     0,   200,    43,   215,     0,   239,   151,
1433    148,   147,   149,   150,   152,   155,     0,   139,   141,   137,
1434     67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
1435     77,     0,     0,     0,     0,   135,     0,     0,     0,    87,
1436    167,    94,    92,     0,     0,   227,   222,   205,   204,     0,
1437      0,    24,    28,    23,    27,    22,    26,    21,    25,    29,
1438     30,     0,     0,    53,    53,   248,     0,     0,   237,     0,
1439      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1440      0,     0,     0,     0,     0,   153,    58,    58,    58,   109,
1441    110,     3,     4,   107,   108,   111,   106,   102,   103,     0,
1442      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1443      0,     0,     0,   105,   104,    58,    64,    64,    91,   166,
1444    160,   163,   164,     0,     0,    84,   182,   183,   184,   189,
1445    185,   186,   187,   188,   180,     0,   191,   196,   195,   197,
1446      0,   206,     0,     0,     0,   244,     0,   246,   241,     0,
1447      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1448      0,     0,     0,     0,     0,     0,   154,     0,   140,   142,
1449    138,     0,     0,     0,     0,     0,     0,    97,   123,     0,
1450      0,   101,     0,    98,     0,     0,     0,     0,   136,    85,
1451     86,   159,   161,     0,    56,    93,   181,     0,     0,     0,
1452      0,     0,     0,     0,     0,     0,   251,     0,     0,   229,
1453      0,   231,   234,     0,     0,   232,   233,     0,     0,     0,
1454    228,     0,   249,     0,     0,     0,    60,    58,   241,     0,
1455      0,     0,     0,     0,     0,    96,    99,   100,     0,     0,
1456      0,     0,   165,   162,    57,    51,     0,   190,     0,     0,
1457    221,    53,    54,    53,   218,   240,     0,     0,     0,     0,
1458      0,   224,   225,   226,   221,     0,    55,    61,    59,     0,
1459      0,     0,     0,     0,     0,   122,     0,     0,     0,     0,
1460      0,   168,     0,     0,     0,   220,     0,     0,   245,   247,
1461      0,     0,     0,   230,   235,   236,     0,   250,   113,     0,
1462      0,     0,     0,     0,     0,     0,     0,     0,    52,   192,
1463      0,     0,     0,   219,   216,     0,   238,   112,     0,   119,
1464      0,     0,   115,   116,   117,   118,     0,   209,     0,     0,
1465      0,   217,     0,     0,     0,   207,     0,   208,     0,     0,
1466    114,   120,   121,     0,     0,     0,     0,     0,     0,   214,
1467      0,     0,   213,   210,     0,     0,     0
1468 };
1469
1470 static const short yydefgoto[] = {    84,
1471    254,   270,   271,   272,   273,   192,   193,   222,   194,    23,
1472     13,    35,   442,   306,   387,   406,   329,   388,    85,    86,
1473    195,    88,    89,   118,   204,   339,   297,   340,   107,   515,
1474      1,     2,   276,   249,   247,   248,    61,   173,    48,   102,
1475    177,    90,   353,   282,   283,   284,    36,    94,    14,    42,
1476     15,    59,    16,    26,   358,   298,    91,   300,   415,    17,
1477     38,    39,   165,   490,    96,   229,   446,   447,   166,   167,
1478    367,   168,   169
1479 };
1480
1481 static const short yypact[] = {-32768,
1482    118,   605,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1483 -32768,   -46,   131,    10,-32768,-32768,   -18,-32768,-32768,    29,
1484    -69,    58,    51,   -19,-32768,   106,   114,   144,-32768,-32768,
1485 -32768,-32768,-32768,-32768,  1060,   -20,-32768,-32768,   130,-32768,
1486 -32768,-32768,-32768,    80,    81,    83,    94,-32768,    57,   114,
1487   1060,    44,    44,    44,    44,-32768,-32768,-32768,   131,-32768,
1488 -32768,-32768,-32768,-32768,    90,-32768,-32768,-32768,-32768,-32768,
1489 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   200,
1490    201,   202,   572,-32768,   130,    99,-32768,-32768,   -34,-32768,
1491 -32768,-32768,-32768,-32768,  1231,-32768,   191,    77,   212,   193,
1492    194,-32768,-32768,-32768,-32768,-32768,  1101,  1101,  1101,  1142,
1493 -32768,-32768,   104,   107,-32768,-32768,   -34,   -74,   109,   852,
1494 -32768,-32768,  1101,-32768,   165,  1183,    30,    93,   131,-32768,
1495 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1496 -32768,-32768,-32768,-32768,-32768,  1101,  1101,  1101,  1101,  1101,
1497   1101,  1101,-32768,-32768,  1101,  1101,  1101,  1101,  1101,  1101,
1498   1101,  1101,  1101,  1101,-32768,   131,-32768,    62,-32768,-32768,
1499 -32768,-32768,-32768,-32768,-32768,-32768,   -72,-32768,-32768,-32768,
1500    142,   170,   221,   173,   222,   175,   223,   178,   224,   231,
1501    232,   183,   225,   233,   425,-32768,  1101,  1101,  1101,-32768,
1502    893,-32768,   120,   128,   638,-32768,-32768,    90,-32768,   638,
1503    638,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1504 -32768,   638,  1060,   121,   132,-32768,   638,   129,   134,   214,
1505    141,   143,   146,   147,   148,   149,   150,   638,   638,   638,
1506    151,  1060,  1101,  1101,   228,-32768,   152,   152,   152,-32768,
1507 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   153,
1508    154,   155,   156,   159,   160,   934,  1142,   592,   230,   161,
1509    164,   177,   180,-32768,-32768,   152,   -37,   -99,   -34,-32768,
1510    130,-32768,   184,   174,   978,-32768,-32768,-32768,-32768,-32768,
1511 -32768,-32768,-32768,-32768,   227,  1142,-32768,-32768,-32768,-32768,
1512    186,-32768,   187,   638,     2,-32768,     3,-32768,   188,   638,
1513    179,  1101,  1101,  1101,  1101,  1101,  1101,  1101,  1101,   189,
1514    190,   195,  1101,   638,   638,   196,-32768,   -23,-32768,-32768,
1515 -32768,  1142,  1142,  1142,  1142,  1142,  1142,-32768,-32768,   -30,
1516     21,-32768,   -73,-32768,  1142,  1142,  1142,  1142,-32768,-32768,
1517 -32768,-32768,-32768,  1019,   229,-32768,-32768,   240,    24,   280,
1518    286,   197,   638,   307,   638,  1101,-32768,   203,   638,-32768,
1519    205,-32768,-32768,   210,   211,-32768,-32768,   638,   638,   638,
1520 -32768,   215,-32768,  1101,   288,   318,-32768,   152,   188,   290,
1521    218,   219,   220,   226,  1142,-32768,-32768,-32768,   234,   237,
1522    241,   242,-32768,-32768,-32768,   284,   243,-32768,   638,   638,
1523   1101,   246,-32768,   246,-32768,   247,   638,   248,  1101,  1101,
1524   1101,-32768,-32768,-32768,  1101,   638,-32768,-32768,-32768,   252,
1525   1101,  1142,  1142,  1142,  1142,-32768,  1142,  1142,  1142,  1142,
1526    338,-32768,   319,   249,   236,   247,   253,   303,-32768,-32768,
1527   1101,   245,   638,-32768,-32768,-32768,   254,-32768,-32768,   256,
1528    260,   259,   263,   265,   264,   267,   270,   274,-32768,-32768,
1529    357,    14,   355,-32768,-32768,   276,-32768,-32768,  1142,-32768,
1530   1142,  1142,-32768,-32768,-32768,-32768,   638,-32768,   742,    52,
1531    372,-32768,   281,   282,   287,-32768,   289,-32768,   742,   638,
1532 -32768,-32768,-32768,   376,   291,   326,   638,   382,   383,-32768,
1533    638,   638,-32768,-32768,   405,   406,-32768
1534 };
1535
1536 static const short yypgoto[] = {-32768,
1537 -32768,   312,   313,   314,   315,  -127,  -126,  -458,-32768,   373,
1538    388,  -116,-32768,  -221,    59,-32768,  -241,-32768,   -48,-32768,
1539    -35,-32768,   -62,   293,-32768,  -100,   239,  -226,    91,-32768,
1540 -32768,-32768,-32768,-32768,-32768,-32768,   365,-32768,-32768,-32768,
1541 -32768,     4,-32768,    63,-32768,-32768,   359,-32768,-32768,-32768,
1542 -32768,-32768,   417,-32768,-32768,  -414,   -55,    64,  -103,-32768,
1543    403,-32768,-32768,-32768,-32768,-32768,    55,    -3,-32768,-32768,
1544     34,-32768,-32768
1545 };
1546
1547
1548 #define YYLAST          1339
1549
1550
1551 static const short yytable[] = {    87,
1552    220,   221,   104,   308,    37,    24,   330,   331,    92,   196,
1553    385,    40,   223,   489,    27,    87,   363,   365,   351,   206,
1554    117,   121,   209,   212,   213,   214,   215,   216,   217,   218,
1555    219,   499,    37,   386,   349,   199,   395,   245,   210,    49,
1556    341,   343,    24,   246,   226,   200,   398,   230,   231,   242,
1557    211,   232,   233,   234,   235,   236,   237,   117,   364,   364,
1558    241,   212,   213,   214,   215,   216,   217,   218,   219,   359,
1559     51,   178,   179,   180,   497,   105,   106,   -64,   350,   395,
1560     44,    45,    46,   121,   505,   396,   121,   205,   119,    56,
1561    205,     5,     6,     7,     8,    52,    10,    53,    93,    47,
1562     54,    41,   212,   213,   214,   215,   216,   217,   218,   219,
1563    224,   225,   205,   227,   228,   205,   205,  -126,    50,   205,
1564    205,   205,   205,   205,   205,   238,   239,   240,   205,   488,
1565    395,   171,   172,   395,   277,   278,   279,    60,   397,   275,
1566    326,   408,     3,   108,   109,   110,   429,    62,     4,   299,
1567     57,    18,    58,    19,   299,   299,   243,   244,     5,     6,
1568      7,     8,     9,    10,    11,   281,   299,   498,   250,   251,
1569    101,   299,   -24,   -24,   304,   -23,   -23,   -22,   -22,    12,
1570    -21,   -21,   299,   299,   299,   252,   253,    87,    97,    98,
1571    449,    99,   450,   324,    28,    29,    30,    31,    32,    33,
1572     34,   -65,   100,   112,   113,   114,    87,   325,   205,   371,
1573    120,   373,   374,   375,   170,   174,   175,   176,   197,   381,
1574    201,   198,   279,   207,   -28,   -27,   -26,   -25,   255,   285,
1575    305,   389,   390,   391,   392,   393,   394,   -31,   -32,   256,
1576    286,   307,   310,   311,   399,   400,   401,   402,   299,   312,
1577    313,   327,   314,   344,   299,   315,   316,   317,   318,   319,
1578    323,   328,   385,   407,   332,   333,   334,   335,   299,   299,
1579    336,   337,   345,   301,   302,   346,   370,   205,   372,   205,
1580    205,   205,   376,   377,   352,   303,   355,   205,   347,   357,
1581    309,   348,   369,   354,   436,   360,   361,   366,   378,   379,
1582    409,   320,   321,   322,   380,   384,   410,   299,   411,   299,
1583    413,   427,   417,   299,   419,   454,   455,   456,   281,   420,
1584    421,   428,   299,   299,   299,   431,   425,   432,   433,   434,
1585    205,   461,   462,   463,   464,   435,   465,   466,   467,   468,
1586    441,   469,   470,   437,   220,   221,   438,   474,   426,   472,
1587    439,   440,   443,   299,   299,   448,   451,   453,   471,   364,
1588    475,   299,   220,   221,   459,   473,   477,   362,   478,   479,
1589    299,   480,   481,   368,   482,   205,   483,   487,   493,   484,
1590    494,   495,   485,   205,   205,   205,   486,   382,   383,   205,
1591    491,   492,   500,   501,   502,   460,   507,   299,   504,   503,
1592    508,   509,   511,   512,   516,   517,   161,   162,   163,   164,
1593     55,    95,   203,   405,   103,   205,   404,   111,    25,    43,
1594    416,   457,   430,     0,     0,     0,   412,     0,   414,    63,
1595     64,   299,   418,   274,     0,     0,     0,     0,     0,     0,
1596      0,   422,   423,   424,   299,     0,    18,     0,    19,     0,
1597    257,   299,     0,     0,     0,   299,   299,     0,     0,     0,
1598      0,     0,   258,   259,     0,     0,     0,     0,     0,     0,
1599      0,     0,   444,   445,     0,     0,     0,     0,     0,     0,
1600    452,     0,     0,     0,     0,     0,     0,     0,     0,   458,
1601      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1602      0,     0,   132,   133,   134,   135,   136,   137,   138,   139,
1603    140,   141,   142,   143,   144,   145,   476,     0,     0,     0,
1604      0,   260,     0,   261,   262,   153,   154,     0,   263,   264,
1605    265,     0,     0,     0,     0,     0,     0,     0,   266,     0,
1606      0,   267,     0,   268,     0,     0,   269,     0,     0,     0,
1607    496,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1608      0,     0,     0,   506,     0,     0,     0,     0,     0,     0,
1609    510,     0,     0,     0,   513,   514,    63,    64,     0,   115,
1610     66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
1611     76,    77,    78,    18,     0,    19,    63,    64,     0,   115,
1612    181,   182,   183,   184,   185,   186,   187,   188,   189,   190,
1613    191,    77,    78,    18,     0,    19,     0,     0,     0,    79,
1614      0,     0,     0,     0,   -34,     0,    18,     0,    19,     0,
1615      0,     0,     0,     0,     0,     4,   -34,   -34,     0,    79,
1616    287,   288,    63,    64,   289,   -34,   -34,   -34,   -34,   -34,
1617    -34,   -34,     0,     0,   -34,    20,     0,     0,     0,    18,
1618      0,    19,    21,   290,   291,   292,    22,     0,     0,     0,
1619      0,     0,     0,     0,     0,   293,   294,     0,     0,     0,
1620      0,     0,    80,     0,     0,    81,     0,     0,    82,     0,
1621     83,   116,     0,     0,     0,     0,     0,     0,   295,     0,
1622      0,     0,    80,     0,     0,    81,     0,     0,    82,     0,
1623     83,   342,     0,     0,     0,   132,   133,   134,   135,   136,
1624    137,   138,   139,   140,   141,   142,   143,   144,   145,     0,
1625      0,     0,     0,     0,   260,     0,   261,   262,   153,   154,
1626      0,   263,   264,   265,   287,   288,     0,     0,   289,     0,
1627      0,     0,     0,     0,   296,     0,     0,     0,     0,     0,
1628      0,     0,     0,     0,     0,     0,     0,   290,   291,   292,
1629      0,     0,     0,     0,     0,     0,     0,     0,     0,   293,
1630    294,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1631      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1632      0,     0,   295,     0,     0,     0,     0,     0,     0,     0,
1633      0,     0,     0,     0,     0,     0,     0,     0,     0,   132,
1634    133,   134,   135,   136,   137,   138,   139,   140,   141,   142,
1635    143,   144,   145,     0,     0,     0,     0,     0,   260,     0,
1636    261,   262,   153,   154,     0,   263,   264,   265,     0,     0,
1637      0,     0,     0,     0,     0,     0,    63,    64,   296,   115,
1638     66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
1639     76,    77,    78,    18,     0,    19,     0,     0,     0,     0,
1640      0,     0,     0,     0,     0,     0,     0,     0,   202,     0,
1641      0,     0,     0,     0,     0,     0,     0,    63,    64,    79,
1642    115,    66,    67,    68,    69,    70,    71,    72,    73,    74,
1643     75,    76,    77,    78,    18,     0,    19,     0,     0,     0,
1644      0,     0,     0,     0,     0,     0,     0,     0,     0,   280,
1645      0,     0,     0,     0,     0,     0,     0,     0,    63,    64,
1646     79,   115,   181,   182,   183,   184,   185,   186,   187,   188,
1647    189,   190,   191,    77,    78,    18,     0,    19,     0,     0,
1648      0,     0,    80,     0,     0,    81,     0,     0,    82,     0,
1649     83,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1650      0,    79,    63,    64,     0,   115,    66,    67,    68,    69,
1651     70,    71,    72,    73,    74,    75,    76,    77,    78,    18,
1652      0,    19,     0,    80,     0,     0,    81,     0,     0,    82,
1653      0,    83,     0,     0,   356,     0,     0,     0,     0,     0,
1654      0,     0,     0,    63,    64,    79,   115,    66,    67,    68,
1655     69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
1656     18,     0,    19,     0,    80,     0,     0,    81,     0,   338,
1657     82,     0,    83,     0,     0,   403,     0,     0,     0,     0,
1658      0,     0,     0,     0,    63,    64,    79,    65,    66,    67,
1659     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
1660     78,    18,     0,    19,     0,     0,     0,     0,    80,     0,
1661      0,    81,     0,     0,    82,     0,    83,     0,     0,     0,
1662      0,     0,     0,     0,     0,    63,    64,    79,   115,    66,
1663     67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
1664     77,    78,    18,     0,    19,     0,     0,     0,     0,    80,
1665      0,     0,    81,     0,     0,    82,     0,    83,     0,     0,
1666      0,     0,     0,     0,     0,     0,    63,    64,    79,   115,
1667    181,   182,   183,   184,   185,   186,   187,   188,   189,   190,
1668    191,    77,    78,    18,     0,    19,     0,     0,     0,     0,
1669     80,     0,     0,    81,     0,     0,    82,     0,    83,     0,
1670      0,     0,     0,     0,     0,     0,     0,    63,    64,    79,
1671    208,    66,    67,    68,    69,    70,    71,    72,    73,    74,
1672     75,    76,    77,    78,    18,     0,    19,     0,     0,     0,
1673      0,    80,     0,     0,    81,     0,     0,    82,     0,    83,
1674      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1675     79,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1676      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1677      0,     0,    80,     0,     0,    81,     0,     0,    82,     0,
1678     83,     0,     0,     0,     0,   122,     0,     0,     0,     0,
1679      0,     0,     0,     0,     0,     0,     0,     0,     0,   123,
1680      0,     0,     0,     0,     0,     0,     0,     0,     0,   124,
1681    125,     0,     0,    80,     0,     0,    81,     0,     0,    82,
1682      0,    83,   126,   127,   128,   129,   130,   131,   132,   133,
1683    134,   135,   136,   137,   138,   139,   140,   141,   142,   143,
1684    144,   145,   146,   147,   148,     0,     0,   149,   150,   151,
1685    152,   153,   154,   155,   156,   157,   158,   159,   160
1686 };
1687
1688 static const short yycheck[] = {    35,
1689    128,   128,    51,   225,    23,     2,   248,   249,    29,   110,
1690     34,    30,   129,   472,    61,    51,    15,    15,   118,   123,
1691     83,   121,   126,    10,    11,    12,    13,    14,    15,    16,
1692     17,   490,    23,    57,   276,   110,   110,   110,     9,   109,
1693    267,   268,    39,   116,   148,   120,   120,   151,   152,   166,
1694     21,   155,   156,   157,   158,   159,   160,   120,    57,    57,
1695    164,    10,    11,    12,    13,    14,    15,    16,    17,   296,
1696     20,   107,   108,   109,   489,    32,    33,   112,   116,   110,
1697     52,    53,    54,   121,   499,   116,   121,   123,    85,   109,
1698    126,    41,    42,    43,    44,    45,    46,    47,   119,    71,
1699     50,   120,    10,    11,    12,    13,    14,    15,    16,    17,
1700    146,   147,   148,   149,   150,   151,   152,     0,    61,   155,
1701    156,   157,   158,   159,   160,   161,   162,   163,   164,   116,
1702    110,    55,    56,   110,   197,   198,   199,    24,   118,   195,
1703    244,   118,    25,    53,    54,    55,   388,     4,    31,   205,
1704     45,    22,    47,    24,   210,   211,    95,    96,    41,    42,
1705     43,    44,    45,    46,    47,   201,   222,   116,    27,    28,
1706    114,   227,     3,     4,   223,     3,     4,     3,     4,    62,
1707      3,     4,   238,   239,   240,     3,     4,   223,   109,   109,
1708    412,   109,   414,   242,    64,    65,    66,    67,    68,    69,
1709     70,   112,   109,     4,     4,     4,   242,   243,   244,   313,
1710    112,   315,   316,   317,    24,     4,    24,    24,   115,   323,
1711    112,   115,   285,    59,     4,     4,     4,     4,     4,   110,
1712    110,   332,   333,   334,   335,   336,   337,     7,     7,     7,
1713    113,   110,   114,   110,   345,   346,   347,   348,   304,    36,
1714    110,    24,   110,    24,   310,   110,   110,   110,   110,   110,
1715    110,   110,    34,    24,   112,   112,   112,   112,   324,   325,
1716    112,   112,   112,   210,   211,   112,   312,   313,   314,   315,
1717    316,   317,   318,   319,   281,   222,   113,   323,   112,    63,
1718    227,   112,   114,   110,   395,   110,   110,   110,   110,   110,
1719     21,   238,   239,   240,   110,   110,    21,   363,   112,   365,
1720      4,    24,   110,   369,   110,   419,   420,   421,   354,   110,
1721    110,     4,   378,   379,   380,    36,   112,   110,   110,   110,
1722    366,   432,   433,   434,   435,   110,   437,   438,   439,   440,
1723     57,     4,    24,   110,   472,   472,   110,   451,   384,   114,
1724    110,   110,   110,   409,   410,   110,   110,   110,   110,    57,
1725    116,   417,   490,   490,   113,   113,   113,   304,   113,   110,
1726    426,   113,   110,   310,   110,   411,   113,    21,   479,   113,
1727    481,   482,   113,   419,   420,   421,   113,   324,   325,   425,
1728     36,   116,    21,   113,   113,   431,    21,   453,   110,   113,
1729    110,    76,    21,    21,     0,     0,    95,    95,    95,    95,
1730     23,    39,   120,   355,    50,   451,   354,    59,     2,    17,
1731    366,   425,   389,    -1,    -1,    -1,   363,    -1,   365,     5,
1732      6,   487,   369,   195,    -1,    -1,    -1,    -1,    -1,    -1,
1733     -1,   378,   379,   380,   500,    -1,    22,    -1,    24,    -1,
1734     26,   507,    -1,    -1,    -1,   511,   512,    -1,    -1,    -1,
1735     -1,    -1,    38,    39,    -1,    -1,    -1,    -1,    -1,    -1,
1736     -1,    -1,   409,   410,    -1,    -1,    -1,    -1,    -1,    -1,
1737    417,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   426,
1738     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1739     -1,    -1,    78,    79,    80,    81,    82,    83,    84,    85,
1740     86,    87,    88,    89,    90,    91,   453,    -1,    -1,    -1,
1741     -1,    97,    -1,    99,   100,   101,   102,    -1,   104,   105,
1742    106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   114,    -1,
1743     -1,   117,    -1,   119,    -1,    -1,   122,    -1,    -1,    -1,
1744    487,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1745     -1,    -1,    -1,   500,    -1,    -1,    -1,    -1,    -1,    -1,
1746    507,    -1,    -1,    -1,   511,   512,     5,     6,    -1,     8,
1747      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
1748     19,    20,    21,    22,    -1,    24,     5,     6,    -1,     8,
1749      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
1750     19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,    48,
1751     -1,    -1,    -1,    -1,    20,    -1,    22,    -1,    24,    -1,
1752     -1,    -1,    -1,    -1,    -1,    31,    32,    33,    -1,    48,
1753      3,     4,     5,     6,     7,    41,    42,    43,    44,    45,
1754     46,    47,    -1,    -1,    50,    51,    -1,    -1,    -1,    22,
1755     -1,    24,    58,    26,    27,    28,    62,    -1,    -1,    -1,
1756     -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    -1,    -1,
1757     -1,    -1,   111,    -1,    -1,   114,    -1,    -1,   117,    -1,
1758    119,   120,    -1,    -1,    -1,    -1,    -1,    -1,    61,    -1,
1759     -1,    -1,   111,    -1,    -1,   114,    -1,    -1,   117,    -1,
1760    119,   120,    -1,    -1,    -1,    78,    79,    80,    81,    82,
1761     83,    84,    85,    86,    87,    88,    89,    90,    91,    -1,
1762     -1,    -1,    -1,    -1,    97,    -1,    99,   100,   101,   102,
1763     -1,   104,   105,   106,     3,     4,    -1,    -1,     7,    -1,
1764     -1,    -1,    -1,    -1,   117,    -1,    -1,    -1,    -1,    -1,
1765     -1,    -1,    -1,    -1,    -1,    -1,    -1,    26,    27,    28,
1766     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    38,
1767     39,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1768     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1769     -1,    -1,    61,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1770     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    78,
1771     79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
1772     89,    90,    91,    -1,    -1,    -1,    -1,    -1,    97,    -1,
1773     99,   100,   101,   102,    -1,   104,   105,   106,    -1,    -1,
1774     -1,    -1,    -1,    -1,    -1,    -1,     5,     6,   117,     8,
1775      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
1776     19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,    -1,
1777     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    37,    -1,
1778     -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,     6,    48,
1779      8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
1780     18,    19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,
1781     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    37,
1782     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,     6,
1783     48,     8,     9,    10,    11,    12,    13,    14,    15,    16,
1784     17,    18,    19,    20,    21,    22,    -1,    24,    -1,    -1,
1785     -1,    -1,   111,    -1,    -1,   114,    -1,    -1,   117,    -1,
1786    119,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1787     -1,    48,     5,     6,    -1,     8,     9,    10,    11,    12,
1788     13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
1789     -1,    24,    -1,   111,    -1,    -1,   114,    -1,    -1,   117,
1790     -1,   119,    -1,    -1,    37,    -1,    -1,    -1,    -1,    -1,
1791     -1,    -1,    -1,     5,     6,    48,     8,     9,    10,    11,
1792     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
1793     22,    -1,    24,    -1,   111,    -1,    -1,   114,    -1,   116,
1794    117,    -1,   119,    -1,    -1,    37,    -1,    -1,    -1,    -1,
1795     -1,    -1,    -1,    -1,     5,     6,    48,     8,     9,    10,
1796     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
1797     21,    22,    -1,    24,    -1,    -1,    -1,    -1,   111,    -1,
1798     -1,   114,    -1,    -1,   117,    -1,   119,    -1,    -1,    -1,
1799     -1,    -1,    -1,    -1,    -1,     5,     6,    48,     8,     9,
1800     10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
1801     20,    21,    22,    -1,    24,    -1,    -1,    -1,    -1,   111,
1802     -1,    -1,   114,    -1,    -1,   117,    -1,   119,    -1,    -1,
1803     -1,    -1,    -1,    -1,    -1,    -1,     5,     6,    48,     8,
1804      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
1805     19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,    -1,
1806    111,    -1,    -1,   114,    -1,    -1,   117,    -1,   119,    -1,
1807     -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,     6,    48,
1808      8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
1809     18,    19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,
1810     -1,   111,    -1,    -1,   114,    -1,    -1,   117,    -1,   119,
1811     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1812     48,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1813     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1814     -1,    -1,   111,    -1,    -1,   114,    -1,    -1,   117,    -1,
1815    119,    -1,    -1,    -1,    -1,    35,    -1,    -1,    -1,    -1,
1816     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    49,
1817     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    59,
1818     60,    -1,    -1,   111,    -1,    -1,   114,    -1,    -1,   117,
1819     -1,   119,    72,    73,    74,    75,    76,    77,    78,    79,
1820     80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
1821     90,    91,    92,    93,    94,    -1,    -1,    97,    98,    99,
1822    100,   101,   102,   103,   104,   105,   106,   107,   108
1823 };
1824 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
1825 #line 3 "/usr/share/bison.simple"
1826 /* This file comes from bison-1.28.  */
1827
1828 /* Skeleton output parser for bison,
1829    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1830
1831    This program is free software; you can redistribute it and/or modify
1832    it under the terms of the GNU General Public License as published by
1833    the Free Software Foundation; either version 2, or (at your option)
1834    any later version.
1835
1836    This program is distributed in the hope that it will be useful,
1837    but WITHOUT ANY WARRANTY; without even the implied warranty of
1838    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1839    GNU General Public License for more details.
1840
1841    You should have received a copy of the GNU General Public License
1842    along with this program; if not, write to the Free Software
1843    Foundation, Inc., 59 Temple Place - Suite 330,
1844    Boston, MA 02111-1307, USA.  */
1845
1846 /* As a special exception, when this file is copied by Bison into a
1847    Bison output file, you may use that output file without restriction.
1848    This special exception was added by the Free Software Foundation
1849    in version 1.24 of Bison.  */
1850
1851 /* This is the parser code that is written into each bison parser
1852   when the %semantic_parser declaration is not specified in the grammar.
1853   It was written by Richard Stallman by simplifying the hairy parser
1854   used when %semantic_parser is specified.  */
1855
1856 #ifndef YYSTACK_USE_ALLOCA
1857 #ifdef alloca
1858 #define YYSTACK_USE_ALLOCA
1859 #else /* alloca not defined */
1860 #ifdef __GNUC__
1861 #define YYSTACK_USE_ALLOCA
1862 #define alloca __builtin_alloca
1863 #else /* not GNU C.  */
1864 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
1865 #define YYSTACK_USE_ALLOCA
1866 #include <alloca.h>
1867 #else /* not sparc */
1868 /* We think this test detects Watcom and Microsoft C.  */
1869 /* This used to test MSDOS, but that is a bad idea
1870    since that symbol is in the user namespace.  */
1871 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
1872 #if 0 /* No need for malloc.h, which pollutes the namespace;
1873          instead, just don't use alloca.  */
1874 #include <malloc.h>
1875 #endif
1876 #else /* not MSDOS, or __TURBOC__ */
1877 #if defined(_AIX)
1878 /* I don't know what this was needed for, but it pollutes the namespace.
1879    So I turned it off.   rms, 2 May 1997.  */
1880 /* #include <malloc.h>  */
1881  #pragma alloca
1882 #define YYSTACK_USE_ALLOCA
1883 #else /* not MSDOS, or __TURBOC__, or _AIX */
1884 #if 0
1885 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
1886                  and on HPUX 10.  Eventually we can turn this on.  */
1887 #define YYSTACK_USE_ALLOCA
1888 #define alloca __builtin_alloca
1889 #endif /* __hpux */
1890 #endif
1891 #endif /* not _AIX */
1892 #endif /* not MSDOS, or __TURBOC__ */
1893 #endif /* not sparc */
1894 #endif /* not GNU C */
1895 #endif /* alloca not defined */
1896 #endif /* YYSTACK_USE_ALLOCA not defined */
1897
1898 #ifdef YYSTACK_USE_ALLOCA
1899 #define YYSTACK_ALLOC alloca
1900 #else
1901 #define YYSTACK_ALLOC malloc
1902 #endif
1903
1904 /* Note: there must be only one dollar sign in this file.
1905    It is replaced by the list of actions, each action
1906    as one case of the switch.  */
1907
1908 #define yyerrok         (yyerrstatus = 0)
1909 #define yyclearin       (yychar = YYEMPTY)
1910 #define YYEMPTY         -2
1911 #define YYEOF           0
1912 #define YYACCEPT        goto yyacceptlab
1913 #define YYABORT         goto yyabortlab
1914 #define YYERROR         goto yyerrlab1
1915 /* Like YYERROR except do call yyerror.
1916    This remains here temporarily to ease the
1917    transition to the new meaning of YYERROR, for GCC.
1918    Once GCC version 2 has supplanted version 1, this can go.  */
1919 #define YYFAIL          goto yyerrlab
1920 #define YYRECOVERING()  (!!yyerrstatus)
1921 #define YYBACKUP(token, value) \
1922 do                                                              \
1923   if (yychar == YYEMPTY && yylen == 1)                          \
1924     { yychar = (token), yylval = (value);                       \
1925       yychar1 = YYTRANSLATE (yychar);                           \
1926       YYPOPSTACK;                                               \
1927       goto yybackup;                                            \
1928     }                                                           \
1929   else                                                          \
1930     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
1931 while (0)
1932
1933 #define YYTERROR        1
1934 #define YYERRCODE       256
1935
1936 #ifndef YYPURE
1937 #define YYLEX           yylex()
1938 #endif
1939
1940 #ifdef YYPURE
1941 #ifdef YYLSP_NEEDED
1942 #ifdef YYLEX_PARAM
1943 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
1944 #else
1945 #define YYLEX           yylex(&yylval, &yylloc)
1946 #endif
1947 #else /* not YYLSP_NEEDED */
1948 #ifdef YYLEX_PARAM
1949 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
1950 #else
1951 #define YYLEX           yylex(&yylval)
1952 #endif
1953 #endif /* not YYLSP_NEEDED */
1954 #endif
1955
1956 /* If nonreentrant, generate the variables here */
1957
1958 #ifndef YYPURE
1959
1960 int     yychar;                 /*  the lookahead symbol                */
1961 YYSTYPE yylval;                 /*  the semantic value of the           */
1962                                 /*  lookahead symbol                    */
1963
1964 #ifdef YYLSP_NEEDED
1965 YYLTYPE yylloc;                 /*  location data for the lookahead     */
1966                                 /*  symbol                              */
1967 #endif
1968
1969 int yynerrs;                    /*  number of parse errors so far       */
1970 #endif  /* not YYPURE */
1971
1972 #if YYDEBUG != 0
1973 int yydebug;                    /*  nonzero means print parse trace     */
1974 /* Since this is uninitialized, it does not stop multiple parsers
1975    from coexisting.  */
1976 #endif
1977
1978 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
1979
1980 #ifndef YYINITDEPTH
1981 #define YYINITDEPTH 200
1982 #endif
1983
1984 /*  YYMAXDEPTH is the maximum size the stacks can grow to
1985     (effective only if the built-in stack extension method is used).  */
1986
1987 #if YYMAXDEPTH == 0
1988 #undef YYMAXDEPTH
1989 #endif
1990
1991 #ifndef YYMAXDEPTH
1992 #define YYMAXDEPTH 10000
1993 #endif
1994 \f
1995 /* Define __yy_memcpy.  Note that the size argument
1996    should be passed with type unsigned int, because that is what the non-GCC
1997    definitions require.  With GCC, __builtin_memcpy takes an arg
1998    of type size_t, but it can handle unsigned int.  */
1999
2000 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
2001 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
2002 #else                           /* not GNU C or C++ */
2003 #ifndef __cplusplus
2004
2005 /* This is the most reliable way to avoid incompatibilities
2006    in available built-in functions on various systems.  */
2007 static void
2008 __yy_memcpy (to, from, count)
2009      char *to;
2010      char *from;
2011      unsigned int count;
2012 {
2013   register char *f = from;
2014   register char *t = to;
2015   register int i = count;
2016
2017   while (i-- > 0)
2018     *t++ = *f++;
2019 }
2020
2021 #else /* __cplusplus */
2022
2023 /* This is the most reliable way to avoid incompatibilities
2024    in available built-in functions on various systems.  */
2025 static void
2026 __yy_memcpy (char *to, char *from, unsigned int count)
2027 {
2028   register char *t = to;
2029   register char *f = from;
2030   register int i = count;
2031
2032   while (i-- > 0)
2033     *t++ = *f++;
2034 }
2035
2036 #endif
2037 #endif
2038 \f
2039 #line 217 "/usr/share/bison.simple"
2040
2041 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2042    into yyparse.  The argument should have type void *.
2043    It should actually point to an object.
2044    Grammar actions can access the variable by casting it
2045    to the proper pointer type.  */
2046
2047 #ifdef YYPARSE_PARAM
2048 #ifdef __cplusplus
2049 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2050 #define YYPARSE_PARAM_DECL
2051 #else /* not __cplusplus */
2052 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2053 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2054 #endif /* not __cplusplus */
2055 #else /* not YYPARSE_PARAM */
2056 #define YYPARSE_PARAM_ARG
2057 #define YYPARSE_PARAM_DECL
2058 #endif /* not YYPARSE_PARAM */
2059
2060 /* Prevent warning if -Wstrict-prototypes.  */
2061 #ifdef __GNUC__
2062 #ifdef YYPARSE_PARAM
2063 int yyparse (void *);
2064 #else
2065 int yyparse (void);
2066 #endif
2067 #endif
2068
2069 int
2070 yyparse(YYPARSE_PARAM_ARG)
2071      YYPARSE_PARAM_DECL
2072 {
2073   register int yystate;
2074   register int yyn;
2075   register short *yyssp;
2076   register YYSTYPE *yyvsp;
2077   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
2078   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
2079
2080   short yyssa[YYINITDEPTH];     /*  the state stack                     */
2081   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
2082
2083   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
2084   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
2085
2086 #ifdef YYLSP_NEEDED
2087   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
2088   YYLTYPE *yyls = yylsa;
2089   YYLTYPE *yylsp;
2090
2091 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
2092 #else
2093 #define YYPOPSTACK   (yyvsp--, yyssp--)
2094 #endif
2095
2096   int yystacksize = YYINITDEPTH;
2097   int yyfree_stacks = 0;
2098
2099 #ifdef YYPURE
2100   int yychar;
2101   YYSTYPE yylval;
2102   int yynerrs;
2103 #ifdef YYLSP_NEEDED
2104   YYLTYPE yylloc;
2105 #endif
2106 #endif
2107
2108   YYSTYPE yyval;                /*  the variable used to return         */
2109                                 /*  semantic values from the action     */
2110                                 /*  routines                            */
2111
2112   int yylen;
2113
2114 #if YYDEBUG != 0
2115   if (yydebug)
2116     fprintf(stderr, "Starting parse\n");
2117 #endif
2118
2119   yystate = 0;
2120   yyerrstatus = 0;
2121   yynerrs = 0;
2122   yychar = YYEMPTY;             /* Cause a token to be read.  */
2123
2124   /* Initialize stack pointers.
2125      Waste one element of value and location stack
2126      so that they stay on the same level as the state stack.
2127      The wasted elements are never initialized.  */
2128
2129   yyssp = yyss - 1;
2130   yyvsp = yyvs;
2131 #ifdef YYLSP_NEEDED
2132   yylsp = yyls;
2133 #endif
2134
2135 /* Push a new state, which is found in  yystate  .  */
2136 /* In all cases, when you get here, the value and location stacks
2137    have just been pushed. so pushing a state here evens the stacks.  */
2138 yynewstate:
2139
2140   *++yyssp = yystate;
2141
2142   if (yyssp >= yyss + yystacksize - 1)
2143     {
2144       /* Give user a chance to reallocate the stack */
2145       /* Use copies of these so that the &'s don't force the real ones into memory. */
2146       YYSTYPE *yyvs1 = yyvs;
2147       short *yyss1 = yyss;
2148 #ifdef YYLSP_NEEDED
2149       YYLTYPE *yyls1 = yyls;
2150 #endif
2151
2152       /* Get the current used size of the three stacks, in elements.  */
2153       int size = yyssp - yyss + 1;
2154
2155 #ifdef yyoverflow
2156       /* Each stack pointer address is followed by the size of
2157          the data in use in that stack, in bytes.  */
2158 #ifdef YYLSP_NEEDED
2159       /* This used to be a conditional around just the two extra args,
2160          but that might be undefined if yyoverflow is a macro.  */
2161       yyoverflow("parser stack overflow",
2162                  &yyss1, size * sizeof (*yyssp),
2163                  &yyvs1, size * sizeof (*yyvsp),
2164                  &yyls1, size * sizeof (*yylsp),
2165                  &yystacksize);
2166 #else
2167       yyoverflow("parser stack overflow",
2168                  &yyss1, size * sizeof (*yyssp),
2169                  &yyvs1, size * sizeof (*yyvsp),
2170                  &yystacksize);
2171 #endif
2172
2173       yyss = yyss1; yyvs = yyvs1;
2174 #ifdef YYLSP_NEEDED
2175       yyls = yyls1;
2176 #endif
2177 #else /* no yyoverflow */
2178       /* Extend the stack our own way.  */
2179       if (yystacksize >= YYMAXDEPTH)
2180         {
2181           yyerror("parser stack overflow");
2182           if (yyfree_stacks)
2183             {
2184               free (yyss);
2185               free (yyvs);
2186 #ifdef YYLSP_NEEDED
2187               free (yyls);
2188 #endif
2189             }
2190           return 2;
2191         }
2192       yystacksize *= 2;
2193       if (yystacksize > YYMAXDEPTH)
2194         yystacksize = YYMAXDEPTH;
2195 #ifndef YYSTACK_USE_ALLOCA
2196       yyfree_stacks = 1;
2197 #endif
2198       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2199       __yy_memcpy ((char *)yyss, (char *)yyss1,
2200                    size * (unsigned int) sizeof (*yyssp));
2201       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2202       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2203                    size * (unsigned int) sizeof (*yyvsp));
2204 #ifdef YYLSP_NEEDED
2205       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2206       __yy_memcpy ((char *)yyls, (char *)yyls1,
2207                    size * (unsigned int) sizeof (*yylsp));
2208 #endif
2209 #endif /* no yyoverflow */
2210
2211       yyssp = yyss + size - 1;
2212       yyvsp = yyvs + size - 1;
2213 #ifdef YYLSP_NEEDED
2214       yylsp = yyls + size - 1;
2215 #endif
2216
2217 #if YYDEBUG != 0
2218       if (yydebug)
2219         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2220 #endif
2221
2222       if (yyssp >= yyss + yystacksize - 1)
2223         YYABORT;
2224     }
2225
2226 #if YYDEBUG != 0
2227   if (yydebug)
2228     fprintf(stderr, "Entering state %d\n", yystate);
2229 #endif
2230
2231   goto yybackup;
2232  yybackup:
2233
2234 /* Do appropriate processing given the current state.  */
2235 /* Read a lookahead token if we need one and don't already have one.  */
2236 /* yyresume: */
2237
2238   /* First try to decide what to do without reference to lookahead token.  */
2239
2240   yyn = yypact[yystate];
2241   if (yyn == YYFLAG)
2242     goto yydefault;
2243
2244   /* Not known => get a lookahead token if don't already have one.  */
2245
2246   /* yychar is either YYEMPTY or YYEOF
2247      or a valid token in external form.  */
2248
2249   if (yychar == YYEMPTY)
2250     {
2251 #if YYDEBUG != 0
2252       if (yydebug)
2253         fprintf(stderr, "Reading a token: ");
2254 #endif
2255       yychar = YYLEX;
2256     }
2257
2258   /* Convert token to internal form (in yychar1) for indexing tables with */
2259
2260   if (yychar <= 0)              /* This means end of input. */
2261     {
2262       yychar1 = 0;
2263       yychar = YYEOF;           /* Don't call YYLEX any more */
2264
2265 #if YYDEBUG != 0
2266       if (yydebug)
2267         fprintf(stderr, "Now at end of input.\n");
2268 #endif
2269     }
2270   else
2271     {
2272       yychar1 = YYTRANSLATE(yychar);
2273
2274 #if YYDEBUG != 0
2275       if (yydebug)
2276         {
2277           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2278           /* Give the individual parser a way to print the precise meaning
2279              of a token, for further debugging info.  */
2280 #ifdef YYPRINT
2281           YYPRINT (stderr, yychar, yylval);
2282 #endif
2283           fprintf (stderr, ")\n");
2284         }
2285 #endif
2286     }
2287
2288   yyn += yychar1;
2289   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2290     goto yydefault;
2291
2292   yyn = yytable[yyn];
2293
2294   /* yyn is what to do for this token type in this state.
2295      Negative => reduce, -yyn is rule number.
2296      Positive => shift, yyn is new state.
2297        New state is final state => don't bother to shift,
2298        just return success.
2299      0, or most negative number => error.  */
2300
2301   if (yyn < 0)
2302     {
2303       if (yyn == YYFLAG)
2304         goto yyerrlab;
2305       yyn = -yyn;
2306       goto yyreduce;
2307     }
2308   else if (yyn == 0)
2309     goto yyerrlab;
2310
2311   if (yyn == YYFINAL)
2312     YYACCEPT;
2313
2314   /* Shift the lookahead token.  */
2315
2316 #if YYDEBUG != 0
2317   if (yydebug)
2318     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2319 #endif
2320
2321   /* Discard the token being shifted unless it is eof.  */
2322   if (yychar != YYEOF)
2323     yychar = YYEMPTY;
2324
2325   *++yyvsp = yylval;
2326 #ifdef YYLSP_NEEDED
2327   *++yylsp = yylloc;
2328 #endif
2329
2330   /* count tokens shifted since error; after three, turn off error status.  */
2331   if (yyerrstatus) yyerrstatus--;
2332
2333   yystate = yyn;
2334   goto yynewstate;
2335
2336 /* Do the default action for the current state.  */
2337 yydefault:
2338
2339   yyn = yydefact[yystate];
2340   if (yyn == 0)
2341     goto yyerrlab;
2342
2343 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
2344 yyreduce:
2345   yylen = yyr2[yyn];
2346   if (yylen > 0)
2347     yyval = yyvsp[1-yylen]; /* implement default value of the action */
2348
2349 #if YYDEBUG != 0
2350   if (yydebug)
2351     {
2352       int i;
2353
2354       fprintf (stderr, "Reducing via rule %d (line %d), ",
2355                yyn, yyrline[yyn]);
2356
2357       /* Print the symbols being reduced, and their result.  */
2358       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2359         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2360       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2361     }
2362 #endif
2363
2364
2365   switch (yyn) {
2366
2367 case 2:
2368 #line 1098 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2369 {
2370   if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX)     // Outside of my range!
2371     GEN_ERROR("Value too large for type!");
2372   yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
2373   CHECK_FOR_ERROR
2374 ;
2375     break;}
2376 case 4:
2377 #line 1107 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2378 {
2379   if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX)     // Outside of my range!
2380     GEN_ERROR("Value too large for type!");
2381   yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
2382   CHECK_FOR_ERROR
2383 ;
2384     break;}
2385 case 33:
2386 #line 1131 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2387 {
2388     yyval.StrVal = yyvsp[-1].StrVal;
2389     CHECK_FOR_ERROR
2390   ;
2391     break;}
2392 case 34:
2393 #line 1135 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2394 {
2395     yyval.StrVal = 0;
2396     CHECK_FOR_ERROR
2397   ;
2398     break;}
2399 case 35:
2400 #line 1140 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2401 { yyval.Linkage = GlobalValue::InternalLinkage; ;
2402     break;}
2403 case 36:
2404 #line 1141 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2405 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2406     break;}
2407 case 37:
2408 #line 1142 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2409 { yyval.Linkage = GlobalValue::WeakLinkage; ;
2410     break;}
2411 case 38:
2412 #line 1143 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2413 { yyval.Linkage = GlobalValue::AppendingLinkage; ;
2414     break;}
2415 case 39:
2416 #line 1144 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2417 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2418     break;}
2419 case 40:
2420 #line 1145 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2421 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2422     break;}
2423 case 41:
2424 #line 1146 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2425 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2426     break;}
2427 case 42:
2428 #line 1147 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2429 { yyval.Linkage = GlobalValue::ExternalLinkage; ;
2430     break;}
2431 case 43:
2432 #line 1149 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2433 { yyval.UIntVal = CallingConv::C; ;
2434     break;}
2435 case 44:
2436 #line 1150 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2437 { yyval.UIntVal = CallingConv::C; ;
2438     break;}
2439 case 45:
2440 #line 1151 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2441 { yyval.UIntVal = CallingConv::CSRet; ;
2442     break;}
2443 case 46:
2444 #line 1152 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2445 { yyval.UIntVal = CallingConv::Fast; ;
2446     break;}
2447 case 47:
2448 #line 1153 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2449 { yyval.UIntVal = CallingConv::Cold; ;
2450     break;}
2451 case 48:
2452 #line 1154 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2453 { yyval.UIntVal = CallingConv::X86_StdCall; ;
2454     break;}
2455 case 49:
2456 #line 1155 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2457 { yyval.UIntVal = CallingConv::X86_FastCall; ;
2458     break;}
2459 case 50:
2460 #line 1156 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2461 {
2462                    if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
2463                      GEN_ERROR("Calling conv too large!");
2464                    yyval.UIntVal = yyvsp[0].UInt64Val;
2465                   CHECK_FOR_ERROR
2466                  ;
2467     break;}
2468 case 51:
2469 #line 1165 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2470 { yyval.UIntVal = 0; ;
2471     break;}
2472 case 52:
2473 #line 1166 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2474 {
2475   yyval.UIntVal = yyvsp[0].UInt64Val;
2476   if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2477     GEN_ERROR("Alignment must be a power of two!");
2478   CHECK_FOR_ERROR
2479 ;
2480     break;}
2481 case 53:
2482 #line 1172 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2483 { yyval.UIntVal = 0; ;
2484     break;}
2485 case 54:
2486 #line 1173 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2487 {
2488   yyval.UIntVal = yyvsp[0].UInt64Val;
2489   if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
2490     GEN_ERROR("Alignment must be a power of two!");
2491   CHECK_FOR_ERROR
2492 ;
2493     break;}
2494 case 55:
2495 #line 1181 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2496 {
2497   for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i)
2498     if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\')
2499       GEN_ERROR("Invalid character in section name!");
2500   yyval.StrVal = yyvsp[0].StrVal;
2501   CHECK_FOR_ERROR
2502 ;
2503     break;}
2504 case 56:
2505 #line 1189 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2506 { yyval.StrVal = 0; ;
2507     break;}
2508 case 57:
2509 #line 1190 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2510 { yyval.StrVal = yyvsp[0].StrVal; ;
2511     break;}
2512 case 58:
2513 #line 1195 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2514 {;
2515     break;}
2516 case 59:
2517 #line 1196 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2518 {;
2519     break;}
2520 case 60:
2521 #line 1197 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2522 {
2523     CurGV->setSection(yyvsp[0].StrVal);
2524     free(yyvsp[0].StrVal);
2525     CHECK_FOR_ERROR
2526   ;
2527     break;}
2528 case 61:
2529 #line 1202 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2530 {
2531     if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
2532       GEN_ERROR("Alignment must be a power of two!");
2533     CurGV->setAlignment(yyvsp[0].UInt64Val);
2534     CHECK_FOR_ERROR
2535   ;
2536     break;}
2537 case 63:
2538 #line 1216 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2539 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2540     break;}
2541 case 65:
2542 #line 1217 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2543 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;
2544     break;}
2545 case 66:
2546 #line 1219 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2547 {
2548     if (!UpRefs.empty())
2549       GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
2550     yyval.TypeVal = yyvsp[0].TypeVal;
2551     CHECK_FOR_ERROR
2552   ;
2553     break;}
2554 case 80:
2555 #line 1231 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2556 {
2557     yyval.TypeVal = new PATypeHolder(OpaqueType::get());
2558     CHECK_FOR_ERROR
2559   ;
2560     break;}
2561 case 81:
2562 #line 1235 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2563 {
2564     yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
2565     CHECK_FOR_ERROR
2566   ;
2567     break;}
2568 case 82:
2569 #line 1239 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2570 {            // Named types are also simple types...
2571   const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
2572   CHECK_FOR_ERROR
2573   yyval.TypeVal = new PATypeHolder(tmp);
2574 ;
2575     break;}
2576 case 83:
2577 #line 1247 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2578 {                   // Type UpReference
2579     if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!");
2580     OpaqueType *OT = OpaqueType::get();        // Use temporary placeholder
2581     UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT));  // Add to vector...
2582     yyval.TypeVal = new PATypeHolder(OT);
2583     UR_OUT("New Upreference!\n");
2584     CHECK_FOR_ERROR
2585   ;
2586     break;}
2587 case 84:
2588 #line 1255 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2589 {           // Function derived type?
2590     std::vector<const Type*> Params;
2591     for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2592            E = yyvsp[-1].TypeList->end(); I != E; ++I)
2593       Params.push_back(*I);
2594     bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
2595     if (isVarArg) Params.pop_back();
2596
2597     yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg)));
2598     delete yyvsp[-1].TypeList;      // Delete the argument list
2599     delete yyvsp[-3].TypeVal;      // Delete the return type handle
2600     CHECK_FOR_ERROR
2601   ;
2602     break;}
2603 case 85:
2604 #line 1268 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2605 {          // Sized array type?
2606     yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2607     delete yyvsp[-1].TypeVal;
2608     CHECK_FOR_ERROR
2609   ;
2610     break;}
2611 case 86:
2612 #line 1273 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2613 {          // Packed array type?
2614      const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
2615      if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
2616         GEN_ERROR("Unsigned result not equal to signed result");
2617      if (!ElemTy->isPrimitiveType())
2618         GEN_ERROR("Elemental type of a PackedType must be primitive");
2619      if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
2620        GEN_ERROR("Vector length should be a power of 2!");
2621      yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
2622      delete yyvsp[-1].TypeVal;
2623      CHECK_FOR_ERROR
2624   ;
2625     break;}
2626 case 87:
2627 #line 1285 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2628 {                        // Structure type?
2629     std::vector<const Type*> Elements;
2630     for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
2631            E = yyvsp[-1].TypeList->end(); I != E; ++I)
2632       Elements.push_back(*I);
2633
2634     yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
2635     delete yyvsp[-1].TypeList;
2636     CHECK_FOR_ERROR
2637   ;
2638     break;}
2639 case 88:
2640 #line 1295 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2641 {                                  // Empty structure type?
2642     yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
2643     CHECK_FOR_ERROR
2644   ;
2645     break;}
2646 case 89:
2647 #line 1299 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2648 {                             // Pointer type?
2649     if (*yyvsp[-1].TypeVal == Type::LabelTy)
2650       GEN_ERROR("Cannot form a pointer to a basic block");
2651     yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2652     delete yyvsp[-1].TypeVal;
2653     CHECK_FOR_ERROR
2654   ;
2655     break;}
2656 case 90:
2657 #line 1310 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2658 {
2659     yyval.TypeList = new std::list<PATypeHolder>();
2660     yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2661     CHECK_FOR_ERROR
2662   ;
2663     break;}
2664 case 91:
2665 #line 1315 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2666 {
2667     (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
2668     CHECK_FOR_ERROR
2669   ;
2670     break;}
2671 case 93:
2672 #line 1322 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2673 {
2674     (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy);
2675     CHECK_FOR_ERROR
2676   ;
2677     break;}
2678 case 94:
2679 #line 1326 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2680 {
2681     (yyval.TypeList = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
2682     CHECK_FOR_ERROR
2683   ;
2684     break;}
2685 case 95:
2686 #line 1330 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2687 {
2688     yyval.TypeList = new std::list<PATypeHolder>();
2689     CHECK_FOR_ERROR
2690   ;
2691     break;}
2692 case 96:
2693 #line 1341 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2694 { // Nonempty unsized arr
2695     const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
2696     if (ATy == 0)
2697       GEN_ERROR("Cannot make array constant with type: '" + 
2698                      (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2699     const Type *ETy = ATy->getElementType();
2700     int NumElements = ATy->getNumElements();
2701
2702     // Verify that we have the correct size...
2703     if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2704       GEN_ERROR("Type mismatch: constant sized array initialized with " +
2705                      utostr(yyvsp[-1].ConstVector->size()) +  " arguments, but has size of " + 
2706                      itostr(NumElements) + "!");
2707
2708     // Verify all elements are correct type!
2709     for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2710       if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2711         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
2712                        ETy->getDescription() +"' as required!\nIt is of type '"+
2713                        (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2714     }
2715
2716     yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
2717     delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2718     CHECK_FOR_ERROR
2719   ;
2720     break;}
2721 case 97:
2722 #line 1367 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2723 {
2724     const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2725     if (ATy == 0)
2726       GEN_ERROR("Cannot make array constant with type: '" + 
2727                      (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2728
2729     int NumElements = ATy->getNumElements();
2730     if (NumElements != -1 && NumElements != 0) 
2731       GEN_ERROR("Type mismatch: constant sized array initialized with 0"
2732                      " arguments, but has size of " + itostr(NumElements) +"!");
2733     yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
2734     delete yyvsp[-2].TypeVal;
2735     CHECK_FOR_ERROR
2736   ;
2737     break;}
2738 case 98:
2739 #line 1381 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2740 {
2741     const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
2742     if (ATy == 0)
2743       GEN_ERROR("Cannot make array constant with type: '" + 
2744                      (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2745
2746     int NumElements = ATy->getNumElements();
2747     const Type *ETy = ATy->getElementType();
2748     char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
2749     if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal))
2750       GEN_ERROR("Can't build string constant of size " + 
2751                      itostr((int)(EndStr-yyvsp[0].StrVal)) +
2752                      " when array has size " + itostr(NumElements) + "!");
2753     std::vector<Constant*> Vals;
2754     if (ETy == Type::SByteTy) {
2755       for (signed char *C = (signed char *)yyvsp[0].StrVal; C != (signed char *)EndStr; ++C)
2756         Vals.push_back(ConstantSInt::get(ETy, *C));
2757     } else if (ETy == Type::UByteTy) {
2758       for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal; 
2759            C != (unsigned char*)EndStr; ++C)
2760         Vals.push_back(ConstantUInt::get(ETy, *C));
2761     } else {
2762       free(yyvsp[0].StrVal);
2763       GEN_ERROR("Cannot build string arrays of non byte sized elements!");
2764     }
2765     free(yyvsp[0].StrVal);
2766     yyval.ConstVal = ConstantArray::get(ATy, Vals);
2767     delete yyvsp[-2].TypeVal;
2768     CHECK_FOR_ERROR
2769   ;
2770     break;}
2771 case 99:
2772 #line 1411 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2773 { // Nonempty unsized arr
2774     const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get());
2775     if (PTy == 0)
2776       GEN_ERROR("Cannot make packed constant with type: '" + 
2777                      (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2778     const Type *ETy = PTy->getElementType();
2779     int NumElements = PTy->getNumElements();
2780
2781     // Verify that we have the correct size...
2782     if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
2783       GEN_ERROR("Type mismatch: constant sized packed initialized with " +
2784                      utostr(yyvsp[-1].ConstVector->size()) +  " arguments, but has size of " + 
2785                      itostr(NumElements) + "!");
2786
2787     // Verify all elements are correct type!
2788     for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
2789       if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
2790         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
2791            ETy->getDescription() +"' as required!\nIt is of type '"+
2792            (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
2793     }
2794
2795     yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector);
2796     delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2797     CHECK_FOR_ERROR
2798   ;
2799     break;}
2800 case 100:
2801 #line 1437 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2802 {
2803     const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
2804     if (STy == 0)
2805       GEN_ERROR("Cannot make struct constant with type: '" + 
2806                      (*yyvsp[-3].TypeVal)->getDescription() + "'!");
2807
2808     if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
2809       GEN_ERROR("Illegal number of initializers for structure type!");
2810
2811     // Check to ensure that constants are compatible with the type initializer!
2812     for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
2813       if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
2814         GEN_ERROR("Expected type '" +
2815                        STy->getElementType(i)->getDescription() +
2816                        "' for element #" + utostr(i) +
2817                        " of structure initializer!");
2818
2819     yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
2820     delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
2821     CHECK_FOR_ERROR
2822   ;
2823     break;}
2824 case 101:
2825 #line 1458 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2826 {
2827     const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
2828     if (STy == 0)
2829       GEN_ERROR("Cannot make struct constant with type: '" + 
2830                      (*yyvsp[-2].TypeVal)->getDescription() + "'!");
2831
2832     if (STy->getNumContainedTypes() != 0)
2833       GEN_ERROR("Illegal number of initializers for structure type!");
2834
2835     yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
2836     delete yyvsp[-2].TypeVal;
2837     CHECK_FOR_ERROR
2838   ;
2839     break;}
2840 case 102:
2841 #line 1471 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2842 {
2843     const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2844     if (PTy == 0)
2845       GEN_ERROR("Cannot make null pointer constant with type: '" + 
2846                      (*yyvsp[-1].TypeVal)->getDescription() + "'!");
2847
2848     yyval.ConstVal = ConstantPointerNull::get(PTy);
2849     delete yyvsp[-1].TypeVal;
2850     CHECK_FOR_ERROR
2851   ;
2852     break;}
2853 case 103:
2854 #line 1481 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2855 {
2856     yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
2857     delete yyvsp[-1].TypeVal;
2858     CHECK_FOR_ERROR
2859   ;
2860     break;}
2861 case 104:
2862 #line 1486 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2863 {
2864     const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
2865     if (Ty == 0)
2866       GEN_ERROR("Global const reference must be a pointer type!");
2867
2868     // ConstExprs can exist in the body of a function, thus creating
2869     // GlobalValues whenever they refer to a variable.  Because we are in
2870     // the context of a function, getValNonImprovising will search the functions
2871     // symbol table instead of the module symbol table for the global symbol,
2872     // which throws things all off.  To get around this, we just tell
2873     // getValNonImprovising that we are at global scope here.
2874     //
2875     Function *SavedCurFn = CurFun.CurrentFunction;
2876     CurFun.CurrentFunction = 0;
2877
2878     Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal);
2879     CHECK_FOR_ERROR
2880
2881     CurFun.CurrentFunction = SavedCurFn;
2882
2883     // If this is an initializer for a constant pointer, which is referencing a
2884     // (currently) undefined variable, create a stub now that shall be replaced
2885     // in the future with the right type of variable.
2886     //
2887     if (V == 0) {
2888       assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
2889       const PointerType *PT = cast<PointerType>(Ty);
2890
2891       // First check to see if the forward references value is already created!
2892       PerModuleInfo::GlobalRefsType::iterator I =
2893         CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
2894     
2895       if (I != CurModule.GlobalRefs.end()) {
2896         V = I->second;             // Placeholder already exists, use it...
2897         yyvsp[0].ValIDVal.destroy();
2898       } else {
2899         std::string Name;
2900         if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name;
2901
2902         // Create the forward referenced global.
2903         GlobalValue *GV;
2904         if (const FunctionType *FTy = 
2905                  dyn_cast<FunctionType>(PT->getElementType())) {
2906           GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
2907                             CurModule.CurrentModule);
2908         } else {
2909           GV = new GlobalVariable(PT->getElementType(), false,
2910                                   GlobalValue::ExternalLinkage, 0,
2911                                   Name, CurModule.CurrentModule);
2912         }
2913
2914         // Keep track of the fact that we have a forward ref to recycle it
2915         CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
2916         V = GV;
2917       }
2918     }
2919
2920     yyval.ConstVal = cast<GlobalValue>(V);
2921     delete yyvsp[-1].TypeVal;            // Free the type handle
2922     CHECK_FOR_ERROR
2923   ;
2924     break;}
2925 case 105:
2926 #line 1547 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2927 {
2928     if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
2929       GEN_ERROR("Mismatched types for constant expression!");
2930     yyval.ConstVal = yyvsp[0].ConstVal;
2931     delete yyvsp[-1].TypeVal;
2932     CHECK_FOR_ERROR
2933   ;
2934     break;}
2935 case 106:
2936 #line 1554 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2937 {
2938     const Type *Ty = yyvsp[-1].TypeVal->get();
2939     if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
2940       GEN_ERROR("Cannot create a null initialized value of this type!");
2941     yyval.ConstVal = Constant::getNullValue(Ty);
2942     delete yyvsp[-1].TypeVal;
2943     CHECK_FOR_ERROR
2944   ;
2945     break;}
2946 case 107:
2947 #line 1563 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2948 {      // integral constants
2949     if (!ConstantSInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
2950       GEN_ERROR("Constant value doesn't fit in type!");
2951     yyval.ConstVal = ConstantSInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val);
2952     CHECK_FOR_ERROR
2953   ;
2954     break;}
2955 case 108:
2956 #line 1569 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2957 {            // integral constants
2958     if (!ConstantUInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
2959       GEN_ERROR("Constant value doesn't fit in type!");
2960     yyval.ConstVal = ConstantUInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val);
2961     CHECK_FOR_ERROR
2962   ;
2963     break;}
2964 case 109:
2965 #line 1575 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2966 {                      // Boolean constants
2967     yyval.ConstVal = ConstantBool::getTrue();
2968     CHECK_FOR_ERROR
2969   ;
2970     break;}
2971 case 110:
2972 #line 1579 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2973 {                     // Boolean constants
2974     yyval.ConstVal = ConstantBool::getFalse();
2975     CHECK_FOR_ERROR
2976   ;
2977     break;}
2978 case 111:
2979 #line 1583 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2980 {                   // Float & Double constants
2981     if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
2982       GEN_ERROR("Floating point constant invalid for type!!");
2983     yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
2984     CHECK_FOR_ERROR
2985   ;
2986     break;}
2987 case 112:
2988 #line 1591 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
2989 {
2990     if (!yyvsp[-3].ConstVal->getType()->isFirstClassType())
2991       GEN_ERROR("cast constant expression from a non-primitive type: '" +
2992                      yyvsp[-3].ConstVal->getType()->getDescription() + "'!");
2993     if (!yyvsp[-1].TypeVal->get()->isFirstClassType())
2994       GEN_ERROR("cast constant expression to a non-primitive type: '" +
2995                      yyvsp[-1].TypeVal->get()->getDescription() + "'!");
2996     yyval.ConstVal = ConstantExpr::getCast(yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get());
2997     delete yyvsp[-1].TypeVal;
2998     CHECK_FOR_ERROR
2999   ;
3000     break;}
3001 case 113:
3002 #line 1602 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3003 {
3004     if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3005       GEN_ERROR("GetElementPtr requires a pointer operand!");
3006
3007     // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
3008     // indices to uint struct indices for compatibility.
3009     generic_gep_type_iterator<std::vector<Value*>::iterator>
3010       GTI = gep_type_begin(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()),
3011       GTE = gep_type_end(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
3012     for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
3013       if (isa<StructType>(*GTI))        // Only change struct indices
3014         if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[-1].ValueList)[i]))
3015           if (CUI->getType() == Type::UByteTy)
3016             (*yyvsp[-1].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3017
3018     const Type *IdxTy =
3019       GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true);
3020     if (!IdxTy)
3021       GEN_ERROR("Index list invalid for constant getelementptr!");
3022
3023     std::vector<Constant*> IdxVec;
3024     for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3025       if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3026         IdxVec.push_back(C);
3027       else
3028         GEN_ERROR("Indices to constant getelementptr must be constants!");
3029
3030     delete yyvsp[-1].ValueList;
3031
3032     yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec);
3033     CHECK_FOR_ERROR
3034   ;
3035     break;}
3036 case 114:
3037 #line 1634 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3038 {
3039     if (yyvsp[-5].ConstVal->getType() != Type::BoolTy)
3040       GEN_ERROR("Select condition must be of boolean type!");
3041     if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3042       GEN_ERROR("Select operand types must match!");
3043     yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3044     CHECK_FOR_ERROR
3045   ;
3046     break;}
3047 case 115:
3048 #line 1642 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3049 {
3050     if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3051       GEN_ERROR("Binary operator types must match!");
3052     // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
3053     // To retain backward compatibility with these early compilers, we emit a
3054     // cast to the appropriate integer type automatically if we are in the
3055     // broken case.  See PR424 for more information.
3056     if (!isa<PointerType>(yyvsp[-3].ConstVal->getType())) {
3057       yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3058     } else {
3059       const Type *IntPtrTy = 0;
3060       switch (CurModule.CurrentModule->getPointerSize()) {
3061       case Module::Pointer32: IntPtrTy = Type::IntTy; break;
3062       case Module::Pointer64: IntPtrTy = Type::LongTy; break;
3063       default: GEN_ERROR("invalid pointer binary constant expr!");
3064       }
3065       yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, ConstantExpr::getCast(yyvsp[-3].ConstVal, IntPtrTy),
3066                              ConstantExpr::getCast(yyvsp[-1].ConstVal, IntPtrTy));
3067       yyval.ConstVal = ConstantExpr::getCast(yyval.ConstVal, yyvsp[-3].ConstVal->getType());
3068     }
3069     CHECK_FOR_ERROR
3070   ;
3071     break;}
3072 case 116:
3073 #line 1664 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3074 {
3075     if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3076       GEN_ERROR("Logical operator types must match!");
3077     if (!yyvsp[-3].ConstVal->getType()->isIntegral()) {
3078       if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()) || 
3079           !cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral())
3080         GEN_ERROR("Logical operator requires integral operands!");
3081     }
3082     yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3083     CHECK_FOR_ERROR
3084   ;
3085     break;}
3086 case 117:
3087 #line 1675 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3088 {
3089     if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3090       GEN_ERROR("setcc operand types must match!");
3091     yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3092     CHECK_FOR_ERROR
3093   ;
3094     break;}
3095 case 118:
3096 #line 1681 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3097 {
3098     if (yyvsp[-1].ConstVal->getType() != Type::UByteTy)
3099       GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3100     if (!yyvsp[-3].ConstVal->getType()->isInteger())
3101       GEN_ERROR("Shift constant expression requires integer operand!");
3102     yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3103     CHECK_FOR_ERROR
3104   ;
3105     break;}
3106 case 119:
3107 #line 1689 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3108 {
3109     if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3110       GEN_ERROR("Invalid extractelement operands!");
3111     yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3112     CHECK_FOR_ERROR
3113   ;
3114     break;}
3115 case 120:
3116 #line 1695 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3117 {
3118     if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3119       GEN_ERROR("Invalid insertelement operands!");
3120     yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3121     CHECK_FOR_ERROR
3122   ;
3123     break;}
3124 case 121:
3125 #line 1701 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3126 {
3127     if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3128       GEN_ERROR("Invalid shufflevector operands!");
3129     yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3130     CHECK_FOR_ERROR
3131   ;
3132     break;}
3133 case 122:
3134 #line 1710 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3135 {
3136     (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3137     CHECK_FOR_ERROR
3138   ;
3139     break;}
3140 case 123:
3141 #line 1714 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3142 {
3143     yyval.ConstVector = new std::vector<Constant*>();
3144     yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3145     CHECK_FOR_ERROR
3146   ;
3147     break;}
3148 case 124:
3149 #line 1722 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3150 { yyval.BoolVal = false; ;
3151     break;}
3152 case 125:
3153 #line 1722 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3154 { yyval.BoolVal = true; ;
3155     break;}
3156 case 126:
3157 #line 1732 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3158 {
3159   yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
3160   CurModule.ModuleDone();
3161   CHECK_FOR_ERROR;
3162 ;
3163     break;}
3164 case 127:
3165 #line 1740 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3166 {
3167     yyval.ModuleVal = yyvsp[-1].ModuleVal;
3168     CurFun.FunctionDone();
3169     CHECK_FOR_ERROR
3170   ;
3171     break;}
3172 case 128:
3173 #line 1745 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3174 {
3175     yyval.ModuleVal = yyvsp[-1].ModuleVal;
3176     CHECK_FOR_ERROR
3177   ;
3178     break;}
3179 case 129:
3180 #line 1749 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3181 {
3182     yyval.ModuleVal = yyvsp[-3].ModuleVal;
3183     CHECK_FOR_ERROR
3184   ;
3185     break;}
3186 case 130:
3187 #line 1753 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3188 {
3189     yyval.ModuleVal = yyvsp[-1].ModuleVal;
3190     CHECK_FOR_ERROR
3191   ;
3192     break;}
3193 case 131:
3194 #line 1757 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3195 {
3196     yyval.ModuleVal = CurModule.CurrentModule;
3197     // Emit an error if there are any unresolved types left.
3198     if (!CurModule.LateResolveTypes.empty()) {
3199       const ValID &DID = CurModule.LateResolveTypes.begin()->first;
3200       if (DID.Type == ValID::NameVal) {
3201         GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
3202       } else {
3203         GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
3204       }
3205     }
3206     CHECK_FOR_ERROR
3207   ;
3208     break;}
3209 case 132:
3210 #line 1772 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3211 {
3212     // Eagerly resolve types.  This is not an optimization, this is a
3213     // requirement that is due to the fact that we could have this:
3214     //
3215     // %list = type { %list * }
3216     // %list = type { %list * }    ; repeated type decl
3217     //
3218     // If types are not resolved eagerly, then the two types will not be
3219     // determined to be the same type!
3220     //
3221     ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
3222
3223     if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
3224       CHECK_FOR_ERROR
3225       // If this is a named type that is not a redefinition, add it to the slot
3226       // table.
3227       CurModule.Types.push_back(*yyvsp[0].TypeVal);
3228     }
3229
3230     delete yyvsp[0].TypeVal;
3231     CHECK_FOR_ERROR
3232   ;
3233     break;}
3234 case 133:
3235 #line 1794 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3236 {       // Function prototypes can be in const pool
3237     CHECK_FOR_ERROR
3238   ;
3239     break;}
3240 case 134:
3241 #line 1797 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3242 {  // Asm blocks can be in the const pool
3243     CHECK_FOR_ERROR
3244   ;
3245     break;}
3246 case 135:
3247 #line 1800 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3248 {
3249     if (yyvsp[0].ConstVal == 0) 
3250       GEN_ERROR("Global value initializer is not a constant!");
3251     CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal);
3252     CHECK_FOR_ERROR
3253   ;
3254     break;}
3255 case 136:
3256 #line 1805 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3257 {
3258     CurGV = 0;
3259   ;
3260     break;}
3261 case 137:
3262 #line 1808 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3263 {
3264     CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
3265     CHECK_FOR_ERROR
3266     delete yyvsp[0].TypeVal;
3267   ;
3268     break;}
3269 case 138:
3270 #line 1812 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3271 {
3272     CurGV = 0;
3273     CHECK_FOR_ERROR
3274   ;
3275     break;}
3276 case 139:
3277 #line 1816 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3278 {
3279     CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
3280     CHECK_FOR_ERROR
3281     delete yyvsp[0].TypeVal;
3282   ;
3283     break;}
3284 case 140:
3285 #line 1820 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3286 {
3287     CurGV = 0;
3288     CHECK_FOR_ERROR
3289   ;
3290     break;}
3291 case 141:
3292 #line 1824 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3293 {
3294     CurGV = 
3295       ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalWeakLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
3296     CHECK_FOR_ERROR
3297     delete yyvsp[0].TypeVal;
3298   ;
3299     break;}
3300 case 142:
3301 #line 1829 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3302 {
3303     CurGV = 0;
3304     CHECK_FOR_ERROR
3305   ;
3306     break;}
3307 case 143:
3308 #line 1833 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3309
3310     CHECK_FOR_ERROR
3311   ;
3312     break;}
3313 case 144:
3314 #line 1836 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3315 {
3316     CHECK_FOR_ERROR
3317   ;
3318     break;}
3319 case 145:
3320 #line 1839 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3321
3322   ;
3323     break;}
3324 case 146:
3325 #line 1843 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3326 {
3327   const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3328   char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
3329   std::string NewAsm(yyvsp[0].StrVal, EndStr);
3330   free(yyvsp[0].StrVal);
3331
3332   if (AsmSoFar.empty())
3333     CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
3334   else
3335     CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
3336   CHECK_FOR_ERROR
3337 ;
3338     break;}
3339 case 147:
3340 #line 1856 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3341 { yyval.Endianness = Module::BigEndian; ;
3342     break;}
3343 case 148:
3344 #line 1857 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3345 { yyval.Endianness = Module::LittleEndian; ;
3346     break;}
3347 case 149:
3348 #line 1859 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3349 {
3350     CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness);
3351     CHECK_FOR_ERROR
3352   ;
3353     break;}
3354 case 150:
3355 #line 1863 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3356 {
3357     if (yyvsp[0].UInt64Val == 32)
3358       CurModule.CurrentModule->setPointerSize(Module::Pointer32);
3359     else if (yyvsp[0].UInt64Val == 64)
3360       CurModule.CurrentModule->setPointerSize(Module::Pointer64);
3361     else
3362       GEN_ERROR("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!");
3363     CHECK_FOR_ERROR
3364   ;
3365     break;}
3366 case 151:
3367 #line 1872 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3368 {
3369     CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
3370     free(yyvsp[0].StrVal);
3371     CHECK_FOR_ERROR
3372   ;
3373     break;}
3374 case 152:
3375 #line 1877 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3376 {
3377     CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal);
3378     free(yyvsp[0].StrVal);
3379     CHECK_FOR_ERROR
3380   ;
3381     break;}
3382 case 154:
3383 #line 1885 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3384 {
3385           CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
3386           free(yyvsp[0].StrVal);
3387           CHECK_FOR_ERROR
3388         ;
3389     break;}
3390 case 155:
3391 #line 1890 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3392 {
3393           CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
3394           free(yyvsp[0].StrVal);
3395           CHECK_FOR_ERROR
3396         ;
3397     break;}
3398 case 156:
3399 #line 1895 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3400 {
3401           CHECK_FOR_ERROR
3402         ;
3403     break;}
3404 case 160:
3405 #line 1905 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3406 { yyval.StrVal = 0; ;
3407     break;}
3408 case 161:
3409 #line 1907 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3410 {
3411   if (*yyvsp[-1].TypeVal == Type::VoidTy)
3412     GEN_ERROR("void typed arguments are invalid!");
3413   yyval.ArgVal = new std::pair<PATypeHolder*, char*>(yyvsp[-1].TypeVal, yyvsp[0].StrVal);
3414   CHECK_FOR_ERROR
3415 ;
3416     break;}
3417 case 162:
3418 #line 1914 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3419 {
3420     yyval.ArgList = yyvsp[-2].ArgList;
3421     yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal);
3422     delete yyvsp[0].ArgVal;
3423     CHECK_FOR_ERROR
3424   ;
3425     break;}
3426 case 163:
3427 #line 1920 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3428 {
3429     yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
3430     yyval.ArgList->push_back(*yyvsp[0].ArgVal);
3431     delete yyvsp[0].ArgVal;
3432     CHECK_FOR_ERROR
3433   ;
3434     break;}
3435 case 164:
3436 #line 1927 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3437 {
3438     yyval.ArgList = yyvsp[0].ArgList;
3439     CHECK_FOR_ERROR
3440   ;
3441     break;}
3442 case 165:
3443 #line 1931 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3444 {
3445     yyval.ArgList = yyvsp[-2].ArgList;
3446     yyval.ArgList->push_back(std::pair<PATypeHolder*,
3447                             char*>(new PATypeHolder(Type::VoidTy), 0));
3448     CHECK_FOR_ERROR
3449   ;
3450     break;}
3451 case 166:
3452 #line 1937 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3453 {
3454     yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
3455     yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
3456     CHECK_FOR_ERROR
3457   ;
3458     break;}
3459 case 167:
3460 #line 1942 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3461 {
3462     yyval.ArgList = 0;
3463     CHECK_FOR_ERROR
3464   ;
3465     break;}
3466 case 168:
3467 #line 1948 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3468 {
3469   UnEscapeLexed(yyvsp[-5].StrVal);
3470   std::string FunctionName(yyvsp[-5].StrVal);
3471   free(yyvsp[-5].StrVal);  // Free strdup'd memory!
3472   
3473   if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy)
3474     GEN_ERROR("LLVM functions cannot return aggregate types!");
3475
3476   std::vector<const Type*> ParamTypeList;
3477   if (yyvsp[-3].ArgList) {   // If there are arguments...
3478     for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
3479          I != yyvsp[-3].ArgList->end(); ++I)
3480       ParamTypeList.push_back(I->first->get());
3481   }
3482
3483   bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
3484   if (isVarArg) ParamTypeList.pop_back();
3485
3486   const FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg);
3487   const PointerType *PFT = PointerType::get(FT);
3488   delete yyvsp[-6].TypeVal;
3489
3490   ValID ID;
3491   if (!FunctionName.empty()) {
3492     ID = ValID::create((char*)FunctionName.c_str());
3493   } else {
3494     ID = ValID::create((int)CurModule.Values[PFT].size());
3495   }
3496
3497   Function *Fn = 0;
3498   // See if this function was forward referenced.  If so, recycle the object.
3499   if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
3500     // Move the function to the end of the list, from whereever it was 
3501     // previously inserted.
3502     Fn = cast<Function>(FWRef);
3503     CurModule.CurrentModule->getFunctionList().remove(Fn);
3504     CurModule.CurrentModule->getFunctionList().push_back(Fn);
3505   } else if (!FunctionName.empty() &&     // Merge with an earlier prototype?
3506              (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
3507     // If this is the case, either we need to be a forward decl, or it needs 
3508     // to be.
3509     if (!CurFun.isDeclare && !Fn->isExternal())
3510       GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
3511     
3512     // Make sure to strip off any argument names so we can't get conflicts.
3513     if (Fn->isExternal())
3514       for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
3515            AI != AE; ++AI)
3516         AI->setName("");
3517   } else  {  // Not already defined?
3518     Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
3519                       CurModule.CurrentModule);
3520
3521     InsertValue(Fn, CurModule.Values);
3522   }
3523
3524   CurFun.FunctionStart(Fn);
3525
3526   if (CurFun.isDeclare) {
3527     // If we have declaration, always overwrite linkage.  This will allow us to
3528     // correctly handle cases, when pointer to function is passed as argument to
3529     // another function.
3530     Fn->setLinkage(CurFun.Linkage);
3531   }
3532   Fn->setCallingConv(yyvsp[-7].UIntVal);
3533   Fn->setAlignment(yyvsp[0].UIntVal);
3534   if (yyvsp[-1].StrVal) {
3535     Fn->setSection(yyvsp[-1].StrVal);
3536     free(yyvsp[-1].StrVal);
3537   }
3538
3539   // Add all of the arguments we parsed to the function...
3540   if (yyvsp[-3].ArgList) {                     // Is null if empty...
3541     if (isVarArg) {  // Nuke the last entry
3542       assert(yyvsp[-3].ArgList->back().first->get() == Type::VoidTy && yyvsp[-3].ArgList->back().second == 0&&
3543              "Not a varargs marker!");
3544       delete yyvsp[-3].ArgList->back().first;
3545       yyvsp[-3].ArgList->pop_back();  // Delete the last entry
3546     }
3547     Function::arg_iterator ArgIt = Fn->arg_begin();
3548     for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
3549          I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) {
3550       delete I->first;                          // Delete the typeholder...
3551
3552       setValueName(ArgIt, I->second);           // Insert arg into symtab...
3553       CHECK_FOR_ERROR
3554       InsertValue(ArgIt);
3555     }
3556
3557     delete yyvsp[-3].ArgList;                     // We're now done with the argument list
3558   }
3559   CHECK_FOR_ERROR
3560 ;
3561     break;}
3562 case 171:
3563 #line 2044 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3564 {
3565   yyval.FunctionVal = CurFun.CurrentFunction;
3566
3567   // Make sure that we keep track of the linkage type even if there was a
3568   // previous "declare".
3569   yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage);
3570 ;
3571     break;}
3572 case 174:
3573 #line 2054 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3574 {
3575   yyval.FunctionVal = yyvsp[-1].FunctionVal;
3576   CHECK_FOR_ERROR
3577 ;
3578     break;}
3579 case 176:
3580 #line 2060 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3581 { CurFun.Linkage = GlobalValue::DLLImportLinkage ;
3582     break;}
3583 case 177:
3584 #line 2061 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3585 { CurFun.Linkage = GlobalValue::DLLImportLinkage ;
3586     break;}
3587 case 178:
3588 #line 2063 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3589 { CurFun.isDeclare = true; ;
3590     break;}
3591 case 179:
3592 #line 2063 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3593 {
3594     yyval.FunctionVal = CurFun.CurrentFunction;
3595     CurFun.FunctionDone();
3596     CHECK_FOR_ERROR
3597   ;
3598     break;}
3599 case 180:
3600 #line 2073 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3601 {
3602     yyval.BoolVal = false;
3603     CHECK_FOR_ERROR
3604   ;
3605     break;}
3606 case 181:
3607 #line 2077 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3608 {
3609     yyval.BoolVal = true;
3610     CHECK_FOR_ERROR
3611   ;
3612     break;}
3613 case 182:
3614 #line 2082 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3615 {    // A reference to a direct constant
3616     yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
3617     CHECK_FOR_ERROR
3618   ;
3619     break;}
3620 case 183:
3621 #line 2086 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3622 {
3623     yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
3624     CHECK_FOR_ERROR
3625   ;
3626     break;}
3627 case 184:
3628 #line 2090 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3629 {                     // Perhaps it's an FP constant?
3630     yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
3631     CHECK_FOR_ERROR
3632   ;
3633     break;}
3634 case 185:
3635 #line 2094 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3636 {
3637     yyval.ValIDVal = ValID::create(ConstantBool::getTrue());
3638     CHECK_FOR_ERROR
3639   ;
3640     break;}
3641 case 186:
3642 #line 2098 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3643 {
3644     yyval.ValIDVal = ValID::create(ConstantBool::getFalse());
3645     CHECK_FOR_ERROR
3646   ;
3647     break;}
3648 case 187:
3649 #line 2102 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3650 {
3651     yyval.ValIDVal = ValID::createNull();
3652     CHECK_FOR_ERROR
3653   ;
3654     break;}
3655 case 188:
3656 #line 2106 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3657 {
3658     yyval.ValIDVal = ValID::createUndef();
3659     CHECK_FOR_ERROR
3660   ;
3661     break;}
3662 case 189:
3663 #line 2110 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3664 {     // A vector zero constant.
3665     yyval.ValIDVal = ValID::createZeroInit();
3666     CHECK_FOR_ERROR
3667   ;
3668     break;}
3669 case 190:
3670 #line 2114 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3671 { // Nonempty unsized packed vector
3672     const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
3673     int NumElements = yyvsp[-1].ConstVector->size(); 
3674     
3675     PackedType* pt = PackedType::get(ETy, NumElements);
3676     PATypeHolder* PTy = new PATypeHolder(
3677                                          HandleUpRefs(
3678                                             PackedType::get(
3679                                                 ETy, 
3680                                                 NumElements)
3681                                             )
3682                                          );
3683     
3684     // Verify all elements are correct type!
3685     for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3686       if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3687         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
3688                      ETy->getDescription() +"' as required!\nIt is of type '" +
3689                      (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3690     }
3691
3692     yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector));
3693     delete PTy; delete yyvsp[-1].ConstVector;
3694     CHECK_FOR_ERROR
3695   ;
3696     break;}
3697 case 191:
3698 #line 2139 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3699 {
3700     yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
3701     CHECK_FOR_ERROR
3702   ;
3703     break;}
3704 case 192:
3705 #line 2143 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3706 {
3707     char *End = UnEscapeLexed(yyvsp[-2].StrVal, true);
3708     std::string AsmStr = std::string(yyvsp[-2].StrVal, End);
3709     End = UnEscapeLexed(yyvsp[0].StrVal, true);
3710     std::string Constraints = std::string(yyvsp[0].StrVal, End);
3711     yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal);
3712     free(yyvsp[-2].StrVal);
3713     free(yyvsp[0].StrVal);
3714     CHECK_FOR_ERROR
3715   ;
3716     break;}
3717 case 193:
3718 #line 2157 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3719 {  // Is it an integer reference...?
3720     yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
3721     CHECK_FOR_ERROR
3722   ;
3723     break;}
3724 case 194:
3725 #line 2161 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3726 {                   // Is it a named reference...?
3727     yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
3728     CHECK_FOR_ERROR
3729   ;
3730     break;}
3731 case 197:
3732 #line 2173 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3733 {
3734     yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal;
3735     CHECK_FOR_ERROR
3736   ;
3737     break;}
3738 case 198:
3739 #line 2178 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3740 {
3741     yyval.FunctionVal = yyvsp[-1].FunctionVal;
3742     CHECK_FOR_ERROR
3743   ;
3744     break;}
3745 case 199:
3746 #line 2182 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3747 { // Do not allow functions with 0 basic blocks   
3748     yyval.FunctionVal = yyvsp[-1].FunctionVal;
3749     CHECK_FOR_ERROR
3750   ;
3751     break;}
3752 case 200:
3753 #line 2191 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3754 {
3755     setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
3756     CHECK_FOR_ERROR
3757     InsertValue(yyvsp[0].TermInstVal);
3758
3759     yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
3760     InsertValue(yyvsp[-2].BasicBlockVal);
3761     yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
3762     CHECK_FOR_ERROR
3763   ;
3764     break;}
3765 case 201:
3766 #line 2202 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3767 {
3768     yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
3769     yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
3770     CHECK_FOR_ERROR
3771   ;
3772     break;}
3773 case 202:
3774 #line 2207 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3775 {
3776     yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
3777     CHECK_FOR_ERROR
3778
3779     // Make sure to move the basic block to the correct location in the
3780     // function, instead of leaving it inserted wherever it was first
3781     // referenced.
3782     Function::BasicBlockListType &BBL = 
3783       CurFun.CurrentFunction->getBasicBlockList();
3784     BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3785     CHECK_FOR_ERROR
3786   ;
3787     break;}
3788 case 203:
3789 #line 2219 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3790 {
3791     yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true);
3792     CHECK_FOR_ERROR
3793
3794     // Make sure to move the basic block to the correct location in the
3795     // function, instead of leaving it inserted wherever it was first
3796     // referenced.
3797     Function::BasicBlockListType &BBL = 
3798       CurFun.CurrentFunction->getBasicBlockList();
3799     BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
3800     CHECK_FOR_ERROR
3801   ;
3802     break;}
3803 case 204:
3804 #line 2232 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3805 {              // Return with a result...
3806     yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
3807     CHECK_FOR_ERROR
3808   ;
3809     break;}
3810 case 205:
3811 #line 2236 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3812 {                                       // Return with no result...
3813     yyval.TermInstVal = new ReturnInst();
3814     CHECK_FOR_ERROR
3815   ;
3816     break;}
3817 case 206:
3818 #line 2240 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3819 {                         // Unconditional Branch...
3820     BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
3821     CHECK_FOR_ERROR
3822     yyval.TermInstVal = new BranchInst(tmpBB);
3823   ;
3824     break;}
3825 case 207:
3826 #line 2245 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3827 {  
3828     BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
3829     CHECK_FOR_ERROR
3830     BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
3831     CHECK_FOR_ERROR
3832     Value* tmpVal = getVal(Type::BoolTy, yyvsp[-6].ValIDVal);
3833     CHECK_FOR_ERROR
3834     yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
3835   ;
3836     break;}
3837 case 208:
3838 #line 2254 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3839 {
3840     Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
3841     CHECK_FOR_ERROR
3842     BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
3843     CHECK_FOR_ERROR
3844     SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
3845     yyval.TermInstVal = S;
3846
3847     std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
3848       E = yyvsp[-1].JumpTable->end();
3849     for (; I != E; ++I) {
3850       if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
3851           S->addCase(CI, I->second);
3852       else
3853         GEN_ERROR("Switch case is constant, but not a simple integer!");
3854     }
3855     delete yyvsp[-1].JumpTable;
3856     CHECK_FOR_ERROR
3857   ;
3858     break;}
3859 case 209:
3860 #line 2273 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3861 {
3862     Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
3863     CHECK_FOR_ERROR
3864     BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
3865     CHECK_FOR_ERROR
3866     SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
3867     yyval.TermInstVal = S;
3868     CHECK_FOR_ERROR
3869   ;
3870     break;}
3871 case 210:
3872 #line 2283 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3873 {
3874     const PointerType *PFTy;
3875     const FunctionType *Ty;
3876
3877     if (!(PFTy = dyn_cast<PointerType>(yyvsp[-10].TypeVal->get())) ||
3878         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
3879       // Pull out the types of all of the arguments...
3880       std::vector<const Type*> ParamTypes;
3881       if (yyvsp[-7].ValueList) {
3882         for (std::vector<Value*>::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end();
3883              I != E; ++I)
3884           ParamTypes.push_back((*I)->getType());
3885       }
3886
3887       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
3888       if (isVarArg) ParamTypes.pop_back();
3889
3890       Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg);
3891       PFTy = PointerType::get(Ty);
3892     }
3893
3894     Value *V = getVal(PFTy, yyvsp[-9].ValIDVal);   // Get the function we're calling...
3895     CHECK_FOR_ERROR
3896     BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
3897     CHECK_FOR_ERROR
3898     BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
3899     CHECK_FOR_ERROR
3900
3901     // Create the call node...
3902     if (!yyvsp[-7].ValueList) {                                   // Has no arguments?
3903       yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector<Value*>());
3904     } else {                                     // Has arguments?
3905       // Loop through FunctionType's arguments and ensure they are specified
3906       // correctly!
3907       //
3908       FunctionType::param_iterator I = Ty->param_begin();
3909       FunctionType::param_iterator E = Ty->param_end();
3910       std::vector<Value*>::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end();
3911
3912       for (; ArgI != ArgE && I != E; ++ArgI, ++I)
3913         if ((*ArgI)->getType() != *I)
3914           GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
3915                          (*I)->getDescription() + "'!");
3916
3917       if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
3918         GEN_ERROR("Invalid number of parameters detected!");
3919
3920       yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList);
3921     }
3922     cast<InvokeInst>(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal);
3923   
3924     delete yyvsp[-10].TypeVal;
3925     delete yyvsp[-7].ValueList;
3926     CHECK_FOR_ERROR
3927   ;
3928     break;}
3929 case 211:
3930 #line 2338 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3931 {
3932     yyval.TermInstVal = new UnwindInst();
3933     CHECK_FOR_ERROR
3934   ;
3935     break;}
3936 case 212:
3937 #line 2342 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3938 {
3939     yyval.TermInstVal = new UnreachableInst();
3940     CHECK_FOR_ERROR
3941   ;
3942     break;}
3943 case 213:
3944 #line 2349 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3945 {
3946     yyval.JumpTable = yyvsp[-5].JumpTable;
3947     Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3948     CHECK_FOR_ERROR
3949     if (V == 0)
3950       GEN_ERROR("May only switch on a constant pool value!");
3951
3952     BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
3953     CHECK_FOR_ERROR
3954     yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
3955   ;
3956     break;}
3957 case 214:
3958 #line 2360 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3959 {
3960     yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
3961     Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
3962     CHECK_FOR_ERROR
3963
3964     if (V == 0)
3965       GEN_ERROR("May only switch on a constant pool value!");
3966
3967     BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
3968     CHECK_FOR_ERROR
3969     yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); 
3970   ;
3971     break;}
3972 case 215:
3973 #line 2373 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3974 {
3975   // Is this definition named?? if so, assign the name...
3976   setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
3977   CHECK_FOR_ERROR
3978   InsertValue(yyvsp[0].InstVal);
3979   yyval.InstVal = yyvsp[0].InstVal;
3980   CHECK_FOR_ERROR
3981 ;
3982     break;}
3983 case 216:
3984 #line 2382 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3985 {    // Used for PHI nodes
3986     yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
3987     Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
3988     CHECK_FOR_ERROR
3989     BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
3990     CHECK_FOR_ERROR
3991     yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
3992     delete yyvsp[-5].TypeVal;
3993   ;
3994     break;}
3995 case 217:
3996 #line 2391 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3997 {
3998     yyval.PHIList = yyvsp[-6].PHIList;
3999     Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4000     CHECK_FOR_ERROR
4001     BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4002     CHECK_FOR_ERROR
4003     yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4004   ;
4005     break;}
4006 case 218:
4007 #line 2401 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4008 {    // Used for call statements, and memory insts...
4009     yyval.ValueList = new std::vector<Value*>();
4010     yyval.ValueList->push_back(yyvsp[0].ValueVal);
4011   ;
4012     break;}
4013 case 219:
4014 #line 2405 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4015 {
4016     yyval.ValueList = yyvsp[-2].ValueList;
4017     yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal);
4018     CHECK_FOR_ERROR
4019   ;
4020     break;}
4021 case 221:
4022 #line 2412 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4023 { yyval.ValueList = 0; ;
4024     break;}
4025 case 222:
4026 #line 2414 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4027 {
4028     yyval.BoolVal = true;
4029     CHECK_FOR_ERROR
4030   ;
4031     break;}
4032 case 223:
4033 #line 2418 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4034 {
4035     yyval.BoolVal = false;
4036     CHECK_FOR_ERROR
4037   ;
4038     break;}
4039 case 224:
4040 #line 2423 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4041 {
4042     if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && 
4043         !isa<PackedType>((*yyvsp[-3].TypeVal).get()))
4044       GEN_ERROR(
4045         "Arithmetic operator requires integer, FP, or packed operands!");
4046     if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) && yyvsp[-4].BinaryOpVal == Instruction::Rem)
4047       GEN_ERROR("Rem not supported on packed types!");
4048     Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); 
4049     CHECK_FOR_ERROR
4050     Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4051     CHECK_FOR_ERROR
4052     yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4053     if (yyval.InstVal == 0)
4054       GEN_ERROR("binary operator returned null!");
4055     delete yyvsp[-3].TypeVal;
4056   ;
4057     break;}
4058 case 225:
4059 #line 2439 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4060 {
4061     if (!(*yyvsp[-3].TypeVal)->isIntegral()) {
4062       if (!isa<PackedType>(yyvsp[-3].TypeVal->get()) ||
4063           !cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral())
4064         GEN_ERROR("Logical operator requires integral operands!");
4065     }
4066     Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4067     CHECK_FOR_ERROR
4068     Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4069     CHECK_FOR_ERROR
4070     yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4071     if (yyval.InstVal == 0)
4072       GEN_ERROR("binary operator returned null!");
4073     delete yyvsp[-3].TypeVal;
4074   ;
4075     break;}
4076 case 226:
4077 #line 2454 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4078 {
4079     if(isa<PackedType>((*yyvsp[-3].TypeVal).get())) {
4080       GEN_ERROR(
4081         "PackedTypes currently not supported in setcc instructions!");
4082     }
4083     Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4084     CHECK_FOR_ERROR
4085     Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4086     CHECK_FOR_ERROR
4087     yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4088     if (yyval.InstVal == 0)
4089       GEN_ERROR("binary operator returned null!");
4090     delete yyvsp[-3].TypeVal;
4091   ;
4092     break;}
4093 case 227:
4094 #line 2468 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4095 {
4096     std::cerr << "WARNING: Use of eliminated 'not' instruction:"
4097               << " Replacing with 'xor'.\n";
4098
4099     Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType());
4100     if (Ones == 0)
4101       GEN_ERROR("Expected integral type for not instruction!");
4102
4103     yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones);
4104     if (yyval.InstVal == 0)
4105       GEN_ERROR("Could not create a xor instruction!");
4106     CHECK_FOR_ERROR
4107   ;
4108     break;}
4109 case 228:
4110 #line 2481 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4111 {
4112     if (yyvsp[0].ValueVal->getType() != Type::UByteTy)
4113       GEN_ERROR("Shift amount must be ubyte!");
4114     if (!yyvsp[-2].ValueVal->getType()->isInteger())
4115       GEN_ERROR("Shift constant expression requires integer operand!");
4116     yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4117     CHECK_FOR_ERROR
4118   ;
4119     break;}
4120 case 229:
4121 #line 2489 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4122 {
4123     if (!yyvsp[0].TypeVal->get()->isFirstClassType())
4124       GEN_ERROR("cast instruction to a non-primitive type: '" +
4125                      yyvsp[0].TypeVal->get()->getDescription() + "'!");
4126     yyval.InstVal = new CastInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4127     delete yyvsp[0].TypeVal;
4128     CHECK_FOR_ERROR
4129   ;
4130     break;}
4131 case 230:
4132 #line 2497 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4133 {
4134     if (yyvsp[-4].ValueVal->getType() != Type::BoolTy)
4135       GEN_ERROR("select condition must be boolean!");
4136     if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
4137       GEN_ERROR("select value types should match!");
4138     yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4139     CHECK_FOR_ERROR
4140   ;
4141     break;}
4142 case 231:
4143 #line 2505 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4144 {
4145     NewVarArgs = true;
4146     yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4147     delete yyvsp[0].TypeVal;
4148     CHECK_FOR_ERROR
4149   ;
4150     break;}
4151 case 232:
4152 #line 2511 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4153 {
4154     ObsoleteVarArgs = true;
4155     const Type* ArgTy = yyvsp[-2].ValueVal->getType();
4156     Function* NF = CurModule.CurrentModule->
4157       getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
4158
4159     //b = vaarg a, t -> 
4160     //foo = alloca 1 of t
4161     //bar = vacopy a 
4162     //store bar -> foo
4163     //b = vaarg foo, t
4164     AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
4165     CurBB->getInstList().push_back(foo);
4166     CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
4167     CurBB->getInstList().push_back(bar);
4168     CurBB->getInstList().push_back(new StoreInst(bar, foo));
4169     yyval.InstVal = new VAArgInst(foo, *yyvsp[0].TypeVal);
4170     delete yyvsp[0].TypeVal;
4171     CHECK_FOR_ERROR
4172   ;
4173     break;}
4174 case 233:
4175 #line 2531 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4176 {
4177     ObsoleteVarArgs = true;
4178     const Type* ArgTy = yyvsp[-2].ValueVal->getType();
4179     Function* NF = CurModule.CurrentModule->
4180       getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
4181
4182     //b = vanext a, t ->
4183     //foo = alloca 1 of t
4184     //bar = vacopy a
4185     //store bar -> foo
4186     //tmp = vaarg foo, t
4187     //b = load foo
4188     AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
4189     CurBB->getInstList().push_back(foo);
4190     CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal);
4191     CurBB->getInstList().push_back(bar);
4192     CurBB->getInstList().push_back(new StoreInst(bar, foo));
4193     Instruction* tmp = new VAArgInst(foo, *yyvsp[0].TypeVal);
4194     CurBB->getInstList().push_back(tmp);
4195     yyval.InstVal = new LoadInst(foo);
4196     delete yyvsp[0].TypeVal;
4197     CHECK_FOR_ERROR
4198   ;
4199     break;}
4200 case 234:
4201 #line 2554 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4202 {
4203     if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4204       GEN_ERROR("Invalid extractelement operands!");
4205     yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4206     CHECK_FOR_ERROR
4207   ;
4208     break;}
4209 case 235:
4210 #line 2560 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4211 {
4212     if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4213       GEN_ERROR("Invalid insertelement operands!");
4214     yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4215     CHECK_FOR_ERROR
4216   ;
4217     break;}
4218 case 236:
4219 #line 2566 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4220 {
4221     if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
4222       GEN_ERROR("Invalid shufflevector operands!");
4223     yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4224     CHECK_FOR_ERROR
4225   ;
4226     break;}
4227 case 237:
4228 #line 2572 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4229 {
4230     const Type *Ty = yyvsp[0].PHIList->front().first->getType();
4231     if (!Ty->isFirstClassType())
4232       GEN_ERROR("PHI node operands must be of first class type!");
4233     yyval.InstVal = new PHINode(Ty);
4234     ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4235     while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4236       if (yyvsp[0].PHIList->front().first->getType() != Ty) 
4237         GEN_ERROR("All elements of a PHI node must be of the same type!");
4238       cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4239       yyvsp[0].PHIList->pop_front();
4240     }
4241     delete yyvsp[0].PHIList;  // Free the list...
4242     CHECK_FOR_ERROR
4243   ;
4244     break;}
4245 case 238:
4246 #line 2587 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4247 {
4248     const PointerType *PFTy;
4249     const FunctionType *Ty;
4250
4251     if (!(PFTy = dyn_cast<PointerType>(yyvsp[-4].TypeVal->get())) ||
4252         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4253       // Pull out the types of all of the arguments...
4254       std::vector<const Type*> ParamTypes;
4255       if (yyvsp[-1].ValueList) {
4256         for (std::vector<Value*>::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end();
4257              I != E; ++I)
4258           ParamTypes.push_back((*I)->getType());
4259       }
4260
4261       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4262       if (isVarArg) ParamTypes.pop_back();
4263
4264       if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy)
4265         GEN_ERROR("LLVM functions cannot return aggregate types!");
4266
4267       Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg);
4268       PFTy = PointerType::get(Ty);
4269     }
4270
4271     Value *V = getVal(PFTy, yyvsp[-3].ValIDVal);   // Get the function we're calling...
4272     CHECK_FOR_ERROR
4273
4274     // Create the call node...
4275     if (!yyvsp[-1].ValueList) {                                   // Has no arguments?
4276       // Make sure no arguments is a good thing!
4277       if (Ty->getNumParams() != 0)
4278         GEN_ERROR("No arguments passed to a function that "
4279                        "expects arguments!");
4280
4281       yyval.InstVal = new CallInst(V, std::vector<Value*>());
4282     } else {                                     // Has arguments?
4283       // Loop through FunctionType's arguments and ensure they are specified
4284       // correctly!
4285       //
4286       FunctionType::param_iterator I = Ty->param_begin();
4287       FunctionType::param_iterator E = Ty->param_end();
4288       std::vector<Value*>::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end();
4289
4290       for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4291         if ((*ArgI)->getType() != *I)
4292           GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4293                          (*I)->getDescription() + "'!");
4294
4295       if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4296         GEN_ERROR("Invalid number of parameters detected!");
4297
4298       yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList);
4299     }
4300     cast<CallInst>(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal);
4301     cast<CallInst>(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal);
4302     delete yyvsp[-4].TypeVal;
4303     delete yyvsp[-1].ValueList;
4304     CHECK_FOR_ERROR
4305   ;
4306     break;}
4307 case 239:
4308 #line 2646 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4309 {
4310     yyval.InstVal = yyvsp[0].InstVal;
4311     CHECK_FOR_ERROR
4312   ;
4313     break;}
4314 case 240:
4315 #line 2653 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4316
4317     yyval.ValueList = yyvsp[0].ValueList; 
4318     CHECK_FOR_ERROR
4319   ;
4320     break;}
4321 case 241:
4322 #line 2656 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4323
4324     yyval.ValueList = new std::vector<Value*>(); 
4325     CHECK_FOR_ERROR
4326   ;
4327     break;}
4328 case 242:
4329 #line 2661 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4330 {
4331     yyval.BoolVal = true;
4332     CHECK_FOR_ERROR
4333   ;
4334     break;}
4335 case 243:
4336 #line 2665 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4337 {
4338     yyval.BoolVal = false;
4339     CHECK_FOR_ERROR
4340   ;
4341     break;}
4342 case 244:
4343 #line 2672 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4344 {
4345     yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4346     delete yyvsp[-1].TypeVal;
4347     CHECK_FOR_ERROR
4348   ;
4349     break;}
4350 case 245:
4351 #line 2677 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4352 {
4353     Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4354     CHECK_FOR_ERROR
4355     yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4356     delete yyvsp[-4].TypeVal;
4357   ;
4358     break;}
4359 case 246:
4360 #line 2683 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4361 {
4362     yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
4363     delete yyvsp[-1].TypeVal;
4364     CHECK_FOR_ERROR
4365   ;
4366     break;}
4367 case 247:
4368 #line 2688 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4369 {
4370     Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
4371     CHECK_FOR_ERROR
4372     yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
4373     delete yyvsp[-4].TypeVal;
4374   ;
4375     break;}
4376 case 248:
4377 #line 2694 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4378 {
4379     if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
4380       GEN_ERROR("Trying to free nonpointer type " + 
4381                      yyvsp[0].ValueVal->getType()->getDescription() + "!");
4382     yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
4383     CHECK_FOR_ERROR
4384   ;
4385     break;}
4386 case 249:
4387 #line 2702 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4388 {
4389     if (!isa<PointerType>(yyvsp[-1].TypeVal->get()))
4390       GEN_ERROR("Can't load from nonpointer type: " +
4391                      (*yyvsp[-1].TypeVal)->getDescription());
4392     if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType())
4393       GEN_ERROR("Can't load from pointer of non-first-class type: " +
4394                      (*yyvsp[-1].TypeVal)->getDescription());
4395     Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4396     CHECK_FOR_ERROR
4397     yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal);
4398     delete yyvsp[-1].TypeVal;
4399   ;
4400     break;}
4401 case 250:
4402 #line 2714 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4403 {
4404     const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
4405     if (!PT)
4406       GEN_ERROR("Can't store to a nonpointer type: " +
4407                      (*yyvsp[-1].TypeVal)->getDescription());
4408     const Type *ElTy = PT->getElementType();
4409     if (ElTy != yyvsp[-3].ValueVal->getType())
4410       GEN_ERROR("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() +
4411                      "' into space of type '" + ElTy->getDescription() + "'!");
4412
4413     Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4414     CHECK_FOR_ERROR
4415     yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, tmpVal, yyvsp[-5].BoolVal);
4416     delete yyvsp[-1].TypeVal;
4417   ;
4418     break;}
4419 case 251:
4420 #line 2729 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4421 {
4422     if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
4423       GEN_ERROR("getelementptr insn requires pointer operand!");
4424
4425     // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
4426     // indices to uint struct indices for compatibility.
4427     generic_gep_type_iterator<std::vector<Value*>::iterator>
4428       GTI = gep_type_begin(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()),
4429       GTE = gep_type_end(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
4430     for (unsigned i = 0, e = yyvsp[0].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI)
4431       if (isa<StructType>(*GTI))        // Only change struct indices
4432         if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*yyvsp[0].ValueList)[i]))
4433           if (CUI->getType() == Type::UByteTy)
4434             (*yyvsp[0].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
4435
4436     if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true))
4437       GEN_ERROR("Invalid getelementptr indices for type '" +
4438                      (*yyvsp[-2].TypeVal)->getDescription()+ "'!");
4439     Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
4440     CHECK_FOR_ERROR
4441     yyval.InstVal = new GetElementPtrInst(tmpVal, *yyvsp[0].ValueList);
4442     delete yyvsp[-2].TypeVal; 
4443     delete yyvsp[0].ValueList;
4444   ;
4445     break;}
4446 }
4447    /* the action file gets copied in in place of this dollarsign */
4448 #line 543 "/usr/share/bison.simple"
4449 \f
4450   yyvsp -= yylen;
4451   yyssp -= yylen;
4452 #ifdef YYLSP_NEEDED
4453   yylsp -= yylen;
4454 #endif
4455
4456 #if YYDEBUG != 0
4457   if (yydebug)
4458     {
4459       short *ssp1 = yyss - 1;
4460       fprintf (stderr, "state stack now");
4461       while (ssp1 != yyssp)
4462         fprintf (stderr, " %d", *++ssp1);
4463       fprintf (stderr, "\n");
4464     }
4465 #endif
4466
4467   *++yyvsp = yyval;
4468
4469 #ifdef YYLSP_NEEDED
4470   yylsp++;
4471   if (yylen == 0)
4472     {
4473       yylsp->first_line = yylloc.first_line;
4474       yylsp->first_column = yylloc.first_column;
4475       yylsp->last_line = (yylsp-1)->last_line;
4476       yylsp->last_column = (yylsp-1)->last_column;
4477       yylsp->text = 0;
4478     }
4479   else
4480     {
4481       yylsp->last_line = (yylsp+yylen-1)->last_line;
4482       yylsp->last_column = (yylsp+yylen-1)->last_column;
4483     }
4484 #endif
4485
4486   /* Now "shift" the result of the reduction.
4487      Determine what state that goes to,
4488      based on the state we popped back to
4489      and the rule number reduced by.  */
4490
4491   yyn = yyr1[yyn];
4492
4493   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
4494   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4495     yystate = yytable[yystate];
4496   else
4497     yystate = yydefgoto[yyn - YYNTBASE];
4498
4499   goto yynewstate;
4500
4501 yyerrlab:   /* here on detecting error */
4502
4503   if (! yyerrstatus)
4504     /* If not already recovering from an error, report this error.  */
4505     {
4506       ++yynerrs;
4507
4508 #ifdef YYERROR_VERBOSE
4509       yyn = yypact[yystate];
4510
4511       if (yyn > YYFLAG && yyn < YYLAST)
4512         {
4513           int size = 0;
4514           char *msg;
4515           int x, count;
4516
4517           count = 0;
4518           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
4519           for (x = (yyn < 0 ? -yyn : 0);
4520                x < (sizeof(yytname) / sizeof(char *)); x++)
4521             if (yycheck[x + yyn] == x)
4522               size += strlen(yytname[x]) + 15, count++;
4523           msg = (char *) malloc(size + 15);
4524           if (msg != 0)
4525             {
4526               strcpy(msg, "parse error");
4527
4528               if (count < 5)
4529                 {
4530                   count = 0;
4531                   for (x = (yyn < 0 ? -yyn : 0);
4532                        x < (sizeof(yytname) / sizeof(char *)); x++)
4533                     if (yycheck[x + yyn] == x)
4534                       {
4535                         strcat(msg, count == 0 ? ", expecting `" : " or `");
4536                         strcat(msg, yytname[x]);
4537                         strcat(msg, "'");
4538                         count++;
4539                       }
4540                 }
4541               yyerror(msg);
4542               free(msg);
4543             }
4544           else
4545             yyerror ("parse error; also virtual memory exceeded");
4546         }
4547       else
4548 #endif /* YYERROR_VERBOSE */
4549         yyerror("parse error");
4550     }
4551
4552   goto yyerrlab1;
4553 yyerrlab1:   /* here on error raised explicitly by an action */
4554
4555   if (yyerrstatus == 3)
4556     {
4557       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
4558
4559       /* return failure if at end of input */
4560       if (yychar == YYEOF)
4561         YYABORT;
4562
4563 #if YYDEBUG != 0
4564       if (yydebug)
4565         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
4566 #endif
4567
4568       yychar = YYEMPTY;
4569     }
4570
4571   /* Else will try to reuse lookahead token
4572      after shifting the error token.  */
4573
4574   yyerrstatus = 3;              /* Each real token shifted decrements this */
4575
4576   goto yyerrhandle;
4577
4578 yyerrdefault:  /* current state does not do anything special for the error token. */
4579
4580 #if 0
4581   /* This is wrong; only states that explicitly want error tokens
4582      should shift them.  */
4583   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
4584   if (yyn) goto yydefault;
4585 #endif
4586
4587 yyerrpop:   /* pop the current state because it cannot handle the error token */
4588
4589   if (yyssp == yyss) YYABORT;
4590   yyvsp--;
4591   yystate = *--yyssp;
4592 #ifdef YYLSP_NEEDED
4593   yylsp--;
4594 #endif
4595
4596 #if YYDEBUG != 0
4597   if (yydebug)
4598     {
4599       short *ssp1 = yyss - 1;
4600       fprintf (stderr, "Error: state stack now");
4601       while (ssp1 != yyssp)
4602         fprintf (stderr, " %d", *++ssp1);
4603       fprintf (stderr, "\n");
4604     }
4605 #endif
4606
4607 yyerrhandle:
4608
4609   yyn = yypact[yystate];
4610   if (yyn == YYFLAG)
4611     goto yyerrdefault;
4612
4613   yyn += YYTERROR;
4614   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
4615     goto yyerrdefault;
4616
4617   yyn = yytable[yyn];
4618   if (yyn < 0)
4619     {
4620       if (yyn == YYFLAG)
4621         goto yyerrpop;
4622       yyn = -yyn;
4623       goto yyreduce;
4624     }
4625   else if (yyn == 0)
4626     goto yyerrpop;
4627
4628   if (yyn == YYFINAL)
4629     YYACCEPT;
4630
4631 #if YYDEBUG != 0
4632   if (yydebug)
4633     fprintf(stderr, "Shifting error token, ");
4634 #endif
4635
4636   *++yyvsp = yylval;
4637 #ifdef YYLSP_NEEDED
4638   *++yylsp = yylloc;
4639 #endif
4640
4641   yystate = yyn;
4642   goto yynewstate;
4643
4644  yyacceptlab:
4645   /* YYACCEPT comes here.  */
4646   if (yyfree_stacks)
4647     {
4648       free (yyss);
4649       free (yyvs);
4650 #ifdef YYLSP_NEEDED
4651       free (yyls);
4652 #endif
4653     }
4654   return 0;
4655
4656  yyabortlab:
4657   /* YYABORT comes here.  */
4658   if (yyfree_stacks)
4659     {
4660       free (yyss);
4661       free (yyvs);
4662 #ifdef YYLSP_NEEDED
4663       free (yyls);
4664 #endif
4665     }
4666   return 1;
4667 }
4668 #line 2755 "/Users/resistor/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4669
4670
4671 void llvm::GenerateError(const std::string &message, int LineNo) {
4672   if (LineNo == -1) LineNo = llvmAsmlineno;
4673   // TODO: column number in exception
4674   if (TheParseError)
4675     TheParseError->setError(CurFilename, message, LineNo);
4676   TriggerError = 1;
4677 }
4678
4679 int yyerror(const char *ErrorMsg) {
4680   std::string where 
4681     = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4682                   + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
4683   std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
4684   if (yychar == YYEMPTY || yychar == 0)
4685     errMsg += "end-of-file.";
4686   else
4687     errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
4688   GenerateError(errMsg);
4689   return 0;
4690 }