Force postdom to be linked into opt and bugpoint, even though it is no longer used...
[oota-llvm.git] / lib / AsmParser / llvmAsmParser.cpp.cvs
1 /* A Bison parser, made by GNU Bison 2.3.  */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6    Free Software Foundation, Inc.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2, or (at your option)
11    any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor,
21    Boston, MA 02110-1301, USA.  */
22
23 /* As a special exception, you may create a larger work that contains
24    part or all of the Bison parser skeleton and distribute that work
25    under terms of your choice, so long as that work isn't itself a
26    parser generator using the skeleton or a modified version thereof
27    as a parser skeleton.  Alternatively, if you modify or redistribute
28    the parser skeleton itself, you may (at your option) remove this
29    special exception, which will cause the skeleton and the resulting
30    Bison output files to be licensed under the GNU General Public
31    License without this special exception.
32
33    This special exception was added by the Free Software Foundation in
34    version 2.2 of Bison.  */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37    simplifying the original so-called "semantic" parser.  */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40    infringing on user name space.  This should be done even for local
41    variables, as they might otherwise be expanded by user macros.
42    There are some unavoidable exceptions within include files to
43    define necessary library symbols; they are noted "INFRINGES ON
44    USER NAME SPACE" below.  */
45
46 /* Identify Bison output.  */
47 #define YYBISON 1
48
49 /* Bison version.  */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name.  */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers.  */
56 #define YYPURE 0
57
58 /* Using locations.  */
59 #define YYLSP_NEEDED 0
60
61 /* Substitute the variable and function names.  */
62 #define yyparse llvmAsmparse
63 #define yylex   llvmAsmlex
64 #define yyerror llvmAsmerror
65 #define yylval  llvmAsmlval
66 #define yychar  llvmAsmchar
67 #define yydebug llvmAsmdebug
68 #define yynerrs llvmAsmnerrs
69
70
71 /* Tokens.  */
72 #ifndef YYTOKENTYPE
73 # define YYTOKENTYPE
74    /* Put the tokens into the symbol table, so that GDB and other debuggers
75       know about them.  */
76    enum yytokentype {
77      ESINT64VAL = 258,
78      EUINT64VAL = 259,
79      ESAPINTVAL = 260,
80      EUAPINTVAL = 261,
81      LOCALVAL_ID = 262,
82      GLOBALVAL_ID = 263,
83      FPVAL = 264,
84      VOID = 265,
85      INTTYPE = 266,
86      FLOAT = 267,
87      DOUBLE = 268,
88      X86_FP80 = 269,
89      FP128 = 270,
90      PPC_FP128 = 271,
91      LABEL = 272,
92      TYPE = 273,
93      LOCALVAR = 274,
94      GLOBALVAR = 275,
95      LABELSTR = 276,
96      STRINGCONSTANT = 277,
97      ATSTRINGCONSTANT = 278,
98      PCTSTRINGCONSTANT = 279,
99      ZEROINITIALIZER = 280,
100      TRUETOK = 281,
101      FALSETOK = 282,
102      BEGINTOK = 283,
103      ENDTOK = 284,
104      DECLARE = 285,
105      DEFINE = 286,
106      GLOBAL = 287,
107      CONSTANT = 288,
108      SECTION = 289,
109      ALIAS = 290,
110      VOLATILE = 291,
111      THREAD_LOCAL = 292,
112      TO = 293,
113      DOTDOTDOT = 294,
114      NULL_TOK = 295,
115      UNDEF = 296,
116      INTERNAL = 297,
117      LINKONCE = 298,
118      WEAK = 299,
119      APPENDING = 300,
120      DLLIMPORT = 301,
121      DLLEXPORT = 302,
122      EXTERN_WEAK = 303,
123      COMMON = 304,
124      OPAQUE = 305,
125      EXTERNAL = 306,
126      TARGET = 307,
127      TRIPLE = 308,
128      ALIGN = 309,
129      ADDRSPACE = 310,
130      DEPLIBS = 311,
131      CALL = 312,
132      TAIL = 313,
133      ASM_TOK = 314,
134      MODULE = 315,
135      SIDEEFFECT = 316,
136      CC_TOK = 317,
137      CCC_TOK = 318,
138      FASTCC_TOK = 319,
139      COLDCC_TOK = 320,
140      X86_STDCALLCC_TOK = 321,
141      X86_FASTCALLCC_TOK = 322,
142      DATALAYOUT = 323,
143      RET = 324,
144      BR = 325,
145      SWITCH = 326,
146      INVOKE = 327,
147      UNWIND = 328,
148      UNREACHABLE = 329,
149      ADD = 330,
150      SUB = 331,
151      MUL = 332,
152      UDIV = 333,
153      SDIV = 334,
154      FDIV = 335,
155      UREM = 336,
156      SREM = 337,
157      FREM = 338,
158      AND = 339,
159      OR = 340,
160      XOR = 341,
161      SHL = 342,
162      LSHR = 343,
163      ASHR = 344,
164      ICMP = 345,
165      FCMP = 346,
166      VICMP = 347,
167      VFCMP = 348,
168      EQ = 349,
169      NE = 350,
170      SLT = 351,
171      SGT = 352,
172      SLE = 353,
173      SGE = 354,
174      ULT = 355,
175      UGT = 356,
176      ULE = 357,
177      UGE = 358,
178      OEQ = 359,
179      ONE = 360,
180      OLT = 361,
181      OGT = 362,
182      OLE = 363,
183      OGE = 364,
184      ORD = 365,
185      UNO = 366,
186      UEQ = 367,
187      UNE = 368,
188      MALLOC = 369,
189      ALLOCA = 370,
190      FREE = 371,
191      LOAD = 372,
192      STORE = 373,
193      GETELEMENTPTR = 374,
194      TRUNC = 375,
195      ZEXT = 376,
196      SEXT = 377,
197      FPTRUNC = 378,
198      FPEXT = 379,
199      BITCAST = 380,
200      UITOFP = 381,
201      SITOFP = 382,
202      FPTOUI = 383,
203      FPTOSI = 384,
204      INTTOPTR = 385,
205      PTRTOINT = 386,
206      PHI_TOK = 387,
207      SELECT = 388,
208      VAARG = 389,
209      EXTRACTELEMENT = 390,
210      INSERTELEMENT = 391,
211      SHUFFLEVECTOR = 392,
212      GETRESULT = 393,
213      EXTRACTVALUE = 394,
214      INSERTVALUE = 395,
215      SIGNEXT = 396,
216      ZEROEXT = 397,
217      NORETURN = 398,
218      INREG = 399,
219      SRET = 400,
220      NOUNWIND = 401,
221      NOALIAS = 402,
222      BYVAL = 403,
223      NEST = 404,
224      READNONE = 405,
225      READONLY = 406,
226      GC = 407,
227      DEFAULT = 408,
228      HIDDEN = 409,
229      PROTECTED = 410
230    };
231 #endif
232 /* Tokens.  */
233 #define ESINT64VAL 258
234 #define EUINT64VAL 259
235 #define ESAPINTVAL 260
236 #define EUAPINTVAL 261
237 #define LOCALVAL_ID 262
238 #define GLOBALVAL_ID 263
239 #define FPVAL 264
240 #define VOID 265
241 #define INTTYPE 266
242 #define FLOAT 267
243 #define DOUBLE 268
244 #define X86_FP80 269
245 #define FP128 270
246 #define PPC_FP128 271
247 #define LABEL 272
248 #define TYPE 273
249 #define LOCALVAR 274
250 #define GLOBALVAR 275
251 #define LABELSTR 276
252 #define STRINGCONSTANT 277
253 #define ATSTRINGCONSTANT 278
254 #define PCTSTRINGCONSTANT 279
255 #define ZEROINITIALIZER 280
256 #define TRUETOK 281
257 #define FALSETOK 282
258 #define BEGINTOK 283
259 #define ENDTOK 284
260 #define DECLARE 285
261 #define DEFINE 286
262 #define GLOBAL 287
263 #define CONSTANT 288
264 #define SECTION 289
265 #define ALIAS 290
266 #define VOLATILE 291
267 #define THREAD_LOCAL 292
268 #define TO 293
269 #define DOTDOTDOT 294
270 #define NULL_TOK 295
271 #define UNDEF 296
272 #define INTERNAL 297
273 #define LINKONCE 298
274 #define WEAK 299
275 #define APPENDING 300
276 #define DLLIMPORT 301
277 #define DLLEXPORT 302
278 #define EXTERN_WEAK 303
279 #define COMMON 304
280 #define OPAQUE 305
281 #define EXTERNAL 306
282 #define TARGET 307
283 #define TRIPLE 308
284 #define ALIGN 309
285 #define ADDRSPACE 310
286 #define DEPLIBS 311
287 #define CALL 312
288 #define TAIL 313
289 #define ASM_TOK 314
290 #define MODULE 315
291 #define SIDEEFFECT 316
292 #define CC_TOK 317
293 #define CCC_TOK 318
294 #define FASTCC_TOK 319
295 #define COLDCC_TOK 320
296 #define X86_STDCALLCC_TOK 321
297 #define X86_FASTCALLCC_TOK 322
298 #define DATALAYOUT 323
299 #define RET 324
300 #define BR 325
301 #define SWITCH 326
302 #define INVOKE 327
303 #define UNWIND 328
304 #define UNREACHABLE 329
305 #define ADD 330
306 #define SUB 331
307 #define MUL 332
308 #define UDIV 333
309 #define SDIV 334
310 #define FDIV 335
311 #define UREM 336
312 #define SREM 337
313 #define FREM 338
314 #define AND 339
315 #define OR 340
316 #define XOR 341
317 #define SHL 342
318 #define LSHR 343
319 #define ASHR 344
320 #define ICMP 345
321 #define FCMP 346
322 #define VICMP 347
323 #define VFCMP 348
324 #define EQ 349
325 #define NE 350
326 #define SLT 351
327 #define SGT 352
328 #define SLE 353
329 #define SGE 354
330 #define ULT 355
331 #define UGT 356
332 #define ULE 357
333 #define UGE 358
334 #define OEQ 359
335 #define ONE 360
336 #define OLT 361
337 #define OGT 362
338 #define OLE 363
339 #define OGE 364
340 #define ORD 365
341 #define UNO 366
342 #define UEQ 367
343 #define UNE 368
344 #define MALLOC 369
345 #define ALLOCA 370
346 #define FREE 371
347 #define LOAD 372
348 #define STORE 373
349 #define GETELEMENTPTR 374
350 #define TRUNC 375
351 #define ZEXT 376
352 #define SEXT 377
353 #define FPTRUNC 378
354 #define FPEXT 379
355 #define BITCAST 380
356 #define UITOFP 381
357 #define SITOFP 382
358 #define FPTOUI 383
359 #define FPTOSI 384
360 #define INTTOPTR 385
361 #define PTRTOINT 386
362 #define PHI_TOK 387
363 #define SELECT 388
364 #define VAARG 389
365 #define EXTRACTELEMENT 390
366 #define INSERTELEMENT 391
367 #define SHUFFLEVECTOR 392
368 #define GETRESULT 393
369 #define EXTRACTVALUE 394
370 #define INSERTVALUE 395
371 #define SIGNEXT 396
372 #define ZEROEXT 397
373 #define NORETURN 398
374 #define INREG 399
375 #define SRET 400
376 #define NOUNWIND 401
377 #define NOALIAS 402
378 #define BYVAL 403
379 #define NEST 404
380 #define READNONE 405
381 #define READONLY 406
382 #define GC 407
383 #define DEFAULT 408
384 #define HIDDEN 409
385 #define PROTECTED 410
386
387
388
389
390 /* Copy the first part of user declarations.  */
391 #line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
392
393 #include "ParserInternals.h"
394 #include "llvm/CallingConv.h"
395 #include "llvm/InlineAsm.h"
396 #include "llvm/Instructions.h"
397 #include "llvm/Module.h"
398 #include "llvm/ValueSymbolTable.h"
399 #include "llvm/AutoUpgrade.h"
400 #include "llvm/Support/GetElementPtrTypeIterator.h"
401 #include "llvm/Support/CommandLine.h"
402 #include "llvm/ADT/SmallVector.h"
403 #include "llvm/ADT/STLExtras.h"
404 #include "llvm/Support/MathExtras.h"
405 #include "llvm/Support/Streams.h"
406 #include <algorithm>
407 #include <list>
408 #include <map>
409 #include <utility>
410
411 // The following is a gross hack. In order to rid the libAsmParser library of
412 // exceptions, we have to have a way of getting the yyparse function to go into
413 // an error situation. So, whenever we want an error to occur, the GenerateError
414 // function (see bottom of file) sets TriggerError. Then, at the end of each 
415 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR 
416 // (a goto) to put YACC in error state. Furthermore, several calls to 
417 // GenerateError are made from inside productions and they must simulate the
418 // previous exception behavior by exiting the production immediately. We have
419 // replaced these with the GEN_ERROR macro which calls GeneratError and then
420 // immediately invokes YYERROR. This would be so much cleaner if it was a 
421 // recursive descent parser.
422 static bool TriggerError = false;
423 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
424 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
425
426 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
427 int yylex();                       // declaration" of xxx warnings.
428 int yyparse();
429 using namespace llvm;
430
431 static Module *ParserResult;
432
433 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
434 // relating to upreferences in the input stream.
435 //
436 //#define DEBUG_UPREFS 1
437 #ifdef DEBUG_UPREFS
438 #define UR_OUT(X) cerr << X
439 #else
440 #define UR_OUT(X)
441 #endif
442
443 #define YYERROR_VERBOSE 1
444
445 static GlobalVariable *CurGV;
446
447
448 // This contains info used when building the body of a function.  It is
449 // destroyed when the function is completed.
450 //
451 typedef std::vector<Value *> ValueList;           // Numbered defs
452
453 static void 
454 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
455
456 static struct PerModuleInfo {
457   Module *CurrentModule;
458   ValueList Values; // Module level numbered definitions
459   ValueList LateResolveValues;
460   std::vector<PATypeHolder>    Types;
461   std::map<ValID, PATypeHolder> LateResolveTypes;
462
463   /// PlaceHolderInfo - When temporary placeholder objects are created, remember
464   /// how they were referenced and on which line of the input they came from so
465   /// that we can resolve them later and print error messages as appropriate.
466   std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
467
468   // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
469   // references to global values.  Global values may be referenced before they
470   // are defined, and if so, the temporary object that they represent is held
471   // here.  This is used for forward references of GlobalValues.
472   //
473   typedef std::map<std::pair<const PointerType *,
474                              ValID>, GlobalValue*> GlobalRefsType;
475   GlobalRefsType GlobalRefs;
476
477   void ModuleDone() {
478     // If we could not resolve some functions at function compilation time
479     // (calls to functions before they are defined), resolve them now...  Types
480     // are resolved when the constant pool has been completely parsed.
481     //
482     ResolveDefinitions(LateResolveValues);
483     if (TriggerError)
484       return;
485
486     // Check to make sure that all global value forward references have been
487     // resolved!
488     //
489     if (!GlobalRefs.empty()) {
490       std::string UndefinedReferences = "Unresolved global references exist:\n";
491
492       for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
493            I != E; ++I) {
494         UndefinedReferences += "  " + I->first.first->getDescription() + " " +
495                                I->first.second.getName() + "\n";
496       }
497       GenerateError(UndefinedReferences);
498       return;
499     }
500
501     // Look for intrinsic functions and CallInst that need to be upgraded
502     for (Module::iterator FI = CurrentModule->begin(),
503          FE = CurrentModule->end(); FI != FE; )
504       UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
505
506     Values.clear();         // Clear out function local definitions
507     Types.clear();
508     CurrentModule = 0;
509   }
510
511   // GetForwardRefForGlobal - Check to see if there is a forward reference
512   // for this global.  If so, remove it from the GlobalRefs map and return it.
513   // If not, just return null.
514   GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
515     // Check to see if there is a forward reference to this global variable...
516     // if there is, eliminate it and patch the reference to use the new def'n.
517     GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
518     GlobalValue *Ret = 0;
519     if (I != GlobalRefs.end()) {
520       Ret = I->second;
521       GlobalRefs.erase(I);
522     }
523     return Ret;
524   }
525
526   bool TypeIsUnresolved(PATypeHolder* PATy) {
527     // If it isn't abstract, its resolved
528     const Type* Ty = PATy->get();
529     if (!Ty->isAbstract())
530       return false;
531     // Traverse the type looking for abstract types. If it isn't abstract then
532     // we don't need to traverse that leg of the type. 
533     std::vector<const Type*> WorkList, SeenList;
534     WorkList.push_back(Ty);
535     while (!WorkList.empty()) {
536       const Type* Ty = WorkList.back();
537       SeenList.push_back(Ty);
538       WorkList.pop_back();
539       if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
540         // Check to see if this is an unresolved type
541         std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
542         std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
543         for ( ; I != E; ++I) {
544           if (I->second.get() == OpTy)
545             return true;
546         }
547       } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
548         const Type* TheTy = SeqTy->getElementType();
549         if (TheTy->isAbstract() && TheTy != Ty) {
550           std::vector<const Type*>::iterator I = SeenList.begin(), 
551                                              E = SeenList.end();
552           for ( ; I != E; ++I)
553             if (*I == TheTy)
554               break;
555           if (I == E)
556             WorkList.push_back(TheTy);
557         }
558       } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
559         for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
560           const Type* TheTy = StrTy->getElementType(i);
561           if (TheTy->isAbstract() && TheTy != Ty) {
562             std::vector<const Type*>::iterator I = SeenList.begin(), 
563                                                E = SeenList.end();
564             for ( ; I != E; ++I)
565               if (*I == TheTy)
566                 break;
567             if (I == E)
568               WorkList.push_back(TheTy);
569           }
570         }
571       }
572     }
573     return false;
574   }
575 } CurModule;
576
577 static struct PerFunctionInfo {
578   Function *CurrentFunction;     // Pointer to current function being created
579
580   ValueList Values; // Keep track of #'d definitions
581   unsigned NextValNum;
582   ValueList LateResolveValues;
583   bool isDeclare;                   // Is this function a forward declararation?
584   GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
585   GlobalValue::VisibilityTypes Visibility;
586
587   /// BBForwardRefs - When we see forward references to basic blocks, keep
588   /// track of them here.
589   std::map<ValID, BasicBlock*> BBForwardRefs;
590
591   inline PerFunctionInfo() {
592     CurrentFunction = 0;
593     isDeclare = false;
594     Linkage = GlobalValue::ExternalLinkage;
595     Visibility = GlobalValue::DefaultVisibility;
596   }
597
598   inline void FunctionStart(Function *M) {
599     CurrentFunction = M;
600     NextValNum = 0;
601   }
602
603   void FunctionDone() {
604     // Any forward referenced blocks left?
605     if (!BBForwardRefs.empty()) {
606       GenerateError("Undefined reference to label " +
607                      BBForwardRefs.begin()->second->getName());
608       return;
609     }
610
611     // Resolve all forward references now.
612     ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
613
614     Values.clear();         // Clear out function local definitions
615     BBForwardRefs.clear();
616     CurrentFunction = 0;
617     isDeclare = false;
618     Linkage = GlobalValue::ExternalLinkage;
619     Visibility = GlobalValue::DefaultVisibility;
620   }
621 } CurFun;  // Info for the current function...
622
623 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
624
625
626 //===----------------------------------------------------------------------===//
627 //               Code to handle definitions of all the types
628 //===----------------------------------------------------------------------===//
629
630 static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
631   // Things that have names or are void typed don't get slot numbers
632   if (V->hasName() || (V->getType() == Type::VoidTy))
633     return;
634
635   // In the case of function values, we have to allow for the forward reference
636   // of basic blocks, which are included in the numbering. Consequently, we keep
637   // track of the next insertion location with NextValNum. When a BB gets 
638   // inserted, it could change the size of the CurFun.Values vector.
639   if (&ValueTab == &CurFun.Values) {
640     if (ValueTab.size() <= CurFun.NextValNum)
641       ValueTab.resize(CurFun.NextValNum+1);
642     ValueTab[CurFun.NextValNum++] = V;
643     return;
644   } 
645   // For all other lists, its okay to just tack it on the back of the vector.
646   ValueTab.push_back(V);
647 }
648
649 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
650   switch (D.Type) {
651   case ValID::LocalID:               // Is it a numbered definition?
652     // Module constants occupy the lowest numbered slots...
653     if (D.Num < CurModule.Types.size())
654       return CurModule.Types[D.Num];
655     break;
656   case ValID::LocalName:                 // Is it a named definition?
657     if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
658       D.destroy();  // Free old strdup'd memory...
659       return N;
660     }
661     break;
662   default:
663     GenerateError("Internal parser error: Invalid symbol type reference");
664     return 0;
665   }
666
667   // If we reached here, we referenced either a symbol that we don't know about
668   // or an id number that hasn't been read yet.  We may be referencing something
669   // forward, so just create an entry to be resolved later and get to it...
670   //
671   if (DoNotImprovise) return 0;  // Do we just want a null to be returned?
672
673
674   if (inFunctionScope()) {
675     if (D.Type == ValID::LocalName) {
676       GenerateError("Reference to an undefined type: '" + D.getName() + "'");
677       return 0;
678     } else {
679       GenerateError("Reference to an undefined type: #" + utostr(D.Num));
680       return 0;
681     }
682   }
683
684   std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
685   if (I != CurModule.LateResolveTypes.end())
686     return I->second;
687
688   Type *Typ = OpaqueType::get();
689   CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
690   return Typ;
691  }
692
693 // getExistingVal - Look up the value specified by the provided type and
694 // the provided ValID.  If the value exists and has already been defined, return
695 // it.  Otherwise return null.
696 //
697 static Value *getExistingVal(const Type *Ty, const ValID &D) {
698   if (isa<FunctionType>(Ty)) {
699     GenerateError("Functions are not values and "
700                    "must be referenced as pointers");
701     return 0;
702   }
703
704   switch (D.Type) {
705   case ValID::LocalID: {                 // Is it a numbered definition?
706     // Check that the number is within bounds.
707     if (D.Num >= CurFun.Values.size()) 
708       return 0;
709     Value *Result = CurFun.Values[D.Num];
710     if (Ty != Result->getType()) {
711       GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
712                     Result->getType()->getDescription() + "' does not match " 
713                     "expected type, '" + Ty->getDescription() + "'");
714       return 0;
715     }
716     return Result;
717   }
718   case ValID::GlobalID: {                 // Is it a numbered definition?
719     if (D.Num >= CurModule.Values.size()) 
720       return 0;
721     Value *Result = CurModule.Values[D.Num];
722     if (Ty != Result->getType()) {
723       GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
724                     Result->getType()->getDescription() + "' does not match " 
725                     "expected type, '" + Ty->getDescription() + "'");
726       return 0;
727     }
728     return Result;
729   }
730     
731   case ValID::LocalName: {                // Is it a named definition?
732     if (!inFunctionScope()) 
733       return 0;
734     ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
735     Value *N = SymTab.lookup(D.getName());
736     if (N == 0) 
737       return 0;
738     if (N->getType() != Ty)
739       return 0;
740     
741     D.destroy();  // Free old strdup'd memory...
742     return N;
743   }
744   case ValID::GlobalName: {                // Is it a named definition?
745     ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
746     Value *N = SymTab.lookup(D.getName());
747     if (N == 0) 
748       return 0;
749     if (N->getType() != Ty)
750       return 0;
751
752     D.destroy();  // Free old strdup'd memory...
753     return N;
754   }
755
756   // Check to make sure that "Ty" is an integral type, and that our
757   // value will fit into the specified type...
758   case ValID::ConstSIntVal:    // Is it a constant pool reference??
759     if (!isa<IntegerType>(Ty) ||
760         !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
761       GenerateError("Signed integral constant '" +
762                      itostr(D.ConstPool64) + "' is invalid for type '" +
763                      Ty->getDescription() + "'");
764       return 0;
765     }
766     return ConstantInt::get(Ty, D.ConstPool64, true);
767
768   case ValID::ConstUIntVal:     // Is it an unsigned const pool reference?
769     if (isa<IntegerType>(Ty) &&
770         ConstantInt::isValueValidForType(Ty, D.UConstPool64))
771       return ConstantInt::get(Ty, D.UConstPool64);
772
773     if (!isa<IntegerType>(Ty) ||
774         !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
775       GenerateError("Integral constant '" + utostr(D.UConstPool64) +
776                     "' is invalid or out of range for type '" +
777                     Ty->getDescription() + "'");
778       return 0;
779     }
780     // This is really a signed reference.  Transmogrify.
781     return ConstantInt::get(Ty, D.ConstPool64, true);
782
783   case ValID::ConstFPVal:        // Is it a floating point const pool reference?
784     if (!Ty->isFloatingPoint() ||
785         !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
786       GenerateError("FP constant invalid for type");
787       return 0;
788     }
789     // Lexer has no type info, so builds all float and double FP constants 
790     // as double.  Fix this here.  Long double does not need this.
791     if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
792         Ty==Type::FloatTy)
793       D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
794     return ConstantFP::get(*D.ConstPoolFP);
795
796   case ValID::ConstNullVal:      // Is it a null value?
797     if (!isa<PointerType>(Ty)) {
798       GenerateError("Cannot create a a non pointer null");
799       return 0;
800     }
801     return ConstantPointerNull::get(cast<PointerType>(Ty));
802
803   case ValID::ConstUndefVal:      // Is it an undef value?
804     return UndefValue::get(Ty);
805
806   case ValID::ConstZeroVal:      // Is it a zero value?
807     return Constant::getNullValue(Ty);
808     
809   case ValID::ConstantVal:       // Fully resolved constant?
810     if (D.ConstantValue->getType() != Ty) {
811       GenerateError("Constant expression type different from required type");
812       return 0;
813     }
814     return D.ConstantValue;
815
816   case ValID::InlineAsmVal: {    // Inline asm expression
817     const PointerType *PTy = dyn_cast<PointerType>(Ty);
818     const FunctionType *FTy =
819       PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
820     if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
821       GenerateError("Invalid type for asm constraint string");
822       return 0;
823     }
824     InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
825                                    D.IAD->HasSideEffects);
826     D.destroy();   // Free InlineAsmDescriptor.
827     return IA;
828   }
829   default:
830     assert(0 && "Unhandled case!");
831     return 0;
832   }   // End of switch
833
834   assert(0 && "Unhandled case!");
835   return 0;
836 }
837
838 // getVal - This function is identical to getExistingVal, except that if a
839 // value is not already defined, it "improvises" by creating a placeholder var
840 // that looks and acts just like the requested variable.  When the value is
841 // defined later, all uses of the placeholder variable are replaced with the
842 // real thing.
843 //
844 static Value *getVal(const Type *Ty, const ValID &ID) {
845   if (Ty == Type::LabelTy) {
846     GenerateError("Cannot use a basic block here");
847     return 0;
848   }
849
850   // See if the value has already been defined.
851   Value *V = getExistingVal(Ty, ID);
852   if (V) return V;
853   if (TriggerError) return 0;
854
855   if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
856     GenerateError("Invalid use of a non-first-class type");
857     return 0;
858   }
859
860   // If we reached here, we referenced either a symbol that we don't know about
861   // or an id number that hasn't been read yet.  We may be referencing something
862   // forward, so just create an entry to be resolved later and get to it...
863   //
864   switch (ID.Type) {
865   case ValID::GlobalName:
866   case ValID::GlobalID: {
867    const PointerType *PTy = dyn_cast<PointerType>(Ty);
868    if (!PTy) {
869      GenerateError("Invalid type for reference to global" );
870      return 0;
871    }
872    const Type* ElTy = PTy->getElementType();
873    if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
874      V = Function::Create(FTy, GlobalValue::ExternalLinkage);
875    else
876      V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
877                             (Module*)0, false, PTy->getAddressSpace());
878    break;
879   }
880   default:
881    V = new Argument(Ty);
882   }
883   
884   // Remember where this forward reference came from.  FIXME, shouldn't we try
885   // to recycle these things??
886   CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
887                                                               LLLgetLineNo())));
888
889   if (inFunctionScope())
890     InsertValue(V, CurFun.LateResolveValues);
891   else
892     InsertValue(V, CurModule.LateResolveValues);
893   return V;
894 }
895
896 /// defineBBVal - This is a definition of a new basic block with the specified
897 /// identifier which must be the same as CurFun.NextValNum, if its numeric.
898 static BasicBlock *defineBBVal(const ValID &ID) {
899   assert(inFunctionScope() && "Can't get basic block at global scope!");
900
901   BasicBlock *BB = 0;
902
903   // First, see if this was forward referenced
904
905   std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
906   if (BBI != CurFun.BBForwardRefs.end()) {
907     BB = BBI->second;
908     // The forward declaration could have been inserted anywhere in the
909     // function: insert it into the correct place now.
910     CurFun.CurrentFunction->getBasicBlockList().remove(BB);
911     CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
912
913     // We're about to erase the entry, save the key so we can clean it up.
914     ValID Tmp = BBI->first;
915
916     // Erase the forward ref from the map as its no longer "forward"
917     CurFun.BBForwardRefs.erase(ID);
918
919     // The key has been removed from the map but so we don't want to leave 
920     // strdup'd memory around so destroy it too.
921     Tmp.destroy();
922
923     // If its a numbered definition, bump the number and set the BB value.
924     if (ID.Type == ValID::LocalID) {
925       assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
926       InsertValue(BB);
927     }
928   } else { 
929     // We haven't seen this BB before and its first mention is a definition. 
930     // Just create it and return it.
931     std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
932     BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
933     if (ID.Type == ValID::LocalID) {
934       assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
935       InsertValue(BB);
936     }
937   }
938
939   ID.destroy();
940   return BB;
941 }
942
943 /// getBBVal - get an existing BB value or create a forward reference for it.
944 /// 
945 static BasicBlock *getBBVal(const ValID &ID) {
946   assert(inFunctionScope() && "Can't get basic block at global scope!");
947
948   BasicBlock *BB =  0;
949
950   std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
951   if (BBI != CurFun.BBForwardRefs.end()) {
952     BB = BBI->second;
953   } if (ID.Type == ValID::LocalName) {
954     std::string Name = ID.getName();
955     Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
956     if (N) {
957       if (N->getType()->getTypeID() == Type::LabelTyID)
958         BB = cast<BasicBlock>(N);
959       else
960         GenerateError("Reference to label '" + Name + "' is actually of type '"+
961           N->getType()->getDescription() + "'");
962     }
963   } else if (ID.Type == ValID::LocalID) {
964     if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
965       if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
966         BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
967       else
968         GenerateError("Reference to label '%" + utostr(ID.Num) + 
969           "' is actually of type '"+ 
970           CurFun.Values[ID.Num]->getType()->getDescription() + "'");
971     }
972   } else {
973     GenerateError("Illegal label reference " + ID.getName());
974     return 0;
975   }
976
977   // If its already been defined, return it now.
978   if (BB) {
979     ID.destroy(); // Free strdup'd memory.
980     return BB;
981   }
982
983   // Otherwise, this block has not been seen before, create it.
984   std::string Name;
985   if (ID.Type == ValID::LocalName)
986     Name = ID.getName();
987   BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
988
989   // Insert it in the forward refs map.
990   CurFun.BBForwardRefs[ID] = BB;
991
992   return BB;
993 }
994
995
996 //===----------------------------------------------------------------------===//
997 //              Code to handle forward references in instructions
998 //===----------------------------------------------------------------------===//
999 //
1000 // This code handles the late binding needed with statements that reference
1001 // values not defined yet... for example, a forward branch, or the PHI node for
1002 // a loop body.
1003 //
1004 // This keeps a table (CurFun.LateResolveValues) of all such forward references
1005 // and back patchs after we are done.
1006 //
1007
1008 // ResolveDefinitions - If we could not resolve some defs at parsing
1009 // time (forward branches, phi functions for loops, etc...) resolve the
1010 // defs now...
1011 //
1012 static void 
1013 ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1014   // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1015   while (!LateResolvers.empty()) {
1016     Value *V = LateResolvers.back();
1017     LateResolvers.pop_back();
1018
1019     std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1020       CurModule.PlaceHolderInfo.find(V);
1021     assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1022
1023     ValID &DID = PHI->second.first;
1024
1025     Value *TheRealValue = getExistingVal(V->getType(), DID);
1026     if (TriggerError)
1027       return;
1028     if (TheRealValue) {
1029       V->replaceAllUsesWith(TheRealValue);
1030       delete V;
1031       CurModule.PlaceHolderInfo.erase(PHI);
1032     } else if (FutureLateResolvers) {
1033       // Functions have their unresolved items forwarded to the module late
1034       // resolver table
1035       InsertValue(V, *FutureLateResolvers);
1036     } else {
1037       if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1038         GenerateError("Reference to an invalid definition: '" +DID.getName()+
1039                        "' of type '" + V->getType()->getDescription() + "'",
1040                        PHI->second.second);
1041         return;
1042       } else {
1043         GenerateError("Reference to an invalid definition: #" +
1044                        itostr(DID.Num) + " of type '" +
1045                        V->getType()->getDescription() + "'",
1046                        PHI->second.second);
1047         return;
1048       }
1049     }
1050   }
1051   LateResolvers.clear();
1052 }
1053
1054 // ResolveTypeTo - A brand new type was just declared.  This means that (if
1055 // name is not null) things referencing Name can be resolved.  Otherwise, things
1056 // refering to the number can be resolved.  Do this now.
1057 //
1058 static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1059   ValID D;
1060   if (Name)
1061     D = ValID::createLocalName(*Name);
1062   else      
1063     D = ValID::createLocalID(CurModule.Types.size());
1064
1065   std::map<ValID, PATypeHolder>::iterator I =
1066     CurModule.LateResolveTypes.find(D);
1067   if (I != CurModule.LateResolveTypes.end()) {
1068     ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1069     CurModule.LateResolveTypes.erase(I);
1070   }
1071 }
1072
1073 // setValueName - Set the specified value to the name given.  The name may be
1074 // null potentially, in which case this is a noop.  The string passed in is
1075 // assumed to be a malloc'd string buffer, and is free'd by this function.
1076 //
1077 static void setValueName(Value *V, std::string *NameStr) {
1078   if (!NameStr) return;
1079   std::string Name(*NameStr);      // Copy string
1080   delete NameStr;                  // Free old string
1081
1082   if (V->getType() == Type::VoidTy) {
1083     GenerateError("Can't assign name '" + Name+"' to value with void type");
1084     return;
1085   }
1086
1087   assert(inFunctionScope() && "Must be in function scope!");
1088   ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1089   if (ST.lookup(Name)) {
1090     GenerateError("Redefinition of value '" + Name + "' of type '" +
1091                    V->getType()->getDescription() + "'");
1092     return;
1093   }
1094
1095   // Set the name.
1096   V->setName(Name);
1097 }
1098
1099 /// ParseGlobalVariable - Handle parsing of a global.  If Initializer is null,
1100 /// this is a declaration, otherwise it is a definition.
1101 static GlobalVariable *
1102 ParseGlobalVariable(std::string *NameStr,
1103                     GlobalValue::LinkageTypes Linkage,
1104                     GlobalValue::VisibilityTypes Visibility,
1105                     bool isConstantGlobal, const Type *Ty,
1106                     Constant *Initializer, bool IsThreadLocal,
1107                     unsigned AddressSpace = 0) {
1108   if (isa<FunctionType>(Ty)) {
1109     GenerateError("Cannot declare global vars of function type");
1110     return 0;
1111   }
1112
1113   const PointerType *PTy = PointerType::get(Ty, AddressSpace);
1114
1115   std::string Name;
1116   if (NameStr) {
1117     Name = *NameStr;      // Copy string
1118     delete NameStr;       // Free old string
1119   }
1120
1121   // See if this global value was forward referenced.  If so, recycle the
1122   // object.
1123   ValID ID;
1124   if (!Name.empty()) {
1125     ID = ValID::createGlobalName(Name);
1126   } else {
1127     ID = ValID::createGlobalID(CurModule.Values.size());
1128   }
1129
1130   if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1131     // Move the global to the end of the list, from whereever it was
1132     // previously inserted.
1133     GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1134     CurModule.CurrentModule->getGlobalList().remove(GV);
1135     CurModule.CurrentModule->getGlobalList().push_back(GV);
1136     GV->setInitializer(Initializer);
1137     GV->setLinkage(Linkage);
1138     GV->setVisibility(Visibility);
1139     GV->setConstant(isConstantGlobal);
1140     GV->setThreadLocal(IsThreadLocal);
1141     InsertValue(GV, CurModule.Values);
1142     return GV;
1143   }
1144
1145   // If this global has a name
1146   if (!Name.empty()) {
1147     // if the global we're parsing has an initializer (is a definition) and
1148     // has external linkage.
1149     if (Initializer && Linkage != GlobalValue::InternalLinkage)
1150       // If there is already a global with external linkage with this name
1151       if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1152         // If we allow this GVar to get created, it will be renamed in the
1153         // symbol table because it conflicts with an existing GVar. We can't
1154         // allow redefinition of GVars whose linking indicates that their name
1155         // must stay the same. Issue the error.
1156         GenerateError("Redefinition of global variable named '" + Name +
1157                        "' of type '" + Ty->getDescription() + "'");
1158         return 0;
1159       }
1160   }
1161
1162   // Otherwise there is no existing GV to use, create one now.
1163   GlobalVariable *GV =
1164     new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1165                        CurModule.CurrentModule, IsThreadLocal, AddressSpace);
1166   GV->setVisibility(Visibility);
1167   InsertValue(GV, CurModule.Values);
1168   return GV;
1169 }
1170
1171 // setTypeName - Set the specified type to the name given.  The name may be
1172 // null potentially, in which case this is a noop.  The string passed in is
1173 // assumed to be a malloc'd string buffer, and is freed by this function.
1174 //
1175 // This function returns true if the type has already been defined, but is
1176 // allowed to be redefined in the specified context.  If the name is a new name
1177 // for the type plane, it is inserted and false is returned.
1178 static bool setTypeName(const Type *T, std::string *NameStr) {
1179   assert(!inFunctionScope() && "Can't give types function-local names!");
1180   if (NameStr == 0) return false;
1181  
1182   std::string Name(*NameStr);      // Copy string
1183   delete NameStr;                  // Free old string
1184
1185   // We don't allow assigning names to void type
1186   if (T == Type::VoidTy) {
1187     GenerateError("Can't assign name '" + Name + "' to the void type");
1188     return false;
1189   }
1190
1191   // Set the type name, checking for conflicts as we do so.
1192   bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1193
1194   if (AlreadyExists) {   // Inserting a name that is already defined???
1195     const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1196     assert(Existing && "Conflict but no matching type?!");
1197
1198     // There is only one case where this is allowed: when we are refining an
1199     // opaque type.  In this case, Existing will be an opaque type.
1200     if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1201       // We ARE replacing an opaque type!
1202       const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1203       return true;
1204     }
1205
1206     // Otherwise, this is an attempt to redefine a type. That's okay if
1207     // the redefinition is identical to the original. This will be so if
1208     // Existing and T point to the same Type object. In this one case we
1209     // allow the equivalent redefinition.
1210     if (Existing == T) return true;  // Yes, it's equal.
1211
1212     // Any other kind of (non-equivalent) redefinition is an error.
1213     GenerateError("Redefinition of type named '" + Name + "' of type '" +
1214                    T->getDescription() + "'");
1215   }
1216
1217   return false;
1218 }
1219
1220 //===----------------------------------------------------------------------===//
1221 // Code for handling upreferences in type names...
1222 //
1223
1224 // TypeContains - Returns true if Ty directly contains E in it.
1225 //
1226 static bool TypeContains(const Type *Ty, const Type *E) {
1227   return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1228                    E) != Ty->subtype_end();
1229 }
1230
1231 namespace {
1232   struct UpRefRecord {
1233     // NestingLevel - The number of nesting levels that need to be popped before
1234     // this type is resolved.
1235     unsigned NestingLevel;
1236
1237     // LastContainedTy - This is the type at the current binding level for the
1238     // type.  Every time we reduce the nesting level, this gets updated.
1239     const Type *LastContainedTy;
1240
1241     // UpRefTy - This is the actual opaque type that the upreference is
1242     // represented with.
1243     OpaqueType *UpRefTy;
1244
1245     UpRefRecord(unsigned NL, OpaqueType *URTy)
1246       : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1247   };
1248 }
1249
1250 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1251 static std::vector<UpRefRecord> UpRefs;
1252
1253 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1254 /// called.  It loops through the UpRefs vector, which is a list of the
1255 /// currently active types.  For each type, if the up reference is contained in
1256 /// the newly completed type, we decrement the level count.  When the level
1257 /// count reaches zero, the upreferenced type is the type that is passed in:
1258 /// thus we can complete the cycle.
1259 ///
1260 static PATypeHolder HandleUpRefs(const Type *ty) {
1261   // If Ty isn't abstract, or if there are no up-references in it, then there is
1262   // nothing to resolve here.
1263   if (!ty->isAbstract() || UpRefs.empty()) return ty;
1264   
1265   PATypeHolder Ty(ty);
1266   UR_OUT("Type '" << Ty->getDescription() <<
1267          "' newly formed.  Resolving upreferences.\n" <<
1268          UpRefs.size() << " upreferences active!\n");
1269
1270   // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1271   // to zero), we resolve them all together before we resolve them to Ty.  At
1272   // the end of the loop, if there is anything to resolve to Ty, it will be in
1273   // this variable.
1274   OpaqueType *TypeToResolve = 0;
1275
1276   for (unsigned i = 0; i != UpRefs.size(); ++i) {
1277     UR_OUT("  UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1278            << UpRefs[i].second->getDescription() << ") = "
1279            << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1280     if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1281       // Decrement level of upreference
1282       unsigned Level = --UpRefs[i].NestingLevel;
1283       UpRefs[i].LastContainedTy = Ty;
1284       UR_OUT("  Uplevel Ref Level = " << Level << "\n");
1285       if (Level == 0) {                     // Upreference should be resolved!
1286         if (!TypeToResolve) {
1287           TypeToResolve = UpRefs[i].UpRefTy;
1288         } else {
1289           UR_OUT("  * Resolving upreference for "
1290                  << UpRefs[i].second->getDescription() << "\n";
1291                  std::string OldName = UpRefs[i].UpRefTy->getDescription());
1292           UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1293           UR_OUT("  * Type '" << OldName << "' refined upreference to: "
1294                  << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1295         }
1296         UpRefs.erase(UpRefs.begin()+i);     // Remove from upreference list...
1297         --i;                                // Do not skip the next element...
1298       }
1299     }
1300   }
1301
1302   if (TypeToResolve) {
1303     UR_OUT("  * Resolving upreference for "
1304            << UpRefs[i].second->getDescription() << "\n";
1305            std::string OldName = TypeToResolve->getDescription());
1306     TypeToResolve->refineAbstractTypeTo(Ty);
1307   }
1308
1309   return Ty;
1310 }
1311
1312 //===----------------------------------------------------------------------===//
1313 //            RunVMAsmParser - Define an interface to this parser
1314 //===----------------------------------------------------------------------===//
1315 //
1316 static Module* RunParser(Module * M);
1317
1318 Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1319   InitLLLexer(MB);
1320   Module *M = RunParser(new Module(LLLgetFilename()));
1321   FreeLexer();
1322   return M;
1323 }
1324
1325
1326
1327 /* Enabling traces.  */
1328 #ifndef YYDEBUG
1329 # define YYDEBUG 0
1330 #endif
1331
1332 /* Enabling verbose error messages.  */
1333 #ifdef YYERROR_VERBOSE
1334 # undef YYERROR_VERBOSE
1335 # define YYERROR_VERBOSE 1
1336 #else
1337 # define YYERROR_VERBOSE 0
1338 #endif
1339
1340 /* Enabling the token table.  */
1341 #ifndef YYTOKEN_TABLE
1342 # define YYTOKEN_TABLE 0
1343 #endif
1344
1345 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1346 typedef union YYSTYPE
1347 #line 949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
1348 {
1349   llvm::Module                           *ModuleVal;
1350   llvm::Function                         *FunctionVal;
1351   llvm::BasicBlock                       *BasicBlockVal;
1352   llvm::TerminatorInst                   *TermInstVal;
1353   llvm::Instruction                      *InstVal;
1354   llvm::Constant                         *ConstVal;
1355
1356   const llvm::Type                       *PrimType;
1357   std::list<llvm::PATypeHolder>          *TypeList;
1358   llvm::PATypeHolder                     *TypeVal;
1359   llvm::Value                            *ValueVal;
1360   std::vector<llvm::Value*>              *ValueList;
1361   llvm::ArgListType                      *ArgList;
1362   llvm::TypeWithAttrs                     TypeWithAttrs;
1363   llvm::TypeWithAttrsList                *TypeWithAttrsList;
1364   llvm::ParamList                        *ParamList;
1365
1366   // Represent the RHS of PHI node
1367   std::list<std::pair<llvm::Value*,
1368                       llvm::BasicBlock*> > *PHIList;
1369   std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1370   std::vector<llvm::Constant*>           *ConstVector;
1371
1372   llvm::GlobalValue::LinkageTypes         Linkage;
1373   llvm::GlobalValue::VisibilityTypes      Visibility;
1374   llvm::ParameterAttributes         ParamAttrs;
1375   llvm::APInt                       *APIntVal;
1376   int64_t                           SInt64Val;
1377   uint64_t                          UInt64Val;
1378   int                               SIntVal;
1379   unsigned                          UIntVal;
1380   llvm::APFloat                    *FPVal;
1381   bool                              BoolVal;
1382
1383   std::string                      *StrVal;   // This memory must be deleted
1384   llvm::ValID                       ValIDVal;
1385
1386   llvm::Instruction::BinaryOps      BinaryOpVal;
1387   llvm::Instruction::TermOps        TermOpVal;
1388   llvm::Instruction::MemoryOps      MemOpVal;
1389   llvm::Instruction::CastOps        CastOpVal;
1390   llvm::Instruction::OtherOps       OtherOpVal;
1391   llvm::ICmpInst::Predicate         IPredicate;
1392   llvm::FCmpInst::Predicate         FPredicate;
1393 }
1394 /* Line 193 of yacc.c.  */
1395 #line 1396 "llvmAsmParser.tab.c"
1396         YYSTYPE;
1397 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1398 # define YYSTYPE_IS_DECLARED 1
1399 # define YYSTYPE_IS_TRIVIAL 1
1400 #endif
1401
1402
1403
1404 /* Copy the second part of user declarations.  */
1405
1406
1407 /* Line 216 of yacc.c.  */
1408 #line 1409 "llvmAsmParser.tab.c"
1409
1410 #ifdef short
1411 # undef short
1412 #endif
1413
1414 #ifdef YYTYPE_UINT8
1415 typedef YYTYPE_UINT8 yytype_uint8;
1416 #else
1417 typedef unsigned char yytype_uint8;
1418 #endif
1419
1420 #ifdef YYTYPE_INT8
1421 typedef YYTYPE_INT8 yytype_int8;
1422 #elif (defined __STDC__ || defined __C99__FUNC__ \
1423      || defined __cplusplus || defined _MSC_VER)
1424 typedef signed char yytype_int8;
1425 #else
1426 typedef short int yytype_int8;
1427 #endif
1428
1429 #ifdef YYTYPE_UINT16
1430 typedef YYTYPE_UINT16 yytype_uint16;
1431 #else
1432 typedef unsigned short int yytype_uint16;
1433 #endif
1434
1435 #ifdef YYTYPE_INT16
1436 typedef YYTYPE_INT16 yytype_int16;
1437 #else
1438 typedef short int yytype_int16;
1439 #endif
1440
1441 #ifndef YYSIZE_T
1442 # ifdef __SIZE_TYPE__
1443 #  define YYSIZE_T __SIZE_TYPE__
1444 # elif defined size_t
1445 #  define YYSIZE_T size_t
1446 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1447      || defined __cplusplus || defined _MSC_VER)
1448 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1449 #  define YYSIZE_T size_t
1450 # else
1451 #  define YYSIZE_T unsigned int
1452 # endif
1453 #endif
1454
1455 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1456
1457 #ifndef YY_
1458 # if defined YYENABLE_NLS && YYENABLE_NLS
1459 #  if ENABLE_NLS
1460 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1461 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
1462 #  endif
1463 # endif
1464 # ifndef YY_
1465 #  define YY_(msgid) msgid
1466 # endif
1467 #endif
1468
1469 /* Suppress unused-variable warnings by "using" E.  */
1470 #if ! defined lint || defined __GNUC__
1471 # define YYUSE(e) ((void) (e))
1472 #else
1473 # define YYUSE(e) /* empty */
1474 #endif
1475
1476 /* Identity function, used to suppress warnings about constant conditions.  */
1477 #ifndef lint
1478 # define YYID(n) (n)
1479 #else
1480 #if (defined __STDC__ || defined __C99__FUNC__ \
1481      || defined __cplusplus || defined _MSC_VER)
1482 static int
1483 YYID (int i)
1484 #else
1485 static int
1486 YYID (i)
1487     int i;
1488 #endif
1489 {
1490   return i;
1491 }
1492 #endif
1493
1494 #if ! defined yyoverflow || YYERROR_VERBOSE
1495
1496 /* The parser invokes alloca or malloc; define the necessary symbols.  */
1497
1498 # ifdef YYSTACK_USE_ALLOCA
1499 #  if YYSTACK_USE_ALLOCA
1500 #   ifdef __GNUC__
1501 #    define YYSTACK_ALLOC __builtin_alloca
1502 #   elif defined __BUILTIN_VA_ARG_INCR
1503 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1504 #   elif defined _AIX
1505 #    define YYSTACK_ALLOC __alloca
1506 #   elif defined _MSC_VER
1507 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1508 #    define alloca _alloca
1509 #   else
1510 #    define YYSTACK_ALLOC alloca
1511 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1512      || defined __cplusplus || defined _MSC_VER)
1513 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1514 #     ifndef _STDLIB_H
1515 #      define _STDLIB_H 1
1516 #     endif
1517 #    endif
1518 #   endif
1519 #  endif
1520 # endif
1521
1522 # ifdef YYSTACK_ALLOC
1523    /* Pacify GCC's `empty if-body' warning.  */
1524 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1525 #  ifndef YYSTACK_ALLOC_MAXIMUM
1526     /* The OS might guarantee only one guard page at the bottom of the stack,
1527        and a page size can be as small as 4096 bytes.  So we cannot safely
1528        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
1529        to allow for a few compiler-allocated temporary stack slots.  */
1530 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1531 #  endif
1532 # else
1533 #  define YYSTACK_ALLOC YYMALLOC
1534 #  define YYSTACK_FREE YYFREE
1535 #  ifndef YYSTACK_ALLOC_MAXIMUM
1536 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1537 #  endif
1538 #  if (defined __cplusplus && ! defined _STDLIB_H \
1539        && ! ((defined YYMALLOC || defined malloc) \
1540              && (defined YYFREE || defined free)))
1541 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1542 #   ifndef _STDLIB_H
1543 #    define _STDLIB_H 1
1544 #   endif
1545 #  endif
1546 #  ifndef YYMALLOC
1547 #   define YYMALLOC malloc
1548 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549      || defined __cplusplus || defined _MSC_VER)
1550 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1551 #   endif
1552 #  endif
1553 #  ifndef YYFREE
1554 #   define YYFREE free
1555 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1556      || defined __cplusplus || defined _MSC_VER)
1557 void free (void *); /* INFRINGES ON USER NAME SPACE */
1558 #   endif
1559 #  endif
1560 # endif
1561 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1562
1563
1564 #if (! defined yyoverflow \
1565      && (! defined __cplusplus \
1566          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1567
1568 /* A type that is properly aligned for any stack member.  */
1569 union yyalloc
1570 {
1571   yytype_int16 yyss;
1572   YYSTYPE yyvs;
1573   };
1574
1575 /* The size of the maximum gap between one aligned stack and the next.  */
1576 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1577
1578 /* The size of an array large to enough to hold all stacks, each with
1579    N elements.  */
1580 # define YYSTACK_BYTES(N) \
1581      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1582       + YYSTACK_GAP_MAXIMUM)
1583
1584 /* Copy COUNT objects from FROM to TO.  The source and destination do
1585    not overlap.  */
1586 # ifndef YYCOPY
1587 #  if defined __GNUC__ && 1 < __GNUC__
1588 #   define YYCOPY(To, From, Count) \
1589       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1590 #  else
1591 #   define YYCOPY(To, From, Count)              \
1592       do                                        \
1593         {                                       \
1594           YYSIZE_T yyi;                         \
1595           for (yyi = 0; yyi < (Count); yyi++)   \
1596             (To)[yyi] = (From)[yyi];            \
1597         }                                       \
1598       while (YYID (0))
1599 #  endif
1600 # endif
1601
1602 /* Relocate STACK from its old location to the new one.  The
1603    local variables YYSIZE and YYSTACKSIZE give the old and new number of
1604    elements in the stack, and YYPTR gives the new location of the
1605    stack.  Advance YYPTR to a properly aligned location for the next
1606    stack.  */
1607 # define YYSTACK_RELOCATE(Stack)                                        \
1608     do                                                                  \
1609       {                                                                 \
1610         YYSIZE_T yynewbytes;                                            \
1611         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
1612         Stack = &yyptr->Stack;                                          \
1613         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1614         yyptr += yynewbytes / sizeof (*yyptr);                          \
1615       }                                                                 \
1616     while (YYID (0))
1617
1618 #endif
1619
1620 /* YYFINAL -- State number of the termination state.  */
1621 #define YYFINAL  44
1622 /* YYLAST -- Last index in YYTABLE.  */
1623 #define YYLAST   2144
1624
1625 /* YYNTOKENS -- Number of terminals.  */
1626 #define YYNTOKENS  170
1627 /* YYNNTS -- Number of nonterminals.  */
1628 #define YYNNTS  85
1629 /* YYNRULES -- Number of rules.  */
1630 #define YYNRULES  331
1631 /* YYNRULES -- Number of states.  */
1632 #define YYNSTATES  679
1633
1634 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
1635 #define YYUNDEFTOK  2
1636 #define YYMAXUTOK   410
1637
1638 #define YYTRANSLATE(YYX)                                                \
1639   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1640
1641 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
1642 static const yytype_uint8 yytranslate[] =
1643 {
1644        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1645        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1646        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1647        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1648      156,   157,   160,     2,   159,     2,     2,     2,     2,     2,
1649        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1650      165,   158,   166,     2,     2,     2,     2,     2,     2,     2,
1651        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1652        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1653        2,   162,   161,   164,     2,     2,     2,     2,     2,   169,
1654        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1655        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1656      163,     2,     2,   167,     2,   168,     2,     2,     2,     2,
1657        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1658        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1659        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1660        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1661        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1662        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1663        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1664        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1665        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1666        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1667        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1668        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1669        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1670        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1671       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1672       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
1673       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1674       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
1675       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1676       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
1677       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
1678       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
1679       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
1680      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
1681      115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
1682      125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
1683      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
1684      145,   146,   147,   148,   149,   150,   151,   152,   153,   154,
1685      155
1686 };
1687
1688 #if YYDEBUG
1689 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1690    YYRHS.  */
1691 static const yytype_uint16 yyprhs[] =
1692 {
1693        0,     0,     3,     5,     7,     9,    11,    13,    15,    17,
1694       19,    21,    23,    25,    27,    29,    31,    33,    35,    37,
1695       39,    41,    43,    45,    47,    49,    51,    53,    55,    57,
1696       59,    61,    63,    65,    67,    69,    71,    73,    75,    77,
1697       79,    81,    83,    85,    87,    89,    91,    93,    95,    97,
1698       99,   101,   103,   105,   107,   109,   111,   113,   115,   117,
1699      119,   121,   123,   125,   127,   129,   130,   135,   136,   139,
1700      140,   142,   144,   146,   147,   150,   152,   154,   156,   158,
1701      160,   162,   164,   166,   168,   169,   171,   173,   175,   176,
1702      178,   180,   181,   183,   185,   187,   189,   190,   192,   194,
1703      195,   197,   199,   201,   203,   205,   208,   210,   212,   214,
1704      216,   218,   220,   222,   224,   226,   229,   230,   233,   235,
1705      237,   239,   241,   243,   245,   246,   249,   250,   253,   254,
1706      257,   258,   262,   265,   266,   268,   269,   273,   275,   278,
1707      280,   282,   284,   286,   288,   290,   292,   294,   296,   300,
1708      302,   305,   311,   317,   323,   329,   333,   336,   342,   347,
1709      350,   352,   354,   356,   360,   362,   366,   368,   369,   371,
1710      375,   380,   384,   388,   393,   398,   402,   409,   415,   418,
1711      421,   424,   427,   430,   433,   436,   439,   442,   445,   448,
1712      451,   458,   464,   473,   480,   487,   495,   503,   511,   519,
1713      526,   535,   544,   550,   558,   562,   564,   566,   568,   570,
1714      571,   574,   581,   583,   584,   586,   589,   590,   594,   595,
1715      599,   603,   607,   611,   612,   621,   622,   632,   633,   643,
1716      649,   652,   656,   658,   662,   666,   670,   674,   676,   677,
1717      683,   687,   689,   693,   695,   696,   707,   709,   711,   716,
1718      718,   720,   723,   727,   728,   730,   732,   734,   736,   738,
1719      740,   742,   744,   746,   750,   752,   758,   760,   762,   764,
1720      766,   768,   770,   773,   775,   779,   782,   785,   789,   792,
1721      793,   795,   798,   801,   805,   815,   825,   834,   849,   851,
1722      853,   860,   866,   869,   876,   884,   889,   894,   901,   908,
1723      909,   910,   914,   917,   919,   925,   931,   938,   945,   952,
1724      959,   964,   971,   976,   981,   988,   995,   998,  1007,  1009,
1725     1011,  1012,  1016,  1023,  1027,  1034,  1037,  1043,  1051,  1057,
1726     1062,  1067
1727 };
1728
1729 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
1730 static const yytype_int16 yyrhs[] =
1731 {
1732      216,     0,    -1,    75,    -1,    76,    -1,    77,    -1,    78,
1733       -1,    79,    -1,    80,    -1,    81,    -1,    82,    -1,    83,
1734       -1,    87,    -1,    88,    -1,    89,    -1,    84,    -1,    85,
1735       -1,    86,    -1,   120,    -1,   121,    -1,   122,    -1,   123,
1736       -1,   124,    -1,   125,    -1,   126,    -1,   127,    -1,   128,
1737       -1,   129,    -1,   130,    -1,   131,    -1,    94,    -1,    95,
1738       -1,    96,    -1,    97,    -1,    98,    -1,    99,    -1,   100,
1739       -1,   101,    -1,   102,    -1,   103,    -1,   104,    -1,   105,
1740       -1,   106,    -1,   107,    -1,   108,    -1,   109,    -1,   110,
1741       -1,   111,    -1,   112,    -1,   113,    -1,   100,    -1,   101,
1742       -1,   102,    -1,   103,    -1,    26,    -1,    27,    -1,    11,
1743       -1,    12,    -1,    13,    -1,    16,    -1,    15,    -1,    14,
1744       -1,    19,    -1,    22,    -1,    24,    -1,   178,    -1,    -1,
1745       55,   156,     4,   157,    -1,    -1,   178,   158,    -1,    -1,
1746       20,    -1,    23,    -1,   184,    -1,    -1,   182,   158,    -1,
1747       42,    -1,    44,    -1,    43,    -1,    45,    -1,    47,    -1,
1748       49,    -1,    46,    -1,    48,    -1,    51,    -1,    -1,   153,
1749       -1,   154,    -1,   155,    -1,    -1,    46,    -1,    48,    -1,
1750       -1,    42,    -1,    43,    -1,    44,    -1,    47,    -1,    -1,
1751       44,    -1,    42,    -1,    -1,    63,    -1,    64,    -1,    65,
1752       -1,    66,    -1,    67,    -1,    62,     4,    -1,   142,    -1,
1753      121,    -1,   141,    -1,   122,    -1,   144,    -1,   145,    -1,
1754      147,    -1,   148,    -1,   149,    -1,    54,     4,    -1,    -1,
1755      193,   192,    -1,   143,    -1,   146,    -1,   142,    -1,   141,
1756       -1,   150,    -1,   151,    -1,    -1,   195,   194,    -1,    -1,
1757      152,    22,    -1,    -1,    54,     4,    -1,    -1,   159,    54,
1758        4,    -1,    34,    22,    -1,    -1,   199,    -1,    -1,   159,
1759      202,   201,    -1,   199,    -1,    54,     4,    -1,    11,    -1,
1760       12,    -1,    13,    -1,    16,    -1,    15,    -1,    14,    -1,
1761       17,    -1,    50,    -1,   203,    -1,   204,   180,   160,    -1,
1762      238,    -1,   161,     4,    -1,   204,   156,   208,   157,   195,
1763       -1,    10,   156,   208,   157,   195,    -1,   162,     4,   163,
1764      204,   164,    -1,   165,     4,   163,   204,   166,    -1,   167,
1765      209,   168,    -1,   167,   168,    -1,   165,   167,   209,   168,
1766      166,    -1,   165,   167,   168,   166,    -1,   204,   193,    -1,
1767      204,    -1,    10,    -1,   205,    -1,   207,   159,   205,    -1,
1768      207,    -1,   207,   159,    39,    -1,    39,    -1,    -1,   204,
1769       -1,   209,   159,   204,    -1,   204,   162,   212,   164,    -1,
1770      204,   162,   164,    -1,   204,   169,    22,    -1,   204,   165,
1771      212,   166,    -1,   204,   167,   212,   168,    -1,   204,   167,
1772      168,    -1,   204,   165,   167,   212,   168,   166,    -1,   204,
1773      165,   167,   168,   166,    -1,   204,    40,    -1,   204,    41,
1774       -1,   204,   238,    -1,   204,   211,    -1,   204,    25,    -1,
1775      176,     3,    -1,   176,     5,    -1,   176,     4,    -1,   176,
1776        6,    -1,    11,    26,    -1,    11,    27,    -1,   177,     9,
1777       -1,   173,   156,   210,    38,   204,   157,    -1,   119,   156,
1778      210,   250,   157,    -1,   133,   156,   210,   159,   210,   159,
1779      210,   157,    -1,   171,   156,   210,   159,   210,   157,    -1,
1780      172,   156,   210,   159,   210,   157,    -1,    90,   174,   156,
1781      210,   159,   210,   157,    -1,    91,   175,   156,   210,   159,
1782      210,   157,    -1,    92,   174,   156,   210,   159,   210,   157,
1783       -1,    93,   175,   156,   210,   159,   210,   157,    -1,   135,
1784      156,   210,   159,   210,   157,    -1,   136,   156,   210,   159,
1785      210,   159,   210,   157,    -1,   137,   156,   210,   159,   210,
1786      159,   210,   157,    -1,   139,   156,   210,   250,   157,    -1,
1787      140,   156,   210,   159,   210,   250,   157,    -1,   212,   159,
1788      210,    -1,   210,    -1,    32,    -1,    33,    -1,    37,    -1,
1789       -1,   206,   238,    -1,   125,   156,   215,    38,   204,   157,
1790       -1,   217,    -1,    -1,   218,    -1,   217,   218,    -1,    -1,
1791       31,   219,   234,    -1,    -1,    30,   220,   235,    -1,    60,
1792       59,   224,    -1,   181,    18,   204,    -1,   181,    18,    10,
1793       -1,    -1,   183,   187,   214,   213,   210,   180,   221,   201,
1794       -1,    -1,   183,   185,   187,   214,   213,   210,   180,   222,
1795      201,    -1,    -1,   183,   186,   187,   214,   213,   204,   180,
1796      223,   201,    -1,   183,   187,    35,   190,   215,    -1,    52,
1797      225,    -1,    56,   158,   226,    -1,    22,    -1,    53,   158,
1798       22,    -1,    68,   158,    22,    -1,   162,   227,   164,    -1,
1799      227,   159,    22,    -1,    22,    -1,    -1,   228,   159,   204,
1800      193,   179,    -1,   204,   193,   179,    -1,   228,    -1,   228,
1801      159,    39,    -1,    39,    -1,    -1,   191,   206,   182,   156,
1802      229,   157,   195,   200,   197,   196,    -1,    28,    -1,   167,
1803       -1,   189,   187,   230,   231,    -1,    29,    -1,   168,    -1,
1804      242,   233,    -1,   188,   187,   230,    -1,    -1,    61,    -1,
1805        3,    -1,     4,    -1,     9,    -1,    26,    -1,    27,    -1,
1806       40,    -1,    41,    -1,    25,    -1,   165,   212,   166,    -1,
1807      211,    -1,    59,   236,    22,   159,    22,    -1,     7,    -1,
1808        8,    -1,   178,    -1,   182,    -1,   238,    -1,   237,    -1,
1809      204,   239,    -1,   240,    -1,   241,   159,   240,    -1,   242,
1810      243,    -1,   232,   243,    -1,   244,   181,   245,    -1,   244,
1811      247,    -1,    -1,    21,    -1,    69,   241,    -1,    69,    10,
1812       -1,    70,    17,   239,    -1,    70,    11,   239,   159,    17,
1813      239,   159,    17,   239,    -1,    71,   176,   239,   159,    17,
1814      239,   162,   246,   164,    -1,    71,   176,   239,   159,    17,
1815      239,   162,   164,    -1,    72,   191,   206,   239,   156,   249,
1816      157,   195,    38,    17,   239,    73,    17,   239,    -1,    73,
1817       -1,    74,    -1,   246,   176,   237,   159,    17,   239,    -1,
1818      176,   237,   159,    17,   239,    -1,   181,   252,    -1,   204,
1819      162,   239,   159,   239,   164,    -1,   248,   159,   162,   239,
1820      159,   239,   164,    -1,   204,   193,   239,   193,    -1,    17,
1821      193,   239,   193,    -1,   249,   159,   204,   193,   239,   193,
1822       -1,   249,   159,    17,   193,   239,   193,    -1,    -1,    -1,
1823      250,   159,   240,    -1,    58,    57,    -1,    57,    -1,   171,
1824      204,   239,   159,   239,    -1,   172,   204,   239,   159,   239,
1825       -1,    90,   174,   204,   239,   159,   239,    -1,    91,   175,
1826      204,   239,   159,   239,    -1,    92,   174,   204,   239,   159,
1827      239,    -1,    93,   175,   204,   239,   159,   239,    -1,   173,
1828      240,    38,   204,    -1,   133,   240,   159,   240,   159,   240,
1829       -1,   134,   240,   159,   204,    -1,   135,   240,   159,   240,
1830       -1,   136,   240,   159,   240,   159,   240,    -1,   137,   240,
1831      159,   240,   159,   240,    -1,   132,   248,    -1,   251,   191,
1832      206,   239,   156,   249,   157,   195,    -1,   254,    -1,    36,
1833       -1,    -1,   114,   204,   198,    -1,   114,   204,   159,    11,
1834      239,   198,    -1,   115,   204,   198,    -1,   115,   204,   159,
1835       11,   239,   198,    -1,   116,   240,    -1,   253,   117,   204,
1836      239,   198,    -1,   253,   118,   240,   159,   204,   239,   198,
1837       -1,   138,   204,   239,   159,     4,    -1,   119,   204,   239,
1838      250,    -1,   139,   204,   239,   250,    -1,   140,   204,   239,
1839      159,   204,   239,   250,    -1
1840 };
1841
1842 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
1843 static const yytype_uint16 yyrline[] =
1844 {
1845        0,  1112,  1112,  1112,  1112,  1112,  1112,  1112,  1112,  1112,
1846     1112,  1113,  1113,  1113,  1113,  1113,  1113,  1114,  1114,  1114,
1847     1114,  1114,  1114,  1115,  1115,  1115,  1115,  1115,  1115,  1118,
1848     1118,  1119,  1119,  1120,  1120,  1121,  1121,  1122,  1122,  1126,
1849     1126,  1127,  1127,  1128,  1128,  1129,  1129,  1130,  1130,  1131,
1850     1131,  1132,  1132,  1133,  1134,  1139,  1140,  1140,  1140,  1140,
1851     1140,  1142,  1142,  1142,  1143,  1143,  1145,  1146,  1150,  1154,
1852     1159,  1159,  1161,  1162,  1167,  1173,  1174,  1175,  1176,  1177,
1853     1178,  1182,  1183,  1184,  1188,  1189,  1190,  1191,  1195,  1196,
1854     1197,  1201,  1202,  1203,  1204,  1205,  1209,  1210,  1211,  1214,
1855     1215,  1216,  1217,  1218,  1219,  1220,  1227,  1228,  1229,  1230,
1856     1231,  1232,  1233,  1234,  1235,  1236,  1240,  1241,  1246,  1247,
1857     1248,  1249,  1250,  1251,  1254,  1255,  1260,  1261,  1268,  1269,
1858     1275,  1276,  1285,  1293,  1294,  1299,  1300,  1301,  1306,  1319,
1859     1319,  1319,  1319,  1319,  1319,  1319,  1322,  1326,  1330,  1337,
1860     1342,  1350,  1379,  1404,  1409,  1419,  1429,  1433,  1443,  1450,
1861     1459,  1466,  1471,  1476,  1483,  1484,  1491,  1498,  1506,  1512,
1862     1524,  1552,  1568,  1595,  1623,  1649,  1669,  1695,  1715,  1727,
1863     1734,  1800,  1810,  1820,  1826,  1836,  1842,  1852,  1857,  1862,
1864     1875,  1887,  1908,  1916,  1922,  1933,  1938,  1943,  1948,  1953,
1865     1959,  1965,  1971,  1992,  2016,  2020,  2028,  2028,  2031,  2031,
1866     2034,  2046,  2067,  2072,  2080,  2081,  2085,  2085,  2089,  2089,
1867     2092,  2095,  2119,  2131,  2130,  2142,  2141,  2151,  2150,  2161,
1868     2201,  2204,  2210,  2220,  2224,  2229,  2231,  2236,  2241,  2250,
1869     2260,  2271,  2275,  2284,  2293,  2298,  2427,  2427,  2429,  2438,
1870     2438,  2440,  2445,  2457,  2461,  2466,  2470,  2474,  2478,  2482,
1871     2486,  2490,  2494,  2498,  2523,  2527,  2537,  2541,  2545,  2550,
1872     2557,  2557,  2563,  2572,  2577,  2582,  2586,  2595,  2604,  2613,
1873     2617,  2625,  2632,  2636,  2641,  2651,  2670,  2679,  2765,  2769,
1874     2776,  2787,  2800,  2810,  2821,  2831,  2842,  2850,  2860,  2867,
1875     2870,  2871,  2878,  2882,  2887,  2903,  2920,  2934,  2948,  2962,
1876     2976,  2988,  2996,  3003,  3009,  3015,  3021,  3036,  3126,  3131,
1877     3135,  3142,  3149,  3157,  3164,  3172,  3180,  3194,  3211,  3219,
1878     3234,  3249
1879 };
1880 #endif
1881
1882 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1883 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1884    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
1885 static const char *const yytname[] =
1886 {
1887   "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1888   "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1889   "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1890   "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1891   "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1892   "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1893   "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1894   "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1895   "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
1896   "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1897   "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1898   "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1899   "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1900   "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1901   "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1902   "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1903   "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1904   "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1905   "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1906   "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1907   "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1908   "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1909   "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1910   "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1911   "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1912   "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1913   "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1914   "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName",
1915   "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1916   "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1917   "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1918   "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1919   "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1920   "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1921   "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1922   "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1923   "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1924   "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1925   "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1926   "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1927   "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1928   "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1929   "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1930   "InstVal", "OptVolatile", "MemoryInst", 0
1931 };
1932 #endif
1933
1934 # ifdef YYPRINT
1935 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1936    token YYLEX-NUM.  */
1937 static const yytype_uint16 yytoknum[] =
1938 {
1939        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1940      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1941      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1942      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1943      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1944      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
1945      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
1946      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
1947      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
1948      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
1949      355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
1950      365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
1951      375,   376,   377,   378,   379,   380,   381,   382,   383,   384,
1952      385,   386,   387,   388,   389,   390,   391,   392,   393,   394,
1953      395,   396,   397,   398,   399,   400,   401,   402,   403,   404,
1954      405,   406,   407,   408,   409,   410,    40,    41,    61,    44,
1955       42,    92,    91,   120,    93,    60,    62,   123,   125,    99
1956 };
1957 # endif
1958
1959 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
1960 static const yytype_uint8 yyr1[] =
1961 {
1962        0,   170,   171,   171,   171,   171,   171,   171,   171,   171,
1963      171,   172,   172,   172,   172,   172,   172,   173,   173,   173,
1964      173,   173,   173,   173,   173,   173,   173,   173,   173,   174,
1965      174,   174,   174,   174,   174,   174,   174,   174,   174,   175,
1966      175,   175,   175,   175,   175,   175,   175,   175,   175,   175,
1967      175,   175,   175,   175,   175,   176,   177,   177,   177,   177,
1968      177,   178,   178,   178,   179,   179,   180,   180,   181,   181,
1969      182,   182,   183,   183,   184,   185,   185,   185,   185,   185,
1970      185,   186,   186,   186,   187,   187,   187,   187,   188,   188,
1971      188,   189,   189,   189,   189,   189,   190,   190,   190,   191,
1972      191,   191,   191,   191,   191,   191,   192,   192,   192,   192,
1973      192,   192,   192,   192,   192,   192,   193,   193,   194,   194,
1974      194,   194,   194,   194,   195,   195,   196,   196,   197,   197,
1975      198,   198,   199,   200,   200,   201,   201,   202,   202,   203,
1976      203,   203,   203,   203,   203,   203,   204,   204,   204,   204,
1977      204,   204,   204,   204,   204,   204,   204,   204,   204,   205,
1978      206,   206,   207,   207,   208,   208,   208,   208,   209,   209,
1979      210,   210,   210,   210,   210,   210,   210,   210,   210,   210,
1980      210,   210,   210,   210,   210,   210,   210,   210,   210,   210,
1981      211,   211,   211,   211,   211,   211,   211,   211,   211,   211,
1982      211,   211,   211,   211,   212,   212,   213,   213,   214,   214,
1983      215,   215,   216,   216,   217,   217,   219,   218,   220,   218,
1984      218,   218,   218,   221,   218,   222,   218,   223,   218,   218,
1985      218,   218,   224,   225,   225,   226,   227,   227,   227,   228,
1986      228,   229,   229,   229,   229,   230,   231,   231,   232,   233,
1987      233,   234,   235,   236,   236,   237,   237,   237,   237,   237,
1988      237,   237,   237,   237,   237,   237,   238,   238,   238,   238,
1989      239,   239,   240,   241,   241,   242,   242,   243,   244,   244,
1990      244,   245,   245,   245,   245,   245,   245,   245,   245,   245,
1991      246,   246,   247,   248,   248,   249,   249,   249,   249,   249,
1992      250,   250,   251,   251,   252,   252,   252,   252,   252,   252,
1993      252,   252,   252,   252,   252,   252,   252,   252,   252,   253,
1994      253,   254,   254,   254,   254,   254,   254,   254,   254,   254,
1995      254,   254
1996 };
1997
1998 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
1999 static const yytype_uint8 yyr2[] =
2000 {
2001        0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
2002        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2003        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2004        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2005        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2006        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2007        1,     1,     1,     1,     1,     0,     4,     0,     2,     0,
2008        1,     1,     1,     0,     2,     1,     1,     1,     1,     1,
2009        1,     1,     1,     1,     0,     1,     1,     1,     0,     1,
2010        1,     0,     1,     1,     1,     1,     0,     1,     1,     0,
2011        1,     1,     1,     1,     1,     2,     1,     1,     1,     1,
2012        1,     1,     1,     1,     1,     2,     0,     2,     1,     1,
2013        1,     1,     1,     1,     0,     2,     0,     2,     0,     2,
2014        0,     3,     2,     0,     1,     0,     3,     1,     2,     1,
2015        1,     1,     1,     1,     1,     1,     1,     1,     3,     1,
2016        2,     5,     5,     5,     5,     3,     2,     5,     4,     2,
2017        1,     1,     1,     3,     1,     3,     1,     0,     1,     3,
2018        4,     3,     3,     4,     4,     3,     6,     5,     2,     2,
2019        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2020        6,     5,     8,     6,     6,     7,     7,     7,     7,     6,
2021        8,     8,     5,     7,     3,     1,     1,     1,     1,     0,
2022        2,     6,     1,     0,     1,     2,     0,     3,     0,     3,
2023        3,     3,     3,     0,     8,     0,     9,     0,     9,     5,
2024        2,     3,     1,     3,     3,     3,     3,     1,     0,     5,
2025        3,     1,     3,     1,     0,    10,     1,     1,     4,     1,
2026        1,     2,     3,     0,     1,     1,     1,     1,     1,     1,
2027        1,     1,     1,     3,     1,     5,     1,     1,     1,     1,
2028        1,     1,     2,     1,     3,     2,     2,     3,     2,     0,
2029        1,     2,     2,     3,     9,     9,     8,    14,     1,     1,
2030        6,     5,     2,     6,     7,     4,     4,     6,     6,     0,
2031        0,     3,     2,     1,     5,     5,     6,     6,     6,     6,
2032        4,     6,     4,     4,     6,     6,     2,     8,     1,     1,
2033        0,     3,     6,     3,     6,     2,     5,     7,     5,     4,
2034        4,     7
2035 };
2036
2037 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2038    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
2039    means the default is an error.  */
2040 static const yytype_uint16 yydefact[] =
2041 {
2042       73,    61,    70,    62,    71,    63,   218,   216,     0,     0,
2043        0,     0,     0,     0,    84,    72,     0,    73,   214,    88,
2044       91,     0,     0,   230,     0,     0,    68,     0,    74,    75,
2045       77,    76,    78,    81,    79,    82,    80,    83,    85,    86,
2046       87,    84,    84,   209,     1,   215,    89,    90,    84,   219,
2047       92,    93,    94,    95,    84,   279,   217,   279,     0,     0,
2048      238,   231,   232,   220,   266,   267,   222,   139,   140,   141,
2049      144,   143,   142,   145,   146,     0,     0,     0,     0,   268,
2050      269,   147,   221,   149,   209,   209,    96,   208,     0,    99,
2051       99,   280,   276,    69,   249,   250,   251,   275,   233,   234,
2052      237,     0,   167,   150,     0,     0,     0,     0,   156,   168,
2053        0,     0,   167,     0,     0,     0,    98,    97,     0,   206,
2054      207,     0,     0,   100,   101,   102,   103,   104,     0,   252,
2055        0,   320,   278,     0,   235,   166,   116,   162,   164,     0,
2056        0,     0,     0,     0,     0,   155,     0,     0,   148,     0,
2057        0,   161,     0,   160,     0,   229,   139,   140,   141,   144,
2058      143,   142,     0,     0,    67,    67,   105,     0,   246,   247,
2059      248,   319,   303,     0,     0,     0,     0,    99,   288,   289,
2060        2,     3,     4,     5,     6,     7,     8,     9,    10,    14,
2061       15,    16,    11,    12,    13,     0,     0,     0,     0,     0,
2062        0,     0,     0,    17,    18,    19,    20,    21,    22,    23,
2063       24,    25,    26,    27,    28,     0,     0,     0,     0,     0,
2064        0,     0,     0,     0,     0,     0,     0,   277,    99,   292,
2065        0,   318,   236,   159,     0,   124,    67,    67,   158,     0,
2066      169,     0,   124,    67,    67,     0,   210,   187,   188,   183,
2067      185,   184,   186,   189,   182,   178,   179,     0,     0,     0,
2068        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2069        0,     0,     0,     0,     0,   181,   180,   223,     0,   302,
2070      282,    67,   273,   281,     0,     0,    55,     0,     0,    29,
2071       30,    31,    32,    33,    34,    35,    36,    37,    38,     0,
2072       53,    54,    49,    50,    51,    52,    39,    40,    41,    42,
2073       43,    44,    45,    46,    47,    48,     0,     0,     0,   130,
2074      130,   325,    67,    67,   316,     0,     0,     0,     0,     0,
2075       67,    67,    67,    67,    67,     0,     0,     0,     0,     0,
2076      107,   109,   108,   106,   110,   111,   112,   113,   114,   117,
2077      165,   163,   152,   153,   154,   157,    66,   151,   225,   227,
2078        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2079        0,     0,   171,   205,     0,     0,     0,   175,     0,   172,
2080        0,     0,     0,   135,   244,   255,   256,   257,   262,   258,
2081      259,   260,   261,   253,     0,   264,   271,   270,   272,     0,
2082        0,   283,     0,     0,    67,    67,    67,    67,     0,   321,
2083        0,   323,   300,     0,     0,     0,     0,     0,     0,     0,
2084        0,   300,     0,     0,     0,     0,     0,    67,     0,   115,
2085      121,   120,   118,   119,   122,   123,   125,   135,   135,     0,
2086        0,     0,     0,     0,   300,     0,     0,     0,     0,   300,
2087        0,     0,   170,   156,   168,     0,   173,   174,     0,     0,
2088        0,     0,   224,   243,   116,   241,     0,   254,     0,     0,
2089      274,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2090        0,   329,     0,     0,     0,   312,   313,     0,     0,     0,
2091      330,     0,     0,     0,   310,     0,   130,     0,   226,   228,
2092       67,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2093        0,     0,   204,   177,     0,     0,     0,     0,     0,     0,
2094      137,   135,    65,     0,   124,     0,   263,     0,     0,   299,
2095        0,     0,     0,     0,   130,   131,   130,     0,     0,     0,
2096        0,     0,     0,   328,    67,   304,   305,   299,     0,   326,
2097       67,   211,     0,     0,     0,     0,   191,     0,     0,     0,
2098        0,   202,   300,   176,     0,     0,    67,   132,   138,   136,
2099       64,   240,   242,   116,   133,     0,     0,     0,   116,   116,
2100        0,   306,   307,   308,   309,   322,   324,   301,     0,     0,
2101      311,   314,   315,   300,     0,   130,     0,     0,     0,     0,
2102        0,   199,     0,     0,     0,   193,   194,   190,    65,   134,
2103      128,   265,     0,     0,     0,     0,   124,     0,   293,     0,
2104      331,   124,   327,   195,   196,   197,   198,     0,     0,     0,
2105      203,   239,     0,   126,     0,   286,     0,     0,   107,   109,
2106      116,   116,     0,   116,   116,   294,   317,   192,   200,   201,
2107      129,     0,   245,   284,     0,   285,     0,   296,   295,     0,
2108        0,     0,   127,     0,     0,     0,   116,   116,     0,     0,
2109        0,   298,   297,   291,     0,     0,   290,     0,   287
2110 };
2111
2112 /* YYDEFGOTO[NTERM-NUM].  */
2113 static const yytype_int16 yydefgoto[] =
2114 {
2115       -1,   272,   273,   274,   299,   316,   162,   163,    79,   571,
2116      113,    12,    80,    14,    15,    41,    42,    43,    48,    54,
2117      118,   128,   349,   233,   436,   352,   652,   633,   409,   520,
2118      610,   462,   521,    81,   164,   137,   154,   138,   139,   110,
2119      373,   395,   374,   121,    88,   155,    16,    17,    18,    20,
2120       19,   383,   437,   438,    63,    23,    61,   101,   465,   466,
2121      129,   170,    55,    96,    56,    49,   468,   396,    83,   398,
2122      282,   283,    57,    92,    93,   227,   637,   132,   324,   580,
2123      481,   228,   229,   230,   231
2124 };
2125
2126 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2127    STATE-NUM.  */
2128 #define YYPACT_NINF -578
2129 static const yytype_int16 yypact[] =
2130 {
2131      348,  -578,  -578,  -578,  -578,  -578,  -578,  -578,    42,  -145,
2132       -8,   -70,    59,   -15,    -2,  -578,   154,  1288,  -578,   155,
2133      317,     4,    24,  -578,    -4,   157,  -578,  1678,  -578,  -578,
2134     -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,
2135     -578,   133,   133,   203,  -578,  -578,  -578,  -578,   133,  -578,
2136     -578,  -578,  -578,  -578,   133,   183,  -578,    -5,   191,   194,
2137      204,  -578,  -578,  -578,  -578,  -578,    73,  -578,  -578,  -578,
2138     -578,  -578,  -578,  -578,  -578,   235,   238,    11,   244,  -578,
2139     -578,  -578,    87,  -578,   212,   212,   261,  -578,   100,   321,
2140      321,  -578,  -578,   250,  -578,  -578,  -578,  -578,  -578,  -578,
2141     -578,   -47,    50,  -578,   102,   107,   787,    73,  -578,    87,
2142      -81,   141,    50,   129,   100,   100,  -578,  -578,  1362,  -578,
2143     -578,  1722,   303,  -578,  -578,  -578,  -578,  -578,  1780,  -578,
2144      -17,  2004,  -578,   302,  -578,  -578,    87,  -578,   173,   189,
2145     1840,  1840,   181,   -61,  1840,  -578,   346,   200,  -578,  1722,
2146     1840,    73,   195,    87,   294,  -578,    79,   360,   365,   371,
2147      372,   385,   272,   388,  1425,   343,  -578,    30,  -578,  -578,
2148     -578,  -578,  -578,   344,  1858,   220,   391,   321,  -578,  -578,
2149     -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,
2150     -578,  -578,  -578,  -578,  -578,   668,   443,   668,   443,  1840,
2151     1840,  1840,  1840,  -578,  -578,  -578,  -578,  -578,  -578,  -578,
2152     -578,  -578,  -578,  -578,  -578,  1840,  1840,  1840,  1840,  1840,
2153     1840,  1840,  1840,  1840,  1840,  1840,  1840,  -578,   321,  -578,
2154       53,  -578,  -578,   178,  1560,  -578,   -20,   -27,  -578,   241,
2155       87,   253,  -578,   343,    16,  1362,  -578,  -578,  -578,  -578,
2156     -578,  -578,  -578,  -578,  -578,  -578,  -578,   668,   443,   668,
2157      443,   258,   264,   268,   275,   278,   280,   281,  1601,  1887,
2158     1046,   395,   282,   284,   287,  -578,  -578,  -578,   288,  -578,
2159       73,   996,  -578,   266,  1140,  1140,  -578,  1140,  1780,  -578,
2160     -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  1840,
2161     -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,
2162     -578,  -578,  -578,  -578,  -578,  -578,  1840,  1840,  1840,    68,
2163       85,  -578,   996,   -25,   271,   286,   289,   290,   291,   299,
2164      996,   996,   996,   996,   996,   408,  1780,  1840,  1840,   455,
2165     -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,
2166     -578,  -578,   188,  -578,  -578,  -578,  -578,   188,  -578,   129,
2167      409,   304,   305,   306,   308,  1722,  1722,  1722,  1722,  1722,
2168     1722,  1722,  -578,  -578,    89,  1087,   -58,  -578,   -48,  -578,
2169     1722,  1722,  1722,   313,  1619,  -578,  -578,  -578,  -578,  -578,
2170     -578,  -578,  -578,   412,  1722,  -578,  -578,  -578,  -578,  1840,
2171      315,  -578,   316,  1140,   996,   996,   996,   996,    27,  -578,
2172       37,  -578,  -578,  1140,   322,  1840,  1840,  1840,  1840,  1840,
2173      319,  -578,   324,   326,   327,  1840,  1140,   996,   329,  -578,
2174     -578,  -578,  -578,  -578,  -578,  -578,  -578,   313,   313,  1840,
2175     1722,  1722,  1722,  1722,  -578,   330,   331,   333,   335,  -578,
2176      336,  1722,  -578,   332,  1274,   -40,  -578,  -578,   337,   341,
2177      463,    21,  -578,  -578,    87,   345,   349,  -578,   480,    22,
2178     -578,   488,   490,   352,   350,   351,   353,   354,  1140,   513,
2179     1140,   359,   361,  1140,   364,    87,  -578,   366,   373,   515,
2180      359,  1840,  1140,  1140,    87,   368,   375,  1840,  -578,  -578,
2181       -1,   376,   377,   380,   381,   147,  1722,  1722,  1722,  1722,
2182      176,  1722,  -578,  -578,   392,  1722,  1722,  1840,   519,   538,
2183     -578,   313,   274,  1660,  -578,   398,  -578,  1140,  1140,  1905,
2184     1140,  1140,  1140,  1140,   375,  -578,   375,  1840,  1140,   400,
2185     1840,  1840,  1840,  -578,   996,  -578,  -578,  1905,   506,  -578,
2186      996,  -578,  1722,  1722,  1722,  1722,  -578,   402,   405,   406,
2187      407,  -578,  -578,  -578,   410,   413,    49,  -578,  -578,  -578,
2188     -578,  -578,  -578,    87,   -16,   547,   414,   419,    90,    87,
2189      206,  -578,  -578,  -578,  -578,  -578,  -578,  -578,   411,  1140,
2190     -578,  -578,  -578,  -578,   269,   375,   415,   417,   425,   427,
2191     1722,  -578,  1722,  1722,   276,  -578,  -578,  -578,   274,  -578,
2192      517,  -578,   568,     1,   849,   849,  -578,  1946,  -578,   422,
2193      359,  -578,  -578,  -578,  -578,  -578,  -578,   430,   431,   432,
2194     -578,  -578,   586,   444,  1140,  -578,   621,     3,   442,   447,
2195     -578,  -578,    18,    90,    87,  -578,   188,  -578,  -578,  -578,
2196     -578,   577,  -578,  -578,   441,  -578,   621,   178,   178,   587,
2197      849,   849,  -578,   588,   448,  1140,  -578,  -578,  1140,   589,
2198      539,   178,   178,  -578,  1140,   594,  -578,  1140,  -578
2199 };
2200
2201 /* YYPGOTO[NTERM-NUM].  */
2202 static const yytype_int16 yypgoto[] =
2203 {
2204     -578,   482,   484,   485,  -163,  -161,  -174,  -578,     0,    12,
2205      -97,   525,    10,  -578,  -578,  -578,  -578,   267,  -578,  -578,
2206     -578,  -138,  -578,  -457,  -578,  -239,  -578,  -578,  -311,    45,
2207     -578,  -412,  -578,  -578,   -26,   387,  -122,  -578,   510,   521,
2208       86,  -159,  -237,   222,   257,   383,  -578,  -578,   612,  -578,
2209     -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,  -578,
2210      541,  -578,  -578,  -578,  -578,  -578,  -578,  -577,   -51,   246,
2211     -197,  -578,  -578,   575,  -578,  -578,  -578,  -578,  -578,    88,
2212     -413,  -578,  -578,  -578,  -578
2213 };
2214
2215 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
2216    positive, shift that token.  If negative, reduce the rule which
2217    number is the opposite.  If zero, do what YYDEFACT says.
2218    If YYTABLE_NINF, syntax error.  */
2219 #define YYTABLE_NINF -214
2220 static const yytype_int16 yytable[] =
2221 {
2222       11,    82,   287,   357,   321,   275,   167,   522,   490,   411,
2223       13,   168,   286,    24,   286,   105,    91,    11,   518,   325,
2224      326,   327,   328,   329,    94,   498,   499,    13,   111,   335,
2225      111,   505,   376,   378,   317,   111,   510,   318,   478,   288,
2226       29,    30,    31,    32,    33,    34,    35,    36,   480,    37,
2227        2,    25,   109,     4,   111,   518,   659,    64,    65,   654,
2228      107,    67,    68,    69,    70,    71,    72,    73,   277,     1,
2229        2,   111,     3,     4,     5,   519,   136,    27,   144,   664,
2230      109,   479,   -55,   -55,   -55,   -55,   136,   145,    26,   135,
2231      336,   479,   153,    11,   361,    21,   363,   362,   144,   364,
2232       74,   451,   153,   246,   111,   247,   248,   239,   456,   569,
2233       22,   451,   133,   276,   236,   237,   608,   134,   240,   451,
2234      457,   614,   615,   111,   244,   430,   431,   432,   514,   112,
2235      433,   112,   119,   120,   434,   435,   112,   413,   455,   354,
2236      111,   428,   111,    28,   353,  -145,   358,   359,   281,   604,
2237      169,    38,    39,    40,    44,   112,   551,   469,    60,   430,
2238      431,   432,    58,    95,   433,   635,   403,   655,   434,   435,
2239      337,   338,   112,   319,   320,   281,   322,   278,   106,    62,
2240      620,   451,    59,   657,   658,   549,   660,   661,   526,   323,
2241      281,   281,   281,   281,   281,   330,   331,   332,   333,   334,
2242      281,    46,   470,    47,    91,   112,   607,   165,   136,   671,
2243      672,    75,    76,    98,   426,    77,    99,    78,   484,   153,
2244      486,   487,   488,   585,   112,   586,   100,   408,   -67,   102,
2245      397,   284,   339,   397,   397,   243,   397,   285,    86,   103,
2246       87,   112,   104,   112,   410,   -67,  -145,   -67,   451,    87,
2247     -145,    64,    65,   452,   107,    67,    68,    69,    70,    71,
2248       72,    73,   153,     1,     2,   140,     3,     4,     5,     1,
2249      141,   397,     3,   404,     5,   249,   250,   251,   252,   397,
2250      397,   397,   397,   397,   622,   574,    38,    39,    40,   148,
2251      405,   406,   407,     1,    74,   275,     3,   146,     5,   340,
2252      341,    64,    65,   116,   556,   117,   537,   166,    84,    85,
2253      153,   427,   281,     1,     2,    89,     3,     4,     5,   342,
2254      343,    90,   344,   345,   232,   346,   347,   348,   339,   430,
2255      431,   432,   234,   561,   433,   537,   149,   150,   434,   435,
2256      587,   114,   115,   590,   591,   592,   235,   238,  -213,   454,
2257      241,   245,   397,   397,   397,   397,   397,   242,   464,    50,
2258       51,    52,   397,   616,    53,   617,   -69,     1,     2,   -56,
2259        3,     4,     5,   281,   -57,   397,   397,   642,     6,     7,
2260      -60,   -59,   646,   122,   123,   124,   125,   126,   127,   281,
2261      485,   281,   281,   281,   -58,   340,   341,   253,   111,   494,
2262        8,   279,   286,   276,     9,    75,    76,   355,    10,    77,
2263      356,    78,   108,   500,   365,   342,   343,   379,   344,   345,
2264      366,   346,   347,   348,   367,   399,   621,   397,   617,   397,
2265      414,   368,   397,   630,   369,   537,   370,   371,   380,   636,
2266      381,   397,   397,   382,   384,   415,   425,   439,   416,   417,
2267      418,   444,   445,   446,   447,   448,   449,   450,   419,   429,
2268      440,   441,   442,   656,   443,   544,   458,   459,   460,   300,
2269      301,   550,   461,   467,   471,   472,   397,   397,   489,   397,
2270      397,   397,   397,   491,   483,   492,   493,   397,   497,   506,
2271      507,   566,   508,   397,   509,   511,   515,   573,   513,   397,
2272      516,   517,   525,   579,   523,   527,   524,   528,   529,   530,
2273      531,   281,   532,   533,   281,   281,   281,   535,   537,   543,
2274      538,   579,   570,   540,   547,   541,   501,   502,   503,   504,
2275      400,   401,   542,   402,   548,   552,   553,   512,   397,   554,
2276      555,   567,   568,   302,   303,   304,   305,   306,   307,   308,
2277      309,   310,   311,   312,   313,   314,   315,   575,   563,   589,
2278      479,   600,   601,   397,   397,   602,   603,   605,   412,   611,
2279      606,   632,   623,   612,   624,   618,   420,   421,   422,   423,
2280      424,   613,   625,   397,   626,   634,   645,   647,   648,   649,
2281      650,   644,   557,   558,   559,   560,   651,   562,   -18,   662,
2282      663,   564,   565,   -19,   665,   668,   674,   669,   570,   397,
2283      397,   677,   675,   224,   397,   225,   226,   397,   131,   609,
2284      631,   351,   147,   397,   385,   386,   397,   143,   360,    45,
2285      387,   130,    97,     0,     0,   594,     0,     0,   596,   597,
2286      598,   599,     0,     0,     0,     0,   388,   389,   390,   473,
2287      474,   475,   476,   477,     0,     0,     0,     0,     0,   482,
2288        0,   391,   392,     0,     0,     0,     0,     0,     0,     0,
2289        0,     0,   495,   496,     0,     0,     0,     0,     0,     0,
2290      393,     0,     0,     0,     0,     0,   627,     0,   628,   629,
2291        0,     0,     0,     0,     0,     0,   180,   181,   182,   183,
2292      184,   185,   186,   187,   188,   189,   190,   191,   192,   193,
2293      194,   257,   258,   259,   260,     0,     0,     0,     0,     0,
2294        0,     0,     0,     0,   534,     0,   536,     0,     0,   539,
2295        0,     0,     0,     0,     0,     0,     0,     0,   545,   546,
2296      261,   203,   204,   205,   206,   207,   208,   209,   210,   211,
2297      212,   213,   214,     0,   262,     0,   263,   264,   265,     0,
2298      266,   267,   289,   290,   291,   292,   293,   294,   295,   296,
2299      297,   298,     0,   576,   577,     0,   581,   582,   583,   584,
2300        0,     0,     0,     0,   588,     0,   394,     0,     0,     0,
2301      593,     0,     0,     0,    64,    65,   595,   107,    67,    68,
2302       69,    70,    71,    72,    73,     0,     1,     2,     0,     3,
2303        4,     5,     0,     0,     0,     0,     0,     0,     0,     0,
2304        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2305        0,     0,     0,     0,     0,   619,     0,    74,     0,     0,
2306        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2307        0,     0,   385,   386,     0,     0,    64,    65,   387,     0,
2308      640,   641,     0,     0,     0,     0,     0,     0,     1,     2,
2309        0,     3,     4,     5,   388,   389,   390,     0,     0,     0,
2310      653,     0,     0,     0,     0,     0,     0,     0,     0,   391,
2311      392,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2312        0,     0,     0,   339,     0,     0,   666,   667,   393,     0,
2313        0,   670,     0,     0,   673,     0,     0,     0,     0,     0,
2314      676,     0,     0,   678,   180,   181,   182,   183,   184,   185,
2315      186,   187,   188,   189,   190,   191,   192,   193,   194,   257,
2316      258,   259,   260,     0,     0,     0,     0,     0,    75,    76,
2317        0,     0,    77,     0,    78,   142,     0,     0,     0,     0,
2318        0,     0,     0,     0,     0,     0,     0,     0,   261,   203,
2319      638,   639,   206,   207,   208,   209,   210,   211,   212,   213,
2320      214,     0,   262,     0,   263,   264,   265,     0,   266,   267,
2321      342,   343,     0,   344,   345,     0,   346,   347,   348,   385,
2322      386,     0,     0,    64,    65,   387,     0,     0,     0,     0,
2323        0,     0,     0,     0,   394,     1,     2,     0,     3,     4,
2324        5,   388,   389,   390,     0,     0,     0,     0,     0,     0,
2325        0,     0,     0,     0,     0,     0,   391,   392,     0,     0,
2326        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2327        0,   111,     0,    64,    65,   393,   107,   156,   157,   158,
2328      159,   160,   161,    73,     0,     1,     2,     0,     3,     4,
2329        5,   180,   181,   182,   183,   184,   185,   186,   187,   188,
2330      189,   190,   191,   192,   193,   194,   257,   258,   259,   260,
2331        0,     0,     0,     0,    64,    65,    74,   107,   156,   157,
2332      158,   159,   160,   161,    73,     0,     1,     2,     0,     3,
2333        4,     5,     0,     0,     0,   261,   203,   204,   205,   206,
2334      207,   208,   209,   210,   211,   212,   213,   214,     0,   262,
2335        0,   263,   264,   265,     0,   266,   267,    74,     0,     0,
2336        0,     0,     0,   385,   386,     0,     0,    64,    65,   387,
2337        0,     0,   112,     0,     0,     0,     0,     0,     0,     1,
2338        2,   394,     3,     4,     5,   388,   389,   390,     0,     0,
2339        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2340      391,   392,     0,     0,     0,     0,     0,     0,     0,     0,
2341        0,     0,     0,     0,     0,     0,     0,     0,     0,   393,
2342        0,     0,     0,     0,     0,     0,     0,    75,    76,     0,
2343        0,    77,     0,    78,   377,   180,   181,   182,   183,   184,
2344      185,   186,   187,   188,   189,   190,   191,   192,   193,   194,
2345      257,   258,   259,   260,     0,     0,     0,     0,     0,     0,
2346        0,     0,     0,     0,     0,     0,     0,     0,    75,    76,
2347        0,     0,    77,     0,    78,   453,     0,     0,     0,   261,
2348      203,   204,   205,   206,   207,   208,   209,   210,   211,   212,
2349      213,   214,     0,   262,     0,   263,   264,   265,     0,   266,
2350      267,    64,    65,     0,     0,     0,     0,     0,  -212,     0,
2351        0,     0,     0,     1,     2,     0,     3,     4,     5,   254,
2352        0,     0,     0,     0,     0,   394,   -69,     1,     2,     0,
2353        3,     4,     5,     0,   255,   256,     0,     0,     6,     7,
2354        0,     0,     0,     0,     0,     0,     0,     0,     0,   111,
2355        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2356        8,     0,     0,     0,     9,     0,     0,     0,    10,   180,
2357      181,   182,   183,   184,   185,   186,   187,   188,   189,   190,
2358      191,   192,   193,   194,   257,   258,   259,   260,     0,    64,
2359       65,     0,   151,    67,    68,    69,    70,    71,    72,    73,
2360        0,     1,     2,     0,     3,     4,     5,     0,     0,     0,
2361        0,     0,     0,   261,   203,   204,   205,   206,   207,   208,
2362      209,   210,   211,   212,   213,   214,     0,   262,     0,   263,
2363      264,   265,    74,   266,   267,     0,     0,     0,     0,     0,
2364        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2365      112,     0,    64,    65,   -67,     0,   268,     0,     0,   269,
2366        0,   270,     0,   271,     1,     2,     0,     3,     4,     5,
2367      254,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2368        0,     0,     0,     0,     0,   255,   256,     0,     0,     0,
2369        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2370      111,     0,     0,     0,     0,     0,     0,   152,     0,     0,
2371        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2372      180,   181,   182,   183,   184,   185,   186,   187,   188,   189,
2373      190,   191,   192,   193,   194,   257,   258,   259,   260,     0,
2374        0,     0,     0,    75,    76,     0,     0,    77,     0,    78,
2375        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2376        0,     0,     0,     0,   261,   203,   204,   205,   206,   207,
2377      208,   209,   210,   211,   212,   213,   214,     0,   262,     0,
2378      263,   264,   265,     0,   266,   267,     0,    64,    65,     0,
2379      107,    67,    68,    69,    70,    71,    72,    73,     0,     1,
2380        2,   112,     3,     4,     5,     0,     0,   268,     0,     0,
2381      269,     0,   270,     0,   271,     0,     0,     0,     0,   350,
2382        0,     0,     0,     0,     0,     0,     0,     0,    64,    65,
2383       74,   107,   156,   157,   158,   159,   160,   161,    73,     0,
2384        1,     2,     0,     3,     4,     5,    64,    65,     0,   107,
2385       67,    68,    69,    70,    71,    72,    73,     0,     1,     2,
2386        0,     3,     4,     5,     0,     0,     0,     0,     0,     0,
2387        0,    74,     0,     0,     0,     0,     0,     0,   463,     0,
2388        0,     0,     0,     0,     0,     0,     0,    64,    65,    74,
2389      107,    67,    68,    69,    70,    71,    72,    73,     0,     1,
2390        2,     0,     3,     4,     5,    64,    65,     0,    66,    67,
2391       68,    69,    70,    71,    72,    73,     0,     1,     2,   572,
2392        3,     4,     5,     0,     0,     0,     0,     0,     0,     0,
2393       74,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2394        0,    75,    76,     0,     0,    77,     0,    78,    74,    64,
2395       65,     0,   107,   156,   157,   158,   159,   160,   161,    73,
2396        0,     1,     2,     0,     3,     4,     5,     0,     0,     0,
2397        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2398        0,     0,    75,    76,     0,   372,    77,     0,    78,     0,
2399        0,     0,    74,     0,     0,     0,     0,     0,     0,     0,
2400       75,    76,     0,     0,    77,     0,    78,    64,    65,     0,
2401      151,    67,    68,    69,    70,    71,    72,    73,     0,     1,
2402        2,     0,     3,     4,     5,     0,     0,     0,     0,     0,
2403        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2404        0,    75,    76,     0,     0,    77,     0,    78,     0,     0,
2405       74,     0,     0,     0,     0,     0,     0,     0,     0,    75,
2406       76,     0,     0,    77,     0,    78,     0,    64,    65,     0,
2407      107,    67,    68,    69,    70,    71,    72,    73,     0,     1,
2408        2,     0,     3,     4,     5,    64,    65,     0,   280,    67,
2409       68,    69,    70,    71,    72,    73,     0,     1,     2,     0,
2410        3,     4,     5,    75,    76,     0,     0,    77,     0,    78,
2411       74,     0,     0,     0,    64,    65,     0,   107,   156,   157,
2412      158,   159,   160,   161,    73,     0,     1,     2,    74,     3,
2413        4,     5,    64,    65,     0,   107,    67,    68,    69,    70,
2414       71,    72,   578,     0,     1,     2,     0,     3,     4,     5,
2415        0,     0,     0,     0,     0,     0,     0,    74,     0,     0,
2416        0,    75,    76,     0,     0,    77,     0,    78,     0,     0,
2417        0,     0,     0,    64,    65,    74,   107,    67,    68,    69,
2418       70,    71,    72,   643,     0,     1,     2,     0,     3,     4,
2419        5,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2420        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2421        0,     0,     0,     0,     0,     0,    74,     0,     0,     0,
2422        0,    75,    76,     0,     0,    77,     0,    78,     0,     0,
2423        0,     0,     0,     0,     0,     0,     0,     0,     0,    75,
2424       76,     0,     0,    77,     0,    78,     0,     0,     0,     0,
2425        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2426      171,     0,     0,     0,     0,     0,     0,     0,    75,    76,
2427        0,     0,    77,     0,   375,     0,     0,     0,     0,     0,
2428        0,   172,   173,     0,     0,     0,    75,    76,     0,     0,
2429       77,     0,    78,   174,   175,   176,   177,   178,   179,   180,
2430      181,   182,   183,   184,   185,   186,   187,   188,   189,   190,
2431      191,   192,   193,   194,   195,   196,   197,   198,     0,     0,
2432        0,     0,     0,     0,     0,     0,     0,    75,    76,     0,
2433        0,    77,     0,    78,     0,     0,     0,     0,   199,   200,
2434      201,     0,     0,   202,   203,   204,   205,   206,   207,   208,
2435      209,   210,   211,   212,   213,   214,   215,   216,   217,   218,
2436      219,   220,   221,   222,   223
2437 };
2438
2439 static const yytype_int16 yycheck[] =
2440 {
2441        0,    27,   176,   242,   201,   164,   128,   464,   421,   320,
2442        0,    28,    11,   158,    11,     4,    21,    17,    34,   216,
2443      217,   218,   219,   220,    29,   437,   438,    17,    55,   226,
2444       55,   444,   269,   270,   197,    55,   449,   198,    11,   177,
2445       42,    43,    44,    45,    46,    47,    48,    49,    11,    51,
2446       20,    59,    78,    23,    55,    34,    38,     7,     8,   636,
2447       10,    11,    12,    13,    14,    15,    16,    17,   165,    19,
2448       20,    55,    22,    23,    24,    54,   102,    18,   159,   656,
2449      106,    54,     3,     4,     5,     6,   112,   168,   158,    39,
2450      228,    54,   118,    93,   257,    53,   259,   258,   159,   260,
2451       50,   159,   128,   154,    55,    26,    27,   168,   166,   521,
2452       68,   159,   159,   164,   140,   141,   573,   164,   144,   159,
2453      168,   578,   579,    55,   150,   141,   142,   143,   168,   156,
2454      146,   156,    32,    33,   150,   151,   156,   162,   375,   166,
2455       55,   338,    55,   158,   164,    55,   243,   244,   174,   562,
2456      167,   153,   154,   155,     0,   156,   157,   394,   162,   141,
2457      142,   143,   158,   168,   146,   164,   288,   164,   150,   151,
2458      117,   118,   156,   199,   200,   201,   202,   167,   167,    22,
2459      593,   159,   158,   640,   641,   496,   643,   644,   166,   215,
2460      216,   217,   218,   219,   220,   221,   222,   223,   224,   225,
2461      226,    46,   399,    48,    21,   156,   157,   121,   234,   666,
2462      667,   161,   162,    22,   336,   165,    22,   167,   415,   245,
2463      417,   418,   419,   534,   156,   536,    22,   159,   160,   156,
2464      281,    11,    54,   284,   285,   149,   287,    17,    35,     4,
2465       37,   156,     4,   156,   159,   160,   156,   160,   159,    37,
2466      160,     7,     8,   164,    10,    11,    12,    13,    14,    15,
2467       16,    17,   288,    19,    20,   163,    22,    23,    24,    19,
2468      163,   322,    22,   299,    24,     3,     4,     5,     6,   330,
2469      331,   332,   333,   334,   595,   524,   153,   154,   155,   160,
2470      316,   317,   318,    19,    50,   454,    22,   156,    24,   121,
2471      122,     7,     8,    42,   157,    44,   159,     4,    41,    42,
2472      336,   337,   338,    19,    20,    48,    22,    23,    24,   141,
2473      142,    54,   144,   145,    22,   147,   148,   149,    54,   141,
2474      142,   143,   159,   157,   146,   159,   114,   115,   150,   151,
2475      537,    84,    85,   540,   541,   542,   157,   166,     0,   375,
2476        4,   156,   403,   404,   405,   406,   407,   157,   384,    42,
2477       43,    44,   413,   157,    47,   159,    18,    19,    20,     9,
2478       22,    23,    24,   399,     9,   426,   427,   616,    30,    31,
2479        9,     9,   621,    62,    63,    64,    65,    66,    67,   415,
2480      416,   417,   418,   419,     9,   121,   122,     9,    55,   425,
2481       52,    57,    11,   454,    56,   161,   162,   166,    60,   165,
2482      157,   167,   168,   439,   156,   141,   142,    22,   144,   145,
2483      156,   147,   148,   149,   156,   159,   157,   478,   159,   480,
2484      159,   156,   483,   157,   156,   159,   156,   156,   156,   613,
2485      156,   492,   493,   156,   156,   159,    38,    38,   159,   159,
2486      159,   365,   366,   367,   368,   369,   370,   371,   159,     4,
2487      156,   156,   156,   637,   156,   491,   380,   381,   382,    26,
2488       27,   497,   159,    61,   159,   159,   527,   528,   159,   530,
2489      531,   532,   533,   159,   162,   159,   159,   538,   159,   159,
2490      159,   517,   159,   544,   159,   159,   159,   523,   166,   550,
2491      159,    38,    22,   529,   159,    17,   157,    17,   156,   159,
2492      159,   537,   159,   159,   540,   541,   542,     4,   159,     4,
2493      159,   547,   522,   159,   156,   159,   440,   441,   442,   443,
2494      284,   285,   159,   287,   159,   159,   159,   451,   589,   159,
2495      159,    22,     4,   100,   101,   102,   103,   104,   105,   106,
2496      107,   108,   109,   110,   111,   112,   113,   159,   166,   159,
2497       54,   159,   157,   614,   615,   159,   159,   157,   322,    22,
2498      157,    54,   157,   159,   157,   164,   330,   331,   332,   333,
2499      334,   162,   157,   634,   157,    17,   164,   157,   157,   157,
2500        4,   617,   506,   507,   508,   509,   152,   511,   156,    22,
2501      159,   515,   516,   156,    17,    17,    17,   159,   608,   660,
2502      661,    17,    73,   131,   665,   131,   131,   668,    93,   574,
2503      608,   234,   112,   674,     3,     4,   677,   106,   245,    17,
2504        9,    90,    57,    -1,    -1,   547,    -1,    -1,   552,   553,
2505      554,   555,    -1,    -1,    -1,    -1,    25,    26,    27,   403,
2506      404,   405,   406,   407,    -1,    -1,    -1,    -1,    -1,   413,
2507       -1,    40,    41,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2508       -1,    -1,   426,   427,    -1,    -1,    -1,    -1,    -1,    -1,
2509       59,    -1,    -1,    -1,    -1,    -1,   600,    -1,   602,   603,
2510       -1,    -1,    -1,    -1,    -1,    -1,    75,    76,    77,    78,
2511       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
2512       89,    90,    91,    92,    93,    -1,    -1,    -1,    -1,    -1,
2513       -1,    -1,    -1,    -1,   478,    -1,   480,    -1,    -1,   483,
2514       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   492,   493,
2515      119,   120,   121,   122,   123,   124,   125,   126,   127,   128,
2516      129,   130,   131,    -1,   133,    -1,   135,   136,   137,    -1,
2517      139,   140,    94,    95,    96,    97,    98,    99,   100,   101,
2518      102,   103,    -1,   527,   528,    -1,   530,   531,   532,   533,
2519       -1,    -1,    -1,    -1,   538,    -1,   165,    -1,    -1,    -1,
2520      544,    -1,    -1,    -1,     7,     8,   550,    10,    11,    12,
2521       13,    14,    15,    16,    17,    -1,    19,    20,    -1,    22,
2522       23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2523       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2524       -1,    -1,    -1,    -1,    -1,   589,    -1,    50,    -1,    -1,
2525       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2526       -1,    -1,     3,     4,    -1,    -1,     7,     8,     9,    -1,
2527      614,   615,    -1,    -1,    -1,    -1,    -1,    -1,    19,    20,
2528       -1,    22,    23,    24,    25,    26,    27,    -1,    -1,    -1,
2529      634,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    40,
2530       41,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2531       -1,    -1,    -1,    54,    -1,    -1,   660,   661,    59,    -1,
2532       -1,   665,    -1,    -1,   668,    -1,    -1,    -1,    -1,    -1,
2533      674,    -1,    -1,   677,    75,    76,    77,    78,    79,    80,
2534       81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
2535       91,    92,    93,    -1,    -1,    -1,    -1,    -1,   161,   162,
2536       -1,    -1,   165,    -1,   167,   168,    -1,    -1,    -1,    -1,
2537       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   119,   120,
2538      121,   122,   123,   124,   125,   126,   127,   128,   129,   130,
2539      131,    -1,   133,    -1,   135,   136,   137,    -1,   139,   140,
2540      141,   142,    -1,   144,   145,    -1,   147,   148,   149,     3,
2541        4,    -1,    -1,     7,     8,     9,    -1,    -1,    -1,    -1,
2542       -1,    -1,    -1,    -1,   165,    19,    20,    -1,    22,    23,
2543       24,    25,    26,    27,    -1,    -1,    -1,    -1,    -1,    -1,
2544       -1,    -1,    -1,    -1,    -1,    -1,    40,    41,    -1,    -1,
2545       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2546       -1,    55,    -1,     7,     8,    59,    10,    11,    12,    13,
2547       14,    15,    16,    17,    -1,    19,    20,    -1,    22,    23,
2548       24,    75,    76,    77,    78,    79,    80,    81,    82,    83,
2549       84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
2550       -1,    -1,    -1,    -1,     7,     8,    50,    10,    11,    12,
2551       13,    14,    15,    16,    17,    -1,    19,    20,    -1,    22,
2552       23,    24,    -1,    -1,    -1,   119,   120,   121,   122,   123,
2553      124,   125,   126,   127,   128,   129,   130,   131,    -1,   133,
2554       -1,   135,   136,   137,    -1,   139,   140,    50,    -1,    -1,
2555       -1,    -1,    -1,     3,     4,    -1,    -1,     7,     8,     9,
2556       -1,    -1,   156,    -1,    -1,    -1,    -1,    -1,    -1,    19,
2557       20,   165,    22,    23,    24,    25,    26,    27,    -1,    -1,
2558       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2559       40,    41,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2560       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    59,
2561       -1,    -1,    -1,    -1,    -1,    -1,    -1,   161,   162,    -1,
2562       -1,   165,    -1,   167,   168,    75,    76,    77,    78,    79,
2563       80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
2564       90,    91,    92,    93,    -1,    -1,    -1,    -1,    -1,    -1,
2565       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   161,   162,
2566       -1,    -1,   165,    -1,   167,   168,    -1,    -1,    -1,   119,
2567      120,   121,   122,   123,   124,   125,   126,   127,   128,   129,
2568      130,   131,    -1,   133,    -1,   135,   136,   137,    -1,   139,
2569      140,     7,     8,    -1,    -1,    -1,    -1,    -1,     0,    -1,
2570       -1,    -1,    -1,    19,    20,    -1,    22,    23,    24,    25,
2571       -1,    -1,    -1,    -1,    -1,   165,    18,    19,    20,    -1,
2572       22,    23,    24,    -1,    40,    41,    -1,    -1,    30,    31,
2573       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    55,
2574       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2575       52,    -1,    -1,    -1,    56,    -1,    -1,    -1,    60,    75,
2576       76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
2577       86,    87,    88,    89,    90,    91,    92,    93,    -1,     7,
2578        8,    -1,    10,    11,    12,    13,    14,    15,    16,    17,
2579       -1,    19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,
2580       -1,    -1,    -1,   119,   120,   121,   122,   123,   124,   125,
2581      126,   127,   128,   129,   130,   131,    -1,   133,    -1,   135,
2582      136,   137,    50,   139,   140,    -1,    -1,    -1,    -1,    -1,
2583       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2584      156,    -1,     7,     8,   160,    -1,   162,    -1,    -1,   165,
2585       -1,   167,    -1,   169,    19,    20,    -1,    22,    23,    24,
2586       25,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2587       -1,    -1,    -1,    -1,    -1,    40,    41,    -1,    -1,    -1,
2588       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2589       55,    -1,    -1,    -1,    -1,    -1,    -1,   125,    -1,    -1,
2590       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2591       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
2592       85,    86,    87,    88,    89,    90,    91,    92,    93,    -1,
2593       -1,    -1,    -1,   161,   162,    -1,    -1,   165,    -1,   167,
2594       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2595       -1,    -1,    -1,    -1,   119,   120,   121,   122,   123,   124,
2596      125,   126,   127,   128,   129,   130,   131,    -1,   133,    -1,
2597      135,   136,   137,    -1,   139,   140,    -1,     7,     8,    -1,
2598       10,    11,    12,    13,    14,    15,    16,    17,    -1,    19,
2599       20,   156,    22,    23,    24,    -1,    -1,   162,    -1,    -1,
2600      165,    -1,   167,    -1,   169,    -1,    -1,    -1,    -1,    39,
2601       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     7,     8,
2602       50,    10,    11,    12,    13,    14,    15,    16,    17,    -1,
2603       19,    20,    -1,    22,    23,    24,     7,     8,    -1,    10,
2604       11,    12,    13,    14,    15,    16,    17,    -1,    19,    20,
2605       -1,    22,    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,
2606       -1,    50,    -1,    -1,    -1,    -1,    -1,    -1,    39,    -1,
2607       -1,    -1,    -1,    -1,    -1,    -1,    -1,     7,     8,    50,
2608       10,    11,    12,    13,    14,    15,    16,    17,    -1,    19,
2609       20,    -1,    22,    23,    24,     7,     8,    -1,    10,    11,
2610       12,    13,    14,    15,    16,    17,    -1,    19,    20,    39,
2611       22,    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2612       50,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2613       -1,   161,   162,    -1,    -1,   165,    -1,   167,    50,     7,
2614        8,    -1,    10,    11,    12,    13,    14,    15,    16,    17,
2615       -1,    19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,
2616       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2617       -1,    -1,   161,   162,    -1,   164,   165,    -1,   167,    -1,
2618       -1,    -1,    50,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2619      161,   162,    -1,    -1,   165,    -1,   167,     7,     8,    -1,
2620       10,    11,    12,    13,    14,    15,    16,    17,    -1,    19,
2621       20,    -1,    22,    23,    24,    -1,    -1,    -1,    -1,    -1,
2622       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2623       -1,   161,   162,    -1,    -1,   165,    -1,   167,    -1,    -1,
2624       50,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   161,
2625      162,    -1,    -1,   165,    -1,   167,    -1,     7,     8,    -1,
2626       10,    11,    12,    13,    14,    15,    16,    17,    -1,    19,
2627       20,    -1,    22,    23,    24,     7,     8,    -1,    10,    11,
2628       12,    13,    14,    15,    16,    17,    -1,    19,    20,    -1,
2629       22,    23,    24,   161,   162,    -1,    -1,   165,    -1,   167,
2630       50,    -1,    -1,    -1,     7,     8,    -1,    10,    11,    12,
2631       13,    14,    15,    16,    17,    -1,    19,    20,    50,    22,
2632       23,    24,     7,     8,    -1,    10,    11,    12,    13,    14,
2633       15,    16,    17,    -1,    19,    20,    -1,    22,    23,    24,
2634       -1,    -1,    -1,    -1,    -1,    -1,    -1,    50,    -1,    -1,
2635       -1,   161,   162,    -1,    -1,   165,    -1,   167,    -1,    -1,
2636       -1,    -1,    -1,     7,     8,    50,    10,    11,    12,    13,
2637       14,    15,    16,    17,    -1,    19,    20,    -1,    22,    23,
2638       24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2639       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2640       -1,    -1,    -1,    -1,    -1,    -1,    50,    -1,    -1,    -1,
2641       -1,   161,   162,    -1,    -1,   165,    -1,   167,    -1,    -1,
2642       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   161,
2643      162,    -1,    -1,   165,    -1,   167,    -1,    -1,    -1,    -1,
2644       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2645       36,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   161,   162,
2646       -1,    -1,   165,    -1,   167,    -1,    -1,    -1,    -1,    -1,
2647       -1,    57,    58,    -1,    -1,    -1,   161,   162,    -1,    -1,
2648      165,    -1,   167,    69,    70,    71,    72,    73,    74,    75,
2649       76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
2650       86,    87,    88,    89,    90,    91,    92,    93,    -1,    -1,
2651       -1,    -1,    -1,    -1,    -1,    -1,    -1,   161,   162,    -1,
2652       -1,   165,    -1,   167,    -1,    -1,    -1,    -1,   114,   115,
2653      116,    -1,    -1,   119,   120,   121,   122,   123,   124,   125,
2654      126,   127,   128,   129,   130,   131,   132,   133,   134,   135,
2655      136,   137,   138,   139,   140
2656 };
2657
2658 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2659    symbol of state STATE-NUM.  */
2660 static const yytype_uint8 yystos[] =
2661 {
2662        0,    19,    20,    22,    23,    24,    30,    31,    52,    56,
2663       60,   178,   181,   182,   183,   184,   216,   217,   218,   220,
2664      219,    53,    68,   225,   158,    59,   158,    18,   158,    42,
2665       43,    44,    45,    46,    47,    48,    49,    51,   153,   154,
2666      155,   185,   186,   187,     0,   218,    46,    48,   188,   235,
2667       42,    43,    44,    47,   189,   232,   234,   242,   158,   158,
2668      162,   226,    22,   224,     7,     8,    10,    11,    12,    13,
2669       14,    15,    16,    17,    50,   161,   162,   165,   167,   178,
2670      182,   203,   204,   238,   187,   187,    35,    37,   214,   187,
2671      187,    21,   243,   244,    29,   168,   233,   243,    22,    22,
2672       22,   227,   156,     4,     4,     4,   167,    10,   168,   204,
2673      209,    55,   156,   180,   214,   214,    42,    44,   190,    32,
2674       33,   213,    62,    63,    64,    65,    66,    67,   191,   230,
2675      230,   181,   247,   159,   164,    39,   204,   205,   207,   208,
2676      163,   163,   168,   209,   159,   168,   156,   208,   160,   213,
2677      213,    10,   125,   204,   206,   215,    11,    12,    13,    14,
2678       15,    16,   176,   177,   204,   210,     4,   206,    28,   167,
2679      231,    36,    57,    58,    69,    70,    71,    72,    73,    74,
2680       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
2681       85,    86,    87,    88,    89,    90,    91,    92,    93,   114,
2682      115,   116,   119,   120,   121,   122,   123,   124,   125,   126,
2683      127,   128,   129,   130,   131,   132,   133,   134,   135,   136,
2684      137,   138,   139,   140,   171,   172,   173,   245,   251,   252,
2685      253,   254,    22,   193,   159,   157,   204,   204,   166,   168,
2686      204,     4,   157,   210,   204,   156,   238,    26,    27,     3,
2687        4,     5,     6,     9,    25,    40,    41,    90,    91,    92,
2688       93,   119,   133,   135,   136,   137,   139,   140,   162,   165,
2689      167,   169,   171,   172,   173,   211,   238,   180,   182,    57,
2690       10,   204,   240,   241,    11,    17,    11,   176,   191,    94,
2691       95,    96,    97,    98,    99,   100,   101,   102,   103,   174,
2692       26,    27,   100,   101,   102,   103,   104,   105,   106,   107,
2693      108,   109,   110,   111,   112,   113,   175,   174,   175,   204,
2694      204,   240,   204,   204,   248,   240,   240,   240,   240,   240,
2695      204,   204,   204,   204,   204,   240,   191,   117,   118,    54,
2696      121,   122,   141,   142,   144,   145,   147,   148,   149,   192,
2697       39,   205,   195,   164,   166,   166,   157,   195,   180,   180,
2698      215,   174,   175,   174,   175,   156,   156,   156,   156,   156,
2699      156,   156,   164,   210,   212,   167,   212,   168,   212,    22,
2700      156,   156,   156,   221,   156,     3,     4,     9,    25,    26,
2701       27,    40,    41,    59,   165,   211,   237,   238,   239,   159,
2702      239,   239,   239,   206,   204,   204,   204,   204,   159,   198,
2703      159,   198,   239,   162,   159,   159,   159,   159,   159,   159,
2704      239,   239,   239,   239,   239,    38,   206,   204,   240,     4,
2705      141,   142,   143,   146,   150,   151,   194,   222,   223,    38,
2706      156,   156,   156,   156,   210,   210,   210,   210,   210,   210,
2707      210,   159,   164,   168,   204,   212,   166,   168,   210,   210,
2708      210,   159,   201,    39,   204,   228,   229,    61,   236,   212,
2709      240,   159,   159,   239,   239,   239,   239,   239,    11,    54,
2710       11,   250,   239,   162,   240,   204,   240,   240,   240,   159,
2711      250,   159,   159,   159,   204,   239,   239,   159,   201,   201,
2712      204,   210,   210,   210,   210,   250,   159,   159,   159,   159,
2713      250,   159,   210,   166,   168,   159,   159,    38,    34,    54,
2714      199,   202,   193,   159,   157,    22,   166,    17,    17,   156,
2715      159,   159,   159,   159,   239,     4,   239,   159,   159,   239,
2716      159,   159,   159,     4,   204,   239,   239,   156,   159,   198,
2717      204,   157,   159,   159,   159,   159,   157,   210,   210,   210,
2718      210,   157,   210,   166,   210,   210,   204,    22,     4,   201,
2719      178,   179,    39,   204,   195,   159,   239,   239,    17,   204,
2720      249,   239,   239,   239,   239,   198,   198,   240,   239,   159,
2721      240,   240,   240,   239,   249,   239,   210,   210,   210,   210,
2722      159,   157,   159,   159,   250,   157,   157,   157,   193,   199,
2723      200,    22,   159,   162,   193,   193,   157,   159,   164,   239,
2724      250,   157,   198,   157,   157,   157,   157,   210,   210,   210,
2725      157,   179,    54,   197,    17,   164,   176,   246,   121,   122,
2726      239,   239,   195,    17,   204,   164,   195,   157,   157,   157,
2727        4,   152,   196,   239,   237,   164,   176,   193,   193,    38,
2728      193,   193,    22,   159,   237,    17,   239,   239,    17,   159,
2729      239,   193,   193,   239,    17,    73,   239,    17,   239
2730 };
2731
2732 #define yyerrok         (yyerrstatus = 0)
2733 #define yyclearin       (yychar = YYEMPTY)
2734 #define YYEMPTY         (-2)
2735 #define YYEOF           0
2736
2737 #define YYACCEPT        goto yyacceptlab
2738 #define YYABORT         goto yyabortlab
2739 #define YYERROR         goto yyerrorlab
2740
2741
2742 /* Like YYERROR except do call yyerror.  This remains here temporarily
2743    to ease the transition to the new meaning of YYERROR, for GCC.
2744    Once GCC version 2 has supplanted version 1, this can go.  */
2745
2746 #define YYFAIL          goto yyerrlab
2747
2748 #define YYRECOVERING()  (!!yyerrstatus)
2749
2750 #define YYBACKUP(Token, Value)                                  \
2751 do                                                              \
2752   if (yychar == YYEMPTY && yylen == 1)                          \
2753     {                                                           \
2754       yychar = (Token);                                         \
2755       yylval = (Value);                                         \
2756       yytoken = YYTRANSLATE (yychar);                           \
2757       YYPOPSTACK (1);                                           \
2758       goto yybackup;                                            \
2759     }                                                           \
2760   else                                                          \
2761     {                                                           \
2762       yyerror (YY_("syntax error: cannot back up")); \
2763       YYERROR;                                                  \
2764     }                                                           \
2765 while (YYID (0))
2766
2767
2768 #define YYTERROR        1
2769 #define YYERRCODE       256
2770
2771
2772 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2773    If N is 0, then set CURRENT to the empty location which ends
2774    the previous symbol: RHS[0] (always defined).  */
2775
2776 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2777 #ifndef YYLLOC_DEFAULT
2778 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
2779     do                                                                  \
2780       if (YYID (N))                                                    \
2781         {                                                               \
2782           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
2783           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
2784           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
2785           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
2786         }                                                               \
2787       else                                                              \
2788         {                                                               \
2789           (Current).first_line   = (Current).last_line   =              \
2790             YYRHSLOC (Rhs, 0).last_line;                                \
2791           (Current).first_column = (Current).last_column =              \
2792             YYRHSLOC (Rhs, 0).last_column;                              \
2793         }                                                               \
2794     while (YYID (0))
2795 #endif
2796
2797
2798 /* YY_LOCATION_PRINT -- Print the location on the stream.
2799    This macro was not mandated originally: define only if we know
2800    we won't break user code: when these are the locations we know.  */
2801
2802 #ifndef YY_LOCATION_PRINT
2803 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2804 #  define YY_LOCATION_PRINT(File, Loc)                  \
2805      fprintf (File, "%d.%d-%d.%d",                      \
2806               (Loc).first_line, (Loc).first_column,     \
2807               (Loc).last_line,  (Loc).last_column)
2808 # else
2809 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2810 # endif
2811 #endif
2812
2813
2814 /* YYLEX -- calling `yylex' with the right arguments.  */
2815
2816 #ifdef YYLEX_PARAM
2817 # define YYLEX yylex (YYLEX_PARAM)
2818 #else
2819 # define YYLEX yylex ()
2820 #endif
2821
2822 /* Enable debugging if requested.  */
2823 #if YYDEBUG
2824
2825 # ifndef YYFPRINTF
2826 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2827 #  define YYFPRINTF fprintf
2828 # endif
2829
2830 # define YYDPRINTF(Args)                        \
2831 do {                                            \
2832   if (yydebug)                                  \
2833     YYFPRINTF Args;                             \
2834 } while (YYID (0))
2835
2836 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
2837 do {                                                                      \
2838   if (yydebug)                                                            \
2839     {                                                                     \
2840       YYFPRINTF (stderr, "%s ", Title);                                   \
2841       yy_symbol_print (stderr,                                            \
2842                   Type, Value); \
2843       YYFPRINTF (stderr, "\n");                                           \
2844     }                                                                     \
2845 } while (YYID (0))
2846
2847
2848 /*--------------------------------.
2849 | Print this symbol on YYOUTPUT.  |
2850 `--------------------------------*/
2851
2852 /*ARGSUSED*/
2853 #if (defined __STDC__ || defined __C99__FUNC__ \
2854      || defined __cplusplus || defined _MSC_VER)
2855 static void
2856 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2857 #else
2858 static void
2859 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2860     FILE *yyoutput;
2861     int yytype;
2862     YYSTYPE const * const yyvaluep;
2863 #endif
2864 {
2865   if (!yyvaluep)
2866     return;
2867 # ifdef YYPRINT
2868   if (yytype < YYNTOKENS)
2869     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2870 # else
2871   YYUSE (yyoutput);
2872 # endif
2873   switch (yytype)
2874     {
2875       default:
2876         break;
2877     }
2878 }
2879
2880
2881 /*--------------------------------.
2882 | Print this symbol on YYOUTPUT.  |
2883 `--------------------------------*/
2884
2885 #if (defined __STDC__ || defined __C99__FUNC__ \
2886      || defined __cplusplus || defined _MSC_VER)
2887 static void
2888 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2889 #else
2890 static void
2891 yy_symbol_print (yyoutput, yytype, yyvaluep)
2892     FILE *yyoutput;
2893     int yytype;
2894     YYSTYPE const * const yyvaluep;
2895 #endif
2896 {
2897   if (yytype < YYNTOKENS)
2898     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2899   else
2900     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2901
2902   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2903   YYFPRINTF (yyoutput, ")");
2904 }
2905
2906 /*------------------------------------------------------------------.
2907 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2908 | TOP (included).                                                   |
2909 `------------------------------------------------------------------*/
2910
2911 #if (defined __STDC__ || defined __C99__FUNC__ \
2912      || defined __cplusplus || defined _MSC_VER)
2913 static void
2914 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2915 #else
2916 static void
2917 yy_stack_print (bottom, top)
2918     yytype_int16 *bottom;
2919     yytype_int16 *top;
2920 #endif
2921 {
2922   YYFPRINTF (stderr, "Stack now");
2923   for (; bottom <= top; ++bottom)
2924     YYFPRINTF (stderr, " %d", *bottom);
2925   YYFPRINTF (stderr, "\n");
2926 }
2927
2928 # define YY_STACK_PRINT(Bottom, Top)                            \
2929 do {                                                            \
2930   if (yydebug)                                                  \
2931     yy_stack_print ((Bottom), (Top));                           \
2932 } while (YYID (0))
2933
2934
2935 /*------------------------------------------------.
2936 | Report that the YYRULE is going to be reduced.  |
2937 `------------------------------------------------*/
2938
2939 #if (defined __STDC__ || defined __C99__FUNC__ \
2940      || defined __cplusplus || defined _MSC_VER)
2941 static void
2942 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2943 #else
2944 static void
2945 yy_reduce_print (yyvsp, yyrule)
2946     YYSTYPE *yyvsp;
2947     int yyrule;
2948 #endif
2949 {
2950   int yynrhs = yyr2[yyrule];
2951   int yyi;
2952   unsigned long int yylno = yyrline[yyrule];
2953   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2954              yyrule - 1, yylno);
2955   /* The symbols being reduced.  */
2956   for (yyi = 0; yyi < yynrhs; yyi++)
2957     {
2958       fprintf (stderr, "   $%d = ", yyi + 1);
2959       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2960                        &(yyvsp[(yyi + 1) - (yynrhs)])
2961                                        );
2962       fprintf (stderr, "\n");
2963     }
2964 }
2965
2966 # define YY_REDUCE_PRINT(Rule)          \
2967 do {                                    \
2968   if (yydebug)                          \
2969     yy_reduce_print (yyvsp, Rule); \
2970 } while (YYID (0))
2971
2972 /* Nonzero means print parse trace.  It is left uninitialized so that
2973    multiple parsers can coexist.  */
2974 int yydebug;
2975 #else /* !YYDEBUG */
2976 # define YYDPRINTF(Args)
2977 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2978 # define YY_STACK_PRINT(Bottom, Top)
2979 # define YY_REDUCE_PRINT(Rule)
2980 #endif /* !YYDEBUG */
2981
2982
2983 /* YYINITDEPTH -- initial size of the parser's stacks.  */
2984 #ifndef YYINITDEPTH
2985 # define YYINITDEPTH 200
2986 #endif
2987
2988 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2989    if the built-in stack extension method is used).
2990
2991    Do not make this value too large; the results are undefined if
2992    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2993    evaluated with infinite-precision integer arithmetic.  */
2994
2995 #ifndef YYMAXDEPTH
2996 # define YYMAXDEPTH 10000
2997 #endif
2998
2999 \f
3000
3001 #if YYERROR_VERBOSE
3002
3003 # ifndef yystrlen
3004 #  if defined __GLIBC__ && defined _STRING_H
3005 #   define yystrlen strlen
3006 #  else
3007 /* Return the length of YYSTR.  */
3008 #if (defined __STDC__ || defined __C99__FUNC__ \
3009      || defined __cplusplus || defined _MSC_VER)
3010 static YYSIZE_T
3011 yystrlen (const char *yystr)
3012 #else
3013 static YYSIZE_T
3014 yystrlen (yystr)
3015     const char *yystr;
3016 #endif
3017 {
3018   YYSIZE_T yylen;
3019   for (yylen = 0; yystr[yylen]; yylen++)
3020     continue;
3021   return yylen;
3022 }
3023 #  endif
3024 # endif
3025
3026 # ifndef yystpcpy
3027 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3028 #   define yystpcpy stpcpy
3029 #  else
3030 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3031    YYDEST.  */
3032 #if (defined __STDC__ || defined __C99__FUNC__ \
3033      || defined __cplusplus || defined _MSC_VER)
3034 static char *
3035 yystpcpy (char *yydest, const char *yysrc)
3036 #else
3037 static char *
3038 yystpcpy (yydest, yysrc)
3039     char *yydest;
3040     const char *yysrc;
3041 #endif
3042 {
3043   char *yyd = yydest;
3044   const char *yys = yysrc;
3045
3046   while ((*yyd++ = *yys++) != '\0')
3047     continue;
3048
3049   return yyd - 1;
3050 }
3051 #  endif
3052 # endif
3053
3054 # ifndef yytnamerr
3055 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3056    quotes and backslashes, so that it's suitable for yyerror.  The
3057    heuristic is that double-quoting is unnecessary unless the string
3058    contains an apostrophe, a comma, or backslash (other than
3059    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
3060    null, do not copy; instead, return the length of what the result
3061    would have been.  */
3062 static YYSIZE_T
3063 yytnamerr (char *yyres, const char *yystr)
3064 {
3065   if (*yystr == '"')
3066     {
3067       YYSIZE_T yyn = 0;
3068       char const *yyp = yystr;
3069
3070       for (;;)
3071         switch (*++yyp)
3072           {
3073           case '\'':
3074           case ',':
3075             goto do_not_strip_quotes;
3076
3077           case '\\':
3078             if (*++yyp != '\\')
3079               goto do_not_strip_quotes;
3080             /* Fall through.  */
3081           default:
3082             if (yyres)
3083               yyres[yyn] = *yyp;
3084             yyn++;
3085             break;
3086
3087           case '"':
3088             if (yyres)
3089               yyres[yyn] = '\0';
3090             return yyn;
3091           }
3092     do_not_strip_quotes: ;
3093     }
3094
3095   if (! yyres)
3096     return yystrlen (yystr);
3097
3098   return yystpcpy (yyres, yystr) - yyres;
3099 }
3100 # endif
3101
3102 /* Copy into YYRESULT an error message about the unexpected token
3103    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
3104    including the terminating null byte.  If YYRESULT is null, do not
3105    copy anything; just return the number of bytes that would be
3106    copied.  As a special case, return 0 if an ordinary "syntax error"
3107    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
3108    size calculation.  */
3109 static YYSIZE_T
3110 yysyntax_error (char *yyresult, int yystate, int yychar)
3111 {
3112   int yyn = yypact[yystate];
3113
3114   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3115     return 0;
3116   else
3117     {
3118       int yytype = YYTRANSLATE (yychar);
3119       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3120       YYSIZE_T yysize = yysize0;
3121       YYSIZE_T yysize1;
3122       int yysize_overflow = 0;
3123       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3124       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3125       int yyx;
3126
3127 # if 0
3128       /* This is so xgettext sees the translatable formats that are
3129          constructed on the fly.  */
3130       YY_("syntax error, unexpected %s");
3131       YY_("syntax error, unexpected %s, expecting %s");
3132       YY_("syntax error, unexpected %s, expecting %s or %s");
3133       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3134       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3135 # endif
3136       char *yyfmt;
3137       char const *yyf;
3138       static char const yyunexpected[] = "syntax error, unexpected %s";
3139       static char const yyexpecting[] = ", expecting %s";
3140       static char const yyor[] = " or %s";
3141       char yyformat[sizeof yyunexpected
3142                     + sizeof yyexpecting - 1
3143                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3144                        * (sizeof yyor - 1))];
3145       char const *yyprefix = yyexpecting;
3146
3147       /* Start YYX at -YYN if negative to avoid negative indexes in
3148          YYCHECK.  */
3149       int yyxbegin = yyn < 0 ? -yyn : 0;
3150
3151       /* Stay within bounds of both yycheck and yytname.  */
3152       int yychecklim = YYLAST - yyn + 1;
3153       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3154       int yycount = 1;
3155
3156       yyarg[0] = yytname[yytype];
3157       yyfmt = yystpcpy (yyformat, yyunexpected);
3158
3159       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3160         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3161           {
3162             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3163               {
3164                 yycount = 1;
3165                 yysize = yysize0;
3166                 yyformat[sizeof yyunexpected - 1] = '\0';
3167                 break;
3168               }
3169             yyarg[yycount++] = yytname[yyx];
3170             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3171             yysize_overflow |= (yysize1 < yysize);
3172             yysize = yysize1;
3173             yyfmt = yystpcpy (yyfmt, yyprefix);
3174             yyprefix = yyor;
3175           }
3176
3177       yyf = YY_(yyformat);
3178       yysize1 = yysize + yystrlen (yyf);
3179       yysize_overflow |= (yysize1 < yysize);
3180       yysize = yysize1;
3181
3182       if (yysize_overflow)
3183         return YYSIZE_MAXIMUM;
3184
3185       if (yyresult)
3186         {
3187           /* Avoid sprintf, as that infringes on the user's name space.
3188              Don't have undefined behavior even if the translation
3189              produced a string with the wrong number of "%s"s.  */
3190           char *yyp = yyresult;
3191           int yyi = 0;
3192           while ((*yyp = *yyf) != '\0')
3193             {
3194               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3195                 {
3196                   yyp += yytnamerr (yyp, yyarg[yyi++]);
3197                   yyf += 2;
3198                 }
3199               else
3200                 {
3201                   yyp++;
3202                   yyf++;
3203                 }
3204             }
3205         }
3206       return yysize;
3207     }
3208 }
3209 #endif /* YYERROR_VERBOSE */
3210 \f
3211
3212 /*-----------------------------------------------.
3213 | Release the memory associated to this symbol.  |
3214 `-----------------------------------------------*/
3215
3216 /*ARGSUSED*/
3217 #if (defined __STDC__ || defined __C99__FUNC__ \
3218      || defined __cplusplus || defined _MSC_VER)
3219 static void
3220 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3221 #else
3222 static void
3223 yydestruct (yymsg, yytype, yyvaluep)
3224     const char *yymsg;
3225     int yytype;
3226     YYSTYPE *yyvaluep;
3227 #endif
3228 {
3229   YYUSE (yyvaluep);
3230
3231   if (!yymsg)
3232     yymsg = "Deleting";
3233   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3234
3235   switch (yytype)
3236     {
3237
3238       default:
3239         break;
3240     }
3241 }
3242 \f
3243
3244 /* Prevent warnings from -Wmissing-prototypes.  */
3245
3246 #ifdef YYPARSE_PARAM
3247 #if defined __STDC__ || defined __cplusplus
3248 int yyparse (void *YYPARSE_PARAM);
3249 #else
3250 int yyparse ();
3251 #endif
3252 #else /* ! YYPARSE_PARAM */
3253 #if defined __STDC__ || defined __cplusplus
3254 int yyparse (void);
3255 #else
3256 int yyparse ();
3257 #endif
3258 #endif /* ! YYPARSE_PARAM */
3259
3260
3261
3262 /* The look-ahead symbol.  */
3263 int yychar;
3264
3265 /* The semantic value of the look-ahead symbol.  */
3266 YYSTYPE yylval;
3267
3268 /* Number of syntax errors so far.  */
3269 int yynerrs;
3270
3271
3272
3273 /*----------.
3274 | yyparse.  |
3275 `----------*/
3276
3277 #ifdef YYPARSE_PARAM
3278 #if (defined __STDC__ || defined __C99__FUNC__ \
3279      || defined __cplusplus || defined _MSC_VER)
3280 int
3281 yyparse (void *YYPARSE_PARAM)
3282 #else
3283 int
3284 yyparse (YYPARSE_PARAM)
3285     void *YYPARSE_PARAM;
3286 #endif
3287 #else /* ! YYPARSE_PARAM */
3288 #if (defined __STDC__ || defined __C99__FUNC__ \
3289      || defined __cplusplus || defined _MSC_VER)
3290 int
3291 yyparse (void)
3292 #else
3293 int
3294 yyparse ()
3295
3296 #endif
3297 #endif
3298 {
3299   
3300   int yystate;
3301   int yyn;
3302   int yyresult;
3303   /* Number of tokens to shift before error messages enabled.  */
3304   int yyerrstatus;
3305   /* Look-ahead token as an internal (translated) token number.  */
3306   int yytoken = 0;
3307 #if YYERROR_VERBOSE
3308   /* Buffer for error messages, and its allocated size.  */
3309   char yymsgbuf[128];
3310   char *yymsg = yymsgbuf;
3311   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3312 #endif
3313
3314   /* Three stacks and their tools:
3315      `yyss': related to states,
3316      `yyvs': related to semantic values,
3317      `yyls': related to locations.
3318
3319      Refer to the stacks thru separate pointers, to allow yyoverflow
3320      to reallocate them elsewhere.  */
3321
3322   /* The state stack.  */
3323   yytype_int16 yyssa[YYINITDEPTH];
3324   yytype_int16 *yyss = yyssa;
3325   yytype_int16 *yyssp;
3326
3327   /* The semantic value stack.  */
3328   YYSTYPE yyvsa[YYINITDEPTH];
3329   YYSTYPE *yyvs = yyvsa;
3330   YYSTYPE *yyvsp;
3331
3332
3333
3334 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
3335
3336   YYSIZE_T yystacksize = YYINITDEPTH;
3337
3338   /* The variables used to return semantic value and location from the
3339      action routines.  */
3340   YYSTYPE yyval;
3341
3342
3343   /* The number of symbols on the RHS of the reduced rule.
3344      Keep to zero when no symbol should be popped.  */
3345   int yylen = 0;
3346
3347   YYDPRINTF ((stderr, "Starting parse\n"));
3348
3349   yystate = 0;
3350   yyerrstatus = 0;
3351   yynerrs = 0;
3352   yychar = YYEMPTY;             /* Cause a token to be read.  */
3353
3354   /* Initialize stack pointers.
3355      Waste one element of value and location stack
3356      so that they stay on the same level as the state stack.
3357      The wasted elements are never initialized.  */
3358
3359   yyssp = yyss;
3360   yyvsp = yyvs;
3361
3362   goto yysetstate;
3363
3364 /*------------------------------------------------------------.
3365 | yynewstate -- Push a new state, which is found in yystate.  |
3366 `------------------------------------------------------------*/
3367  yynewstate:
3368   /* In all cases, when you get here, the value and location stacks
3369      have just been pushed.  So pushing a state here evens the stacks.  */
3370   yyssp++;
3371
3372  yysetstate:
3373   *yyssp = yystate;
3374
3375   if (yyss + yystacksize - 1 <= yyssp)
3376     {
3377       /* Get the current used size of the three stacks, in elements.  */
3378       YYSIZE_T yysize = yyssp - yyss + 1;
3379
3380 #ifdef yyoverflow
3381       {
3382         /* Give user a chance to reallocate the stack.  Use copies of
3383            these so that the &'s don't force the real ones into
3384            memory.  */
3385         YYSTYPE *yyvs1 = yyvs;
3386         yytype_int16 *yyss1 = yyss;
3387
3388
3389         /* Each stack pointer address is followed by the size of the
3390            data in use in that stack, in bytes.  This used to be a
3391            conditional around just the two extra args, but that might
3392            be undefined if yyoverflow is a macro.  */
3393         yyoverflow (YY_("memory exhausted"),
3394                     &yyss1, yysize * sizeof (*yyssp),
3395                     &yyvs1, yysize * sizeof (*yyvsp),
3396
3397                     &yystacksize);
3398
3399         yyss = yyss1;
3400         yyvs = yyvs1;
3401       }
3402 #else /* no yyoverflow */
3403 # ifndef YYSTACK_RELOCATE
3404       goto yyexhaustedlab;
3405 # else
3406       /* Extend the stack our own way.  */
3407       if (YYMAXDEPTH <= yystacksize)
3408         goto yyexhaustedlab;
3409       yystacksize *= 2;
3410       if (YYMAXDEPTH < yystacksize)
3411         yystacksize = YYMAXDEPTH;
3412
3413       {
3414         yytype_int16 *yyss1 = yyss;
3415         union yyalloc *yyptr =
3416           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3417         if (! yyptr)
3418           goto yyexhaustedlab;
3419         YYSTACK_RELOCATE (yyss);
3420         YYSTACK_RELOCATE (yyvs);
3421
3422 #  undef YYSTACK_RELOCATE
3423         if (yyss1 != yyssa)
3424           YYSTACK_FREE (yyss1);
3425       }
3426 # endif
3427 #endif /* no yyoverflow */
3428
3429       yyssp = yyss + yysize - 1;
3430       yyvsp = yyvs + yysize - 1;
3431
3432
3433       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3434                   (unsigned long int) yystacksize));
3435
3436       if (yyss + yystacksize - 1 <= yyssp)
3437         YYABORT;
3438     }
3439
3440   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3441
3442   goto yybackup;
3443
3444 /*-----------.
3445 | yybackup.  |
3446 `-----------*/
3447 yybackup:
3448
3449   /* Do appropriate processing given the current state.  Read a
3450      look-ahead token if we need one and don't already have one.  */
3451
3452   /* First try to decide what to do without reference to look-ahead token.  */
3453   yyn = yypact[yystate];
3454   if (yyn == YYPACT_NINF)
3455     goto yydefault;
3456
3457   /* Not known => get a look-ahead token if don't already have one.  */
3458
3459   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
3460   if (yychar == YYEMPTY)
3461     {
3462       YYDPRINTF ((stderr, "Reading a token: "));
3463       yychar = YYLEX;
3464     }
3465
3466   if (yychar <= YYEOF)
3467     {
3468       yychar = yytoken = YYEOF;
3469       YYDPRINTF ((stderr, "Now at end of input.\n"));
3470     }
3471   else
3472     {
3473       yytoken = YYTRANSLATE (yychar);
3474       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3475     }
3476
3477   /* If the proper action on seeing token YYTOKEN is to reduce or to
3478      detect an error, take that action.  */
3479   yyn += yytoken;
3480   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3481     goto yydefault;
3482   yyn = yytable[yyn];
3483   if (yyn <= 0)
3484     {
3485       if (yyn == 0 || yyn == YYTABLE_NINF)
3486         goto yyerrlab;
3487       yyn = -yyn;
3488       goto yyreduce;
3489     }
3490
3491   if (yyn == YYFINAL)
3492     YYACCEPT;
3493
3494   /* Count tokens shifted since error; after three, turn off error
3495      status.  */
3496   if (yyerrstatus)
3497     yyerrstatus--;
3498
3499   /* Shift the look-ahead token.  */
3500   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3501
3502   /* Discard the shifted token unless it is eof.  */
3503   if (yychar != YYEOF)
3504     yychar = YYEMPTY;
3505
3506   yystate = yyn;
3507   *++yyvsp = yylval;
3508
3509   goto yynewstate;
3510
3511
3512 /*-----------------------------------------------------------.
3513 | yydefault -- do the default action for the current state.  |
3514 `-----------------------------------------------------------*/
3515 yydefault:
3516   yyn = yydefact[yystate];
3517   if (yyn == 0)
3518     goto yyerrlab;
3519   goto yyreduce;
3520
3521
3522 /*-----------------------------.
3523 | yyreduce -- Do a reduction.  |
3524 `-----------------------------*/
3525 yyreduce:
3526   /* yyn is the number of a rule to reduce with.  */
3527   yylen = yyr2[yyn];
3528
3529   /* If YYLEN is nonzero, implement the default value of the action:
3530      `$$ = $1'.
3531
3532      Otherwise, the following line sets YYVAL to garbage.
3533      This behavior is undocumented and Bison
3534      users should not rely upon it.  Assigning to YYVAL
3535      unconditionally makes the parser a bit smaller, and it avoids a
3536      GCC warning that YYVAL may be used uninitialized.  */
3537   yyval = yyvsp[1-yylen];
3538
3539
3540   YY_REDUCE_PRINT (yyn);
3541   switch (yyn)
3542     {
3543         case 29:
3544 #line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3545     { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3546     break;
3547
3548   case 30:
3549 #line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3550     { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3551     break;
3552
3553   case 31:
3554 #line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3555     { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3556     break;
3557
3558   case 32:
3559 #line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3560     { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3561     break;
3562
3563   case 33:
3564 #line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3565     { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3566     break;
3567
3568   case 34:
3569 #line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3570     { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3571     break;
3572
3573   case 35:
3574 #line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3575     { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3576     break;
3577
3578   case 36:
3579 #line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3580     { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3581     break;
3582
3583   case 37:
3584 #line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3585     { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3586     break;
3587
3588   case 38:
3589 #line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3590     { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3591     break;
3592
3593   case 39:
3594 #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3595     { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3596     break;
3597
3598   case 40:
3599 #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3600     { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3601     break;
3602
3603   case 41:
3604 #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3605     { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3606     break;
3607
3608   case 42:
3609 #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3610     { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3611     break;
3612
3613   case 43:
3614 #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3615     { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3616     break;
3617
3618   case 44:
3619 #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3620     { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3621     break;
3622
3623   case 45:
3624 #line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3625     { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3626     break;
3627
3628   case 46:
3629 #line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3630     { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3631     break;
3632
3633   case 47:
3634 #line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3635     { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3636     break;
3637
3638   case 48:
3639 #line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3640     { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3641     break;
3642
3643   case 49:
3644 #line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3645     { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3646     break;
3647
3648   case 50:
3649 #line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3650     { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3651     break;
3652
3653   case 51:
3654 #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3655     { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3656     break;
3657
3658   case 52:
3659 #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3660     { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3661     break;
3662
3663   case 53:
3664 #line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3665     { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3666     break;
3667
3668   case 54:
3669 #line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3670     { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3671     break;
3672
3673   case 65:
3674 #line 1143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3675     { (yyval.StrVal) = 0; ;}
3676     break;
3677
3678   case 66:
3679 #line 1145 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3680     { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3681     break;
3682
3683   case 67:
3684 #line 1146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3685     { (yyval.UIntVal)=0; ;}
3686     break;
3687
3688   case 68:
3689 #line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3690     {
3691     (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3692     CHECK_FOR_ERROR
3693   ;}
3694     break;
3695
3696   case 69:
3697 #line 1154 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3698     {
3699     (yyval.StrVal) = 0;
3700     CHECK_FOR_ERROR
3701   ;}
3702     break;
3703
3704   case 73:
3705 #line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3706     {
3707     (yyval.StrVal) = 0;
3708     CHECK_FOR_ERROR
3709   ;}
3710     break;
3711
3712   case 74:
3713 #line 1167 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3714     {
3715     (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
3716     CHECK_FOR_ERROR
3717   ;}
3718     break;
3719
3720   case 75:
3721 #line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3722     { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3723     break;
3724
3725   case 76:
3726 #line 1174 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3727     { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3728     break;
3729
3730   case 77:
3731 #line 1175 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3732     { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3733     break;
3734
3735   case 78:
3736 #line 1176 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3737     { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3738     break;
3739
3740   case 79:
3741 #line 1177 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3742     { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3743     break;
3744
3745   case 80:
3746 #line 1178 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3747     { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
3748     break;
3749
3750   case 81:
3751 #line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3752     { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3753     break;
3754
3755   case 82:
3756 #line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3757     { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3758     break;
3759
3760   case 83:
3761 #line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3762     { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3763     break;
3764
3765   case 84:
3766 #line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3767     { (yyval.Visibility) = GlobalValue::DefaultVisibility;   ;}
3768     break;
3769
3770   case 85:
3771 #line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3772     { (yyval.Visibility) = GlobalValue::DefaultVisibility;   ;}
3773     break;
3774
3775   case 86:
3776 #line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3777     { (yyval.Visibility) = GlobalValue::HiddenVisibility;    ;}
3778     break;
3779
3780   case 87:
3781 #line 1191 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3782     { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3783     break;
3784
3785   case 88:
3786 #line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3787     { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3788     break;
3789
3790   case 89:
3791 #line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3792     { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3793     break;
3794
3795   case 90:
3796 #line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3797     { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3798     break;
3799
3800   case 91:
3801 #line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3802     { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3803     break;
3804
3805   case 92:
3806 #line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3807     { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3808     break;
3809
3810   case 93:
3811 #line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3812     { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3813     break;
3814
3815   case 94:
3816 #line 1204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3817     { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3818     break;
3819
3820   case 95:
3821 #line 1205 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3822     { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3823     break;
3824
3825   case 96:
3826 #line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3827     { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3828     break;
3829
3830   case 97:
3831 #line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3832     { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3833     break;
3834
3835   case 98:
3836 #line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3837     { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3838     break;
3839
3840   case 99:
3841 #line 1214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3842     { (yyval.UIntVal) = CallingConv::C; ;}
3843     break;
3844
3845   case 100:
3846 #line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3847     { (yyval.UIntVal) = CallingConv::C; ;}
3848     break;
3849
3850   case 101:
3851 #line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3852     { (yyval.UIntVal) = CallingConv::Fast; ;}
3853     break;
3854
3855   case 102:
3856 #line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3857     { (yyval.UIntVal) = CallingConv::Cold; ;}
3858     break;
3859
3860   case 103:
3861 #line 1218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3862     { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3863     break;
3864
3865   case 104:
3866 #line 1219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3867     { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3868     break;
3869
3870   case 105:
3871 #line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3872     {
3873                    if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
3874                      GEN_ERROR("Calling conv too large");
3875                    (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3876                   CHECK_FOR_ERROR
3877                  ;}
3878     break;
3879
3880   case 106:
3881 #line 1227 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3882     { (yyval.ParamAttrs) = ParamAttr::ZExt;      ;}
3883     break;
3884
3885   case 107:
3886 #line 1228 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3887     { (yyval.ParamAttrs) = ParamAttr::ZExt;      ;}
3888     break;
3889
3890   case 108:
3891 #line 1229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3892     { (yyval.ParamAttrs) = ParamAttr::SExt;      ;}
3893     break;
3894
3895   case 109:
3896 #line 1230 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3897     { (yyval.ParamAttrs) = ParamAttr::SExt;      ;}
3898     break;
3899
3900   case 110:
3901 #line 1231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3902     { (yyval.ParamAttrs) = ParamAttr::InReg;     ;}
3903     break;
3904
3905   case 111:
3906 #line 1232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3907     { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3908     break;
3909
3910   case 112:
3911 #line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3912     { (yyval.ParamAttrs) = ParamAttr::NoAlias;   ;}
3913     break;
3914
3915   case 113:
3916 #line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3917     { (yyval.ParamAttrs) = ParamAttr::ByVal;     ;}
3918     break;
3919
3920   case 114:
3921 #line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3922     { (yyval.ParamAttrs) = ParamAttr::Nest;      ;}
3923     break;
3924
3925   case 115:
3926 #line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3927     { (yyval.ParamAttrs) = 
3928                           ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val));    ;}
3929     break;
3930
3931   case 116:
3932 #line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3933     { (yyval.ParamAttrs) = ParamAttr::None; ;}
3934     break;
3935
3936   case 117:
3937 #line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3938     {
3939                 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3940               ;}
3941     break;
3942
3943   case 118:
3944 #line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3945     { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3946     break;
3947
3948   case 119:
3949 #line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3950     { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3951     break;
3952
3953   case 120:
3954 #line 1248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3955     { (yyval.ParamAttrs) = ParamAttr::ZExt;     ;}
3956     break;
3957
3958   case 121:
3959 #line 1249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3960     { (yyval.ParamAttrs) = ParamAttr::SExt;     ;}
3961     break;
3962
3963   case 122:
3964 #line 1250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3965     { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3966     break;
3967
3968   case 123:
3969 #line 1251 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3970     { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3971     break;
3972
3973   case 124:
3974 #line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3975     { (yyval.ParamAttrs) = ParamAttr::None; ;}
3976     break;
3977
3978   case 125:
3979 #line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3980     {
3981                 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3982               ;}
3983     break;
3984
3985   case 126:
3986 #line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3987     { (yyval.StrVal) = 0; ;}
3988     break;
3989
3990   case 127:
3991 #line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3992     {
3993                 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3994               ;}
3995     break;
3996
3997   case 128:
3998 #line 1268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3999     { (yyval.UIntVal) = 0; ;}
4000     break;
4001
4002   case 129:
4003 #line 1269 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4004     {
4005   (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4006   if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4007     GEN_ERROR("Alignment must be a power of two");
4008   CHECK_FOR_ERROR
4009 ;}
4010     break;
4011
4012   case 130:
4013 #line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4014     { (yyval.UIntVal) = 0; ;}
4015     break;
4016
4017   case 131:
4018 #line 1276 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4019     {
4020   (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4021   if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
4022     GEN_ERROR("Alignment must be a power of two");
4023   CHECK_FOR_ERROR
4024 ;}
4025     break;
4026
4027   case 132:
4028 #line 1285 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4029     {
4030   for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4031     if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
4032       GEN_ERROR("Invalid character in section name");
4033   (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4034   CHECK_FOR_ERROR
4035 ;}
4036     break;
4037
4038   case 133:
4039 #line 1293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4040     { (yyval.StrVal) = 0; ;}
4041     break;
4042
4043   case 134:
4044 #line 1294 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4045     { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4046     break;
4047
4048   case 135:
4049 #line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4050     {;}
4051     break;
4052
4053   case 136:
4054 #line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4055     {;}
4056     break;
4057
4058   case 137:
4059 #line 1301 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4060     {
4061     CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4062     delete (yyvsp[(1) - (1)].StrVal);
4063     CHECK_FOR_ERROR
4064   ;}
4065     break;
4066
4067   case 138:
4068 #line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4069     {
4070     if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
4071       GEN_ERROR("Alignment must be a power of two");
4072     CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
4073     CHECK_FOR_ERROR
4074   ;}
4075     break;
4076
4077   case 146:
4078 #line 1322 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4079     {
4080     (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
4081     CHECK_FOR_ERROR
4082   ;}
4083     break;
4084
4085   case 147:
4086 #line 1326 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4087     {
4088     (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
4089     CHECK_FOR_ERROR
4090   ;}
4091     break;
4092
4093   case 148:
4094 #line 1330 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4095     {                             // Pointer type?
4096     if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
4097       GEN_ERROR("Cannot form a pointer to a basic block");
4098     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4099     delete (yyvsp[(1) - (3)].TypeVal);
4100     CHECK_FOR_ERROR
4101   ;}
4102     break;
4103
4104   case 149:
4105 #line 1337 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4106     {            // Named types are also simple types...
4107     const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
4108     CHECK_FOR_ERROR
4109     (yyval.TypeVal) = new PATypeHolder(tmp);
4110   ;}
4111     break;
4112
4113   case 150:
4114 #line 1342 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4115     {                   // Type UpReference
4116     if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
4117     OpaqueType *OT = OpaqueType::get();        // Use temporary placeholder
4118     UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT));  // Add to vector...
4119     (yyval.TypeVal) = new PATypeHolder(OT);
4120     UR_OUT("New Upreference!\n");
4121     CHECK_FOR_ERROR
4122   ;}
4123     break;
4124
4125   case 151:
4126 #line 1350 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4127     {
4128     // Allow but ignore attributes on function types; this permits auto-upgrade.
4129     // FIXME: remove in LLVM 3.0.
4130     const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4131     if (!FunctionType::isValidReturnType(RetTy))
4132       GEN_ERROR("Invalid result type for LLVM function");
4133       
4134     std::vector<const Type*> Params;
4135     TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4136     for (; I != E; ++I ) {
4137       const Type *Ty = I->Ty->get();
4138       Params.push_back(Ty);
4139     }
4140
4141     bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4142     if (isVarArg) Params.pop_back();
4143
4144     for (unsigned i = 0; i != Params.size(); ++i)
4145       if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4146         GEN_ERROR("Function arguments must be value types!");
4147
4148     CHECK_FOR_ERROR
4149
4150     FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
4151     delete (yyvsp[(3) - (5)].TypeWithAttrsList);   // Delete the argument list
4152     delete (yyvsp[(1) - (5)].TypeVal);   // Delete the return type handle
4153     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); 
4154     CHECK_FOR_ERROR
4155   ;}
4156     break;
4157
4158   case 152:
4159 #line 1379 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4160     {
4161     // Allow but ignore attributes on function types; this permits auto-upgrade.
4162     // FIXME: remove in LLVM 3.0.
4163     std::vector<const Type*> Params;
4164     TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
4165     for ( ; I != E; ++I ) {
4166       const Type* Ty = I->Ty->get();
4167       Params.push_back(Ty);
4168     }
4169
4170     bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4171     if (isVarArg) Params.pop_back();
4172
4173     for (unsigned i = 0; i != Params.size(); ++i)
4174       if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4175         GEN_ERROR("Function arguments must be value types!");
4176
4177     CHECK_FOR_ERROR
4178
4179     FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4180     delete (yyvsp[(3) - (5)].TypeWithAttrsList);      // Delete the argument list
4181     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); 
4182     CHECK_FOR_ERROR
4183   ;}
4184     break;
4185
4186   case 153:
4187 #line 1404 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4188     {          // Sized array type?
4189     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4190     delete (yyvsp[(4) - (5)].TypeVal);
4191     CHECK_FOR_ERROR
4192   ;}
4193     break;
4194
4195   case 154:
4196 #line 1409 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4197     {          // Vector type?
4198      const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4199      if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
4200         GEN_ERROR("Unsigned result not equal to signed result");
4201      if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4202         GEN_ERROR("Element type of a VectorType must be primitive");
4203      (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4204      delete (yyvsp[(4) - (5)].TypeVal);
4205      CHECK_FOR_ERROR
4206   ;}
4207     break;
4208
4209   case 155:
4210 #line 1419 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4211     {                        // Structure type?
4212     std::vector<const Type*> Elements;
4213     for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4214            E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
4215       Elements.push_back(*I);
4216
4217     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4218     delete (yyvsp[(2) - (3)].TypeList);
4219     CHECK_FOR_ERROR
4220   ;}
4221     break;
4222
4223   case 156:
4224 #line 1429 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4225     {                                  // Empty structure type?
4226     (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
4227     CHECK_FOR_ERROR
4228   ;}
4229     break;
4230
4231   case 157:
4232 #line 1433 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4233     {
4234     std::vector<const Type*> Elements;
4235     for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4236            E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
4237       Elements.push_back(*I);
4238
4239     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4240     delete (yyvsp[(3) - (5)].TypeList);
4241     CHECK_FOR_ERROR
4242   ;}
4243     break;
4244
4245   case 158:
4246 #line 1443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4247     {                         // Empty structure type?
4248     (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
4249     CHECK_FOR_ERROR
4250   ;}
4251     break;
4252
4253   case 159:
4254 #line 1450 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4255     {
4256     // Allow but ignore attributes on function types; this permits auto-upgrade.
4257     // FIXME: remove in LLVM 3.0.
4258     (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); 
4259     (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4260   ;}
4261     break;
4262
4263   case 160:
4264 #line 1459 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4265     {
4266     if (!UpRefs.empty())
4267       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4268     if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
4269       GEN_ERROR("LLVM functions cannot return aggregate types");
4270     (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4271   ;}
4272     break;
4273
4274   case 161:
4275 #line 1466 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4276     {
4277     (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4278   ;}
4279     break;
4280
4281   case 162:
4282 #line 1471 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4283     {
4284     (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4285     (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
4286     CHECK_FOR_ERROR
4287   ;}
4288     break;
4289
4290   case 163:
4291 #line 1476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4292     {
4293     ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
4294     CHECK_FOR_ERROR
4295   ;}
4296     break;
4297
4298   case 165:
4299 #line 1484 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4300     {
4301     (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
4302     TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4303     TWA.Ty = new PATypeHolder(Type::VoidTy);
4304     (yyval.TypeWithAttrsList)->push_back(TWA);
4305     CHECK_FOR_ERROR
4306   ;}
4307     break;
4308
4309   case 166:
4310 #line 1491 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4311     {
4312     (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4313     TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4314     TWA.Ty = new PATypeHolder(Type::VoidTy);
4315     (yyval.TypeWithAttrsList)->push_back(TWA);
4316     CHECK_FOR_ERROR
4317   ;}
4318     break;
4319
4320   case 167:
4321 #line 1498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4322     {
4323     (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4324     CHECK_FOR_ERROR
4325   ;}
4326     break;
4327
4328   case 168:
4329 #line 1506 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4330     {
4331     (yyval.TypeList) = new std::list<PATypeHolder>();
4332     (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); 
4333     delete (yyvsp[(1) - (1)].TypeVal);
4334     CHECK_FOR_ERROR
4335   ;}
4336     break;
4337
4338   case 169:
4339 #line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4340     {
4341     ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); 
4342     delete (yyvsp[(3) - (3)].TypeVal);
4343     CHECK_FOR_ERROR
4344   ;}
4345     break;
4346
4347   case 170:
4348 #line 1524 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4349     { // Nonempty unsized arr
4350     if (!UpRefs.empty())
4351       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4352     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
4353     if (ATy == 0)
4354       GEN_ERROR("Cannot make array constant with type: '" + 
4355                      (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4356     const Type *ETy = ATy->getElementType();
4357     int NumElements = ATy->getNumElements();
4358
4359     // Verify that we have the correct size...
4360     if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4361       GEN_ERROR("Type mismatch: constant sized array initialized with " +
4362                      utostr((yyvsp[(3) - (4)].ConstVector)->size()) +  " arguments, but has size of " + 
4363                      itostr(NumElements) + "");
4364
4365     // Verify all elements are correct type!
4366     for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4367       if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4368         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
4369                        ETy->getDescription() +"' as required!\nIt is of type '"+
4370                        (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4371     }
4372
4373     (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4374     delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4375     CHECK_FOR_ERROR
4376   ;}
4377     break;
4378
4379   case 171:
4380 #line 1552 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4381     {
4382     if (!UpRefs.empty())
4383       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4384     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4385     if (ATy == 0)
4386       GEN_ERROR("Cannot make array constant with type: '" + 
4387                      (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4388
4389     int NumElements = ATy->getNumElements();
4390     if (NumElements != -1 && NumElements != 0) 
4391       GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4392                      " arguments, but has size of " + itostr(NumElements) +"");
4393     (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4394     delete (yyvsp[(1) - (3)].TypeVal);
4395     CHECK_FOR_ERROR
4396   ;}
4397     break;
4398
4399   case 172:
4400 #line 1568 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4401     {
4402     if (!UpRefs.empty())
4403       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4404     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
4405     if (ATy == 0)
4406       GEN_ERROR("Cannot make array constant with type: '" + 
4407                      (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4408
4409     int NumElements = ATy->getNumElements();
4410     const Type *ETy = ATy->getElementType();
4411     if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
4412       GEN_ERROR("Can't build string constant of size " + 
4413                      itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
4414                      " when array has size " + itostr(NumElements) + "");
4415     std::vector<Constant*> Vals;
4416     if (ETy == Type::Int8Ty) {
4417       for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4418         Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
4419     } else {
4420       delete (yyvsp[(3) - (3)].StrVal);
4421       GEN_ERROR("Cannot build string arrays of non byte sized elements");
4422     }
4423     delete (yyvsp[(3) - (3)].StrVal);
4424     (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4425     delete (yyvsp[(1) - (3)].TypeVal);
4426     CHECK_FOR_ERROR
4427   ;}
4428     break;
4429
4430   case 173:
4431 #line 1595 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4432     { // Nonempty unsized arr
4433     if (!UpRefs.empty())
4434       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4435     const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
4436     if (PTy == 0)
4437       GEN_ERROR("Cannot make packed constant with type: '" + 
4438                      (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4439     const Type *ETy = PTy->getElementType();
4440     int NumElements = PTy->getNumElements();
4441
4442     // Verify that we have the correct size...
4443     if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
4444       GEN_ERROR("Type mismatch: constant sized packed initialized with " +
4445                      utostr((yyvsp[(3) - (4)].ConstVector)->size()) +  " arguments, but has size of " + 
4446                      itostr(NumElements) + "");
4447
4448     // Verify all elements are correct type!
4449     for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4450       if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
4451         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
4452            ETy->getDescription() +"' as required!\nIt is of type '"+
4453            (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
4454     }
4455
4456     (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4457     delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4458     CHECK_FOR_ERROR
4459   ;}
4460     break;
4461
4462   case 174:
4463 #line 1623 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4464     {
4465     const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
4466     if (STy == 0)
4467       GEN_ERROR("Cannot make struct constant with type: '" + 
4468                      (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
4469
4470     if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4471       GEN_ERROR("Illegal number of initializers for structure type");
4472
4473     // Check to ensure that constants are compatible with the type initializer!
4474     for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4475       if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4476         GEN_ERROR("Expected type '" +
4477                        STy->getElementType(i)->getDescription() +
4478                        "' for element #" + utostr(i) +
4479                        " of structure initializer");
4480
4481     // Check to ensure that Type is not packed
4482     if (STy->isPacked())
4483       GEN_ERROR("Unpacked Initializer to vector type '" +
4484                 STy->getDescription() + "'");
4485
4486     (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4487     delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4488     CHECK_FOR_ERROR
4489   ;}
4490     break;
4491
4492   case 175:
4493 #line 1649 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4494     {
4495     if (!UpRefs.empty())
4496       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4497     const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4498     if (STy == 0)
4499       GEN_ERROR("Cannot make struct constant with type: '" + 
4500                      (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
4501
4502     if (STy->getNumContainedTypes() != 0)
4503       GEN_ERROR("Illegal number of initializers for structure type");
4504
4505     // Check to ensure that Type is not packed
4506     if (STy->isPacked())
4507       GEN_ERROR("Unpacked Initializer to vector type '" +
4508                 STy->getDescription() + "'");
4509
4510     (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4511     delete (yyvsp[(1) - (3)].TypeVal);
4512     CHECK_FOR_ERROR
4513   ;}
4514     break;
4515
4516   case 176:
4517 #line 1669 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4518     {
4519     const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
4520     if (STy == 0)
4521       GEN_ERROR("Cannot make struct constant with type: '" + 
4522                      (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
4523
4524     if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
4525       GEN_ERROR("Illegal number of initializers for structure type");
4526
4527     // Check to ensure that constants are compatible with the type initializer!
4528     for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4529       if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
4530         GEN_ERROR("Expected type '" +
4531                        STy->getElementType(i)->getDescription() +
4532                        "' for element #" + utostr(i) +
4533                        " of structure initializer");
4534
4535     // Check to ensure that Type is packed
4536     if (!STy->isPacked())
4537       GEN_ERROR("Vector initializer to non-vector type '" + 
4538                 STy->getDescription() + "'");
4539
4540     (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4541     delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
4542     CHECK_FOR_ERROR
4543   ;}
4544     break;
4545
4546   case 177:
4547 #line 1695 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4548     {
4549     if (!UpRefs.empty())
4550       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4551     const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
4552     if (STy == 0)
4553       GEN_ERROR("Cannot make struct constant with type: '" + 
4554                      (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
4555
4556     if (STy->getNumContainedTypes() != 0)
4557       GEN_ERROR("Illegal number of initializers for structure type");
4558
4559     // Check to ensure that Type is packed
4560     if (!STy->isPacked())
4561       GEN_ERROR("Vector initializer to non-vector type '" + 
4562                 STy->getDescription() + "'");
4563
4564     (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4565     delete (yyvsp[(1) - (5)].TypeVal);
4566     CHECK_FOR_ERROR
4567   ;}
4568     break;
4569
4570   case 178:
4571 #line 1715 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4572     {
4573     if (!UpRefs.empty())
4574       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4575     const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4576     if (PTy == 0)
4577       GEN_ERROR("Cannot make null pointer constant with type: '" + 
4578                      (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
4579
4580     (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4581     delete (yyvsp[(1) - (2)].TypeVal);
4582     CHECK_FOR_ERROR
4583   ;}
4584     break;
4585
4586   case 179:
4587 #line 1727 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4588     {
4589     if (!UpRefs.empty())
4590       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4591     (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4592     delete (yyvsp[(1) - (2)].TypeVal);
4593     CHECK_FOR_ERROR
4594   ;}
4595     break;
4596
4597   case 180:
4598 #line 1734 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4599     {
4600     if (!UpRefs.empty())
4601       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4602     const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4603     if (Ty == 0)
4604       GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4605
4606     // ConstExprs can exist in the body of a function, thus creating
4607     // GlobalValues whenever they refer to a variable.  Because we are in
4608     // the context of a function, getExistingVal will search the functions
4609     // symbol table instead of the module symbol table for the global symbol,
4610     // which throws things all off.  To get around this, we just tell
4611     // getExistingVal that we are at global scope here.
4612     //
4613     Function *SavedCurFn = CurFun.CurrentFunction;
4614     CurFun.CurrentFunction = 0;
4615
4616     Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
4617     CHECK_FOR_ERROR
4618
4619     CurFun.CurrentFunction = SavedCurFn;
4620
4621     // If this is an initializer for a constant pointer, which is referencing a
4622     // (currently) undefined variable, create a stub now that shall be replaced
4623     // in the future with the right type of variable.
4624     //
4625     if (V == 0) {
4626       assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4627       const PointerType *PT = cast<PointerType>(Ty);
4628
4629       // First check to see if the forward references value is already created!
4630       PerModuleInfo::GlobalRefsType::iterator I =
4631         CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
4632     
4633       if (I != CurModule.GlobalRefs.end()) {
4634         V = I->second;             // Placeholder already exists, use it...
4635         (yyvsp[(2) - (2)].ValIDVal).destroy();
4636       } else {
4637         std::string Name;
4638         if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4639           Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4640         else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
4641           GEN_ERROR("Invalid reference to global");
4642
4643         // Create the forward referenced global.
4644         GlobalValue *GV;
4645         if (const FunctionType *FTy = 
4646                  dyn_cast<FunctionType>(PT->getElementType())) {
4647           GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4648                                 CurModule.CurrentModule);
4649         } else {
4650           GV = new GlobalVariable(PT->getElementType(), false,
4651                                   GlobalValue::ExternalWeakLinkage, 0,
4652                                   Name, CurModule.CurrentModule);
4653         }
4654
4655         // Keep track of the fact that we have a forward ref to recycle it
4656         CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
4657         V = GV;
4658       }
4659     }
4660
4661     (yyval.ConstVal) = cast<GlobalValue>(V);
4662     delete (yyvsp[(1) - (2)].TypeVal);            // Free the type handle
4663     CHECK_FOR_ERROR
4664   ;}
4665     break;
4666
4667   case 181:
4668 #line 1800 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4669     {
4670     if (!UpRefs.empty())
4671       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4672     if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4673       GEN_ERROR("Mismatched types for constant expression: " + 
4674         (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4675     (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4676     delete (yyvsp[(1) - (2)].TypeVal);
4677     CHECK_FOR_ERROR
4678   ;}
4679     break;
4680
4681   case 182:
4682 #line 1810 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4683     {
4684     if (!UpRefs.empty())
4685       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4686     const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4687     if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4688       GEN_ERROR("Cannot create a null initialized value of this type");
4689     (yyval.ConstVal) = Constant::getNullValue(Ty);
4690     delete (yyvsp[(1) - (2)].TypeVal);
4691     CHECK_FOR_ERROR
4692   ;}
4693     break;
4694
4695   case 183:
4696 #line 1820 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4697     {      // integral constants
4698     if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
4699       GEN_ERROR("Constant value doesn't fit in type");
4700     (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
4701     CHECK_FOR_ERROR
4702   ;}
4703     break;
4704
4705   case 184:
4706 #line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4707     {      // arbitrary precision integer constants
4708     uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4709     if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4710       GEN_ERROR("Constant value does not fit in type");
4711     }
4712     (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4713     (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4714     delete (yyvsp[(2) - (2)].APIntVal);
4715     CHECK_FOR_ERROR
4716   ;}
4717     break;
4718
4719   case 185:
4720 #line 1836 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4721     {      // integral constants
4722     if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4723       GEN_ERROR("Constant value doesn't fit in type");
4724     (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
4725     CHECK_FOR_ERROR
4726   ;}
4727     break;
4728
4729   case 186:
4730 #line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4731     {      // arbitrary precision integer constants
4732     uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4733     if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
4734       GEN_ERROR("Constant value does not fit in type");
4735     } 
4736     (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4737     (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4738     delete (yyvsp[(2) - (2)].APIntVal);
4739     CHECK_FOR_ERROR
4740   ;}
4741     break;
4742
4743   case 187:
4744 #line 1852 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4745     {                      // Boolean constants
4746     assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4747     (yyval.ConstVal) = ConstantInt::getTrue();
4748     CHECK_FOR_ERROR
4749   ;}
4750     break;
4751
4752   case 188:
4753 #line 1857 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4754     {                     // Boolean constants
4755     assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4756     (yyval.ConstVal) = ConstantInt::getFalse();
4757     CHECK_FOR_ERROR
4758   ;}
4759     break;
4760
4761   case 189:
4762 #line 1862 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4763     {                   // Floating point constants
4764     if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
4765       GEN_ERROR("Floating point constant invalid for type");
4766     // Lexer has no type info, so builds all float and double FP constants 
4767     // as double.  Fix this here.  Long double is done right.
4768     if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4769       (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4770     (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
4771     delete (yyvsp[(2) - (2)].FPVal);
4772     CHECK_FOR_ERROR
4773   ;}
4774     break;
4775
4776   case 190:
4777 #line 1875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4778     {
4779     if (!UpRefs.empty())
4780       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4781     Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4782     const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4783     if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4784       GEN_ERROR("invalid cast opcode for cast from '" +
4785                 Val->getType()->getDescription() + "' to '" +
4786                 DestTy->getDescription() + "'"); 
4787     (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4788     delete (yyvsp[(5) - (6)].TypeVal);
4789   ;}
4790     break;
4791
4792   case 191:
4793 #line 1887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4794     {
4795     if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4796       GEN_ERROR("GetElementPtr requires a pointer operand");
4797
4798     const Type *IdxTy =
4799       GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4800     if (!IdxTy)
4801       GEN_ERROR("Index list invalid for constant getelementptr");
4802
4803     SmallVector<Constant*, 8> IdxVec;
4804     for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4805       if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4806         IdxVec.push_back(C);
4807       else
4808         GEN_ERROR("Indices to constant getelementptr must be constants");
4809
4810     delete (yyvsp[(4) - (5)].ValueList);
4811
4812     (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4813     CHECK_FOR_ERROR
4814   ;}
4815     break;
4816
4817   case 192:
4818 #line 1908 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4819     {
4820     if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4821       GEN_ERROR("Select condition must be of boolean type");
4822     if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4823       GEN_ERROR("Select operand types must match");
4824     (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4825     CHECK_FOR_ERROR
4826   ;}
4827     break;
4828
4829   case 193:
4830 #line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4831     {
4832     if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4833       GEN_ERROR("Binary operator types must match");
4834     CHECK_FOR_ERROR;
4835     (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4836   ;}
4837     break;
4838
4839   case 194:
4840 #line 1922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4841     {
4842     if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4843       GEN_ERROR("Logical operator types must match");
4844     if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4845       if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) || 
4846           !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4847         GEN_ERROR("Logical operator requires integral operands");
4848     }
4849     (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4850     CHECK_FOR_ERROR
4851   ;}
4852     break;
4853
4854   case 195:
4855 #line 1933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4856     {
4857     if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4858       GEN_ERROR("icmp operand types must match");
4859     (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4860   ;}
4861     break;
4862
4863   case 196:
4864 #line 1938 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4865     {
4866     if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4867       GEN_ERROR("fcmp operand types must match");
4868     (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4869   ;}
4870     break;
4871
4872   case 197:
4873 #line 1943 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4874     {
4875     if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4876       GEN_ERROR("vicmp operand types must match");
4877     (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4878   ;}
4879     break;
4880
4881   case 198:
4882 #line 1948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4883     {
4884     if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4885       GEN_ERROR("vfcmp operand types must match");
4886     (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4887   ;}
4888     break;
4889
4890   case 199:
4891 #line 1953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4892     {
4893     if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4894       GEN_ERROR("Invalid extractelement operands");
4895     (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4896     CHECK_FOR_ERROR
4897   ;}
4898     break;
4899
4900   case 200:
4901 #line 1959 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4902     {
4903     if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4904       GEN_ERROR("Invalid insertelement operands");
4905     (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4906     CHECK_FOR_ERROR
4907   ;}
4908     break;
4909
4910   case 201:
4911 #line 1965 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4912     {
4913     if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4914       GEN_ERROR("Invalid shufflevector operands");
4915     (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4916     CHECK_FOR_ERROR
4917   ;}
4918     break;
4919
4920   case 202:
4921 #line 1971 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4922     {
4923     if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4924       GEN_ERROR("ExtractValue requires an aggregate operand");
4925
4926     const Type *IdxTy =
4927       ExtractValueInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4928     if (!IdxTy)
4929       GEN_ERROR("Index list invalid for constant extractvalue");
4930
4931     SmallVector<Constant*, 8> IdxVec;
4932     for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4933       if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4934         IdxVec.push_back(C);
4935       else
4936         GEN_ERROR("Indices to constant extractvalue must be constants");
4937
4938     delete (yyvsp[(4) - (5)].ValueList);
4939
4940     (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4941     CHECK_FOR_ERROR
4942   ;}
4943     break;
4944
4945   case 203:
4946 #line 1992 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4947     {
4948     if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
4949       GEN_ERROR("InsertValue requires an aggregate operand");
4950
4951     const Type *IdxTy =
4952       ExtractValueInst::getIndexedType((yyvsp[(3) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ValueList)->begin(), (yyvsp[(6) - (7)].ValueList)->end());
4953     if (IdxTy != (yyvsp[(5) - (7)].ConstVal)->getType())
4954       GEN_ERROR("Index list invalid for constant insertvalue");
4955
4956     SmallVector<Constant*, 8> IdxVec;
4957     for (unsigned i = 0, e = (yyvsp[(6) - (7)].ValueList)->size(); i != e; ++i)
4958       if (Constant *C = dyn_cast<Constant>((*(yyvsp[(6) - (7)].ValueList))[i]))
4959         IdxVec.push_back(C);
4960       else
4961         GEN_ERROR("Indices to constant insertvalue must be constants");
4962
4963     delete (yyvsp[(6) - (7)].ValueList);
4964
4965     (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &IdxVec[0], IdxVec.size());
4966     CHECK_FOR_ERROR
4967   ;}
4968     break;
4969
4970   case 204:
4971 #line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4972     {
4973     ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
4974     CHECK_FOR_ERROR
4975   ;}
4976     break;
4977
4978   case 205:
4979 #line 2020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4980     {
4981     (yyval.ConstVector) = new std::vector<Constant*>();
4982     (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4983     CHECK_FOR_ERROR
4984   ;}
4985     break;
4986
4987   case 206:
4988 #line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4989     { (yyval.BoolVal) = false; ;}
4990     break;
4991
4992   case 207:
4993 #line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4994     { (yyval.BoolVal) = true; ;}
4995     break;
4996
4997   case 208:
4998 #line 2031 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4999     { (yyval.BoolVal) = true; ;}
5000     break;
5001
5002   case 209:
5003 #line 2031 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5004     { (yyval.BoolVal) = false; ;}
5005     break;
5006
5007   case 210:
5008 #line 2034 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5009     {
5010     const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5011     Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
5012     CHECK_FOR_ERROR
5013     GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5014     if (!Aliasee)
5015       GEN_ERROR("Aliases can be created only to global values");
5016
5017     (yyval.ConstVal) = Aliasee;
5018     CHECK_FOR_ERROR
5019     delete (yyvsp[(1) - (2)].TypeVal);
5020    ;}
5021     break;
5022
5023   case 211:
5024 #line 2046 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5025     {
5026     Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5027     const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5028     if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
5029       GEN_ERROR("invalid cast opcode for cast from '" +
5030                 Val->getType()->getDescription() + "' to '" +
5031                 DestTy->getDescription() + "'");
5032     
5033     (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5034     CHECK_FOR_ERROR
5035     delete (yyvsp[(5) - (6)].TypeVal);
5036    ;}
5037     break;
5038
5039   case 212:
5040 #line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5041     {
5042     (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5043     CurModule.ModuleDone();
5044     CHECK_FOR_ERROR;
5045   ;}
5046     break;
5047
5048   case 213:
5049 #line 2072 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5050     {
5051     (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5052     CurModule.ModuleDone();
5053     CHECK_FOR_ERROR;
5054   ;}
5055     break;
5056
5057   case 216:
5058 #line 2085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5059     { CurFun.isDeclare = false; ;}
5060     break;
5061
5062   case 217:
5063 #line 2085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5064     {
5065     CurFun.FunctionDone();
5066     CHECK_FOR_ERROR
5067   ;}
5068     break;
5069
5070   case 218:
5071 #line 2089 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5072     { CurFun.isDeclare = true; ;}
5073     break;
5074
5075   case 219:
5076 #line 2089 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5077     {
5078     CHECK_FOR_ERROR
5079   ;}
5080     break;
5081
5082   case 220:
5083 #line 2092 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5084     {
5085     CHECK_FOR_ERROR
5086   ;}
5087     break;
5088
5089   case 221:
5090 #line 2095 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5091     {
5092     if (!UpRefs.empty())
5093       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
5094     // Eagerly resolve types.  This is not an optimization, this is a
5095     // requirement that is due to the fact that we could have this:
5096     //
5097     // %list = type { %list * }
5098     // %list = type { %list * }    ; repeated type decl
5099     //
5100     // If types are not resolved eagerly, then the two types will not be
5101     // determined to be the same type!
5102     //
5103     ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
5104
5105     if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5106       CHECK_FOR_ERROR
5107       // If this is a named type that is not a redefinition, add it to the slot
5108       // table.
5109       CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
5110     }
5111
5112     delete (yyvsp[(3) - (3)].TypeVal);
5113     CHECK_FOR_ERROR
5114   ;}
5115     break;
5116
5117   case 222:
5118 #line 2119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5119     {
5120     ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5121
5122     if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
5123       CHECK_FOR_ERROR
5124       // If this is a named type that is not a redefinition, add it to the slot
5125       // table.
5126       CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
5127     }
5128     CHECK_FOR_ERROR
5129   ;}
5130     break;
5131
5132   case 223:
5133 #line 2131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5134     { 
5135     /* "Externally Visible" Linkage */
5136     if ((yyvsp[(5) - (6)].ConstVal) == 0) 
5137       GEN_ERROR("Global value initializer is not a constant");
5138     CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5139                                 (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal));
5140     CHECK_FOR_ERROR
5141   ;}
5142     break;
5143
5144   case 224:
5145 #line 2138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5146     {
5147     CurGV = 0;
5148   ;}
5149     break;
5150
5151   case 225:
5152 #line 2142 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5153     {
5154     if ((yyvsp[(6) - (7)].ConstVal) == 0) 
5155       GEN_ERROR("Global value initializer is not a constant");
5156     CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5157     CHECK_FOR_ERROR
5158   ;}
5159     break;
5160
5161   case 226:
5162 #line 2147 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5163     {
5164     CurGV = 0;
5165   ;}
5166     break;
5167
5168   case 227:
5169 #line 2151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5170     {
5171     if (!UpRefs.empty())
5172       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5173     CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
5174     CHECK_FOR_ERROR
5175     delete (yyvsp[(6) - (7)].TypeVal);
5176   ;}
5177     break;
5178
5179   case 228:
5180 #line 2157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5181     {
5182     CurGV = 0;
5183     CHECK_FOR_ERROR
5184   ;}
5185     break;
5186
5187   case 229:
5188 #line 2161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5189     {
5190     std::string Name;
5191     if ((yyvsp[(1) - (5)].StrVal)) {
5192       Name = *(yyvsp[(1) - (5)].StrVal);
5193       delete (yyvsp[(1) - (5)].StrVal);
5194     }
5195     if (Name.empty())
5196       GEN_ERROR("Alias name cannot be empty");
5197     
5198     Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
5199     if (Aliasee == 0)
5200       GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5201
5202     GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
5203                                       CurModule.CurrentModule);
5204     GA->setVisibility((yyvsp[(2) - (5)].Visibility));
5205     InsertValue(GA, CurModule.Values);
5206     
5207     
5208     // If there was a forward reference of this alias, resolve it now.
5209     
5210     ValID ID;
5211     if (!Name.empty())
5212       ID = ValID::createGlobalName(Name);
5213     else
5214       ID = ValID::createGlobalID(CurModule.Values.size()-1);
5215     
5216     if (GlobalValue *FWGV =
5217           CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5218       // Replace uses of the fwdref with the actual alias.
5219       FWGV->replaceAllUsesWith(GA);
5220       if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5221         GV->eraseFromParent();
5222       else
5223         cast<Function>(FWGV)->eraseFromParent();
5224     }
5225     ID.destroy();
5226     
5227     CHECK_FOR_ERROR
5228   ;}
5229     break;
5230
5231   case 230:
5232 #line 2201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5233     { 
5234     CHECK_FOR_ERROR
5235   ;}
5236     break;
5237
5238   case 231:
5239 #line 2204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5240     {
5241     CHECK_FOR_ERROR
5242   ;}
5243     break;
5244
5245   case 232:
5246 #line 2210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5247     {
5248   const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5249   if (AsmSoFar.empty())
5250     CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
5251   else
5252     CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5253   delete (yyvsp[(1) - (1)].StrVal);
5254   CHECK_FOR_ERROR
5255 ;}
5256     break;
5257
5258   case 233:
5259 #line 2220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5260     {
5261     CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5262     delete (yyvsp[(3) - (3)].StrVal);
5263   ;}
5264     break;
5265
5266   case 234:
5267 #line 2224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5268     {
5269     CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5270     delete (yyvsp[(3) - (3)].StrVal);
5271   ;}
5272     break;
5273
5274   case 236:
5275 #line 2231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5276     {
5277           CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5278           delete (yyvsp[(3) - (3)].StrVal);
5279           CHECK_FOR_ERROR
5280         ;}
5281     break;
5282
5283   case 237:
5284 #line 2236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5285     {
5286           CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5287           delete (yyvsp[(1) - (1)].StrVal);
5288           CHECK_FOR_ERROR
5289         ;}
5290     break;
5291
5292   case 238:
5293 #line 2241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5294     {
5295           CHECK_FOR_ERROR
5296         ;}
5297     break;
5298
5299   case 239:
5300 #line 2250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5301     {
5302     if (!UpRefs.empty())
5303       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5304     if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
5305       GEN_ERROR("void typed arguments are invalid");
5306     ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5307     (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5308     (yyvsp[(1) - (5)].ArgList)->push_back(E);
5309     CHECK_FOR_ERROR
5310   ;}
5311     break;
5312
5313   case 240:
5314 #line 2260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5315     {
5316     if (!UpRefs.empty())
5317       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5318     if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
5319       GEN_ERROR("void typed arguments are invalid");
5320     ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5321     (yyval.ArgList) = new ArgListType;
5322     (yyval.ArgList)->push_back(E);
5323     CHECK_FOR_ERROR
5324   ;}
5325     break;
5326
5327   case 241:
5328 #line 2271 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5329     {
5330     (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
5331     CHECK_FOR_ERROR
5332   ;}
5333     break;
5334
5335   case 242:
5336 #line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5337     {
5338     (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
5339     struct ArgListEntry E;
5340     E.Ty = new PATypeHolder(Type::VoidTy);
5341     E.Name = 0;
5342     E.Attrs = ParamAttr::None;
5343     (yyval.ArgList)->push_back(E);
5344     CHECK_FOR_ERROR
5345   ;}
5346     break;
5347
5348   case 243:
5349 #line 2284 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5350     {
5351     (yyval.ArgList) = new ArgListType;
5352     struct ArgListEntry E;
5353     E.Ty = new PATypeHolder(Type::VoidTy);
5354     E.Name = 0;
5355     E.Attrs = ParamAttr::None;
5356     (yyval.ArgList)->push_back(E);
5357     CHECK_FOR_ERROR
5358   ;}
5359     break;
5360
5361   case 244:
5362 #line 2293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5363     {
5364     (yyval.ArgList) = 0;
5365     CHECK_FOR_ERROR
5366   ;}
5367     break;
5368
5369   case 245:
5370 #line 2299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5371     {
5372   std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5373   delete (yyvsp[(3) - (10)].StrVal);  // Free strdup'd memory!
5374   
5375   // Check the function result for abstractness if this is a define. We should
5376   // have no abstract types at this point
5377   if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5378     GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
5379
5380   if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5381     GEN_ERROR("Invalid result type for LLVM function");
5382     
5383   std::vector<const Type*> ParamTypeList;
5384   SmallVector<ParamAttrsWithIndex, 8> Attrs;
5385   if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5386     Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5387   if ((yyvsp[(5) - (10)].ArgList)) {   // If there are arguments...
5388     unsigned index = 1;
5389     for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
5390       const Type* Ty = I->Ty->get();
5391       if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5392         GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5393       ParamTypeList.push_back(Ty);
5394       if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5395         Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
5396     }
5397   }
5398
5399   bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5400   if (isVarArg) ParamTypeList.pop_back();
5401
5402   PAListPtr PAL;
5403   if (!Attrs.empty())
5404     PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5405
5406   FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
5407   const PointerType *PFT = PointerType::getUnqual(FT);
5408   delete (yyvsp[(2) - (10)].TypeVal);
5409
5410   ValID ID;
5411   if (!FunctionName.empty()) {
5412     ID = ValID::createGlobalName((char*)FunctionName.c_str());
5413   } else {
5414     ID = ValID::createGlobalID(CurModule.Values.size());
5415   }
5416
5417   Function *Fn = 0;
5418   // See if this function was forward referenced.  If so, recycle the object.
5419   if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5420     // Move the function to the end of the list, from whereever it was 
5421     // previously inserted.
5422     Fn = cast<Function>(FWRef);
5423     assert(Fn->getParamAttrs().isEmpty() &&
5424            "Forward reference has parameter attributes!");
5425     CurModule.CurrentModule->getFunctionList().remove(Fn);
5426     CurModule.CurrentModule->getFunctionList().push_back(Fn);
5427   } else if (!FunctionName.empty() &&     // Merge with an earlier prototype?
5428              (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
5429     if (Fn->getFunctionType() != FT ) {
5430       // The existing function doesn't have the same type. This is an overload
5431       // error.
5432       GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5433     } else if (Fn->getParamAttrs() != PAL) {
5434       // The existing function doesn't have the same parameter attributes.
5435       // This is an overload error.
5436       GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
5437     } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5438       // Neither the existing or the current function is a declaration and they
5439       // have the same name and same type. Clearly this is a redefinition.
5440       GEN_ERROR("Redefinition of function '" + FunctionName + "'");
5441     } else if (Fn->isDeclaration()) {
5442       // Make sure to strip off any argument names so we can't get conflicts.
5443       for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5444            AI != AE; ++AI)
5445         AI->setName("");
5446     }
5447   } else  {  // Not already defined?
5448     Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5449                           CurModule.CurrentModule);
5450     InsertValue(Fn, CurModule.Values);
5451   }
5452
5453   CurFun.FunctionStart(Fn);
5454
5455   if (CurFun.isDeclare) {
5456     // If we have declaration, always overwrite linkage.  This will allow us to
5457     // correctly handle cases, when pointer to function is passed as argument to
5458     // another function.
5459     Fn->setLinkage(CurFun.Linkage);
5460     Fn->setVisibility(CurFun.Visibility);
5461   }
5462   Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
5463   Fn->setParamAttrs(PAL);
5464   Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5465   if ((yyvsp[(8) - (10)].StrVal)) {
5466     Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5467     delete (yyvsp[(8) - (10)].StrVal);
5468   }
5469   if ((yyvsp[(10) - (10)].StrVal)) {
5470     Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5471     delete (yyvsp[(10) - (10)].StrVal);
5472   }
5473
5474   // Add all of the arguments we parsed to the function...
5475   if ((yyvsp[(5) - (10)].ArgList)) {                     // Is null if empty...
5476     if (isVarArg) {  // Nuke the last entry
5477       assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
5478              "Not a varargs marker!");
5479       delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5480       (yyvsp[(5) - (10)].ArgList)->pop_back();  // Delete the last entry
5481     }
5482     Function::arg_iterator ArgIt = Fn->arg_begin();
5483     Function::arg_iterator ArgEnd = Fn->arg_end();
5484     unsigned Idx = 1;
5485     for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); 
5486          I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
5487       delete I->Ty;                          // Delete the typeholder...
5488       setValueName(ArgIt, I->Name);       // Insert arg into symtab...
5489       CHECK_FOR_ERROR
5490       InsertValue(ArgIt);
5491       Idx++;
5492     }
5493
5494     delete (yyvsp[(5) - (10)].ArgList);                     // We're now done with the argument list
5495   }
5496   CHECK_FOR_ERROR
5497 ;}
5498     break;
5499
5500   case 248:
5501 #line 2429 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5502     {
5503   (yyval.FunctionVal) = CurFun.CurrentFunction;
5504
5505   // Make sure that we keep track of the linkage type even if there was a
5506   // previous "declare".
5507   (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5508   (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5509 ;}
5510     break;
5511
5512   case 251:
5513 #line 2440 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5514     {
5515   (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5516   CHECK_FOR_ERROR
5517 ;}
5518     break;
5519
5520   case 252:
5521 #line 2445 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5522     {
5523     CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5524     CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5525     (yyval.FunctionVal) = CurFun.CurrentFunction;
5526     CurFun.FunctionDone();
5527     CHECK_FOR_ERROR
5528   ;}
5529     break;
5530
5531   case 253:
5532 #line 2457 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5533     {
5534     (yyval.BoolVal) = false;
5535     CHECK_FOR_ERROR
5536   ;}
5537     break;
5538
5539   case 254:
5540 #line 2461 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5541     {
5542     (yyval.BoolVal) = true;
5543     CHECK_FOR_ERROR
5544   ;}
5545     break;
5546
5547   case 255:
5548 #line 2466 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5549     {    // A reference to a direct constant
5550     (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
5551     CHECK_FOR_ERROR
5552   ;}
5553     break;
5554
5555   case 256:
5556 #line 2470 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5557     {
5558     (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
5559     CHECK_FOR_ERROR
5560   ;}
5561     break;
5562
5563   case 257:
5564 #line 2474 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5565     {                     // Perhaps it's an FP constant?
5566     (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
5567     CHECK_FOR_ERROR
5568   ;}
5569     break;
5570
5571   case 258:
5572 #line 2478 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5573     {
5574     (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
5575     CHECK_FOR_ERROR
5576   ;}
5577     break;
5578
5579   case 259:
5580 #line 2482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5581     {
5582     (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
5583     CHECK_FOR_ERROR
5584   ;}
5585     break;
5586
5587   case 260:
5588 #line 2486 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5589     {
5590     (yyval.ValIDVal) = ValID::createNull();
5591     CHECK_FOR_ERROR
5592   ;}
5593     break;
5594
5595   case 261:
5596 #line 2490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5597     {
5598     (yyval.ValIDVal) = ValID::createUndef();
5599     CHECK_FOR_ERROR
5600   ;}
5601     break;
5602
5603   case 262:
5604 #line 2494 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5605     {     // A vector zero constant.
5606     (yyval.ValIDVal) = ValID::createZeroInit();
5607     CHECK_FOR_ERROR
5608   ;}
5609     break;
5610
5611   case 263:
5612 #line 2498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5613     { // Nonempty unsized packed vector
5614     const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5615     int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); 
5616     
5617     VectorType* pt = VectorType::get(ETy, NumElements);
5618     PATypeHolder* PTy = new PATypeHolder(
5619                                          HandleUpRefs(
5620                                             VectorType::get(
5621                                                 ETy, 
5622                                                 NumElements)
5623                                             )
5624                                          );
5625     
5626     // Verify all elements are correct type!
5627     for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5628       if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5629         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
5630                      ETy->getDescription() +"' as required!\nIt is of type '" +
5631                      (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5632     }
5633
5634     (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5635     delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5636     CHECK_FOR_ERROR
5637   ;}
5638     break;
5639
5640   case 264:
5641 #line 2523 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5642     {
5643     (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
5644     CHECK_FOR_ERROR
5645   ;}
5646     break;
5647
5648   case 265:
5649 #line 2527 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5650     {
5651     (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5652     delete (yyvsp[(3) - (5)].StrVal);
5653     delete (yyvsp[(5) - (5)].StrVal);
5654     CHECK_FOR_ERROR
5655   ;}
5656     break;
5657
5658   case 266:
5659 #line 2537 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5660     {  // Is it an integer reference...?
5661     (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
5662     CHECK_FOR_ERROR
5663   ;}
5664     break;
5665
5666   case 267:
5667 #line 2541 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5668     {
5669     (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
5670     CHECK_FOR_ERROR
5671   ;}
5672     break;
5673
5674   case 268:
5675 #line 2545 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5676     {                   // Is it a named reference...?
5677     (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5678     delete (yyvsp[(1) - (1)].StrVal);
5679     CHECK_FOR_ERROR
5680   ;}
5681     break;
5682
5683   case 269:
5684 #line 2550 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5685     {                   // Is it a named reference...?
5686     (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5687     delete (yyvsp[(1) - (1)].StrVal);
5688     CHECK_FOR_ERROR
5689   ;}
5690     break;
5691
5692   case 272:
5693 #line 2563 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5694     {
5695     if (!UpRefs.empty())
5696       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5697     (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); 
5698     delete (yyvsp[(1) - (2)].TypeVal);
5699     CHECK_FOR_ERROR
5700   ;}
5701     break;
5702
5703   case 273:
5704 #line 2572 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5705     {
5706     (yyval.ValueList) = new std::vector<Value *>();
5707     (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); 
5708     CHECK_FOR_ERROR
5709   ;}
5710     break;
5711
5712   case 274:
5713 #line 2577 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5714     {
5715     ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); 
5716     CHECK_FOR_ERROR
5717   ;}
5718     break;
5719
5720   case 275:
5721 #line 2582 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5722     {
5723     (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5724     CHECK_FOR_ERROR
5725   ;}
5726     break;
5727
5728   case 276:
5729 #line 2586 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5730     { // Do not allow functions with 0 basic blocks   
5731     (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
5732     CHECK_FOR_ERROR
5733   ;}
5734     break;
5735
5736   case 277:
5737 #line 2595 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5738     {
5739     setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5740     CHECK_FOR_ERROR
5741     InsertValue((yyvsp[(3) - (3)].TermInstVal));
5742     (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5743     (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
5744     CHECK_FOR_ERROR
5745   ;}
5746     break;
5747
5748   case 278:
5749 #line 2604 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5750     {
5751     if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5752       if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5753         if (CI2->getParent() == 0)
5754           (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5755     (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5756     (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5757     CHECK_FOR_ERROR
5758   ;}
5759     break;
5760
5761   case 279:
5762 #line 2613 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5763     {          // Empty space between instruction lists
5764     (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
5765     CHECK_FOR_ERROR
5766   ;}
5767     break;
5768
5769   case 280:
5770 #line 2617 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5771     {             // Labelled (named) basic block
5772     (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5773     delete (yyvsp[(1) - (1)].StrVal);
5774     CHECK_FOR_ERROR
5775
5776   ;}
5777     break;
5778
5779   case 281:
5780 #line 2625 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5781     { // Return with a result...
5782     ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5783     assert(!VL.empty() && "Invalid ret operands!");
5784     (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5785     delete (yyvsp[(2) - (2)].ValueList);
5786     CHECK_FOR_ERROR
5787   ;}
5788     break;
5789
5790   case 282:
5791 #line 2632 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5792     {                                    // Return with no result...
5793     (yyval.TermInstVal) = ReturnInst::Create();
5794     CHECK_FOR_ERROR
5795   ;}
5796     break;
5797
5798   case 283:
5799 #line 2636 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5800     {                           // Unconditional Branch...
5801     BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5802     CHECK_FOR_ERROR
5803     (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5804   ;}
5805     break;
5806
5807   case 284:
5808 #line 2641 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5809     {  
5810     assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5811     BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5812     CHECK_FOR_ERROR
5813     BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5814     CHECK_FOR_ERROR
5815     Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5816     CHECK_FOR_ERROR
5817     (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5818   ;}
5819     break;
5820
5821   case 285:
5822 #line 2651 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5823     {
5824     Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5825     CHECK_FOR_ERROR
5826     BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5827     CHECK_FOR_ERROR
5828     SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5829     (yyval.TermInstVal) = S;
5830
5831     std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5832       E = (yyvsp[(8) - (9)].JumpTable)->end();
5833     for (; I != E; ++I) {
5834       if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5835           S->addCase(CI, I->second);
5836       else
5837         GEN_ERROR("Switch case is constant, but not a simple integer");
5838     }
5839     delete (yyvsp[(8) - (9)].JumpTable);
5840     CHECK_FOR_ERROR
5841   ;}
5842     break;
5843
5844   case 286:
5845 #line 2670 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5846     {
5847     Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
5848     CHECK_FOR_ERROR
5849     BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
5850     CHECK_FOR_ERROR
5851     SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
5852     (yyval.TermInstVal) = S;
5853     CHECK_FOR_ERROR
5854   ;}
5855     break;
5856
5857   case 287:
5858 #line 2680 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5859     {
5860
5861     // Handle the short syntax
5862     const PointerType *PFTy = 0;
5863     const FunctionType *Ty = 0;
5864     if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
5865         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5866       // Pull out the types of all of the arguments...
5867       std::vector<const Type*> ParamTypes;
5868       ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
5869       for (; I != E; ++I) {
5870         const Type *Ty = I->Val->getType();
5871         if (Ty == Type::VoidTy)
5872           GEN_ERROR("Short call syntax cannot be used with varargs");
5873         ParamTypes.push_back(Ty);
5874       }
5875       
5876       if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5877         GEN_ERROR("Invalid result type for LLVM function");
5878
5879       Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
5880       PFTy = PointerType::getUnqual(Ty);
5881     }
5882
5883     delete (yyvsp[(3) - (14)].TypeVal);
5884
5885     Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal));   // Get the function we're calling...
5886     CHECK_FOR_ERROR
5887     BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
5888     CHECK_FOR_ERROR
5889     BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
5890     CHECK_FOR_ERROR
5891
5892     SmallVector<ParamAttrsWithIndex, 8> Attrs;
5893     if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5894       Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
5895
5896     // Check the arguments
5897     ValueList Args;
5898     if ((yyvsp[(6) - (14)].ParamList)->empty()) {                                   // Has no arguments?
5899       // Make sure no arguments is a good thing!
5900       if (Ty->getNumParams() != 0)
5901         GEN_ERROR("No arguments passed to a function that "
5902                        "expects arguments");
5903     } else {                                     // Has arguments?
5904       // Loop through FunctionType's arguments and ensure they are specified
5905       // correctly!
5906       FunctionType::param_iterator I = Ty->param_begin();
5907       FunctionType::param_iterator E = Ty->param_end();
5908       ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
5909       unsigned index = 1;
5910
5911       for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
5912         if (ArgI->Val->getType() != *I)
5913           GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5914                          (*I)->getDescription() + "'");
5915         Args.push_back(ArgI->Val);
5916         if (ArgI->Attrs != ParamAttr::None)
5917           Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5918       }
5919
5920       if (Ty->isVarArg()) {
5921         if (I == E)
5922           for (; ArgI != ArgE; ++ArgI, ++index) {
5923             Args.push_back(ArgI->Val); // push the remaining varargs
5924             if (ArgI->Attrs != ParamAttr::None)
5925               Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
5926           }
5927       } else if (I != E || ArgI != ArgE)
5928         GEN_ERROR("Invalid number of parameters detected");
5929     }
5930
5931     PAListPtr PAL;
5932     if (!Attrs.empty())
5933       PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
5934
5935     // Create the InvokeInst
5936     InvokeInst *II = InvokeInst::Create(V, Normal, Except,
5937                                         Args.begin(), Args.end());
5938     II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
5939     II->setParamAttrs(PAL);
5940     (yyval.TermInstVal) = II;
5941     delete (yyvsp[(6) - (14)].ParamList);
5942     CHECK_FOR_ERROR
5943   ;}
5944     break;
5945
5946   case 288:
5947 #line 2765 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5948     {
5949     (yyval.TermInstVal) = new UnwindInst();
5950     CHECK_FOR_ERROR
5951   ;}
5952     break;
5953
5954   case 289:
5955 #line 2769 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5956     {
5957     (yyval.TermInstVal) = new UnreachableInst();
5958     CHECK_FOR_ERROR
5959   ;}
5960     break;
5961
5962   case 290:
5963 #line 2776 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5964     {
5965     (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5966     Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
5967     CHECK_FOR_ERROR
5968     if (V == 0)
5969       GEN_ERROR("May only switch on a constant pool value");
5970
5971     BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
5972     CHECK_FOR_ERROR
5973     (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5974   ;}
5975     break;
5976
5977   case 291:
5978 #line 2787 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5979     {
5980     (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5981     Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
5982     CHECK_FOR_ERROR
5983
5984     if (V == 0)
5985       GEN_ERROR("May only switch on a constant pool value");
5986
5987     BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
5988     CHECK_FOR_ERROR
5989     (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); 
5990   ;}
5991     break;
5992
5993   case 292:
5994 #line 2800 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5995     {
5996     // Is this definition named?? if so, assign the name...
5997     setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
5998     CHECK_FOR_ERROR
5999     InsertValue((yyvsp[(2) - (2)].InstVal));
6000     (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6001     CHECK_FOR_ERROR
6002   ;}
6003     break;
6004
6005   case 293:
6006 #line 2810 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6007     {    // Used for PHI nodes
6008     if (!UpRefs.empty())
6009       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6010     (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6011     Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
6012     CHECK_FOR_ERROR
6013     BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6014     CHECK_FOR_ERROR
6015     (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6016     delete (yyvsp[(1) - (6)].TypeVal);
6017   ;}
6018     break;
6019
6020   case 294:
6021 #line 2821 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6022     {
6023     (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6024     Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
6025     CHECK_FOR_ERROR
6026     BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
6027     CHECK_FOR_ERROR
6028     (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6029   ;}
6030     break;
6031
6032   case 295:
6033 #line 2831 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6034     {
6035     // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6036     if (!UpRefs.empty())
6037       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
6038     // Used for call and invoke instructions
6039     (yyval.ParamList) = new ParamList();
6040     ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6041     (yyval.ParamList)->push_back(E);
6042     delete (yyvsp[(1) - (4)].TypeVal);
6043     CHECK_FOR_ERROR
6044   ;}
6045     break;
6046
6047   case 296:
6048 #line 2842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6049     {
6050     // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6051     // Labels are only valid in ASMs
6052     (yyval.ParamList) = new ParamList();
6053     ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6054     (yyval.ParamList)->push_back(E);
6055     CHECK_FOR_ERROR
6056   ;}
6057     break;
6058
6059   case 297:
6060 #line 2850 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6061     {
6062     // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6063     if (!UpRefs.empty())
6064       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6065     (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6066     ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6067     (yyval.ParamList)->push_back(E);
6068     delete (yyvsp[(3) - (6)].TypeVal);
6069     CHECK_FOR_ERROR
6070   ;}
6071     break;
6072
6073   case 298:
6074 #line 2860 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6075     {
6076     // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
6077     (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6078     ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6079     (yyval.ParamList)->push_back(E);
6080     CHECK_FOR_ERROR
6081   ;}
6082     break;
6083
6084   case 299:
6085 #line 2867 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6086     { (yyval.ParamList) = new ParamList(); ;}
6087     break;
6088
6089   case 300:
6090 #line 2870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6091     { (yyval.ValueList) = new std::vector<Value*>(); ;}
6092     break;
6093
6094   case 301:
6095 #line 2871 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6096     {
6097     (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6098     (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
6099     CHECK_FOR_ERROR
6100   ;}
6101     break;
6102
6103   case 302:
6104 #line 2878 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6105     {
6106     (yyval.BoolVal) = true;
6107     CHECK_FOR_ERROR
6108   ;}
6109     break;
6110
6111   case 303:
6112 #line 2882 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6113     {
6114     (yyval.BoolVal) = false;
6115     CHECK_FOR_ERROR
6116   ;}
6117     break;
6118
6119   case 304:
6120 #line 2887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6121     {
6122     if (!UpRefs.empty())
6123       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6124     if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && 
6125         !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
6126       GEN_ERROR(
6127         "Arithmetic operator requires integer, FP, or packed operands");
6128     Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); 
6129     CHECK_FOR_ERROR
6130     Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6131     CHECK_FOR_ERROR
6132     (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6133     if ((yyval.InstVal) == 0)
6134       GEN_ERROR("binary operator returned null");
6135     delete (yyvsp[(2) - (5)].TypeVal);
6136   ;}
6137     break;
6138
6139   case 305:
6140 #line 2903 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6141     {
6142     if (!UpRefs.empty())
6143       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6144     if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6145       if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6146           !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
6147         GEN_ERROR("Logical operator requires integral operands");
6148     }
6149     Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
6150     CHECK_FOR_ERROR
6151     Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
6152     CHECK_FOR_ERROR
6153     (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6154     if ((yyval.InstVal) == 0)
6155       GEN_ERROR("binary operator returned null");
6156     delete (yyvsp[(2) - (5)].TypeVal);
6157   ;}
6158     break;
6159
6160   case 306:
6161 #line 2920 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6162     {
6163     if (!UpRefs.empty())
6164       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6165     if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6166       GEN_ERROR("Vector types not supported by icmp instruction");
6167     Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6168     CHECK_FOR_ERROR
6169     Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6170     CHECK_FOR_ERROR
6171     (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6172     if ((yyval.InstVal) == 0)
6173       GEN_ERROR("icmp operator returned null");
6174     delete (yyvsp[(3) - (6)].TypeVal);
6175   ;}
6176     break;
6177
6178   case 307:
6179 #line 2934 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6180     {
6181     if (!UpRefs.empty())
6182       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6183     if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6184       GEN_ERROR("Vector types not supported by fcmp instruction");
6185     Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6186     CHECK_FOR_ERROR
6187     Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6188     CHECK_FOR_ERROR
6189     (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6190     if ((yyval.InstVal) == 0)
6191       GEN_ERROR("fcmp operator returned null");
6192     delete (yyvsp[(3) - (6)].TypeVal);
6193   ;}
6194     break;
6195
6196   case 308:
6197 #line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6198     {
6199     if (!UpRefs.empty())
6200       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6201     if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6202       GEN_ERROR("Scalar types not supported by vicmp instruction");
6203     Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6204     CHECK_FOR_ERROR
6205     Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6206     CHECK_FOR_ERROR
6207     (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6208     if ((yyval.InstVal) == 0)
6209       GEN_ERROR("icmp operator returned null");
6210     delete (yyvsp[(3) - (6)].TypeVal);
6211   ;}
6212     break;
6213
6214   case 309:
6215 #line 2962 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6216     {
6217     if (!UpRefs.empty())
6218       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6219     if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6220       GEN_ERROR("Scalar types not supported by vfcmp instruction");
6221     Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6222     CHECK_FOR_ERROR
6223     Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6224     CHECK_FOR_ERROR
6225     (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6226     if ((yyval.InstVal) == 0)
6227       GEN_ERROR("fcmp operator returned null");
6228     delete (yyvsp[(3) - (6)].TypeVal);
6229   ;}
6230     break;
6231
6232   case 310:
6233 #line 2976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6234     {
6235     if (!UpRefs.empty())
6236       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6237     Value* Val = (yyvsp[(2) - (4)].ValueVal);
6238     const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6239     if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
6240       GEN_ERROR("invalid cast opcode for cast from '" +
6241                 Val->getType()->getDescription() + "' to '" +
6242                 DestTy->getDescription() + "'"); 
6243     (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6244     delete (yyvsp[(4) - (4)].TypeVal);
6245   ;}
6246     break;
6247
6248   case 311:
6249 #line 2988 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6250     {
6251     if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6252       GEN_ERROR("select condition must be boolean");
6253     if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
6254       GEN_ERROR("select value types should match");
6255     (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6256     CHECK_FOR_ERROR
6257   ;}
6258     break;
6259
6260   case 312:
6261 #line 2996 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6262     {
6263     if (!UpRefs.empty())
6264       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6265     (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6266     delete (yyvsp[(4) - (4)].TypeVal);
6267     CHECK_FOR_ERROR
6268   ;}
6269     break;
6270
6271   case 313:
6272 #line 3003 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6273     {
6274     if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
6275       GEN_ERROR("Invalid extractelement operands");
6276     (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
6277     CHECK_FOR_ERROR
6278   ;}
6279     break;
6280
6281   case 314:
6282 #line 3009 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6283     {
6284     if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6285       GEN_ERROR("Invalid insertelement operands");
6286     (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6287     CHECK_FOR_ERROR
6288   ;}
6289     break;
6290
6291   case 315:
6292 #line 3015 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6293     {
6294     if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
6295       GEN_ERROR("Invalid shufflevector operands");
6296     (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
6297     CHECK_FOR_ERROR
6298   ;}
6299     break;
6300
6301   case 316:
6302 #line 3021 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6303     {
6304     const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
6305     if (!Ty->isFirstClassType())
6306       GEN_ERROR("PHI node operands must be of first class type");
6307     (yyval.InstVal) = PHINode::Create(Ty);
6308     ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6309     while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6310       if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) 
6311         GEN_ERROR("All elements of a PHI node must be of the same type");
6312       cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6313       (yyvsp[(2) - (2)].PHIList)->pop_front();
6314     }
6315     delete (yyvsp[(2) - (2)].PHIList);  // Free the list...
6316     CHECK_FOR_ERROR
6317   ;}
6318     break;
6319
6320   case 317:
6321 #line 3037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6322     {
6323
6324     // Handle the short syntax
6325     const PointerType *PFTy = 0;
6326     const FunctionType *Ty = 0;
6327     if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
6328         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6329       // Pull out the types of all of the arguments...
6330       std::vector<const Type*> ParamTypes;
6331       ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
6332       for (; I != E; ++I) {
6333         const Type *Ty = I->Val->getType();
6334         if (Ty == Type::VoidTy)
6335           GEN_ERROR("Short call syntax cannot be used with varargs");
6336         ParamTypes.push_back(Ty);
6337       }
6338
6339       if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6340         GEN_ERROR("Invalid result type for LLVM function");
6341
6342       Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
6343       PFTy = PointerType::getUnqual(Ty);
6344     }
6345
6346     Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal));   // Get the function we're calling...
6347     CHECK_FOR_ERROR
6348
6349     // Check for call to invalid intrinsic to avoid crashing later.
6350     if (Function *theF = dyn_cast<Function>(V)) {
6351       if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6352           (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6353           !theF->getIntrinsicID(true))
6354         GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6355                   theF->getName() + "'");
6356     }
6357
6358     // Set up the ParamAttrs for the function
6359     SmallVector<ParamAttrsWithIndex, 8> Attrs;
6360     if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6361       Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
6362     // Check the arguments 
6363     ValueList Args;
6364     if ((yyvsp[(6) - (8)].ParamList)->empty()) {                                   // Has no arguments?
6365       // Make sure no arguments is a good thing!
6366       if (Ty->getNumParams() != 0)
6367         GEN_ERROR("No arguments passed to a function that "
6368                        "expects arguments");
6369     } else {                                     // Has arguments?
6370       // Loop through FunctionType's arguments and ensure they are specified
6371       // correctly.  Also, gather any parameter attributes.
6372       FunctionType::param_iterator I = Ty->param_begin();
6373       FunctionType::param_iterator E = Ty->param_end();
6374       ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
6375       unsigned index = 1;
6376
6377       for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
6378         if (ArgI->Val->getType() != *I)
6379           GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6380                          (*I)->getDescription() + "'");
6381         Args.push_back(ArgI->Val);
6382         if (ArgI->Attrs != ParamAttr::None)
6383           Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6384       }
6385       if (Ty->isVarArg()) {
6386         if (I == E)
6387           for (; ArgI != ArgE; ++ArgI, ++index) {
6388             Args.push_back(ArgI->Val); // push the remaining varargs
6389             if (ArgI->Attrs != ParamAttr::None)
6390               Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
6391           }
6392       } else if (I != E || ArgI != ArgE)
6393         GEN_ERROR("Invalid number of parameters detected");
6394     }
6395
6396     // Finish off the ParamAttrs and check them
6397     PAListPtr PAL;
6398     if (!Attrs.empty())
6399       PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
6400
6401     // Create the call node
6402     CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
6403     CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6404     CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
6405     CI->setParamAttrs(PAL);
6406     (yyval.InstVal) = CI;
6407     delete (yyvsp[(6) - (8)].ParamList);
6408     delete (yyvsp[(3) - (8)].TypeVal);
6409     CHECK_FOR_ERROR
6410   ;}
6411     break;
6412
6413   case 318:
6414 #line 3126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6415     {
6416     (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
6417     CHECK_FOR_ERROR
6418   ;}
6419     break;
6420
6421   case 319:
6422 #line 3131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6423     {
6424     (yyval.BoolVal) = true;
6425     CHECK_FOR_ERROR
6426   ;}
6427     break;
6428
6429   case 320:
6430 #line 3135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6431     {
6432     (yyval.BoolVal) = false;
6433     CHECK_FOR_ERROR
6434   ;}
6435     break;
6436
6437   case 321:
6438 #line 3142 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6439     {
6440     if (!UpRefs.empty())
6441       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6442     (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6443     delete (yyvsp[(2) - (3)].TypeVal);
6444     CHECK_FOR_ERROR
6445   ;}
6446     break;
6447
6448   case 322:
6449 #line 3149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6450     {
6451     if (!UpRefs.empty())
6452       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6453     Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6454     CHECK_FOR_ERROR
6455     (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6456     delete (yyvsp[(2) - (6)].TypeVal);
6457   ;}
6458     break;
6459
6460   case 323:
6461 #line 3157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6462     {
6463     if (!UpRefs.empty())
6464       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6465     (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6466     delete (yyvsp[(2) - (3)].TypeVal);
6467     CHECK_FOR_ERROR
6468   ;}
6469     break;
6470
6471   case 324:
6472 #line 3164 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6473     {
6474     if (!UpRefs.empty())
6475       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6476     Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
6477     CHECK_FOR_ERROR
6478     (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6479     delete (yyvsp[(2) - (6)].TypeVal);
6480   ;}
6481     break;
6482
6483   case 325:
6484 #line 3172 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6485     {
6486     if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
6487       GEN_ERROR("Trying to free nonpointer type " + 
6488                      (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6489     (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
6490     CHECK_FOR_ERROR
6491   ;}
6492     break;
6493
6494   case 326:
6495 #line 3180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6496     {
6497     if (!UpRefs.empty())
6498       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6499     if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
6500       GEN_ERROR("Can't load from nonpointer type: " +
6501                      (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6502     if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
6503       GEN_ERROR("Can't load from pointer of non-first-class type: " +
6504                      (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6505     Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
6506     CHECK_FOR_ERROR
6507     (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6508     delete (yyvsp[(3) - (5)].TypeVal);
6509   ;}
6510     break;
6511
6512   case 327:
6513 #line 3194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6514     {
6515     if (!UpRefs.empty())
6516       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6517     const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
6518     if (!PT)
6519       GEN_ERROR("Can't store to a nonpointer type: " +
6520                      (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6521     const Type *ElTy = PT->getElementType();
6522     if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6523       GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
6524                      "' into space of type '" + ElTy->getDescription() + "'");
6525
6526     Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6527     CHECK_FOR_ERROR
6528     (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6529     delete (yyvsp[(5) - (7)].TypeVal);
6530   ;}
6531     break;
6532
6533   case 328:
6534 #line 3211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6535     {
6536   Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6537   if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
6538       GEN_ERROR("Invalid getresult operands");
6539     (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6540     delete (yyvsp[(2) - (5)].TypeVal);
6541     CHECK_FOR_ERROR
6542   ;}
6543     break;
6544
6545   case 329:
6546 #line 3219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6547     {
6548     if (!UpRefs.empty())
6549       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6550     if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
6551       GEN_ERROR("getelementptr insn requires pointer operand");
6552
6553     if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6554       GEN_ERROR("Invalid getelementptr indices for type '" +
6555                      (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6556     Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6557     CHECK_FOR_ERROR
6558     (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6559     delete (yyvsp[(2) - (4)].TypeVal); 
6560     delete (yyvsp[(4) - (4)].ValueList);
6561   ;}
6562     break;
6563
6564   case 330:
6565 #line 3234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6566     {
6567     if (!UpRefs.empty())
6568       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6569     if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6570       GEN_ERROR("extractvalue insn requires an aggregate operand");
6571
6572     if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6573       GEN_ERROR("Invalid extractvalue indices for type '" +
6574                      (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6575     Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6576     CHECK_FOR_ERROR
6577     (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6578     delete (yyvsp[(2) - (4)].TypeVal); 
6579     delete (yyvsp[(4) - (4)].ValueList);
6580   ;}
6581     break;
6582
6583   case 331:
6584 #line 3249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6585     {
6586     if (!UpRefs.empty())
6587       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6588     if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6589       GEN_ERROR("extractvalue insn requires an aggregate operand");
6590
6591     if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ValueList)->begin(), (yyvsp[(7) - (7)].ValueList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
6592       GEN_ERROR("Invalid insertvalue indices for type '" +
6593                      (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6594     Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6595     Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6596     CHECK_FOR_ERROR
6597     (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ValueList)->begin(), (yyvsp[(7) - (7)].ValueList)->end());
6598     delete (yyvsp[(2) - (7)].TypeVal); 
6599     delete (yyvsp[(5) - (7)].TypeVal);
6600     delete (yyvsp[(7) - (7)].ValueList);
6601   ;}
6602     break;
6603
6604
6605 /* Line 1267 of yacc.c.  */
6606 #line 6607 "llvmAsmParser.tab.c"
6607       default: break;
6608     }
6609   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6610
6611   YYPOPSTACK (yylen);
6612   yylen = 0;
6613   YY_STACK_PRINT (yyss, yyssp);
6614
6615   *++yyvsp = yyval;
6616
6617
6618   /* Now `shift' the result of the reduction.  Determine what state
6619      that goes to, based on the state we popped back to and the rule
6620      number reduced by.  */
6621
6622   yyn = yyr1[yyn];
6623
6624   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6625   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
6626     yystate = yytable[yystate];
6627   else
6628     yystate = yydefgoto[yyn - YYNTOKENS];
6629
6630   goto yynewstate;
6631
6632
6633 /*------------------------------------.
6634 | yyerrlab -- here on detecting error |
6635 `------------------------------------*/
6636 yyerrlab:
6637   /* If not already recovering from an error, report this error.  */
6638   if (!yyerrstatus)
6639     {
6640       ++yynerrs;
6641 #if ! YYERROR_VERBOSE
6642       yyerror (YY_("syntax error"));
6643 #else
6644       {
6645         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6646         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6647           {
6648             YYSIZE_T yyalloc = 2 * yysize;
6649             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6650               yyalloc = YYSTACK_ALLOC_MAXIMUM;
6651             if (yymsg != yymsgbuf)
6652               YYSTACK_FREE (yymsg);
6653             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6654             if (yymsg)
6655               yymsg_alloc = yyalloc;
6656             else
6657               {
6658                 yymsg = yymsgbuf;
6659                 yymsg_alloc = sizeof yymsgbuf;
6660               }
6661           }
6662
6663         if (0 < yysize && yysize <= yymsg_alloc)
6664           {
6665             (void) yysyntax_error (yymsg, yystate, yychar);
6666             yyerror (yymsg);
6667           }
6668         else
6669           {
6670             yyerror (YY_("syntax error"));
6671             if (yysize != 0)
6672               goto yyexhaustedlab;
6673           }
6674       }
6675 #endif
6676     }
6677
6678
6679
6680   if (yyerrstatus == 3)
6681     {
6682       /* If just tried and failed to reuse look-ahead token after an
6683          error, discard it.  */
6684
6685       if (yychar <= YYEOF)
6686         {
6687           /* Return failure if at end of input.  */
6688           if (yychar == YYEOF)
6689             YYABORT;
6690         }
6691       else
6692         {
6693           yydestruct ("Error: discarding",
6694                       yytoken, &yylval);
6695           yychar = YYEMPTY;
6696         }
6697     }
6698
6699   /* Else will try to reuse look-ahead token after shifting the error
6700      token.  */
6701   goto yyerrlab1;
6702
6703
6704 /*---------------------------------------------------.
6705 | yyerrorlab -- error raised explicitly by YYERROR.  |
6706 `---------------------------------------------------*/
6707 yyerrorlab:
6708
6709   /* Pacify compilers like GCC when the user code never invokes
6710      YYERROR and the label yyerrorlab therefore never appears in user
6711      code.  */
6712   if (/*CONSTCOND*/ 0)
6713      goto yyerrorlab;
6714
6715   /* Do not reclaim the symbols of the rule which action triggered
6716      this YYERROR.  */
6717   YYPOPSTACK (yylen);
6718   yylen = 0;
6719   YY_STACK_PRINT (yyss, yyssp);
6720   yystate = *yyssp;
6721   goto yyerrlab1;
6722
6723
6724 /*-------------------------------------------------------------.
6725 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
6726 `-------------------------------------------------------------*/
6727 yyerrlab1:
6728   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
6729
6730   for (;;)
6731     {
6732       yyn = yypact[yystate];
6733       if (yyn != YYPACT_NINF)
6734         {
6735           yyn += YYTERROR;
6736           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6737             {
6738               yyn = yytable[yyn];
6739               if (0 < yyn)
6740                 break;
6741             }
6742         }
6743
6744       /* Pop the current state because it cannot handle the error token.  */
6745       if (yyssp == yyss)
6746         YYABORT;
6747
6748
6749       yydestruct ("Error: popping",
6750                   yystos[yystate], yyvsp);
6751       YYPOPSTACK (1);
6752       yystate = *yyssp;
6753       YY_STACK_PRINT (yyss, yyssp);
6754     }
6755
6756   if (yyn == YYFINAL)
6757     YYACCEPT;
6758
6759   *++yyvsp = yylval;
6760
6761
6762   /* Shift the error token.  */
6763   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
6764
6765   yystate = yyn;
6766   goto yynewstate;
6767
6768
6769 /*-------------------------------------.
6770 | yyacceptlab -- YYACCEPT comes here.  |
6771 `-------------------------------------*/
6772 yyacceptlab:
6773   yyresult = 0;
6774   goto yyreturn;
6775
6776 /*-----------------------------------.
6777 | yyabortlab -- YYABORT comes here.  |
6778 `-----------------------------------*/
6779 yyabortlab:
6780   yyresult = 1;
6781   goto yyreturn;
6782
6783 #ifndef yyoverflow
6784 /*-------------------------------------------------.
6785 | yyexhaustedlab -- memory exhaustion comes here.  |
6786 `-------------------------------------------------*/
6787 yyexhaustedlab:
6788   yyerror (YY_("memory exhausted"));
6789   yyresult = 2;
6790   /* Fall through.  */
6791 #endif
6792
6793 yyreturn:
6794   if (yychar != YYEOF && yychar != YYEMPTY)
6795      yydestruct ("Cleanup: discarding lookahead",
6796                  yytoken, &yylval);
6797   /* Do not reclaim the symbols of the rule which action triggered
6798      this YYABORT or YYACCEPT.  */
6799   YYPOPSTACK (yylen);
6800   YY_STACK_PRINT (yyss, yyssp);
6801   while (yyssp != yyss)
6802     {
6803       yydestruct ("Cleanup: popping",
6804                   yystos[*yyssp], yyvsp);
6805       YYPOPSTACK (1);
6806     }
6807 #ifndef yyoverflow
6808   if (yyss != yyssa)
6809     YYSTACK_FREE (yyss);
6810 #endif
6811 #if YYERROR_VERBOSE
6812   if (yymsg != yymsgbuf)
6813     YYSTACK_FREE (yymsg);
6814 #endif
6815   /* Make sure YYID is used.  */
6816   return YYID (yyresult);
6817 }
6818
6819
6820 #line 3268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6821
6822
6823 // common code from the two 'RunVMAsmParser' functions
6824 static Module* RunParser(Module * M) {
6825   CurModule.CurrentModule = M;
6826   // Check to make sure the parser succeeded
6827   if (yyparse()) {
6828     if (ParserResult)
6829       delete ParserResult;
6830     return 0;
6831   }
6832
6833   // Emit an error if there are any unresolved types left.
6834   if (!CurModule.LateResolveTypes.empty()) {
6835     const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6836     if (DID.Type == ValID::LocalName) {
6837       GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6838     } else {
6839       GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6840     }
6841     if (ParserResult)
6842       delete ParserResult;
6843     return 0;
6844   }
6845
6846   // Emit an error if there are any unresolved values left.
6847   if (!CurModule.LateResolveValues.empty()) {
6848     Value *V = CurModule.LateResolveValues.back();
6849     std::map<Value*, std::pair<ValID, int> >::iterator I =
6850       CurModule.PlaceHolderInfo.find(V);
6851
6852     if (I != CurModule.PlaceHolderInfo.end()) {
6853       ValID &DID = I->second.first;
6854       if (DID.Type == ValID::LocalName) {
6855         GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6856       } else {
6857         GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6858       }
6859       if (ParserResult)
6860         delete ParserResult;
6861       return 0;
6862     }
6863   }
6864
6865   // Check to make sure that parsing produced a result
6866   if (!ParserResult)
6867     return 0;
6868
6869   // Reset ParserResult variable while saving its value for the result.
6870   Module *Result = ParserResult;
6871   ParserResult = 0;
6872
6873   return Result;
6874 }
6875
6876 void llvm::GenerateError(const std::string &message, int LineNo) {
6877   if (LineNo == -1) LineNo = LLLgetLineNo();
6878   // TODO: column number in exception
6879   if (TheParseError)
6880     TheParseError->setError(LLLgetFilename(), message, LineNo);
6881   TriggerError = 1;
6882 }
6883
6884 int yyerror(const char *ErrorMsg) {
6885   std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
6886   std::string errMsg = where + "error: " + std::string(ErrorMsg);
6887   if (yychar != YYEMPTY && yychar != 0) {
6888     errMsg += " while reading token: '";
6889     errMsg += std::string(LLLgetTokenStart(), 
6890                           LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6891   }
6892   GenerateError(errMsg);
6893   return 0;
6894 }
6895