Fix a bunch of missing semicolon parse errors from bison.
[oota-llvm.git] / tools / llvm-upgrade / UpgradeParser.cpp.cvs
1 /* A Bison parser, made from /usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y, by GNU bison 1.75.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 /* As a special exception, when this file is copied by Bison into a
22    Bison output file, you may use that output file without restriction.
23    This special exception was added by the Free Software Foundation
24    in version 1.24 of Bison.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30    infringing on user name space.  This should be done even for local
31    variables, as they might otherwise be expanded by user macros.
32    There are some unavoidable exceptions within include files to
33    define necessary library symbols; they are noted "INFRINGES ON
34    USER NAME SPACE" below.  */
35
36 /* Identify Bison output.  */
37 #define YYBISON 1
38
39 /* Pure parsers.  */
40 #define YYPURE  0
41
42 /* Using locations.  */
43 #define YYLSP_NEEDED 0
44
45 /* If NAME_PREFIX is specified substitute the variables and functions
46    names.  */
47 #define yyparse Upgradeparse
48 #define yylex   Upgradelex
49 #define yyerror Upgradeerror
50 #define yylval  Upgradelval
51 #define yychar  Upgradechar
52 #define yydebug Upgradedebug
53 #define yynerrs Upgradenerrs
54
55
56 /* Tokens.  */
57 #ifndef YYTOKENTYPE
58 # define YYTOKENTYPE
59    /* Put the tokens into the symbol table, so that GDB and other debuggers
60       know about them.  */
61    enum yytokentype {
62      VOID = 258,
63      BOOL = 259,
64      SBYTE = 260,
65      UBYTE = 261,
66      SHORT = 262,
67      USHORT = 263,
68      INT = 264,
69      UINT = 265,
70      LONG = 266,
71      ULONG = 267,
72      FLOAT = 268,
73      DOUBLE = 269,
74      LABEL = 270,
75      OPAQUE = 271,
76      ESINT64VAL = 272,
77      EUINT64VAL = 273,
78      SINTVAL = 274,
79      UINTVAL = 275,
80      FPVAL = 276,
81      NULL_TOK = 277,
82      UNDEF = 278,
83      ZEROINITIALIZER = 279,
84      TRUETOK = 280,
85      FALSETOK = 281,
86      TYPE = 282,
87      VAR_ID = 283,
88      LABELSTR = 284,
89      STRINGCONSTANT = 285,
90      IMPLEMENTATION = 286,
91      BEGINTOK = 287,
92      ENDTOK = 288,
93      DECLARE = 289,
94      GLOBAL = 290,
95      CONSTANT = 291,
96      SECTION = 292,
97      VOLATILE = 293,
98      TO = 294,
99      DOTDOTDOT = 295,
100      CONST = 296,
101      INTERNAL = 297,
102      LINKONCE = 298,
103      WEAK = 299,
104      DLLIMPORT = 300,
105      DLLEXPORT = 301,
106      EXTERN_WEAK = 302,
107      APPENDING = 303,
108      EXTERNAL = 304,
109      TARGET = 305,
110      TRIPLE = 306,
111      ENDIAN = 307,
112      POINTERSIZE = 308,
113      LITTLE = 309,
114      BIG = 310,
115      ALIGN = 311,
116      UNINITIALIZED = 312,
117      DEPLIBS = 313,
118      CALL = 314,
119      TAIL = 315,
120      ASM_TOK = 316,
121      MODULE = 317,
122      SIDEEFFECT = 318,
123      CC_TOK = 319,
124      CCC_TOK = 320,
125      CSRETCC_TOK = 321,
126      FASTCC_TOK = 322,
127      COLDCC_TOK = 323,
128      X86_STDCALLCC_TOK = 324,
129      X86_FASTCALLCC_TOK = 325,
130      DATALAYOUT = 326,
131      RET = 327,
132      BR = 328,
133      SWITCH = 329,
134      INVOKE = 330,
135      EXCEPT = 331,
136      UNWIND = 332,
137      UNREACHABLE = 333,
138      ADD = 334,
139      SUB = 335,
140      MUL = 336,
141      DIV = 337,
142      UDIV = 338,
143      SDIV = 339,
144      FDIV = 340,
145      REM = 341,
146      UREM = 342,
147      SREM = 343,
148      FREM = 344,
149      AND = 345,
150      OR = 346,
151      XOR = 347,
152      SETLE = 348,
153      SETGE = 349,
154      SETLT = 350,
155      SETGT = 351,
156      SETEQ = 352,
157      SETNE = 353,
158      ICMP = 354,
159      FCMP = 355,
160      EQ = 356,
161      NE = 357,
162      SLT = 358,
163      SGT = 359,
164      SLE = 360,
165      SGE = 361,
166      OEQ = 362,
167      ONE = 363,
168      OLT = 364,
169      OGT = 365,
170      OLE = 366,
171      OGE = 367,
172      ORD = 368,
173      UNO = 369,
174      UEQ = 370,
175      UNE = 371,
176      ULT = 372,
177      UGT = 373,
178      ULE = 374,
179      UGE = 375,
180      MALLOC = 376,
181      ALLOCA = 377,
182      FREE = 378,
183      LOAD = 379,
184      STORE = 380,
185      GETELEMENTPTR = 381,
186      PHI_TOK = 382,
187      SELECT = 383,
188      SHL = 384,
189      SHR = 385,
190      ASHR = 386,
191      LSHR = 387,
192      VAARG = 388,
193      EXTRACTELEMENT = 389,
194      INSERTELEMENT = 390,
195      SHUFFLEVECTOR = 391,
196      CAST = 392,
197      TRUNC = 393,
198      ZEXT = 394,
199      SEXT = 395,
200      FPTRUNC = 396,
201      FPEXT = 397,
202      FPTOUI = 398,
203      FPTOSI = 399,
204      UITOFP = 400,
205      SITOFP = 401,
206      PTRTOINT = 402,
207      INTTOPTR = 403,
208      BITCAST = 404
209    };
210 #endif
211 #define VOID 258
212 #define BOOL 259
213 #define SBYTE 260
214 #define UBYTE 261
215 #define SHORT 262
216 #define USHORT 263
217 #define INT 264
218 #define UINT 265
219 #define LONG 266
220 #define ULONG 267
221 #define FLOAT 268
222 #define DOUBLE 269
223 #define LABEL 270
224 #define OPAQUE 271
225 #define ESINT64VAL 272
226 #define EUINT64VAL 273
227 #define SINTVAL 274
228 #define UINTVAL 275
229 #define FPVAL 276
230 #define NULL_TOK 277
231 #define UNDEF 278
232 #define ZEROINITIALIZER 279
233 #define TRUETOK 280
234 #define FALSETOK 281
235 #define TYPE 282
236 #define VAR_ID 283
237 #define LABELSTR 284
238 #define STRINGCONSTANT 285
239 #define IMPLEMENTATION 286
240 #define BEGINTOK 287
241 #define ENDTOK 288
242 #define DECLARE 289
243 #define GLOBAL 290
244 #define CONSTANT 291
245 #define SECTION 292
246 #define VOLATILE 293
247 #define TO 294
248 #define DOTDOTDOT 295
249 #define CONST 296
250 #define INTERNAL 297
251 #define LINKONCE 298
252 #define WEAK 299
253 #define DLLIMPORT 300
254 #define DLLEXPORT 301
255 #define EXTERN_WEAK 302
256 #define APPENDING 303
257 #define EXTERNAL 304
258 #define TARGET 305
259 #define TRIPLE 306
260 #define ENDIAN 307
261 #define POINTERSIZE 308
262 #define LITTLE 309
263 #define BIG 310
264 #define ALIGN 311
265 #define UNINITIALIZED 312
266 #define DEPLIBS 313
267 #define CALL 314
268 #define TAIL 315
269 #define ASM_TOK 316
270 #define MODULE 317
271 #define SIDEEFFECT 318
272 #define CC_TOK 319
273 #define CCC_TOK 320
274 #define CSRETCC_TOK 321
275 #define FASTCC_TOK 322
276 #define COLDCC_TOK 323
277 #define X86_STDCALLCC_TOK 324
278 #define X86_FASTCALLCC_TOK 325
279 #define DATALAYOUT 326
280 #define RET 327
281 #define BR 328
282 #define SWITCH 329
283 #define INVOKE 330
284 #define EXCEPT 331
285 #define UNWIND 332
286 #define UNREACHABLE 333
287 #define ADD 334
288 #define SUB 335
289 #define MUL 336
290 #define DIV 337
291 #define UDIV 338
292 #define SDIV 339
293 #define FDIV 340
294 #define REM 341
295 #define UREM 342
296 #define SREM 343
297 #define FREM 344
298 #define AND 345
299 #define OR 346
300 #define XOR 347
301 #define SETLE 348
302 #define SETGE 349
303 #define SETLT 350
304 #define SETGT 351
305 #define SETEQ 352
306 #define SETNE 353
307 #define ICMP 354
308 #define FCMP 355
309 #define EQ 356
310 #define NE 357
311 #define SLT 358
312 #define SGT 359
313 #define SLE 360
314 #define SGE 361
315 #define OEQ 362
316 #define ONE 363
317 #define OLT 364
318 #define OGT 365
319 #define OLE 366
320 #define OGE 367
321 #define ORD 368
322 #define UNO 369
323 #define UEQ 370
324 #define UNE 371
325 #define ULT 372
326 #define UGT 373
327 #define ULE 374
328 #define UGE 375
329 #define MALLOC 376
330 #define ALLOCA 377
331 #define FREE 378
332 #define LOAD 379
333 #define STORE 380
334 #define GETELEMENTPTR 381
335 #define PHI_TOK 382
336 #define SELECT 383
337 #define SHL 384
338 #define SHR 385
339 #define ASHR 386
340 #define LSHR 387
341 #define VAARG 388
342 #define EXTRACTELEMENT 389
343 #define INSERTELEMENT 390
344 #define SHUFFLEVECTOR 391
345 #define CAST 392
346 #define TRUNC 393
347 #define ZEXT 394
348 #define SEXT 395
349 #define FPTRUNC 396
350 #define FPEXT 397
351 #define FPTOUI 398
352 #define FPTOSI 399
353 #define UITOFP 400
354 #define SITOFP 401
355 #define PTRTOINT 402
356 #define INTTOPTR 403
357 #define BITCAST 404
358
359
360
361
362 /* Copy the first part of user declarations.  */
363 #line 14 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
364
365 #include "UpgradeInternals.h"
366 #include <algorithm>
367 #include <map>
368 #include <utility>
369 #include <iostream>
370
371 #define YYERROR_VERBOSE 1
372 #define YYINCLUDED_STDLIB_H
373 #define YYDEBUG 1
374
375 int yylex();                       // declaration" of xxx warnings.
376 int yyparse();
377 extern int yydebug;
378
379 static std::string CurFilename;
380 static std::ostream *O = 0;
381 std::istream* LexInput = 0;
382 unsigned SizeOfPointer = 32;
383
384
385 // This bool controls whether attributes are ever added to function declarations
386 // definitions and calls.
387 static bool AddAttributes = false;
388
389 static void warning(const std::string& msg);
390
391 void UpgradeAssembly(const std::string &infile, std::istream& in, 
392                      std::ostream &out, bool debug, bool addAttrs)
393 {
394   Upgradelineno = 1; 
395   CurFilename = infile;
396   LexInput = &in;
397   yydebug = debug;
398   AddAttributes = addAttrs;
399   O = &out;
400
401   if (yyparse()) {
402     std::cerr << "llvm-upgrade: parse failed.\n";
403     out << "llvm-upgrade: parse failed.\n";
404     exit(1);
405   }
406 }
407
408 namespace { // Anonymous namespace to keep our implementation local
409
410
411 /// This type is used to keep track of the signedness of values. Instead
412 /// of creating llvm::Value directly, the parser will create Value which
413 /// associates a Value* with a Signedness indication.
414 struct Value {
415   std::string* val;
416   const Type* type;
417   bool constant;
418   bool isConstant() const { return constant; }
419   ~Value() { delete val; }
420 };
421
422
423 /// This type is used to keep track of the signedness of the obsolete
424 /// integer types. Instead of creating an llvm::Type directly, the Lexer will
425 /// create instances of Type which retains the signedness indication so
426 /// it can be used by the parser for upgrade decisions.
427 /// For example if "uint" is encountered then the "first" field will be set 
428 /// to "int32" and the "second" field will be set to "isUnsigned".  If the 
429 /// type is not obsolete then "second" will be set to "isSignless".
430 class Type {
431 public:
432   static const Type* get(const std::string &newType, TypeIDs oldType);
433   static const Type* get(const std::string& newType, TypeIDs oldType, 
434                              const Type* eTy, const Type* rTy);
435
436   static const Type* get(const std::string& newType, TypeIDs oldType, 
437                              const Type *eTy, uint64_t elems);
438
439   static const Type* get(const std::string& newType, TypeIDs oldType, 
440                              TypeList* TL);
441
442   static const Type* get(const std::string& newType, const Type* resTy, 
443                              TypeList* TL);
444
445   const Type* resolve() const;
446   bool operator<(const Type& that) const;
447
448   bool sameNewTyAs(const Type* that) const {
449     return this->newTy == that->newTy;
450   }
451
452   bool sameOldTyAs(const Type* that) const;
453
454   TypeIDs getElementTy() const {
455     if (elemTy) {
456       return elemTy->oldTy;
457     }
458     return UnresolvedTy;
459   }
460
461   unsigned getUpRefNum() const {
462     assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference");
463     return atoi(&((getNewTy().c_str())[1])); // skip the slash
464   }
465
466   typedef std::vector<const Type*> UpRefStack;
467   void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const;
468   std::string makeUniqueName(const std::string& BaseName) const;
469
470   const std::string& getNewTy() const { return newTy; }
471   const Type* getResultType() const { return resultTy; }
472   const Type* getElementType() const { return elemTy; }
473
474   const Type* getPointerType() const {
475     return get(newTy + "*", PointerTy, this, (Type*)0);
476   }
477
478   bool isUnresolved() const { return oldTy == UnresolvedTy; }
479   bool isUpReference() const { return oldTy == UpRefTy; }
480   bool isVoid() const { return oldTy == VoidTy; }
481   bool isBool() const { return oldTy == BoolTy; }
482   bool isSigned() const {
483     return oldTy == SByteTy || oldTy == ShortTy || 
484            oldTy == IntTy || oldTy == LongTy;
485   }
486
487   bool isUnsigned() const {
488     return oldTy == UByteTy || oldTy == UShortTy || 
489            oldTy == UIntTy || oldTy == ULongTy;
490   }
491   bool isSignless() const { return !isSigned() && !isUnsigned(); }
492   bool isInteger() const { return isSigned() || isUnsigned(); }
493   bool isIntegral() const { return oldTy == BoolTy || isInteger(); }
494   bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; }
495   bool isPacked() const { return oldTy == PackedTy; }
496   bool isPointer() const { return oldTy == PointerTy; }
497   bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; }
498   bool isArray() const { return oldTy == ArrayTy; }
499   bool isOther() const { 
500     return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); }
501   bool isFunction() const { return oldTy == FunctionTy; }
502   bool isComposite() const {
503     return isStruct() || isPointer() || isArray() || isPacked();
504   }
505
506   bool isAttributeCandidate() const {
507     return isIntegral() && getBitWidth() < 32;
508   }
509
510   bool isUnresolvedDeep() const;
511
512   unsigned getBitWidth() const;
513
514   const Type* getIndexedType(const Value*  V) const;
515
516   unsigned getNumStructElements() const { 
517     return (elements ? elements->size() : 0);
518   }
519
520   const Type* getElement(unsigned idx) const {
521     if (elements)
522       if (idx < elements->size())
523         return (*elements)[idx];
524     return 0;
525   }
526
527 private:
528   Type() 
529     : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
530       nelems(0) {
531   }
532
533   Type(const Type& that); // do not implement
534   Type& operator=(const Type& that); // do not implement
535
536   ~Type() { delete elements; }
537
538   struct ltfunctor
539   {
540     bool operator()(const Type* X, const Type* Y) const {
541       assert(X && "Can't compare null pointer");
542       assert(Y && "Can't compare null pointer");
543       return *X < *Y;
544     }
545   };
546
547   typedef std::set<const Type*, ltfunctor> TypeRegMap;
548
549   static const Type* add_new_type(Type* existing);
550
551   std::string newTy;
552   TypeIDs oldTy;
553   Type *elemTy;
554   Type *resultTy;
555   TypeList *elements;
556   uint64_t nelems;
557   static TypeRegMap registry;
558 public:
559   typedef std::vector<const Type*> TypeVector;
560   typedef std::map<std::string,const Type*> TypeMap;
561   typedef std::map<const Type*,std::string> TypePlaneMap;
562   typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
563   static TypeVector EnumeratedTypes;
564   static TypeMap NamedTypes;
565   static GlobalsTypeMap Globals;
566 };
567
568 Type::TypeRegMap     Type::registry;
569 Type::TypeVector     Type::EnumeratedTypes;
570 Type::TypeMap        Type::NamedTypes;
571 Type::GlobalsTypeMap Type::Globals;
572
573 const Type* Type::get(const std::string &newType, TypeIDs oldType) {
574   Type* Ty = new Type();
575   Ty->newTy = newType;
576   Ty->oldTy = oldType;
577   return add_new_type(Ty);
578 }
579
580 const Type* Type::get(const std::string& newType, TypeIDs oldType, 
581                               const Type* eTy, const Type* rTy) {
582   Type* Ty= new Type();
583   Ty->newTy = newType;
584   Ty->oldTy = oldType;
585   Ty->elemTy = const_cast<Type*>(eTy);
586   Ty->resultTy = const_cast<Type*>(rTy);
587   return add_new_type(Ty);
588 }
589
590 const Type* Type::get(const std::string& newType, TypeIDs oldType, 
591                               const Type *eTy, uint64_t elems) {
592   Type* Ty = new Type();
593   Ty->newTy = newType;
594   Ty->oldTy = oldType;
595   Ty->elemTy = const_cast<Type*>(eTy);
596   Ty->nelems = elems;
597   return  add_new_type(Ty);
598 }
599
600 const Type* Type::get(const std::string& newType, TypeIDs oldType, 
601                               TypeList* TL) {
602   Type* Ty = new Type();
603   Ty->newTy = newType;
604   Ty->oldTy = oldType;
605   Ty->elements = TL;
606   return add_new_type(Ty);
607 }
608
609 const Type* Type::get(const std::string& newType, const Type* resTy,
610                               TypeList* TL) {
611   Type* Ty = new Type();
612   Ty->newTy = newType;
613   Ty->oldTy = FunctionTy;
614   Ty->resultTy = const_cast<Type*>(resTy);
615   Ty->elements = TL;
616   return add_new_type(Ty);
617 }
618
619 const Type* Type::resolve() const {
620   if (isUnresolved()) {
621     if (getNewTy()[0] == '%' && isdigit(newTy[1])) {
622       unsigned ref = atoi(&((newTy.c_str())[1])); // skip the %
623       if (ref < EnumeratedTypes.size()) {
624         return EnumeratedTypes[ref];
625       } else {
626         std::string msg("Can't resolve numbered type: ");
627         msg += getNewTy();
628         yyerror(msg.c_str());
629       }
630     } else {
631       Type::TypeMap::iterator I = NamedTypes.find(newTy);
632       if (I != NamedTypes.end()) {
633         return I->second;
634       } else {
635         std::string msg("Cannot resolve type: ");
636         msg += getNewTy();
637         yyerror(msg.c_str());
638       }
639     }
640   }
641   // otherwise its already resolved.
642   return this;
643 }
644
645 bool Type::operator<(const Type& that) const {
646   if (this == &that)
647     return false;
648   if (oldTy != that.oldTy)
649     return oldTy < that.oldTy;
650   switch (oldTy) {
651     case UpRefTy: {
652       unsigned thisUp = this->getUpRefNum();
653       unsigned thatUp = that.getUpRefNum();
654       return thisUp < thatUp;
655     }
656     case PackedTy:
657     case ArrayTy:
658       if (this->nelems != that.nelems)
659         return nelems < that.nelems;
660     case PointerTy: {
661       const Type* thisTy = this->elemTy;
662       const Type* thatTy = that.elemTy;
663       return *thisTy < *thatTy;
664     }
665     case FunctionTy: {
666       const Type* thisTy = this->resultTy;
667       const Type* thatTy = that.resultTy;
668       if (!thisTy->sameOldTyAs(thatTy))
669         return *thisTy < *thatTy;
670       /* FALL THROUGH */
671     }
672     case StructTy:
673     case PackedStructTy: {
674       if (elements->size() != that.elements->size())
675         return elements->size() < that.elements->size();
676       for (unsigned i = 0; i < elements->size(); i++) {
677         const Type* thisTy = (*this->elements)[i];
678         const Type* thatTy = (*that.elements)[i];
679         if (!thisTy->sameOldTyAs(thatTy))
680           return *thisTy < *thatTy;
681       }
682       break;
683     }
684     case UnresolvedTy:
685       return this->newTy < that.newTy;
686     default:
687       break;
688   }
689   return false; 
690 }
691
692 bool Type::sameOldTyAs(const Type* that) const {
693   if (that == 0)
694     return false;
695   if ( this == that ) 
696     return true;
697   if (oldTy != that->oldTy)
698     return false;
699   switch (oldTy) {
700     case PackedTy:
701     case ArrayTy:
702       if (nelems != that->nelems)
703         return false;
704       /* FALL THROUGH */
705     case PointerTy: {
706       const Type* thisTy = this->elemTy;
707       const Type* thatTy = that->elemTy;
708       return thisTy->sameOldTyAs(thatTy);
709     }
710     case FunctionTy: {
711       const Type* thisTy = this->resultTy;
712       const Type* thatTy = that->resultTy;
713       if (!thisTy->sameOldTyAs(thatTy))
714         return false;
715       /* FALL THROUGH */
716     }
717     case StructTy:
718     case PackedStructTy: {
719       if (elements->size() != that->elements->size())
720         return false;
721       for (unsigned i = 0; i < elements->size(); i++) {
722         const Type* thisTy = (*this->elements)[i];
723         const Type* thatTy = (*that->elements)[i];
724         if (!thisTy->sameOldTyAs(thatTy))
725           return false;
726       }
727       return true;
728     }
729     case UnresolvedTy:
730       return this->newTy == that->newTy;
731     default:
732       return true; // for all others oldTy == that->oldTy is sufficient
733   }
734   return true;
735 }
736
737 bool Type::isUnresolvedDeep() const {
738   switch (oldTy) {
739     case UnresolvedTy: 
740       return true;
741     case PackedTy:
742     case ArrayTy:
743     case PointerTy:
744       return elemTy->isUnresolvedDeep();
745     case PackedStructTy:
746     case StructTy:
747       for (unsigned i = 0; i < elements->size(); i++)
748         if ((*elements)[i]->isUnresolvedDeep())
749           return true;
750       return false;
751     default:
752       return false;
753   }
754 }
755
756 unsigned Type::getBitWidth() const {
757   switch (oldTy) {
758     default:
759     case LabelTy:
760     case VoidTy : return 0;
761     case BoolTy : return 1;
762     case SByteTy: case UByteTy : return 8;
763     case ShortTy: case UShortTy : return 16;
764     case IntTy: case UIntTy: case FloatTy: return 32;
765     case LongTy: case ULongTy: case DoubleTy : return 64;
766     case PointerTy: return SizeOfPointer; // global var
767     case PackedTy: 
768     case ArrayTy: 
769       return nelems * elemTy->getBitWidth();
770     case StructTy:
771     case PackedStructTy: {
772       uint64_t size = 0;
773       for (unsigned i = 0; i < elements->size(); i++) {
774         size += (*elements)[i]->getBitWidth();
775       }
776       return size;
777     }
778   }
779 }
780
781 const Type* Type::getIndexedType(const Value*  V) const {
782   if (isStruct()) {
783     if (V->isConstant() && V->type->isInteger()) {
784       size_t pos = V->val->find(' ') + 1;
785       if (pos < V->val->size()) {
786         uint64_t idx = atoi(V->val->substr(pos).c_str());
787         return (*elements)[idx];
788       } else {
789         yyerror("Invalid value for constant integer");
790         return 0;
791       }
792     } else {
793       yyerror("Structure requires constant index");
794       return 0;
795     }
796   }
797   if (isArray() || isPacked() || isPointer())
798     return elemTy;
799   yyerror("Invalid type for getIndexedType");
800   return 0;
801 }
802
803 void Type::getSignedness(unsigned &sNum, unsigned &uNum, 
804                              UpRefStack& stack) const {
805   switch (oldTy) {
806     default:
807     case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: 
808     case FloatTy : case DoubleTy: case UpRefTy:
809       return;
810     case SByteTy: case ShortTy: case LongTy: case IntTy: 
811       sNum++;
812       return;
813     case UByteTy: case UShortTy: case UIntTy: case ULongTy: 
814       uNum++;
815       return;
816     case PointerTy:
817     case PackedTy: 
818     case ArrayTy:
819       stack.push_back(this);
820       elemTy->getSignedness(sNum, uNum, stack);
821       return;
822     case StructTy:
823     case PackedStructTy: {
824       stack.push_back(this);
825       for (unsigned i = 0; i < elements->size(); i++) {
826         (*elements)[i]->getSignedness(sNum, uNum, stack);
827       }
828       return;
829     }
830     case UnresolvedTy: {
831       const Type* Ty = this->resolve();
832       // Let's not recurse.
833       UpRefStack::const_iterator I = stack.begin(), E = stack.end();
834       for ( ; I != E && *I != Ty; ++I) 
835         ;
836       if (I == E)
837         Ty->getSignedness(sNum, uNum, stack);
838       return;
839     }
840   }
841 }
842
843 std::string AddSuffix(const std::string& Name, const std::string& Suffix) {
844   if (Name[Name.size()-1] == '"') {
845     std::string Result = Name;
846     Result.insert(Result.size()-1, Suffix);
847     return Result;
848   }
849   return Name + Suffix;
850 }
851
852 std::string Type::makeUniqueName(const std::string& BaseName) const {
853   if (BaseName == "\"alloca point\"")
854     return BaseName;
855   switch (oldTy) {
856     default:
857       break;
858     case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy:
859     case FloatTy : case DoubleTy: case UnresolvedTy:
860       return BaseName;
861     case SByteTy: case ShortTy: case LongTy: case IntTy: 
862       return AddSuffix(BaseName, ".s");
863     case UByteTy: case UShortTy: case UIntTy: case ULongTy: 
864       return AddSuffix(BaseName, ".u");
865   }
866
867   unsigned uNum = 0, sNum = 0;
868   std::string Suffix;
869   switch (oldTy) {
870     case PointerTy:
871     case PackedTy: 
872     case ArrayTy: {
873       Type::UpRefStack stack;
874       elemTy->resolve()->getSignedness(sNum, uNum, stack);
875       break;
876     }
877     case StructTy:
878     case PackedStructTy: {
879       for (unsigned i = 0; i < elements->size(); i++) {
880         Type::UpRefStack stack;
881         (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack);
882       }
883       break;
884     }
885     default:
886       assert(0 && "Invalid Type");
887       break;
888   }
889
890   if (sNum == 0 && uNum == 0)
891     return BaseName;
892
893   switch (oldTy) {
894     default:             Suffix += ".nada"; break;
895     case PointerTy:      Suffix += ".pntr"; break;
896     case PackedTy:       Suffix += ".pckd"; break;
897     case ArrayTy:        Suffix += ".arry"; break;
898     case StructTy:       Suffix += ".strc"; break;
899     case PackedStructTy: Suffix += ".pstr"; break;
900   }
901
902   Suffix += ".s" + llvm::utostr(sNum);
903   Suffix += ".u" + llvm::utostr(uNum);
904   return AddSuffix(BaseName, Suffix);
905 }
906
907 Type& Type::operator=(const Type& that) {
908   oldTy = that.oldTy;
909   nelems = that.nelems;
910   newTy = that.newTy;
911   elemTy = that.elemTy;
912   resultTy = that.resultTy;
913   if (that.elements) {
914     elements = new TypeList(that.elements->size());
915     *elements = *that.elements;
916   } else {
917     elements = 0;
918   }
919   return *this;
920 }
921
922 const Type* Type::add_new_type(Type* newTy) {
923   TypeRegMap::iterator I = registry.find(newTy);
924   if (I != registry.end()) {
925     delete newTy;
926     return *I;
927   }
928   registry.insert(newTy);
929   return newTy;
930 }
931
932 class Instruction {
933 };
934
935 /// This type is used to keep track of the signedness of constants.
936 struct Constant {
937   std::string *cnst;
938   const Type *type;
939   ~Constant() { delete cnst; }
940 };
941
942 /// This variable provides a counter for unique names. It is used in various
943 /// productions to ensure a unique name is generated.
944 static uint64_t UniqueNameCounter = 1;
945
946 // This is set when a DECLARE keyword is recognized so that subsequent parsing
947 // of a function prototype can know if its a declaration or definition.
948 static bool isDeclare = false;
949
950 // This bool is used to communicate between the InstVal and Inst rules about
951 // whether or not a cast should be deleted. When the flag is set, InstVal has
952 // determined that the cast is a candidate. However, it can only be deleted if
953 // the value being casted is the same value name as the instruction. The Inst
954 // rule makes that comparison if the flag is set and comments out the
955 // instruction if they match.
956 static bool deleteUselessCastFlag = false;
957 static std::string* deleteUselessCastName = 0;
958
959
960
961 const char* getCastOpcode(std::string& Source, const Type* SrcTy, 
962                           const Type* DstTy) {
963   unsigned SrcBits = SrcTy->getBitWidth();
964   unsigned DstBits = DstTy->getBitWidth();
965   const char* opcode = "bitcast";
966   // Run through the possibilities ...
967   if (DstTy->isIntegral()) {                        // Casting to integral
968     if (SrcTy->isIntegral()) {                      // Casting from integral
969       if (DstBits < SrcBits)
970         opcode = "trunc";
971       else if (DstBits > SrcBits) {                // its an extension
972         if (SrcTy->isSigned())
973           opcode ="sext";                          // signed -> SEXT
974         else
975           opcode = "zext";                         // unsigned -> ZEXT
976       } else {
977         opcode = "bitcast";                        // Same size, No-op cast
978       }
979     } else if (SrcTy->isFloatingPoint()) {          // Casting from floating pt
980       if (DstTy->isSigned()) 
981         opcode = "fptosi";                         // FP -> sint
982       else
983         opcode = "fptoui";                         // FP -> uint 
984     } else if (SrcTy->isPacked()) {
985       assert(DstBits == SrcTy->getBitWidth() &&
986                "Casting packed to integer of different width");
987         opcode = "bitcast";                        // same size, no-op cast
988     } else {
989       assert(SrcTy->isPointer() &&
990              "Casting from a value that is not first-class type");
991       opcode = "ptrtoint";                         // ptr -> int
992     }
993   } else if (DstTy->isFloatingPoint()) {           // Casting to floating pt
994     if (SrcTy->isIntegral()) {                     // Casting from integral
995       if (SrcTy->isSigned())
996         opcode = "sitofp";                         // sint -> FP
997       else
998         opcode = "uitofp";                         // uint -> FP
999     } else if (SrcTy->isFloatingPoint()) {         // Casting from floating pt
1000       if (DstBits < SrcBits) {
1001         opcode = "fptrunc";                        // FP -> smaller FP
1002       } else if (DstBits > SrcBits) {
1003         opcode = "fpext";                          // FP -> larger FP
1004       } else  {
1005         opcode ="bitcast";                         // same size, no-op cast
1006       }
1007     } else if (SrcTy->isPacked()) {
1008       assert(DstBits == SrcTy->getBitWidth() &&
1009              "Casting packed to floating point of different width");
1010         opcode = "bitcast";                        // same size, no-op cast
1011     } else {
1012       assert(0 && "Casting pointer or non-first class to float");
1013     }
1014   } else if (DstTy->isPacked()) {
1015     if (SrcTy->isPacked()) {
1016       assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
1017              "Casting packed to packed of different widths");
1018       opcode = "bitcast";                          // packed -> packed
1019     } else if (DstTy->getBitWidth() == SrcBits) {
1020       opcode = "bitcast";                          // float/int -> packed
1021     } else {
1022       assert(!"Illegal cast to packed (wrong type or size)");
1023     }
1024   } else if (DstTy->isPointer()) {
1025     if (SrcTy->isPointer()) {
1026       opcode = "bitcast";                          // ptr -> ptr
1027     } else if (SrcTy->isIntegral()) {
1028       opcode = "inttoptr";                         // int -> ptr
1029     } else {
1030       assert(!"Casting invalid type to pointer");
1031     }
1032   } else {
1033     assert(!"Casting to type that is not first-class");
1034   }
1035   return opcode;
1036 }
1037
1038 std::string getCastUpgrade(const std::string& Src, const Type* SrcTy,
1039                            const Type* DstTy, bool isConst) {
1040   std::string Result;
1041   std::string Source = Src;
1042   if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
1043     // fp -> ptr cast is no longer supported but we must upgrade this
1044     // by doing a double cast: fp -> int -> ptr
1045     if (isConst)
1046       Source = "i64 fptoui(" + Source + " to i64)";
1047     else {
1048       *O << "    %cast_upgrade" << UniqueNameCounter << " = fptoui " 
1049          << Source << " to i64\n";
1050       Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter++);
1051     }
1052     // Update the SrcTy for the getCastOpcode call below
1053     SrcTy = Type::get("i64", ULongTy);
1054   } else if (DstTy->isBool()) {
1055     // cast type %x to bool was previously defined as setne type %x, null
1056     // The cast semantic is now to truncate, not compare so we must retain
1057     // the original intent by replacing the cast with a setne
1058     const char* comparator = SrcTy->isPointer() ? ", null" : 
1059       (SrcTy->isFloatingPoint() ? ", 0.0" : 
1060        (SrcTy->isBool() ? ", false" : ", 0"));
1061     const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
1062     if (isConst) { 
1063       Result = "(" + Source + comparator + ")";
1064       Result = compareOp + Result;
1065     } else
1066       Result = compareOp + Source + comparator;
1067     return Result; // skip cast processing below
1068   }
1069   SrcTy = SrcTy->resolve();
1070   DstTy = DstTy->resolve();
1071   std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
1072   if (isConst)
1073     Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
1074   else
1075     Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
1076   return Result;
1077 }
1078
1079 const char* getDivRemOpcode(const std::string& opcode, const Type* TI) {
1080   const char* op = opcode.c_str();
1081   const Type* Ty = TI->resolve();
1082   if (Ty->isPacked())
1083     Ty = Ty->getElementType();
1084   if (opcode == "div")
1085     if (Ty->isFloatingPoint())
1086       op = "fdiv";
1087     else if (Ty->isUnsigned())
1088       op = "udiv";
1089     else if (Ty->isSigned())
1090       op = "sdiv";
1091     else
1092       yyerror("Invalid type for div instruction");
1093   else if (opcode == "rem")
1094     if (Ty->isFloatingPoint())
1095       op = "frem";
1096     else if (Ty->isUnsigned())
1097       op = "urem";
1098     else if (Ty->isSigned())
1099       op = "srem";
1100     else
1101       yyerror("Invalid type for rem instruction");
1102   return op;
1103 }
1104
1105 std::string getCompareOp(const std::string& setcc, const Type* TI) {
1106   assert(setcc.length() == 5);
1107   char cc1 = setcc[3];
1108   char cc2 = setcc[4];
1109   assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
1110   assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
1111   std::string result("xcmp xxx");
1112   result[6] = cc1;
1113   result[7] = cc2;
1114   if (TI->isFloatingPoint()) {
1115     result[0] = 'f';
1116     result[5] = 'o';
1117     if (cc1 == 'n')
1118       result[5] = 'u'; // NE maps to unordered
1119     else
1120       result[5] = 'o'; // everything else maps to ordered
1121   } else if (TI->isIntegral() || TI->isPointer()) {
1122     result[0] = 'i';
1123     if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
1124       result.erase(5,1);
1125     else if (TI->isSigned())
1126       result[5] = 's';
1127     else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
1128       result[5] = 'u';
1129     else
1130       yyerror("Invalid integral type for setcc");
1131   }
1132   return result;
1133 }
1134
1135 const Type* getFunctionReturnType(const Type* PFTy) {
1136   PFTy = PFTy->resolve();
1137   if (PFTy->isPointer()) {
1138     const Type* ElemTy = PFTy->getElementType();
1139     ElemTy = ElemTy->resolve();
1140     if (ElemTy->isFunction())
1141       return ElemTy->getResultType();
1142   } else if (PFTy->isFunction()) {
1143     return PFTy->getResultType();
1144   }
1145   return PFTy;
1146 }
1147
1148 const Type* ResolveUpReference(const Type* Ty, 
1149                                    Type::UpRefStack* stack) {
1150   assert(Ty->isUpReference() && "Can't resolve a non-upreference");
1151   unsigned upref = Ty->getUpRefNum();
1152   assert(upref < stack->size() && "Invalid up reference");
1153   return (*stack)[upref - stack->size() - 1];
1154 }
1155
1156 const Type* getGEPIndexedType(const Type* PTy, ValueList* idxs) {
1157   const Type* Result = PTy = PTy->resolve();
1158   assert(PTy->isPointer() && "GEP Operand is not a pointer?");
1159   Type::UpRefStack stack;
1160   for (unsigned i = 0; i < idxs->size(); ++i) {
1161     if (Result->isComposite()) {
1162       Result = Result->getIndexedType((*idxs)[i]);
1163       Result = Result->resolve();
1164       stack.push_back(Result);
1165     } else
1166       yyerror("Invalid type for index");
1167   }
1168   // Resolve upreferences so we can return a more natural type
1169   if (Result->isPointer()) {
1170     if (Result->getElementType()->isUpReference()) {
1171       stack.push_back(Result);
1172       Result = ResolveUpReference(Result->getElementType(), &stack);
1173     }
1174   } else if (Result->isUpReference()) {
1175     Result = ResolveUpReference(Result->getElementType(), &stack);
1176   }
1177   return Result->getPointerType();
1178 }
1179
1180 // This function handles appending .u or .s to integer value names that
1181 // were previously unsigned or signed, respectively. This avoids name
1182 // collisions since the unsigned and signed type planes have collapsed
1183 // into a single signless type plane.
1184 std::string getUniqueName(const std::string *Name, const Type* Ty,
1185                           bool isGlobal = false, bool isDef = false) {
1186
1187   // If its not a symbolic name, don't modify it, probably a constant val.
1188   if ((*Name)[0] != '%' && (*Name)[0] != '"')
1189     return *Name;
1190
1191   // If its a numeric reference, just leave it alone.
1192   if (isdigit((*Name)[1]))
1193     return *Name;
1194
1195   // Resolve the type
1196   Ty = Ty->resolve(); 
1197
1198   // If its a global name, get its uniquified name, if any
1199   Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
1200   if (GI != Type::Globals.end()) {
1201     Type::TypePlaneMap::iterator TPI = GI->second.begin();
1202     Type::TypePlaneMap::iterator TPE = GI->second.end();
1203     for ( ; TPI != TPE ; ++TPI) {
1204       if (TPI->first->sameNewTyAs(Ty)) 
1205         return TPI->second;
1206     }
1207   }
1208
1209   if (isGlobal) {
1210     // We didn't find a global name, but if its supposed to be global then all 
1211     // we can do is return the name. This is probably a forward reference of a 
1212     // global value that hasn't been defined yet. Since we have no definition
1213     // we don't know its linkage class. Just assume its an external and the name
1214     // shouldn't change.
1215     return *Name;
1216   }
1217
1218   // Default the result to the current name
1219   std::string Result = Ty->makeUniqueName(*Name);
1220
1221   return Result;
1222 }
1223
1224 std::string getGlobalName(const std::string* Name, const std::string Linkage,
1225                           const Type* Ty, bool isConstant) {
1226   // Default to given name
1227   std::string Result = *Name; 
1228   // Look up the name in the Globals Map
1229   Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
1230   // Did we see this global name before?
1231   if (GI != Type::Globals.end()) {
1232     if (Ty->isUnresolvedDeep()) {
1233       // The Gval's type is unresolved. Consequently, we can't disambiguate it
1234       // by type. We'll just change its name and emit a warning.
1235       warning("Cannot disambiguate global value '" + *Name + 
1236               "' because type '" + Ty->getNewTy() + "'is unresolved.\n");
1237       Result = *Name + ".unique";
1238       UniqueNameCounter++;
1239       Result += llvm::utostr(UniqueNameCounter);
1240       return Result;
1241     } else {
1242       Type::TypePlaneMap::iterator TPI = GI->second.find(Ty);
1243       if (TPI != GI->second.end()) {
1244         // We found an existing name of the same old type. This isn't allowed 
1245         // in LLVM 2.0. Consequently, we must alter the name of the global so it
1246         // can at least compile. References to the global will yield the first
1247         // definition, which is okay. We also must warn about this.
1248         Result = *Name + ".unique";
1249         UniqueNameCounter++;
1250         Result += llvm::utostr(UniqueNameCounter);
1251         warning(std::string("Global variable '") + *Name + "' was renamed to '"+
1252                 Result + "'");
1253       } else { 
1254         // There isn't an existing definition for this name according to the
1255         // old types. Now search the TypePlanMap for types with the same new
1256         // name. 
1257         Type::TypePlaneMap::iterator TPI = GI->second.begin();
1258         Type::TypePlaneMap::iterator TPE = GI->second.end();
1259         for ( ; TPI != TPE; ++TPI) {
1260           if (TPI->first->sameNewTyAs(Ty)) {
1261             // The new types are the same but the old types are different so 
1262             // this is a global name collision resulting from type planes 
1263             // collapsing. 
1264             if (Linkage == "external" || Linkage == "dllimport" || 
1265                 Linkage == "extern_weak" || Linkage == "") {
1266               // The linkage of this gval is external so we can't reliably 
1267               // rename it because it could potentially create a linking 
1268               // problem.  However, we can't leave the name conflict in the 
1269               // output either or it won't assemble with LLVM 2.0.  So, all we 
1270               // can do is rename this one to something unique and emit a 
1271               // warning about the problem.
1272               Result = *Name + ".unique";
1273               UniqueNameCounter++;
1274               Result += llvm::utostr(UniqueNameCounter);
1275               warning("Renaming global value '" + *Name + "' to '" + Result + 
1276                       "' may cause linkage errors.");
1277               return Result;
1278             } else {
1279               // Its linkage is internal and its type is known so we can 
1280               // disambiguate the name collision successfully based on the type.
1281               Result = getUniqueName(Name, Ty);
1282               TPI->second = Result;
1283               return Result;
1284             }
1285           }
1286         }
1287         // We didn't find an entry in the type plane with the same new type and
1288         // the old types differ so this is a new type plane for this global 
1289         // variable. We just fall through to the logic below which inserts
1290         // the global.
1291       }
1292     }
1293   }
1294
1295   // Its a new global name, if it is external we can't change it
1296   if (isConstant || Linkage == "external" || Linkage == "dllimport" || 
1297       Linkage == "extern_weak" || Linkage == "") {
1298     Type::Globals[Result][Ty] = Result;
1299     return Result;
1300   }
1301
1302   // Its a new global name, and it is internal, change the name to make it
1303   // unique for its type.
1304   // Result = getUniqueName(Name, Ty);
1305   Type::Globals[*Name][Ty] = Result;
1306   return Result;
1307 }
1308
1309 } // End anonymous namespace
1310
1311 // This function is used by the Lexer to create a Type. It can't be
1312 // in the anonymous namespace.
1313 const Type* getType(const std::string& newTy, TypeIDs oldTy) {
1314   return Type::get(newTy, oldTy);
1315 }
1316
1317
1318
1319 /* Enabling traces.  */
1320 #ifndef YYDEBUG
1321 # define YYDEBUG 0
1322 #endif
1323
1324 /* Enabling verbose error messages.  */
1325 #ifdef YYERROR_VERBOSE
1326 # undef YYERROR_VERBOSE
1327 # define YYERROR_VERBOSE 1
1328 #else
1329 # define YYERROR_VERBOSE 0
1330 #endif
1331
1332 #ifndef YYSTYPE
1333 #line 971 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
1334 typedef union {
1335   std::string*    String;
1336   const Type*     Ty;
1337   Value*          Val;
1338   Constant*       Const;
1339   ValueList*      ValList;
1340   TypeList*       TypeVec;
1341 } yystype;
1342 /* Line 188 of /usr/local/share/bison/yacc.c.  */
1343 #line 1344 "UpgradeParser.tab.c"
1344 # define YYSTYPE yystype
1345 # define YYSTYPE_IS_TRIVIAL 1
1346 #endif
1347
1348 #ifndef YYLTYPE
1349 typedef struct yyltype
1350 {
1351   int first_line;
1352   int first_column;
1353   int last_line;
1354   int last_column;
1355 } yyltype;
1356 # define YYLTYPE yyltype
1357 # define YYLTYPE_IS_TRIVIAL 1
1358 #endif
1359
1360 /* Copy the second part of user declarations.  */
1361
1362
1363 /* Line 213 of /usr/local/share/bison/yacc.c.  */
1364 #line 1365 "UpgradeParser.tab.c"
1365
1366 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1367
1368 /* The parser invokes alloca or malloc; define the necessary symbols.  */
1369
1370 # if YYSTACK_USE_ALLOCA
1371 #  define YYSTACK_ALLOC alloca
1372 # else
1373 #  ifndef YYSTACK_USE_ALLOCA
1374 #   if defined (alloca) || defined (_ALLOCA_H)
1375 #    define YYSTACK_ALLOC alloca
1376 #   else
1377 #    ifdef __GNUC__
1378 #     define YYSTACK_ALLOC __builtin_alloca
1379 #    endif
1380 #   endif
1381 #  endif
1382 # endif
1383
1384 # ifdef YYSTACK_ALLOC
1385    /* Pacify GCC's `empty if-body' warning. */
1386 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1387 # else
1388 #  if defined (__STDC__) || defined (__cplusplus)
1389 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1390 #   define YYSIZE_T size_t
1391 #  endif
1392 #  define YYSTACK_ALLOC malloc
1393 #  define YYSTACK_FREE free
1394 # endif
1395 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1396
1397
1398 #if (! defined (yyoverflow) \
1399      && (! defined (__cplusplus) \
1400          || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1401
1402 /* A type that is properly aligned for any stack member.  */
1403 union yyalloc
1404 {
1405   short yyss;
1406   YYSTYPE yyvs;
1407   };
1408
1409 /* The size of the maximum gap between one aligned stack and the next.  */
1410 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
1411
1412 /* The size of an array large to enough to hold all stacks, each with
1413    N elements.  */
1414 # define YYSTACK_BYTES(N) \
1415      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
1416       + YYSTACK_GAP_MAX)
1417
1418 /* Copy COUNT objects from FROM to TO.  The source and destination do
1419    not overlap.  */
1420 # ifndef YYCOPY
1421 #  if 1 < __GNUC__
1422 #   define YYCOPY(To, From, Count) \
1423       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1424 #  else
1425 #   define YYCOPY(To, From, Count)              \
1426       do                                        \
1427         {                                       \
1428           register YYSIZE_T yyi;                \
1429           for (yyi = 0; yyi < (Count); yyi++)   \
1430             (To)[yyi] = (From)[yyi];    \
1431         }                                       \
1432       while (0)
1433 #  endif
1434 # endif
1435
1436 /* Relocate STACK from its old location to the new one.  The
1437    local variables YYSIZE and YYSTACKSIZE give the old and new number of
1438    elements in the stack, and YYPTR gives the new location of the
1439    stack.  Advance YYPTR to a properly aligned location for the next
1440    stack.  */
1441 # define YYSTACK_RELOCATE(Stack)                                        \
1442     do                                                                  \
1443       {                                                                 \
1444         YYSIZE_T yynewbytes;                                            \
1445         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
1446         Stack = &yyptr->Stack;                                          \
1447         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;   \
1448         yyptr += yynewbytes / sizeof (*yyptr);                          \
1449       }                                                                 \
1450     while (0)
1451
1452 #endif
1453
1454 #if defined (__STDC__) || defined (__cplusplus)
1455    typedef signed char yysigned_char;
1456 #else
1457    typedef short yysigned_char;
1458 #endif
1459
1460 /* YYFINAL -- State number of the termination state. */
1461 #define YYFINAL  4
1462 #define YYLAST   1473
1463
1464 /* YYNTOKENS -- Number of terminals. */
1465 #define YYNTOKENS  164
1466 /* YYNNTS -- Number of nonterminals. */
1467 #define YYNNTS  76
1468 /* YYNRULES -- Number of rules. */
1469 #define YYNRULES  301
1470 /* YYNRULES -- Number of states. */
1471 #define YYNSTATES  585
1472
1473 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
1474 #define YYUNDEFTOK  2
1475 #define YYMAXUTOK   404
1476
1477 #define YYTRANSLATE(X) \
1478   ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
1479
1480 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
1481 static const unsigned char yytranslate[] =
1482 {
1483        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1484        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1485        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1486        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1487      153,   154,   162,     2,   151,     2,     2,     2,     2,     2,
1488        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1489      158,   150,   159,     2,     2,     2,     2,     2,     2,     2,
1490        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1491        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1492        2,   155,   152,   157,     2,     2,     2,     2,     2,   163,
1493        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1494        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1495      156,     2,     2,   160,     2,   161,     2,     2,     2,     2,
1496        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1497        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1498        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1499        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1500        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1501        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1502        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1503        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1504        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1505        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1506        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1507        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1508        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1509        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1510       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1511       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
1512       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1513       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
1514       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1515       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
1516       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
1517       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
1518       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
1519      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
1520      115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
1521      125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
1522      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
1523      145,   146,   147,   148,   149
1524 };
1525
1526 #if YYDEBUG
1527 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1528    YYRHS.  */
1529 static const unsigned short yyprhs[] =
1530 {
1531        0,     0,     3,     5,     7,     9,    11,    13,    15,    17,
1532       19,    21,    23,    25,    27,    29,    31,    33,    35,    37,
1533       39,    41,    43,    45,    47,    49,    51,    53,    55,    57,
1534       59,    61,    63,    65,    67,    69,    71,    73,    75,    77,
1535       79,    81,    83,    85,    87,    89,    91,    93,    95,    97,
1536       99,   101,   103,   105,   107,   109,   111,   113,   115,   117,
1537      119,   121,   123,   125,   127,   129,   131,   133,   135,   137,
1538      139,   141,   143,   145,   147,   149,   151,   153,   155,   157,
1539      159,   161,   164,   165,   167,   169,   171,   173,   175,   177,
1540      179,   180,   182,   184,   186,   188,   190,   192,   195,   196,
1541      197,   200,   201,   205,   208,   209,   211,   212,   216,   218,
1542      221,   223,   225,   227,   229,   231,   233,   235,   237,   239,
1543      241,   243,   245,   247,   249,   251,   253,   255,   257,   259,
1544      261,   264,   269,   275,   281,   285,   288,   294,   299,   302,
1545      304,   308,   310,   314,   316,   317,   322,   326,   330,   335,
1546      340,   344,   347,   350,   353,   356,   359,   362,   365,   368,
1547      371,   374,   381,   387,   396,   403,   410,   417,   425,   433,
1548      440,   447,   456,   465,   469,   471,   473,   475,   477,   480,
1549      483,   488,   491,   493,   495,   497,   502,   505,   510,   517,
1550      524,   531,   538,   542,   547,   548,   550,   552,   554,   558,
1551      562,   566,   570,   574,   578,   580,   581,   583,   585,   587,
1552      588,   591,   595,   597,   599,   603,   605,   606,   615,   617,
1553      619,   623,   625,   627,   631,   632,   634,   636,   637,   642,
1554      643,   645,   647,   649,   651,   653,   655,   657,   659,   661,
1555      665,   667,   673,   675,   677,   679,   681,   684,   687,   689,
1556      692,   695,   696,   698,   700,   702,   705,   708,   712,   722,
1557      732,   741,   756,   758,   760,   767,   773,   776,   783,   791,
1558      793,   797,   799,   800,   803,   805,   811,   817,   823,   830,
1559      837,   842,   847,   854,   859,   864,   871,   878,   881,   889,
1560      891,   894,   895,   897,   898,   902,   909,   913,   920,   923,
1561      928,   935
1562 };
1563
1564 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1565 static const short yyrhs[] =
1566 {
1567      198,     0,    -1,    19,    -1,    20,    -1,    17,    -1,    18,
1568       -1,    79,    -1,    80,    -1,    81,    -1,    82,    -1,    83,
1569       -1,    84,    -1,    85,    -1,    86,    -1,    87,    -1,    88,
1570       -1,    89,    -1,    90,    -1,    91,    -1,    92,    -1,    93,
1571       -1,    94,    -1,    95,    -1,    96,    -1,    97,    -1,    98,
1572       -1,   101,    -1,   102,    -1,   103,    -1,   104,    -1,   105,
1573       -1,   106,    -1,   117,    -1,   118,    -1,   119,    -1,   120,
1574       -1,   107,    -1,   108,    -1,   109,    -1,   110,    -1,   111,
1575       -1,   112,    -1,   113,    -1,   114,    -1,   115,    -1,   116,
1576       -1,   117,    -1,   118,    -1,   119,    -1,   120,    -1,    25,
1577       -1,    26,    -1,   129,    -1,   130,    -1,   131,    -1,   132,
1578       -1,   138,    -1,   139,    -1,   140,    -1,   141,    -1,   142,
1579       -1,   143,    -1,   144,    -1,   145,    -1,   146,    -1,   147,
1580       -1,   148,    -1,   149,    -1,   137,    -1,    11,    -1,     9,
1581       -1,     7,    -1,     5,    -1,    12,    -1,    10,    -1,     8,
1582       -1,     6,    -1,   174,    -1,   175,    -1,    13,    -1,    14,
1583       -1,   207,   150,    -1,    -1,    42,    -1,    43,    -1,    44,
1584       -1,    48,    -1,    45,    -1,    46,    -1,    47,    -1,    -1,
1585       65,    -1,    66,    -1,    67,    -1,    68,    -1,    69,    -1,
1586       70,    -1,    64,    18,    -1,    -1,    -1,    56,    18,    -1,
1587       -1,   151,    56,    18,    -1,    37,    30,    -1,    -1,   183,
1588       -1,    -1,   151,   186,   185,    -1,   183,    -1,    56,    18,
1589       -1,   189,    -1,     3,    -1,   191,    -1,     3,    -1,   191,
1590       -1,     4,    -1,     5,    -1,     6,    -1,     7,    -1,     8,
1591       -1,     9,    -1,    10,    -1,    11,    -1,    12,    -1,    13,
1592       -1,    14,    -1,    15,    -1,    16,    -1,   222,    -1,   190,
1593       -1,   152,    18,    -1,   188,   153,   193,   154,    -1,   155,
1594       18,   156,   191,   157,    -1,   158,    18,   156,   191,   159,
1595       -1,   160,   192,   161,    -1,   160,   161,    -1,   158,   160,
1596      192,   161,   159,    -1,   158,   160,   161,   159,    -1,   191,
1597      162,    -1,   191,    -1,   192,   151,   191,    -1,   192,    -1,
1598      192,   151,    40,    -1,    40,    -1,    -1,   189,   155,   196,
1599      157,    -1,   189,   155,   157,    -1,   189,   163,    30,    -1,
1600      189,   158,   196,   159,    -1,   189,   160,   196,   161,    -1,
1601      189,   160,   161,    -1,   189,    22,    -1,   189,    23,    -1,
1602      189,   222,    -1,   189,   195,    -1,   189,    24,    -1,   174,
1603      166,    -1,   175,   166,    -1,     4,    25,    -1,     4,    26,
1604       -1,   177,    21,    -1,   173,   153,   194,    39,   189,   154,
1605       -1,   126,   153,   194,   237,   154,    -1,   128,   153,   194,
1606      151,   194,   151,   194,   154,    -1,   167,   153,   194,   151,
1607      194,   154,    -1,   168,   153,   194,   151,   194,   154,    -1,
1608      169,   153,   194,   151,   194,   154,    -1,    99,   170,   153,
1609      194,   151,   194,   154,    -1,   100,   171,   153,   194,   151,
1610      194,   154,    -1,   172,   153,   194,   151,   194,   154,    -1,
1611      134,   153,   194,   151,   194,   154,    -1,   135,   153,   194,
1612      151,   194,   151,   194,   154,    -1,   136,   153,   194,   151,
1613      194,   151,   194,   154,    -1,   196,   151,   194,    -1,   194,
1614       -1,    35,    -1,    36,    -1,   199,    -1,   199,   216,    -1,
1615      199,   218,    -1,   199,    62,    61,   202,    -1,   199,    31,
1616       -1,   201,    -1,    49,    -1,    57,    -1,   201,   178,    27,
1617      187,    -1,   201,   218,    -1,   201,    62,    61,   202,    -1,
1618      201,   178,   179,   197,   194,   185,    -1,   201,   178,   200,
1619      197,   189,   185,    -1,   201,   178,    45,   197,   189,   185,
1620       -1,   201,   178,    47,   197,   189,   185,    -1,   201,    50,
1621      204,    -1,   201,    58,   150,   205,    -1,    -1,    30,    -1,
1622       55,    -1,    54,    -1,    52,   150,   203,    -1,    53,   150,
1623       18,    -1,    51,   150,    30,    -1,    71,   150,    30,    -1,
1624      155,   206,   157,    -1,   206,   151,    30,    -1,    30,    -1,
1625       -1,    28,    -1,    30,    -1,   207,    -1,    -1,   189,   208,
1626       -1,   210,   151,   209,    -1,   209,    -1,   210,    -1,   210,
1627      151,    40,    -1,    40,    -1,    -1,   180,   187,   207,   153,
1628      211,   154,   184,   181,    -1,    32,    -1,   160,    -1,   179,
1629      212,   213,    -1,    33,    -1,   161,    -1,   214,   225,   215,
1630       -1,    -1,    45,    -1,    47,    -1,    -1,    34,   219,   217,
1631      212,    -1,    -1,    63,    -1,    17,    -1,    18,    -1,    21,
1632       -1,    25,    -1,    26,    -1,    22,    -1,    23,    -1,    24,
1633       -1,   158,   196,   159,    -1,   195,    -1,    61,   220,    30,
1634      151,    30,    -1,   165,    -1,   207,    -1,   222,    -1,   221,
1635       -1,   189,   223,    -1,   225,   226,    -1,   226,    -1,   227,
1636      229,    -1,   227,   231,    -1,    -1,    29,    -1,    77,    -1,
1637       76,    -1,    72,   224,    -1,    72,     3,    -1,    73,    15,
1638      223,    -1,    73,     4,   223,   151,    15,   223,   151,    15,
1639      223,    -1,    74,   176,   223,   151,    15,   223,   155,   230,
1640      157,    -1,    74,   176,   223,   151,    15,   223,   155,   157,
1641       -1,   178,    75,   180,   187,   223,   153,   234,   154,    39,
1642       15,   223,   228,    15,   223,    -1,   228,    -1,    78,    -1,
1643      230,   176,   221,   151,    15,   223,    -1,   176,   221,   151,
1644       15,   223,    -1,   178,   236,    -1,   189,   155,   223,   151,
1645      223,   157,    -1,   232,   151,   155,   223,   151,   223,   157,
1646       -1,   224,    -1,   233,   151,   224,    -1,   233,    -1,    -1,
1647       60,    59,    -1,    59,    -1,   167,   189,   223,   151,   223,
1648       -1,   168,   189,   223,   151,   223,    -1,   169,   189,   223,
1649      151,   223,    -1,    99,   170,   189,   223,   151,   223,    -1,
1650      100,   171,   189,   223,   151,   223,    -1,   172,   224,   151,
1651      224,    -1,   173,   224,    39,   189,    -1,   128,   224,   151,
1652      224,   151,   224,    -1,   133,   224,   151,   189,    -1,   134,
1653      224,   151,   224,    -1,   135,   224,   151,   224,   151,   224,
1654       -1,   136,   224,   151,   224,   151,   224,    -1,   127,   232,
1655       -1,   235,   180,   187,   223,   153,   234,   154,    -1,   239,
1656       -1,   151,   233,    -1,    -1,    38,    -1,    -1,   121,   189,
1657      182,    -1,   121,   189,   151,    10,   223,   182,    -1,   122,
1658      189,   182,    -1,   122,   189,   151,    10,   223,   182,    -1,
1659      123,   224,    -1,   238,   124,   189,   223,    -1,   238,   125,
1660      224,   151,   189,   223,    -1,   126,   189,   223,   237,    -1
1661 };
1662
1663 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
1664 static const unsigned short yyrline[] =
1665 {
1666        0,  1036,  1036,  1036,  1037,  1037,  1041,  1041,  1041,  1041,
1667     1041,  1041,  1041,  1042,  1042,  1042,  1042,  1043,  1043,  1043,
1668     1044,  1044,  1044,  1044,  1044,  1044,  1045,  1045,  1045,  1045,
1669     1045,  1045,  1045,  1045,  1045,  1045,  1046,  1046,  1046,  1046,
1670     1046,  1046,  1046,  1046,  1046,  1046,  1047,  1047,  1047,  1047,
1671     1047,  1047,  1048,  1048,  1048,  1048,  1049,  1049,  1049,  1049,
1672     1049,  1049,  1049,  1049,  1050,  1050,  1050,  1050,  1050,  1055,
1673     1055,  1055,  1055,  1056,  1056,  1056,  1056,  1057,  1057,  1058,
1674     1058,  1061,  1064,  1069,  1069,  1069,  1069,  1069,  1069,  1070,
1675     1071,  1074,  1074,  1074,  1074,  1074,  1075,  1076,  1081,  1086,
1676     1087,  1090,  1091,  1099,  1105,  1106,  1109,  1110,  1119,  1120,
1677     1133,  1133,  1134,  1134,  1135,  1139,  1139,  1139,  1139,  1139,
1678     1139,  1139,  1140,  1140,  1140,  1140,  1140,  1142,  1145,  1148,
1679     1151,  1155,  1168,  1174,  1180,  1190,  1193,  1203,  1206,  1214,
1680     1218,  1225,  1226,  1231,  1236,  1246,  1253,  1259,  1266,  1273,
1681     1280,  1286,  1293,  1300,  1308,  1315,  1322,  1329,  1336,  1343,
1682     1350,  1358,  1372,  1384,  1389,  1395,  1400,  1406,  1411,  1416,
1683     1424,  1429,  1434,  1444,  1449,  1454,  1454,  1464,  1469,  1472,
1684     1477,  1481,  1485,  1488,  1488,  1491,  1501,  1506,  1511,  1521,
1685     1531,  1541,  1551,  1556,  1561,  1566,  1568,  1568,  1571,  1576,
1686     1583,  1588,  1595,  1602,  1607,  1608,  1616,  1616,  1617,  1617,
1687     1619,  1628,  1632,  1636,  1639,  1644,  1647,  1650,  1673,  1674,
1688     1678,  1689,  1690,  1692,  1701,  1702,  1703,  1707,  1707,  1721,
1689     1722,  1725,  1725,  1725,  1725,  1725,  1725,  1725,  1726,  1727,
1690     1732,  1733,  1742,  1742,  1746,  1752,  1763,  1772,  1775,  1783,
1691     1787,  1792,  1795,  1801,  1801,  1803,  1808,  1813,  1818,  1826,
1692     1836,  1845,  1867,  1872,  1878,  1884,  1892,  1910,  1919,  1929,
1693     1933,  1940,  1941,  1945,  1950,  1953,  1964,  1974,  1985,  1995,
1694     2005,  2016,  2046,  2055,  2062,  2071,  2078,  2085,  2091,  2142,
1695     2147,  2148,  2152,  2153,  2156,  2165,  2175,  2184,  2195,  2202,
1696     2213,  2224
1697 };
1698 #endif
1699
1700 #if YYDEBUG || YYERROR_VERBOSE
1701 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1702    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1703 static const char *const yytname[] =
1704 {
1705   "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", 
1706   "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "LABEL", 
1707   "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL", "FPVAL", 
1708   "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "TYPE", 
1709   "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", "BEGINTOK", 
1710   "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", 
1711   "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK", "DLLIMPORT", 
1712   "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "EXTERNAL", "TARGET", "TRIPLE", 
1713   "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "UNINITIALIZED", 
1714   "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", 
1715   "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", 
1716   "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", 
1717   "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE", "ADD", "SUB", 
1718   "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM", "SREM", "FREM", 
1719   "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", 
1720   "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "OEQ", 
1721   "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "ULT", 
1722   "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", 
1723   "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR", 
1724   "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST", 
1725   "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI", 
1726   "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','", 
1727   "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", 
1728   "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps", 
1729   "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps", 
1730   "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign", 
1731   "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", 
1732   "SectionString", "OptSection", "GlobalVarAttributes", 
1733   "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType", 
1734   "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr", 
1735   "ConstVector", "GlobalType", "Module", "DefinitionList", "External", 
1736   "ConstPool", "AsmBlock", "BigOrLittle", "TargetDefinition", 
1737   "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", 
1738   "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", 
1739   "END", "Function", "FnDeclareLinkage", "FunctionProto", "@1", 
1740   "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", 
1741   "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", 
1742   "Unwind", "BBTerminatorInst", "JumpTable", "Inst", "PHIList", 
1743   "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList", 
1744   "OptVolatile", "MemoryInst", 0
1745 };
1746 #endif
1747
1748 # ifdef YYPRINT
1749 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1750    token YYLEX-NUM.  */
1751 static const unsigned short yytoknum[] =
1752 {
1753        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1754      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1755      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1756      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1757      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1758      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
1759      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
1760      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
1761      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
1762      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
1763      355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
1764      365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
1765      375,   376,   377,   378,   379,   380,   381,   382,   383,   384,
1766      385,   386,   387,   388,   389,   390,   391,   392,   393,   394,
1767      395,   396,   397,   398,   399,   400,   401,   402,   403,   404,
1768       61,    44,    92,    40,    41,    91,   120,    93,    60,    62,
1769      123,   125,    42,    99
1770 };
1771 # endif
1772
1773 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
1774 static const unsigned char yyr1[] =
1775 {
1776        0,   164,   165,   165,   166,   166,   167,   167,   167,   167,
1777      167,   167,   167,   167,   167,   167,   167,   168,   168,   168,
1778      169,   169,   169,   169,   169,   169,   170,   170,   170,   170,
1779      170,   170,   170,   170,   170,   170,   171,   171,   171,   171,
1780      171,   171,   171,   171,   171,   171,   171,   171,   171,   171,
1781      171,   171,   172,   172,   172,   172,   173,   173,   173,   173,
1782      173,   173,   173,   173,   173,   173,   173,   173,   173,   174,
1783      174,   174,   174,   175,   175,   175,   175,   176,   176,   177,
1784      177,   178,   178,   179,   179,   179,   179,   179,   179,   179,
1785      179,   180,   180,   180,   180,   180,   180,   180,   180,   181,
1786      181,   182,   182,   183,   184,   184,   185,   185,   186,   186,
1787      187,   187,   188,   188,   189,   190,   190,   190,   190,   190,
1788      190,   190,   190,   190,   190,   190,   190,   191,   191,   191,
1789      191,   191,   191,   191,   191,   191,   191,   191,   191,   192,
1790      192,   193,   193,   193,   193,   194,   194,   194,   194,   194,
1791      194,   194,   194,   194,   194,   194,   194,   194,   194,   194,
1792      194,   195,   195,   195,   195,   195,   195,   195,   195,   195,
1793      195,   195,   195,   196,   196,   197,   197,   198,   199,   199,
1794      199,   199,   199,   200,   200,   201,   201,   201,   201,   201,
1795      201,   201,   201,   201,   201,   202,   203,   203,   204,   204,
1796      204,   204,   205,   206,   206,   206,   207,   207,   208,   208,
1797      209,   210,   210,   211,   211,   211,   211,   212,   213,   213,
1798      214,   215,   215,   216,   217,   217,   217,   219,   218,   220,
1799      220,   221,   221,   221,   221,   221,   221,   221,   221,   221,
1800      221,   221,   222,   222,   223,   223,   224,   225,   225,   226,
1801      227,   227,   227,   228,   228,   229,   229,   229,   229,   229,
1802      229,   229,   229,   229,   230,   230,   231,   232,   232,   233,
1803      233,   234,   234,   235,   235,   236,   236,   236,   236,   236,
1804      236,   236,   236,   236,   236,   236,   236,   236,   236,   236,
1805      237,   237,   238,   238,   239,   239,   239,   239,   239,   239,
1806      239,   239
1807 };
1808
1809 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
1810 static const unsigned char yyr2[] =
1811 {
1812        0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
1813        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1814        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1815        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1816        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1817        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1818        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1819        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1820        1,     2,     0,     1,     1,     1,     1,     1,     1,     1,
1821        0,     1,     1,     1,     1,     1,     1,     2,     0,     0,
1822        2,     0,     3,     2,     0,     1,     0,     3,     1,     2,
1823        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1824        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1825        2,     4,     5,     5,     3,     2,     5,     4,     2,     1,
1826        3,     1,     3,     1,     0,     4,     3,     3,     4,     4,
1827        3,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1828        2,     6,     5,     8,     6,     6,     6,     7,     7,     6,
1829        6,     8,     8,     3,     1,     1,     1,     1,     2,     2,
1830        4,     2,     1,     1,     1,     4,     2,     4,     6,     6,
1831        6,     6,     3,     4,     0,     1,     1,     1,     3,     3,
1832        3,     3,     3,     3,     1,     0,     1,     1,     1,     0,
1833        2,     3,     1,     1,     3,     1,     0,     8,     1,     1,
1834        3,     1,     1,     3,     0,     1,     1,     0,     4,     0,
1835        1,     1,     1,     1,     1,     1,     1,     1,     1,     3,
1836        1,     5,     1,     1,     1,     1,     2,     2,     1,     2,
1837        2,     0,     1,     1,     1,     2,     2,     3,     9,     9,
1838        8,    14,     1,     1,     6,     5,     2,     6,     7,     1,
1839        3,     1,     0,     2,     1,     5,     5,     5,     6,     6,
1840        4,     4,     6,     4,     4,     6,     6,     2,     7,     1,
1841        2,     0,     1,     0,     3,     6,     3,     6,     2,     4,
1842        6,     4
1843 };
1844
1845 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1846    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
1847    means the default is an error.  */
1848 static const unsigned short yydefact[] =
1849 {
1850      194,     0,    90,   182,     1,   181,   227,    83,    84,    85,
1851       87,    88,    89,    86,     0,    98,   251,   178,   179,   206,
1852      207,     0,     0,     0,    90,     0,   186,   224,     0,     0,
1853       91,    92,    93,    94,    95,    96,     0,     0,   252,   251,
1854      248,    82,     0,     0,     0,     0,   192,     0,     0,     0,
1855        0,     0,   183,   184,     0,     0,    81,   225,   226,    98,
1856      195,   180,    97,   111,   115,   116,   117,   118,   119,   120,
1857      121,   122,   123,   124,   125,   126,   127,     2,     3,     0,
1858        0,     0,     0,   242,     0,     0,   110,   129,   114,   243,
1859      128,   218,   219,   220,   221,   222,   223,   247,     0,     0,
1860        0,   254,   253,   263,   293,   262,   249,   250,     0,     0,
1861        0,     0,   205,   193,   187,   185,   175,   176,     0,     0,
1862        0,     0,   228,   130,     0,     0,     0,   113,   135,   139,
1863        0,     0,   144,   138,   256,     0,   255,     0,     0,    72,
1864       76,    71,    75,    70,    74,    69,    73,    77,    78,     0,
1865      292,   274,     0,    98,     6,     7,     8,     9,    10,    11,
1866       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
1867       22,    23,    24,    25,     0,     0,     0,     0,     0,     0,
1868        0,     0,    52,    53,    54,    55,     0,     0,     0,     0,
1869       68,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1870       65,    66,    67,     0,     0,     0,     0,     0,    98,   266,
1871        0,   289,   200,   197,   196,   198,   199,   201,   204,     0,
1872      106,   106,   115,   116,   117,   118,   119,   120,   121,   122,
1873      123,   124,   125,     0,     0,     0,     0,   106,   106,     0,
1874        0,     0,     0,     0,   134,   216,   143,   141,     0,   231,
1875      232,   233,   236,   237,   238,   234,   235,   229,     0,     0,
1876        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1877        0,   240,   245,   244,   246,     0,   257,     0,   273,     0,
1878       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
1879        0,    50,    51,    36,    37,    38,    39,    40,    41,    42,
1880       43,    44,    45,    46,    47,    48,    49,     0,   101,   101,
1881      298,     0,     0,   287,     0,     0,     0,     0,     0,     0,
1882        0,     0,     0,     0,     0,     0,     0,     0,   202,     0,
1883      190,   191,   158,   159,     4,     5,   156,   157,   160,   151,
1884      152,   155,     0,     0,     0,     0,   154,   153,   188,   189,
1885      112,   112,   137,     0,   140,   215,   209,   212,   213,     0,
1886        0,   131,   230,     0,     0,     0,     0,     0,     0,     0,
1887        0,   174,     0,     0,     0,     0,     0,     0,     0,     0,
1888        0,     0,     0,     0,   294,     0,   296,   291,     0,     0,
1889        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1890        0,     0,     0,   203,     0,     0,   108,   106,   146,     0,
1891        0,   150,     0,   147,   132,   133,   136,   208,   210,     0,
1892      104,   142,     0,     0,     0,   291,     0,     0,     0,     0,
1893        0,   239,     0,     0,     0,     0,     0,     0,     0,     0,
1894        0,     0,     0,     0,     0,     0,   301,     0,     0,     0,
1895      283,   284,     0,     0,     0,     0,     0,   280,   281,     0,
1896      299,     0,   103,   109,   107,   145,   148,   149,   214,   211,
1897      105,    99,     0,     0,     0,     0,     0,     0,     0,     0,
1898      173,     0,     0,     0,     0,     0,     0,     0,   272,     0,
1899        0,   101,   102,   101,   269,   290,     0,     0,     0,     0,
1900        0,   275,   276,   277,   272,     0,     0,   217,   241,     0,
1901        0,   162,     0,     0,     0,     0,     0,     0,     0,     0,
1902        0,     0,     0,   271,     0,   278,   279,     0,   295,   297,
1903        0,     0,     0,   282,   285,   286,     0,   300,   100,     0,
1904        0,     0,   170,     0,     0,   164,   165,   166,   169,   161,
1905        0,   260,     0,     0,     0,   270,   267,     0,   288,   167,
1906      168,     0,     0,     0,   258,     0,   259,     0,     0,   268,
1907      163,   171,   172,     0,     0,     0,     0,     0,     0,   265,
1908        0,     0,   264,     0,   261
1909 };
1910
1911 /* YYDEFGOTO[NTERM-NUM]. */
1912 static const short yydefgoto[] =
1913 {
1914       -1,    83,   336,   266,   267,   268,   290,   307,   269,   270,
1915      233,   234,   149,   235,    24,    15,    36,   507,   384,   406,
1916      471,   330,   407,    84,    85,   236,    87,    88,   130,   248,
1917      371,   271,   372,   118,     1,     2,    55,     3,    61,   215,
1918       46,   113,   219,    89,   418,   357,   358,   359,    37,    93,
1919       16,    96,    17,    59,    18,    27,   363,   272,    90,   274,
1920      494,    39,    40,    41,   105,   106,   553,   107,   313,   523,
1921      524,   208,   209,   446,   210,   211
1922 };
1923
1924 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1925    STATE-NUM.  */
1926 #define YYPACT_NINF -537
1927 static const short yypact[] =
1928 {
1929     -537,    75,    61,  1145,  -537,  -537,  -537,  -537,  -537,  -537,
1930     -537,  -537,  -537,  -537,    18,   180,    55,  -537,  -537,  -537,
1931     -537,   -28,   -61,    33,   130,   -40,  -537,   102,    87,   117,
1932     -537,  -537,  -537,  -537,  -537,  -537,   838,   -24,  -537,   -15,
1933     -537,    48,   -11,    -2,     6,    12,  -537,    11,    87,   838,
1934       -9,    -9,  -537,  -537,    -9,    -9,  -537,  -537,  -537,   180,
1935     -537,  -537,  -537,    32,  -537,  -537,  -537,  -537,  -537,  -537,
1936     -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,   164,
1937      171,    -6,   512,  -537,   135,    41,  -537,  -537,  -103,  -537,
1938     -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,   883,    45,
1939      192,  -537,  -537,  -537,  1324,  -537,  -537,  -537,   175,   126,
1940      190,   188,   203,  -537,  -537,  -537,  -537,  -537,   911,   911,
1941      957,   911,  -537,  -537,    81,    97,   561,  -537,  -537,  -103,
1942     -109,   121,   641,  -537,    32,  1140,  -537,  1140,  1140,  -537,
1943     -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  1140,
1944     -537,  -537,   219,   180,  -537,  -537,  -537,  -537,  -537,  -537,
1945     -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,
1946     -537,  -537,  -537,  -537,    10,   112,   911,   911,   911,   911,
1947      911,   911,  -537,  -537,  -537,  -537,   911,   911,   911,   911,
1948     -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,
1949     -537,  -537,  -537,   911,   911,   911,   911,   911,   180,  -537,
1950       59,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,   -71,
1951      129,   129,   167,   193,   195,   218,   222,   224,   234,   243,
1952      250,   261,   263,   252,   252,   264,   993,   129,   129,   911,
1953      911,   127,   -97,   911,  -537,   680,  -537,   136,   137,  -537,
1954     -537,  -537,  -537,  -537,  -537,  -537,  -537,   229,    10,   112,
1955      140,   141,   144,   145,   146,   957,   147,   148,   150,   154,
1956      155,  -537,  -537,  -537,  -537,   158,  -537,   160,  -537,   838,
1957     -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,
1958      911,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,
1959     -537,  -537,  -537,  -537,  -537,  -537,  -537,   911,   163,   165,
1960     -537,  1140,   162,   169,   170,   172,   173,   174,   176,  1140,
1961     1140,  1140,   177,   276,   838,   911,   911,   288,  -537,    -8,
1962     -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,
1963     -537,  -537,   724,   957,   590,   292,  -537,  -537,  -537,  -537,
1964     -106,  -104,  -537,   179,  -103,  -537,   135,  -537,   178,   181,
1965      752,  -537,  -537,   296,   183,   187,   957,   957,   957,   957,
1966      957,  -537,  -131,   957,   957,   957,   957,   957,   315,   316,
1967     1140,  1140,  1140,     1,  -537,     7,  -537,   191,  1140,   186,
1968      911,   911,   911,   911,   911,   194,   197,   201,   911,   911,
1969     1140,  1140,   202,  -537,   304,   326,  -537,   129,  -537,   -60,
1970      -78,  -537,   -74,  -537,  -537,  -537,  -537,  -537,  -537,   799,
1971      309,  -537,   208,   957,   957,   191,   210,   213,   223,   225,
1972      957,  -537,   230,   231,   235,   236,   308,  1140,  1140,   227,
1973      237,   238,  1140,   357,  1140,   911,  -537,   239,  1140,   241,
1974     -537,  -537,   242,   244,  1140,  1140,  1140,  -537,  -537,   248,
1975     -537,   911,  -537,  -537,  -537,  -537,  -537,  -537,  -537,  -537,
1976     -537,   338,   366,   246,   251,   249,   957,   957,   957,   957,
1977     -537,   957,   957,   957,   957,   911,   253,   258,   911,  1140,
1978     1140,   254,  -537,   254,  -537,   255,  1140,   256,   911,   911,
1979      911,  -537,  -537,  -537,   911,  1140,   390,  -537,  -537,   957,
1980      957,  -537,   265,   260,   266,   267,   268,   272,   274,   275,
1981      277,   400,    29,   255,   280,  -537,  -537,   363,  -537,  -537,
1982      911,   278,  1140,  -537,  -537,  -537,   282,  -537,  -537,   283,
1983      287,   957,  -537,   957,   957,  -537,  -537,  -537,  -537,  -537,
1984     1140,  -537,  1229,    60,   381,  -537,  -537,   286,  -537,  -537,
1985     -537,   290,   293,   294,  -537,   270,  -537,  1229,   435,  -537,
1986     -537,  -537,  -537,   436,   302,  1140,  1140,   441,   196,  -537,
1987     1140,   442,  -537,  1140,  -537
1988 };
1989
1990 /* YYPGOTO[NTERM-NUM].  */
1991 static const short yypgoto[] =
1992 {
1993     -537,  -537,   226,   361,   362,   365,   209,   214,   368,   370,
1994      -99,   -98,  -507,  -537,   420,   452,  -134,  -537,  -303,    57,
1995     -537,  -216,  -537,   -45,  -537,   -36,  -537,   -79,   -30,  -537,
1996     -111,   245,  -210,   104,  -537,  -537,  -537,  -537,   431,  -537,
1997     -537,  -537,  -537,     4,  -537,    63,  -537,  -537,   421,  -537,
1998     -537,  -537,  -537,  -537,   480,  -537,  -537,  -536,  -105,    58,
1999      -88,  -537,   445,  -537,   -93,  -537,  -537,  -537,  -537,    42,
2000      -18,  -537,  -537,    64,  -537,  -537
2001 };
2002
2003 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
2004    positive, shift that token.  If negative, reduce the rule which
2005    number is the opposite.  If zero, do what YYDEFACT says.
2006    If YYTABLE_NINF, parse error.  */
2007 #define YYTABLE_NINF -178
2008 static const short yytable[] =
2009 {
2010       86,   147,   148,   129,   115,   331,   386,    25,    91,   237,
2011      136,   442,   125,    86,    38,   552,   565,   444,    94,   279,
2012      430,   348,   349,    42,    43,    44,   116,   117,   431,   404,
2013      273,   574,   273,   273,   139,   140,   141,   142,   143,   144,
2014      145,   146,   243,    45,   273,    25,   567,   129,   405,   137,
2015     -112,   414,   244,   129,   243,   415,   133,   443,   133,   133,
2016      138,  -177,   135,   443,   353,   139,   140,   141,   142,   143,
2017      144,   145,   146,   430,   324,     4,    19,   430,    20,    28,
2018      327,   466,   220,   221,    38,   238,   328,   467,   131,    47,
2019      310,   430,     5,   314,    48,     6,   242,   465,   315,   316,
2020      317,   318,   247,     7,     8,     9,    10,    11,    12,    13,
2021       56,   280,   281,   282,   283,   284,   285,    60,   322,   323,
2022       98,    99,   100,    14,   101,   102,   103,   286,   287,   288,
2023      289,   347,   409,   410,   412,    62,    92,   291,   292,   108,
2024      308,   309,   135,   311,   312,   135,    95,    57,   109,    58,
2025      135,   135,   135,   135,   126,   119,   110,    49,   120,   121,
2026      350,   351,   111,    19,   354,    20,   112,   319,   320,   321,
2027      135,   135,     7,     8,     9,    50,    11,    51,    13,    52,
2028      213,   214,   123,   325,   326,  -113,   551,    53,   528,   124,
2029      529,   464,   332,   333,   132,   275,   276,   139,   140,   141,
2030      142,   143,   144,   145,   146,   212,   273,   277,   216,   356,
2031      -72,   -72,   -76,   -76,   273,   273,   273,   566,   217,   293,
2032      294,   295,   296,   297,   298,   299,   300,   301,   302,   303,
2033      304,   305,   306,   218,   380,   -71,   -71,   239,   402,   -75,
2034      -75,   -70,   -70,    86,    29,    30,    31,    32,    33,    34,
2035       35,   -74,   -74,   240,   381,   425,   426,   427,   428,   429,
2036      -69,   -69,   432,   433,   434,   435,   436,   -73,   -73,   334,
2037      335,   382,   101,   102,   245,   273,   273,   273,   278,   400,
2038      329,   354,   -79,   273,   -80,   338,   352,   360,    86,   401,
2039      135,   361,   362,   366,   367,   273,   273,   368,   369,   370,
2040      373,   374,   449,   375,   451,   452,   453,   376,   377,   378,
2041      457,   379,   473,   474,   383,   399,   385,   388,   403,   480,
2042      389,   390,   413,   391,   392,   393,   422,   394,   398,   419,
2043      437,   438,   273,   273,   462,   420,   423,   273,   416,   273,
2044      424,   448,   445,   273,   463,   454,   404,   485,   455,   273,
2045      273,   273,   456,   461,   135,   450,   135,   135,   135,   472,
2046      417,   476,   135,   458,   477,   512,   513,   514,   515,   387,
2047      516,   517,   518,   519,   478,   492,   479,   395,   396,   397,
2048      488,   481,   482,   356,   273,   273,   483,   484,   489,   490,
2049      496,   273,   498,   499,   506,   500,   508,   509,   539,   540,
2050      273,   504,   510,   511,   521,   527,   530,   532,   538,   135,
2051      533,   534,   535,   522,   542,   550,   541,   543,   544,   443,
2052      568,   573,   545,   147,   148,   505,   546,   273,   547,   548,
2053      561,   549,   562,   563,   554,   556,   558,   559,   439,   440,
2054      441,   560,   555,   569,   570,   273,   447,   571,   572,   520,
2055      575,   576,   135,   577,   147,   148,   580,   583,   459,   460,
2056      337,   104,   135,   135,   135,   203,   204,   364,   135,   205,
2057      273,   273,   206,   365,   207,   273,    54,   470,   273,   114,
2058      122,   346,   469,    26,    97,   581,   536,   495,     0,   475,
2059        0,     0,     0,     0,   135,   486,   487,     0,     0,     0,
2060      491,     0,   493,     0,     0,     0,   497,     0,     0,     0,
2061        0,     0,   501,   502,   503,   127,    64,    65,    66,    67,
2062       68,    69,    70,    71,    72,    73,    74,    75,    76,     0,
2063        0,    77,    78,     0,     0,     0,     0,     0,     0,     0,
2064       19,     0,    20,     0,     0,     0,     0,   525,   526,     0,
2065        0,     0,     0,     0,   531,     0,     0,     0,     0,     0,
2066        0,     0,     0,   537,   127,    64,    65,    66,    67,    68,
2067       69,    70,    71,    72,    73,    74,    75,    76,     0,     0,
2068       77,    78,     0,     0,     0,     0,     0,     0,     0,    19,
2069      557,    20,     0,   127,   222,   223,   224,   225,   226,   227,
2070      228,   229,   230,   231,   232,    75,    76,     0,   564,    77,
2071       78,     0,     0,     0,     0,     0,     0,     0,    19,     0,
2072       20,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2073        0,     0,     0,   578,   579,     0,     0,     0,   582,     0,
2074        0,   584,     0,     0,   127,    64,    65,    66,    67,    68,
2075       69,    70,    71,    72,    73,    74,    75,    76,     0,     0,
2076       77,    78,     0,     0,    79,     0,     0,    80,     0,    19,
2077       81,    20,    82,   128,     0,     0,     0,     0,     0,     0,
2078        0,   246,     0,   127,    64,    65,    66,    67,    68,    69,
2079       70,    71,    72,    73,    74,    75,    76,     0,     0,    77,
2080       78,     0,     0,     0,     0,     0,     0,     0,    19,     0,
2081       20,     0,     0,    79,     0,     0,    80,     0,     0,    81,
2082      355,    82,   241,     0,     0,     0,     0,   127,   222,   223,
2083      224,   225,   226,   227,   228,   229,   230,   231,   232,    75,
2084       76,     0,    79,    77,    78,    80,     0,     0,    81,     0,
2085       82,   411,    19,     0,    20,   127,    64,    65,    66,    67,
2086       68,    69,    70,    71,    72,    73,    74,    75,    76,     0,
2087        0,    77,    78,     0,     0,     0,     0,     0,     0,     0,
2088       19,     0,    20,     0,     0,     0,     0,     0,     0,     0,
2089        0,     0,   421,    79,     0,     0,    80,     0,     0,    81,
2090        0,    82,   127,    64,    65,    66,    67,    68,    69,    70,
2091       71,    72,    73,    74,    75,    76,     0,     0,    77,    78,
2092        0,     0,     0,     0,     0,     0,     0,    19,     0,    20,
2093        0,     0,    79,     0,     0,    80,     0,     0,    81,   468,
2094       82,    63,    64,    65,    66,    67,    68,    69,    70,    71,
2095       72,    73,    74,    75,    76,     0,     0,    77,    78,     0,
2096        0,     0,     0,     0,     0,     0,    19,     0,    20,     0,
2097        0,     0,     0,     0,     0,     0,    79,     0,     0,    80,
2098        0,   408,    81,     0,    82,     0,   134,    64,    65,    66,
2099       67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
2100        0,     0,    77,    78,    79,     0,     0,    80,     0,     0,
2101       81,    19,    82,    20,   127,    64,    65,    66,    67,    68,
2102       69,    70,    71,    72,    73,    74,    75,    76,     0,     0,
2103       77,    78,     0,     0,     0,     0,     0,     0,     0,    19,
2104        0,    20,     0,     0,     0,     0,     0,     0,     0,     0,
2105        0,    79,     0,     0,    80,     0,     0,    81,     0,    82,
2106      127,   222,   223,   224,   225,   226,   227,   228,   229,   230,
2107      231,   232,    75,    76,     0,     0,    77,    78,     0,     0,
2108        0,     0,     0,     0,     0,    19,     0,    20,     0,     0,
2109       79,     0,     0,    80,     0,     0,    81,     0,    82,     0,
2110        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2111        0,     0,    77,    78,     0,   339,   340,   341,     0,     0,
2112        0,    19,     0,    20,     0,     0,     0,     0,     0,     0,
2113        0,     0,     0,     0,     0,    79,     0,     0,    80,     0,
2114        0,    81,     0,    82,     0,     0,     0,     0,     0,     0,
2115        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2116        0,     0,     0,    79,     0,     0,    80,     0,     0,    81,
2117        0,    82,   154,   155,   156,   157,   158,   159,   160,   161,
2118      162,   163,   164,   165,   166,   167,   168,   169,   170,   171,
2119      172,   173,   258,   259,     0,     0,     0,     0,     0,     0,
2120        0,     0,     0,     0,     0,     0,     0,     0,     0,    79,
2121        0,     0,    80,     0,     0,    81,     0,    82,     0,   260,
2122        0,   261,   182,   183,   184,   185,     0,   262,   263,   264,
2123      190,   191,   192,   193,   194,   195,   196,   197,   198,   199,
2124      200,   201,   202,     0,     0,     0,     0,     0,   342,     0,
2125        0,   343,     0,   344,     0,     0,   345,   249,   250,    77,
2126       78,   251,   252,   253,   254,   255,   256,     0,    19,     0,
2127       20,     0,   -82,    19,     0,    20,     0,     0,     0,     6,
2128      -82,   -82,     0,     0,     0,     0,     0,   -82,   -82,   -82,
2129      -82,   -82,   -82,   -82,   -82,    21,     0,     0,     0,     0,
2130        0,   257,   -82,    22,     0,     0,     0,    23,     0,     0,
2131        0,     0,     0,     0,     0,     0,     0,     0,     0,   154,
2132      155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
2133      165,   166,   167,   168,   169,   170,   171,   172,   173,   258,
2134      259,     0,     0,     0,     0,     0,   249,   250,     0,     0,
2135      251,   252,   253,   254,   255,   256,     0,     0,     0,     0,
2136        0,     0,     0,     0,     0,     0,   260,     0,   261,   182,
2137      183,   184,   185,     0,   262,   263,   264,   190,   191,   192,
2138      193,   194,   195,   196,   197,   198,   199,   200,   201,   202,
2139      257,     0,     0,     0,     0,     0,     0,     0,   265,     0,
2140        0,     0,     0,     0,     0,     0,     0,     0,   154,   155,
2141      156,   157,   158,   159,   160,   161,   162,   163,   164,   165,
2142      166,   167,   168,   169,   170,   171,   172,   173,   258,   259,
2143        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2144        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2145        0,     0,     0,     0,     0,   260,     0,   261,   182,   183,
2146      184,   185,   150,   262,   263,   264,   190,   191,   192,   193,
2147      194,   195,   196,   197,   198,   199,   200,   201,   202,     0,
2148        0,     0,     0,   151,   152,     0,     0,   265,     0,     0,
2149        0,     0,     0,     0,     0,     0,     0,     0,     0,   153,
2150        0,     0,     0,   154,   155,   156,   157,   158,   159,   160,
2151      161,   162,   163,   164,   165,   166,   167,   168,   169,   170,
2152      171,   172,   173,   174,   175,     0,     0,     0,     0,     0,
2153        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2154        0,     0,     0,     0,     0,   176,   177,   178,     0,     0,
2155      179,   180,   181,   182,   183,   184,   185,   186,   187,   188,
2156      189,   190,   191,   192,   193,   194,   195,   196,   197,   198,
2157      199,   200,   201,   202
2158 };
2159
2160 static const short yycheck[] =
2161 {
2162       36,   100,   100,    82,    49,   221,   309,     3,    32,   120,
2163       98,    10,    18,    49,    29,   522,   552,    10,    33,   153,
2164      151,   237,   238,    51,    52,    53,    35,    36,   159,    37,
2165      135,   567,   137,   138,     5,     6,     7,     8,     9,    10,
2166       11,    12,   151,    71,   149,    41,   553,   126,    56,     4,
2167      153,   157,   161,   132,   151,   159,   162,    56,   162,   162,
2168       15,     0,    98,    56,   161,     5,     6,     7,     8,     9,
2169       10,    11,    12,   151,   208,     0,    28,   151,    30,    61,
2170      151,   159,   118,   119,    29,   121,   157,   161,    84,   150,
2171      178,   151,    31,   181,    61,    34,   126,   157,   186,   187,
2172      188,   189,   132,    42,    43,    44,    45,    46,    47,    48,
2173      150,   101,   102,   103,   104,   105,   106,    30,   206,   207,
2174       72,    73,    74,    62,    76,    77,    78,   117,   118,   119,
2175      120,   236,   342,   343,   344,    18,   160,    25,    26,   150,
2176      176,   177,   178,   179,   180,   181,   161,    45,   150,    47,
2177      186,   187,   188,   189,   160,    51,   150,    27,    54,    55,
2178      239,   240,   150,    28,   243,    30,   155,   203,   204,   205,
2179      206,   207,    42,    43,    44,    45,    46,    47,    48,    49,
2180       54,    55,    18,   124,   125,   153,   157,    57,   491,    18,
2181      493,   407,    25,    26,   153,   137,   138,     5,     6,     7,
2182        8,     9,    10,    11,    12,    30,   311,   149,    18,   245,
2183       17,    18,    17,    18,   319,   320,   321,   157,    30,   107,
2184      108,   109,   110,   111,   112,   113,   114,   115,   116,   117,
2185      118,   119,   120,    30,   279,    17,    18,   156,   326,    17,
2186       18,    17,    18,   279,    64,    65,    66,    67,    68,    69,
2187       70,    17,    18,   156,   290,   366,   367,   368,   369,   370,
2188       17,    18,   373,   374,   375,   376,   377,    17,    18,    17,
2189       18,   307,    76,    77,   153,   380,   381,   382,    59,   324,
2190      151,   360,    21,   388,    21,    21,   159,   151,   324,   325,
2191      326,   154,    63,   153,   153,   400,   401,   153,   153,   153,
2192      153,   153,   390,   153,   392,   393,   394,   153,   153,   151,
2193      398,   151,   423,   424,   151,    39,   151,   155,    30,   430,
2194      151,   151,    30,   151,   151,   151,    30,   151,   151,   151,
2195       15,    15,   437,   438,    30,   154,   153,   442,   159,   444,
2196      153,   155,   151,   448,    18,   151,    37,    39,   151,   454,
2197      455,   456,   151,   151,   390,   391,   392,   393,   394,   151,
2198      356,   151,   398,   399,   151,   476,   477,   478,   479,   311,
2199      481,   482,   483,   484,   151,    18,   151,   319,   320,   321,
2200      153,   151,   151,   419,   489,   490,   151,   151,   151,   151,
2201      151,   496,   151,   151,    56,   151,    30,   151,   509,   510,
2202      505,   153,   151,   154,   151,   151,   151,   151,    18,   445,
2203      498,   499,   500,   155,   154,    15,   151,   151,   151,    56,
2204       39,   151,   154,   522,   522,   461,   154,   532,   154,   154,
2205      541,   154,   543,   544,   154,   157,   154,   154,   380,   381,
2206      382,   154,   530,   157,   154,   550,   388,   154,   154,   485,
2207       15,    15,   488,   151,   553,   553,    15,    15,   400,   401,
2208      234,    41,   498,   499,   500,   104,   104,   258,   504,   104,
2209      575,   576,   104,   259,   104,   580,    24,   420,   583,    48,
2210       59,   236,   419,     3,    39,   578,   504,   445,    -1,   425,
2211       -1,    -1,    -1,    -1,   530,   437,   438,    -1,    -1,    -1,
2212      442,    -1,   444,    -1,    -1,    -1,   448,    -1,    -1,    -1,
2213       -1,    -1,   454,   455,   456,     3,     4,     5,     6,     7,
2214        8,     9,    10,    11,    12,    13,    14,    15,    16,    -1,
2215       -1,    19,    20,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2216       28,    -1,    30,    -1,    -1,    -1,    -1,   489,   490,    -1,
2217       -1,    -1,    -1,    -1,   496,    -1,    -1,    -1,    -1,    -1,
2218       -1,    -1,    -1,   505,     3,     4,     5,     6,     7,     8,
2219        9,    10,    11,    12,    13,    14,    15,    16,    -1,    -1,
2220       19,    20,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    28,
2221      532,    30,    -1,     3,     4,     5,     6,     7,     8,     9,
2222       10,    11,    12,    13,    14,    15,    16,    -1,   550,    19,
2223       20,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    28,    -1,
2224       30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2225       -1,    -1,    -1,   575,   576,    -1,    -1,    -1,   580,    -1,
2226       -1,   583,    -1,    -1,     3,     4,     5,     6,     7,     8,
2227        9,    10,    11,    12,    13,    14,    15,    16,    -1,    -1,
2228       19,    20,    -1,    -1,   152,    -1,    -1,   155,    -1,    28,
2229      158,    30,   160,   161,    -1,    -1,    -1,    -1,    -1,    -1,
2230       -1,    40,    -1,     3,     4,     5,     6,     7,     8,     9,
2231       10,    11,    12,    13,    14,    15,    16,    -1,    -1,    19,
2232       20,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    28,    -1,
2233       30,    -1,    -1,   152,    -1,    -1,   155,    -1,    -1,   158,
2234       40,   160,   161,    -1,    -1,    -1,    -1,     3,     4,     5,
2235        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
2236       16,    -1,   152,    19,    20,   155,    -1,    -1,   158,    -1,
2237      160,   161,    28,    -1,    30,     3,     4,     5,     6,     7,
2238        8,     9,    10,    11,    12,    13,    14,    15,    16,    -1,
2239       -1,    19,    20,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2240       28,    -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2241       -1,    -1,    40,   152,    -1,    -1,   155,    -1,    -1,   158,
2242       -1,   160,     3,     4,     5,     6,     7,     8,     9,    10,
2243       11,    12,    13,    14,    15,    16,    -1,    -1,    19,    20,
2244       -1,    -1,    -1,    -1,    -1,    -1,    -1,    28,    -1,    30,
2245       -1,    -1,   152,    -1,    -1,   155,    -1,    -1,   158,    40,
2246      160,     3,     4,     5,     6,     7,     8,     9,    10,    11,
2247       12,    13,    14,    15,    16,    -1,    -1,    19,    20,    -1,
2248       -1,    -1,    -1,    -1,    -1,    -1,    28,    -1,    30,    -1,
2249       -1,    -1,    -1,    -1,    -1,    -1,   152,    -1,    -1,   155,
2250       -1,   157,   158,    -1,   160,    -1,     3,     4,     5,     6,
2251        7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
2252       -1,    -1,    19,    20,   152,    -1,    -1,   155,    -1,    -1,
2253      158,    28,   160,    30,     3,     4,     5,     6,     7,     8,
2254        9,    10,    11,    12,    13,    14,    15,    16,    -1,    -1,
2255       19,    20,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    28,
2256       -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2257       -1,   152,    -1,    -1,   155,    -1,    -1,   158,    -1,   160,
2258        3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
2259       13,    14,    15,    16,    -1,    -1,    19,    20,    -1,    -1,
2260       -1,    -1,    -1,    -1,    -1,    28,    -1,    30,    -1,    -1,
2261      152,    -1,    -1,   155,    -1,    -1,   158,    -1,   160,    -1,
2262       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2263       -1,    -1,    19,    20,    -1,    22,    23,    24,    -1,    -1,
2264       -1,    28,    -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,
2265       -1,    -1,    -1,    -1,    -1,   152,    -1,    -1,   155,    -1,
2266       -1,   158,    -1,   160,    -1,    -1,    -1,    -1,    -1,    -1,
2267       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2268       -1,    -1,    -1,   152,    -1,    -1,   155,    -1,    -1,   158,
2269       -1,   160,    79,    80,    81,    82,    83,    84,    85,    86,
2270       87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
2271       97,    98,    99,   100,    -1,    -1,    -1,    -1,    -1,    -1,
2272       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   152,
2273       -1,    -1,   155,    -1,    -1,   158,    -1,   160,    -1,   126,
2274       -1,   128,   129,   130,   131,   132,    -1,   134,   135,   136,
2275      137,   138,   139,   140,   141,   142,   143,   144,   145,   146,
2276      147,   148,   149,    -1,    -1,    -1,    -1,    -1,   155,    -1,
2277       -1,   158,    -1,   160,    -1,    -1,   163,    17,    18,    19,
2278       20,    21,    22,    23,    24,    25,    26,    -1,    28,    -1,
2279       30,    -1,    27,    28,    -1,    30,    -1,    -1,    -1,    34,
2280       35,    36,    -1,    -1,    -1,    -1,    -1,    42,    43,    44,
2281       45,    46,    47,    48,    49,    50,    -1,    -1,    -1,    -1,
2282       -1,    61,    57,    58,    -1,    -1,    -1,    62,    -1,    -1,
2283       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    79,
2284       80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
2285       90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
2286      100,    -1,    -1,    -1,    -1,    -1,    17,    18,    -1,    -1,
2287       21,    22,    23,    24,    25,    26,    -1,    -1,    -1,    -1,
2288       -1,    -1,    -1,    -1,    -1,    -1,   126,    -1,   128,   129,
2289      130,   131,   132,    -1,   134,   135,   136,   137,   138,   139,
2290      140,   141,   142,   143,   144,   145,   146,   147,   148,   149,
2291       61,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   158,    -1,
2292       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    79,    80,
2293       81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
2294       91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
2295       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2296       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2297       -1,    -1,    -1,    -1,    -1,   126,    -1,   128,   129,   130,
2298      131,   132,    38,   134,   135,   136,   137,   138,   139,   140,
2299      141,   142,   143,   144,   145,   146,   147,   148,   149,    -1,
2300       -1,    -1,    -1,    59,    60,    -1,    -1,   158,    -1,    -1,
2301       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    75,
2302       -1,    -1,    -1,    79,    80,    81,    82,    83,    84,    85,
2303       86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
2304       96,    97,    98,    99,   100,    -1,    -1,    -1,    -1,    -1,
2305       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2306       -1,    -1,    -1,    -1,    -1,   121,   122,   123,    -1,    -1,
2307      126,   127,   128,   129,   130,   131,   132,   133,   134,   135,
2308      136,   137,   138,   139,   140,   141,   142,   143,   144,   145,
2309      146,   147,   148,   149
2310 };
2311
2312 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2313    symbol of state STATE-NUM.  */
2314 static const unsigned char yystos[] =
2315 {
2316        0,   198,   199,   201,     0,    31,    34,    42,    43,    44,
2317       45,    46,    47,    48,    62,   179,   214,   216,   218,    28,
2318       30,    50,    58,    62,   178,   207,   218,   219,    61,    64,
2319       65,    66,    67,    68,    69,    70,   180,   212,    29,   225,
2320      226,   227,    51,    52,    53,    71,   204,   150,    61,    27,
2321       45,    47,    49,    57,   179,   200,   150,    45,    47,   217,
2322       30,   202,    18,     3,     4,     5,     6,     7,     8,     9,
2323       10,    11,    12,    13,    14,    15,    16,    19,    20,   152,
2324      155,   158,   160,   165,   187,   188,   189,   190,   191,   207,
2325      222,    32,   160,   213,    33,   161,   215,   226,    72,    73,
2326       74,    76,    77,    78,   178,   228,   229,   231,   150,   150,
2327      150,   150,   155,   205,   202,   187,    35,    36,   197,   197,
2328      197,   197,   212,    18,    18,    18,   160,     3,   161,   191,
2329      192,   207,   153,   162,     3,   189,   224,     4,    15,     5,
2330        6,     7,     8,     9,    10,    11,    12,   174,   175,   176,
2331       38,    59,    60,    75,    79,    80,    81,    82,    83,    84,
2332       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
2333       95,    96,    97,    98,    99,   100,   121,   122,   123,   126,
2334      127,   128,   129,   130,   131,   132,   133,   134,   135,   136,
2335      137,   138,   139,   140,   141,   142,   143,   144,   145,   146,
2336      147,   148,   149,   167,   168,   169,   172,   173,   235,   236,
2337      238,   239,    30,    54,    55,   203,    18,    30,    30,   206,
2338      189,   189,     4,     5,     6,     7,     8,     9,    10,    11,
2339       12,    13,    14,   174,   175,   177,   189,   194,   189,   156,
2340      156,   161,   192,   151,   161,   153,    40,   192,   193,    17,
2341       18,    21,    22,    23,    24,    25,    26,    61,    99,   100,
2342      126,   128,   134,   135,   136,   158,   167,   168,   169,   172,
2343      173,   195,   221,   222,   223,   223,   223,   223,    59,   180,
2344      101,   102,   103,   104,   105,   106,   117,   118,   119,   120,
2345      170,    25,    26,   107,   108,   109,   110,   111,   112,   113,
2346      114,   115,   116,   117,   118,   119,   120,   171,   189,   189,
2347      224,   189,   189,   232,   224,   224,   224,   224,   224,   189,
2348      189,   189,   224,   224,   180,   124,   125,   151,   157,   151,
2349      185,   185,    25,    26,    17,    18,   166,   166,    21,    22,
2350       23,    24,   155,   158,   160,   163,   195,   222,   185,   185,
2351      191,   191,   159,   161,   191,    40,   189,   209,   210,   211,
2352      151,   154,    63,   220,   170,   171,   153,   153,   153,   153,
2353      153,   194,   196,   153,   153,   153,   153,   153,   151,   151,
2354      187,   189,   189,   151,   182,   151,   182,   223,   155,   151,
2355      151,   151,   151,   151,   151,   223,   223,   223,   151,    39,
2356      187,   189,   224,    30,    37,    56,   183,   186,   157,   196,
2357      196,   161,   196,    30,   157,   159,   159,   207,   208,   151,
2358      154,    40,    30,   153,   153,   194,   194,   194,   194,   194,
2359      151,   159,   194,   194,   194,   194,   194,    15,    15,   223,
2360      223,   223,    10,    56,    10,   151,   237,   223,   155,   224,
2361      189,   224,   224,   224,   151,   151,   151,   224,   189,   223,
2362      223,   151,    30,    18,   185,   157,   159,   161,    40,   209,
2363      183,   184,   151,   194,   194,   237,   151,   151,   151,   151,
2364      194,   151,   151,   151,   151,    39,   223,   223,   153,   151,
2365      151,   223,    18,   223,   224,   233,   151,   223,   151,   151,
2366      151,   223,   223,   223,   153,   189,    56,   181,    30,   151,
2367      151,   154,   194,   194,   194,   194,   194,   194,   194,   194,
2368      189,   151,   155,   233,   234,   223,   223,   151,   182,   182,
2369      151,   223,   151,   224,   224,   224,   234,   223,    18,   194,
2370      194,   151,   154,   151,   151,   154,   154,   154,   154,   154,
2371       15,   157,   176,   230,   154,   224,   157,   223,   154,   154,
2372      154,   194,   194,   194,   223,   221,   157,   176,    39,   157,
2373      154,   154,   154,   151,   221,    15,    15,   151,   223,   223,
2374       15,   228,   223,    15,   223
2375 };
2376
2377 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2378 # define YYSIZE_T __SIZE_TYPE__
2379 #endif
2380 #if ! defined (YYSIZE_T) && defined (size_t)
2381 # define YYSIZE_T size_t
2382 #endif
2383 #if ! defined (YYSIZE_T)
2384 # if defined (__STDC__) || defined (__cplusplus)
2385 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2386 #  define YYSIZE_T size_t
2387 # endif
2388 #endif
2389 #if ! defined (YYSIZE_T)
2390 # define YYSIZE_T unsigned int
2391 #endif
2392
2393 #define yyerrok         (yyerrstatus = 0)
2394 #define yyclearin       (yychar = YYEMPTY)
2395 #define YYEMPTY         -2
2396 #define YYEOF           0
2397
2398 #define YYACCEPT        goto yyacceptlab
2399 #define YYABORT         goto yyabortlab
2400 #define YYERROR         goto yyerrlab1
2401
2402 /* Like YYERROR except do call yyerror.  This remains here temporarily
2403    to ease the transition to the new meaning of YYERROR, for GCC.
2404    Once GCC version 2 has supplanted version 1, this can go.  */
2405
2406 #define YYFAIL          goto yyerrlab
2407
2408 #define YYRECOVERING()  (!!yyerrstatus)
2409
2410 #define YYBACKUP(Token, Value)                                  \
2411 do                                                              \
2412   if (yychar == YYEMPTY && yylen == 1)                          \
2413     {                                                           \
2414       yychar = (Token);                                         \
2415       yylval = (Value);                                         \
2416       yychar1 = YYTRANSLATE (yychar);                           \
2417       YYPOPSTACK;                                               \
2418       goto yybackup;                                            \
2419     }                                                           \
2420   else                                                          \
2421     {                                                           \
2422       yyerror ("syntax error: cannot back up");                 \
2423       YYERROR;                                                  \
2424     }                                                           \
2425 while (0)
2426
2427 #define YYTERROR        1
2428 #define YYERRCODE       256
2429
2430 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
2431    are run).  */
2432
2433 #ifndef YYLLOC_DEFAULT
2434 # define YYLLOC_DEFAULT(Current, Rhs, N)           \
2435   Current.first_line   = Rhs[1].first_line;      \
2436   Current.first_column = Rhs[1].first_column;    \
2437   Current.last_line    = Rhs[N].last_line;       \
2438   Current.last_column  = Rhs[N].last_column;
2439 #endif
2440
2441 /* YYLEX -- calling `yylex' with the right arguments.  */
2442
2443 #define YYLEX   yylex ()
2444
2445 /* Enable debugging if requested.  */
2446 #if YYDEBUG
2447
2448 # ifndef YYFPRINTF
2449 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2450 #  define YYFPRINTF fprintf
2451 # endif
2452
2453 # define YYDPRINTF(Args)                        \
2454 do {                                            \
2455   if (yydebug)                                  \
2456     YYFPRINTF Args;                             \
2457 } while (0)
2458 # define YYDSYMPRINT(Args)                      \
2459 do {                                            \
2460   if (yydebug)                                  \
2461     yysymprint Args;                            \
2462 } while (0)
2463 /* Nonzero means print parse trace.  It is left uninitialized so that
2464    multiple parsers can coexist.  */
2465 int yydebug;
2466 #else /* !YYDEBUG */
2467 # define YYDPRINTF(Args)
2468 # define YYDSYMPRINT(Args)
2469 #endif /* !YYDEBUG */
2470
2471 /* YYINITDEPTH -- initial size of the parser's stacks.  */
2472 #ifndef YYINITDEPTH
2473 # define YYINITDEPTH 200
2474 #endif
2475
2476 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2477    if the built-in stack extension method is used).
2478
2479    Do not make this value too large; the results are undefined if
2480    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
2481    evaluated with infinite-precision integer arithmetic.  */
2482
2483 #if YYMAXDEPTH == 0
2484 # undef YYMAXDEPTH
2485 #endif
2486
2487 #ifndef YYMAXDEPTH
2488 # define YYMAXDEPTH 10000
2489 #endif
2490
2491 \f
2492
2493 #if YYERROR_VERBOSE
2494
2495 # ifndef yystrlen
2496 #  if defined (__GLIBC__) && defined (_STRING_H)
2497 #   define yystrlen strlen
2498 #  else
2499 /* Return the length of YYSTR.  */
2500 static YYSIZE_T
2501 #   if defined (__STDC__) || defined (__cplusplus)
2502 yystrlen (const char *yystr)
2503 #   else
2504 yystrlen (yystr)
2505      const char *yystr;
2506 #   endif
2507 {
2508   register const char *yys = yystr;
2509
2510   while (*yys++ != '\0')
2511     continue;
2512
2513   return yys - yystr - 1;
2514 }
2515 #  endif
2516 # endif
2517
2518 # ifndef yystpcpy
2519 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2520 #   define yystpcpy stpcpy
2521 #  else
2522 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2523    YYDEST.  */
2524 static char *
2525 #   if defined (__STDC__) || defined (__cplusplus)
2526 yystpcpy (char *yydest, const char *yysrc)
2527 #   else
2528 yystpcpy (yydest, yysrc)
2529      char *yydest;
2530      const char *yysrc;
2531 #   endif
2532 {
2533   register char *yyd = yydest;
2534   register const char *yys = yysrc;
2535
2536   while ((*yyd++ = *yys++) != '\0')
2537     continue;
2538
2539   return yyd - 1;
2540 }
2541 #  endif
2542 # endif
2543
2544 #endif /* !YYERROR_VERBOSE */
2545
2546 \f
2547
2548 #if YYDEBUG
2549 /*-----------------------------.
2550 | Print this symbol on YYOUT.  |
2551 `-----------------------------*/
2552
2553 static void
2554 #if defined (__STDC__) || defined (__cplusplus)
2555 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
2556 #else
2557 yysymprint (yyout, yytype, yyvalue)
2558     FILE* yyout;
2559     int yytype;
2560     YYSTYPE yyvalue;
2561 #endif
2562 {
2563   /* Pacify ``unused variable'' warnings.  */
2564   (void) yyvalue;
2565
2566   if (yytype < YYNTOKENS)
2567     {
2568       YYFPRINTF (yyout, "token %s (", yytname[yytype]);
2569 # ifdef YYPRINT
2570       YYPRINT (yyout, yytoknum[yytype], yyvalue);
2571 # endif
2572     }
2573   else
2574     YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
2575
2576   switch (yytype)
2577     {
2578       default:
2579         break;
2580     }
2581   YYFPRINTF (yyout, ")");
2582 }
2583 #endif /* YYDEBUG. */
2584
2585
2586 /*-----------------------------------------------.
2587 | Release the memory associated to this symbol.  |
2588 `-----------------------------------------------*/
2589
2590 static void
2591 #if defined (__STDC__) || defined (__cplusplus)
2592 yydestruct (int yytype, YYSTYPE yyvalue)
2593 #else
2594 yydestruct (yytype, yyvalue)
2595     int yytype;
2596     YYSTYPE yyvalue;
2597 #endif
2598 {
2599   /* Pacify ``unused variable'' warnings.  */
2600   (void) yyvalue;
2601
2602   switch (yytype)
2603     {
2604       default:
2605         break;
2606     }
2607 }
2608
2609 \f
2610
2611 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2612    into yyparse.  The argument should have type void *.
2613    It should actually point to an object.
2614    Grammar actions can access the variable by casting it
2615    to the proper pointer type.  */
2616
2617 #ifdef YYPARSE_PARAM
2618 # if defined (__STDC__) || defined (__cplusplus)
2619 #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2620 #  define YYPARSE_PARAM_DECL
2621 # else
2622 #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
2623 #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2624 # endif
2625 #else /* !YYPARSE_PARAM */
2626 # define YYPARSE_PARAM_ARG
2627 # define YYPARSE_PARAM_DECL
2628 #endif /* !YYPARSE_PARAM */
2629
2630 /* Prevent warning if -Wstrict-prototypes.  */
2631 #ifdef __GNUC__
2632 # ifdef YYPARSE_PARAM
2633 int yyparse (void *);
2634 # else
2635 int yyparse (void);
2636 # endif
2637 #endif
2638
2639
2640 /* The lookahead symbol.  */
2641 int yychar;
2642
2643 /* The semantic value of the lookahead symbol.  */
2644 YYSTYPE yylval;
2645
2646 /* Number of parse errors so far.  */
2647 int yynerrs;
2648
2649
2650 int
2651 yyparse (YYPARSE_PARAM_ARG)
2652      YYPARSE_PARAM_DECL
2653 {
2654   
2655   register int yystate;
2656   register int yyn;
2657   int yyresult;
2658   /* Number of tokens to shift before error messages enabled.  */
2659   int yyerrstatus;
2660   /* Lookahead token as an internal (translated) token number.  */
2661   int yychar1 = 0;
2662
2663   /* Three stacks and their tools:
2664      `yyss': related to states,
2665      `yyvs': related to semantic values,
2666      `yyls': related to locations.
2667
2668      Refer to the stacks thru separate pointers, to allow yyoverflow
2669      to reallocate them elsewhere.  */
2670
2671   /* The state stack.  */
2672   short yyssa[YYINITDEPTH];
2673   short *yyss = yyssa;
2674   register short *yyssp;
2675
2676   /* The semantic value stack.  */
2677   YYSTYPE yyvsa[YYINITDEPTH];
2678   YYSTYPE *yyvs = yyvsa;
2679   register YYSTYPE *yyvsp;
2680
2681
2682
2683 #define YYPOPSTACK   (yyvsp--, yyssp--)
2684
2685   YYSIZE_T yystacksize = YYINITDEPTH;
2686
2687   /* The variables used to return semantic value and location from the
2688      action routines.  */
2689   YYSTYPE yyval;
2690
2691
2692   /* When reducing, the number of symbols on the RHS of the reduced
2693      rule.  */
2694   int yylen;
2695
2696   YYDPRINTF ((stderr, "Starting parse\n"));
2697
2698   yystate = 0;
2699   yyerrstatus = 0;
2700   yynerrs = 0;
2701   yychar = YYEMPTY;             /* Cause a token to be read.  */
2702
2703   /* Initialize stack pointers.
2704      Waste one element of value and location stack
2705      so that they stay on the same level as the state stack.
2706      The wasted elements are never initialized.  */
2707
2708   yyssp = yyss;
2709   yyvsp = yyvs;
2710
2711   goto yysetstate;
2712
2713 /*------------------------------------------------------------.
2714 | yynewstate -- Push a new state, which is found in yystate.  |
2715 `------------------------------------------------------------*/
2716  yynewstate:
2717   /* In all cases, when you get here, the value and location stacks
2718      have just been pushed. so pushing a state here evens the stacks.
2719      */
2720   yyssp++;
2721
2722  yysetstate:
2723   *yyssp = yystate;
2724
2725   if (yyssp >= yyss + yystacksize - 1)
2726     {
2727       /* Get the current used size of the three stacks, in elements.  */
2728       YYSIZE_T yysize = yyssp - yyss + 1;
2729
2730 #ifdef yyoverflow
2731       {
2732         /* Give user a chance to reallocate the stack. Use copies of
2733            these so that the &'s don't force the real ones into
2734            memory.  */
2735         YYSTYPE *yyvs1 = yyvs;
2736         short *yyss1 = yyss;
2737
2738
2739         /* Each stack pointer address is followed by the size of the
2740            data in use in that stack, in bytes.  This used to be a
2741            conditional around just the two extra args, but that might
2742            be undefined if yyoverflow is a macro.  */
2743         yyoverflow ("parser stack overflow",
2744                     &yyss1, yysize * sizeof (*yyssp),
2745                     &yyvs1, yysize * sizeof (*yyvsp),
2746
2747                     &yystacksize);
2748
2749         yyss = yyss1;
2750         yyvs = yyvs1;
2751       }
2752 #else /* no yyoverflow */
2753 # ifndef YYSTACK_RELOCATE
2754       goto yyoverflowlab;
2755 # else
2756       /* Extend the stack our own way.  */
2757       if (yystacksize >= YYMAXDEPTH)
2758         goto yyoverflowlab;
2759       yystacksize *= 2;
2760       if (yystacksize > YYMAXDEPTH)
2761         yystacksize = YYMAXDEPTH;
2762
2763       {
2764         short *yyss1 = yyss;
2765         union yyalloc *yyptr =
2766           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2767         if (! yyptr)
2768           goto yyoverflowlab;
2769         YYSTACK_RELOCATE (yyss);
2770         YYSTACK_RELOCATE (yyvs);
2771
2772 #  undef YYSTACK_RELOCATE
2773         if (yyss1 != yyssa)
2774           YYSTACK_FREE (yyss1);
2775       }
2776 # endif
2777 #endif /* no yyoverflow */
2778
2779       yyssp = yyss + yysize - 1;
2780       yyvsp = yyvs + yysize - 1;
2781
2782
2783       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2784                   (unsigned long int) yystacksize));
2785
2786       if (yyssp >= yyss + yystacksize - 1)
2787         YYABORT;
2788     }
2789
2790   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2791
2792   goto yybackup;
2793
2794 /*-----------.
2795 | yybackup.  |
2796 `-----------*/
2797 yybackup:
2798
2799 /* Do appropriate processing given the current state.  */
2800 /* Read a lookahead token if we need one and don't already have one.  */
2801 /* yyresume: */
2802
2803   /* First try to decide what to do without reference to lookahead token.  */
2804
2805   yyn = yypact[yystate];
2806   if (yyn == YYPACT_NINF)
2807     goto yydefault;
2808
2809   /* Not known => get a lookahead token if don't already have one.  */
2810
2811   /* yychar is either YYEMPTY or YYEOF
2812      or a valid token in external form.  */
2813
2814   if (yychar == YYEMPTY)
2815     {
2816       YYDPRINTF ((stderr, "Reading a token: "));
2817       yychar = YYLEX;
2818     }
2819
2820   /* Convert token to internal form (in yychar1) for indexing tables with.  */
2821
2822   if (yychar <= 0)              /* This means end of input.  */
2823     {
2824       yychar1 = 0;
2825       yychar = YYEOF;           /* Don't call YYLEX any more.  */
2826
2827       YYDPRINTF ((stderr, "Now at end of input.\n"));
2828     }
2829   else
2830     {
2831       yychar1 = YYTRANSLATE (yychar);
2832
2833       /* We have to keep this `#if YYDEBUG', since we use variables
2834          which are defined only if `YYDEBUG' is set.  */
2835       YYDPRINTF ((stderr, "Next token is "));
2836       YYDSYMPRINT ((stderr, yychar1, yylval));
2837       YYDPRINTF ((stderr, "\n"));
2838     }
2839
2840   /* If the proper action on seeing token YYCHAR1 is to reduce or to
2841      detect an error, take that action.  */
2842   yyn += yychar1;
2843   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
2844     goto yydefault;
2845   yyn = yytable[yyn];
2846   if (yyn <= 0)
2847     {
2848       if (yyn == 0 || yyn == YYTABLE_NINF)
2849         goto yyerrlab;
2850       yyn = -yyn;
2851       goto yyreduce;
2852     }
2853
2854   if (yyn == YYFINAL)
2855     YYACCEPT;
2856
2857   /* Shift the lookahead token.  */
2858   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
2859               yychar, yytname[yychar1]));
2860
2861   /* Discard the token being shifted unless it is eof.  */
2862   if (yychar != YYEOF)
2863     yychar = YYEMPTY;
2864
2865   *++yyvsp = yylval;
2866
2867
2868   /* Count tokens shifted since error; after three, turn off error
2869      status.  */
2870   if (yyerrstatus)
2871     yyerrstatus--;
2872
2873   yystate = yyn;
2874   goto yynewstate;
2875
2876
2877 /*-----------------------------------------------------------.
2878 | yydefault -- do the default action for the current state.  |
2879 `-----------------------------------------------------------*/
2880 yydefault:
2881   yyn = yydefact[yystate];
2882   if (yyn == 0)
2883     goto yyerrlab;
2884   goto yyreduce;
2885
2886
2887 /*-----------------------------.
2888 | yyreduce -- Do a reduction.  |
2889 `-----------------------------*/
2890 yyreduce:
2891   /* yyn is the number of a rule to reduce with.  */
2892   yylen = yyr2[yyn];
2893
2894   /* If YYLEN is nonzero, implement the default value of the action:
2895      `$$ = $1'.
2896
2897      Otherwise, the following line sets YYVAL to garbage.
2898      This behavior is undocumented and Bison
2899      users should not rely upon it.  Assigning to YYVAL
2900      unconditionally makes the parser a bit smaller, and it avoids a
2901      GCC warning that YYVAL may be used uninitialized.  */
2902   yyval = yyvsp[1-yylen];
2903
2904
2905
2906 #if YYDEBUG
2907   /* We have to keep this `#if YYDEBUG', since we use variables which
2908      are defined only if `YYDEBUG' is set.  */
2909   if (yydebug)
2910     {
2911       int yyi;
2912
2913       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
2914                  yyn - 1, yyrline[yyn]);
2915
2916       /* Print the symbols being reduced, and their result.  */
2917       for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
2918         YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2919       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2920     }
2921 #endif
2922   switch (yyn)
2923     {
2924         case 81:
2925 #line 1061 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2926     {
2927     yyval.String = yyvsp[-1].String;
2928   }
2929     break;
2930
2931   case 82:
2932 #line 1064 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2933     {
2934     yyval.String = new std::string(""); 
2935   }
2936     break;
2937
2938   case 90:
2939 #line 1071 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2940     { yyval.String = new std::string(""); }
2941     break;
2942
2943   case 97:
2944 #line 1076 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2945     { 
2946     *yyvsp[-1].String += *yyvsp[0].String; 
2947     delete yyvsp[0].String;
2948     yyval.String = yyvsp[-1].String; 
2949     }
2950     break;
2951
2952   case 98:
2953 #line 1081 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2954     { yyval.String = new std::string(""); }
2955     break;
2956
2957   case 99:
2958 #line 1086 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2959     { yyval.String = new std::string(); }
2960     break;
2961
2962   case 100:
2963 #line 1087 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2964     { *yyvsp[-1].String += " " + *yyvsp[0].String; delete yyvsp[0].String; yyval.String = yyvsp[-1].String; }
2965     break;
2966
2967   case 101:
2968 #line 1090 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2969     { yyval.String = new std::string(); }
2970     break;
2971
2972   case 102:
2973 #line 1091 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2974     { 
2975     yyvsp[-1].String->insert(0, ", "); 
2976     *yyvsp[-1].String += " " + *yyvsp[0].String;
2977     delete yyvsp[0].String;
2978     yyval.String = yyvsp[-1].String;
2979   }
2980     break;
2981
2982   case 103:
2983 #line 1099 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2984     { 
2985     *yyvsp[-1].String += " " + *yyvsp[0].String;
2986     delete yyvsp[0].String;
2987     yyval.String = yyvsp[-1].String;
2988   }
2989     break;
2990
2991   case 104:
2992 #line 1105 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2993     { yyval.String = new std::string(); }
2994     break;
2995
2996   case 106:
2997 #line 1109 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2998     { yyval.String = new std::string(); }
2999     break;
3000
3001   case 107:
3002 #line 1110 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3003     {
3004       yyvsp[-1].String->insert(0, ", ");
3005       if (!yyvsp[0].String->empty())
3006         *yyvsp[-1].String += " " + *yyvsp[0].String;
3007       delete yyvsp[0].String;
3008       yyval.String = yyvsp[-1].String;
3009     }
3010     break;
3011
3012   case 109:
3013 #line 1120 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3014     {
3015       *yyvsp[-1].String += " " + *yyvsp[0].String;
3016       delete yyvsp[0].String;
3017       yyval.String = yyvsp[-1].String;
3018     }
3019     break;
3020
3021   case 127:
3022 #line 1142 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3023     { 
3024     yyval.Ty = Type::get(*yyvsp[0].String, OpaqueTy);
3025   }
3026     break;
3027
3028   case 128:
3029 #line 1145 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3030     { 
3031     yyval.Ty = Type::get(*yyvsp[0].String, UnresolvedTy);
3032   }
3033     break;
3034
3035   case 129:
3036 #line 1148 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3037     { 
3038     yyval.Ty = yyvsp[0].Ty; 
3039   }
3040     break;
3041
3042   case 130:
3043 #line 1151 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3044     {                   // Type UpReference
3045     yyvsp[0].String->insert(0, "\\");
3046     yyval.Ty = Type::get(*yyvsp[0].String, UpRefTy);
3047   }
3048     break;
3049
3050   case 131:
3051 #line 1155 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3052     {           // Function derived type?
3053     std::string newTy( yyvsp[-3].Ty->getNewTy() + "(");
3054     for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
3055       if (i != 0)
3056         newTy +=  ", ";
3057       if ((*yyvsp[-1].TypeVec)[i]->isVoid())
3058         newTy += "...";
3059       else
3060         newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
3061     }
3062     newTy += ")";
3063     yyval.Ty = Type::get(newTy, yyvsp[-3].Ty, yyvsp[-1].TypeVec);
3064   }
3065     break;
3066
3067   case 132:
3068 #line 1168 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3069     {          // Sized array type?
3070     uint64_t elems = atoi(yyvsp[-3].String->c_str());
3071     yyvsp[-3].String->insert(0,"[ ");
3072     *yyvsp[-3].String += " x " + yyvsp[-1].Ty->getNewTy() + " ]";
3073     yyval.Ty = Type::get(*yyvsp[-3].String, ArrayTy, yyvsp[-1].Ty, elems);
3074   }
3075     break;
3076
3077   case 133:
3078 #line 1174 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3079     {          // Packed array type?
3080     uint64_t elems = atoi(yyvsp[-3].String->c_str());
3081     yyvsp[-3].String->insert(0,"< ");
3082     *yyvsp[-3].String += " x " + yyvsp[-1].Ty->getNewTy() + " >";
3083     yyval.Ty = Type::get(*yyvsp[-3].String, PackedTy, yyvsp[-1].Ty, elems);
3084   }
3085     break;
3086
3087   case 134:
3088 #line 1180 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3089     {                        // Structure type?
3090     std::string newTy("{");
3091     for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
3092       if (i != 0)
3093         newTy +=  ", ";
3094       newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
3095     }
3096     newTy += "}";
3097     yyval.Ty = Type::get(newTy, StructTy, yyvsp[-1].TypeVec);
3098   }
3099     break;
3100
3101   case 135:
3102 #line 1190 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3103     {                                  // Empty structure type?
3104     yyval.Ty = Type::get("{}", StructTy, new TypeList());
3105   }
3106     break;
3107
3108   case 136:
3109 #line 1193 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3110     {                // Packed Structure type?
3111     std::string newTy("<{");
3112     for (unsigned i = 0; i < yyvsp[-2].TypeVec->size(); ++i) {
3113       if (i != 0)
3114         newTy +=  ", ";
3115       newTy += (*yyvsp[-2].TypeVec)[i]->getNewTy();
3116     }
3117     newTy += "}>";
3118     yyval.Ty = Type::get(newTy, PackedStructTy, yyvsp[-2].TypeVec);
3119   }
3120     break;
3121
3122   case 137:
3123 #line 1203 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3124     {                          // Empty packed structure type?
3125     yyval.Ty = Type::get("<{}>", PackedStructTy, new TypeList());
3126   }
3127     break;
3128
3129   case 138:
3130 #line 1206 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3131     {                             // Pointer type?
3132     yyval.Ty = yyvsp[-1].Ty->getPointerType();
3133   }
3134     break;
3135
3136   case 139:
3137 #line 1214 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3138     {
3139     yyval.TypeVec = new TypeList();
3140     yyval.TypeVec->push_back(yyvsp[0].Ty);
3141   }
3142     break;
3143
3144   case 140:
3145 #line 1218 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3146     {
3147     yyval.TypeVec = yyvsp[-2].TypeVec;
3148     yyval.TypeVec->push_back(yyvsp[0].Ty);
3149   }
3150     break;
3151
3152   case 142:
3153 #line 1226 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3154     {
3155     yyval.TypeVec = yyvsp[-2].TypeVec;
3156     yyval.TypeVec->push_back(Type::get("void",VoidTy));
3157     delete yyvsp[0].String;
3158   }
3159     break;
3160
3161   case 143:
3162 #line 1231 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3163     {
3164     yyval.TypeVec = new TypeList();
3165     yyval.TypeVec->push_back(Type::get("void",VoidTy));
3166     delete yyvsp[0].String;
3167   }
3168     break;
3169
3170   case 144:
3171 #line 1236 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3172     {
3173     yyval.TypeVec = new TypeList();
3174   }
3175     break;
3176
3177   case 145:
3178 #line 1246 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3179     { // Nonempty unsized arr
3180     yyval.Const = new Constant;
3181     yyval.Const->type = yyvsp[-3].Ty;
3182     yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3183     *yyval.Const->cnst += " [ " + *yyvsp[-1].String + " ]";
3184     delete yyvsp[-1].String;
3185   }
3186     break;
3187
3188   case 146:
3189 #line 1253 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3190     {
3191     yyval.Const = new Constant;
3192     yyval.Const->type = yyvsp[-2].Ty;
3193     yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3194     *yyval.Const->cnst += "[ ]";
3195   }
3196     break;
3197
3198   case 147:
3199 #line 1259 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3200     {
3201     yyval.Const = new Constant;
3202     yyval.Const->type = yyvsp[-2].Ty;
3203     yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3204     *yyval.Const->cnst += " c" + *yyvsp[0].String;
3205     delete yyvsp[0].String;
3206   }
3207     break;
3208
3209   case 148:
3210 #line 1266 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3211     { // Nonempty unsized arr
3212     yyval.Const = new Constant;
3213     yyval.Const->type = yyvsp[-3].Ty;
3214     yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3215     *yyval.Const->cnst += " < " + *yyvsp[-1].String + " >";
3216     delete yyvsp[-1].String;
3217   }
3218     break;
3219
3220   case 149:
3221 #line 1273 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3222     {
3223     yyval.Const = new Constant;
3224     yyval.Const->type = yyvsp[-3].Ty;
3225     yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3226     *yyval.Const->cnst += " { " + *yyvsp[-1].String + " }";
3227     delete yyvsp[-1].String;
3228   }
3229     break;
3230
3231   case 150:
3232 #line 1280 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3233     {
3234     yyval.Const = new Constant;
3235     yyval.Const->type = yyvsp[-2].Ty;
3236     yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3237     *yyval.Const->cnst += " {}";
3238   }
3239     break;
3240
3241   case 151:
3242 #line 1286 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3243     {
3244     yyval.Const = new Constant;
3245     yyval.Const->type = yyvsp[-1].Ty;
3246     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3247     *yyval.Const->cnst +=  " " + *yyvsp[0].String;
3248     delete yyvsp[0].String;
3249   }
3250     break;
3251
3252   case 152:
3253 #line 1293 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3254     {
3255     yyval.Const = new Constant;
3256     yyval.Const->type = yyvsp[-1].Ty;
3257     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3258     *yyval.Const->cnst += " " + *yyvsp[0].String;
3259     delete yyvsp[0].String;
3260   }
3261     break;
3262
3263   case 153:
3264 #line 1300 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3265     {
3266     yyval.Const = new Constant;
3267     std::string Name = getUniqueName(yyvsp[0].String, yyvsp[-1].Ty->resolve(), true);
3268     yyval.Const->type = yyvsp[-1].Ty;
3269     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3270     *yyval.Const->cnst += " " + Name;
3271     delete yyvsp[0].String;
3272   }
3273     break;
3274
3275   case 154:
3276 #line 1308 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3277     {
3278     yyval.Const = new Constant;
3279     yyval.Const->type = yyvsp[-1].Ty;
3280     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3281     *yyval.Const->cnst += " " + *yyvsp[0].String;
3282     delete yyvsp[0].String;
3283   }
3284     break;
3285
3286   case 155:
3287 #line 1315 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3288     {
3289     yyval.Const = new Constant;
3290     yyval.Const->type = yyvsp[-1].Ty;
3291     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3292     *yyval.Const->cnst += " " + *yyvsp[0].String;
3293     delete yyvsp[0].String;
3294   }
3295     break;
3296
3297   case 156:
3298 #line 1322 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3299     {      // integral constants
3300     yyval.Const = new Constant;
3301     yyval.Const->type = yyvsp[-1].Ty;
3302     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3303     *yyval.Const->cnst += " " + *yyvsp[0].String;
3304     delete yyvsp[0].String;
3305   }
3306     break;
3307
3308   case 157:
3309 #line 1329 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3310     {            // integral constants
3311     yyval.Const = new Constant;
3312     yyval.Const->type = yyvsp[-1].Ty;
3313     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3314     *yyval.Const->cnst += " " + *yyvsp[0].String;
3315     delete yyvsp[0].String;
3316   }
3317     break;
3318
3319   case 158:
3320 #line 1336 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3321     {                      // Boolean constants
3322     yyval.Const = new Constant;
3323     yyval.Const->type = yyvsp[-1].Ty;
3324     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3325     *yyval.Const->cnst += " " + *yyvsp[0].String;
3326     delete yyvsp[0].String;
3327   }
3328     break;
3329
3330   case 159:
3331 #line 1343 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3332     {                     // Boolean constants
3333     yyval.Const = new Constant;
3334     yyval.Const->type = yyvsp[-1].Ty;
3335     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3336     *yyval.Const->cnst += " " + *yyvsp[0].String;
3337     delete yyvsp[0].String;
3338   }
3339     break;
3340
3341   case 160:
3342 #line 1350 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3343     {                   // Float & Double constants
3344     yyval.Const = new Constant;
3345     yyval.Const->type = yyvsp[-1].Ty;
3346     yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3347     *yyval.Const->cnst += " " + *yyvsp[0].String;
3348     delete yyvsp[0].String;
3349   }
3350     break;
3351
3352   case 161:
3353 #line 1358 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3354     {
3355     std::string source = *yyvsp[-3].Const->cnst;
3356     const Type* SrcTy = yyvsp[-3].Const->type->resolve();
3357     const Type* DstTy = yyvsp[-1].Ty->resolve(); 
3358     if (*yyvsp[-5].String == "cast") {
3359       // Call getCastUpgrade to upgrade the old cast
3360       yyval.String = new std::string(getCastUpgrade(source, SrcTy, DstTy, true));
3361     } else {
3362       // Nothing to upgrade, just create the cast constant expr
3363       yyval.String = new std::string(*yyvsp[-5].String);
3364       *yyval.String += "( " + source + " to " + yyvsp[-1].Ty->getNewTy() + ")";
3365     }
3366     delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-2].String;
3367   }
3368     break;
3369
3370   case 162:
3371 #line 1372 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3372     {
3373     *yyvsp[-4].String += "(" + *yyvsp[-2].Const->cnst;
3374     for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
3375       Value* V = (*yyvsp[-1].ValList)[i];
3376       *yyvsp[-4].String += ", " + *V->val;
3377       delete V;
3378     }
3379     *yyvsp[-4].String += ")";
3380     yyval.String = yyvsp[-4].String;
3381     delete yyvsp[-2].Const;
3382     delete yyvsp[-1].ValList;
3383   }
3384     break;
3385
3386   case 163:
3387 #line 1384 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3388     {
3389     *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3390     delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3391     yyval.String = yyvsp[-7].String;
3392   }
3393     break;
3394
3395   case 164:
3396 #line 1389 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3397     {
3398     const char* op = getDivRemOpcode(*yyvsp[-5].String, yyvsp[-3].Const->type); 
3399     yyval.String = new std::string(op);
3400     *yyval.String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3401     delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3402   }
3403     break;
3404
3405   case 165:
3406 #line 1395 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3407     {
3408     *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3409     delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3410     yyval.String = yyvsp[-5].String;
3411   }
3412     break;
3413
3414   case 166:
3415 #line 1400 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3416     {
3417     *yyvsp[-5].String = getCompareOp(*yyvsp[-5].String, yyvsp[-3].Const->type);
3418     *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3419     delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3420     yyval.String = yyvsp[-5].String;
3421   }
3422     break;
3423
3424   case 167:
3425 #line 1406 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3426     {
3427     *yyvsp[-6].String += " " + *yyvsp[-5].String + " (" +  *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3428     delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3429     yyval.String = yyvsp[-6].String;
3430   }
3431     break;
3432
3433   case 168:
3434 #line 1411 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3435     {
3436     *yyvsp[-6].String += " " + *yyvsp[-5].String + " (" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3437     delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3438     yyval.String = yyvsp[-6].String;
3439   }
3440     break;
3441
3442   case 169:
3443 #line 1416 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3444     {
3445     const char* shiftop = yyvsp[-5].String->c_str();
3446     if (*yyvsp[-5].String == "shr")
3447       shiftop = (yyvsp[-3].Const->type->isUnsigned()) ? "lshr" : "ashr";
3448     yyval.String = new std::string(shiftop);
3449     *yyval.String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3450     delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3451   }
3452     break;
3453
3454   case 170:
3455 #line 1424 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3456     {
3457     *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3458     delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3459     yyval.String = yyvsp[-5].String;
3460   }
3461     break;
3462
3463   case 171:
3464 #line 1429 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3465     {
3466     *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3467     delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3468     yyval.String = yyvsp[-7].String;
3469   }
3470     break;
3471
3472   case 172:
3473 #line 1434 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3474     {
3475     *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3476     delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3477     yyval.String = yyvsp[-7].String;
3478   }
3479     break;
3480
3481   case 173:
3482 #line 1444 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3483     {
3484     *yyvsp[-2].String += ", " + *yyvsp[0].Const->cnst;
3485     delete yyvsp[0].Const;
3486     yyval.String = yyvsp[-2].String;
3487   }
3488     break;
3489
3490   case 174:
3491 #line 1449 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3492     { yyval.String = new std::string(*yyvsp[0].Const->cnst); delete yyvsp[0].Const; }
3493     break;
3494
3495   case 177:
3496 #line 1464 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3497     {
3498 }
3499     break;
3500
3501   case 178:
3502 #line 1469 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3503     {
3504     yyval.String = 0;
3505   }
3506     break;
3507
3508   case 179:
3509 #line 1472 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3510     {
3511     *O << *yyvsp[0].String << '\n';
3512     delete yyvsp[0].String;
3513     yyval.String = 0;
3514   }
3515     break;
3516
3517   case 180:
3518 #line 1477 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3519     {
3520     *O << "module asm " << ' ' << *yyvsp[0].String << '\n';
3521     yyval.String = 0;
3522   }
3523     break;
3524
3525   case 181:
3526 #line 1481 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3527     {
3528     *O << "implementation\n";
3529     yyval.String = 0;
3530   }
3531     break;
3532
3533   case 182:
3534 #line 1485 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3535     { yyval.String = 0; }
3536     break;
3537
3538   case 184:
3539 #line 1488 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3540     { yyval.String = yyvsp[0].String; *yyval.String = "external"; }
3541     break;
3542
3543   case 185:
3544 #line 1491 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3545     {
3546     Type::EnumeratedTypes.push_back(yyvsp[0].Ty);
3547     if (!yyvsp[-2].String->empty()) {
3548       Type::NamedTypes[*yyvsp[-2].String] = yyvsp[0].Ty;
3549       *O << *yyvsp[-2].String << " = ";
3550     }
3551     *O << "type " << yyvsp[0].Ty->getNewTy() << '\n';
3552     delete yyvsp[-2].String; delete yyvsp[-1].String;
3553     yyval.String = 0;
3554   }
3555     break;
3556
3557   case 186:
3558 #line 1501 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3559     {       // Function prototypes can be in const pool
3560     *O << *yyvsp[0].String << '\n';
3561     delete yyvsp[0].String;
3562     yyval.String = 0;
3563   }
3564     break;
3565
3566   case 187:
3567 #line 1506 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3568     {  // Asm blocks can be in the const pool
3569     *O << *yyvsp[-2].String << ' ' << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3570     delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String; 
3571     yyval.String = 0;
3572   }
3573     break;
3574
3575   case 188:
3576 #line 1511 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3577     {
3578     if (!yyvsp[-4].String->empty()) {
3579       std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String, yyvsp[-1].Const->type->getPointerType(),
3580                                        *yyvsp[-2].String == "constant");
3581       *O << Name << " = ";
3582     }
3583     *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << *yyvsp[-1].Const->cnst << ' ' << *yyvsp[0].String << '\n';
3584     delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String; 
3585     yyval.String = 0;
3586   }
3587     break;
3588
3589   case 189:
3590 #line 1521 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3591     {
3592     if (!yyvsp[-4].String->empty()) {
3593       std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3594                                        *yyvsp[-2].String == "constant");
3595       *O << Name << " = ";
3596     }
3597     *O <<  *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3598     delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3599     yyval.String = 0;
3600   }
3601     break;
3602
3603   case 190:
3604 #line 1531 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3605     {
3606     if (!yyvsp[-4].String->empty()) {
3607       std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3608                                        *yyvsp[-2].String == "constant");
3609       *O << Name << " = ";
3610     }
3611     *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3612     delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3613     yyval.String = 0;
3614   }
3615     break;
3616
3617   case 191:
3618 #line 1541 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3619     {
3620     if (!yyvsp[-4].String->empty()) {
3621       std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3622                                        *yyvsp[-2].String == "constant");
3623       *O << Name << " = ";
3624     }
3625     *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3626     delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3627     yyval.String = 0;
3628   }
3629     break;
3630
3631   case 192:
3632 #line 1551 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3633     { 
3634     *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3635     delete yyvsp[-1].String; delete yyvsp[0].String;
3636     yyval.String = 0;
3637   }
3638     break;
3639
3640   case 193:
3641 #line 1556 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3642     {
3643     *O << *yyvsp[-2].String << " = " << *yyvsp[0].String << '\n';
3644     delete yyvsp[-2].String; delete yyvsp[0].String;
3645     yyval.String = 0;
3646   }
3647     break;
3648
3649   case 194:
3650 #line 1561 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3651     { 
3652     yyval.String = 0;
3653   }
3654     break;
3655
3656   case 198:
3657 #line 1571 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3658     {
3659     *yyvsp[-2].String += " = " + *yyvsp[0].String;
3660     delete yyvsp[0].String;
3661     yyval.String = yyvsp[-2].String;
3662   }
3663     break;
3664
3665   case 199:
3666 #line 1576 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3667     {
3668     *yyvsp[-2].String += " = " + *yyvsp[0].String;
3669     if (*yyvsp[0].String == "64")
3670       SizeOfPointer = 64;
3671     delete yyvsp[0].String;
3672     yyval.String = yyvsp[-2].String;
3673   }
3674     break;
3675
3676   case 200:
3677 #line 1583 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3678     {
3679     *yyvsp[-2].String += " = " + *yyvsp[0].String;
3680     delete yyvsp[0].String;
3681     yyval.String = yyvsp[-2].String;
3682   }
3683     break;
3684
3685   case 201:
3686 #line 1588 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3687     {
3688     *yyvsp[-2].String += " = " + *yyvsp[0].String;
3689     delete yyvsp[0].String;
3690     yyval.String = yyvsp[-2].String;
3691   }
3692     break;
3693
3694   case 202:
3695 #line 1595 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3696     {
3697     yyvsp[-1].String->insert(0, "[ ");
3698     *yyvsp[-1].String += " ]";
3699     yyval.String = yyvsp[-1].String;
3700   }
3701     break;
3702
3703   case 203:
3704 #line 1602 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3705     {
3706     *yyvsp[-2].String += ", " + *yyvsp[0].String;
3707     delete yyvsp[0].String;
3708     yyval.String = yyvsp[-2].String;
3709   }
3710     break;
3711
3712   case 205:
3713 #line 1608 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3714     {
3715     yyval.String = new std::string();
3716   }
3717     break;
3718
3719   case 209:
3720 #line 1617 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3721     { yyval.String = new std::string(); }
3722     break;
3723
3724   case 210:
3725 #line 1619 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3726     {
3727   yyval.String = new std::string(yyvsp[-1].Ty->getNewTy());
3728   if (!yyvsp[0].String->empty()) {
3729     std::string Name = getUniqueName(yyvsp[0].String, yyvsp[-1].Ty->resolve());
3730     *yyval.String += " " + Name;
3731   }
3732   delete yyvsp[0].String;
3733 }
3734     break;
3735
3736   case 211:
3737 #line 1628 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3738     {
3739     *yyvsp[-2].String += ", " + *yyvsp[0].String;
3740     delete yyvsp[0].String;
3741   }
3742     break;
3743
3744   case 212:
3745 #line 1632 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3746     {
3747     yyval.String = yyvsp[0].String;
3748   }
3749     break;
3750
3751   case 213:
3752 #line 1636 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3753     {
3754     yyval.String = yyvsp[0].String;
3755   }
3756     break;
3757
3758   case 214:
3759 #line 1639 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3760     {
3761     *yyvsp[-2].String += ", ...";
3762     yyval.String = yyvsp[-2].String;
3763     delete yyvsp[0].String;
3764   }
3765     break;
3766
3767   case 215:
3768 #line 1644 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3769     {
3770     yyval.String = yyvsp[0].String;
3771   }
3772     break;
3773
3774   case 216:
3775 #line 1647 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3776     { yyval.String = new std::string(); }
3777     break;
3778
3779   case 217:
3780 #line 1650 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3781     {
3782     if (*yyvsp[-5].String == "%llvm.va_start" || *yyvsp[-5].String == "%llvm.va_end") {
3783       *yyvsp[-3].String = "i8*";
3784     } else if (*yyvsp[-5].String == "%llvm.va_copy") {
3785       *yyvsp[-3].String = "i8*, i8*";
3786     }
3787     if (!yyvsp[-7].String->empty()) {
3788       *yyvsp[-7].String += " ";
3789     }
3790     *yyvsp[-7].String += yyvsp[-6].Ty->getNewTy() + " " + *yyvsp[-5].String + "(" + *yyvsp[-3].String + ")";
3791     if (!yyvsp[-1].String->empty()) {
3792       *yyvsp[-7].String += " " + *yyvsp[-1].String;
3793     }
3794     if (!yyvsp[0].String->empty()) {
3795       *yyvsp[-7].String += " " + *yyvsp[0].String;
3796     }
3797     delete yyvsp[-5].String;
3798     delete yyvsp[-3].String;
3799     delete yyvsp[-1].String;
3800     delete yyvsp[0].String;
3801     yyval.String = yyvsp[-7].String;
3802   }
3803     break;
3804
3805   case 218:
3806 #line 1673 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3807     { yyval.String = new std::string("{"); delete yyvsp[0].String; }
3808     break;
3809
3810   case 219:
3811 #line 1674 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3812     { yyval.String = new std::string ("{"); }
3813     break;
3814
3815   case 220:
3816 #line 1678 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3817     {
3818     *O << "define ";
3819     if (!yyvsp[-2].String->empty()) {
3820       *O << *yyvsp[-2].String << ' ';
3821     }
3822     *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3823     delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3824     yyval.String = 0;
3825   }
3826     break;
3827
3828   case 221:
3829 #line 1689 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3830     { yyval.String = new std::string("}"); delete yyvsp[0].String; }
3831     break;
3832
3833   case 222:
3834 #line 1690 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3835     { yyval.String = new std::string("}"); }
3836     break;
3837
3838   case 223:
3839 #line 1692 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3840     {
3841   if (yyvsp[-1].String)
3842     *O << *yyvsp[-1].String;
3843   *O << *yyvsp[0].String << "\n\n";
3844   delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3845   yyval.String = 0;
3846 }
3847     break;
3848
3849   case 224:
3850 #line 1701 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3851     { yyval.String = new std::string(); }
3852     break;
3853
3854   case 227:
3855 #line 1707 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3856     { isDeclare = true; }
3857     break;
3858
3859   case 228:
3860 #line 1707 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3861     { 
3862     if (!yyvsp[-1].String->empty())
3863       *yyvsp[-3].String += " " + *yyvsp[-1].String;
3864     *yyvsp[-3].String += " " + *yyvsp[0].String;
3865     delete yyvsp[-1].String;
3866     delete yyvsp[0].String;
3867     yyval.String = yyvsp[-3].String;
3868     isDeclare = false;
3869   }
3870     break;
3871
3872   case 229:
3873 #line 1721 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3874     { yyval.String = new std::string(); }
3875     break;
3876
3877   case 239:
3878 #line 1727 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3879     { 
3880     yyvsp[-1].String->insert(0, "<");
3881     *yyvsp[-1].String += ">";
3882     yyval.String = yyvsp[-1].String;
3883   }
3884     break;
3885
3886   case 241:
3887 #line 1733 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3888     {
3889     if (!yyvsp[-3].String->empty()) {
3890       *yyvsp[-4].String += " " + *yyvsp[-3].String;
3891     }
3892     *yyvsp[-4].String += " " + *yyvsp[-2].String + ", " + *yyvsp[0].String;
3893     delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3894     yyval.String = yyvsp[-4].String;
3895   }
3896     break;
3897
3898   case 244:
3899 #line 1746 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3900     {
3901     yyval.Val = new Value;
3902     yyval.Val->val = yyvsp[0].String;
3903     yyval.Val->constant = false;
3904     yyval.Val->type = 0;
3905   }
3906     break;
3907
3908   case 245:
3909 #line 1752 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3910     {
3911     yyval.Val = new Value;
3912     yyval.Val->val = yyvsp[0].String;
3913     yyval.Val->constant = true;
3914     yyval.Val->type = 0;
3915   }
3916     break;
3917
3918   case 246:
3919 #line 1763 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3920     {
3921     yyvsp[-1].Ty = yyvsp[-1].Ty->resolve();
3922     std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
3923     yyval.Val = yyvsp[0].Val;
3924     delete yyval.Val->val;
3925     yyval.Val->val = new std::string(yyvsp[-1].Ty->getNewTy() + " " + Name);
3926     yyval.Val->type = yyvsp[-1].Ty;
3927   }
3928     break;
3929
3930   case 247:
3931 #line 1772 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3932     {
3933     yyval.String = 0;
3934   }
3935     break;
3936
3937   case 248:
3938 #line 1775 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3939     { // Do not allow functions with 0 basic blocks   
3940     yyval.String = 0;
3941   }
3942     break;
3943
3944   case 249:
3945 #line 1783 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3946     {
3947     yyval.String = 0;
3948   }
3949     break;
3950
3951   case 250:
3952 #line 1787 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3953     {
3954     *O << "    " << *yyvsp[0].String << '\n';
3955     delete yyvsp[0].String;
3956     yyval.String = 0;
3957   }
3958     break;
3959
3960   case 251:
3961 #line 1792 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3962     {
3963     yyval.String = 0;
3964   }
3965     break;
3966
3967   case 252:
3968 #line 1795 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3969     {
3970     *O << *yyvsp[0].String << '\n';
3971     delete yyvsp[0].String;
3972     yyval.String = 0;
3973   }
3974     break;
3975
3976   case 254:
3977 #line 1801 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3978     { yyval.String = yyvsp[0].String; *yyval.String = "unwind"; }
3979     break;
3980
3981   case 255:
3982 #line 1803 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3983     {              // Return with a result...
3984     *O << "    " << *yyvsp[-1].String << ' ' << *yyvsp[0].Val->val << '\n';
3985     delete yyvsp[-1].String; delete yyvsp[0].Val;
3986     yyval.String = 0;
3987   }
3988     break;
3989
3990   case 256:
3991 #line 1808 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3992     {                                       // Return with no result...
3993     *O << "    " << *yyvsp[-1].String << ' ' << yyvsp[0].Ty->getNewTy() << '\n';
3994     delete yyvsp[-1].String;
3995     yyval.String = 0;
3996   }
3997     break;
3998
3999   case 257:
4000 #line 1813 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4001     {                         // Unconditional Branch...
4002     *O << "    " << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].Val->val << '\n';
4003     delete yyvsp[-2].String; delete yyvsp[0].Val;
4004     yyval.String = 0;
4005   }
4006     break;
4007
4008   case 258:
4009 #line 1818 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4010     {  
4011     std::string Name = getUniqueName(yyvsp[-6].Val->val, yyvsp[-7].Ty);
4012     *O << "    " << *yyvsp[-8].String << ' ' << yyvsp[-7].Ty->getNewTy() << ' ' << Name << ", " 
4013        << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << ", " << yyvsp[-1].Ty->getNewTy() << ' ' 
4014        << *yyvsp[0].Val->val << '\n';
4015     delete yyvsp[-8].String; delete yyvsp[-6].Val; delete yyvsp[-3].Val; delete yyvsp[0].Val;
4016     yyval.String = 0;
4017   }
4018     break;
4019
4020   case 259:
4021 #line 1826 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4022     {
4023     std::string Name = getUniqueName(yyvsp[-6].Val->val, yyvsp[-7].Ty);
4024     *O << "    " << *yyvsp[-8].String << ' ' << yyvsp[-7].Ty->getNewTy() << ' ' << Name << ", " 
4025        << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << " [" << *yyvsp[-1].String << " ]\n";
4026     delete yyvsp[-8].String; 
4027     delete yyvsp[-6].Val;
4028     delete yyvsp[-3].Val; 
4029     delete yyvsp[-1].String;
4030     yyval.String = 0;
4031   }
4032     break;
4033
4034   case 260:
4035 #line 1836 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4036     {
4037     std::string Name = getUniqueName(yyvsp[-5].Val->val, yyvsp[-6].Ty);
4038     *O << "    " << *yyvsp[-7].String << ' ' << yyvsp[-6].Ty->getNewTy() << ' ' << Name << ", " 
4039        << yyvsp[-3].Ty->getNewTy() << ' ' << *yyvsp[-2].Val->val << "[]\n";
4040     delete yyvsp[-7].String; 
4041     delete yyvsp[-5].Val; 
4042     delete yyvsp[-2].Val;
4043     yyval.String = 0;
4044   }
4045     break;
4046
4047   case 261:
4048 #line 1846 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4049     {
4050     const Type* ResTy = getFunctionReturnType(yyvsp[-10].Ty);
4051     *O << "    ";
4052     if (!yyvsp[-13].String->empty()) {
4053       std::string Name = getUniqueName(yyvsp[-13].String, ResTy);
4054       *O << Name << " = ";
4055     }
4056     *O << *yyvsp[-12].String << ' ' << *yyvsp[-11].String << ' ' << yyvsp[-10].Ty->getNewTy() << ' ' << *yyvsp[-9].Val->val << " (";
4057     for (unsigned i = 0; i < yyvsp[-7].ValList->size(); ++i) {
4058       Value* V = (*yyvsp[-7].ValList)[i];
4059       *O << *V->val;
4060       if (i+1 < yyvsp[-7].ValList->size())
4061         *O << ", ";
4062       delete V;
4063     }
4064     *O << ") " << *yyvsp[-5].String << ' ' << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << ' ' 
4065        << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].Val->val << '\n';
4066     delete yyvsp[-13].String; delete yyvsp[-12].String; delete yyvsp[-11].String; delete yyvsp[-9].Val; delete yyvsp[-7].ValList; 
4067     delete yyvsp[-5].String; delete yyvsp[-3].Val; delete yyvsp[-2].String; delete yyvsp[0].Val; 
4068     yyval.String = 0;
4069   }
4070     break;
4071
4072   case 262:
4073 #line 1867 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4074     {
4075     *O << "    " << *yyvsp[0].String << '\n';
4076     delete yyvsp[0].String;
4077     yyval.String = 0;
4078   }
4079     break;
4080
4081   case 263:
4082 #line 1872 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4083     {
4084     *O << "    " << *yyvsp[0].String << '\n';
4085     delete yyvsp[0].String;
4086     yyval.String = 0;
4087   }
4088     break;
4089
4090   case 264:
4091 #line 1878 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4092     {
4093     *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + " " + *yyvsp[-3].String + ", " + yyvsp[-1].Ty->getNewTy() + " " + 
4094            *yyvsp[0].Val->val;
4095     delete yyvsp[-3].String; delete yyvsp[0].Val;
4096     yyval.String = yyvsp[-5].String;
4097   }
4098     break;
4099
4100   case 265:
4101 #line 1884 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4102     {
4103     yyvsp[-3].String->insert(0, yyvsp[-4].Ty->getNewTy() + " " );
4104     *yyvsp[-3].String += ", " + yyvsp[-1].Ty->getNewTy() + " " + *yyvsp[0].Val->val;
4105     delete yyvsp[0].Val;
4106     yyval.String = yyvsp[-3].String;
4107   }
4108     break;
4109
4110   case 266:
4111 #line 1892 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4112     {
4113     if (!yyvsp[-1].String->empty()) {
4114       // Get a unique name for this value, based on its type.
4115       std::string Name = getUniqueName(yyvsp[-1].String, yyvsp[0].Val->type);
4116       *yyvsp[-1].String = Name + " = ";
4117       if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
4118         // don't actually delete it, just comment it out
4119         yyvsp[-1].String->insert(0, "; USELSS BITCAST: "); 
4120         delete deleteUselessCastName;
4121       }
4122     }
4123     *yyvsp[-1].String += *yyvsp[0].Val->val;
4124     delete yyvsp[0].Val;
4125     deleteUselessCastFlag = false;
4126     yyval.String = yyvsp[-1].String; 
4127   }
4128     break;
4129
4130   case 267:
4131 #line 1910 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4132     {    // Used for PHI nodes
4133     std::string Name = getUniqueName(yyvsp[-3].Val->val, yyvsp[-5].Ty);
4134     Name.insert(0, yyvsp[-5].Ty->getNewTy() + "[");
4135     Name += "," + *yyvsp[-1].Val->val + "]";
4136     yyval.Val = new Value;
4137     yyval.Val->val = new std::string(Name);
4138     yyval.Val->type = yyvsp[-5].Ty;
4139     delete yyvsp[-3].Val; delete yyvsp[-1].Val;
4140   }
4141     break;
4142
4143   case 268:
4144 #line 1919 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4145     {
4146     std::string Name = getUniqueName(yyvsp[-3].Val->val, yyvsp[-6].Val->type);
4147     *yyvsp[-6].Val->val += ", [" + Name + "," + *yyvsp[-1].Val->val + "]";
4148     delete yyvsp[-3].Val; 
4149     delete yyvsp[-1].Val;
4150     yyval.Val = yyvsp[-6].Val;
4151   }
4152     break;
4153
4154   case 269:
4155 #line 1929 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4156     {
4157     yyval.ValList = new ValueList();
4158     yyval.ValList->push_back(yyvsp[0].Val);
4159   }
4160     break;
4161
4162   case 270:
4163 #line 1933 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4164     {
4165     yyval.ValList = yyvsp[-2].ValList;
4166     yyval.ValList->push_back(yyvsp[0].Val);
4167   }
4168     break;
4169
4170   case 271:
4171 #line 1940 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4172     { yyval.ValList = yyvsp[0].ValList; }
4173     break;
4174
4175   case 272:
4176 #line 1941 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4177     { yyval.ValList = new ValueList(); }
4178     break;
4179
4180   case 273:
4181 #line 1945 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4182     {
4183     *yyvsp[-1].String += " " + *yyvsp[0].String;
4184     delete yyvsp[0].String;
4185     yyval.String = yyvsp[-1].String;
4186   }
4187     break;
4188
4189   case 275:
4190 #line 1953 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4191     {
4192     const char* op = getDivRemOpcode(*yyvsp[-4].String, yyvsp[-3].Ty); 
4193     std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4194     std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4195     yyval.Val = yyvsp[-2].Val;
4196     delete yyval.Val->val;
4197     yyval.Val->val = new std::string(op);
4198     *yyval.Val->val += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4199     yyval.Val->type = yyvsp[-3].Ty;
4200     delete yyvsp[-4].String; delete yyvsp[0].Val;
4201   }
4202     break;
4203
4204   case 276:
4205 #line 1964 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4206     {
4207     std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4208     std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4209     *yyvsp[-4].String += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4210     yyval.Val = yyvsp[-2].Val;
4211     delete yyval.Val->val;
4212     yyval.Val->val = yyvsp[-4].String;
4213     yyval.Val->type = yyvsp[-3].Ty;
4214     delete yyvsp[0].Val;
4215   }
4216     break;
4217
4218   case 277:
4219 #line 1974 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4220     {
4221     std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4222     std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4223     *yyvsp[-4].String = getCompareOp(*yyvsp[-4].String, yyvsp[-3].Ty);
4224     *yyvsp[-4].String += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4225     yyval.Val = yyvsp[-2].Val;
4226     delete yyval.Val->val;
4227     yyval.Val->val = yyvsp[-4].String;
4228     yyval.Val->type = Type::get("i1",BoolTy);
4229     delete yyvsp[0].Val;
4230   }
4231     break;
4232
4233   case 278:
4234 #line 1985 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4235     {
4236     std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4237     std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4238     *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + "," + Name2;
4239     yyval.Val = yyvsp[-2].Val;
4240     delete yyval.Val->val;
4241     yyval.Val->val = yyvsp[-5].String;
4242     yyval.Val->type = Type::get("i1",BoolTy);
4243     delete yyvsp[-4].String; delete yyvsp[0].Val;
4244   }
4245     break;
4246
4247   case 279:
4248 #line 1995 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4249     {
4250     std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4251     std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4252     *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + "," + Name2;
4253     yyval.Val = yyvsp[-2].Val;
4254     delete yyval.Val->val;
4255     yyval.Val->val = yyvsp[-5].String;
4256     yyval.Val->type = Type::get("i1",BoolTy);
4257     delete yyvsp[-4].String; delete yyvsp[0].Val;
4258   }
4259     break;
4260
4261   case 280:
4262 #line 2005 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4263     {
4264     const char* shiftop = yyvsp[-3].String->c_str();
4265     if (*yyvsp[-3].String == "shr")
4266       shiftop = (yyvsp[-2].Val->type->isUnsigned()) ? "lshr" : "ashr";
4267     std::string *val = new std::string(shiftop);
4268     *val += " " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4269     yyval.Val = yyvsp[-2].Val;
4270     delete yyval.Val->val;
4271     yyval.Val->val = val;
4272     delete yyvsp[-3].String; delete yyvsp[0].Val;
4273   }
4274     break;
4275
4276   case 281:
4277 #line 2016 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4278     {
4279     std::string source = *yyvsp[-2].Val->val;
4280     const Type* SrcTy = yyvsp[-2].Val->type->resolve();
4281     const Type* DstTy = yyvsp[0].Ty->resolve();
4282     yyval.Val = yyvsp[-2].Val;
4283     delete yyval.Val->val;
4284     yyval.Val->val = new std::string();
4285     yyval.Val->type = DstTy;
4286     if (*yyvsp[-3].String == "cast") {
4287       *yyval.Val->val += getCastUpgrade(source, SrcTy, DstTy, false);
4288     } else {
4289       *yyval.Val->val += *yyvsp[-3].String + " " + source + " to " + DstTy->getNewTy();
4290     }
4291     // Check to see if this is a useless cast of a value to the same name
4292     // and the same type. Such casts will probably cause redefinition errors
4293     // when assembled and perform no code gen action so just remove them.
4294     if (*yyvsp[-3].String == "cast" || *yyvsp[-3].String == "bitcast")
4295       if (SrcTy->isInteger() && DstTy->isInteger() &&
4296           SrcTy->getBitWidth() == DstTy->getBitWidth()) {
4297         deleteUselessCastFlag = true; // Flag the "Inst" rule
4298         deleteUselessCastName = new std::string(*yyvsp[-2].Val->val); // save the name
4299         size_t pos = deleteUselessCastName->find_first_of("%\"",0);
4300         if (pos != std::string::npos) {
4301           // remove the type portion before val
4302           deleteUselessCastName->erase(0, pos);
4303         }
4304       }
4305     delete yyvsp[-3].String; 
4306     delete yyvsp[-1].String;
4307   }
4308     break;
4309
4310   case 282:
4311 #line 2046 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4312     {
4313     *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4314     yyval.Val = yyvsp[-4].Val;
4315     delete yyval.Val->val;
4316     yyval.Val->val = yyvsp[-5].String;
4317     yyval.Val->type = yyvsp[-2].Val->type;
4318     delete yyvsp[-2].Val;
4319     delete yyvsp[0].Val;
4320   }
4321     break;
4322
4323   case 283:
4324 #line 2055 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4325     {
4326     *yyvsp[-3].String += " " + *yyvsp[-2].Val->val + ", " + yyvsp[0].Ty->getNewTy();
4327     yyval.Val = yyvsp[-2].Val;
4328     delete yyval.Val->val;
4329     yyval.Val->val = yyvsp[-3].String;
4330     yyval.Val->type = yyvsp[0].Ty;
4331   }
4332     break;
4333
4334   case 284:
4335 #line 2062 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4336     {
4337     *yyvsp[-3].String += " " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4338     yyval.Val = yyvsp[-2].Val;
4339     delete yyval.Val->val;
4340     yyval.Val->val = yyvsp[-3].String;
4341     yyval.Val->type = yyval.Val->type->resolve();
4342     yyval.Val->type = yyval.Val->type->getElementType();
4343     delete yyvsp[0].Val;
4344   }
4345     break;
4346
4347   case 285:
4348 #line 2071 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4349     {
4350     *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4351     yyval.Val = yyvsp[-4].Val;
4352     delete yyval.Val->val;
4353     yyval.Val->val = yyvsp[-5].String;
4354     delete yyvsp[-2].Val; delete yyvsp[0].Val;
4355   }
4356     break;
4357
4358   case 286:
4359 #line 2078 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4360     {
4361     *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4362     yyval.Val = yyvsp[-4].Val;
4363     delete yyval.Val->val;
4364     yyval.Val->val = yyvsp[-5].String;
4365     delete yyvsp[-2].Val; delete yyvsp[0].Val;
4366   }
4367     break;
4368
4369   case 287:
4370 #line 2085 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4371     {
4372     *yyvsp[-1].String += " " + *yyvsp[0].Val->val;
4373     yyval.Val = yyvsp[0].Val;
4374     delete yyvsp[0].Val->val;
4375     yyval.Val->val = yyvsp[-1].String;
4376   }
4377     break;
4378
4379   case 288:
4380 #line 2091 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4381     {
4382     // map llvm.isunordered to "fcmp uno" 
4383     yyval.Val = new Value;
4384     if (*yyvsp[-3].Val->val == "%llvm.isunordered.f32" ||
4385         *yyvsp[-3].Val->val == "%llvm.isunordered.f64") {
4386       yyval.Val->val = new std::string( "fcmp uno " + *(*yyvsp[-1].ValList)[0]->val + ", ");
4387       size_t pos = (*yyvsp[-1].ValList)[1]->val->find(' ');
4388       assert(pos != std::string::npos && "no space?");
4389       *yyval.Val->val += (*yyvsp[-1].ValList)[1]->val->substr(pos+1);
4390       yyval.Val->type = Type::get("i1", BoolTy);
4391     } else {
4392       static unsigned upgradeCount = 1;
4393       if (*yyvsp[-3].Val->val == "%llvm.va_start" || *yyvsp[-3].Val->val == "%llvm.va_end") {
4394         if (!yyvsp[-1].ValList->empty()) {
4395           std::string name("%va_upgrade");
4396           name += llvm::utostr(upgradeCount++);
4397           yyvsp[-6].String->insert(0, name + " = bitcast " + *(*yyvsp[-1].ValList)[0]->val + " to i8*\n    ");
4398           *(*yyvsp[-1].ValList)[0]->val = "i8* " + name;
4399           (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
4400         }
4401       } else if (*yyvsp[-3].Val->val == "%llvm.va_copy") {
4402         std::string name0("%va_upgrade");
4403         name0 += llvm::utostr(upgradeCount++);
4404         std::string name1("%va_upgrade");
4405         name1 += llvm::utostr(upgradeCount++);
4406         yyvsp[-6].String->insert(0, name0 + " = bitcast " + *(*yyvsp[-1].ValList)[0]->val + " to i8*\n    " +
4407                       name1 + " = bitcast " + *(*yyvsp[-1].ValList)[1]->val + " to i8*\n    ");
4408         *(*yyvsp[-1].ValList)[0]->val = "i8* " + name0;
4409         (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
4410         *(*yyvsp[-1].ValList)[1]->val = "i8* " + name1;
4411         (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
4412       }
4413       if (!yyvsp[-5].String->empty())
4414         *yyvsp[-6].String += " " + *yyvsp[-5].String;
4415       if (!yyvsp[-6].String->empty())
4416         *yyvsp[-6].String += " ";
4417       *yyvsp[-6].String += yyvsp[-4].Ty->getNewTy() + " " + *yyvsp[-3].Val->val + "(";
4418       for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
4419         Value* V = (*yyvsp[-1].ValList)[i];
4420         *yyvsp[-6].String += *V->val;
4421         if (i+1 < yyvsp[-1].ValList->size())
4422           *yyvsp[-6].String += ", ";
4423         delete V;
4424       }
4425       *yyvsp[-6].String += ")";
4426       yyval.Val = new Value;
4427       yyval.Val->val = yyvsp[-6].String;
4428       yyval.Val->type = getFunctionReturnType(yyvsp[-4].Ty);
4429     }
4430     delete yyvsp[-5].String; delete yyvsp[-3].Val; delete yyvsp[-1].ValList;
4431   }
4432     break;
4433
4434   case 290:
4435 #line 2147 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4436     { yyval.ValList = yyvsp[0].ValList; }
4437     break;
4438
4439   case 291:
4440 #line 2148 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4441     {  yyval.ValList = new ValueList(); }
4442     break;
4443
4444   case 293:
4445 #line 2153 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4446     { yyval.String = new std::string(); }
4447     break;
4448
4449   case 294:
4450 #line 2156 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4451     {
4452     *yyvsp[-2].String += " " + yyvsp[-1].Ty->getNewTy();
4453     if (!yyvsp[0].String->empty())
4454       *yyvsp[-2].String += " " + *yyvsp[0].String;
4455     yyval.Val = new Value;
4456     yyval.Val->val = yyvsp[-2].String;
4457     yyval.Val->type = yyvsp[-1].Ty->getPointerType();
4458     delete yyvsp[0].String;
4459   }
4460     break;
4461
4462   case 295:
4463 #line 2165 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4464     {
4465     std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4466     *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + ", " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4467     if (!yyvsp[0].String->empty())
4468       *yyvsp[-5].String += " " + *yyvsp[0].String;
4469     yyval.Val = new Value;
4470     yyval.Val->val = yyvsp[-5].String;
4471     yyval.Val->type = yyvsp[-4].Ty->getPointerType();
4472     delete yyvsp[-1].Val; delete yyvsp[0].String;
4473   }
4474     break;
4475
4476   case 296:
4477 #line 2175 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4478     {
4479     *yyvsp[-2].String += " " + yyvsp[-1].Ty->getNewTy();
4480     if (!yyvsp[0].String->empty())
4481       *yyvsp[-2].String += " " + *yyvsp[0].String;
4482     yyval.Val = new Value;
4483     yyval.Val->val = yyvsp[-2].String;
4484     yyval.Val->type = yyvsp[-1].Ty->getPointerType();
4485     delete yyvsp[0].String;
4486   }
4487     break;
4488
4489   case 297:
4490 #line 2184 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4491     {
4492     std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4493     *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + ", " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4494     if (!yyvsp[0].String->empty())
4495       *yyvsp[-5].String += " " + *yyvsp[0].String;
4496     yyval.Val = yyvsp[-1].Val;
4497     delete yyval.Val->val;
4498     yyval.Val->val = yyvsp[-5].String;
4499     yyval.Val->type = yyvsp[-4].Ty->getPointerType();
4500     delete yyvsp[0].String;
4501   }
4502     break;
4503
4504   case 298:
4505 #line 2195 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4506     {
4507     *yyvsp[-1].String += " " + *yyvsp[0].Val->val;
4508     yyval.Val = yyvsp[0].Val;
4509     delete yyvsp[0].Val->val;
4510     yyval.Val->val = yyvsp[-1].String;
4511     yyval.Val->type = Type::get("void", VoidTy); 
4512   }
4513     break;
4514
4515   case 299:
4516 #line 2202 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4517     {
4518     std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
4519     if (!yyvsp[-3].String->empty())
4520       *yyvsp[-3].String += " ";
4521     *yyvsp[-3].String += *yyvsp[-2].String + " " + yyvsp[-1].Ty->getNewTy() + " " + Name;
4522     yyval.Val = yyvsp[0].Val;
4523     delete yyval.Val->val;
4524     yyval.Val->val = yyvsp[-3].String;
4525     yyval.Val->type = yyvsp[-1].Ty->getElementType();
4526     delete yyvsp[-2].String;
4527   }
4528     break;
4529
4530   case 300:
4531 #line 2213 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4532     {
4533     std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
4534     if (!yyvsp[-5].String->empty())
4535       *yyvsp[-5].String += " ";
4536     *yyvsp[-5].String += *yyvsp[-4].String + " " + *yyvsp[-3].Val->val + ", " + yyvsp[-1].Ty->getNewTy() + " " + Name;
4537     yyval.Val = yyvsp[-3].Val;
4538     delete yyval.Val->val;
4539     yyval.Val->val = yyvsp[-5].String;
4540     yyval.Val->type = Type::get("void", VoidTy);
4541     delete yyvsp[-4].String; delete yyvsp[0].Val;
4542   }
4543     break;
4544
4545   case 301:
4546 #line 2224 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4547     {
4548     std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4549     // Upgrade the indices
4550     for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
4551       Value* V = (*yyvsp[0].ValList)[i];
4552       if (V->type->isUnsigned() && !V->isConstant() && 
4553           V->type->getBitWidth() < 64) {
4554         *O << "    %gep_upgrade" << UniqueNameCounter << " = zext " << *V->val 
4555            << " to i64\n";
4556         *V->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++);
4557         V->type = Type::get("i64",ULongTy);
4558       }
4559     }
4560     *yyvsp[-3].String += " " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4561     for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
4562       Value* V = (*yyvsp[0].ValList)[i];
4563       *yyvsp[-3].String += ", " + *V->val;
4564     }
4565     yyval.Val = yyvsp[-1].Val;
4566     delete yyval.Val->val;
4567     yyval.Val->val = yyvsp[-3].String;
4568     yyval.Val->type = getGEPIndexedType(yyvsp[-2].Ty,yyvsp[0].ValList); 
4569     for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i)
4570       delete (*yyvsp[0].ValList)[i];
4571     delete yyvsp[0].ValList;
4572   }
4573     break;
4574
4575
4576     }
4577
4578 /* Line 1016 of /usr/local/share/bison/yacc.c.  */
4579 #line 4580 "UpgradeParser.tab.c"
4580 \f
4581   yyvsp -= yylen;
4582   yyssp -= yylen;
4583
4584
4585 #if YYDEBUG
4586   if (yydebug)
4587     {
4588       short *yyssp1 = yyss - 1;
4589       YYFPRINTF (stderr, "state stack now");
4590       while (yyssp1 != yyssp)
4591         YYFPRINTF (stderr, " %d", *++yyssp1);
4592       YYFPRINTF (stderr, "\n");
4593     }
4594 #endif
4595
4596   *++yyvsp = yyval;
4597
4598
4599   /* Now `shift' the result of the reduction.  Determine what state
4600      that goes to, based on the state we popped back to and the rule
4601      number reduced by.  */
4602
4603   yyn = yyr1[yyn];
4604
4605   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4606   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4607     yystate = yytable[yystate];
4608   else
4609     yystate = yydefgoto[yyn - YYNTOKENS];
4610
4611   goto yynewstate;
4612
4613
4614 /*------------------------------------.
4615 | yyerrlab -- here on detecting error |
4616 `------------------------------------*/
4617 yyerrlab:
4618   /* If not already recovering from an error, report this error.  */
4619   if (!yyerrstatus)
4620     {
4621       ++yynerrs;
4622 #if YYERROR_VERBOSE
4623       yyn = yypact[yystate];
4624
4625       if (YYPACT_NINF < yyn && yyn < YYLAST)
4626         {
4627           YYSIZE_T yysize = 0;
4628           int yytype = YYTRANSLATE (yychar);
4629           char *yymsg;
4630           int yyx, yycount;
4631
4632           yycount = 0;
4633           /* Start YYX at -YYN if negative to avoid negative indexes in
4634              YYCHECK.  */
4635           for (yyx = yyn < 0 ? -yyn : 0;
4636                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
4637             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4638               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
4639           yysize += yystrlen ("parse error, unexpected ") + 1;
4640           yysize += yystrlen (yytname[yytype]);
4641           yymsg = (char *) YYSTACK_ALLOC (yysize);
4642           if (yymsg != 0)
4643             {
4644               char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
4645               yyp = yystpcpy (yyp, yytname[yytype]);
4646
4647               if (yycount < 5)
4648                 {
4649                   yycount = 0;
4650                   for (yyx = yyn < 0 ? -yyn : 0;
4651                        yyx < (int) (sizeof (yytname) / sizeof (char *));
4652                        yyx++)
4653                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4654                       {
4655                         const char *yyq = ! yycount ? ", expecting " : " or ";
4656                         yyp = yystpcpy (yyp, yyq);
4657                         yyp = yystpcpy (yyp, yytname[yyx]);
4658                         yycount++;
4659                       }
4660                 }
4661               yyerror (yymsg);
4662               YYSTACK_FREE (yymsg);
4663             }
4664           else
4665             yyerror ("parse error; also virtual memory exhausted");
4666         }
4667       else
4668 #endif /* YYERROR_VERBOSE */
4669         yyerror ("parse error");
4670     }
4671   goto yyerrlab1;
4672
4673
4674 /*----------------------------------------------------.
4675 | yyerrlab1 -- error raised explicitly by an action.  |
4676 `----------------------------------------------------*/
4677 yyerrlab1:
4678   if (yyerrstatus == 3)
4679     {
4680       /* If just tried and failed to reuse lookahead token after an
4681          error, discard it.  */
4682
4683       /* Return failure if at end of input.  */
4684       if (yychar == YYEOF)
4685         {
4686           /* Pop the error token.  */
4687           YYPOPSTACK;
4688           /* Pop the rest of the stack.  */
4689           while (yyssp > yyss)
4690             {
4691               YYDPRINTF ((stderr, "Error: popping "));
4692               YYDSYMPRINT ((stderr,
4693                             yystos[*yyssp],
4694                             *yyvsp));
4695               YYDPRINTF ((stderr, "\n"));
4696               yydestruct (yystos[*yyssp], *yyvsp);
4697               YYPOPSTACK;
4698             }
4699           YYABORT;
4700         }
4701
4702       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
4703                   yychar, yytname[yychar1]));
4704       yydestruct (yychar1, yylval);
4705       yychar = YYEMPTY;
4706     }
4707
4708   /* Else will try to reuse lookahead token after shifting the error
4709      token.  */
4710
4711   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
4712
4713   for (;;)
4714     {
4715       yyn = yypact[yystate];
4716       if (yyn != YYPACT_NINF)
4717         {
4718           yyn += YYTERROR;
4719           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4720             {
4721               yyn = yytable[yyn];
4722               if (0 < yyn)
4723                 break;
4724             }
4725         }
4726
4727       /* Pop the current state because it cannot handle the error token.  */
4728       if (yyssp == yyss)
4729         YYABORT;
4730
4731       YYDPRINTF ((stderr, "Error: popping "));
4732       YYDSYMPRINT ((stderr,
4733                     yystos[*yyssp], *yyvsp));
4734       YYDPRINTF ((stderr, "\n"));
4735
4736       yydestruct (yystos[yystate], *yyvsp);
4737       yyvsp--;
4738       yystate = *--yyssp;
4739
4740
4741 #if YYDEBUG
4742       if (yydebug)
4743         {
4744           short *yyssp1 = yyss - 1;
4745           YYFPRINTF (stderr, "Error: state stack now");
4746           while (yyssp1 != yyssp)
4747             YYFPRINTF (stderr, " %d", *++yyssp1);
4748           YYFPRINTF (stderr, "\n");
4749         }
4750 #endif
4751     }
4752
4753   if (yyn == YYFINAL)
4754     YYACCEPT;
4755
4756   YYDPRINTF ((stderr, "Shifting error token, "));
4757
4758   *++yyvsp = yylval;
4759
4760
4761   yystate = yyn;
4762   goto yynewstate;
4763
4764
4765 /*-------------------------------------.
4766 | yyacceptlab -- YYACCEPT comes here.  |
4767 `-------------------------------------*/
4768 yyacceptlab:
4769   yyresult = 0;
4770   goto yyreturn;
4771
4772 /*-----------------------------------.
4773 | yyabortlab -- YYABORT comes here.  |
4774 `-----------------------------------*/
4775 yyabortlab:
4776   yyresult = 1;
4777   goto yyreturn;
4778
4779 #ifndef yyoverflow
4780 /*----------------------------------------------.
4781 | yyoverflowlab -- parser overflow comes here.  |
4782 `----------------------------------------------*/
4783 yyoverflowlab:
4784   yyerror ("parser stack overflow");
4785   yyresult = 2;
4786   /* Fall through.  */
4787 #endif
4788
4789 yyreturn:
4790 #ifndef yyoverflow
4791   if (yyss != yyssa)
4792     YYSTACK_FREE (yyss);
4793 #endif
4794   return yyresult;
4795 }
4796
4797
4798 #line 2251 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4799
4800
4801 int yyerror(const char *ErrorMsg) {
4802   std::string where 
4803     = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4804                   + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
4805   std::string errMsg = where + "error: " + std::string(ErrorMsg) + 
4806                        " while reading ";
4807   if (yychar == YYEMPTY || yychar == 0)
4808     errMsg += "end-of-file.";
4809   else
4810     errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
4811   std::cerr << "llvm-upgrade: " << errMsg << '\n';
4812   *O << "llvm-upgrade parse failed.\n";
4813   exit(1);
4814 }
4815
4816 void warning(const std::string& ErrorMsg) {
4817   std::string where 
4818     = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4819                   + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
4820   std::string errMsg = where + "warning: " + std::string(ErrorMsg) + 
4821                        " while reading ";
4822   if (yychar == YYEMPTY || yychar == 0)
4823     errMsg += "end-of-file.";
4824   else
4825     errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
4826   std::cerr << "llvm-upgrade: " << errMsg << '\n';
4827 }
4828