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