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