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