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