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