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