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