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