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