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