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