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