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