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