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