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