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