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