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