blob: da69f6f9bccf725c96ddfc59ec5c4242504edf0b [file] [log] [blame]
Reid Spencer319a7302007-01-05 17:20:02 +00001/* A Bison parser, made by GNU Bison 2.1. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002
Reid Spencer319a7302007-01-05 17:20:02 +00003/* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Reid Spencere7c3c602006-11-30 06:36:44 +00005
Reid Spencer319a7302007-01-05 17:20:02 +00006 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.
Reid Spencere7c3c602006-11-30 06:36:44 +000010
Reid Spencer319a7302007-01-05 17:20:02 +000011 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. */
Reid Spencere7c3c602006-11-30 06:36:44 +000052#define yyparse Upgradeparse
Reid Spencer319a7302007-01-05 17:20:02 +000053#define yylex Upgradelex
Reid Spencere7c3c602006-11-30 06:36:44 +000054#define yyerror Upgradeerror
Reid Spencer319a7302007-01-05 17:20:02 +000055#define yylval Upgradelval
56#define yychar Upgradechar
Reid Spencere7c3c602006-11-30 06:36:44 +000057#define yydebug Upgradedebug
58#define yynerrs Upgradenerrs
59
Reid Spencere7c3c602006-11-30 06:36:44 +000060
Reid Spencer319a7302007-01-05 17:20:02 +000061/* 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 NOT = 304,
114 EXTERNAL = 305,
115 TARGET = 306,
116 TRIPLE = 307,
117 ENDIAN = 308,
118 POINTERSIZE = 309,
119 LITTLE = 310,
120 BIG = 311,
121 ALIGN = 312,
122 UNINITIALIZED = 313,
123 DEPLIBS = 314,
124 CALL = 315,
125 TAIL = 316,
126 ASM_TOK = 317,
127 MODULE = 318,
128 SIDEEFFECT = 319,
129 CC_TOK = 320,
130 CCC_TOK = 321,
131 CSRETCC_TOK = 322,
132 FASTCC_TOK = 323,
133 COLDCC_TOK = 324,
134 X86_STDCALLCC_TOK = 325,
135 X86_FASTCALLCC_TOK = 326,
136 DATALAYOUT = 327,
137 RET = 328,
138 BR = 329,
139 SWITCH = 330,
140 INVOKE = 331,
141 EXCEPT = 332,
142 UNWIND = 333,
143 UNREACHABLE = 334,
144 ADD = 335,
145 SUB = 336,
146 MUL = 337,
147 DIV = 338,
148 UDIV = 339,
149 SDIV = 340,
150 FDIV = 341,
151 REM = 342,
152 UREM = 343,
153 SREM = 344,
154 FREM = 345,
155 AND = 346,
156 OR = 347,
157 XOR = 348,
158 SETLE = 349,
159 SETGE = 350,
160 SETLT = 351,
161 SETGT = 352,
162 SETEQ = 353,
163 SETNE = 354,
164 ICMP = 355,
165 FCMP = 356,
166 EQ = 357,
167 NE = 358,
168 SLT = 359,
169 SGT = 360,
170 SLE = 361,
171 SGE = 362,
172 OEQ = 363,
173 ONE = 364,
174 OLT = 365,
175 OGT = 366,
176 OLE = 367,
177 OGE = 368,
178 ORD = 369,
179 UNO = 370,
180 UEQ = 371,
181 UNE = 372,
182 ULT = 373,
183 UGT = 374,
184 ULE = 375,
185 UGE = 376,
186 MALLOC = 377,
187 ALLOCA = 378,
188 FREE = 379,
189 LOAD = 380,
190 STORE = 381,
191 GETELEMENTPTR = 382,
192 PHI_TOK = 383,
193 SELECT = 384,
194 SHL = 385,
195 SHR = 386,
196 ASHR = 387,
197 LSHR = 388,
198 VAARG = 389,
199 EXTRACTELEMENT = 390,
200 INSERTELEMENT = 391,
201 SHUFFLEVECTOR = 392,
202 CAST = 393,
203 TRUNC = 394,
204 ZEXT = 395,
205 SEXT = 396,
206 FPTRUNC = 397,
207 FPEXT = 398,
208 FPTOUI = 399,
209 FPTOSI = 400,
210 UITOFP = 401,
211 SITOFP = 402,
212 PTRTOINT = 403,
213 INTTOPTR = 404,
214 BITCAST = 405
215 };
216#endif
217/* Tokens. */
218#define VOID 258
219#define BOOL 259
220#define SBYTE 260
221#define UBYTE 261
222#define SHORT 262
223#define USHORT 263
224#define INT 264
225#define UINT 265
226#define LONG 266
227#define ULONG 267
228#define FLOAT 268
229#define DOUBLE 269
230#define LABEL 270
231#define OPAQUE 271
232#define ESINT64VAL 272
233#define EUINT64VAL 273
234#define SINTVAL 274
235#define UINTVAL 275
236#define FPVAL 276
237#define NULL_TOK 277
238#define UNDEF 278
239#define ZEROINITIALIZER 279
240#define TRUETOK 280
241#define FALSETOK 281
242#define TYPE 282
243#define VAR_ID 283
244#define LABELSTR 284
245#define STRINGCONSTANT 285
246#define IMPLEMENTATION 286
247#define BEGINTOK 287
248#define ENDTOK 288
249#define DECLARE 289
250#define GLOBAL 290
251#define CONSTANT 291
252#define SECTION 292
253#define VOLATILE 293
254#define TO 294
255#define DOTDOTDOT 295
256#define CONST 296
257#define INTERNAL 297
258#define LINKONCE 298
259#define WEAK 299
260#define DLLIMPORT 300
261#define DLLEXPORT 301
262#define EXTERN_WEAK 302
263#define APPENDING 303
264#define NOT 304
265#define EXTERNAL 305
266#define TARGET 306
267#define TRIPLE 307
268#define ENDIAN 308
269#define POINTERSIZE 309
270#define LITTLE 310
271#define BIG 311
272#define ALIGN 312
273#define UNINITIALIZED 313
274#define DEPLIBS 314
275#define CALL 315
276#define TAIL 316
277#define ASM_TOK 317
278#define MODULE 318
279#define SIDEEFFECT 319
280#define CC_TOK 320
281#define CCC_TOK 321
282#define CSRETCC_TOK 322
283#define FASTCC_TOK 323
284#define COLDCC_TOK 324
285#define X86_STDCALLCC_TOK 325
286#define X86_FASTCALLCC_TOK 326
287#define DATALAYOUT 327
288#define RET 328
289#define BR 329
290#define SWITCH 330
291#define INVOKE 331
292#define EXCEPT 332
293#define UNWIND 333
294#define UNREACHABLE 334
295#define ADD 335
296#define SUB 336
297#define MUL 337
298#define DIV 338
299#define UDIV 339
300#define SDIV 340
301#define FDIV 341
302#define REM 342
303#define UREM 343
304#define SREM 344
305#define FREM 345
306#define AND 346
307#define OR 347
308#define XOR 348
309#define SETLE 349
310#define SETGE 350
311#define SETLT 351
312#define SETGT 352
313#define SETEQ 353
314#define SETNE 354
315#define ICMP 355
316#define FCMP 356
317#define EQ 357
318#define NE 358
319#define SLT 359
320#define SGT 360
321#define SLE 361
322#define SGE 362
323#define OEQ 363
324#define ONE 364
325#define OLT 365
326#define OGT 366
327#define OLE 367
328#define OGE 368
329#define ORD 369
330#define UNO 370
331#define UEQ 371
332#define UNE 372
333#define ULT 373
334#define UGT 374
335#define ULE 375
336#define UGE 376
337#define MALLOC 377
338#define ALLOCA 378
339#define FREE 379
340#define LOAD 380
341#define STORE 381
342#define GETELEMENTPTR 382
343#define PHI_TOK 383
344#define SELECT 384
345#define SHL 385
346#define SHR 386
347#define ASHR 387
348#define LSHR 388
349#define VAARG 389
350#define EXTRACTELEMENT 390
351#define INSERTELEMENT 391
352#define SHUFFLEVECTOR 392
353#define CAST 393
354#define TRUNC 394
355#define ZEXT 395
356#define SEXT 396
357#define FPTRUNC 397
358#define FPEXT 398
359#define FPTOUI 399
360#define FPTOSI 400
361#define UITOFP 401
362#define SITOFP 402
363#define PTRTOINT 403
364#define INTTOPTR 404
365#define BITCAST 405
366
367
368
369
370/* Copy the first part of user declarations. */
Reid Spencer609ca3e2007-01-12 20:10:51 +0000371#line 14 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +0000372
373#include "UpgradeInternals.h"
Reid Spencere7c3c602006-11-30 06:36:44 +0000374#include <algorithm>
Reid Spencera50d5962006-12-02 04:11:07 +0000375#include <map>
Reid Spencere7c3c602006-11-30 06:36:44 +0000376#include <utility>
377#include <iostream>
378
Reid Spencere77e35e2006-12-01 20:26:20 +0000379#define YYERROR_VERBOSE 1
Reid Spencer96839be2006-11-30 16:50:26 +0000380#define YYINCLUDED_STDLIB_H
Reid Spencere77e35e2006-12-01 20:26:20 +0000381#define YYDEBUG 1
Reid Spencere7c3c602006-11-30 06:36:44 +0000382
383int yylex(); // declaration" of xxx warnings.
384int yyparse();
Reid Spencere77e35e2006-12-01 20:26:20 +0000385extern int yydebug;
Reid Spencere7c3c602006-11-30 06:36:44 +0000386
387static std::string CurFilename;
Reid Spencere7c3c602006-11-30 06:36:44 +0000388static std::ostream *O = 0;
Reid Spencer96839be2006-11-30 16:50:26 +0000389std::istream* LexInput = 0;
Reid Spencere77e35e2006-12-01 20:26:20 +0000390unsigned SizeOfPointer = 32;
Reid Spencerf459d392006-12-02 16:19:52 +0000391static uint64_t unique = 1;
Reid Spencer96839be2006-11-30 16:50:26 +0000392
Reid Spencer71d2ec92006-12-31 06:02:26 +0000393// This bool controls whether attributes are ever added to function declarations
394// definitions and calls.
395static bool AddAttributes = false;
396
Reid Spencerf5626a32007-01-01 01:20:41 +0000397// This bool is used to communicate between the InstVal and Inst rules about
398// whether or not a cast should be deleted. When the flag is set, InstVal has
399// determined that the cast is a candidate. However, it can only be deleted if
400// the value being casted is the same value name as the instruction. The Inst
401// rule makes that comparison if the flag is set and comments out the
402// instruction if they match.
403static bool deleteUselessCastFlag = false;
404static std::string* deleteUselessCastName = 0;
405
Reid Spencer319a7302007-01-05 17:20:02 +0000406typedef std::vector<const TypeInfo*> TypeVector;
Reid Spencera50d5962006-12-02 04:11:07 +0000407static TypeVector EnumeratedTypes;
Reid Spencer319a7302007-01-05 17:20:02 +0000408typedef std::map<std::string,const TypeInfo*> TypeMap;
Reid Spencera50d5962006-12-02 04:11:07 +0000409static TypeMap NamedTypes;
Reid Spencer319a7302007-01-05 17:20:02 +0000410typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
411typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
412static GlobalsTypeMap Globals;
413
414static void warning(const std::string& msg);
Reid Spencera50d5962006-12-02 04:11:07 +0000415
Reid Spencerf8483652006-12-02 15:16:01 +0000416void destroy(ValueList* VL) {
417 while (!VL->empty()) {
418 ValueInfo& VI = VL->back();
419 VI.destroy();
420 VL->pop_back();
421 }
422 delete VL;
423}
424
Reid Spencer96839be2006-11-30 16:50:26 +0000425void UpgradeAssembly(const std::string &infile, std::istream& in,
Reid Spencer71d2ec92006-12-31 06:02:26 +0000426 std::ostream &out, bool debug, bool addAttrs)
Reid Spencere7c3c602006-11-30 06:36:44 +0000427{
428 Upgradelineno = 1;
429 CurFilename = infile;
Reid Spencer96839be2006-11-30 16:50:26 +0000430 LexInput = &in;
Reid Spencere77e35e2006-12-01 20:26:20 +0000431 yydebug = debug;
Reid Spencer71d2ec92006-12-31 06:02:26 +0000432 AddAttributes = addAttrs;
Reid Spencere7c3c602006-11-30 06:36:44 +0000433 O = &out;
434
435 if (yyparse()) {
436 std::cerr << "Parse failed.\n";
Chris Lattner37e01c52007-01-04 18:46:42 +0000437 out << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +0000438 exit(1);
439 }
440}
441
Reid Spencer319a7302007-01-05 17:20:02 +0000442TypeInfo::TypeRegMap TypeInfo::registry;
443
444const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) {
445 TypeInfo* Ty = new TypeInfo();
446 Ty->newTy = newType;
447 Ty->oldTy = oldType;
448 return add_new_type(Ty);
449}
450
451const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
452 const TypeInfo* eTy, const TypeInfo* rTy) {
453 TypeInfo* Ty= new TypeInfo();
454 Ty->newTy = newType;
455 Ty->oldTy = oldType;
456 Ty->elemTy = const_cast<TypeInfo*>(eTy);
457 Ty->resultTy = const_cast<TypeInfo*>(rTy);
458 return add_new_type(Ty);
459}
460
461const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
462 const TypeInfo *eTy, uint64_t elems) {
463 TypeInfo* Ty = new TypeInfo();
464 Ty->newTy = newType;
465 Ty->oldTy = oldType;
466 Ty->elemTy = const_cast<TypeInfo*>(eTy);
467 Ty->nelems = elems;
468 return add_new_type(Ty);
469}
470
471const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
472 TypeList* TL) {
473 TypeInfo* Ty = new TypeInfo();
474 Ty->newTy = newType;
475 Ty->oldTy = oldType;
476 Ty->elements = TL;
477 return add_new_type(Ty);
478}
479
480const TypeInfo* TypeInfo::get(const std::string& newType, const TypeInfo* resTy,
481 TypeList* TL) {
482 TypeInfo* Ty = new TypeInfo();
483 Ty->newTy = newType;
484 Ty->oldTy = FunctionTy;
485 Ty->resultTy = const_cast<TypeInfo*>(resTy);
486 Ty->elements = TL;
487 return add_new_type(Ty);
488}
489
490const TypeInfo* TypeInfo::resolve() const {
491 if (isUnresolved()) {
Reid Spencerf8383de2007-01-06 06:04:32 +0000492 if (getNewTy()[0] == '%' && isdigit(newTy[1])) {
493 unsigned ref = atoi(&((newTy.c_str())[1])); // skip the %
Reid Spencereff838e2007-01-03 23:45:42 +0000494 if (ref < EnumeratedTypes.size()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000495 return EnumeratedTypes[ref];
Reid Spencereff838e2007-01-03 23:45:42 +0000496 } else {
497 std::string msg("Can't resolve numbered type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000498 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000499 yyerror(msg.c_str());
500 }
Reid Spencer78720742006-12-02 20:21:22 +0000501 } else {
Reid Spencerf8383de2007-01-06 06:04:32 +0000502 TypeMap::iterator I = NamedTypes.find(newTy);
Reid Spencereff838e2007-01-03 23:45:42 +0000503 if (I != NamedTypes.end()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000504 return I->second;
Reid Spencereff838e2007-01-03 23:45:42 +0000505 } else {
506 std::string msg("Cannot resolve type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000507 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000508 yyerror(msg.c_str());
509 }
Reid Spencera50d5962006-12-02 04:11:07 +0000510 }
Reid Spencer280d8012006-12-01 23:40:53 +0000511 }
Reid Spencera50d5962006-12-02 04:11:07 +0000512 // otherwise its already resolved.
Reid Spencer319a7302007-01-05 17:20:02 +0000513 return this;
514}
515
516bool TypeInfo::operator<(const TypeInfo& that) const {
517 if (this == &that)
518 return false;
519 if (oldTy != that.oldTy)
520 return oldTy < that.oldTy;
521 switch (oldTy) {
522 case UpRefTy: {
523 unsigned thisUp = this->getUpRefNum();
524 unsigned thatUp = that.getUpRefNum();
525 return thisUp < thatUp;
526 }
527 case PackedTy:
528 case ArrayTy:
529 if (this->nelems != that.nelems)
530 return nelems < that.nelems;
531 case PointerTy: {
532 const TypeInfo* thisTy = this->elemTy;
533 const TypeInfo* thatTy = that.elemTy;
534 return *thisTy < *thatTy;
535 }
536 case FunctionTy: {
537 const TypeInfo* thisTy = this->resultTy;
538 const TypeInfo* thatTy = that.resultTy;
539 if (!thisTy->sameOldTyAs(thatTy))
540 return *thisTy < *thatTy;
541 /* FALL THROUGH */
542 }
543 case StructTy:
544 case PackedStructTy: {
545 if (elements->size() != that.elements->size())
546 return elements->size() < that.elements->size();
547 for (unsigned i = 0; i < elements->size(); i++) {
548 const TypeInfo* thisTy = (*this->elements)[i];
549 const TypeInfo* thatTy = (*that.elements)[i];
550 if (!thisTy->sameOldTyAs(thatTy))
551 return *thisTy < *thatTy;
552 }
553 break;
554 }
555 case UnresolvedTy:
556 return this->newTy < that.newTy;
557 default:
558 break;
559 }
560 return false;
561}
562
563bool TypeInfo::sameOldTyAs(const TypeInfo* that) const {
564 if (that == 0)
565 return false;
566 if ( this == that )
567 return true;
568 if (oldTy != that->oldTy)
569 return false;
570 switch (oldTy) {
571 case PackedTy:
572 case ArrayTy:
573 if (nelems != that->nelems)
574 return false;
575 /* FALL THROUGH */
576 case PointerTy: {
577 const TypeInfo* thisTy = this->elemTy;
578 const TypeInfo* thatTy = that->elemTy;
579 return thisTy->sameOldTyAs(thatTy);
580 }
581 case FunctionTy: {
582 const TypeInfo* thisTy = this->resultTy;
583 const TypeInfo* thatTy = that->resultTy;
584 if (!thisTy->sameOldTyAs(thatTy))
585 return false;
586 /* FALL THROUGH */
587 }
588 case StructTy:
589 case PackedStructTy: {
590 if (elements->size() != that->elements->size())
591 return false;
592 for (unsigned i = 0; i < elements->size(); i++) {
593 const TypeInfo* thisTy = (*this->elements)[i];
594 const TypeInfo* thatTy = (*that->elements)[i];
595 if (!thisTy->sameOldTyAs(thatTy))
596 return false;
597 }
598 return true;
599 }
600 case UnresolvedTy:
601 return this->newTy == that->newTy;
602 default:
603 return true; // for all others oldTy == that->oldTy is sufficient
604 }
605 return true;
606}
607
608bool TypeInfo::isUnresolvedDeep() const {
609 switch (oldTy) {
610 case UnresolvedTy:
611 return true;
612 case PackedTy:
613 case ArrayTy:
614 case PointerTy:
615 return elemTy->isUnresolvedDeep();
616 case PackedStructTy:
617 case StructTy:
618 for (unsigned i = 0; i < elements->size(); i++)
619 if ((*elements)[i]->isUnresolvedDeep())
620 return true;
621 return false;
622 default:
623 return false;
624 }
625}
626
627unsigned TypeInfo::getBitWidth() const {
628 switch (oldTy) {
629 default:
630 case LabelTy:
631 case VoidTy : return 0;
632 case BoolTy : return 1;
633 case SByteTy: case UByteTy : return 8;
634 case ShortTy: case UShortTy : return 16;
635 case IntTy: case UIntTy: case FloatTy: return 32;
636 case LongTy: case ULongTy: case DoubleTy : return 64;
637 case PointerTy: return SizeOfPointer; // global var
638 case PackedTy:
639 case ArrayTy:
640 return nelems * elemTy->getBitWidth();
641 case StructTy:
642 case PackedStructTy: {
643 uint64_t size = 0;
644 for (unsigned i = 0; i < elements->size(); i++) {
645 size += (*elements)[i]->getBitWidth();
646 }
647 return size;
648 }
649 }
650}
651
652const TypeInfo* TypeInfo::getIndexedType(const ValueInfo& VI) const {
653 if (isStruct()) {
654 if (VI.isConstant() && VI.type->isInteger()) {
655 size_t pos = VI.val->find(' ') + 1;
656 if (pos < VI.val->size()) {
657 uint64_t idx = atoi(VI.val->substr(pos).c_str());
658 return (*elements)[idx];
659 } else {
660 yyerror("Invalid value for constant integer");
661 return 0;
662 }
663 } else {
664 yyerror("Structure requires constant index");
665 return 0;
666 }
667 }
668 if (isArray() || isPacked() || isPointer())
669 return elemTy;
670 yyerror("Invalid type for getIndexedType");
671 return 0;
672}
673
Reid Spencerf8383de2007-01-06 06:04:32 +0000674void TypeInfo::getSignedness(unsigned &sNum, unsigned &uNum,
675 UpRefStack& stack) const {
676 switch (oldTy) {
677 default:
678 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy:
679 case FloatTy : case DoubleTy: case UpRefTy:
680 return;
681 case SByteTy: case ShortTy: case LongTy: case IntTy:
682 sNum++;
683 return;
684 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
685 uNum++;
686 return;
687 case PointerTy:
688 case PackedTy:
689 case ArrayTy:
690 stack.push_back(this);
691 elemTy->getSignedness(sNum, uNum, stack);
692 return;
693 case StructTy:
694 case PackedStructTy: {
695 stack.push_back(this);
696 for (unsigned i = 0; i < elements->size(); i++) {
697 (*elements)[i]->getSignedness(sNum, uNum, stack);
698 }
699 return;
700 }
701 case UnresolvedTy: {
702 const TypeInfo* Ty = this->resolve();
703 // Let's not recurse.
704 UpRefStack::const_iterator I = stack.begin(), E = stack.end();
705 for ( ; I != E && *I != Ty; ++I)
706 ;
707 if (I == E)
708 Ty->getSignedness(sNum, uNum, stack);
709 return;
710 }
711 }
712}
713
714std::string AddSuffix(const std::string& Name, const std::string& Suffix) {
715 if (Name[Name.size()-1] == '"') {
716 std::string Result = Name;
717 Result.insert(Result.size()-1, Suffix);
718 return Result;
719 }
720 return Name + Suffix;
721}
722
723std::string TypeInfo::makeUniqueName(const std::string& BaseName) const {
724 if (BaseName == "\"alloca point\"")
725 return BaseName;
726 switch (oldTy) {
727 default:
728 break;
729 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy:
730 case FloatTy : case DoubleTy: case UnresolvedTy:
731 return BaseName;
732 case SByteTy: case ShortTy: case LongTy: case IntTy:
733 return AddSuffix(BaseName, ".s");
734 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
735 return AddSuffix(BaseName, ".u");
736 }
737
738 unsigned uNum = 0, sNum = 0;
739 std::string Suffix;
740 switch (oldTy) {
741 case PointerTy:
742 case PackedTy:
743 case ArrayTy: {
744 TypeInfo::UpRefStack stack;
745 elemTy->resolve()->getSignedness(sNum, uNum, stack);
746 break;
747 }
748 case StructTy:
749 case PackedStructTy: {
750 for (unsigned i = 0; i < elements->size(); i++) {
751 TypeInfo::UpRefStack stack;
752 (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack);
753 }
754 break;
755 }
756 default:
757 assert(0 && "Invalid Type");
758 break;
759 }
760
761 if (sNum == 0 && uNum == 0)
762 return BaseName;
763
764 switch (oldTy) {
765 default: Suffix += ".nada"; break;
766 case PointerTy: Suffix += ".pntr"; break;
767 case PackedTy: Suffix += ".pckd"; break;
768 case ArrayTy: Suffix += ".arry"; break;
769 case StructTy: Suffix += ".strc"; break;
770 case PackedStructTy: Suffix += ".pstr"; break;
771 }
772
773 Suffix += ".s" + llvm::utostr(sNum);
774 Suffix += ".u" + llvm::utostr(uNum);
775 return AddSuffix(BaseName, Suffix);
776}
777
Reid Spencer319a7302007-01-05 17:20:02 +0000778TypeInfo& TypeInfo::operator=(const TypeInfo& that) {
779 oldTy = that.oldTy;
780 nelems = that.nelems;
781 newTy = that.newTy;
782 elemTy = that.elemTy;
783 resultTy = that.resultTy;
784 if (that.elements) {
785 elements = new TypeList(that.elements->size());
786 *elements = *that.elements;
787 } else {
788 elements = 0;
789 }
790 return *this;
791}
792
793const TypeInfo* TypeInfo::add_new_type(TypeInfo* newTy) {
794 TypeRegMap::iterator I = registry.find(newTy);
795 if (I != registry.end()) {
796 delete newTy;
797 return *I;
798 }
799 registry.insert(newTy);
800 return newTy;
Reid Spencer280d8012006-12-01 23:40:53 +0000801}
802
Reid Spencera50d5962006-12-02 04:11:07 +0000803static const char* getCastOpcode(
Reid Spencer52402b02007-01-02 05:45:11 +0000804 std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy)
Reid Spencera50d5962006-12-02 04:11:07 +0000805{
Reid Spencer52402b02007-01-02 05:45:11 +0000806 unsigned SrcBits = SrcTy->getBitWidth();
807 unsigned DstBits = DstTy->getBitWidth();
Reid Spencere77e35e2006-12-01 20:26:20 +0000808 const char* opcode = "bitcast";
809 // Run through the possibilities ...
Reid Spencer52402b02007-01-02 05:45:11 +0000810 if (DstTy->isIntegral()) { // Casting to integral
811 if (SrcTy->isIntegral()) { // Casting from integral
Reid Spencere77e35e2006-12-01 20:26:20 +0000812 if (DstBits < SrcBits)
813 opcode = "trunc";
814 else if (DstBits > SrcBits) { // its an extension
Reid Spencer52402b02007-01-02 05:45:11 +0000815 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000816 opcode ="sext"; // signed -> SEXT
817 else
818 opcode = "zext"; // unsigned -> ZEXT
819 } else {
820 opcode = "bitcast"; // Same size, No-op cast
821 }
Reid Spencer52402b02007-01-02 05:45:11 +0000822 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
823 if (DstTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000824 opcode = "fptosi"; // FP -> sint
825 else
826 opcode = "fptoui"; // FP -> uint
Reid Spencer52402b02007-01-02 05:45:11 +0000827 } else if (SrcTy->isPacked()) {
828 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000829 "Casting packed to integer of different width");
830 opcode = "bitcast"; // same size, no-op cast
831 } else {
Reid Spencer52402b02007-01-02 05:45:11 +0000832 assert(SrcTy->isPointer() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000833 "Casting from a value that is not first-class type");
834 opcode = "ptrtoint"; // ptr -> int
835 }
Reid Spencer52402b02007-01-02 05:45:11 +0000836 } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
837 if (SrcTy->isIntegral()) { // Casting from integral
838 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000839 opcode = "sitofp"; // sint -> FP
840 else
841 opcode = "uitofp"; // uint -> FP
Reid Spencer52402b02007-01-02 05:45:11 +0000842 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
Reid Spencere77e35e2006-12-01 20:26:20 +0000843 if (DstBits < SrcBits) {
844 opcode = "fptrunc"; // FP -> smaller FP
845 } else if (DstBits > SrcBits) {
846 opcode = "fpext"; // FP -> larger FP
847 } else {
848 opcode ="bitcast"; // same size, no-op cast
849 }
Reid Spencer52402b02007-01-02 05:45:11 +0000850 } else if (SrcTy->isPacked()) {
851 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000852 "Casting packed to floating point of different width");
853 opcode = "bitcast"; // same size, no-op cast
854 } else {
855 assert(0 && "Casting pointer or non-first class to float");
856 }
Reid Spencer52402b02007-01-02 05:45:11 +0000857 } else if (DstTy->isPacked()) {
858 if (SrcTy->isPacked()) {
859 assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000860 "Casting packed to packed of different widths");
861 opcode = "bitcast"; // packed -> packed
Reid Spencer52402b02007-01-02 05:45:11 +0000862 } else if (DstTy->getBitWidth() == SrcBits) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000863 opcode = "bitcast"; // float/int -> packed
864 } else {
865 assert(!"Illegal cast to packed (wrong type or size)");
866 }
Reid Spencer52402b02007-01-02 05:45:11 +0000867 } else if (DstTy->isPointer()) {
868 if (SrcTy->isPointer()) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000869 opcode = "bitcast"; // ptr -> ptr
Reid Spencer52402b02007-01-02 05:45:11 +0000870 } else if (SrcTy->isIntegral()) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000871 opcode = "inttoptr"; // int -> ptr
872 } else {
Reid Spencera50d5962006-12-02 04:11:07 +0000873 assert(!"Casting invalid type to pointer");
Reid Spencere77e35e2006-12-01 20:26:20 +0000874 }
875 } else {
876 assert(!"Casting to type that is not first-class");
877 }
878 return opcode;
879}
880
Reid Spencer319a7302007-01-05 17:20:02 +0000881static std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
882 const TypeInfo* DstTy, bool isConst)
Reid Spencera50d5962006-12-02 04:11:07 +0000883{
884 std::string Result;
885 std::string Source = Src;
Reid Spencer52402b02007-01-02 05:45:11 +0000886 if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
Reid Spencera50d5962006-12-02 04:11:07 +0000887 // fp -> ptr cast is no longer supported but we must upgrade this
888 // by doing a double cast: fp -> int -> ptr
889 if (isConst)
Reid Spencer71d2ec92006-12-31 06:02:26 +0000890 Source = "i64 fptoui(" + Source + " to i64)";
Reid Spencera50d5962006-12-02 04:11:07 +0000891 else {
Reid Spencerf459d392006-12-02 16:19:52 +0000892 *O << " %cast_upgrade" << unique << " = fptoui " << Source
Reid Spencer71d2ec92006-12-31 06:02:26 +0000893 << " to i64\n";
894 Source = "i64 %cast_upgrade" + llvm::utostr(unique);
Reid Spencera50d5962006-12-02 04:11:07 +0000895 }
896 // Update the SrcTy for the getCastOpcode call below
Reid Spencer319a7302007-01-05 17:20:02 +0000897 SrcTy = TypeInfo::get("i64", ULongTy);
Reid Spencer52402b02007-01-02 05:45:11 +0000898 } else if (DstTy->isBool()) {
899 // cast type %x to bool was previously defined as setne type %x, null
900 // The cast semantic is now to truncate, not compare so we must retain
901 // the original intent by replacing the cast with a setne
902 const char* comparator = SrcTy->isPointer() ? ", null" :
903 (SrcTy->isFloatingPoint() ? ", 0.0" :
904 (SrcTy->isBool() ? ", false" : ", 0"));
905 const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
Reid Spencer187ccf82006-12-09 16:57:22 +0000906 if (isConst) {
907 Result = "(" + Source + comparator + ")";
908 Result = compareOp + Result;
909 } else
910 Result = compareOp + Source + comparator;
Reid Spencera50d5962006-12-02 04:11:07 +0000911 return Result; // skip cast processing below
912 }
Reid Spencer319a7302007-01-05 17:20:02 +0000913 SrcTy = SrcTy->resolve();
914 DstTy = DstTy->resolve();
Reid Spencera50d5962006-12-02 04:11:07 +0000915 std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
916 if (isConst)
Reid Spencer52402b02007-01-02 05:45:11 +0000917 Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
Reid Spencera50d5962006-12-02 04:11:07 +0000918 else
Reid Spencer52402b02007-01-02 05:45:11 +0000919 Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
Reid Spencera50d5962006-12-02 04:11:07 +0000920 return Result;
921}
922
Reid Spencer319a7302007-01-05 17:20:02 +0000923const char* getDivRemOpcode(const std::string& opcode, const TypeInfo* TI) {
Reid Spencer78720742006-12-02 20:21:22 +0000924 const char* op = opcode.c_str();
Reid Spencer319a7302007-01-05 17:20:02 +0000925 const TypeInfo* Ty = TI->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +0000926 if (Ty->isPacked())
927 Ty = Ty->getElementType();
Reid Spencer78720742006-12-02 20:21:22 +0000928 if (opcode == "div")
Reid Spencer52402b02007-01-02 05:45:11 +0000929 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +0000930 op = "fdiv";
Reid Spencer52402b02007-01-02 05:45:11 +0000931 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +0000932 op = "udiv";
Reid Spencer52402b02007-01-02 05:45:11 +0000933 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +0000934 op = "sdiv";
935 else
936 yyerror("Invalid type for div instruction");
937 else if (opcode == "rem")
Reid Spencer52402b02007-01-02 05:45:11 +0000938 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +0000939 op = "frem";
Reid Spencer52402b02007-01-02 05:45:11 +0000940 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +0000941 op = "urem";
Reid Spencer52402b02007-01-02 05:45:11 +0000942 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +0000943 op = "srem";
944 else
945 yyerror("Invalid type for rem instruction");
946 return op;
947}
Reid Spencere7c3c602006-11-30 06:36:44 +0000948
Reid Spencer229e9362006-12-02 22:14:11 +0000949std::string
Reid Spencer52402b02007-01-02 05:45:11 +0000950getCompareOp(const std::string& setcc, const TypeInfo* TI) {
Reid Spencer229e9362006-12-02 22:14:11 +0000951 assert(setcc.length() == 5);
952 char cc1 = setcc[3];
953 char cc2 = setcc[4];
954 assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
955 assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
956 std::string result("xcmp xxx");
957 result[6] = cc1;
958 result[7] = cc2;
Reid Spencer52402b02007-01-02 05:45:11 +0000959 if (TI->isFloatingPoint()) {
Reid Spencer229e9362006-12-02 22:14:11 +0000960 result[0] = 'f';
Reid Spencere4d87aa2006-12-23 06:05:41 +0000961 result[5] = 'o';
Reid Spencerf0cf1322006-12-07 04:23:03 +0000962 if (cc1 == 'n')
963 result[5] = 'u'; // NE maps to unordered
964 else
965 result[5] = 'o'; // everything else maps to ordered
Reid Spencer52402b02007-01-02 05:45:11 +0000966 } else if (TI->isIntegral() || TI->isPointer()) {
Reid Spencer229e9362006-12-02 22:14:11 +0000967 result[0] = 'i';
968 if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
969 result.erase(5,1);
Reid Spencer52402b02007-01-02 05:45:11 +0000970 else if (TI->isSigned())
Reid Spencer229e9362006-12-02 22:14:11 +0000971 result[5] = 's';
Reid Spencer52402b02007-01-02 05:45:11 +0000972 else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
Reid Spencer229e9362006-12-02 22:14:11 +0000973 result[5] = 'u';
974 else
975 yyerror("Invalid integral type for setcc");
976 }
977 return result;
978}
979
Reid Spencer319a7302007-01-05 17:20:02 +0000980static const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
981 PFTy = PFTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +0000982 if (PFTy->isPointer()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000983 const TypeInfo* ElemTy = PFTy->getElementType();
984 ElemTy = ElemTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +0000985 if (ElemTy->isFunction())
Reid Spencer319a7302007-01-05 17:20:02 +0000986 return ElemTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +0000987 } else if (PFTy->isFunction()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000988 return PFTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +0000989 }
Reid Spencer319a7302007-01-05 17:20:02 +0000990 return PFTy;
Reid Spencer52402b02007-01-02 05:45:11 +0000991}
992
Reid Spencer319a7302007-01-05 17:20:02 +0000993static const TypeInfo* ResolveUpReference(const TypeInfo* Ty,
Reid Spencerf8383de2007-01-06 06:04:32 +0000994 TypeInfo::UpRefStack* stack) {
Reid Spencereff838e2007-01-03 23:45:42 +0000995 assert(Ty->isUpReference() && "Can't resolve a non-upreference");
Reid Spencer319a7302007-01-05 17:20:02 +0000996 unsigned upref = Ty->getUpRefNum();
Reid Spencereff838e2007-01-03 23:45:42 +0000997 assert(upref < stack->size() && "Invalid up reference");
998 return (*stack)[upref - stack->size() - 1];
999}
1000
Reid Spencer319a7302007-01-05 17:20:02 +00001001static const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
1002 const TypeInfo* Result = PTy = PTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001003 assert(PTy->isPointer() && "GEP Operand is not a pointer?");
Reid Spencerf8383de2007-01-06 06:04:32 +00001004 TypeInfo::UpRefStack stack;
Reid Spencereff838e2007-01-03 23:45:42 +00001005 for (unsigned i = 0; i < idxs->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00001006 if (Result->isComposite()) {
1007 Result = Result->getIndexedType((*idxs)[i]);
Reid Spencer319a7302007-01-05 17:20:02 +00001008 Result = Result->resolve();
Reid Spencereff838e2007-01-03 23:45:42 +00001009 stack.push_back(Result);
Reid Spencer52402b02007-01-02 05:45:11 +00001010 } else
1011 yyerror("Invalid type for index");
1012 }
Reid Spencereff838e2007-01-03 23:45:42 +00001013 // Resolve upreferences so we can return a more natural type
1014 if (Result->isPointer()) {
1015 if (Result->getElementType()->isUpReference()) {
1016 stack.push_back(Result);
1017 Result = ResolveUpReference(Result->getElementType(), &stack);
1018 }
1019 } else if (Result->isUpReference()) {
1020 Result = ResolveUpReference(Result->getElementType(), &stack);
1021 }
Reid Spencer52402b02007-01-02 05:45:11 +00001022 return Result->getPointerType();
1023}
1024
Reid Spencer52402b02007-01-02 05:45:11 +00001025
1026// This function handles appending .u or .s to integer value names that
1027// were previously unsigned or signed, respectively. This avoids name
1028// collisions since the unsigned and signed type planes have collapsed
1029// into a single signless type plane.
Reid Spencer319a7302007-01-05 17:20:02 +00001030static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
Reid Spencerf8383de2007-01-06 06:04:32 +00001031 bool isGlobal = false, bool isDef = false) {
Reid Spencer319a7302007-01-05 17:20:02 +00001032
Reid Spencer52402b02007-01-02 05:45:11 +00001033 // If its not a symbolic name, don't modify it, probably a constant val.
1034 if ((*Name)[0] != '%' && (*Name)[0] != '"')
1035 return *Name;
Reid Spencer319a7302007-01-05 17:20:02 +00001036
Reid Spencer52402b02007-01-02 05:45:11 +00001037 // If its a numeric reference, just leave it alone.
1038 if (isdigit((*Name)[1]))
1039 return *Name;
1040
1041 // Resolve the type
Reid Spencer319a7302007-01-05 17:20:02 +00001042 Ty = Ty->resolve();
1043
1044 // If its a global name, get its uniquified name, if any
1045 GlobalsTypeMap::iterator GI = Globals.find(*Name);
1046 if (GI != Globals.end()) {
1047 TypePlaneMap::iterator TPI = GI->second.begin();
1048 TypePlaneMap::iterator TPE = GI->second.end();
1049 for ( ; TPI != TPE ; ++TPI) {
1050 if (TPI->first->sameNewTyAs(Ty))
1051 return TPI->second;
1052 }
1053 }
1054
1055 if (isGlobal) {
1056 // We didn't find a global name, but if its supposed to be global then all
1057 // we can do is return the name. This is probably a forward reference of a
1058 // global value that hasn't been defined yet. Since we have no definition
1059 // we don't know its linkage class. Just assume its an external and the name
1060 // shouldn't change.
1061 return *Name;
1062 }
Reid Spencer52402b02007-01-02 05:45:11 +00001063
1064 // Default the result to the current name
Reid Spencerf8383de2007-01-06 06:04:32 +00001065 std::string Result = Ty->makeUniqueName(*Name);
Reid Spencer52402b02007-01-02 05:45:11 +00001066
Reid Spencer52402b02007-01-02 05:45:11 +00001067 return Result;
1068}
1069
Reid Spencer319a7302007-01-05 17:20:02 +00001070static unsigned UniqueNameCounter = 0;
Reid Spencer229e9362006-12-02 22:14:11 +00001071
Reid Spencer319a7302007-01-05 17:20:02 +00001072std::string getGlobalName(const std::string* Name, const std::string Linkage,
1073 const TypeInfo* Ty, bool isConstant) {
1074 // Default to given name
1075 std::string Result = *Name;
1076 // Look up the name in the Globals Map
1077 GlobalsTypeMap::iterator GI = Globals.find(*Name);
1078 // Did we see this global name before?
1079 if (GI != Globals.end()) {
1080 if (Ty->isUnresolvedDeep()) {
1081 // The Gval's type is unresolved. Consequently, we can't disambiguate it
1082 // by type. We'll just change its name and emit a warning.
1083 warning("Cannot disambiguate global value '" + *Name +
1084 "' because type '" + Ty->getNewTy() + "'is unresolved.\n");
1085 Result = *Name + ".unique";
1086 UniqueNameCounter++;
1087 Result += llvm::utostr(UniqueNameCounter);
1088 return Result;
1089 } else {
1090 TypePlaneMap::iterator TPI = GI->second.find(Ty);
1091 if (TPI != GI->second.end()) {
1092 // We found an existing name of the same old type. This isn't allowed
1093 // in LLVM 2.0. Consequently, we must alter the name of the global so it
1094 // can at least compile. References to the global will yield the first
1095 // definition, which is okay. We also must warn about this.
1096 Result = *Name + ".unique";
1097 UniqueNameCounter++;
1098 Result += llvm::utostr(UniqueNameCounter);
1099 warning(std::string("Global variable '") + *Name + "' was renamed to '"+
1100 Result + "'");
1101 } else {
1102 // There isn't an existing definition for this name according to the
1103 // old types. Now search the TypePlanMap for types with the same new
1104 // name.
1105 TypePlaneMap::iterator TPI = GI->second.begin();
1106 TypePlaneMap::iterator TPE = GI->second.end();
1107 for ( ; TPI != TPE; ++TPI) {
1108 if (TPI->first->sameNewTyAs(Ty)) {
1109 // The new types are the same but the old types are different so
1110 // this is a global name collision resulting from type planes
1111 // collapsing.
1112 if (Linkage == "external" || Linkage == "dllimport" ||
1113 Linkage == "extern_weak" || Linkage == "") {
1114 // The linkage of this gval is external so we can't reliably
1115 // rename it because it could potentially create a linking
1116 // problem. However, we can't leave the name conflict in the
1117 // output either or it won't assemble with LLVM 2.0. So, all we
1118 // can do is rename this one to something unique and emit a
1119 // warning about the problem.
1120 Result = *Name + ".unique";
1121 UniqueNameCounter++;
1122 Result += llvm::utostr(UniqueNameCounter);
1123 warning("Renaming global value '" + *Name + "' to '" + Result +
1124 "' may cause linkage errors.");
1125 return Result;
1126 } else {
1127 // Its linkage is internal and its type is known so we can
1128 // disambiguate the name collision successfully based on the type.
1129 Result = getUniqueName(Name, Ty);
1130 TPI->second = Result;
1131 return Result;
1132 }
1133 }
1134 }
1135 // We didn't find an entry in the type plane with the same new type and
1136 // the old types differ so this is a new type plane for this global
1137 // variable. We just fall through to the logic below which inserts
1138 // the global.
1139 }
1140 }
1141 }
1142
1143 // Its a new global name, if it is external we can't change it
1144 if (isConstant || Linkage == "external" || Linkage == "dllimport" ||
1145 Linkage == "extern_weak" || Linkage == "") {
1146 Globals[Result][Ty] = Result;
1147 return Result;
1148 }
1149
1150 // Its a new global name, and it is internal, change the name to make it
1151 // unique for its type.
1152 // Result = getUniqueName(Name, Ty);
1153 Globals[*Name][Ty] = Result;
1154 return Result;
1155}
1156
1157
1158/* Enabling traces. */
1159#ifndef YYDEBUG
1160# define YYDEBUG 0
1161#endif
1162
1163/* Enabling verbose error messages. */
1164#ifdef YYERROR_VERBOSE
1165# undef YYERROR_VERBOSE
1166# define YYERROR_VERBOSE 1
1167#else
1168# define YYERROR_VERBOSE 0
1169#endif
1170
1171/* Enabling the token table. */
1172#ifndef YYTOKEN_TABLE
1173# define YYTOKEN_TABLE 0
1174#endif
1175
1176#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
Reid Spencer609ca3e2007-01-12 20:10:51 +00001177#line 802 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00001178typedef union YYSTYPE {
Reid Spencere77e35e2006-12-01 20:26:20 +00001179 std::string* String;
Reid Spencer319a7302007-01-05 17:20:02 +00001180 const TypeInfo* Type;
Reid Spencere77e35e2006-12-01 20:26:20 +00001181 ValueInfo Value;
1182 ConstInfo Const;
Reid Spencerf8483652006-12-02 15:16:01 +00001183 ValueList* ValList;
Reid Spencer52402b02007-01-02 05:45:11 +00001184 TypeList* TypeVec;
Reid Spencere77e35e2006-12-01 20:26:20 +00001185} YYSTYPE;
Reid Spencer319a7302007-01-05 17:20:02 +00001186/* Line 196 of yacc.c. */
Reid Spencerf8383de2007-01-06 06:04:32 +00001187#line 1188 "UpgradeParser.tab.c"
Reid Spencer319a7302007-01-05 17:20:02 +00001188# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1189# define YYSTYPE_IS_DECLARED 1
1190# define YYSTYPE_IS_TRIVIAL 1
Reid Spencere7c3c602006-11-30 06:36:44 +00001191#endif
1192
1193
1194
Reid Spencer319a7302007-01-05 17:20:02 +00001195/* Copy the second part of user declarations. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001196
1197
Reid Spencer319a7302007-01-05 17:20:02 +00001198/* Line 219 of yacc.c. */
Reid Spencerf8383de2007-01-06 06:04:32 +00001199#line 1200 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00001200
Reid Spencer319a7302007-01-05 17:20:02 +00001201#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1202# define YYSIZE_T __SIZE_TYPE__
1203#endif
1204#if ! defined (YYSIZE_T) && defined (size_t)
1205# define YYSIZE_T size_t
1206#endif
1207#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1208# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1209# define YYSIZE_T size_t
1210#endif
1211#if ! defined (YYSIZE_T)
1212# define YYSIZE_T unsigned int
1213#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001214
Reid Spencer319a7302007-01-05 17:20:02 +00001215#ifndef YY_
1216# if YYENABLE_NLS
1217# if ENABLE_NLS
1218# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1219# define YY_(msgid) dgettext ("bison-runtime", msgid)
1220# endif
1221# endif
1222# ifndef YY_
1223# define YY_(msgid) msgid
1224# endif
1225#endif
1226
1227#if ! defined (yyoverflow) || YYERROR_VERBOSE
1228
1229/* The parser invokes alloca or malloc; define the necessary symbols. */
1230
1231# ifdef YYSTACK_USE_ALLOCA
1232# if YYSTACK_USE_ALLOCA
1233# ifdef __GNUC__
1234# define YYSTACK_ALLOC __builtin_alloca
1235# else
1236# define YYSTACK_ALLOC alloca
1237# if defined (__STDC__) || defined (__cplusplus)
1238# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1239# define YYINCLUDED_STDLIB_H
1240# endif
1241# endif
1242# endif
1243# endif
1244
1245# ifdef YYSTACK_ALLOC
1246 /* Pacify GCC's `empty if-body' warning. */
1247# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1248# ifndef YYSTACK_ALLOC_MAXIMUM
1249 /* The OS might guarantee only one guard page at the bottom of the stack,
1250 and a page size can be as small as 4096 bytes. So we cannot safely
1251 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1252 to allow for a few compiler-allocated temporary stack slots. */
1253# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1254# endif
1255# else
1256# define YYSTACK_ALLOC YYMALLOC
1257# define YYSTACK_FREE YYFREE
1258# ifndef YYSTACK_ALLOC_MAXIMUM
1259# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1260# endif
1261# ifdef __cplusplus
1262extern "C" {
1263# endif
1264# ifndef YYMALLOC
1265# define YYMALLOC malloc
1266# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1267 && (defined (__STDC__) || defined (__cplusplus)))
1268void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1269# endif
1270# endif
1271# ifndef YYFREE
1272# define YYFREE free
1273# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1274 && (defined (__STDC__) || defined (__cplusplus)))
1275void free (void *); /* INFRINGES ON USER NAME SPACE */
1276# endif
1277# endif
1278# ifdef __cplusplus
1279}
1280# endif
1281# endif
1282#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1283
1284
1285#if (! defined (yyoverflow) \
1286 && (! defined (__cplusplus) \
1287 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1288
1289/* A type that is properly aligned for any stack member. */
1290union yyalloc
1291{
1292 short int yyss;
1293 YYSTYPE yyvs;
1294 };
1295
1296/* The size of the maximum gap between one aligned stack and the next. */
1297# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1298
1299/* The size of an array large to enough to hold all stacks, each with
1300 N elements. */
1301# define YYSTACK_BYTES(N) \
1302 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1303 + YYSTACK_GAP_MAXIMUM)
1304
1305/* Copy COUNT objects from FROM to TO. The source and destination do
1306 not overlap. */
1307# ifndef YYCOPY
1308# if defined (__GNUC__) && 1 < __GNUC__
1309# define YYCOPY(To, From, Count) \
1310 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1311# else
1312# define YYCOPY(To, From, Count) \
1313 do \
1314 { \
1315 YYSIZE_T yyi; \
1316 for (yyi = 0; yyi < (Count); yyi++) \
1317 (To)[yyi] = (From)[yyi]; \
1318 } \
1319 while (0)
1320# endif
1321# endif
1322
1323/* Relocate STACK from its old location to the new one. The
1324 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1325 elements in the stack, and YYPTR gives the new location of the
1326 stack. Advance YYPTR to a properly aligned location for the next
1327 stack. */
1328# define YYSTACK_RELOCATE(Stack) \
1329 do \
1330 { \
1331 YYSIZE_T yynewbytes; \
1332 YYCOPY (&yyptr->Stack, Stack, yysize); \
1333 Stack = &yyptr->Stack; \
1334 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1335 yyptr += yynewbytes / sizeof (*yyptr); \
1336 } \
1337 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00001338
1339#endif
1340
Reid Spencer319a7302007-01-05 17:20:02 +00001341#if defined (__STDC__) || defined (__cplusplus)
1342 typedef signed char yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001343#else
Reid Spencer319a7302007-01-05 17:20:02 +00001344 typedef short int yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001345#endif
1346
Reid Spencer319a7302007-01-05 17:20:02 +00001347/* YYFINAL -- State number of the termination state. */
1348#define YYFINAL 4
1349/* YYLAST -- Last index in YYTABLE. */
Reid Spencer609ca3e2007-01-12 20:10:51 +00001350#define YYLAST 1463
Reid Spencer319a7302007-01-05 17:20:02 +00001351
1352/* YYNTOKENS -- Number of terminals. */
1353#define YYNTOKENS 165
1354/* YYNNTS -- Number of nonterminals. */
1355#define YYNNTS 75
1356/* YYNRULES -- Number of rules. */
Reid Spencer609ca3e2007-01-12 20:10:51 +00001357#define YYNRULES 300
Reid Spencer319a7302007-01-05 17:20:02 +00001358/* YYNRULES -- Number of states. */
Reid Spencer609ca3e2007-01-12 20:10:51 +00001359#define YYNSTATES 584
Reid Spencer319a7302007-01-05 17:20:02 +00001360
1361/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1362#define YYUNDEFTOK 2
1363#define YYMAXUTOK 405
1364
1365#define YYTRANSLATE(YYX) \
1366 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1367
1368/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1369static const unsigned char yytranslate[] =
1370{
1371 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1372 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1373 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1375 154, 155, 163, 2, 152, 2, 2, 2, 2, 2,
1376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1377 159, 151, 160, 2, 2, 2, 2, 2, 2, 2,
1378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1380 2, 156, 153, 158, 2, 2, 2, 2, 2, 164,
1381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1383 157, 2, 2, 161, 2, 162, 2, 2, 2, 2,
1384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1396 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1397 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1398 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1399 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1400 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1401 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1402 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1403 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1404 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1405 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1406 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1407 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1408 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1409 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1410 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1411 145, 146, 147, 148, 149, 150
1412};
1413
1414#if YYDEBUG
1415/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1416 YYRHS. */
1417static const unsigned short int yyprhs[] =
1418{
1419 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1420 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1421 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1422 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1423 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1424 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1425 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1426 139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1427 159, 161, 164, 165, 167, 169, 171, 173, 175, 177,
1428 179, 180, 182, 184, 186, 188, 190, 192, 195, 196,
1429 197, 200, 201, 205, 208, 209, 211, 212, 216, 218,
1430 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1431 241, 243, 245, 247, 249, 251, 253, 255, 257, 259,
1432 261, 264, 269, 275, 281, 285, 288, 294, 299, 302,
1433 304, 308, 310, 314, 316, 317, 322, 326, 330, 335,
1434 340, 344, 347, 350, 353, 356, 359, 362, 365, 368,
1435 371, 374, 381, 387, 396, 403, 410, 417, 425, 433,
1436 440, 447, 456, 465, 469, 471, 473, 475, 477, 480,
1437 483, 488, 491, 493, 495, 497, 502, 505, 510, 517,
1438 524, 531, 538, 542, 547, 548, 550, 552, 554, 558,
1439 562, 566, 570, 574, 578, 580, 581, 583, 585, 587,
1440 588, 591, 595, 597, 599, 603, 605, 606, 615, 617,
1441 619, 623, 625, 627, 631, 632, 634, 636, 640, 641,
1442 643, 645, 647, 649, 651, 653, 655, 657, 659, 663,
1443 665, 671, 673, 675, 677, 679, 682, 685, 687, 690,
1444 693, 694, 696, 698, 700, 703, 706, 710, 720, 730,
1445 739, 754, 756, 758, 765, 771, 774, 781, 789, 791,
1446 795, 797, 798, 801, 803, 809, 815, 821, 828, 835,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001447 840, 845, 852, 857, 862, 869, 876, 879, 887, 889,
1448 892, 893, 895, 896, 900, 907, 911, 918, 921, 926,
1449 933
Reid Spencer319a7302007-01-05 17:20:02 +00001450};
1451
1452/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1453static const short int yyrhs[] =
1454{
1455 199, 0, -1, 19, -1, 20, -1, 17, -1, 18,
1456 -1, 80, -1, 81, -1, 82, -1, 83, -1, 84,
1457 -1, 85, -1, 86, -1, 87, -1, 88, -1, 89,
1458 -1, 90, -1, 91, -1, 92, -1, 93, -1, 94,
1459 -1, 95, -1, 96, -1, 97, -1, 98, -1, 99,
1460 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1461 -1, 107, -1, 118, -1, 119, -1, 120, -1, 121,
1462 -1, 108, -1, 109, -1, 110, -1, 111, -1, 112,
1463 -1, 113, -1, 114, -1, 115, -1, 116, -1, 117,
1464 -1, 118, -1, 119, -1, 120, -1, 121, -1, 25,
1465 -1, 26, -1, 130, -1, 131, -1, 132, -1, 133,
1466 -1, 139, -1, 140, -1, 141, -1, 142, -1, 143,
1467 -1, 144, -1, 145, -1, 146, -1, 147, -1, 148,
1468 -1, 149, -1, 150, -1, 138, -1, 11, -1, 9,
1469 -1, 7, -1, 5, -1, 12, -1, 10, -1, 8,
1470 -1, 6, -1, 175, -1, 176, -1, 13, -1, 14,
1471 -1, 208, 151, -1, -1, 42, -1, 43, -1, 44,
1472 -1, 48, -1, 45, -1, 46, -1, 47, -1, -1,
1473 66, -1, 67, -1, 68, -1, 69, -1, 70, -1,
1474 71, -1, 65, 18, -1, -1, -1, 57, 18, -1,
1475 -1, 152, 57, 18, -1, 37, 30, -1, -1, 184,
1476 -1, -1, 152, 187, 186, -1, 184, -1, 57, 18,
1477 -1, 190, -1, 3, -1, 192, -1, 3, -1, 192,
1478 -1, 4, -1, 5, -1, 6, -1, 7, -1, 8,
1479 -1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
1480 -1, 14, -1, 15, -1, 16, -1, 222, -1, 191,
1481 -1, 153, 18, -1, 189, 154, 194, 155, -1, 156,
1482 18, 157, 192, 158, -1, 159, 18, 157, 192, 160,
1483 -1, 161, 193, 162, -1, 161, 162, -1, 159, 161,
1484 193, 162, 160, -1, 159, 161, 162, 160, -1, 192,
1485 163, -1, 192, -1, 193, 152, 192, -1, 193, -1,
1486 193, 152, 40, -1, 40, -1, -1, 190, 156, 197,
1487 158, -1, 190, 156, 158, -1, 190, 164, 30, -1,
1488 190, 159, 197, 160, -1, 190, 161, 197, 162, -1,
1489 190, 161, 162, -1, 190, 22, -1, 190, 23, -1,
1490 190, 222, -1, 190, 196, -1, 190, 24, -1, 175,
1491 167, -1, 176, 167, -1, 4, 25, -1, 4, 26,
1492 -1, 178, 21, -1, 174, 154, 195, 39, 190, 155,
1493 -1, 127, 154, 195, 237, 155, -1, 129, 154, 195,
1494 152, 195, 152, 195, 155, -1, 168, 154, 195, 152,
1495 195, 155, -1, 169, 154, 195, 152, 195, 155, -1,
1496 170, 154, 195, 152, 195, 155, -1, 100, 171, 154,
1497 195, 152, 195, 155, -1, 101, 172, 154, 195, 152,
1498 195, 155, -1, 173, 154, 195, 152, 195, 155, -1,
1499 135, 154, 195, 152, 195, 155, -1, 136, 154, 195,
1500 152, 195, 152, 195, 155, -1, 137, 154, 195, 152,
1501 195, 152, 195, 155, -1, 197, 152, 195, -1, 195,
1502 -1, 35, -1, 36, -1, 200, -1, 200, 217, -1,
1503 200, 219, -1, 200, 63, 62, 203, -1, 200, 31,
1504 -1, 202, -1, 50, -1, 58, -1, 202, 179, 27,
1505 188, -1, 202, 219, -1, 202, 63, 62, 203, -1,
1506 202, 179, 180, 198, 195, 186, -1, 202, 179, 201,
1507 198, 190, 186, -1, 202, 179, 45, 198, 190, 186,
1508 -1, 202, 179, 47, 198, 190, 186, -1, 202, 51,
1509 205, -1, 202, 59, 151, 206, -1, -1, 30, -1,
1510 56, -1, 55, -1, 53, 151, 204, -1, 54, 151,
1511 18, -1, 52, 151, 30, -1, 72, 151, 30, -1,
1512 156, 207, 158, -1, 207, 152, 30, -1, 30, -1,
1513 -1, 28, -1, 30, -1, 208, -1, -1, 190, 209,
1514 -1, 211, 152, 210, -1, 210, -1, 211, -1, 211,
1515 152, 40, -1, 40, -1, -1, 181, 188, 208, 154,
1516 212, 155, 185, 182, -1, 32, -1, 161, -1, 180,
1517 213, 214, -1, 33, -1, 162, -1, 215, 225, 216,
1518 -1, -1, 45, -1, 47, -1, 34, 218, 213, -1,
1519 -1, 64, -1, 17, -1, 18, -1, 21, -1, 25,
1520 -1, 26, -1, 22, -1, 23, -1, 24, -1, 159,
1521 197, 160, -1, 196, -1, 62, 220, 30, 152, 30,
1522 -1, 166, -1, 208, -1, 222, -1, 221, -1, 190,
1523 223, -1, 225, 226, -1, 226, -1, 227, 229, -1,
1524 227, 231, -1, -1, 29, -1, 78, -1, 77, -1,
1525 73, 224, -1, 73, 3, -1, 74, 15, 223, -1,
1526 74, 4, 223, 152, 15, 223, 152, 15, 223, -1,
1527 75, 177, 223, 152, 15, 223, 156, 230, 158, -1,
1528 75, 177, 223, 152, 15, 223, 156, 158, -1, 179,
1529 76, 181, 188, 223, 154, 234, 155, 39, 15, 223,
1530 228, 15, 223, -1, 228, -1, 79, -1, 230, 177,
1531 221, 152, 15, 223, -1, 177, 221, 152, 15, 223,
1532 -1, 179, 236, -1, 190, 156, 223, 152, 223, 158,
1533 -1, 232, 152, 156, 223, 152, 223, 158, -1, 224,
1534 -1, 233, 152, 224, -1, 233, -1, -1, 61, 60,
1535 -1, 60, -1, 168, 190, 223, 152, 223, -1, 169,
1536 190, 223, 152, 223, -1, 170, 190, 223, 152, 223,
1537 -1, 100, 171, 190, 223, 152, 223, -1, 101, 172,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001538 190, 223, 152, 223, -1, 173, 224, 152, 224, -1,
1539 174, 224, 39, 190, -1, 129, 224, 152, 224, 152,
1540 224, -1, 134, 224, 152, 190, -1, 135, 224, 152,
1541 224, -1, 136, 224, 152, 224, 152, 224, -1, 137,
1542 224, 152, 224, 152, 224, -1, 128, 232, -1, 235,
1543 181, 188, 223, 154, 234, 155, -1, 239, -1, 152,
1544 233, -1, -1, 38, -1, -1, 122, 190, 183, -1,
1545 122, 190, 152, 10, 223, 183, -1, 123, 190, 183,
1546 -1, 123, 190, 152, 10, 223, 183, -1, 124, 224,
1547 -1, 238, 125, 190, 223, -1, 238, 126, 224, 152,
1548 190, 223, -1, 127, 190, 223, 237, -1
Reid Spencer319a7302007-01-05 17:20:02 +00001549};
1550
1551/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1552static const unsigned short int yyrline[] =
1553{
Reid Spencerf8383de2007-01-06 06:04:32 +00001554 0, 867, 867, 867, 868, 868, 872, 872, 872, 872,
1555 872, 872, 872, 873, 873, 873, 873, 874, 874, 874,
1556 875, 875, 875, 875, 875, 875, 876, 876, 876, 876,
1557 876, 876, 876, 876, 876, 876, 877, 877, 877, 877,
1558 877, 877, 877, 877, 877, 877, 878, 878, 878, 878,
1559 878, 878, 879, 879, 879, 879, 880, 880, 880, 880,
1560 880, 880, 880, 881, 881, 881, 881, 881, 881, 886,
1561 886, 886, 886, 887, 887, 887, 887, 888, 888, 889,
1562 889, 892, 895, 900, 900, 900, 900, 900, 900, 901,
1563 902, 905, 905, 905, 905, 905, 906, 907, 912, 917,
1564 918, 921, 922, 930, 936, 937, 940, 941, 950, 951,
1565 964, 964, 965, 965, 966, 970, 970, 970, 970, 970,
1566 970, 970, 971, 971, 971, 971, 971, 973, 976, 979,
1567 982, 986, 999, 1005, 1011, 1021, 1024, 1034, 1037, 1045,
1568 1049, 1056, 1057, 1062, 1067, 1077, 1083, 1088, 1094, 1100,
1569 1106, 1111, 1117, 1123, 1130, 1136, 1142, 1148, 1154, 1160,
1570 1166, 1174, 1188, 1200, 1205, 1211, 1216, 1222, 1227, 1232,
1571 1240, 1245, 1250, 1260, 1265, 1270, 1270, 1280, 1285, 1288,
1572 1293, 1297, 1301, 1303, 1303, 1306, 1316, 1321, 1326, 1336,
1573 1346, 1356, 1366, 1371, 1376, 1381, 1383, 1383, 1386, 1391,
1574 1398, 1403, 1410, 1417, 1422, 1423, 1431, 1431, 1432, 1432,
1575 1434, 1443, 1447, 1451, 1454, 1459, 1462, 1465, 1483, 1484,
1576 1487, 1498, 1499, 1501, 1510, 1511, 1512, 1516, 1529, 1530,
1577 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1534, 1535, 1540,
1578 1541, 1550, 1550, 1554, 1559, 1569, 1578, 1581, 1589, 1593,
1579 1598, 1601, 1607, 1607, 1609, 1614, 1619, 1624, 1632, 1640,
1580 1647, 1669, 1674, 1680, 1686, 1694, 1712, 1720, 1729, 1733,
1581 1740, 1741, 1745, 1750, 1753, 1762, 1770, 1779, 1787, 1795,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001582 1804, 1832, 1838, 1844, 1851, 1857, 1863, 1869, 1897, 1902,
1583 1903, 1907, 1908, 1911, 1919, 1928, 1936, 1945, 1951, 1960,
1584 1969
Reid Spencer319a7302007-01-05 17:20:02 +00001585};
1586#endif
1587
1588#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1589/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1590 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1591static const char *const yytname[] =
1592{
1593 "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE",
1594 "SHORT", "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE",
1595 "LABEL", "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL",
1596 "FPVAL", "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK",
1597 "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1598 "BEGINTOK", "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION",
1599 "VOLATILE", "TO", "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK",
1600 "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "NOT", "EXTERNAL",
1601 "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN",
1602 "UNINITIALIZED", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1603 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1604 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1605 "RET", "BR", "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE",
1606 "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM",
1607 "SREM", "FREM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT",
1608 "SETEQ", "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1609 "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE",
1610 "ULT", "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1611 "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR",
1612 "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST",
1613 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI",
1614 "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','",
1615 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1616 "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps",
1617 "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps",
1618 "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1619 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString",
1620 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV",
1621 "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
1622 "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1623 "Module", "DefinitionList", "External", "ConstPool", "AsmBlock",
1624 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1625 "Name", "OptName", "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH",
1626 "BEGIN", "FunctionHeader", "END", "Function", "FnDeclareLinkage",
1627 "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef",
1628 "ValueRef", "ResolvedVal", "BasicBlockList", "BasicBlock",
1629 "InstructionList", "Unwind", "BBTerminatorInst", "JumpTable", "Inst",
1630 "PHIList", "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal",
1631 "IndexList", "OptVolatile", "MemoryInst", 0
1632};
1633#endif
1634
1635# ifdef YYPRINT
1636/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1637 token YYLEX-NUM. */
1638static const unsigned short int yytoknum[] =
1639{
1640 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1641 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1642 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1643 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1644 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1645 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1646 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1647 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1648 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1649 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1650 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1651 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1652 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1653 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1654 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1655 405, 61, 44, 92, 40, 41, 91, 120, 93, 60,
1656 62, 123, 125, 42, 99
1657};
1658# endif
1659
1660/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1661static const unsigned char yyr1[] =
1662{
1663 0, 165, 166, 166, 167, 167, 168, 168, 168, 168,
1664 168, 168, 168, 168, 168, 168, 168, 169, 169, 169,
1665 170, 170, 170, 170, 170, 170, 171, 171, 171, 171,
1666 171, 171, 171, 171, 171, 171, 172, 172, 172, 172,
1667 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
1668 172, 172, 173, 173, 173, 173, 174, 174, 174, 174,
1669 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
1670 175, 175, 175, 176, 176, 176, 176, 177, 177, 178,
1671 178, 179, 179, 180, 180, 180, 180, 180, 180, 180,
1672 180, 181, 181, 181, 181, 181, 181, 181, 181, 182,
1673 182, 183, 183, 184, 185, 185, 186, 186, 187, 187,
1674 188, 188, 189, 189, 190, 191, 191, 191, 191, 191,
1675 191, 191, 191, 191, 191, 191, 191, 192, 192, 192,
1676 192, 192, 192, 192, 192, 192, 192, 192, 192, 193,
1677 193, 194, 194, 194, 194, 195, 195, 195, 195, 195,
1678 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1679 195, 196, 196, 196, 196, 196, 196, 196, 196, 196,
1680 196, 196, 196, 197, 197, 198, 198, 199, 200, 200,
1681 200, 200, 200, 201, 201, 202, 202, 202, 202, 202,
1682 202, 202, 202, 202, 202, 203, 204, 204, 205, 205,
1683 205, 205, 206, 207, 207, 207, 208, 208, 209, 209,
1684 210, 211, 211, 212, 212, 212, 212, 213, 214, 214,
1685 215, 216, 216, 217, 218, 218, 218, 219, 220, 220,
1686 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
1687 221, 222, 222, 223, 223, 224, 225, 225, 226, 227,
1688 227, 227, 228, 228, 229, 229, 229, 229, 229, 229,
1689 229, 229, 229, 230, 230, 231, 232, 232, 233, 233,
1690 234, 234, 235, 235, 236, 236, 236, 236, 236, 236,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001691 236, 236, 236, 236, 236, 236, 236, 236, 236, 237,
1692 237, 238, 238, 239, 239, 239, 239, 239, 239, 239,
1693 239
Reid Spencer319a7302007-01-05 17:20:02 +00001694};
1695
1696/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1697static const unsigned char yyr2[] =
1698{
1699 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1700 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1701 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1702 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1703 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1704 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1705 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1706 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1707 1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1708 0, 1, 1, 1, 1, 1, 1, 2, 0, 0,
1709 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1710 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1711 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1712 2, 4, 5, 5, 3, 2, 5, 4, 2, 1,
1713 3, 1, 3, 1, 0, 4, 3, 3, 4, 4,
1714 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1715 2, 6, 5, 8, 6, 6, 6, 7, 7, 6,
1716 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1717 4, 2, 1, 1, 1, 4, 2, 4, 6, 6,
1718 6, 6, 3, 4, 0, 1, 1, 1, 3, 3,
1719 3, 3, 3, 3, 1, 0, 1, 1, 1, 0,
1720 2, 3, 1, 1, 3, 1, 0, 8, 1, 1,
1721 3, 1, 1, 3, 0, 1, 1, 3, 0, 1,
1722 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1723 5, 1, 1, 1, 1, 2, 2, 1, 2, 2,
1724 0, 1, 1, 1, 2, 2, 3, 9, 9, 8,
1725 14, 1, 1, 6, 5, 2, 6, 7, 1, 3,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001726 1, 0, 2, 1, 5, 5, 5, 6, 6, 4,
1727 4, 6, 4, 4, 6, 6, 2, 7, 1, 2,
1728 0, 1, 0, 3, 6, 3, 6, 2, 4, 6,
1729 4
Reid Spencer319a7302007-01-05 17:20:02 +00001730};
1731
1732/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1733 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1734 means the default is an error. */
1735static const unsigned short int yydefact[] =
1736{
1737 194, 0, 90, 182, 1, 181, 224, 83, 84, 85,
1738 87, 88, 89, 86, 0, 98, 250, 178, 179, 206,
1739 207, 0, 0, 0, 90, 0, 186, 225, 226, 98,
1740 0, 0, 91, 92, 93, 94, 95, 96, 0, 0,
1741 251, 250, 247, 82, 0, 0, 0, 0, 192, 0,
1742 0, 0, 0, 0, 183, 184, 0, 0, 81, 227,
1743 195, 180, 97, 111, 115, 116, 117, 118, 119, 120,
1744 121, 122, 123, 124, 125, 126, 127, 2, 3, 0,
1745 0, 0, 0, 241, 0, 0, 110, 129, 114, 242,
1746 128, 218, 219, 220, 221, 222, 223, 246, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001747 0, 253, 252, 262, 292, 261, 248, 249, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001748 0, 0, 205, 193, 187, 185, 175, 176, 0, 0,
1749 0, 0, 130, 0, 0, 0, 113, 135, 139, 0,
1750 0, 144, 138, 255, 0, 254, 0, 0, 72, 76,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001751 71, 75, 70, 74, 69, 73, 77, 78, 0, 291,
1752 273, 0, 98, 6, 7, 8, 9, 10, 11, 12,
1753 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
1754 23, 24, 25, 0, 0, 0, 0, 0, 0, 0,
1755 0, 52, 53, 54, 55, 0, 0, 0, 0, 68,
1756 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
1757 66, 67, 0, 0, 0, 0, 0, 98, 265, 0,
1758 288, 200, 197, 196, 198, 199, 201, 204, 0, 106,
1759 106, 115, 116, 117, 118, 119, 120, 121, 122, 123,
1760 124, 125, 0, 0, 0, 0, 106, 106, 0, 0,
1761 0, 0, 0, 134, 216, 143, 141, 0, 230, 231,
1762 232, 235, 236, 237, 233, 234, 228, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001763 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001764 239, 244, 243, 245, 0, 256, 0, 272, 0, 26,
1765 27, 28, 29, 30, 31, 32, 33, 34, 35, 0,
1766 50, 51, 36, 37, 38, 39, 40, 41, 42, 43,
1767 44, 45, 46, 47, 48, 49, 0, 101, 101, 297,
1768 0, 0, 286, 0, 0, 0, 0, 0, 0, 0,
1769 0, 0, 0, 0, 0, 0, 0, 202, 0, 190,
1770 191, 158, 159, 4, 5, 156, 157, 160, 151, 152,
1771 155, 0, 0, 0, 0, 154, 153, 188, 189, 112,
1772 112, 137, 0, 140, 215, 209, 212, 213, 0, 0,
1773 131, 229, 0, 0, 0, 0, 0, 0, 0, 0,
1774 174, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1775 0, 0, 0, 293, 0, 295, 290, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001776 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001777 0, 0, 203, 0, 0, 108, 106, 146, 0, 0,
1778 150, 0, 147, 132, 133, 136, 208, 210, 0, 104,
1779 142, 0, 0, 0, 290, 0, 0, 0, 0, 0,
1780 238, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1781 0, 0, 0, 0, 0, 300, 0, 0, 0, 282,
1782 283, 0, 0, 0, 0, 0, 279, 280, 0, 298,
1783 0, 103, 109, 107, 145, 148, 149, 214, 211, 105,
1784 99, 0, 0, 0, 0, 0, 0, 0, 0, 173,
1785 0, 0, 0, 0, 0, 0, 0, 271, 0, 0,
1786 101, 102, 101, 268, 289, 0, 0, 0, 0, 0,
1787 274, 275, 276, 271, 0, 0, 217, 240, 0, 0,
1788 162, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1789 0, 0, 270, 0, 277, 278, 0, 294, 296, 0,
1790 0, 0, 281, 284, 285, 0, 299, 100, 0, 0,
1791 0, 170, 0, 0, 164, 165, 166, 169, 161, 0,
1792 259, 0, 0, 0, 269, 266, 0, 287, 167, 168,
1793 0, 0, 0, 257, 0, 258, 0, 0, 267, 163,
1794 171, 172, 0, 0, 0, 0, 0, 0, 264, 0,
1795 0, 263, 0, 260
Reid Spencer319a7302007-01-05 17:20:02 +00001796};
1797
1798/* YYDEFGOTO[NTERM-NUM]. */
1799static const short int yydefgoto[] =
1800{
Reid Spencer609ca3e2007-01-12 20:10:51 +00001801 -1, 83, 335, 265, 266, 267, 289, 306, 268, 269,
1802 232, 233, 148, 234, 24, 15, 38, 506, 383, 405,
1803 470, 329, 406, 84, 85, 235, 87, 88, 129, 247,
1804 370, 270, 371, 118, 1, 2, 57, 3, 61, 214,
1805 48, 113, 218, 89, 417, 356, 357, 358, 39, 93,
1806 16, 96, 17, 29, 18, 362, 271, 90, 273, 493,
1807 41, 42, 43, 105, 106, 552, 107, 312, 522, 523,
1808 207, 208, 445, 209, 210
Reid Spencer319a7302007-01-05 17:20:02 +00001809};
1810
1811/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1812 STATE-NUM. */
Reid Spencer609ca3e2007-01-12 20:10:51 +00001813#define YYPACT_NINF -509
Reid Spencer319a7302007-01-05 17:20:02 +00001814static const short int yypact[] =
1815{
Reid Spencer609ca3e2007-01-12 20:10:51 +00001816 -509, 53, 152, 539, -509, -509, 46, -509, -509, -509,
1817 -509, -509, -509, -509, 5, 56, 55, -509, -509, -509,
1818 -509, -4, -81, 26, 134, -16, -509, -509, -509, 56,
1819 113, 128, -509, -509, -509, -509, -509, -509, 830, -25,
1820 -509, -18, -509, -1, 11, 40, 42, 54, -509, 33,
1821 113, 830, 96, 96, -509, -509, 96, 96, -509, -509,
1822 -509, -509, -509, 62, -509, -509, -509, -509, -509, -509,
1823 -509, -509, -509, -509, -509, -509, -509, -509, -509, 223,
1824 225, -10, 100, -509, 145, 77, -509, -509, -108, -509,
1825 -509, -509, -509, -509, -509, -509, -509, -509, 869, 41,
1826 148, -509, -509, -509, 1313, -509, -509, -509, 219, 153,
1827 234, 237, 250, -509, -509, -509, -509, -509, 898, 898,
1828 936, 898, -509, 98, 103, 504, -509, -509, -108, -100,
1829 122, 214, -509, 62, 1128, -509, 1128, 1128, -509, -509,
1830 -509, -509, -509, -509, -509, -509, -509, -509, 1128, -509,
1831 -509, 224, 56, -509, -509, -509, -509, -509, -509, -509,
1832 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
1833 -509, -509, -509, 193, 535, 898, 898, 898, 898, 898,
1834 898, -509, -509, -509, -509, 898, 898, 898, 898, -509,
1835 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
1836 -509, -509, 898, 898, 898, 898, 898, 56, -509, 110,
1837 -509, -509, -509, -509, -509, -509, -509, -509, -57, 138,
1838 138, 213, 228, 230, 240, 246, 248, 252, 254, 261,
1839 271, 281, 265, 265, 285, 980, 138, 138, 898, 898,
1840 150, -87, 898, -509, 671, -509, 156, 163, -509, -509,
1841 -509, -509, -509, -509, -509, -509, 255, 193, 535, 166,
1842 167, 168, 169, 170, 936, 171, 172, 173, 174, 175,
1843 -509, -509, -509, -509, 180, -509, 181, -509, 830, -509,
1844 -509, -509, -509, -509, -509, -509, -509, -509, -509, 898,
1845 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
1846 -509, -509, -509, -509, -509, -509, 898, 182, 184, -509,
1847 1128, 183, 186, 188, 190, 191, 192, 194, 1128, 1128,
1848 1128, 198, 306, 830, 898, 898, 327, -509, 4, -509,
1849 -509, -509, -509, -509, -509, -509, -509, -509, -509, -509,
1850 -509, 709, 936, 612, 328, -509, -509, -509, -509, -92,
1851 -109, -509, 201, -108, -509, 145, -509, 210, 208, 739,
1852 -509, -509, 334, 212, 215, 936, 936, 936, 936, 936,
1853 -509, -70, 936, 936, 936, 936, 936, 350, 353, 1128,
1854 1128, 1128, 2, -509, 30, -509, 220, 1128, 218, 898,
1855 898, 898, 898, 898, 227, 229, 233, 898, 898, 1128,
1856 1128, 235, -509, 341, 368, -509, 138, -509, -56, -66,
1857 -509, -83, -509, -509, -509, -509, -509, -509, 777, 351,
1858 -509, 238, 936, 936, 220, 239, 241, 242, 243, 936,
1859 -509, 247, 249, 251, 253, 361, 1128, 1128, 258, 256,
1860 262, 1128, 374, 1128, 898, -509, 263, 1128, 264, -509,
1861 -509, 266, 267, 1128, 1128, 1128, -509, -509, 259, -509,
1862 898, -509, -509, -509, -509, -509, -509, -509, -509, -509,
1863 345, 377, 268, 269, 272, 936, 936, 936, 936, -509,
1864 936, 936, 936, 936, 898, 274, 273, 898, 1128, 1128,
1865 276, -509, 276, -509, 278, 1128, 279, 898, 898, 898,
1866 -509, -509, -509, 898, 1128, 386, -509, -509, 936, 936,
1867 -509, 280, 282, 283, 284, 287, 290, 292, 293, 298,
1868 402, 14, 278, 301, -509, -509, 382, -509, -509, 898,
1869 299, 1128, -509, -509, -509, 303, -509, -509, 307, 308,
1870 936, -509, 936, 936, -509, -509, -509, -509, -509, 1128,
1871 -509, 1217, 27, 425, -509, -509, 309, -509, -509, -509,
1872 311, 315, 316, -509, 320, -509, 1217, 459, -509, -509,
1873 -509, -509, 460, 325, 1128, 1128, 463, 211, -509, 1128,
1874 464, -509, 1128, -509
Reid Spencer319a7302007-01-05 17:20:02 +00001875};
1876
1877/* YYPGOTO[NTERM-NUM]. */
1878static const short int yypgoto[] =
1879{
Reid Spencer609ca3e2007-01-12 20:10:51 +00001880 -509, -509, 257, 376, 378, 379, 231, 226, 383, 385,
1881 -98, -97, -505, -509, 438, 469, -143, -509, -302, 75,
1882 -509, -219, -509, -46, -509, -38, -509, -68, 38, -509,
1883 130, 286, -140, 154, -509, -509, -509, -509, 450, -509,
1884 -509, -509, -509, 1, -509, 104, -509, -509, 496, -509,
1885 -509, -509, -509, -509, 523, -509, -508, -106, -3, -88,
1886 -509, 486, -509, -48, -509, -509, -509, -509, 86, 28,
1887 -509, -509, 109, -509, -509
Reid Spencer319a7302007-01-05 17:20:02 +00001888};
1889
1890/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1891 positive, shift that token. If negative, reduce the rule which
1892 number is the opposite. If zero, do what YYDEFACT says.
1893 If YYTABLE_NINF, syntax error. */
1894#define YYTABLE_NINF -178
1895static const short int yytable[] =
1896{
Reid Spencer609ca3e2007-01-12 20:10:51 +00001897 86, 330, 146, 147, 25, 115, 385, 91, 124, 278,
1898 135, 40, 441, 86, 128, 94, 551, 347, 348, 138,
1899 139, 140, 141, 142, 143, 144, 145, 19, 272, 20,
1900 272, 272, 138, 139, 140, 141, 142, 143, 144, 145,
1901 443, 403, 272, 564, 25, 136, -112, 566, 44, 45,
1902 46, 414, 242, 4, 132, 132, 137, 128, 573, 442,
1903 134, 404, 243, 128, 323, 242, 413, 30, 47, 429,
1904 49, 132, 98, 99, 100, 352, 101, 102, 103, 466,
1905 219, 220, 429, 237, 40, 130, 429, 442, 50, 309,
1906 430, 27, 313, 28, 465, 326, 429, 314, 315, 316,
1907 317, 327, 464, 126, 64, 65, 66, 67, 68, 69,
1908 70, 71, 72, 73, 74, 75, 76, 321, 322, 77,
1909 78, 31, 32, 33, 34, 35, 36, 37, 19, 346,
1910 20, 116, 117, 274, 275, 58, 92, 307, 308, 134,
1911 310, 311, 134, 60, 95, 276, 62, 134, 134, 134,
1912 134, 125, -177, 138, 139, 140, 141, 142, 143, 144,
1913 145, 51, 108, 241, 318, 319, 320, 134, 134, 246,
1914 349, 350, 550, 19, 353, 20, 7, 8, 9, 52,
1915 11, 53, 13, 5, 54, 565, 6, 463, 527, 112,
1916 528, 109, 55, 110, 7, 8, 9, 10, 11, 12,
1917 13, 408, 409, 411, 272, 111, 355, 119, 212, 213,
1918 120, 121, 272, 272, 272, 14, -113, 126, 64, 65,
Reid Spencer319a7302007-01-05 17:20:02 +00001919 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001920 76, 131, 379, 77, 78, 324, 325, 401, 331, 332,
1921 86, 122, 19, 123, 20, -72, -72, -76, -76, 211,
1922 236, 380, 215, 79, 245, 238, 80, -71, -71, 81,
1923 239, 82, 127, -75, -75, -70, -70, 216, 381, -74,
1924 -74, -69, -69, 272, 272, 272, 244, 399, -73, -73,
1925 217, 272, 333, 334, 277, 86, 400, 134, 101, 102,
1926 328, 353, -79, 272, 272, 279, 280, 281, 282, 283,
1927 284, 448, -80, 450, 451, 452, 337, 386, 359, 456,
1928 351, 285, 286, 287, 288, 394, 395, 396, 360, 361,
1929 365, 366, 367, 368, 369, 372, 373, 374, 375, 376,
1930 272, 272, 377, 378, 382, 272, 384, 272, 388, 387,
1931 389, 272, 390, 391, 392, 398, 393, 272, 272, 272,
1932 397, 134, 449, 134, 134, 134, 416, 402, 412, 134,
1933 457, 415, 418, 419, 421, 436, 422, 79, 437, 423,
1934 80, 461, 444, 81, 447, 82, 438, 439, 440, 453,
1935 355, 454, 272, 272, 446, 455, 462, 460, 403, 272,
1936 471, 475, 491, 476, 477, 478, 458, 459, 272, 480,
1937 484, 481, 505, 482, 537, 483, 134, 507, 488, 532,
1938 533, 534, 487, 503, 489, 495, 497, 549, 498, 499,
1939 508, 509, 504, 146, 147, 272, 520, 510, 526, 521,
1940 529, 531, 540, 485, 486, 542, 543, 541, 490, 442,
1941 492, 554, 544, 272, 496, 545, 519, 546, 547, 134,
1942 500, 501, 502, 548, 146, 147, 553, 555, 557, 134,
1943 134, 134, 558, 559, 567, 134, 569, 568, 272, 272,
1944 570, 571, 572, 272, 574, 575, 272, 576, 579, 582,
1945 202, 104, 203, 204, 364, 524, 525, 205, 363, 206,
1946 336, 134, 530, 56, 469, 424, 425, 426, 427, 428,
1947 114, 536, 431, 432, 433, 434, 435, 126, 64, 65,
1948 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1949 76, 345, 468, 77, 78, 59, 26, 97, 556, 580,
1950 494, 535, 19, 474, 20, 0, 0, 0, 0, 0,
1951 0, 0, 0, 0, 0, 0, 563, 0, 0, 0,
1952 0, 0, 472, 473, 0, 0, 0, 0, 0, 479,
1953 290, 291, 0, 0, 0, 0, -82, 19, 0, 20,
1954 0, 577, 578, 6, -82, -82, 581, 0, 0, 583,
1955 0, -82, -82, -82, -82, -82, -82, -82, 0, -82,
1956 21, 0, 0, 0, 0, 0, 0, -82, 22, 0,
1957 0, 0, 23, 0, 0, 511, 512, 513, 514, 0,
1958 515, 516, 517, 518, 0, 126, 221, 222, 223, 224,
1959 225, 226, 227, 228, 229, 230, 231, 75, 76, 0,
1960 0, 77, 78, 0, 0, 0, 0, 0, 538, 539,
1961 19, 0, 20, 292, 293, 294, 295, 296, 297, 298,
1962 299, 300, 301, 302, 303, 304, 305, 79, 0, 0,
1963 80, 0, 0, 81, 0, 82, 240, 0, 0, 0,
1964 560, 0, 561, 562, 126, 64, 65, 66, 67, 68,
Reid Spencer319a7302007-01-05 17:20:02 +00001965 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
1966 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
1967 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001968 0, 354, 126, 221, 222, 223, 224, 225, 226, 227,
1969 228, 229, 230, 231, 75, 76, 0, 0, 77, 78,
1970 0, 0, 0, 0, 0, 0, 0, 19, 0, 20,
1971 0, 0, 126, 64, 65, 66, 67, 68, 69, 70,
1972 71, 72, 73, 74, 75, 76, 0, 0, 77, 78,
1973 0, 0, 0, 0, 0, 79, 0, 19, 80, 20,
1974 0, 81, 0, 82, 410, 0, 0, 0, 0, 420,
1975 126, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1976 73, 74, 75, 76, 0, 0, 77, 78, 0, 0,
1977 0, 0, 0, 0, 0, 19, 0, 20, 0, 0,
1978 0, 0, 0, 0, 0, 0, 0, 467, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001979 0, 0, 0, 0, 79, 0, 0, 80, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001980 81, 0, 82, 63, 64, 65, 66, 67, 68, 69,
1981 70, 71, 72, 73, 74, 75, 76, 0, 0, 77,
1982 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
1983 20, 0, 79, 0, 0, 80, 0, 407, 81, 0,
1984 82, 0, 133, 64, 65, 66, 67, 68, 69, 70,
1985 71, 72, 73, 74, 75, 76, 0, 0, 77, 78,
1986 0, 0, 79, 0, 0, 80, 0, 19, 81, 20,
1987 82, 126, 64, 65, 66, 67, 68, 69, 70, 71,
1988 72, 73, 74, 75, 76, 0, 0, 77, 78, 0,
1989 0, 0, 0, 0, 0, 0, 19, 0, 20, 0,
1990 79, 0, 0, 80, 0, 0, 81, 0, 82, 126,
1991 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
1992 231, 75, 76, 0, 0, 77, 78, 0, 0, 0,
1993 0, 0, 0, 0, 19, 0, 20, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001994 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001995 0, 0, 0, 79, 0, 0, 80, 0, 0, 81,
1996 0, 82, 0, 0, 0, 0, 0, 0, 0, 77,
1997 78, 0, 338, 339, 340, 0, 0, 0, 19, 0,
1998 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1999 0, 0, 79, 0, 0, 80, 0, 0, 81, 0,
2000 82, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2001 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2002 0, 79, 0, 0, 80, 0, 0, 81, 0, 82,
2003 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
2004 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
2005 257, 258, 0, 0, 0, 0, 0, 0, 0, 79,
2006 0, 0, 80, 0, 0, 81, 0, 82, 0, 0,
2007 0, 0, 0, 0, 0, 0, 0, 259, 0, 260,
2008 181, 182, 183, 184, 0, 261, 262, 263, 189, 190,
2009 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
2010 201, 0, 0, 0, 0, 0, 341, 0, 0, 342,
2011 0, 343, 0, 0, 344, 248, 249, 77, 78, 250,
2012 251, 252, 253, 254, 255, 0, 19, 0, 20, 0,
2013 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2014 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2015 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2016 256, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2017 0, 0, 0, 0, 0, 0, 0, 0, 153, 154,
2018 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
2019 165, 166, 167, 168, 169, 170, 171, 172, 257, 258,
2020 0, 0, 0, 0, 248, 249, 0, 0, 250, 251,
2021 252, 253, 254, 255, 0, 0, 0, 0, 0, 0,
2022 0, 0, 0, 0, 0, 259, 0, 260, 181, 182,
2023 183, 184, 0, 261, 262, 263, 189, 190, 191, 192,
2024 193, 194, 195, 196, 197, 198, 199, 200, 201, 256,
2025 0, 0, 0, 0, 0, 0, 0, 264, 0, 0,
2026 0, 0, 0, 0, 0, 0, 0, 153, 154, 155,
2027 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
2028 166, 167, 168, 169, 170, 171, 172, 257, 258, 0,
2029 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2030 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2031 0, 0, 0, 0, 259, 0, 260, 181, 182, 183,
2032 184, 149, 261, 262, 263, 189, 190, 191, 192, 193,
2033 194, 195, 196, 197, 198, 199, 200, 201, 0, 0,
2034 0, 0, 0, 150, 151, 0, 264, 0, 0, 0,
2035 0, 0, 0, 0, 0, 0, 0, 0, 0, 152,
2036 0, 0, 0, 153, 154, 155, 156, 157, 158, 159,
Reid Spencer319a7302007-01-05 17:20:02 +00002037 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002038 170, 171, 172, 173, 174, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002039 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002040 0, 0, 0, 0, 0, 175, 176, 177, 0, 0,
2041 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2042 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
2043 198, 199, 200, 201
Reid Spencer319a7302007-01-05 17:20:02 +00002044};
2045
2046static const short int yycheck[] =
2047{
Reid Spencer609ca3e2007-01-12 20:10:51 +00002048 38, 220, 100, 100, 3, 51, 308, 32, 18, 152,
2049 98, 29, 10, 51, 82, 33, 521, 236, 237, 5,
2050 6, 7, 8, 9, 10, 11, 12, 28, 134, 30,
Reid Spencer319a7302007-01-05 17:20:02 +00002051 136, 137, 5, 6, 7, 8, 9, 10, 11, 12,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002052 10, 37, 148, 551, 43, 4, 154, 552, 52, 53,
2053 54, 160, 152, 0, 163, 163, 15, 125, 566, 57,
2054 98, 57, 162, 131, 207, 152, 158, 62, 72, 152,
2055 151, 163, 73, 74, 75, 162, 77, 78, 79, 162,
2056 118, 119, 152, 121, 29, 84, 152, 57, 62, 177,
2057 160, 45, 180, 47, 160, 152, 152, 185, 186, 187,
2058 188, 158, 158, 3, 4, 5, 6, 7, 8, 9,
2059 10, 11, 12, 13, 14, 15, 16, 205, 206, 19,
2060 20, 65, 66, 67, 68, 69, 70, 71, 28, 235,
2061 30, 35, 36, 136, 137, 151, 161, 175, 176, 177,
2062 178, 179, 180, 30, 162, 148, 18, 185, 186, 187,
2063 188, 161, 0, 5, 6, 7, 8, 9, 10, 11,
2064 12, 27, 151, 125, 202, 203, 204, 205, 206, 131,
2065 238, 239, 158, 28, 242, 30, 42, 43, 44, 45,
2066 46, 47, 48, 31, 50, 158, 34, 406, 490, 156,
2067 492, 151, 58, 151, 42, 43, 44, 45, 46, 47,
2068 48, 341, 342, 343, 310, 151, 244, 53, 55, 56,
2069 56, 57, 318, 319, 320, 63, 154, 3, 4, 5,
Reid Spencer319a7302007-01-05 17:20:02 +00002070 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002071 16, 154, 278, 19, 20, 125, 126, 325, 25, 26,
2072 278, 18, 28, 18, 30, 17, 18, 17, 18, 30,
2073 120, 289, 18, 153, 40, 157, 156, 17, 18, 159,
2074 157, 161, 162, 17, 18, 17, 18, 30, 306, 17,
2075 18, 17, 18, 379, 380, 381, 154, 323, 17, 18,
2076 30, 387, 17, 18, 60, 323, 324, 325, 77, 78,
2077 152, 359, 21, 399, 400, 102, 103, 104, 105, 106,
2078 107, 389, 21, 391, 392, 393, 21, 310, 152, 397,
2079 160, 118, 119, 120, 121, 318, 319, 320, 155, 64,
2080 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
2081 436, 437, 152, 152, 152, 441, 152, 443, 152, 156,
2082 152, 447, 152, 152, 152, 39, 152, 453, 454, 455,
2083 152, 389, 390, 391, 392, 393, 355, 30, 30, 397,
2084 398, 160, 152, 155, 30, 15, 154, 153, 15, 154,
2085 156, 30, 152, 159, 156, 161, 379, 380, 381, 152,
2086 418, 152, 488, 489, 387, 152, 18, 152, 37, 495,
2087 152, 152, 18, 152, 152, 152, 399, 400, 504, 152,
2088 39, 152, 57, 152, 18, 152, 444, 30, 152, 497,
2089 498, 499, 154, 154, 152, 152, 152, 15, 152, 152,
2090 152, 152, 460, 521, 521, 531, 152, 155, 152, 156,
2091 152, 152, 152, 436, 437, 152, 152, 155, 441, 57,
2092 443, 529, 155, 549, 447, 155, 484, 155, 155, 487,
2093 453, 454, 455, 155, 552, 552, 155, 158, 155, 497,
2094 498, 499, 155, 155, 39, 503, 155, 158, 574, 575,
2095 155, 155, 152, 579, 15, 15, 582, 152, 15, 15,
2096 104, 43, 104, 104, 258, 488, 489, 104, 257, 104,
2097 233, 529, 495, 24, 419, 365, 366, 367, 368, 369,
2098 50, 504, 372, 373, 374, 375, 376, 3, 4, 5,
2099 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2100 16, 235, 418, 19, 20, 29, 3, 41, 531, 577,
2101 444, 503, 28, 424, 30, -1, -1, -1, -1, -1,
2102 -1, -1, -1, -1, -1, -1, 549, -1, -1, -1,
2103 -1, -1, 422, 423, -1, -1, -1, -1, -1, 429,
2104 25, 26, -1, -1, -1, -1, 27, 28, -1, 30,
2105 -1, 574, 575, 34, 35, 36, 579, -1, -1, 582,
2106 -1, 42, 43, 44, 45, 46, 47, 48, -1, 50,
2107 51, -1, -1, -1, -1, -1, -1, 58, 59, -1,
2108 -1, -1, 63, -1, -1, 475, 476, 477, 478, -1,
2109 480, 481, 482, 483, -1, 3, 4, 5, 6, 7,
2110 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2111 -1, 19, 20, -1, -1, -1, -1, -1, 508, 509,
2112 28, -1, 30, 108, 109, 110, 111, 112, 113, 114,
2113 115, 116, 117, 118, 119, 120, 121, 153, -1, -1,
2114 156, -1, -1, 159, -1, 161, 162, -1, -1, -1,
2115 540, -1, 542, 543, 3, 4, 5, 6, 7, 8,
Reid Spencer319a7302007-01-05 17:20:02 +00002116 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2117 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2118 -1, 30, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002119 -1, 40, 3, 4, 5, 6, 7, 8, 9, 10,
2120 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2121 -1, -1, -1, -1, -1, -1, -1, 28, -1, 30,
2122 -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
2123 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2124 -1, -1, -1, -1, -1, 153, -1, 28, 156, 30,
2125 -1, 159, -1, 161, 162, -1, -1, -1, -1, 40,
2126 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2127 13, 14, 15, 16, -1, -1, 19, 20, -1, -1,
2128 -1, -1, -1, -1, -1, 28, -1, 30, -1, -1,
2129 -1, -1, -1, -1, -1, -1, -1, 40, -1, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002130 -1, -1, -1, -1, 153, -1, -1, 156, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002131 159, -1, 161, 3, 4, 5, 6, 7, 8, 9,
2132 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
2133 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2134 30, -1, 153, -1, -1, 156, -1, 158, 159, -1,
2135 161, -1, 3, 4, 5, 6, 7, 8, 9, 10,
2136 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2137 -1, -1, 153, -1, -1, 156, -1, 28, 159, 30,
2138 161, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2139 12, 13, 14, 15, 16, -1, -1, 19, 20, -1,
2140 -1, -1, -1, -1, -1, -1, 28, -1, 30, -1,
2141 153, -1, -1, 156, -1, -1, 159, -1, 161, 3,
2142 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
2143 14, 15, 16, -1, -1, 19, 20, -1, -1, -1,
2144 -1, -1, -1, -1, 28, -1, 30, -1, -1, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002145 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002146 -1, -1, -1, 153, -1, -1, 156, -1, -1, 159,
2147 -1, 161, -1, -1, -1, -1, -1, -1, -1, 19,
2148 20, -1, 22, 23, 24, -1, -1, -1, 28, -1,
2149 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2150 -1, -1, 153, -1, -1, 156, -1, -1, 159, -1,
2151 161, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002152 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002153 -1, 153, -1, -1, 156, -1, -1, 159, -1, 161,
2154 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2155 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
2156 100, 101, -1, -1, -1, -1, -1, -1, -1, 153,
2157 -1, -1, 156, -1, -1, 159, -1, 161, -1, -1,
2158 -1, -1, -1, -1, -1, -1, -1, 127, -1, 129,
2159 130, 131, 132, 133, -1, 135, 136, 137, 138, 139,
2160 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
2161 150, -1, -1, -1, -1, -1, 156, -1, -1, 159,
2162 -1, 161, -1, -1, 164, 17, 18, 19, 20, 21,
2163 22, 23, 24, 25, 26, -1, 28, -1, 30, -1,
2164 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2165 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2166 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2167 62, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2168 -1, -1, -1, -1, -1, -1, -1, -1, 80, 81,
2169 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2170 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
2171 -1, -1, -1, -1, 17, 18, -1, -1, 21, 22,
2172 23, 24, 25, 26, -1, -1, -1, -1, -1, -1,
2173 -1, -1, -1, -1, -1, 127, -1, 129, 130, 131,
2174 132, 133, -1, 135, 136, 137, 138, 139, 140, 141,
2175 142, 143, 144, 145, 146, 147, 148, 149, 150, 62,
2176 -1, -1, -1, -1, -1, -1, -1, 159, -1, -1,
2177 -1, -1, -1, -1, -1, -1, -1, 80, 81, 82,
2178 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2179 93, 94, 95, 96, 97, 98, 99, 100, 101, -1,
2180 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2181 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2182 -1, -1, -1, -1, 127, -1, 129, 130, 131, 132,
2183 133, 38, 135, 136, 137, 138, 139, 140, 141, 142,
2184 143, 144, 145, 146, 147, 148, 149, 150, -1, -1,
2185 -1, -1, -1, 60, 61, -1, 159, -1, -1, -1,
2186 -1, -1, -1, -1, -1, -1, -1, -1, -1, 76,
Reid Spencer319a7302007-01-05 17:20:02 +00002187 -1, -1, -1, 80, 81, 82, 83, 84, 85, 86,
2188 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2189 97, 98, 99, 100, 101, -1, -1, -1, -1, -1,
2190 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002191 -1, -1, -1, -1, -1, 122, 123, 124, -1, -1,
2192 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Reid Spencer319a7302007-01-05 17:20:02 +00002193 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002194 147, 148, 149, 150
Reid Spencer319a7302007-01-05 17:20:02 +00002195};
2196
2197/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2198 symbol of state STATE-NUM. */
2199static const unsigned char yystos[] =
2200{
2201 0, 199, 200, 202, 0, 31, 34, 42, 43, 44,
2202 45, 46, 47, 48, 63, 180, 215, 217, 219, 28,
2203 30, 51, 59, 63, 179, 208, 219, 45, 47, 218,
2204 62, 65, 66, 67, 68, 69, 70, 71, 181, 213,
2205 29, 225, 226, 227, 52, 53, 54, 72, 205, 151,
2206 62, 27, 45, 47, 50, 58, 180, 201, 151, 213,
2207 30, 203, 18, 3, 4, 5, 6, 7, 8, 9,
2208 10, 11, 12, 13, 14, 15, 16, 19, 20, 153,
2209 156, 159, 161, 166, 188, 189, 190, 191, 192, 208,
2210 222, 32, 161, 214, 33, 162, 216, 226, 73, 74,
2211 75, 77, 78, 79, 179, 228, 229, 231, 151, 151,
2212 151, 151, 156, 206, 203, 188, 35, 36, 198, 198,
2213 198, 198, 18, 18, 18, 161, 3, 162, 192, 193,
2214 208, 154, 163, 3, 190, 224, 4, 15, 5, 6,
2215 7, 8, 9, 10, 11, 12, 175, 176, 177, 38,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002216 60, 61, 76, 80, 81, 82, 83, 84, 85, 86,
2217 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2218 97, 98, 99, 100, 101, 122, 123, 124, 127, 128,
2219 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
2220 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
2221 149, 150, 168, 169, 170, 173, 174, 235, 236, 238,
2222 239, 30, 55, 56, 204, 18, 30, 30, 207, 190,
2223 190, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2224 13, 14, 175, 176, 178, 190, 195, 190, 157, 157,
2225 162, 193, 152, 162, 154, 40, 193, 194, 17, 18,
2226 21, 22, 23, 24, 25, 26, 62, 100, 101, 127,
2227 129, 135, 136, 137, 159, 168, 169, 170, 173, 174,
2228 196, 221, 222, 223, 223, 223, 223, 60, 181, 102,
2229 103, 104, 105, 106, 107, 118, 119, 120, 121, 171,
2230 25, 26, 108, 109, 110, 111, 112, 113, 114, 115,
2231 116, 117, 118, 119, 120, 121, 172, 190, 190, 224,
2232 190, 190, 232, 224, 224, 224, 224, 224, 190, 190,
2233 190, 224, 224, 181, 125, 126, 152, 158, 152, 186,
2234 186, 25, 26, 17, 18, 167, 167, 21, 22, 23,
2235 24, 156, 159, 161, 164, 196, 222, 186, 186, 192,
2236 192, 160, 162, 192, 40, 190, 210, 211, 212, 152,
2237 155, 64, 220, 171, 172, 154, 154, 154, 154, 154,
2238 195, 197, 154, 154, 154, 154, 154, 152, 152, 188,
2239 190, 190, 152, 183, 152, 183, 223, 156, 152, 152,
2240 152, 152, 152, 152, 223, 223, 223, 152, 39, 188,
2241 190, 224, 30, 37, 57, 184, 187, 158, 197, 197,
2242 162, 197, 30, 158, 160, 160, 208, 209, 152, 155,
2243 40, 30, 154, 154, 195, 195, 195, 195, 195, 152,
2244 160, 195, 195, 195, 195, 195, 15, 15, 223, 223,
2245 223, 10, 57, 10, 152, 237, 223, 156, 224, 190,
2246 224, 224, 224, 152, 152, 152, 224, 190, 223, 223,
2247 152, 30, 18, 186, 158, 160, 162, 40, 210, 184,
2248 185, 152, 195, 195, 237, 152, 152, 152, 152, 195,
2249 152, 152, 152, 152, 39, 223, 223, 154, 152, 152,
2250 223, 18, 223, 224, 233, 152, 223, 152, 152, 152,
2251 223, 223, 223, 154, 190, 57, 182, 30, 152, 152,
2252 155, 195, 195, 195, 195, 195, 195, 195, 195, 190,
2253 152, 156, 233, 234, 223, 223, 152, 183, 183, 152,
2254 223, 152, 224, 224, 224, 234, 223, 18, 195, 195,
2255 152, 155, 152, 152, 155, 155, 155, 155, 155, 15,
2256 158, 177, 230, 155, 224, 158, 223, 155, 155, 155,
2257 195, 195, 195, 223, 221, 158, 177, 39, 158, 155,
2258 155, 155, 152, 221, 15, 15, 152, 223, 223, 15,
2259 228, 223, 15, 223
Reid Spencer319a7302007-01-05 17:20:02 +00002260};
Reid Spencere7c3c602006-11-30 06:36:44 +00002261
2262#define yyerrok (yyerrstatus = 0)
2263#define yyclearin (yychar = YYEMPTY)
Reid Spencer319a7302007-01-05 17:20:02 +00002264#define YYEMPTY (-2)
Reid Spencere7c3c602006-11-30 06:36:44 +00002265#define YYEOF 0
Reid Spencer319a7302007-01-05 17:20:02 +00002266
Reid Spencere7c3c602006-11-30 06:36:44 +00002267#define YYACCEPT goto yyacceptlab
Reid Spencer319a7302007-01-05 17:20:02 +00002268#define YYABORT goto yyabortlab
2269#define YYERROR goto yyerrorlab
2270
2271
2272/* Like YYERROR except do call yyerror. This remains here temporarily
2273 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencere7c3c602006-11-30 06:36:44 +00002274 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer319a7302007-01-05 17:20:02 +00002275
Reid Spencere7c3c602006-11-30 06:36:44 +00002276#define YYFAIL goto yyerrlab
Reid Spencer319a7302007-01-05 17:20:02 +00002277
Reid Spencere7c3c602006-11-30 06:36:44 +00002278#define YYRECOVERING() (!!yyerrstatus)
Reid Spencer319a7302007-01-05 17:20:02 +00002279
2280#define YYBACKUP(Token, Value) \
Reid Spencere7c3c602006-11-30 06:36:44 +00002281do \
2282 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencer319a7302007-01-05 17:20:02 +00002283 { \
2284 yychar = (Token); \
2285 yylval = (Value); \
2286 yytoken = YYTRANSLATE (yychar); \
Reid Spencere7c3c602006-11-30 06:36:44 +00002287 YYPOPSTACK; \
2288 goto yybackup; \
2289 } \
2290 else \
Reid Spencer319a7302007-01-05 17:20:02 +00002291 { \
2292 yyerror (YY_("syntax error: cannot back up")); \
2293 YYERROR; \
2294 } \
Reid Spencere7c3c602006-11-30 06:36:44 +00002295while (0)
2296
Reid Spencer319a7302007-01-05 17:20:02 +00002297
Reid Spencere7c3c602006-11-30 06:36:44 +00002298#define YYTERROR 1
2299#define YYERRCODE 256
2300
Reid Spencer319a7302007-01-05 17:20:02 +00002301
2302/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2303 If N is 0, then set CURRENT to the empty location which ends
2304 the previous symbol: RHS[0] (always defined). */
2305
2306#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2307#ifndef YYLLOC_DEFAULT
2308# define YYLLOC_DEFAULT(Current, Rhs, N) \
2309 do \
2310 if (N) \
2311 { \
2312 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2313 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2314 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2315 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2316 } \
2317 else \
2318 { \
2319 (Current).first_line = (Current).last_line = \
2320 YYRHSLOC (Rhs, 0).last_line; \
2321 (Current).first_column = (Current).last_column = \
2322 YYRHSLOC (Rhs, 0).last_column; \
2323 } \
2324 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002325#endif
2326
Reid Spencer319a7302007-01-05 17:20:02 +00002327
2328/* YY_LOCATION_PRINT -- Print the location on the stream.
2329 This macro was not mandated originally: define only if we know
2330 we won't break user code: when these are the locations we know. */
2331
2332#ifndef YY_LOCATION_PRINT
2333# if YYLTYPE_IS_TRIVIAL
2334# define YY_LOCATION_PRINT(File, Loc) \
2335 fprintf (File, "%d.%d-%d.%d", \
2336 (Loc).first_line, (Loc).first_column, \
2337 (Loc).last_line, (Loc).last_column)
2338# else
2339# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2340# endif
2341#endif
2342
2343
2344/* YYLEX -- calling `yylex' with the right arguments. */
2345
Reid Spencere7c3c602006-11-30 06:36:44 +00002346#ifdef YYLEX_PARAM
Reid Spencer319a7302007-01-05 17:20:02 +00002347# define YYLEX yylex (YYLEX_PARAM)
Reid Spencere7c3c602006-11-30 06:36:44 +00002348#else
Reid Spencer319a7302007-01-05 17:20:02 +00002349# define YYLEX yylex ()
Chris Lattner37e01c52007-01-04 18:46:42 +00002350#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002351
2352/* Enable debugging if requested. */
2353#if YYDEBUG
2354
2355# ifndef YYFPRINTF
2356# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2357# define YYFPRINTF fprintf
2358# endif
2359
2360# define YYDPRINTF(Args) \
2361do { \
2362 if (yydebug) \
2363 YYFPRINTF Args; \
2364} while (0)
2365
2366# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2367do { \
2368 if (yydebug) \
2369 { \
2370 YYFPRINTF (stderr, "%s ", Title); \
2371 yysymprint (stderr, \
2372 Type, Value); \
2373 YYFPRINTF (stderr, "\n"); \
2374 } \
2375} while (0)
2376
2377/*------------------------------------------------------------------.
2378| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2379| TOP (included). |
2380`------------------------------------------------------------------*/
2381
2382#if defined (__STDC__) || defined (__cplusplus)
2383static void
2384yy_stack_print (short int *bottom, short int *top)
Chris Lattner37e01c52007-01-04 18:46:42 +00002385#else
Reid Spencer319a7302007-01-05 17:20:02 +00002386static void
2387yy_stack_print (bottom, top)
2388 short int *bottom;
2389 short int *top;
Chris Lattner37e01c52007-01-04 18:46:42 +00002390#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002391{
2392 YYFPRINTF (stderr, "Stack now");
2393 for (/* Nothing. */; bottom <= top; ++bottom)
2394 YYFPRINTF (stderr, " %d", *bottom);
2395 YYFPRINTF (stderr, "\n");
2396}
2397
2398# define YY_STACK_PRINT(Bottom, Top) \
2399do { \
2400 if (yydebug) \
2401 yy_stack_print ((Bottom), (Top)); \
2402} while (0)
2403
2404
2405/*------------------------------------------------.
2406| Report that the YYRULE is going to be reduced. |
2407`------------------------------------------------*/
2408
2409#if defined (__STDC__) || defined (__cplusplus)
2410static void
2411yy_reduce_print (int yyrule)
2412#else
2413static void
2414yy_reduce_print (yyrule)
2415 int yyrule;
Reid Spencere7c3c602006-11-30 06:36:44 +00002416#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002417{
2418 int yyi;
2419 unsigned long int yylno = yyrline[yyrule];
2420 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2421 yyrule - 1, yylno);
2422 /* Print the symbols being reduced, and their result. */
2423 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2424 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2425 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2426}
Reid Spencere7c3c602006-11-30 06:36:44 +00002427
Reid Spencer319a7302007-01-05 17:20:02 +00002428# define YY_REDUCE_PRINT(Rule) \
2429do { \
2430 if (yydebug) \
2431 yy_reduce_print (Rule); \
2432} while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002433
Reid Spencer319a7302007-01-05 17:20:02 +00002434/* Nonzero means print parse trace. It is left uninitialized so that
2435 multiple parsers can coexist. */
2436int yydebug;
2437#else /* !YYDEBUG */
2438# define YYDPRINTF(Args)
2439# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2440# define YY_STACK_PRINT(Bottom, Top)
2441# define YY_REDUCE_PRINT(Rule)
2442#endif /* !YYDEBUG */
Reid Spencere7c3c602006-11-30 06:36:44 +00002443
Reid Spencere7c3c602006-11-30 06:36:44 +00002444
Reid Spencer319a7302007-01-05 17:20:02 +00002445/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002446#ifndef YYINITDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002447# define YYINITDEPTH 200
Reid Spencere7c3c602006-11-30 06:36:44 +00002448#endif
2449
Reid Spencer319a7302007-01-05 17:20:02 +00002450/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2451 if the built-in stack extension method is used).
Reid Spencere7c3c602006-11-30 06:36:44 +00002452
Reid Spencer319a7302007-01-05 17:20:02 +00002453 Do not make this value too large; the results are undefined if
2454 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2455 evaluated with infinite-precision integer arithmetic. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002456
2457#ifndef YYMAXDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002458# define YYMAXDEPTH 10000
Reid Spencere7c3c602006-11-30 06:36:44 +00002459#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002460
Reid Spencere7c3c602006-11-30 06:36:44 +00002461
2462
Reid Spencer319a7302007-01-05 17:20:02 +00002463#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00002464
Reid Spencer319a7302007-01-05 17:20:02 +00002465# ifndef yystrlen
2466# if defined (__GLIBC__) && defined (_STRING_H)
2467# define yystrlen strlen
2468# else
2469/* Return the length of YYSTR. */
2470static YYSIZE_T
2471# if defined (__STDC__) || defined (__cplusplus)
2472yystrlen (const char *yystr)
2473# else
2474yystrlen (yystr)
2475 const char *yystr;
2476# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002477{
Reid Spencer319a7302007-01-05 17:20:02 +00002478 const char *yys = yystr;
Chris Lattner37e01c52007-01-04 18:46:42 +00002479
Reid Spencer319a7302007-01-05 17:20:02 +00002480 while (*yys++ != '\0')
2481 continue;
2482
2483 return yys - yystr - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002484}
Reid Spencer319a7302007-01-05 17:20:02 +00002485# endif
2486# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002487
Reid Spencer319a7302007-01-05 17:20:02 +00002488# ifndef yystpcpy
2489# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2490# define yystpcpy stpcpy
2491# else
2492/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2493 YYDEST. */
2494static char *
2495# if defined (__STDC__) || defined (__cplusplus)
2496yystpcpy (char *yydest, const char *yysrc)
2497# else
2498yystpcpy (yydest, yysrc)
2499 char *yydest;
2500 const char *yysrc;
2501# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002502{
Reid Spencer319a7302007-01-05 17:20:02 +00002503 char *yyd = yydest;
2504 const char *yys = yysrc;
Chris Lattner37e01c52007-01-04 18:46:42 +00002505
Reid Spencer319a7302007-01-05 17:20:02 +00002506 while ((*yyd++ = *yys++) != '\0')
2507 continue;
2508
2509 return yyd - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002510}
Reid Spencer319a7302007-01-05 17:20:02 +00002511# endif
2512# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002513
Reid Spencer319a7302007-01-05 17:20:02 +00002514# ifndef yytnamerr
2515/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2516 quotes and backslashes, so that it's suitable for yyerror. The
2517 heuristic is that double-quoting is unnecessary unless the string
2518 contains an apostrophe, a comma, or backslash (other than
2519 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2520 null, do not copy; instead, return the length of what the result
2521 would have been. */
2522static YYSIZE_T
2523yytnamerr (char *yyres, const char *yystr)
2524{
2525 if (*yystr == '"')
2526 {
2527 size_t yyn = 0;
2528 char const *yyp = yystr;
2529
2530 for (;;)
2531 switch (*++yyp)
2532 {
2533 case '\'':
2534 case ',':
2535 goto do_not_strip_quotes;
2536
2537 case '\\':
2538 if (*++yyp != '\\')
2539 goto do_not_strip_quotes;
2540 /* Fall through. */
2541 default:
2542 if (yyres)
2543 yyres[yyn] = *yyp;
2544 yyn++;
2545 break;
2546
2547 case '"':
2548 if (yyres)
2549 yyres[yyn] = '\0';
2550 return yyn;
2551 }
2552 do_not_strip_quotes: ;
2553 }
2554
2555 if (! yyres)
2556 return yystrlen (yystr);
2557
2558 return yystpcpy (yyres, yystr) - yyres;
2559}
2560# endif
2561
2562#endif /* YYERROR_VERBOSE */
2563
Reid Spencere7c3c602006-11-30 06:36:44 +00002564
2565
Reid Spencer319a7302007-01-05 17:20:02 +00002566#if YYDEBUG
2567/*--------------------------------.
2568| Print this symbol on YYOUTPUT. |
2569`--------------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002570
Reid Spencer319a7302007-01-05 17:20:02 +00002571#if defined (__STDC__) || defined (__cplusplus)
2572static void
2573yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Chris Lattner37e01c52007-01-04 18:46:42 +00002574#else
Reid Spencer319a7302007-01-05 17:20:02 +00002575static void
2576yysymprint (yyoutput, yytype, yyvaluep)
2577 FILE *yyoutput;
2578 int yytype;
2579 YYSTYPE *yyvaluep;
2580#endif
2581{
2582 /* Pacify ``unused variable'' warnings. */
2583 (void) yyvaluep;
2584
2585 if (yytype < YYNTOKENS)
2586 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2587 else
2588 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2589
2590
2591# ifdef YYPRINT
2592 if (yytype < YYNTOKENS)
2593 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2594# endif
2595 switch (yytype)
2596 {
2597 default:
2598 break;
2599 }
2600 YYFPRINTF (yyoutput, ")");
2601}
2602
2603#endif /* ! YYDEBUG */
2604/*-----------------------------------------------.
2605| Release the memory associated to this symbol. |
2606`-----------------------------------------------*/
2607
2608#if defined (__STDC__) || defined (__cplusplus)
2609static void
2610yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2611#else
2612static void
2613yydestruct (yymsg, yytype, yyvaluep)
2614 const char *yymsg;
2615 int yytype;
2616 YYSTYPE *yyvaluep;
2617#endif
2618{
2619 /* Pacify ``unused variable'' warnings. */
2620 (void) yyvaluep;
2621
2622 if (!yymsg)
2623 yymsg = "Deleting";
2624 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2625
2626 switch (yytype)
2627 {
2628
2629 default:
2630 break;
2631 }
2632}
2633
2634
2635/* Prevent warnings from -Wmissing-prototypes. */
2636
2637#ifdef YYPARSE_PARAM
2638# if defined (__STDC__) || defined (__cplusplus)
2639int yyparse (void *YYPARSE_PARAM);
2640# else
2641int yyparse ();
2642# endif
2643#else /* ! YYPARSE_PARAM */
2644#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere7c3c602006-11-30 06:36:44 +00002645int yyparse (void);
Chris Lattner37e01c52007-01-04 18:46:42 +00002646#else
Reid Spencer319a7302007-01-05 17:20:02 +00002647int yyparse ();
2648#endif
2649#endif /* ! YYPARSE_PARAM */
2650
2651
2652
2653/* The look-ahead symbol. */
2654int yychar;
2655
2656/* The semantic value of the look-ahead symbol. */
2657YYSTYPE yylval;
2658
2659/* Number of syntax errors so far. */
2660int yynerrs;
2661
2662
2663
2664/*----------.
2665| yyparse. |
2666`----------*/
2667
2668#ifdef YYPARSE_PARAM
2669# if defined (__STDC__) || defined (__cplusplus)
2670int yyparse (void *YYPARSE_PARAM)
2671# else
2672int yyparse (YYPARSE_PARAM)
2673 void *YYPARSE_PARAM;
2674# endif
2675#else /* ! YYPARSE_PARAM */
2676#if defined (__STDC__) || defined (__cplusplus)
2677int
2678yyparse (void)
2679#else
2680int
2681yyparse ()
2682
2683#endif
2684#endif
2685{
2686
2687 int yystate;
2688 int yyn;
2689 int yyresult;
2690 /* Number of tokens to shift before error messages enabled. */
2691 int yyerrstatus;
2692 /* Look-ahead token as an internal (translated) token number. */
2693 int yytoken = 0;
2694
2695 /* Three stacks and their tools:
2696 `yyss': related to states,
2697 `yyvs': related to semantic values,
2698 `yyls': related to locations.
2699
2700 Refer to the stacks thru separate pointers, to allow yyoverflow
2701 to reallocate them elsewhere. */
2702
2703 /* The state stack. */
2704 short int yyssa[YYINITDEPTH];
2705 short int *yyss = yyssa;
2706 short int *yyssp;
2707
2708 /* The semantic value stack. */
2709 YYSTYPE yyvsa[YYINITDEPTH];
2710 YYSTYPE *yyvs = yyvsa;
2711 YYSTYPE *yyvsp;
2712
2713
2714
Reid Spencere7c3c602006-11-30 06:36:44 +00002715#define YYPOPSTACK (yyvsp--, yyssp--)
2716
Reid Spencer319a7302007-01-05 17:20:02 +00002717 YYSIZE_T yystacksize = YYINITDEPTH;
Reid Spencere7c3c602006-11-30 06:36:44 +00002718
Reid Spencer319a7302007-01-05 17:20:02 +00002719 /* The variables used to return semantic value and location from the
2720 action routines. */
2721 YYSTYPE yyval;
Reid Spencere7c3c602006-11-30 06:36:44 +00002722
2723
Reid Spencer319a7302007-01-05 17:20:02 +00002724 /* When reducing, the number of symbols on the RHS of the reduced
2725 rule. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002726 int yylen;
2727
Reid Spencer319a7302007-01-05 17:20:02 +00002728 YYDPRINTF ((stderr, "Starting parse\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002729
2730 yystate = 0;
2731 yyerrstatus = 0;
2732 yynerrs = 0;
2733 yychar = YYEMPTY; /* Cause a token to be read. */
2734
2735 /* Initialize stack pointers.
2736 Waste one element of value and location stack
2737 so that they stay on the same level as the state stack.
2738 The wasted elements are never initialized. */
2739
Reid Spencer319a7302007-01-05 17:20:02 +00002740 yyssp = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002741 yyvsp = yyvs;
2742
Reid Spencer319a7302007-01-05 17:20:02 +00002743 goto yysetstate;
Reid Spencere7c3c602006-11-30 06:36:44 +00002744
Reid Spencer319a7302007-01-05 17:20:02 +00002745/*------------------------------------------------------------.
2746| yynewstate -- Push a new state, which is found in yystate. |
2747`------------------------------------------------------------*/
2748 yynewstate:
2749 /* In all cases, when you get here, the value and location stacks
2750 have just been pushed. so pushing a state here evens the stacks.
2751 */
2752 yyssp++;
Reid Spencere7c3c602006-11-30 06:36:44 +00002753
Reid Spencer319a7302007-01-05 17:20:02 +00002754 yysetstate:
2755 *yyssp = yystate;
2756
2757 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002758 {
2759 /* Get the current used size of the three stacks, in elements. */
Reid Spencer319a7302007-01-05 17:20:02 +00002760 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002761
2762#ifdef yyoverflow
Reid Spencer319a7302007-01-05 17:20:02 +00002763 {
2764 /* Give user a chance to reallocate the stack. Use copies of
2765 these so that the &'s don't force the real ones into
2766 memory. */
2767 YYSTYPE *yyvs1 = yyvs;
2768 short int *yyss1 = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002769
Reid Spencer319a7302007-01-05 17:20:02 +00002770
2771 /* Each stack pointer address is followed by the size of the
2772 data in use in that stack, in bytes. This used to be a
2773 conditional around just the two extra args, but that might
2774 be undefined if yyoverflow is a macro. */
2775 yyoverflow (YY_("memory exhausted"),
2776 &yyss1, yysize * sizeof (*yyssp),
2777 &yyvs1, yysize * sizeof (*yyvsp),
2778
2779 &yystacksize);
2780
2781 yyss = yyss1;
2782 yyvs = yyvs1;
2783 }
Reid Spencere7c3c602006-11-30 06:36:44 +00002784#else /* no yyoverflow */
Reid Spencer319a7302007-01-05 17:20:02 +00002785# ifndef YYSTACK_RELOCATE
2786 goto yyexhaustedlab;
2787# else
Reid Spencere7c3c602006-11-30 06:36:44 +00002788 /* Extend the stack our own way. */
Reid Spencer319a7302007-01-05 17:20:02 +00002789 if (YYMAXDEPTH <= yystacksize)
2790 goto yyexhaustedlab;
Reid Spencere7c3c602006-11-30 06:36:44 +00002791 yystacksize *= 2;
Reid Spencer319a7302007-01-05 17:20:02 +00002792 if (YYMAXDEPTH < yystacksize)
Reid Spencere7c3c602006-11-30 06:36:44 +00002793 yystacksize = YYMAXDEPTH;
Reid Spencer319a7302007-01-05 17:20:02 +00002794
2795 {
2796 short int *yyss1 = yyss;
2797 union yyalloc *yyptr =
2798 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2799 if (! yyptr)
2800 goto yyexhaustedlab;
2801 YYSTACK_RELOCATE (yyss);
2802 YYSTACK_RELOCATE (yyvs);
2803
2804# undef YYSTACK_RELOCATE
2805 if (yyss1 != yyssa)
2806 YYSTACK_FREE (yyss1);
2807 }
2808# endif
Reid Spencere7c3c602006-11-30 06:36:44 +00002809#endif /* no yyoverflow */
2810
Reid Spencer319a7302007-01-05 17:20:02 +00002811 yyssp = yyss + yysize - 1;
2812 yyvsp = yyvs + yysize - 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002813
2814
Reid Spencer319a7302007-01-05 17:20:02 +00002815 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2816 (unsigned long int) yystacksize));
2817
2818 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002819 YYABORT;
2820 }
2821
Reid Spencer319a7302007-01-05 17:20:02 +00002822 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencere7c3c602006-11-30 06:36:44 +00002823
2824 goto yybackup;
Reid Spencer319a7302007-01-05 17:20:02 +00002825
2826/*-----------.
2827| yybackup. |
2828`-----------*/
2829yybackup:
Reid Spencere7c3c602006-11-30 06:36:44 +00002830
2831/* Do appropriate processing given the current state. */
Reid Spencer319a7302007-01-05 17:20:02 +00002832/* Read a look-ahead token if we need one and don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002833/* yyresume: */
2834
Reid Spencer319a7302007-01-05 17:20:02 +00002835 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002836
2837 yyn = yypact[yystate];
Reid Spencer319a7302007-01-05 17:20:02 +00002838 if (yyn == YYPACT_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002839 goto yydefault;
2840
Reid Spencer319a7302007-01-05 17:20:02 +00002841 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002842
Reid Spencer319a7302007-01-05 17:20:02 +00002843 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002844 if (yychar == YYEMPTY)
2845 {
Reid Spencer319a7302007-01-05 17:20:02 +00002846 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencere7c3c602006-11-30 06:36:44 +00002847 yychar = YYLEX;
2848 }
2849
Reid Spencer319a7302007-01-05 17:20:02 +00002850 if (yychar <= YYEOF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002851 {
Reid Spencer319a7302007-01-05 17:20:02 +00002852 yychar = yytoken = YYEOF;
2853 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002854 }
2855 else
2856 {
Reid Spencer319a7302007-01-05 17:20:02 +00002857 yytoken = YYTRANSLATE (yychar);
2858 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00002859 }
2860
Reid Spencer319a7302007-01-05 17:20:02 +00002861 /* If the proper action on seeing token YYTOKEN is to reduce or to
2862 detect an error, take that action. */
2863 yyn += yytoken;
2864 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencere7c3c602006-11-30 06:36:44 +00002865 goto yydefault;
2866 yyn = yytable[yyn];
Reid Spencer319a7302007-01-05 17:20:02 +00002867 if (yyn <= 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002868 {
Reid Spencer319a7302007-01-05 17:20:02 +00002869 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002870 goto yyerrlab;
2871 yyn = -yyn;
2872 goto yyreduce;
2873 }
2874
2875 if (yyn == YYFINAL)
2876 YYACCEPT;
2877
Reid Spencer319a7302007-01-05 17:20:02 +00002878 /* Shift the look-ahead token. */
2879 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00002880
2881 /* Discard the token being shifted unless it is eof. */
2882 if (yychar != YYEOF)
2883 yychar = YYEMPTY;
2884
2885 *++yyvsp = yylval;
2886
Reid Spencer319a7302007-01-05 17:20:02 +00002887
2888 /* Count tokens shifted since error; after three, turn off error
2889 status. */
2890 if (yyerrstatus)
2891 yyerrstatus--;
Reid Spencere7c3c602006-11-30 06:36:44 +00002892
2893 yystate = yyn;
2894 goto yynewstate;
2895
Chris Lattner37e01c52007-01-04 18:46:42 +00002896
Reid Spencer319a7302007-01-05 17:20:02 +00002897/*-----------------------------------------------------------.
2898| yydefault -- do the default action for the current state. |
2899`-----------------------------------------------------------*/
2900yydefault:
Reid Spencere7c3c602006-11-30 06:36:44 +00002901 yyn = yydefact[yystate];
2902 if (yyn == 0)
2903 goto yyerrlab;
Reid Spencer319a7302007-01-05 17:20:02 +00002904 goto yyreduce;
Reid Spencere7c3c602006-11-30 06:36:44 +00002905
Reid Spencer319a7302007-01-05 17:20:02 +00002906
2907/*-----------------------------.
2908| yyreduce -- Do a reduction. |
2909`-----------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002910yyreduce:
Reid Spencer319a7302007-01-05 17:20:02 +00002911 /* yyn is the number of a rule to reduce with. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002912 yylen = yyr2[yyn];
2913
Reid Spencer319a7302007-01-05 17:20:02 +00002914 /* If YYLEN is nonzero, implement the default value of the action:
2915 `$$ = $1'.
2916
2917 Otherwise, the following line sets YYVAL to garbage.
2918 This behavior is undocumented and Bison
2919 users should not rely upon it. Assigning to YYVAL
2920 unconditionally makes the parser a bit smaller, and it avoids a
2921 GCC warning that YYVAL may be used uninitialized. */
2922 yyval = yyvsp[1-yylen];
2923
2924
2925 YY_REDUCE_PRINT (yyn);
2926 switch (yyn)
Reid Spencere7c3c602006-11-30 06:36:44 +00002927 {
Reid Spencer319a7302007-01-05 17:20:02 +00002928 case 81:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002929#line 892 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002930 {
2931 (yyval.String) = (yyvsp[-1].String);
2932 ;}
2933 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002934
Reid Spencer319a7302007-01-05 17:20:02 +00002935 case 82:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002936#line 895 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002937 {
2938 (yyval.String) = new std::string("");
2939 ;}
2940 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002941
Reid Spencer319a7302007-01-05 17:20:02 +00002942 case 90:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002943#line 902 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002944 { (yyval.String) = new std::string(""); ;}
2945 break;
Reid Spencere77e35e2006-12-01 20:26:20 +00002946
Reid Spencer319a7302007-01-05 17:20:02 +00002947 case 97:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002948#line 907 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002949 {
2950 *(yyvsp[-1].String) += *(yyvsp[0].String);
2951 delete (yyvsp[0].String);
2952 (yyval.String) = (yyvsp[-1].String);
2953 ;}
2954 break;
Reid Spencer16244f42006-12-01 21:10:07 +00002955
Reid Spencer319a7302007-01-05 17:20:02 +00002956 case 98:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002957#line 912 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002958 { (yyval.String) = new std::string(""); ;}
2959 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002960
Reid Spencer319a7302007-01-05 17:20:02 +00002961 case 99:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002962#line 917 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002963 { (yyval.String) = new std::string(); ;}
2964 break;
2965
2966 case 100:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002967#line 918 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002968 { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
2969 break;
2970
2971 case 101:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002972#line 921 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002973 { (yyval.String) = new std::string(); ;}
2974 break;
2975
2976 case 102:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002977#line 922 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002978 {
2979 (yyvsp[-1].String)->insert(0, ", ");
2980 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
2981 delete (yyvsp[0].String);
2982 (yyval.String) = (yyvsp[-1].String);
2983 ;}
2984 break;
2985
2986 case 103:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002987#line 930 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002988 {
2989 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
2990 delete (yyvsp[0].String);
2991 (yyval.String) = (yyvsp[-1].String);
2992 ;}
2993 break;
2994
2995 case 104:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002996#line 936 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002997 { (yyval.String) = new std::string(); ;}
2998 break;
2999
3000 case 106:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003001#line 940 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003002 { (yyval.String) = new std::string(); ;}
3003 break;
3004
3005 case 107:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003006#line 941 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003007 {
3008 (yyvsp[-1].String)->insert(0, ", ");
3009 if (!(yyvsp[0].String)->empty())
3010 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3011 delete (yyvsp[0].String);
3012 (yyval.String) = (yyvsp[-1].String);
3013 ;}
3014 break;
3015
3016 case 109:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003017#line 951 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003018 {
3019 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3020 delete (yyvsp[0].String);
3021 (yyval.String) = (yyvsp[-1].String);
3022 ;}
3023 break;
3024
3025 case 127:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003026#line 973 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003027 {
3028 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), OpaqueTy);
3029 ;}
3030 break;
3031
3032 case 128:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003033#line 976 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003034 {
3035 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UnresolvedTy);
3036 ;}
3037 break;
3038
3039 case 129:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003040#line 979 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003041 {
3042 (yyval.Type) = (yyvsp[0].Type);
3043 ;}
3044 break;
3045
3046 case 130:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003047#line 982 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003048 { // Type UpReference
3049 (yyvsp[0].String)->insert(0, "\\");
3050 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UpRefTy);
3051 ;}
3052 break;
3053
3054 case 131:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003055#line 986 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003056 { // Function derived type?
3057 std::string newTy( (yyvsp[-3].Type)->getNewTy() + "(");
3058 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003059 if (i != 0)
3060 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003061 if ((*(yyvsp[-1].TypeVec))[i]->isVoid())
Reid Spencer52402b02007-01-02 05:45:11 +00003062 newTy += "...";
3063 else
Reid Spencer319a7302007-01-05 17:20:02 +00003064 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003065 }
3066 newTy += ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003067 (yyval.Type) = TypeInfo::get(newTy, (yyvsp[-3].Type), (yyvsp[-1].TypeVec));
3068 ;}
3069 break;
3070
3071 case 132:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003072#line 999 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003073 { // Sized array type?
3074 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3075 (yyvsp[-3].String)->insert(0,"[ ");
3076 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " ]";
3077 (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Type), elems);
3078 ;}
3079 break;
3080
3081 case 133:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003082#line 1005 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003083 { // Packed array type?
3084 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3085 (yyvsp[-3].String)->insert(0,"< ");
3086 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " >";
3087 (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), PackedTy, (yyvsp[-1].Type), elems);
3088 ;}
3089 break;
3090
3091 case 134:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003092#line 1011 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003093 { // Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003094 std::string newTy("{");
Reid Spencer319a7302007-01-05 17:20:02 +00003095 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003096 if (i != 0)
3097 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003098 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003099 }
3100 newTy += "}";
Reid Spencer319a7302007-01-05 17:20:02 +00003101 (yyval.Type) = TypeInfo::get(newTy, StructTy, (yyvsp[-1].TypeVec));
3102 ;}
3103 break;
3104
3105 case 135:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003106#line 1021 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003107 { // Empty structure type?
3108 (yyval.Type) = TypeInfo::get("{}", StructTy, new TypeList());
3109 ;}
3110 break;
3111
3112 case 136:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003113#line 1024 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003114 { // Packed Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003115 std::string newTy("<{");
Reid Spencer319a7302007-01-05 17:20:02 +00003116 for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003117 if (i != 0)
3118 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003119 newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003120 }
3121 newTy += "}>";
Reid Spencer319a7302007-01-05 17:20:02 +00003122 (yyval.Type) = TypeInfo::get(newTy, PackedStructTy, (yyvsp[-2].TypeVec));
3123 ;}
3124 break;
3125
3126 case 137:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003127#line 1034 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003128 { // Empty packed structure type?
3129 (yyval.Type) = TypeInfo::get("<{}>", PackedStructTy, new TypeList());
3130 ;}
3131 break;
3132
3133 case 138:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003134#line 1037 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003135 { // Pointer type?
3136 (yyval.Type) = (yyvsp[-1].Type)->getPointerType();
3137 ;}
3138 break;
3139
3140 case 139:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003141#line 1045 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003142 {
3143 (yyval.TypeVec) = new TypeList();
3144 (yyval.TypeVec)->push_back((yyvsp[0].Type));
3145 ;}
3146 break;
3147
3148 case 140:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003149#line 1049 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003150 {
3151 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
3152 (yyval.TypeVec)->push_back((yyvsp[0].Type));
3153 ;}
3154 break;
3155
3156 case 142:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003157#line 1057 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003158 {
3159 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
3160 (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
3161 delete (yyvsp[0].String);
3162 ;}
3163 break;
3164
3165 case 143:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003166#line 1062 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003167 {
3168 (yyval.TypeVec) = new TypeList();
3169 (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
3170 delete (yyvsp[0].String);
3171 ;}
3172 break;
3173
3174 case 144:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003175#line 1067 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003176 {
3177 (yyval.TypeVec) = new TypeList();
3178 ;}
3179 break;
3180
3181 case 145:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003182#line 1077 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003183 { // Nonempty unsized arr
3184 (yyval.Const).type = (yyvsp[-3].Type);
3185 (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3186 *(yyval.Const).cnst += " [ " + *(yyvsp[-1].String) + " ]";
3187 delete (yyvsp[-1].String);
3188 ;}
3189 break;
3190
3191 case 146:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003192#line 1083 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003193 {
3194 (yyval.Const).type = (yyvsp[-2].Type);
3195 (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3196 *(yyval.Const).cnst += "[ ]";
3197 ;}
3198 break;
3199
3200 case 147:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003201#line 1088 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003202 {
3203 (yyval.Const).type = (yyvsp[-2].Type);
3204 (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3205 *(yyval.Const).cnst += " c" + *(yyvsp[0].String);
3206 delete (yyvsp[0].String);
3207 ;}
3208 break;
3209
3210 case 148:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003211#line 1094 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003212 { // Nonempty unsized arr
3213 (yyval.Const).type = (yyvsp[-3].Type);
3214 (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3215 *(yyval.Const).cnst += " < " + *(yyvsp[-1].String) + " >";
3216 delete (yyvsp[-1].String);
3217 ;}
3218 break;
3219
3220 case 149:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003221#line 1100 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003222 {
3223 (yyval.Const).type = (yyvsp[-3].Type);
3224 (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3225 *(yyval.Const).cnst += " { " + *(yyvsp[-1].String) + " }";
3226 delete (yyvsp[-1].String);
3227 ;}
3228 break;
3229
3230 case 150:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003231#line 1106 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003232 {
3233 (yyval.Const).type = (yyvsp[-2].Type);
3234 (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3235 *(yyval.Const).cnst += " {}";
3236 ;}
3237 break;
3238
3239 case 151:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003240#line 1111 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003241 {
3242 (yyval.Const).type = (yyvsp[-1].Type);
3243 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3244 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3245 delete (yyvsp[0].String);
3246 ;}
3247 break;
3248
3249 case 152:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003250#line 1117 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003251 {
3252 (yyval.Const).type = (yyvsp[-1].Type);
3253 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3254 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3255 delete (yyvsp[0].String);
3256 ;}
3257 break;
3258
3259 case 153:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003260#line 1123 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003261 {
3262 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve(), true);
3263 (yyval.Const).type = (yyvsp[-1].Type);
3264 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3265 *(yyval.Const).cnst += " " + Name;
3266 delete (yyvsp[0].String);
3267 ;}
3268 break;
3269
3270 case 154:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003271#line 1130 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003272 {
3273 (yyval.Const).type = (yyvsp[-1].Type);
3274 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3275 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3276 delete (yyvsp[0].String);
3277 ;}
3278 break;
3279
3280 case 155:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003281#line 1136 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003282 {
3283 (yyval.Const).type = (yyvsp[-1].Type);
3284 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3285 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3286 delete (yyvsp[0].String);
3287 ;}
3288 break;
3289
3290 case 156:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003291#line 1142 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003292 { // integral constants
3293 (yyval.Const).type = (yyvsp[-1].Type);
3294 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3295 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3296 delete (yyvsp[0].String);
3297 ;}
3298 break;
3299
3300 case 157:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003301#line 1148 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003302 { // integral constants
3303 (yyval.Const).type = (yyvsp[-1].Type);
3304 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3305 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3306 delete (yyvsp[0].String);
3307 ;}
3308 break;
3309
3310 case 158:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003311#line 1154 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003312 { // Boolean constants
3313 (yyval.Const).type = (yyvsp[-1].Type);
3314 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3315 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3316 delete (yyvsp[0].String);
3317 ;}
3318 break;
3319
3320 case 159:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003321#line 1160 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003322 { // Boolean constants
3323 (yyval.Const).type = (yyvsp[-1].Type);
3324 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3325 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3326 delete (yyvsp[0].String);
3327 ;}
3328 break;
3329
3330 case 160:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003331#line 1166 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003332 { // Float & Double constants
3333 (yyval.Const).type = (yyvsp[-1].Type);
3334 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3335 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3336 delete (yyvsp[0].String);
3337 ;}
3338 break;
3339
3340 case 161:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003341#line 1174 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003342 {
3343 std::string source = *(yyvsp[-3].Const).cnst;
3344 const TypeInfo* SrcTy = (yyvsp[-3].Const).type->resolve();
3345 const TypeInfo* DstTy = (yyvsp[-1].Type)->resolve();
3346 if (*(yyvsp[-5].String) == "cast") {
Reid Spencera50d5962006-12-02 04:11:07 +00003347 // Call getCastUpgrade to upgrade the old cast
Reid Spencer319a7302007-01-05 17:20:02 +00003348 (yyval.String) = new std::string(getCastUpgrade(source, SrcTy, DstTy, true));
Reid Spencera50d5962006-12-02 04:11:07 +00003349 } else {
3350 // Nothing to upgrade, just create the cast constant expr
Reid Spencer319a7302007-01-05 17:20:02 +00003351 (yyval.String) = new std::string(*(yyvsp[-5].String));
3352 *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Type)->getNewTy() + ")";
Reid Spencer280d8012006-12-01 23:40:53 +00003353 }
Reid Spencer319a7302007-01-05 17:20:02 +00003354 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String);
3355 ;}
3356 break;
3357
3358 case 162:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003359#line 1188 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003360 {
3361 *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst;
3362 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
3363 ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
3364 *(yyvsp[-4].String) += ", " + *VI.val;
Reid Spencerf8483652006-12-02 15:16:01 +00003365 VI.destroy();
3366 }
Reid Spencer319a7302007-01-05 17:20:02 +00003367 *(yyvsp[-4].String) += ")";
3368 (yyval.String) = (yyvsp[-4].String);
3369 (yyvsp[-2].Const).destroy();
3370 delete (yyvsp[-1].ValList);
3371 ;}
3372 break;
3373
3374 case 163:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003375#line 1200 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003376 {
3377 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3378 (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3379 (yyval.String) = (yyvsp[-7].String);
3380 ;}
3381 break;
3382
3383 case 164:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003384#line 1205 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003385 {
3386 const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
3387 (yyval.String) = new std::string(op);
3388 *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3389 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3390 ;}
3391 break;
3392
3393 case 165:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003394#line 1211 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003395 {
3396 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3397 (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3398 (yyval.String) = (yyvsp[-5].String);
3399 ;}
3400 break;
3401
3402 case 166:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003403#line 1216 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003404 {
3405 *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
3406 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3407 (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3408 (yyval.String) = (yyvsp[-5].String);
3409 ;}
3410 break;
3411
3412 case 167:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003413#line 1222 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003414 {
Reid Spencera7c46fa2007-01-06 00:23:53 +00003415 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003416 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3417 (yyval.String) = (yyvsp[-6].String);
3418 ;}
3419 break;
3420
3421 case 168:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003422#line 1227 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003423 {
Reid Spencera7c46fa2007-01-06 00:23:53 +00003424 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003425 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3426 (yyval.String) = (yyvsp[-6].String);
3427 ;}
3428 break;
3429
3430 case 169:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003431#line 1232 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003432 {
3433 const char* shiftop = (yyvsp[-5].String)->c_str();
3434 if (*(yyvsp[-5].String) == "shr")
3435 shiftop = ((yyvsp[-3].Const).type->isUnsigned()) ? "lshr" : "ashr";
3436 (yyval.String) = new std::string(shiftop);
3437 *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3438 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3439 ;}
3440 break;
3441
3442 case 170:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003443#line 1240 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003444 {
3445 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3446 (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3447 (yyval.String) = (yyvsp[-5].String);
3448 ;}
3449 break;
3450
3451 case 171:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003452#line 1245 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003453 {
3454 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3455 (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3456 (yyval.String) = (yyvsp[-7].String);
3457 ;}
3458 break;
3459
3460 case 172:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003461#line 1250 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003462 {
3463 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3464 (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3465 (yyval.String) = (yyvsp[-7].String);
3466 ;}
3467 break;
3468
3469 case 173:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003470#line 1260 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003471 {
3472 *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst;
3473 (yyvsp[0].Const).destroy();
3474 (yyval.String) = (yyvsp[-2].String);
3475 ;}
3476 break;
3477
3478 case 174:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003479#line 1265 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003480 { (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;}
3481 break;
3482
3483 case 177:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003484#line 1280 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003485 {
3486;}
3487 break;
3488
3489 case 178:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003490#line 1285 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003491 {
3492 (yyval.String) = 0;
3493 ;}
3494 break;
3495
3496 case 179:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003497#line 1288 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003498 {
3499 *O << *(yyvsp[0].String) << '\n';
3500 delete (yyvsp[0].String);
3501 (yyval.String) = 0;
3502 ;}
3503 break;
3504
3505 case 180:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003506#line 1293 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003507 {
3508 *O << "module asm " << ' ' << *(yyvsp[0].String) << '\n';
3509 (yyval.String) = 0;
3510 ;}
3511 break;
3512
3513 case 181:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003514#line 1297 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003515 {
Reid Spencerd154b572006-12-01 20:36:40 +00003516 *O << "implementation\n";
Reid Spencer319a7302007-01-05 17:20:02 +00003517 (yyval.String) = 0;
3518 ;}
3519 break;
3520
3521 case 182:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003522#line 1301 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003523 { (yyval.String) = 0; ;}
3524 break;
3525
3526 case 184:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003527#line 1303 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003528 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
3529 break;
3530
3531 case 185:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003532#line 1306 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003533 {
3534 EnumeratedTypes.push_back((yyvsp[0].Type));
3535 if (!(yyvsp[-2].String)->empty()) {
3536 NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Type);
3537 *O << *(yyvsp[-2].String) << " = ";
Reid Spencera50d5962006-12-02 04:11:07 +00003538 }
Reid Spencer319a7302007-01-05 17:20:02 +00003539 *O << "type " << (yyvsp[0].Type)->getNewTy() << '\n';
3540 delete (yyvsp[-2].String); delete (yyvsp[-1].String);
3541 (yyval.String) = 0;
3542 ;}
3543 break;
3544
3545 case 186:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003546#line 1316 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003547 { // Function prototypes can be in const pool
3548 *O << *(yyvsp[0].String) << '\n';
3549 delete (yyvsp[0].String);
3550 (yyval.String) = 0;
3551 ;}
3552 break;
3553
3554 case 187:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003555#line 1321 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003556 { // Asm blocks can be in the const pool
3557 *O << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3558 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3559 (yyval.String) = 0;
3560 ;}
3561 break;
3562
3563 case 188:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003564#line 1326 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003565 {
3566 if (!(yyvsp[-4].String)->empty()) {
3567 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const).type->getPointerType(),
3568 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003569 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003570 }
Reid Spencer319a7302007-01-05 17:20:02 +00003571 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const).cnst << ' ' << *(yyvsp[0].String) << '\n';
3572 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3573 (yyval.String) = 0;
3574 ;}
3575 break;
3576
3577 case 189:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003578#line 1336 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003579 {
3580 if (!(yyvsp[-4].String)->empty()) {
3581 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3582 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003583 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003584 }
Reid Spencer319a7302007-01-05 17:20:02 +00003585 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3586 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3587 (yyval.String) = 0;
3588 ;}
3589 break;
3590
3591 case 190:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003592#line 1346 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003593 {
3594 if (!(yyvsp[-4].String)->empty()) {
3595 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3596 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003597 *O << Name << " = ";
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003598 }
Reid Spencer319a7302007-01-05 17:20:02 +00003599 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3600 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3601 (yyval.String) = 0;
3602 ;}
3603 break;
3604
3605 case 191:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003606#line 1356 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003607 {
3608 if (!(yyvsp[-4].String)->empty()) {
3609 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3610 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003611 *O << Name << " = ";
Reid Spencerf5626a32007-01-01 01:20:41 +00003612 }
Reid Spencer319a7302007-01-05 17:20:02 +00003613 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3614 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3615 (yyval.String) = 0;
3616 ;}
3617 break;
3618
3619 case 192:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003620#line 1366 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003621 {
3622 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3623 delete (yyvsp[-1].String); delete (yyvsp[0].String);
3624 (yyval.String) = 0;
3625 ;}
3626 break;
3627
3628 case 193:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003629#line 1371 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003630 {
3631 *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n';
3632 delete (yyvsp[-2].String); delete (yyvsp[0].String);
3633 (yyval.String) = 0;
3634 ;}
3635 break;
3636
3637 case 194:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003638#line 1376 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003639 {
3640 (yyval.String) = 0;
3641 ;}
3642 break;
3643
3644 case 198:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003645#line 1386 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003646 {
3647 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3648 delete (yyvsp[0].String);
3649 (yyval.String) = (yyvsp[-2].String);
3650 ;}
3651 break;
3652
3653 case 199:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003654#line 1391 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003655 {
3656 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3657 if (*(yyvsp[0].String) == "64")
Reid Spencere77e35e2006-12-01 20:26:20 +00003658 SizeOfPointer = 64;
Reid Spencer319a7302007-01-05 17:20:02 +00003659 delete (yyvsp[0].String);
3660 (yyval.String) = (yyvsp[-2].String);
3661 ;}
3662 break;
3663
3664 case 200:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003665#line 1398 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003666 {
3667 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3668 delete (yyvsp[0].String);
3669 (yyval.String) = (yyvsp[-2].String);
3670 ;}
3671 break;
3672
3673 case 201:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003674#line 1403 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003675 {
3676 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3677 delete (yyvsp[0].String);
3678 (yyval.String) = (yyvsp[-2].String);
3679 ;}
3680 break;
3681
3682 case 202:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003683#line 1410 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003684 {
3685 (yyvsp[-1].String)->insert(0, "[ ");
3686 *(yyvsp[-1].String) += " ]";
3687 (yyval.String) = (yyvsp[-1].String);
3688 ;}
3689 break;
3690
3691 case 203:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003692#line 1417 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003693 {
3694 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3695 delete (yyvsp[0].String);
3696 (yyval.String) = (yyvsp[-2].String);
3697 ;}
3698 break;
3699
3700 case 205:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003701#line 1423 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003702 {
3703 (yyval.String) = new std::string();
3704 ;}
3705 break;
3706
3707 case 209:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003708#line 1432 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003709 { (yyval.String) = new std::string(); ;}
3710 break;
3711
3712 case 210:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003713#line 1434 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003714 {
3715 (yyval.String) = new std::string((yyvsp[-1].Type)->getNewTy());
3716 if (!(yyvsp[0].String)->empty()) {
3717 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve());
3718 *(yyval.String) += " " + Name;
Reid Spencer52402b02007-01-02 05:45:11 +00003719 }
Reid Spencer319a7302007-01-05 17:20:02 +00003720 delete (yyvsp[0].String);
3721;}
3722 break;
3723
3724 case 211:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003725#line 1443 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003726 {
3727 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3728 delete (yyvsp[0].String);
3729 ;}
3730 break;
3731
3732 case 212:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003733#line 1447 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003734 {
3735 (yyval.String) = (yyvsp[0].String);
3736 ;}
3737 break;
3738
3739 case 213:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003740#line 1451 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003741 {
3742 (yyval.String) = (yyvsp[0].String);
3743 ;}
3744 break;
3745
3746 case 214:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003747#line 1454 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003748 {
3749 *(yyvsp[-2].String) += ", ...";
3750 (yyval.String) = (yyvsp[-2].String);
3751 delete (yyvsp[0].String);
3752 ;}
3753 break;
3754
3755 case 215:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003756#line 1459 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003757 {
3758 (yyval.String) = (yyvsp[0].String);
3759 ;}
3760 break;
3761
3762 case 216:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003763#line 1462 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003764 { (yyval.String) = new std::string(); ;}
3765 break;
3766
3767 case 217:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003768#line 1465 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003769 {
3770 if (!(yyvsp[-7].String)->empty()) {
3771 *(yyvsp[-7].String) += " ";
Reid Spencere77e35e2006-12-01 20:26:20 +00003772 }
Reid Spencer319a7302007-01-05 17:20:02 +00003773 *(yyvsp[-7].String) += (yyvsp[-6].Type)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
3774 if (!(yyvsp[-1].String)->empty()) {
3775 *(yyvsp[-7].String) += " " + *(yyvsp[-1].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003776 }
Reid Spencer319a7302007-01-05 17:20:02 +00003777 if (!(yyvsp[0].String)->empty()) {
3778 *(yyvsp[-7].String) += " " + *(yyvsp[0].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003779 }
Reid Spencer319a7302007-01-05 17:20:02 +00003780 delete (yyvsp[-5].String);
3781 delete (yyvsp[-3].String);
3782 delete (yyvsp[-1].String);
3783 delete (yyvsp[0].String);
3784 (yyval.String) = (yyvsp[-7].String);
3785 ;}
3786 break;
3787
3788 case 218:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003789#line 1483 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003790 { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
3791 break;
3792
3793 case 219:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003794#line 1484 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003795 { (yyval.String) = new std::string ("{"); ;}
3796 break;
3797
3798 case 220:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003799#line 1487 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003800 {
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003801 *O << "define ";
Reid Spencer319a7302007-01-05 17:20:02 +00003802 if (!(yyvsp[-2].String)->empty()) {
3803 *O << *(yyvsp[-2].String) << ' ';
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003804 }
Reid Spencer319a7302007-01-05 17:20:02 +00003805 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3806 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3807 (yyval.String) = 0;
3808 ;}
3809 break;
3810
3811 case 221:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003812#line 1498 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003813 { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
3814 break;
3815
3816 case 222:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003817#line 1499 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003818 { (yyval.String) = new std::string("}"); ;}
3819 break;
3820
3821 case 223:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003822#line 1501 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003823 {
3824 if ((yyvsp[-1].String))
3825 *O << *(yyvsp[-1].String);
3826 *O << *(yyvsp[0].String) << "\n\n";
3827 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3828 (yyval.String) = 0;
3829;}
3830 break;
3831
3832 case 224:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003833#line 1510 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003834 { (yyval.String) = new std::string(); ;}
3835 break;
3836
3837 case 227:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003838#line 1516 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003839 {
3840 if (!(yyvsp[-1].String)->empty())
3841 *(yyvsp[-2].String) += " " + *(yyvsp[-1].String);
3842 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
3843 delete (yyvsp[-1].String);
3844 delete (yyvsp[0].String);
3845 (yyval.String) = (yyvsp[-2].String);
3846 ;}
3847 break;
3848
3849 case 228:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003850#line 1529 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003851 { (yyval.String) = new std::string(); ;}
3852 break;
3853
3854 case 238:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003855#line 1535 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003856 {
3857 (yyvsp[-1].String)->insert(0, "<");
3858 *(yyvsp[-1].String) += ">";
3859 (yyval.String) = (yyvsp[-1].String);
3860 ;}
3861 break;
3862
3863 case 240:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003864#line 1541 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003865 {
3866 if (!(yyvsp[-3].String)->empty()) {
3867 *(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003868 }
Reid Spencer319a7302007-01-05 17:20:02 +00003869 *(yyvsp[-4].String) += " " + *(yyvsp[-2].String) + ", " + *(yyvsp[0].String);
3870 delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3871 (yyval.String) = (yyvsp[-4].String);
3872 ;}
3873 break;
3874
3875 case 243:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003876#line 1554 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003877 {
3878 (yyval.Value).val = (yyvsp[0].String);
3879 (yyval.Value).constant = false;
3880 (yyval.Value).type = 0;
3881 ;}
3882 break;
3883
3884 case 244:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003885#line 1559 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003886 {
3887 (yyval.Value).val = (yyvsp[0].String);
3888 (yyval.Value).constant = true;
3889 (yyval.Value).type = 0;
3890 ;}
3891 break;
3892
3893 case 245:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003894#line 1569 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003895 {
3896 (yyvsp[-1].Type) = (yyvsp[-1].Type)->resolve();
3897 std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
3898 (yyval.Value) = (yyvsp[0].Value);
3899 delete (yyval.Value).val;
3900 (yyval.Value).val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name);
3901 (yyval.Value).type = (yyvsp[-1].Type);
3902 ;}
3903 break;
3904
3905 case 246:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003906#line 1578 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003907 {
3908 (yyval.String) = 0;
3909 ;}
3910 break;
3911
3912 case 247:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003913#line 1581 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003914 { // Do not allow functions with 0 basic blocks
3915 (yyval.String) = 0;
3916 ;}
3917 break;
3918
3919 case 248:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003920#line 1589 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003921 {
3922 (yyval.String) = 0;
3923 ;}
3924 break;
3925
3926 case 249:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003927#line 1593 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003928 {
3929 *O << " " << *(yyvsp[0].String) << '\n';
3930 delete (yyvsp[0].String);
3931 (yyval.String) = 0;
3932 ;}
3933 break;
3934
3935 case 250:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003936#line 1598 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003937 {
3938 (yyval.String) = 0;
3939 ;}
3940 break;
3941
3942 case 251:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003943#line 1601 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003944 {
3945 *O << *(yyvsp[0].String) << '\n';
3946 delete (yyvsp[0].String);
3947 (yyval.String) = 0;
3948 ;}
3949 break;
3950
3951 case 253:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003952#line 1607 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003953 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
3954 break;
3955
3956 case 254:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003957#line 1609 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003958 { // Return with a result...
3959 *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Value).val << '\n';
3960 delete (yyvsp[-1].String); (yyvsp[0].Value).destroy();
3961 (yyval.String) = 0;
3962 ;}
3963 break;
3964
3965 case 255:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003966#line 1614 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003967 { // Return with no result...
3968 *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Type)->getNewTy() << '\n';
3969 delete (yyvsp[-1].String);
3970 (yyval.String) = 0;
3971 ;}
3972 break;
3973
3974 case 256:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003975#line 1619 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003976 { // Unconditional Branch...
3977 *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
3978 delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
3979 (yyval.String) = 0;
3980 ;}
3981 break;
3982
3983 case 257:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003984#line 1624 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003985 {
3986 std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type));
3987 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", "
3988 << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ", " << (yyvsp[-1].Type)->getNewTy() << ' '
3989 << *(yyvsp[0].Value).val << '\n';
3990 delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy();
3991 (yyval.String) = 0;
3992 ;}
3993 break;
3994
3995 case 258:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003996#line 1632 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003997 {
3998 std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type));
3999 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", "
4000 << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n";
4001 delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy();
4002 delete (yyvsp[-1].String);
4003 (yyval.String) = 0;
4004 ;}
4005 break;
4006
4007 case 259:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004008#line 1640 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004009 {
4010 std::string Name = getUniqueName((yyvsp[-5].Value).val, (yyvsp[-6].Type));
4011 *O << " " << *(yyvsp[-7].String) << ' ' << (yyvsp[-6].Type)->getNewTy() << ' ' << Name << ", "
4012 << (yyvsp[-3].Type)->getNewTy() << ' ' << *(yyvsp[-2].Value).val << "[]\n";
4013 delete (yyvsp[-7].String); (yyvsp[-5].Value).destroy(); (yyvsp[-2].Value).destroy();
4014 (yyval.String) = 0;
4015 ;}
4016 break;
4017
4018 case 260:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004019#line 1648 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004020 {
4021 const TypeInfo* ResTy = getFunctionReturnType((yyvsp[-10].Type));
Reid Spencer16244f42006-12-01 21:10:07 +00004022 *O << " ";
Reid Spencer319a7302007-01-05 17:20:02 +00004023 if (!(yyvsp[-13].String)->empty()) {
4024 std::string Name = getUniqueName((yyvsp[-13].String), ResTy);
Reid Spencer52402b02007-01-02 05:45:11 +00004025 *O << Name << " = ";
4026 }
Reid Spencer319a7302007-01-05 17:20:02 +00004027 *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Type)->getNewTy() << ' ' << *(yyvsp[-9].Value).val << " (";
4028 for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) {
4029 ValueInfo& VI = (*(yyvsp[-7].ValList))[i];
Reid Spencerf8483652006-12-02 15:16:01 +00004030 *O << *VI.val;
Reid Spencer319a7302007-01-05 17:20:02 +00004031 if (i+1 < (yyvsp[-7].ValList)->size())
Reid Spencerf8483652006-12-02 15:16:01 +00004032 *O << ", ";
4033 VI.destroy();
4034 }
Reid Spencer319a7302007-01-05 17:20:02 +00004035 *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ' '
4036 << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
4037 delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList);
4038 delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
4039 (yyval.String) = 0;
4040 ;}
4041 break;
4042
4043 case 261:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004044#line 1669 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004045 {
4046 *O << " " << *(yyvsp[0].String) << '\n';
4047 delete (yyvsp[0].String);
4048 (yyval.String) = 0;
4049 ;}
4050 break;
4051
4052 case 262:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004053#line 1674 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004054 {
4055 *O << " " << *(yyvsp[0].String) << '\n';
4056 delete (yyvsp[0].String);
4057 (yyval.String) = 0;
4058 ;}
4059 break;
4060
4061 case 263:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004062#line 1680 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004063 {
4064 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Type)->getNewTy() + " " +
4065 *(yyvsp[0].Value).val;
4066 delete (yyvsp[-3].String); (yyvsp[0].Value).destroy();
4067 (yyval.String) = (yyvsp[-5].String);
4068 ;}
4069 break;
4070
4071 case 264:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004072#line 1686 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004073 {
4074 (yyvsp[-3].String)->insert(0, (yyvsp[-4].Type)->getNewTy() + " " );
4075 *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value).val;
4076 (yyvsp[0].Value).destroy();
4077 (yyval.String) = (yyvsp[-3].String);
4078 ;}
4079 break;
4080
4081 case 265:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004082#line 1694 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004083 {
4084 if (!(yyvsp[-1].String)->empty()) {
4085 // Get a unique name for this value, based on its type.
4086 std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value).type);
4087 *(yyvsp[-1].String) = Name + " = ";
4088 if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
4089 // don't actually delete it, just comment it out
4090 (yyvsp[-1].String)->insert(0, "; USELSS BITCAST: ");
Reid Spencerf5626a32007-01-01 01:20:41 +00004091 delete deleteUselessCastName;
Reid Spencerf5626a32007-01-01 01:20:41 +00004092 }
4093 }
Reid Spencer319a7302007-01-05 17:20:02 +00004094 *(yyvsp[-1].String) += *(yyvsp[0].Value).val;
4095 (yyvsp[0].Value).destroy();
Reid Spencerf5626a32007-01-01 01:20:41 +00004096 deleteUselessCastFlag = false;
Reid Spencer319a7302007-01-05 17:20:02 +00004097 (yyval.String) = (yyvsp[-1].String);
4098 ;}
4099 break;
4100
4101 case 266:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004102#line 1712 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004103 { // Used for PHI nodes
4104 std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-5].Type));
4105 Name.insert(0, (yyvsp[-5].Type)->getNewTy() + "[");
4106 Name += "," + *(yyvsp[-1].Value).val + "]";
4107 (yyval.Value).val = new std::string(Name);
4108 (yyval.Value).type = (yyvsp[-5].Type);
4109 (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
4110 ;}
4111 break;
4112
4113 case 267:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004114#line 1720 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004115 {
4116 std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-6].Value).type);
4117 *(yyvsp[-6].Value).val += ", [" + Name + "," + *(yyvsp[-1].Value).val + "]";
4118 (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
4119 (yyval.Value) = (yyvsp[-6].Value);
4120 ;}
4121 break;
4122
4123 case 268:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004124#line 1729 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004125 {
4126 (yyval.ValList) = new ValueList();
4127 (yyval.ValList)->push_back((yyvsp[0].Value));
4128 ;}
4129 break;
4130
4131 case 269:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004132#line 1733 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004133 {
4134 (yyval.ValList) = (yyvsp[-2].ValList);
4135 (yyval.ValList)->push_back((yyvsp[0].Value));
4136 ;}
4137 break;
4138
4139 case 270:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004140#line 1740 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004141 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4142 break;
4143
4144 case 271:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004145#line 1741 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004146 { (yyval.ValList) = new ValueList(); ;}
4147 break;
4148
4149 case 272:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004150#line 1745 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004151 {
4152 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
4153 delete (yyvsp[0].String);
4154 (yyval.String) = (yyvsp[-1].String);
4155 ;}
4156 break;
4157
4158 case 274:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004159#line 1753 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004160 {
4161 const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type));
4162 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4163 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4164 (yyval.Value).val = new std::string(op);
4165 *(yyval.Value).val += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
4166 (yyval.Value).type = (yyvsp[-3].Type);
4167 delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4168 ;}
4169 break;
4170
4171 case 275:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004172#line 1762 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004173 {
4174 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4175 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4176 *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
4177 (yyval.Value).val = (yyvsp[-4].String);
4178 (yyval.Value).type = (yyvsp[-3].Type);
4179 (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4180 ;}
4181 break;
4182
4183 case 276:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004184#line 1770 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004185 {
4186 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4187 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4188 *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
4189 *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
4190 (yyval.Value).val = (yyvsp[-4].String);
4191 (yyval.Value).type = TypeInfo::get("bool",BoolTy);
4192 (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4193 ;}
4194 break;
4195
4196 case 277:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004197#line 1779 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004198 {
4199 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4200 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4201 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
4202 (yyval.Value).val = (yyvsp[-5].String);
4203 (yyval.Value).type = TypeInfo::get("bool",BoolTy);
4204 delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4205 ;}
4206 break;
4207
4208 case 278:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004209#line 1787 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004210 {
4211 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4212 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4213 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
4214 (yyval.Value).val = (yyvsp[-5].String);
4215 (yyval.Value).type = TypeInfo::get("bool",BoolTy);
4216 delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4217 ;}
4218 break;
4219
4220 case 279:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004221#line 1795 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004222 {
4223 const char* shiftop = (yyvsp[-3].String)->c_str();
4224 if (*(yyvsp[-3].String) == "shr")
4225 shiftop = ((yyvsp[-2].Value).type->isUnsigned()) ? "lshr" : "ashr";
4226 (yyval.Value).val = new std::string(shiftop);
4227 *(yyval.Value).val += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4228 (yyval.Value).type = (yyvsp[-2].Value).type;
Reid Spencerf8383de2007-01-06 06:04:32 +00004229 delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004230 ;}
4231 break;
4232
Reid Spencer609ca3e2007-01-12 20:10:51 +00004233 case 280:
4234#line 1804 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004235 {
4236 std::string source = *(yyvsp[-2].Value).val;
4237 const TypeInfo* SrcTy = (yyvsp[-2].Value).type->resolve();
4238 const TypeInfo* DstTy = (yyvsp[0].Type)->resolve();
4239 (yyval.Value).val = new std::string();
4240 (yyval.Value).type = DstTy;
4241 if (*(yyvsp[-3].String) == "cast") {
4242 *(yyval.Value).val += getCastUpgrade(source, SrcTy, DstTy, false);
Reid Spencera50d5962006-12-02 04:11:07 +00004243 } else {
Reid Spencer319a7302007-01-05 17:20:02 +00004244 *(yyval.Value).val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
Reid Spencer280d8012006-12-01 23:40:53 +00004245 }
Reid Spencerf5626a32007-01-01 01:20:41 +00004246 // Check to see if this is a useless cast of a value to the same name
4247 // and the same type. Such casts will probably cause redefinition errors
4248 // when assembled and perform no code gen action so just remove them.
Reid Spencer319a7302007-01-05 17:20:02 +00004249 if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast")
4250 if (SrcTy->isInteger() && DstTy->isInteger() &&
4251 SrcTy->getBitWidth() == DstTy->getBitWidth()) {
Reid Spencerf5626a32007-01-01 01:20:41 +00004252 deleteUselessCastFlag = true; // Flag the "Inst" rule
Reid Spencer319a7302007-01-05 17:20:02 +00004253 deleteUselessCastName = new std::string(*(yyvsp[-2].Value).val); // save the name
Reid Spencerf5626a32007-01-01 01:20:41 +00004254 size_t pos = deleteUselessCastName->find_first_of("%\"",0);
4255 if (pos != std::string::npos) {
4256 // remove the type portion before val
4257 deleteUselessCastName->erase(0, pos);
4258 }
4259 }
Reid Spencer319a7302007-01-05 17:20:02 +00004260 delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy();
4261 delete (yyvsp[-1].String);
4262 ;}
4263 break;
4264
Reid Spencer609ca3e2007-01-12 20:10:51 +00004265 case 281:
4266#line 1832 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004267 {
4268 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4269 (yyval.Value).val = (yyvsp[-5].String);
4270 (yyval.Value).type = (yyvsp[-2].Value).type;
Reid Spencerf8383de2007-01-06 06:04:32 +00004271 (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004272 ;}
4273 break;
4274
Reid Spencer609ca3e2007-01-12 20:10:51 +00004275 case 282:
4276#line 1838 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004277 {
4278 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + (yyvsp[0].Type)->getNewTy();
4279 (yyval.Value).val = (yyvsp[-3].String);
4280 (yyval.Value).type = (yyvsp[0].Type);
4281 (yyvsp[-2].Value).destroy();
4282 ;}
4283 break;
4284
Reid Spencer609ca3e2007-01-12 20:10:51 +00004285 case 283:
4286#line 1844 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004287 {
4288 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4289 (yyval.Value).val = (yyvsp[-3].String);
4290 (yyvsp[-2].Value).type = (yyvsp[-2].Value).type->resolve();;
4291 (yyval.Value).type = (yyvsp[-2].Value).type->getElementType();
Reid Spencerf8383de2007-01-06 06:04:32 +00004292 (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004293 ;}
4294 break;
4295
Reid Spencer609ca3e2007-01-12 20:10:51 +00004296 case 284:
4297#line 1851 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
4298 {
4299 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4300 (yyval.Value).val = (yyvsp[-5].String);
4301 (yyval.Value).type = (yyvsp[-4].Value).type;
4302 (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4303 ;}
4304 break;
4305
Reid Spencer319a7302007-01-05 17:20:02 +00004306 case 285:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004307#line 1857 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004308 {
4309 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4310 (yyval.Value).val = (yyvsp[-5].String);
4311 (yyval.Value).type = (yyvsp[-4].Value).type;
Reid Spencerf8383de2007-01-06 06:04:32 +00004312 (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004313 ;}
4314 break;
4315
4316 case 286:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004317#line 1863 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004318 {
4319 *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
4320 (yyval.Value).val = (yyvsp[-1].String);
4321 (yyval.Value).type = (yyvsp[0].Value).type;
4322 delete (yyvsp[0].Value).val;
4323 ;}
4324 break;
4325
Reid Spencer609ca3e2007-01-12 20:10:51 +00004326 case 287:
4327#line 1869 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004328 {
Reid Spencer12969882007-01-07 08:07:39 +00004329 // map llvm.isunordered to "fcmp uno"
4330 if (*(yyvsp[-3].Value).val == "%llvm.isunordered.f32" ||
4331 *(yyvsp[-3].Value).val == "%llvm.isunordered.f64") {
4332 (yyval.Value).val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0].val + ", ");
4333 size_t pos = (*(yyvsp[-1].ValList))[1].val->find(' ');
4334 assert(pos != std::string::npos && "no space?");
4335 *(yyval.Value).val += (*(yyvsp[-1].ValList))[1].val->substr(pos+1);
4336 (yyval.Value).type = TypeInfo::get("bool", BoolTy);
4337 } else {
4338 if (!(yyvsp[-5].String)->empty())
4339 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
4340 if (!(yyvsp[-6].String)->empty())
4341 *(yyvsp[-6].String) += " ";
4342 *(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].Value).val + "(";
4343 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
4344 ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
4345 *(yyvsp[-6].String) += *VI.val;
4346 if (i+1 < (yyvsp[-1].ValList)->size())
4347 *(yyvsp[-6].String) += ", ";
4348 VI.destroy();
4349 }
4350 *(yyvsp[-6].String) += ")";
4351 (yyval.Value).val = (yyvsp[-6].String);
4352 (yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type));
Reid Spencerf8483652006-12-02 15:16:01 +00004353 }
Reid Spencer319a7302007-01-05 17:20:02 +00004354 delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList);
4355 ;}
4356 break;
4357
Reid Spencer609ca3e2007-01-12 20:10:51 +00004358 case 289:
4359#line 1902 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004360 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4361 break;
4362
Reid Spencer609ca3e2007-01-12 20:10:51 +00004363 case 290:
4364#line 1903 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004365 { (yyval.ValList) = new ValueList(); ;}
4366 break;
4367
Reid Spencer609ca3e2007-01-12 20:10:51 +00004368 case 292:
4369#line 1908 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004370 { (yyval.String) = new std::string(); ;}
4371 break;
4372
Reid Spencer609ca3e2007-01-12 20:10:51 +00004373 case 293:
4374#line 1911 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004375 {
4376 *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
4377 if (!(yyvsp[0].String)->empty())
4378 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
4379 (yyval.Value).val = (yyvsp[-2].String);
4380 (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
4381 delete (yyvsp[0].String);
4382 ;}
4383 break;
4384
Reid Spencer609ca3e2007-01-12 20:10:51 +00004385 case 294:
4386#line 1919 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
4387 {
4388 std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
4389 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4390 if (!(yyvsp[0].String)->empty())
4391 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
4392 (yyval.Value).val = (yyvsp[-5].String);
4393 (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
4394 (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
4395 ;}
4396 break;
4397
Reid Spencer319a7302007-01-05 17:20:02 +00004398 case 295:
Reid Spencer609ca3e2007-01-12 20:10:51 +00004399#line 1928 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004400 {
4401 *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
4402 if (!(yyvsp[0].String)->empty())
4403 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
4404 (yyval.Value).val = (yyvsp[-2].String);
4405 (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
4406 delete (yyvsp[0].String);
4407 ;}
4408 break;
4409
Reid Spencer609ca3e2007-01-12 20:10:51 +00004410 case 296:
4411#line 1936 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004412 {
4413 std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
4414 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4415 if (!(yyvsp[0].String)->empty())
4416 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
4417 (yyval.Value).val = (yyvsp[-5].String);
4418 (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
4419 (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
4420 ;}
4421 break;
4422
Reid Spencer609ca3e2007-01-12 20:10:51 +00004423 case 297:
4424#line 1945 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004425 {
4426 *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
4427 (yyval.Value).val = (yyvsp[-1].String);
4428 (yyval.Value).type = TypeInfo::get("void", VoidTy);
4429 (yyvsp[0].Value).destroy();
4430 ;}
4431 break;
4432
Reid Spencer609ca3e2007-01-12 20:10:51 +00004433 case 298:
4434#line 1951 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004435 {
4436 std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
4437 if (!(yyvsp[-3].String)->empty())
4438 *(yyvsp[-3].String) += " ";
4439 *(yyvsp[-3].String) += *(yyvsp[-2].String) + " " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
4440 (yyval.Value).val = (yyvsp[-3].String);
4441 (yyval.Value).type = (yyvsp[-1].Type)->getElementType();
4442 delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
4443 ;}
4444 break;
4445
Reid Spencer609ca3e2007-01-12 20:10:51 +00004446 case 299:
4447#line 1960 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004448 {
4449 std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
4450 if (!(yyvsp[-5].String)->empty())
4451 *(yyvsp[-5].String) += " ";
4452 *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Value).val + ", " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
4453 (yyval.Value).val = (yyvsp[-5].String);
4454 (yyval.Value).type = TypeInfo::get("void", VoidTy);
4455 delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy();
4456 ;}
4457 break;
4458
Reid Spencer609ca3e2007-01-12 20:10:51 +00004459 case 300:
4460#line 1969 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004461 {
4462 std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
Reid Spencerf459d392006-12-02 16:19:52 +00004463 // Upgrade the indices
Reid Spencer319a7302007-01-05 17:20:02 +00004464 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
4465 ValueInfo& VI = (*(yyvsp[0].ValList))[i];
Reid Spencer52402b02007-01-02 05:45:11 +00004466 if (VI.type->isUnsigned() && !VI.isConstant() &&
4467 VI.type->getBitWidth() < 64) {
Reid Spencerf8383de2007-01-06 06:04:32 +00004468 *O << " %gep_upgrade" << unique << " = zext " << *VI.val
Reid Spencer71d2ec92006-12-31 06:02:26 +00004469 << " to i64\n";
Reid Spencerf8383de2007-01-06 06:04:32 +00004470 *VI.val = "i64 %gep_upgrade" + llvm::utostr(unique++);
Reid Spencer319a7302007-01-05 17:20:02 +00004471 VI.type = TypeInfo::get("i64",ULongTy);
Reid Spencerf459d392006-12-02 16:19:52 +00004472 }
4473 }
Reid Spencer319a7302007-01-05 17:20:02 +00004474 *(yyvsp[-3].String) += " " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4475 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
4476 ValueInfo& VI = (*(yyvsp[0].ValList))[i];
4477 *(yyvsp[-3].String) += ", " + *VI.val;
Reid Spencerf8483652006-12-02 15:16:01 +00004478 }
Reid Spencer319a7302007-01-05 17:20:02 +00004479 (yyval.Value).val = (yyvsp[-3].String);
4480 (yyval.Value).type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList));
4481 (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList);
4482 ;}
4483 break;
4484
4485
4486 default: break;
4487 }
4488
4489/* Line 1126 of yacc.c. */
Reid Spencer609ca3e2007-01-12 20:10:51 +00004490#line 4491 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00004491
4492 yyvsp -= yylen;
4493 yyssp -= yylen;
4494
Reid Spencer319a7302007-01-05 17:20:02 +00004495
4496 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004497
4498 *++yyvsp = yyval;
4499
4500
Reid Spencer319a7302007-01-05 17:20:02 +00004501 /* Now `shift' the result of the reduction. Determine what state
4502 that goes to, based on the state we popped back to and the rule
4503 number reduced by. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004504
4505 yyn = yyr1[yyn];
4506
Reid Spencer319a7302007-01-05 17:20:02 +00004507 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4508 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00004509 yystate = yytable[yystate];
4510 else
Reid Spencer319a7302007-01-05 17:20:02 +00004511 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencere7c3c602006-11-30 06:36:44 +00004512
4513 goto yynewstate;
4514
4515
Reid Spencer319a7302007-01-05 17:20:02 +00004516/*------------------------------------.
4517| yyerrlab -- here on detecting error |
4518`------------------------------------*/
4519yyerrlab:
4520 /* If not already recovering from an error, report this error. */
4521 if (!yyerrstatus)
Reid Spencere7c3c602006-11-30 06:36:44 +00004522 {
4523 ++yynerrs;
Reid Spencer319a7302007-01-05 17:20:02 +00004524#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00004525 yyn = yypact[yystate];
4526
Reid Spencer319a7302007-01-05 17:20:02 +00004527 if (YYPACT_NINF < yyn && yyn < YYLAST)
Reid Spencere7c3c602006-11-30 06:36:44 +00004528 {
Reid Spencer319a7302007-01-05 17:20:02 +00004529 int yytype = YYTRANSLATE (yychar);
4530 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
4531 YYSIZE_T yysize = yysize0;
4532 YYSIZE_T yysize1;
4533 int yysize_overflow = 0;
4534 char *yymsg = 0;
4535# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
4536 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
4537 int yyx;
Reid Spencere7c3c602006-11-30 06:36:44 +00004538
Reid Spencer319a7302007-01-05 17:20:02 +00004539#if 0
4540 /* This is so xgettext sees the translatable formats that are
4541 constructed on the fly. */
4542 YY_("syntax error, unexpected %s");
4543 YY_("syntax error, unexpected %s, expecting %s");
4544 YY_("syntax error, unexpected %s, expecting %s or %s");
4545 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
4546 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
4547#endif
4548 char *yyfmt;
4549 char const *yyf;
4550 static char const yyunexpected[] = "syntax error, unexpected %s";
4551 static char const yyexpecting[] = ", expecting %s";
4552 static char const yyor[] = " or %s";
4553 char yyformat[sizeof yyunexpected
4554 + sizeof yyexpecting - 1
4555 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
4556 * (sizeof yyor - 1))];
4557 char const *yyprefix = yyexpecting;
4558
4559 /* Start YYX at -YYN if negative to avoid negative indexes in
4560 YYCHECK. */
4561 int yyxbegin = yyn < 0 ? -yyn : 0;
4562
4563 /* Stay within bounds of both yycheck and yytname. */
4564 int yychecklim = YYLAST - yyn;
4565 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4566 int yycount = 1;
4567
4568 yyarg[0] = yytname[yytype];
4569 yyfmt = yystpcpy (yyformat, yyunexpected);
4570
4571 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4572 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4573 {
4574 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
4575 {
4576 yycount = 1;
4577 yysize = yysize0;
4578 yyformat[sizeof yyunexpected - 1] = '\0';
4579 break;
4580 }
4581 yyarg[yycount++] = yytname[yyx];
4582 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
4583 yysize_overflow |= yysize1 < yysize;
4584 yysize = yysize1;
4585 yyfmt = yystpcpy (yyfmt, yyprefix);
4586 yyprefix = yyor;
4587 }
4588
4589 yyf = YY_(yyformat);
4590 yysize1 = yysize + yystrlen (yyf);
4591 yysize_overflow |= yysize1 < yysize;
4592 yysize = yysize1;
4593
4594 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
4595 yymsg = (char *) YYSTACK_ALLOC (yysize);
4596 if (yymsg)
Reid Spencere7c3c602006-11-30 06:36:44 +00004597 {
Reid Spencer319a7302007-01-05 17:20:02 +00004598 /* Avoid sprintf, as that infringes on the user's name space.
4599 Don't have undefined behavior even if the translation
4600 produced a string with the wrong number of "%s"s. */
4601 char *yyp = yymsg;
4602 int yyi = 0;
4603 while ((*yyp = *yyf))
Reid Spencere7c3c602006-11-30 06:36:44 +00004604 {
Reid Spencer319a7302007-01-05 17:20:02 +00004605 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
4606 {
4607 yyp += yytnamerr (yyp, yyarg[yyi++]);
4608 yyf += 2;
4609 }
4610 else
4611 {
4612 yyp++;
4613 yyf++;
4614 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004615 }
Reid Spencer319a7302007-01-05 17:20:02 +00004616 yyerror (yymsg);
4617 YYSTACK_FREE (yymsg);
Reid Spencere7c3c602006-11-30 06:36:44 +00004618 }
4619 else
Reid Spencer319a7302007-01-05 17:20:02 +00004620 {
4621 yyerror (YY_("syntax error"));
4622 goto yyexhaustedlab;
4623 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004624 }
4625 else
4626#endif /* YYERROR_VERBOSE */
Reid Spencer319a7302007-01-05 17:20:02 +00004627 yyerror (YY_("syntax error"));
Reid Spencere7c3c602006-11-30 06:36:44 +00004628 }
4629
Reid Spencer319a7302007-01-05 17:20:02 +00004630
Reid Spencere7c3c602006-11-30 06:36:44 +00004631
4632 if (yyerrstatus == 3)
4633 {
Reid Spencer319a7302007-01-05 17:20:02 +00004634 /* If just tried and failed to reuse look-ahead token after an
4635 error, discard it. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004636
Reid Spencer319a7302007-01-05 17:20:02 +00004637 if (yychar <= YYEOF)
4638 {
4639 /* Return failure if at end of input. */
4640 if (yychar == YYEOF)
4641 YYABORT;
4642 }
4643 else
4644 {
4645 yydestruct ("Error: discarding", yytoken, &yylval);
4646 yychar = YYEMPTY;
4647 }
4648 }
4649
4650 /* Else will try to reuse look-ahead token after shifting the error
4651 token. */
4652 goto yyerrlab1;
4653
4654
4655/*---------------------------------------------------.
4656| yyerrorlab -- error raised explicitly by YYERROR. |
4657`---------------------------------------------------*/
4658yyerrorlab:
4659
4660 /* Pacify compilers like GCC when the user code never invokes
4661 YYERROR and the label yyerrorlab therefore never appears in user
4662 code. */
4663 if (0)
4664 goto yyerrorlab;
4665
4666yyvsp -= yylen;
4667 yyssp -= yylen;
4668 yystate = *yyssp;
4669 goto yyerrlab1;
4670
4671
4672/*-------------------------------------------------------------.
4673| yyerrlab1 -- common code for both syntax error and YYERROR. |
4674`-------------------------------------------------------------*/
4675yyerrlab1:
4676 yyerrstatus = 3; /* Each real token shifted decrements this. */
4677
4678 for (;;)
4679 {
4680 yyn = yypact[yystate];
4681 if (yyn != YYPACT_NINF)
4682 {
4683 yyn += YYTERROR;
4684 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4685 {
4686 yyn = yytable[yyn];
4687 if (0 < yyn)
4688 break;
4689 }
4690 }
4691
4692 /* Pop the current state because it cannot handle the error token. */
4693 if (yyssp == yyss)
Reid Spencere7c3c602006-11-30 06:36:44 +00004694 YYABORT;
4695
4696
Reid Spencer319a7302007-01-05 17:20:02 +00004697 yydestruct ("Error: popping", yystos[yystate], yyvsp);
4698 YYPOPSTACK;
4699 yystate = *yyssp;
4700 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004701 }
4702
4703 if (yyn == YYFINAL)
4704 YYACCEPT;
4705
4706 *++yyvsp = yylval;
Reid Spencer319a7302007-01-05 17:20:02 +00004707
4708
4709 /* Shift the error token. */
4710 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004711
4712 yystate = yyn;
4713 goto yynewstate;
4714
Chris Lattner37e01c52007-01-04 18:46:42 +00004715
Reid Spencer319a7302007-01-05 17:20:02 +00004716/*-------------------------------------.
4717| yyacceptlab -- YYACCEPT comes here. |
4718`-------------------------------------*/
4719yyacceptlab:
4720 yyresult = 0;
4721 goto yyreturn;
4722
4723/*-----------------------------------.
4724| yyabortlab -- YYABORT comes here. |
4725`-----------------------------------*/
4726yyabortlab:
4727 yyresult = 1;
4728 goto yyreturn;
4729
4730#ifndef yyoverflow
4731/*-------------------------------------------------.
4732| yyexhaustedlab -- memory exhaustion comes here. |
4733`-------------------------------------------------*/
4734yyexhaustedlab:
4735 yyerror (YY_("memory exhausted"));
4736 yyresult = 2;
4737 /* Fall through. */
Chris Lattner37e01c52007-01-04 18:46:42 +00004738#endif
Reid Spencer319a7302007-01-05 17:20:02 +00004739
4740yyreturn:
4741 if (yychar != YYEOF && yychar != YYEMPTY)
4742 yydestruct ("Cleanup: discarding lookahead",
4743 yytoken, &yylval);
4744 while (yyssp != yyss)
4745 {
4746 yydestruct ("Cleanup: popping",
4747 yystos[*yyssp], yyvsp);
4748 YYPOPSTACK;
Chris Lattner37e01c52007-01-04 18:46:42 +00004749 }
Reid Spencer319a7302007-01-05 17:20:02 +00004750#ifndef yyoverflow
4751 if (yyss != yyssa)
4752 YYSTACK_FREE (yyss);
4753#endif
4754 return yyresult;
Reid Spencere7c3c602006-11-30 06:36:44 +00004755}
Reid Spencer319a7302007-01-05 17:20:02 +00004756
4757
Reid Spencer609ca3e2007-01-12 20:10:51 +00004758#line 1992 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencere7c3c602006-11-30 06:36:44 +00004759
4760
4761int yyerror(const char *ErrorMsg) {
4762 std::string where
4763 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4764 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
Reid Spencer319a7302007-01-05 17:20:02 +00004765 std::string errMsg = where + "error: " + std::string(ErrorMsg) +
4766 " while reading ";
Reid Spencere7c3c602006-11-30 06:36:44 +00004767 if (yychar == YYEMPTY || yychar == 0)
4768 errMsg += "end-of-file.";
4769 else
4770 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
Reid Spencer71d2ec92006-12-31 06:02:26 +00004771 std::cerr << "llvm-upgrade: " << errMsg << '\n';
Chris Lattner37e01c52007-01-04 18:46:42 +00004772 *O << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +00004773 exit(1);
4774}
Reid Spencer319a7302007-01-05 17:20:02 +00004775
4776static void warning(const std::string& ErrorMsg) {
4777 std::string where
4778 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4779 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
4780 std::string errMsg = where + "warning: " + std::string(ErrorMsg) +
4781 " while reading ";
4782 if (yychar == YYEMPTY || yychar == 0)
4783 errMsg += "end-of-file.";
4784 else
4785 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
4786 std::cerr << "llvm-upgrade: " << errMsg << '\n';
4787}
4788