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