blob: ea951a176284615abb0734715ec907d6c497f973 [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,
Reid Spencerc4d96252007-01-13 00:03:30 +0000113 EXTERNAL = 304,
114 TARGET = 305,
115 TRIPLE = 306,
116 ENDIAN = 307,
117 POINTERSIZE = 308,
118 LITTLE = 309,
119 BIG = 310,
120 ALIGN = 311,
121 UNINITIALIZED = 312,
122 DEPLIBS = 313,
123 CALL = 314,
124 TAIL = 315,
125 ASM_TOK = 316,
126 MODULE = 317,
127 SIDEEFFECT = 318,
128 CC_TOK = 319,
129 CCC_TOK = 320,
130 CSRETCC_TOK = 321,
131 FASTCC_TOK = 322,
132 COLDCC_TOK = 323,
133 X86_STDCALLCC_TOK = 324,
134 X86_FASTCALLCC_TOK = 325,
135 DATALAYOUT = 326,
136 RET = 327,
137 BR = 328,
138 SWITCH = 329,
139 INVOKE = 330,
140 EXCEPT = 331,
141 UNWIND = 332,
142 UNREACHABLE = 333,
143 ADD = 334,
144 SUB = 335,
145 MUL = 336,
146 DIV = 337,
147 UDIV = 338,
148 SDIV = 339,
149 FDIV = 340,
150 REM = 341,
151 UREM = 342,
152 SREM = 343,
153 FREM = 344,
154 AND = 345,
155 OR = 346,
156 XOR = 347,
157 SETLE = 348,
158 SETGE = 349,
159 SETLT = 350,
160 SETGT = 351,
161 SETEQ = 352,
162 SETNE = 353,
163 ICMP = 354,
164 FCMP = 355,
165 EQ = 356,
166 NE = 357,
167 SLT = 358,
168 SGT = 359,
169 SLE = 360,
170 SGE = 361,
171 OEQ = 362,
172 ONE = 363,
173 OLT = 364,
174 OGT = 365,
175 OLE = 366,
176 OGE = 367,
177 ORD = 368,
178 UNO = 369,
179 UEQ = 370,
180 UNE = 371,
181 ULT = 372,
182 UGT = 373,
183 ULE = 374,
184 UGE = 375,
185 MALLOC = 376,
186 ALLOCA = 377,
187 FREE = 378,
188 LOAD = 379,
189 STORE = 380,
190 GETELEMENTPTR = 381,
191 PHI_TOK = 382,
192 SELECT = 383,
193 SHL = 384,
194 SHR = 385,
195 ASHR = 386,
196 LSHR = 387,
197 VAARG = 388,
198 EXTRACTELEMENT = 389,
199 INSERTELEMENT = 390,
200 SHUFFLEVECTOR = 391,
201 CAST = 392,
202 TRUNC = 393,
203 ZEXT = 394,
204 SEXT = 395,
205 FPTRUNC = 396,
206 FPEXT = 397,
207 FPTOUI = 398,
208 FPTOSI = 399,
209 UITOFP = 400,
210 SITOFP = 401,
211 PTRTOINT = 402,
212 INTTOPTR = 403,
213 BITCAST = 404
Reid Spencer319a7302007-01-05 17:20:02 +0000214 };
215#endif
216/* Tokens. */
217#define VOID 258
218#define BOOL 259
219#define SBYTE 260
220#define UBYTE 261
221#define SHORT 262
222#define USHORT 263
223#define INT 264
224#define UINT 265
225#define LONG 266
226#define ULONG 267
227#define FLOAT 268
228#define DOUBLE 269
229#define LABEL 270
230#define OPAQUE 271
231#define ESINT64VAL 272
232#define EUINT64VAL 273
233#define SINTVAL 274
234#define UINTVAL 275
235#define FPVAL 276
236#define NULL_TOK 277
237#define UNDEF 278
238#define ZEROINITIALIZER 279
239#define TRUETOK 280
240#define FALSETOK 281
241#define TYPE 282
242#define VAR_ID 283
243#define LABELSTR 284
244#define STRINGCONSTANT 285
245#define IMPLEMENTATION 286
246#define BEGINTOK 287
247#define ENDTOK 288
248#define DECLARE 289
249#define GLOBAL 290
250#define CONSTANT 291
251#define SECTION 292
252#define VOLATILE 293
253#define TO 294
254#define DOTDOTDOT 295
255#define CONST 296
256#define INTERNAL 297
257#define LINKONCE 298
258#define WEAK 299
259#define DLLIMPORT 300
260#define DLLEXPORT 301
261#define EXTERN_WEAK 302
262#define APPENDING 303
Reid Spencerc4d96252007-01-13 00:03:30 +0000263#define EXTERNAL 304
264#define TARGET 305
265#define TRIPLE 306
266#define ENDIAN 307
267#define POINTERSIZE 308
268#define LITTLE 309
269#define BIG 310
270#define ALIGN 311
271#define UNINITIALIZED 312
272#define DEPLIBS 313
273#define CALL 314
274#define TAIL 315
275#define ASM_TOK 316
276#define MODULE 317
277#define SIDEEFFECT 318
278#define CC_TOK 319
279#define CCC_TOK 320
280#define CSRETCC_TOK 321
281#define FASTCC_TOK 322
282#define COLDCC_TOK 323
283#define X86_STDCALLCC_TOK 324
284#define X86_FASTCALLCC_TOK 325
285#define DATALAYOUT 326
286#define RET 327
287#define BR 328
288#define SWITCH 329
289#define INVOKE 330
290#define EXCEPT 331
291#define UNWIND 332
292#define UNREACHABLE 333
293#define ADD 334
294#define SUB 335
295#define MUL 336
296#define DIV 337
297#define UDIV 338
298#define SDIV 339
299#define FDIV 340
300#define REM 341
301#define UREM 342
302#define SREM 343
303#define FREM 344
304#define AND 345
305#define OR 346
306#define XOR 347
307#define SETLE 348
308#define SETGE 349
309#define SETLT 350
310#define SETGT 351
311#define SETEQ 352
312#define SETNE 353
313#define ICMP 354
314#define FCMP 355
315#define EQ 356
316#define NE 357
317#define SLT 358
318#define SGT 359
319#define SLE 360
320#define SGE 361
321#define OEQ 362
322#define ONE 363
323#define OLT 364
324#define OGT 365
325#define OLE 366
326#define OGE 367
327#define ORD 368
328#define UNO 369
329#define UEQ 370
330#define UNE 371
331#define ULT 372
332#define UGT 373
333#define ULE 374
334#define UGE 375
335#define MALLOC 376
336#define ALLOCA 377
337#define FREE 378
338#define LOAD 379
339#define STORE 380
340#define GETELEMENTPTR 381
341#define PHI_TOK 382
342#define SELECT 383
343#define SHL 384
344#define SHR 385
345#define ASHR 386
346#define LSHR 387
347#define VAARG 388
348#define EXTRACTELEMENT 389
349#define INSERTELEMENT 390
350#define SHUFFLEVECTOR 391
351#define CAST 392
352#define TRUNC 393
353#define ZEXT 394
354#define SEXT 395
355#define FPTRUNC 396
356#define FPEXT 397
357#define FPTOUI 398
358#define FPTOSI 399
359#define UITOFP 400
360#define SITOFP 401
361#define PTRTOINT 402
362#define INTTOPTR 403
363#define BITCAST 404
Reid Spencer319a7302007-01-05 17:20:02 +0000364
365
366
367
368/* Copy the first part of user declarations. */
Reid Spencer609ca3e2007-01-12 20:10:51 +0000369#line 14 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +0000370
371#include "UpgradeInternals.h"
Reid Spencere7c3c602006-11-30 06:36:44 +0000372#include <algorithm>
Reid Spencera50d5962006-12-02 04:11:07 +0000373#include <map>
Reid Spencere7c3c602006-11-30 06:36:44 +0000374#include <utility>
375#include <iostream>
376
Reid Spencere77e35e2006-12-01 20:26:20 +0000377#define YYERROR_VERBOSE 1
Reid Spencer96839be2006-11-30 16:50:26 +0000378#define YYINCLUDED_STDLIB_H
Reid Spencere77e35e2006-12-01 20:26:20 +0000379#define YYDEBUG 1
Reid Spencere7c3c602006-11-30 06:36:44 +0000380
381int yylex(); // declaration" of xxx warnings.
382int yyparse();
Reid Spencere77e35e2006-12-01 20:26:20 +0000383extern int yydebug;
Reid Spencere7c3c602006-11-30 06:36:44 +0000384
385static std::string CurFilename;
Reid Spencere7c3c602006-11-30 06:36:44 +0000386static std::ostream *O = 0;
Reid Spencer96839be2006-11-30 16:50:26 +0000387std::istream* LexInput = 0;
Reid Spencere77e35e2006-12-01 20:26:20 +0000388unsigned SizeOfPointer = 32;
Reid Spencerf459d392006-12-02 16:19:52 +0000389static uint64_t unique = 1;
Reid Spencer96839be2006-11-30 16:50:26 +0000390
Reid Spencer71d2ec92006-12-31 06:02:26 +0000391// This bool controls whether attributes are ever added to function declarations
392// definitions and calls.
393static bool AddAttributes = false;
394
Reid Spencerc4d96252007-01-13 00:03:30 +0000395// This is set when a DECLARE keyword is recognized so that subsequent parsing
396// of a function prototype can know if its a declaration or definition.
397static bool isDeclare = false;
398
Reid Spencerf5626a32007-01-01 01:20:41 +0000399// This bool is used to communicate between the InstVal and Inst rules about
400// whether or not a cast should be deleted. When the flag is set, InstVal has
401// determined that the cast is a candidate. However, it can only be deleted if
402// the value being casted is the same value name as the instruction. The Inst
403// rule makes that comparison if the flag is set and comments out the
404// instruction if they match.
405static bool deleteUselessCastFlag = false;
406static std::string* deleteUselessCastName = 0;
407
Reid Spencer319a7302007-01-05 17:20:02 +0000408typedef std::vector<const TypeInfo*> TypeVector;
Reid Spencera50d5962006-12-02 04:11:07 +0000409static TypeVector EnumeratedTypes;
Reid Spencer319a7302007-01-05 17:20:02 +0000410typedef std::map<std::string,const TypeInfo*> TypeMap;
Reid Spencera50d5962006-12-02 04:11:07 +0000411static TypeMap NamedTypes;
Reid Spencer319a7302007-01-05 17:20:02 +0000412typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
413typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
414static GlobalsTypeMap Globals;
415
416static void warning(const std::string& msg);
Reid Spencera50d5962006-12-02 04:11:07 +0000417
Reid Spencerf8483652006-12-02 15:16:01 +0000418void destroy(ValueList* VL) {
419 while (!VL->empty()) {
420 ValueInfo& VI = VL->back();
421 VI.destroy();
422 VL->pop_back();
423 }
424 delete VL;
425}
426
Reid Spencer96839be2006-11-30 16:50:26 +0000427void UpgradeAssembly(const std::string &infile, std::istream& in,
Reid Spencer71d2ec92006-12-31 06:02:26 +0000428 std::ostream &out, bool debug, bool addAttrs)
Reid Spencere7c3c602006-11-30 06:36:44 +0000429{
430 Upgradelineno = 1;
431 CurFilename = infile;
Reid Spencer96839be2006-11-30 16:50:26 +0000432 LexInput = &in;
Reid Spencere77e35e2006-12-01 20:26:20 +0000433 yydebug = debug;
Reid Spencer71d2ec92006-12-31 06:02:26 +0000434 AddAttributes = addAttrs;
Reid Spencere7c3c602006-11-30 06:36:44 +0000435 O = &out;
436
437 if (yyparse()) {
438 std::cerr << "Parse failed.\n";
Chris Lattner37e01c52007-01-04 18:46:42 +0000439 out << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +0000440 exit(1);
441 }
442}
443
Reid Spencer319a7302007-01-05 17:20:02 +0000444TypeInfo::TypeRegMap TypeInfo::registry;
445
446const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) {
447 TypeInfo* Ty = new TypeInfo();
448 Ty->newTy = newType;
449 Ty->oldTy = oldType;
450 return add_new_type(Ty);
451}
452
453const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
454 const TypeInfo* eTy, const TypeInfo* rTy) {
455 TypeInfo* Ty= new TypeInfo();
456 Ty->newTy = newType;
457 Ty->oldTy = oldType;
458 Ty->elemTy = const_cast<TypeInfo*>(eTy);
459 Ty->resultTy = const_cast<TypeInfo*>(rTy);
460 return add_new_type(Ty);
461}
462
463const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
464 const TypeInfo *eTy, uint64_t elems) {
465 TypeInfo* Ty = new TypeInfo();
466 Ty->newTy = newType;
467 Ty->oldTy = oldType;
468 Ty->elemTy = const_cast<TypeInfo*>(eTy);
469 Ty->nelems = elems;
470 return add_new_type(Ty);
471}
472
473const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
474 TypeList* TL) {
475 TypeInfo* Ty = new TypeInfo();
476 Ty->newTy = newType;
477 Ty->oldTy = oldType;
478 Ty->elements = TL;
479 return add_new_type(Ty);
480}
481
482const TypeInfo* TypeInfo::get(const std::string& newType, const TypeInfo* resTy,
483 TypeList* TL) {
484 TypeInfo* Ty = new TypeInfo();
485 Ty->newTy = newType;
486 Ty->oldTy = FunctionTy;
487 Ty->resultTy = const_cast<TypeInfo*>(resTy);
488 Ty->elements = TL;
489 return add_new_type(Ty);
490}
491
492const TypeInfo* TypeInfo::resolve() const {
493 if (isUnresolved()) {
Reid Spencerf8383de2007-01-06 06:04:32 +0000494 if (getNewTy()[0] == '%' && isdigit(newTy[1])) {
495 unsigned ref = atoi(&((newTy.c_str())[1])); // skip the %
Reid Spencereff838e2007-01-03 23:45:42 +0000496 if (ref < EnumeratedTypes.size()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000497 return EnumeratedTypes[ref];
Reid Spencereff838e2007-01-03 23:45:42 +0000498 } else {
499 std::string msg("Can't resolve numbered type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000500 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000501 yyerror(msg.c_str());
502 }
Reid Spencer78720742006-12-02 20:21:22 +0000503 } else {
Reid Spencerf8383de2007-01-06 06:04:32 +0000504 TypeMap::iterator I = NamedTypes.find(newTy);
Reid Spencereff838e2007-01-03 23:45:42 +0000505 if (I != NamedTypes.end()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000506 return I->second;
Reid Spencereff838e2007-01-03 23:45:42 +0000507 } else {
508 std::string msg("Cannot resolve type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000509 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000510 yyerror(msg.c_str());
511 }
Reid Spencera50d5962006-12-02 04:11:07 +0000512 }
Reid Spencer280d8012006-12-01 23:40:53 +0000513 }
Reid Spencera50d5962006-12-02 04:11:07 +0000514 // otherwise its already resolved.
Reid Spencer319a7302007-01-05 17:20:02 +0000515 return this;
516}
517
518bool TypeInfo::operator<(const TypeInfo& that) const {
519 if (this == &that)
520 return false;
521 if (oldTy != that.oldTy)
522 return oldTy < that.oldTy;
523 switch (oldTy) {
524 case UpRefTy: {
525 unsigned thisUp = this->getUpRefNum();
526 unsigned thatUp = that.getUpRefNum();
527 return thisUp < thatUp;
528 }
529 case PackedTy:
530 case ArrayTy:
531 if (this->nelems != that.nelems)
532 return nelems < that.nelems;
533 case PointerTy: {
534 const TypeInfo* thisTy = this->elemTy;
535 const TypeInfo* thatTy = that.elemTy;
536 return *thisTy < *thatTy;
537 }
538 case FunctionTy: {
539 const TypeInfo* thisTy = this->resultTy;
540 const TypeInfo* thatTy = that.resultTy;
541 if (!thisTy->sameOldTyAs(thatTy))
542 return *thisTy < *thatTy;
543 /* FALL THROUGH */
544 }
545 case StructTy:
546 case PackedStructTy: {
547 if (elements->size() != that.elements->size())
548 return elements->size() < that.elements->size();
549 for (unsigned i = 0; i < elements->size(); i++) {
550 const TypeInfo* thisTy = (*this->elements)[i];
551 const TypeInfo* thatTy = (*that.elements)[i];
552 if (!thisTy->sameOldTyAs(thatTy))
553 return *thisTy < *thatTy;
554 }
555 break;
556 }
557 case UnresolvedTy:
558 return this->newTy < that.newTy;
559 default:
560 break;
561 }
562 return false;
563}
564
565bool TypeInfo::sameOldTyAs(const TypeInfo* that) const {
566 if (that == 0)
567 return false;
568 if ( this == that )
569 return true;
570 if (oldTy != that->oldTy)
571 return false;
572 switch (oldTy) {
573 case PackedTy:
574 case ArrayTy:
575 if (nelems != that->nelems)
576 return false;
577 /* FALL THROUGH */
578 case PointerTy: {
579 const TypeInfo* thisTy = this->elemTy;
580 const TypeInfo* thatTy = that->elemTy;
581 return thisTy->sameOldTyAs(thatTy);
582 }
583 case FunctionTy: {
584 const TypeInfo* thisTy = this->resultTy;
585 const TypeInfo* thatTy = that->resultTy;
586 if (!thisTy->sameOldTyAs(thatTy))
587 return false;
588 /* FALL THROUGH */
589 }
590 case StructTy:
591 case PackedStructTy: {
592 if (elements->size() != that->elements->size())
593 return false;
594 for (unsigned i = 0; i < elements->size(); i++) {
595 const TypeInfo* thisTy = (*this->elements)[i];
596 const TypeInfo* thatTy = (*that->elements)[i];
597 if (!thisTy->sameOldTyAs(thatTy))
598 return false;
599 }
600 return true;
601 }
602 case UnresolvedTy:
603 return this->newTy == that->newTy;
604 default:
605 return true; // for all others oldTy == that->oldTy is sufficient
606 }
607 return true;
608}
609
610bool TypeInfo::isUnresolvedDeep() const {
611 switch (oldTy) {
612 case UnresolvedTy:
613 return true;
614 case PackedTy:
615 case ArrayTy:
616 case PointerTy:
617 return elemTy->isUnresolvedDeep();
618 case PackedStructTy:
619 case StructTy:
620 for (unsigned i = 0; i < elements->size(); i++)
621 if ((*elements)[i]->isUnresolvedDeep())
622 return true;
623 return false;
624 default:
625 return false;
626 }
627}
628
629unsigned TypeInfo::getBitWidth() const {
630 switch (oldTy) {
631 default:
632 case LabelTy:
633 case VoidTy : return 0;
634 case BoolTy : return 1;
635 case SByteTy: case UByteTy : return 8;
636 case ShortTy: case UShortTy : return 16;
637 case IntTy: case UIntTy: case FloatTy: return 32;
638 case LongTy: case ULongTy: case DoubleTy : return 64;
639 case PointerTy: return SizeOfPointer; // global var
640 case PackedTy:
641 case ArrayTy:
642 return nelems * elemTy->getBitWidth();
643 case StructTy:
644 case PackedStructTy: {
645 uint64_t size = 0;
646 for (unsigned i = 0; i < elements->size(); i++) {
647 size += (*elements)[i]->getBitWidth();
648 }
649 return size;
650 }
651 }
652}
653
654const TypeInfo* TypeInfo::getIndexedType(const ValueInfo& VI) const {
655 if (isStruct()) {
656 if (VI.isConstant() && VI.type->isInteger()) {
657 size_t pos = VI.val->find(' ') + 1;
658 if (pos < VI.val->size()) {
659 uint64_t idx = atoi(VI.val->substr(pos).c_str());
660 return (*elements)[idx];
661 } else {
662 yyerror("Invalid value for constant integer");
663 return 0;
664 }
665 } else {
666 yyerror("Structure requires constant index");
667 return 0;
668 }
669 }
670 if (isArray() || isPacked() || isPointer())
671 return elemTy;
672 yyerror("Invalid type for getIndexedType");
673 return 0;
674}
675
Reid Spencerf8383de2007-01-06 06:04:32 +0000676void TypeInfo::getSignedness(unsigned &sNum, unsigned &uNum,
677 UpRefStack& stack) const {
678 switch (oldTy) {
679 default:
680 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy:
681 case FloatTy : case DoubleTy: case UpRefTy:
682 return;
683 case SByteTy: case ShortTy: case LongTy: case IntTy:
684 sNum++;
685 return;
686 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
687 uNum++;
688 return;
689 case PointerTy:
690 case PackedTy:
691 case ArrayTy:
692 stack.push_back(this);
693 elemTy->getSignedness(sNum, uNum, stack);
694 return;
695 case StructTy:
696 case PackedStructTy: {
697 stack.push_back(this);
698 for (unsigned i = 0; i < elements->size(); i++) {
699 (*elements)[i]->getSignedness(sNum, uNum, stack);
700 }
701 return;
702 }
703 case UnresolvedTy: {
704 const TypeInfo* Ty = this->resolve();
705 // Let's not recurse.
706 UpRefStack::const_iterator I = stack.begin(), E = stack.end();
707 for ( ; I != E && *I != Ty; ++I)
708 ;
709 if (I == E)
710 Ty->getSignedness(sNum, uNum, stack);
711 return;
712 }
713 }
714}
715
716std::string AddSuffix(const std::string& Name, const std::string& Suffix) {
717 if (Name[Name.size()-1] == '"') {
718 std::string Result = Name;
719 Result.insert(Result.size()-1, Suffix);
720 return Result;
721 }
722 return Name + Suffix;
723}
724
725std::string TypeInfo::makeUniqueName(const std::string& BaseName) const {
726 if (BaseName == "\"alloca point\"")
727 return BaseName;
728 switch (oldTy) {
729 default:
730 break;
731 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy:
732 case FloatTy : case DoubleTy: case UnresolvedTy:
733 return BaseName;
734 case SByteTy: case ShortTy: case LongTy: case IntTy:
735 return AddSuffix(BaseName, ".s");
736 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
737 return AddSuffix(BaseName, ".u");
738 }
739
740 unsigned uNum = 0, sNum = 0;
741 std::string Suffix;
742 switch (oldTy) {
743 case PointerTy:
744 case PackedTy:
745 case ArrayTy: {
746 TypeInfo::UpRefStack stack;
747 elemTy->resolve()->getSignedness(sNum, uNum, stack);
748 break;
749 }
750 case StructTy:
751 case PackedStructTy: {
752 for (unsigned i = 0; i < elements->size(); i++) {
753 TypeInfo::UpRefStack stack;
754 (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack);
755 }
756 break;
757 }
758 default:
759 assert(0 && "Invalid Type");
760 break;
761 }
762
763 if (sNum == 0 && uNum == 0)
764 return BaseName;
765
766 switch (oldTy) {
767 default: Suffix += ".nada"; break;
768 case PointerTy: Suffix += ".pntr"; break;
769 case PackedTy: Suffix += ".pckd"; break;
770 case ArrayTy: Suffix += ".arry"; break;
771 case StructTy: Suffix += ".strc"; break;
772 case PackedStructTy: Suffix += ".pstr"; break;
773 }
774
775 Suffix += ".s" + llvm::utostr(sNum);
776 Suffix += ".u" + llvm::utostr(uNum);
777 return AddSuffix(BaseName, Suffix);
778}
779
Reid Spencer319a7302007-01-05 17:20:02 +0000780TypeInfo& TypeInfo::operator=(const TypeInfo& that) {
781 oldTy = that.oldTy;
782 nelems = that.nelems;
783 newTy = that.newTy;
784 elemTy = that.elemTy;
785 resultTy = that.resultTy;
786 if (that.elements) {
787 elements = new TypeList(that.elements->size());
788 *elements = *that.elements;
789 } else {
790 elements = 0;
791 }
792 return *this;
793}
794
795const TypeInfo* TypeInfo::add_new_type(TypeInfo* newTy) {
796 TypeRegMap::iterator I = registry.find(newTy);
797 if (I != registry.end()) {
798 delete newTy;
799 return *I;
800 }
801 registry.insert(newTy);
802 return newTy;
Reid Spencer280d8012006-12-01 23:40:53 +0000803}
804
Reid Spencera50d5962006-12-02 04:11:07 +0000805static const char* getCastOpcode(
Reid Spencer52402b02007-01-02 05:45:11 +0000806 std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy)
Reid Spencera50d5962006-12-02 04:11:07 +0000807{
Reid Spencer52402b02007-01-02 05:45:11 +0000808 unsigned SrcBits = SrcTy->getBitWidth();
809 unsigned DstBits = DstTy->getBitWidth();
Reid Spencere77e35e2006-12-01 20:26:20 +0000810 const char* opcode = "bitcast";
811 // Run through the possibilities ...
Reid Spencer52402b02007-01-02 05:45:11 +0000812 if (DstTy->isIntegral()) { // Casting to integral
813 if (SrcTy->isIntegral()) { // Casting from integral
Reid Spencere77e35e2006-12-01 20:26:20 +0000814 if (DstBits < SrcBits)
815 opcode = "trunc";
816 else if (DstBits > SrcBits) { // its an extension
Reid Spencer52402b02007-01-02 05:45:11 +0000817 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000818 opcode ="sext"; // signed -> SEXT
819 else
820 opcode = "zext"; // unsigned -> ZEXT
821 } else {
822 opcode = "bitcast"; // Same size, No-op cast
823 }
Reid Spencer52402b02007-01-02 05:45:11 +0000824 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
825 if (DstTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000826 opcode = "fptosi"; // FP -> sint
827 else
828 opcode = "fptoui"; // FP -> uint
Reid Spencer52402b02007-01-02 05:45:11 +0000829 } else if (SrcTy->isPacked()) {
830 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000831 "Casting packed to integer of different width");
832 opcode = "bitcast"; // same size, no-op cast
833 } else {
Reid Spencer52402b02007-01-02 05:45:11 +0000834 assert(SrcTy->isPointer() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000835 "Casting from a value that is not first-class type");
836 opcode = "ptrtoint"; // ptr -> int
837 }
Reid Spencer52402b02007-01-02 05:45:11 +0000838 } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
839 if (SrcTy->isIntegral()) { // Casting from integral
840 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000841 opcode = "sitofp"; // sint -> FP
842 else
843 opcode = "uitofp"; // uint -> FP
Reid Spencer52402b02007-01-02 05:45:11 +0000844 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
Reid Spencere77e35e2006-12-01 20:26:20 +0000845 if (DstBits < SrcBits) {
846 opcode = "fptrunc"; // FP -> smaller FP
847 } else if (DstBits > SrcBits) {
848 opcode = "fpext"; // FP -> larger FP
849 } else {
850 opcode ="bitcast"; // same size, no-op cast
851 }
Reid Spencer52402b02007-01-02 05:45:11 +0000852 } else if (SrcTy->isPacked()) {
853 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000854 "Casting packed to floating point of different width");
855 opcode = "bitcast"; // same size, no-op cast
856 } else {
857 assert(0 && "Casting pointer or non-first class to float");
858 }
Reid Spencer52402b02007-01-02 05:45:11 +0000859 } else if (DstTy->isPacked()) {
860 if (SrcTy->isPacked()) {
861 assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000862 "Casting packed to packed of different widths");
863 opcode = "bitcast"; // packed -> packed
Reid Spencer52402b02007-01-02 05:45:11 +0000864 } else if (DstTy->getBitWidth() == SrcBits) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000865 opcode = "bitcast"; // float/int -> packed
866 } else {
867 assert(!"Illegal cast to packed (wrong type or size)");
868 }
Reid Spencer52402b02007-01-02 05:45:11 +0000869 } else if (DstTy->isPointer()) {
870 if (SrcTy->isPointer()) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000871 opcode = "bitcast"; // ptr -> ptr
Reid Spencer52402b02007-01-02 05:45:11 +0000872 } else if (SrcTy->isIntegral()) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000873 opcode = "inttoptr"; // int -> ptr
874 } else {
Reid Spencera50d5962006-12-02 04:11:07 +0000875 assert(!"Casting invalid type to pointer");
Reid Spencere77e35e2006-12-01 20:26:20 +0000876 }
877 } else {
878 assert(!"Casting to type that is not first-class");
879 }
880 return opcode;
881}
882
Reid Spencer319a7302007-01-05 17:20:02 +0000883static std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
884 const TypeInfo* DstTy, bool isConst)
Reid Spencera50d5962006-12-02 04:11:07 +0000885{
886 std::string Result;
887 std::string Source = Src;
Reid Spencer52402b02007-01-02 05:45:11 +0000888 if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
Reid Spencera50d5962006-12-02 04:11:07 +0000889 // fp -> ptr cast is no longer supported but we must upgrade this
890 // by doing a double cast: fp -> int -> ptr
891 if (isConst)
Reid Spencer71d2ec92006-12-31 06:02:26 +0000892 Source = "i64 fptoui(" + Source + " to i64)";
Reid Spencera50d5962006-12-02 04:11:07 +0000893 else {
Reid Spencerf459d392006-12-02 16:19:52 +0000894 *O << " %cast_upgrade" << unique << " = fptoui " << Source
Reid Spencer71d2ec92006-12-31 06:02:26 +0000895 << " to i64\n";
896 Source = "i64 %cast_upgrade" + llvm::utostr(unique);
Reid Spencera50d5962006-12-02 04:11:07 +0000897 }
898 // Update the SrcTy for the getCastOpcode call below
Reid Spencer319a7302007-01-05 17:20:02 +0000899 SrcTy = TypeInfo::get("i64", ULongTy);
Reid Spencer52402b02007-01-02 05:45:11 +0000900 } else if (DstTy->isBool()) {
901 // cast type %x to bool was previously defined as setne type %x, null
902 // The cast semantic is now to truncate, not compare so we must retain
903 // the original intent by replacing the cast with a setne
904 const char* comparator = SrcTy->isPointer() ? ", null" :
905 (SrcTy->isFloatingPoint() ? ", 0.0" :
906 (SrcTy->isBool() ? ", false" : ", 0"));
907 const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
Reid Spencer187ccf82006-12-09 16:57:22 +0000908 if (isConst) {
909 Result = "(" + Source + comparator + ")";
910 Result = compareOp + Result;
911 } else
912 Result = compareOp + Source + comparator;
Reid Spencera50d5962006-12-02 04:11:07 +0000913 return Result; // skip cast processing below
914 }
Reid Spencer319a7302007-01-05 17:20:02 +0000915 SrcTy = SrcTy->resolve();
916 DstTy = DstTy->resolve();
Reid Spencera50d5962006-12-02 04:11:07 +0000917 std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
918 if (isConst)
Reid Spencer52402b02007-01-02 05:45:11 +0000919 Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
Reid Spencera50d5962006-12-02 04:11:07 +0000920 else
Reid Spencer52402b02007-01-02 05:45:11 +0000921 Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
Reid Spencera50d5962006-12-02 04:11:07 +0000922 return Result;
923}
924
Reid Spencer319a7302007-01-05 17:20:02 +0000925const char* getDivRemOpcode(const std::string& opcode, const TypeInfo* TI) {
Reid Spencer78720742006-12-02 20:21:22 +0000926 const char* op = opcode.c_str();
Reid Spencer319a7302007-01-05 17:20:02 +0000927 const TypeInfo* Ty = TI->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +0000928 if (Ty->isPacked())
929 Ty = Ty->getElementType();
Reid Spencer78720742006-12-02 20:21:22 +0000930 if (opcode == "div")
Reid Spencer52402b02007-01-02 05:45:11 +0000931 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +0000932 op = "fdiv";
Reid Spencer52402b02007-01-02 05:45:11 +0000933 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +0000934 op = "udiv";
Reid Spencer52402b02007-01-02 05:45:11 +0000935 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +0000936 op = "sdiv";
937 else
938 yyerror("Invalid type for div instruction");
939 else if (opcode == "rem")
Reid Spencer52402b02007-01-02 05:45:11 +0000940 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +0000941 op = "frem";
Reid Spencer52402b02007-01-02 05:45:11 +0000942 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +0000943 op = "urem";
Reid Spencer52402b02007-01-02 05:45:11 +0000944 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +0000945 op = "srem";
946 else
947 yyerror("Invalid type for rem instruction");
948 return op;
949}
Reid Spencere7c3c602006-11-30 06:36:44 +0000950
Reid Spencer229e9362006-12-02 22:14:11 +0000951std::string
Reid Spencer52402b02007-01-02 05:45:11 +0000952getCompareOp(const std::string& setcc, const TypeInfo* TI) {
Reid Spencer229e9362006-12-02 22:14:11 +0000953 assert(setcc.length() == 5);
954 char cc1 = setcc[3];
955 char cc2 = setcc[4];
956 assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
957 assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
958 std::string result("xcmp xxx");
959 result[6] = cc1;
960 result[7] = cc2;
Reid Spencer52402b02007-01-02 05:45:11 +0000961 if (TI->isFloatingPoint()) {
Reid Spencer229e9362006-12-02 22:14:11 +0000962 result[0] = 'f';
Reid Spencere4d87aa2006-12-23 06:05:41 +0000963 result[5] = 'o';
Reid Spencerf0cf1322006-12-07 04:23:03 +0000964 if (cc1 == 'n')
965 result[5] = 'u'; // NE maps to unordered
966 else
967 result[5] = 'o'; // everything else maps to ordered
Reid Spencer52402b02007-01-02 05:45:11 +0000968 } else if (TI->isIntegral() || TI->isPointer()) {
Reid Spencer229e9362006-12-02 22:14:11 +0000969 result[0] = 'i';
970 if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
971 result.erase(5,1);
Reid Spencer52402b02007-01-02 05:45:11 +0000972 else if (TI->isSigned())
Reid Spencer229e9362006-12-02 22:14:11 +0000973 result[5] = 's';
Reid Spencer52402b02007-01-02 05:45:11 +0000974 else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
Reid Spencer229e9362006-12-02 22:14:11 +0000975 result[5] = 'u';
976 else
977 yyerror("Invalid integral type for setcc");
978 }
979 return result;
980}
981
Reid Spencer319a7302007-01-05 17:20:02 +0000982static const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
983 PFTy = PFTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +0000984 if (PFTy->isPointer()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000985 const TypeInfo* ElemTy = PFTy->getElementType();
986 ElemTy = ElemTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +0000987 if (ElemTy->isFunction())
Reid Spencer319a7302007-01-05 17:20:02 +0000988 return ElemTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +0000989 } else if (PFTy->isFunction()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000990 return PFTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +0000991 }
Reid Spencer319a7302007-01-05 17:20:02 +0000992 return PFTy;
Reid Spencer52402b02007-01-02 05:45:11 +0000993}
994
Reid Spencer319a7302007-01-05 17:20:02 +0000995static const TypeInfo* ResolveUpReference(const TypeInfo* Ty,
Reid Spencerf8383de2007-01-06 06:04:32 +0000996 TypeInfo::UpRefStack* stack) {
Reid Spencereff838e2007-01-03 23:45:42 +0000997 assert(Ty->isUpReference() && "Can't resolve a non-upreference");
Reid Spencer319a7302007-01-05 17:20:02 +0000998 unsigned upref = Ty->getUpRefNum();
Reid Spencereff838e2007-01-03 23:45:42 +0000999 assert(upref < stack->size() && "Invalid up reference");
1000 return (*stack)[upref - stack->size() - 1];
1001}
1002
Reid Spencer319a7302007-01-05 17:20:02 +00001003static const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
1004 const TypeInfo* Result = PTy = PTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001005 assert(PTy->isPointer() && "GEP Operand is not a pointer?");
Reid Spencerf8383de2007-01-06 06:04:32 +00001006 TypeInfo::UpRefStack stack;
Reid Spencereff838e2007-01-03 23:45:42 +00001007 for (unsigned i = 0; i < idxs->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00001008 if (Result->isComposite()) {
1009 Result = Result->getIndexedType((*idxs)[i]);
Reid Spencer319a7302007-01-05 17:20:02 +00001010 Result = Result->resolve();
Reid Spencereff838e2007-01-03 23:45:42 +00001011 stack.push_back(Result);
Reid Spencer52402b02007-01-02 05:45:11 +00001012 } else
1013 yyerror("Invalid type for index");
1014 }
Reid Spencereff838e2007-01-03 23:45:42 +00001015 // Resolve upreferences so we can return a more natural type
1016 if (Result->isPointer()) {
1017 if (Result->getElementType()->isUpReference()) {
1018 stack.push_back(Result);
1019 Result = ResolveUpReference(Result->getElementType(), &stack);
1020 }
1021 } else if (Result->isUpReference()) {
1022 Result = ResolveUpReference(Result->getElementType(), &stack);
1023 }
Reid Spencer52402b02007-01-02 05:45:11 +00001024 return Result->getPointerType();
1025}
1026
Reid Spencer52402b02007-01-02 05:45:11 +00001027
1028// This function handles appending .u or .s to integer value names that
1029// were previously unsigned or signed, respectively. This avoids name
1030// collisions since the unsigned and signed type planes have collapsed
1031// into a single signless type plane.
Reid Spencer319a7302007-01-05 17:20:02 +00001032static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
Reid Spencerf8383de2007-01-06 06:04:32 +00001033 bool isGlobal = false, bool isDef = false) {
Reid Spencer319a7302007-01-05 17:20:02 +00001034
Reid Spencer52402b02007-01-02 05:45:11 +00001035 // If its not a symbolic name, don't modify it, probably a constant val.
1036 if ((*Name)[0] != '%' && (*Name)[0] != '"')
1037 return *Name;
Reid Spencer319a7302007-01-05 17:20:02 +00001038
Reid Spencer52402b02007-01-02 05:45:11 +00001039 // If its a numeric reference, just leave it alone.
1040 if (isdigit((*Name)[1]))
1041 return *Name;
1042
1043 // Resolve the type
Reid Spencer319a7302007-01-05 17:20:02 +00001044 Ty = Ty->resolve();
1045
1046 // If its a global name, get its uniquified name, if any
1047 GlobalsTypeMap::iterator GI = Globals.find(*Name);
1048 if (GI != Globals.end()) {
1049 TypePlaneMap::iterator TPI = GI->second.begin();
1050 TypePlaneMap::iterator TPE = GI->second.end();
1051 for ( ; TPI != TPE ; ++TPI) {
1052 if (TPI->first->sameNewTyAs(Ty))
1053 return TPI->second;
1054 }
1055 }
1056
1057 if (isGlobal) {
1058 // We didn't find a global name, but if its supposed to be global then all
1059 // we can do is return the name. This is probably a forward reference of a
1060 // global value that hasn't been defined yet. Since we have no definition
1061 // we don't know its linkage class. Just assume its an external and the name
1062 // shouldn't change.
1063 return *Name;
1064 }
Reid Spencer52402b02007-01-02 05:45:11 +00001065
1066 // Default the result to the current name
Reid Spencerf8383de2007-01-06 06:04:32 +00001067 std::string Result = Ty->makeUniqueName(*Name);
Reid Spencer52402b02007-01-02 05:45:11 +00001068
Reid Spencer52402b02007-01-02 05:45:11 +00001069 return Result;
1070}
1071
Reid Spencer319a7302007-01-05 17:20:02 +00001072static unsigned UniqueNameCounter = 0;
Reid Spencer229e9362006-12-02 22:14:11 +00001073
Reid Spencer319a7302007-01-05 17:20:02 +00001074std::string getGlobalName(const std::string* Name, const std::string Linkage,
1075 const TypeInfo* Ty, bool isConstant) {
1076 // Default to given name
1077 std::string Result = *Name;
1078 // Look up the name in the Globals Map
1079 GlobalsTypeMap::iterator GI = Globals.find(*Name);
1080 // Did we see this global name before?
1081 if (GI != Globals.end()) {
1082 if (Ty->isUnresolvedDeep()) {
1083 // The Gval's type is unresolved. Consequently, we can't disambiguate it
1084 // by type. We'll just change its name and emit a warning.
1085 warning("Cannot disambiguate global value '" + *Name +
1086 "' because type '" + Ty->getNewTy() + "'is unresolved.\n");
1087 Result = *Name + ".unique";
1088 UniqueNameCounter++;
1089 Result += llvm::utostr(UniqueNameCounter);
1090 return Result;
1091 } else {
1092 TypePlaneMap::iterator TPI = GI->second.find(Ty);
1093 if (TPI != GI->second.end()) {
1094 // We found an existing name of the same old type. This isn't allowed
1095 // in LLVM 2.0. Consequently, we must alter the name of the global so it
1096 // can at least compile. References to the global will yield the first
1097 // definition, which is okay. We also must warn about this.
1098 Result = *Name + ".unique";
1099 UniqueNameCounter++;
1100 Result += llvm::utostr(UniqueNameCounter);
1101 warning(std::string("Global variable '") + *Name + "' was renamed to '"+
1102 Result + "'");
1103 } else {
1104 // There isn't an existing definition for this name according to the
1105 // old types. Now search the TypePlanMap for types with the same new
1106 // name.
1107 TypePlaneMap::iterator TPI = GI->second.begin();
1108 TypePlaneMap::iterator TPE = GI->second.end();
1109 for ( ; TPI != TPE; ++TPI) {
1110 if (TPI->first->sameNewTyAs(Ty)) {
1111 // The new types are the same but the old types are different so
1112 // this is a global name collision resulting from type planes
1113 // collapsing.
1114 if (Linkage == "external" || Linkage == "dllimport" ||
1115 Linkage == "extern_weak" || Linkage == "") {
1116 // The linkage of this gval is external so we can't reliably
1117 // rename it because it could potentially create a linking
1118 // problem. However, we can't leave the name conflict in the
1119 // output either or it won't assemble with LLVM 2.0. So, all we
1120 // can do is rename this one to something unique and emit a
1121 // warning about the problem.
1122 Result = *Name + ".unique";
1123 UniqueNameCounter++;
1124 Result += llvm::utostr(UniqueNameCounter);
1125 warning("Renaming global value '" + *Name + "' to '" + Result +
1126 "' may cause linkage errors.");
1127 return Result;
1128 } else {
1129 // Its linkage is internal and its type is known so we can
1130 // disambiguate the name collision successfully based on the type.
1131 Result = getUniqueName(Name, Ty);
1132 TPI->second = Result;
1133 return Result;
1134 }
1135 }
1136 }
1137 // We didn't find an entry in the type plane with the same new type and
1138 // the old types differ so this is a new type plane for this global
1139 // variable. We just fall through to the logic below which inserts
1140 // the global.
1141 }
1142 }
1143 }
1144
1145 // Its a new global name, if it is external we can't change it
1146 if (isConstant || Linkage == "external" || Linkage == "dllimport" ||
1147 Linkage == "extern_weak" || Linkage == "") {
1148 Globals[Result][Ty] = Result;
1149 return Result;
1150 }
1151
1152 // Its a new global name, and it is internal, change the name to make it
1153 // unique for its type.
1154 // Result = getUniqueName(Name, Ty);
1155 Globals[*Name][Ty] = Result;
1156 return Result;
1157}
1158
1159
1160/* Enabling traces. */
1161#ifndef YYDEBUG
1162# define YYDEBUG 0
1163#endif
1164
1165/* Enabling verbose error messages. */
1166#ifdef YYERROR_VERBOSE
1167# undef YYERROR_VERBOSE
1168# define YYERROR_VERBOSE 1
1169#else
1170# define YYERROR_VERBOSE 0
1171#endif
1172
1173/* Enabling the token table. */
1174#ifndef YYTOKEN_TABLE
1175# define YYTOKEN_TABLE 0
1176#endif
1177
1178#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
Reid Spencerc4d96252007-01-13 00:03:30 +00001179#line 806 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00001180typedef union YYSTYPE {
Reid Spencere77e35e2006-12-01 20:26:20 +00001181 std::string* String;
Reid Spencer319a7302007-01-05 17:20:02 +00001182 const TypeInfo* Type;
Reid Spencere77e35e2006-12-01 20:26:20 +00001183 ValueInfo Value;
1184 ConstInfo Const;
Reid Spencerf8483652006-12-02 15:16:01 +00001185 ValueList* ValList;
Reid Spencer52402b02007-01-02 05:45:11 +00001186 TypeList* TypeVec;
Reid Spencere77e35e2006-12-01 20:26:20 +00001187} YYSTYPE;
Reid Spencer319a7302007-01-05 17:20:02 +00001188/* Line 196 of yacc.c. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001189#line 1190 "UpgradeParser.tab.c"
Reid Spencer319a7302007-01-05 17:20:02 +00001190# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1191# define YYSTYPE_IS_DECLARED 1
1192# define YYSTYPE_IS_TRIVIAL 1
Reid Spencere7c3c602006-11-30 06:36:44 +00001193#endif
1194
1195
1196
Reid Spencer319a7302007-01-05 17:20:02 +00001197/* Copy the second part of user declarations. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001198
1199
Reid Spencer319a7302007-01-05 17:20:02 +00001200/* Line 219 of yacc.c. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001201#line 1202 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00001202
Reid Spencer319a7302007-01-05 17:20:02 +00001203#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1204# define YYSIZE_T __SIZE_TYPE__
1205#endif
1206#if ! defined (YYSIZE_T) && defined (size_t)
1207# define YYSIZE_T size_t
1208#endif
1209#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1210# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1211# define YYSIZE_T size_t
1212#endif
1213#if ! defined (YYSIZE_T)
1214# define YYSIZE_T unsigned int
1215#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001216
Reid Spencer319a7302007-01-05 17:20:02 +00001217#ifndef YY_
1218# if YYENABLE_NLS
1219# if ENABLE_NLS
1220# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1221# define YY_(msgid) dgettext ("bison-runtime", msgid)
1222# endif
1223# endif
1224# ifndef YY_
1225# define YY_(msgid) msgid
1226# endif
1227#endif
1228
1229#if ! defined (yyoverflow) || YYERROR_VERBOSE
1230
1231/* The parser invokes alloca or malloc; define the necessary symbols. */
1232
1233# ifdef YYSTACK_USE_ALLOCA
1234# if YYSTACK_USE_ALLOCA
1235# ifdef __GNUC__
1236# define YYSTACK_ALLOC __builtin_alloca
1237# else
1238# define YYSTACK_ALLOC alloca
1239# if defined (__STDC__) || defined (__cplusplus)
1240# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1241# define YYINCLUDED_STDLIB_H
1242# endif
1243# endif
1244# endif
1245# endif
1246
1247# ifdef YYSTACK_ALLOC
1248 /* Pacify GCC's `empty if-body' warning. */
1249# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1250# ifndef YYSTACK_ALLOC_MAXIMUM
1251 /* The OS might guarantee only one guard page at the bottom of the stack,
1252 and a page size can be as small as 4096 bytes. So we cannot safely
1253 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1254 to allow for a few compiler-allocated temporary stack slots. */
1255# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1256# endif
1257# else
1258# define YYSTACK_ALLOC YYMALLOC
1259# define YYSTACK_FREE YYFREE
1260# ifndef YYSTACK_ALLOC_MAXIMUM
1261# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1262# endif
1263# ifdef __cplusplus
1264extern "C" {
1265# endif
1266# ifndef YYMALLOC
1267# define YYMALLOC malloc
1268# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1269 && (defined (__STDC__) || defined (__cplusplus)))
1270void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1271# endif
1272# endif
1273# ifndef YYFREE
1274# define YYFREE free
1275# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1276 && (defined (__STDC__) || defined (__cplusplus)))
1277void free (void *); /* INFRINGES ON USER NAME SPACE */
1278# endif
1279# endif
1280# ifdef __cplusplus
1281}
1282# endif
1283# endif
1284#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1285
1286
1287#if (! defined (yyoverflow) \
1288 && (! defined (__cplusplus) \
1289 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1290
1291/* A type that is properly aligned for any stack member. */
1292union yyalloc
1293{
1294 short int yyss;
1295 YYSTYPE yyvs;
1296 };
1297
1298/* The size of the maximum gap between one aligned stack and the next. */
1299# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1300
1301/* The size of an array large to enough to hold all stacks, each with
1302 N elements. */
1303# define YYSTACK_BYTES(N) \
1304 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1305 + YYSTACK_GAP_MAXIMUM)
1306
1307/* Copy COUNT objects from FROM to TO. The source and destination do
1308 not overlap. */
1309# ifndef YYCOPY
1310# if defined (__GNUC__) && 1 < __GNUC__
1311# define YYCOPY(To, From, Count) \
1312 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1313# else
1314# define YYCOPY(To, From, Count) \
1315 do \
1316 { \
1317 YYSIZE_T yyi; \
1318 for (yyi = 0; yyi < (Count); yyi++) \
1319 (To)[yyi] = (From)[yyi]; \
1320 } \
1321 while (0)
1322# endif
1323# endif
1324
1325/* Relocate STACK from its old location to the new one. The
1326 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1327 elements in the stack, and YYPTR gives the new location of the
1328 stack. Advance YYPTR to a properly aligned location for the next
1329 stack. */
1330# define YYSTACK_RELOCATE(Stack) \
1331 do \
1332 { \
1333 YYSIZE_T yynewbytes; \
1334 YYCOPY (&yyptr->Stack, Stack, yysize); \
1335 Stack = &yyptr->Stack; \
1336 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1337 yyptr += yynewbytes / sizeof (*yyptr); \
1338 } \
1339 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00001340
1341#endif
1342
Reid Spencer319a7302007-01-05 17:20:02 +00001343#if defined (__STDC__) || defined (__cplusplus)
1344 typedef signed char yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001345#else
Reid Spencer319a7302007-01-05 17:20:02 +00001346 typedef short int yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001347#endif
1348
Reid Spencer319a7302007-01-05 17:20:02 +00001349/* YYFINAL -- State number of the termination state. */
1350#define YYFINAL 4
1351/* YYLAST -- Last index in YYTABLE. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001352#define YYLAST 1473
Reid Spencer319a7302007-01-05 17:20:02 +00001353
1354/* YYNTOKENS -- Number of terminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001355#define YYNTOKENS 164
Reid Spencer319a7302007-01-05 17:20:02 +00001356/* YYNNTS -- Number of nonterminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001357#define YYNNTS 76
Reid Spencer319a7302007-01-05 17:20:02 +00001358/* YYNRULES -- Number of rules. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001359#define YYNRULES 301
Reid Spencer319a7302007-01-05 17:20:02 +00001360/* YYNRULES -- Number of states. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001361#define YYNSTATES 585
Reid Spencer319a7302007-01-05 17:20:02 +00001362
1363/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1364#define YYUNDEFTOK 2
Reid Spencerc4d96252007-01-13 00:03:30 +00001365#define YYMAXUTOK 404
Reid Spencer319a7302007-01-05 17:20:02 +00001366
1367#define YYTRANSLATE(YYX) \
1368 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1369
1370/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1371static const unsigned char yytranslate[] =
1372{
1373 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1375 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001377 153, 154, 162, 2, 151, 2, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001379 158, 150, 159, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001382 2, 155, 152, 157, 2, 2, 2, 2, 2, 163,
Reid Spencer319a7302007-01-05 17:20:02 +00001383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001385 156, 2, 2, 160, 2, 161, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001386 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, 2, 2, 2, 2,
1397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1398 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1399 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1400 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1401 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1402 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1403 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1404 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1405 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1406 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1407 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1408 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1409 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1410 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1411 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1412 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Reid Spencerc4d96252007-01-13 00:03:30 +00001413 145, 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00001414};
1415
1416#if YYDEBUG
1417/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1418 YYRHS. */
1419static const unsigned short int yyprhs[] =
1420{
1421 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1422 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1423 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1424 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1425 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1426 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1427 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1428 139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1429 159, 161, 164, 165, 167, 169, 171, 173, 175, 177,
1430 179, 180, 182, 184, 186, 188, 190, 192, 195, 196,
1431 197, 200, 201, 205, 208, 209, 211, 212, 216, 218,
1432 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1433 241, 243, 245, 247, 249, 251, 253, 255, 257, 259,
1434 261, 264, 269, 275, 281, 285, 288, 294, 299, 302,
1435 304, 308, 310, 314, 316, 317, 322, 326, 330, 335,
1436 340, 344, 347, 350, 353, 356, 359, 362, 365, 368,
1437 371, 374, 381, 387, 396, 403, 410, 417, 425, 433,
1438 440, 447, 456, 465, 469, 471, 473, 475, 477, 480,
1439 483, 488, 491, 493, 495, 497, 502, 505, 510, 517,
1440 524, 531, 538, 542, 547, 548, 550, 552, 554, 558,
1441 562, 566, 570, 574, 578, 580, 581, 583, 585, 587,
1442 588, 591, 595, 597, 599, 603, 605, 606, 615, 617,
Reid Spencerc4d96252007-01-13 00:03:30 +00001443 619, 623, 625, 627, 631, 632, 634, 636, 637, 642,
1444 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
1445 665, 667, 673, 675, 677, 679, 681, 684, 687, 689,
1446 692, 695, 696, 698, 700, 702, 705, 708, 712, 722,
1447 732, 741, 756, 758, 760, 767, 773, 776, 783, 791,
1448 793, 797, 799, 800, 803, 805, 811, 817, 823, 830,
1449 837, 842, 847, 854, 859, 864, 871, 878, 881, 889,
1450 891, 894, 895, 897, 898, 902, 909, 913, 920, 923,
1451 928, 935
Reid Spencer319a7302007-01-05 17:20:02 +00001452};
1453
1454/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1455static const short int yyrhs[] =
1456{
Reid Spencerc4d96252007-01-13 00:03:30 +00001457 198, 0, -1, 19, -1, 20, -1, 17, -1, 18,
1458 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1459 -1, 84, -1, 85, -1, 86, -1, 87, -1, 88,
1460 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1461 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1462 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1463 -1, 106, -1, 117, -1, 118, -1, 119, -1, 120,
1464 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1465 -1, 112, -1, 113, -1, 114, -1, 115, -1, 116,
1466 -1, 117, -1, 118, -1, 119, -1, 120, -1, 25,
1467 -1, 26, -1, 129, -1, 130, -1, 131, -1, 132,
1468 -1, 138, -1, 139, -1, 140, -1, 141, -1, 142,
1469 -1, 143, -1, 144, -1, 145, -1, 146, -1, 147,
1470 -1, 148, -1, 149, -1, 137, -1, 11, -1, 9,
Reid Spencer319a7302007-01-05 17:20:02 +00001471 -1, 7, -1, 5, -1, 12, -1, 10, -1, 8,
Reid Spencerc4d96252007-01-13 00:03:30 +00001472 -1, 6, -1, 174, -1, 175, -1, 13, -1, 14,
1473 -1, 207, 150, -1, -1, 42, -1, 43, -1, 44,
Reid Spencer319a7302007-01-05 17:20:02 +00001474 -1, 48, -1, 45, -1, 46, -1, 47, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001475 65, -1, 66, -1, 67, -1, 68, -1, 69, -1,
1476 70, -1, 64, 18, -1, -1, -1, 56, 18, -1,
1477 -1, 151, 56, 18, -1, 37, 30, -1, -1, 183,
1478 -1, -1, 151, 186, 185, -1, 183, -1, 56, 18,
1479 -1, 189, -1, 3, -1, 191, -1, 3, -1, 191,
Reid Spencer319a7302007-01-05 17:20:02 +00001480 -1, 4, -1, 5, -1, 6, -1, 7, -1, 8,
1481 -1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
Reid Spencerc4d96252007-01-13 00:03:30 +00001482 -1, 14, -1, 15, -1, 16, -1, 222, -1, 190,
1483 -1, 152, 18, -1, 188, 153, 193, 154, -1, 155,
1484 18, 156, 191, 157, -1, 158, 18, 156, 191, 159,
1485 -1, 160, 192, 161, -1, 160, 161, -1, 158, 160,
1486 192, 161, 159, -1, 158, 160, 161, 159, -1, 191,
1487 162, -1, 191, -1, 192, 151, 191, -1, 192, -1,
1488 192, 151, 40, -1, 40, -1, -1, 189, 155, 196,
1489 157, -1, 189, 155, 157, -1, 189, 163, 30, -1,
1490 189, 158, 196, 159, -1, 189, 160, 196, 161, -1,
1491 189, 160, 161, -1, 189, 22, -1, 189, 23, -1,
1492 189, 222, -1, 189, 195, -1, 189, 24, -1, 174,
1493 166, -1, 175, 166, -1, 4, 25, -1, 4, 26,
1494 -1, 177, 21, -1, 173, 153, 194, 39, 189, 154,
1495 -1, 126, 153, 194, 237, 154, -1, 128, 153, 194,
1496 151, 194, 151, 194, 154, -1, 167, 153, 194, 151,
1497 194, 154, -1, 168, 153, 194, 151, 194, 154, -1,
1498 169, 153, 194, 151, 194, 154, -1, 99, 170, 153,
1499 194, 151, 194, 154, -1, 100, 171, 153, 194, 151,
1500 194, 154, -1, 172, 153, 194, 151, 194, 154, -1,
1501 134, 153, 194, 151, 194, 154, -1, 135, 153, 194,
1502 151, 194, 151, 194, 154, -1, 136, 153, 194, 151,
1503 194, 151, 194, 154, -1, 196, 151, 194, -1, 194,
1504 -1, 35, -1, 36, -1, 199, -1, 199, 216, -1,
1505 199, 218, -1, 199, 62, 61, 202, -1, 199, 31,
1506 -1, 201, -1, 49, -1, 57, -1, 201, 178, 27,
1507 187, -1, 201, 218, -1, 201, 62, 61, 202, -1,
1508 201, 178, 179, 197, 194, 185, -1, 201, 178, 200,
1509 197, 189, 185, -1, 201, 178, 45, 197, 189, 185,
1510 -1, 201, 178, 47, 197, 189, 185, -1, 201, 50,
1511 204, -1, 201, 58, 150, 205, -1, -1, 30, -1,
1512 55, -1, 54, -1, 52, 150, 203, -1, 53, 150,
1513 18, -1, 51, 150, 30, -1, 71, 150, 30, -1,
1514 155, 206, 157, -1, 206, 151, 30, -1, 30, -1,
1515 -1, 28, -1, 30, -1, 207, -1, -1, 189, 208,
1516 -1, 210, 151, 209, -1, 209, -1, 210, -1, 210,
1517 151, 40, -1, 40, -1, -1, 180, 187, 207, 153,
1518 211, 154, 184, 181, -1, 32, -1, 160, -1, 179,
1519 212, 213, -1, 33, -1, 161, -1, 214, 225, 215,
1520 -1, -1, 45, -1, 47, -1, -1, 34, 219, 217,
1521 212, -1, -1, 63, -1, 17, -1, 18, -1, 21,
1522 -1, 25, -1, 26, -1, 22, -1, 23, -1, 24,
1523 -1, 158, 196, 159, -1, 195, -1, 61, 220, 30,
1524 151, 30, -1, 165, -1, 207, -1, 222, -1, 221,
1525 -1, 189, 223, -1, 225, 226, -1, 226, -1, 227,
1526 229, -1, 227, 231, -1, -1, 29, -1, 77, -1,
1527 76, -1, 72, 224, -1, 72, 3, -1, 73, 15,
1528 223, -1, 73, 4, 223, 151, 15, 223, 151, 15,
1529 223, -1, 74, 176, 223, 151, 15, 223, 155, 230,
1530 157, -1, 74, 176, 223, 151, 15, 223, 155, 157,
1531 -1, 178, 75, 180, 187, 223, 153, 234, 154, 39,
1532 15, 223, 228, 15, 223, -1, 228, -1, 78, -1,
1533 230, 176, 221, 151, 15, 223, -1, 176, 221, 151,
1534 15, 223, -1, 178, 236, -1, 189, 155, 223, 151,
1535 223, 157, -1, 232, 151, 155, 223, 151, 223, 157,
1536 -1, 224, -1, 233, 151, 224, -1, 233, -1, -1,
1537 60, 59, -1, 59, -1, 167, 189, 223, 151, 223,
1538 -1, 168, 189, 223, 151, 223, -1, 169, 189, 223,
1539 151, 223, -1, 99, 170, 189, 223, 151, 223, -1,
1540 100, 171, 189, 223, 151, 223, -1, 172, 224, 151,
1541 224, -1, 173, 224, 39, 189, -1, 128, 224, 151,
1542 224, 151, 224, -1, 133, 224, 151, 189, -1, 134,
1543 224, 151, 224, -1, 135, 224, 151, 224, 151, 224,
1544 -1, 136, 224, 151, 224, 151, 224, -1, 127, 232,
1545 -1, 235, 180, 187, 223, 153, 234, 154, -1, 239,
1546 -1, 151, 233, -1, -1, 38, -1, -1, 121, 189,
1547 182, -1, 121, 189, 151, 10, 223, 182, -1, 122,
1548 189, 182, -1, 122, 189, 151, 10, 223, 182, -1,
1549 123, 224, -1, 238, 124, 189, 223, -1, 238, 125,
1550 224, 151, 189, 223, -1, 126, 189, 223, 237, -1
Reid Spencer319a7302007-01-05 17:20:02 +00001551};
1552
1553/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1554static const unsigned short int yyrline[] =
1555{
Reid Spencerc4d96252007-01-13 00:03:30 +00001556 0, 871, 871, 871, 872, 872, 876, 876, 876, 876,
1557 876, 876, 876, 877, 877, 877, 877, 878, 878, 878,
1558 879, 879, 879, 879, 879, 879, 880, 880, 880, 880,
1559 880, 880, 880, 880, 880, 880, 881, 881, 881, 881,
1560 881, 881, 881, 881, 881, 881, 882, 882, 882, 882,
1561 882, 882, 883, 883, 883, 883, 884, 884, 884, 884,
1562 884, 884, 884, 885, 885, 885, 885, 885, 885, 890,
1563 890, 890, 890, 891, 891, 891, 891, 892, 892, 893,
1564 893, 896, 899, 904, 904, 904, 904, 904, 904, 905,
1565 906, 909, 909, 909, 909, 909, 910, 911, 916, 921,
1566 922, 925, 926, 934, 940, 941, 944, 945, 954, 955,
1567 968, 968, 969, 969, 970, 974, 974, 974, 974, 974,
1568 974, 974, 975, 975, 975, 975, 975, 977, 980, 983,
1569 986, 990, 1003, 1009, 1015, 1025, 1028, 1038, 1041, 1049,
1570 1053, 1060, 1061, 1066, 1071, 1081, 1087, 1092, 1098, 1104,
1571 1110, 1115, 1121, 1127, 1134, 1140, 1146, 1152, 1158, 1164,
1572 1170, 1178, 1192, 1204, 1209, 1215, 1220, 1226, 1231, 1236,
1573 1244, 1249, 1254, 1264, 1269, 1274, 1274, 1284, 1289, 1292,
1574 1297, 1301, 1305, 1307, 1307, 1310, 1320, 1325, 1330, 1340,
1575 1350, 1360, 1370, 1375, 1380, 1385, 1387, 1387, 1390, 1395,
1576 1402, 1407, 1414, 1421, 1426, 1427, 1435, 1435, 1436, 1436,
1577 1438, 1447, 1451, 1455, 1458, 1463, 1466, 1469, 1492, 1493,
1578 1496, 1507, 1508, 1510, 1519, 1520, 1521, 1525, 1525, 1539,
1579 1540, 1543, 1543, 1543, 1543, 1543, 1543, 1543, 1544, 1545,
1580 1550, 1551, 1560, 1560, 1564, 1569, 1579, 1588, 1591, 1599,
1581 1603, 1608, 1611, 1617, 1617, 1619, 1624, 1629, 1634, 1642,
1582 1650, 1657, 1679, 1684, 1690, 1696, 1704, 1722, 1730, 1739,
1583 1743, 1750, 1751, 1755, 1760, 1763, 1772, 1780, 1789, 1797,
Reid Spencerf6e54592007-01-13 00:23:06 +00001584 1805, 1814, 1842, 1848, 1854, 1861, 1867, 1873, 1879, 1928,
1585 1933, 1934, 1938, 1939, 1942, 1950, 1959, 1967, 1976, 1982,
1586 1991, 2000
Reid Spencer319a7302007-01-05 17:20:02 +00001587};
1588#endif
1589
1590#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1591/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1592 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1593static const char *const yytname[] =
1594{
1595 "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE",
1596 "SHORT", "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE",
1597 "LABEL", "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL",
1598 "FPVAL", "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK",
1599 "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1600 "BEGINTOK", "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION",
1601 "VOLATILE", "TO", "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK",
Reid Spencerc4d96252007-01-13 00:03:30 +00001602 "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "EXTERNAL",
Reid Spencer319a7302007-01-05 17:20:02 +00001603 "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN",
1604 "UNINITIALIZED", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1605 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1606 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1607 "RET", "BR", "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE",
1608 "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM",
1609 "SREM", "FREM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT",
1610 "SETEQ", "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1611 "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE",
1612 "ULT", "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1613 "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR",
1614 "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST",
1615 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI",
1616 "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','",
1617 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1618 "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps",
1619 "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps",
1620 "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1621 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString",
1622 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV",
1623 "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
1624 "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1625 "Module", "DefinitionList", "External", "ConstPool", "AsmBlock",
1626 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1627 "Name", "OptName", "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH",
1628 "BEGIN", "FunctionHeader", "END", "Function", "FnDeclareLinkage",
Reid Spencerc4d96252007-01-13 00:03:30 +00001629 "FunctionProto", "@1", "OptSideEffect", "ConstValueRef",
1630 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1631 "BasicBlock", "InstructionList", "Unwind", "BBTerminatorInst",
1632 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE",
1633 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0
Reid Spencer319a7302007-01-05 17:20:02 +00001634};
1635#endif
1636
1637# ifdef YYPRINT
1638/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1639 token YYLEX-NUM. */
1640static const unsigned short int yytoknum[] =
1641{
1642 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1643 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1644 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1645 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1646 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1647 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1648 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1649 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1650 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1651 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1652 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1653 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1654 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1655 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1656 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Reid Spencerc4d96252007-01-13 00:03:30 +00001657 61, 44, 92, 40, 41, 91, 120, 93, 60, 62,
1658 123, 125, 42, 99
Reid Spencer319a7302007-01-05 17:20:02 +00001659};
1660# endif
1661
1662/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1663static const unsigned char yyr1[] =
1664{
Reid Spencerc4d96252007-01-13 00:03:30 +00001665 0, 164, 165, 165, 166, 166, 167, 167, 167, 167,
1666 167, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1667 169, 169, 169, 169, 169, 169, 170, 170, 170, 170,
Reid Spencer319a7302007-01-05 17:20:02 +00001668 170, 170, 170, 170, 170, 170, 171, 171, 171, 171,
Reid Spencerc4d96252007-01-13 00:03:30 +00001669 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1670 171, 171, 172, 172, 172, 172, 173, 173, 173, 173,
1671 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1672 174, 174, 174, 175, 175, 175, 175, 176, 176, 177,
1673 177, 178, 178, 179, 179, 179, 179, 179, 179, 179,
1674 179, 180, 180, 180, 180, 180, 180, 180, 180, 181,
1675 181, 182, 182, 183, 184, 184, 185, 185, 186, 186,
1676 187, 187, 188, 188, 189, 190, 190, 190, 190, 190,
1677 190, 190, 190, 190, 190, 190, 190, 191, 191, 191,
1678 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1679 192, 193, 193, 193, 193, 194, 194, 194, 194, 194,
1680 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
1681 194, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1682 195, 195, 195, 196, 196, 197, 197, 198, 199, 199,
1683 199, 199, 199, 200, 200, 201, 201, 201, 201, 201,
1684 201, 201, 201, 201, 201, 202, 203, 203, 204, 204,
1685 204, 204, 205, 206, 206, 206, 207, 207, 208, 208,
1686 209, 210, 210, 211, 211, 211, 211, 212, 213, 213,
1687 214, 215, 215, 216, 217, 217, 217, 219, 218, 220,
1688 220, 221, 221, 221, 221, 221, 221, 221, 221, 221,
1689 221, 221, 222, 222, 223, 223, 224, 225, 225, 226,
1690 227, 227, 227, 228, 228, 229, 229, 229, 229, 229,
1691 229, 229, 229, 229, 230, 230, 231, 232, 232, 233,
1692 233, 234, 234, 235, 235, 236, 236, 236, 236, 236,
1693 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1694 237, 237, 238, 238, 239, 239, 239, 239, 239, 239,
1695 239, 239
Reid Spencer319a7302007-01-05 17:20:02 +00001696};
1697
1698/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1699static const unsigned char yyr2[] =
1700{
1701 0, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1708 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1709 1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1710 0, 1, 1, 1, 1, 1, 1, 2, 0, 0,
1711 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1712 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1713 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1714 2, 4, 5, 5, 3, 2, 5, 4, 2, 1,
1715 3, 1, 3, 1, 0, 4, 3, 3, 4, 4,
1716 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1717 2, 6, 5, 8, 6, 6, 6, 7, 7, 6,
1718 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1719 4, 2, 1, 1, 1, 4, 2, 4, 6, 6,
1720 6, 6, 3, 4, 0, 1, 1, 1, 3, 3,
1721 3, 3, 3, 3, 1, 0, 1, 1, 1, 0,
1722 2, 3, 1, 1, 3, 1, 0, 8, 1, 1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001723 3, 1, 1, 3, 0, 1, 1, 0, 4, 0,
1724 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1725 1, 5, 1, 1, 1, 1, 2, 2, 1, 2,
1726 2, 0, 1, 1, 1, 2, 2, 3, 9, 9,
1727 8, 14, 1, 1, 6, 5, 2, 6, 7, 1,
1728 3, 1, 0, 2, 1, 5, 5, 5, 6, 6,
1729 4, 4, 6, 4, 4, 6, 6, 2, 7, 1,
1730 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
1731 6, 4
Reid Spencer319a7302007-01-05 17:20:02 +00001732};
1733
1734/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1735 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1736 means the default is an error. */
1737static const unsigned short int yydefact[] =
1738{
Reid Spencerc4d96252007-01-13 00:03:30 +00001739 194, 0, 90, 182, 1, 181, 227, 83, 84, 85,
1740 87, 88, 89, 86, 0, 98, 251, 178, 179, 206,
1741 207, 0, 0, 0, 90, 0, 186, 224, 0, 0,
1742 91, 92, 93, 94, 95, 96, 0, 0, 252, 251,
1743 248, 82, 0, 0, 0, 0, 192, 0, 0, 0,
1744 0, 0, 183, 184, 0, 0, 81, 225, 226, 98,
Reid Spencer319a7302007-01-05 17:20:02 +00001745 195, 180, 97, 111, 115, 116, 117, 118, 119, 120,
1746 121, 122, 123, 124, 125, 126, 127, 2, 3, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001747 0, 0, 0, 242, 0, 0, 110, 129, 114, 243,
1748 128, 218, 219, 220, 221, 222, 223, 247, 0, 0,
1749 0, 254, 253, 263, 293, 262, 249, 250, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001750 0, 0, 205, 193, 187, 185, 175, 176, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001751 0, 0, 228, 130, 0, 0, 0, 113, 135, 139,
1752 0, 0, 144, 138, 256, 0, 255, 0, 0, 72,
1753 76, 71, 75, 70, 74, 69, 73, 77, 78, 0,
1754 292, 274, 0, 98, 6, 7, 8, 9, 10, 11,
1755 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1756 22, 23, 24, 25, 0, 0, 0, 0, 0, 0,
1757 0, 0, 52, 53, 54, 55, 0, 0, 0, 0,
1758 68, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1759 65, 66, 67, 0, 0, 0, 0, 0, 98, 266,
1760 0, 289, 200, 197, 196, 198, 199, 201, 204, 0,
1761 106, 106, 115, 116, 117, 118, 119, 120, 121, 122,
1762 123, 124, 125, 0, 0, 0, 0, 106, 106, 0,
1763 0, 0, 0, 0, 134, 216, 143, 141, 0, 231,
1764 232, 233, 236, 237, 238, 234, 235, 229, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001765 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001766 0, 240, 245, 244, 246, 0, 257, 0, 273, 0,
1767 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1768 0, 50, 51, 36, 37, 38, 39, 40, 41, 42,
1769 43, 44, 45, 46, 47, 48, 49, 0, 101, 101,
1770 298, 0, 0, 287, 0, 0, 0, 0, 0, 0,
1771 0, 0, 0, 0, 0, 0, 0, 0, 202, 0,
1772 190, 191, 158, 159, 4, 5, 156, 157, 160, 151,
1773 152, 155, 0, 0, 0, 0, 154, 153, 188, 189,
1774 112, 112, 137, 0, 140, 215, 209, 212, 213, 0,
1775 0, 131, 230, 0, 0, 0, 0, 0, 0, 0,
1776 0, 174, 0, 0, 0, 0, 0, 0, 0, 0,
1777 0, 0, 0, 0, 294, 0, 296, 291, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001778 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001779 0, 0, 0, 203, 0, 0, 108, 106, 146, 0,
1780 0, 150, 0, 147, 132, 133, 136, 208, 210, 0,
1781 104, 142, 0, 0, 0, 291, 0, 0, 0, 0,
1782 0, 239, 0, 0, 0, 0, 0, 0, 0, 0,
1783 0, 0, 0, 0, 0, 0, 301, 0, 0, 0,
1784 283, 284, 0, 0, 0, 0, 0, 280, 281, 0,
1785 299, 0, 103, 109, 107, 145, 148, 149, 214, 211,
1786 105, 99, 0, 0, 0, 0, 0, 0, 0, 0,
1787 173, 0, 0, 0, 0, 0, 0, 0, 272, 0,
1788 0, 101, 102, 101, 269, 290, 0, 0, 0, 0,
1789 0, 275, 276, 277, 272, 0, 0, 217, 241, 0,
1790 0, 162, 0, 0, 0, 0, 0, 0, 0, 0,
1791 0, 0, 0, 271, 0, 278, 279, 0, 295, 297,
1792 0, 0, 0, 282, 285, 286, 0, 300, 100, 0,
1793 0, 0, 170, 0, 0, 164, 165, 166, 169, 161,
1794 0, 260, 0, 0, 0, 270, 267, 0, 288, 167,
1795 168, 0, 0, 0, 258, 0, 259, 0, 0, 268,
1796 163, 171, 172, 0, 0, 0, 0, 0, 0, 265,
1797 0, 0, 264, 0, 261
Reid Spencer319a7302007-01-05 17:20:02 +00001798};
1799
1800/* YYDEFGOTO[NTERM-NUM]. */
1801static const short int yydefgoto[] =
1802{
Reid Spencerc4d96252007-01-13 00:03:30 +00001803 -1, 83, 336, 266, 267, 268, 290, 307, 269, 270,
1804 233, 234, 149, 235, 24, 15, 36, 507, 384, 406,
1805 471, 330, 407, 84, 85, 236, 87, 88, 130, 248,
1806 371, 271, 372, 118, 1, 2, 55, 3, 61, 215,
1807 46, 113, 219, 89, 418, 357, 358, 359, 37, 93,
1808 16, 96, 17, 59, 18, 27, 363, 272, 90, 274,
1809 494, 39, 40, 41, 105, 106, 553, 107, 313, 523,
1810 524, 208, 209, 446, 210, 211
Reid Spencer319a7302007-01-05 17:20:02 +00001811};
1812
1813/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1814 STATE-NUM. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001815#define YYPACT_NINF -537
Reid Spencer319a7302007-01-05 17:20:02 +00001816static const short int yypact[] =
1817{
Reid Spencerc4d96252007-01-13 00:03:30 +00001818 -537, 75, 61, 1145, -537, -537, -537, -537, -537, -537,
1819 -537, -537, -537, -537, 18, 180, 55, -537, -537, -537,
1820 -537, -28, -61, 33, 130, -40, -537, 102, 87, 117,
1821 -537, -537, -537, -537, -537, -537, 838, -24, -537, -15,
1822 -537, 48, -11, -2, 6, 12, -537, 11, 87, 838,
1823 -9, -9, -537, -537, -9, -9, -537, -537, -537, 180,
1824 -537, -537, -537, 32, -537, -537, -537, -537, -537, -537,
1825 -537, -537, -537, -537, -537, -537, -537, -537, -537, 164,
1826 171, -6, 512, -537, 135, 41, -537, -537, -103, -537,
1827 -537, -537, -537, -537, -537, -537, -537, -537, 883, 45,
1828 192, -537, -537, -537, 1324, -537, -537, -537, 175, 126,
1829 190, 188, 203, -537, -537, -537, -537, -537, 911, 911,
1830 957, 911, -537, -537, 81, 97, 561, -537, -537, -103,
1831 -109, 121, 641, -537, 32, 1140, -537, 1140, 1140, -537,
1832 -537, -537, -537, -537, -537, -537, -537, -537, -537, 1140,
1833 -537, -537, 219, 180, -537, -537, -537, -537, -537, -537,
1834 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1835 -537, -537, -537, -537, 10, 112, 911, 911, 911, 911,
1836 911, 911, -537, -537, -537, -537, 911, 911, 911, 911,
1837 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1838 -537, -537, -537, 911, 911, 911, 911, 911, 180, -537,
1839 59, -537, -537, -537, -537, -537, -537, -537, -537, -71,
1840 129, 129, 167, 193, 195, 218, 222, 224, 234, 243,
1841 250, 261, 263, 252, 252, 264, 993, 129, 129, 911,
1842 911, 127, -97, 911, -537, 680, -537, 136, 137, -537,
1843 -537, -537, -537, -537, -537, -537, -537, 229, 10, 112,
1844 140, 141, 144, 145, 146, 957, 147, 148, 150, 154,
1845 155, -537, -537, -537, -537, 158, -537, 160, -537, 838,
1846 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1847 911, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1848 -537, -537, -537, -537, -537, -537, -537, 911, 163, 165,
1849 -537, 1140, 162, 169, 170, 172, 173, 174, 176, 1140,
1850 1140, 1140, 177, 276, 838, 911, 911, 288, -537, -8,
1851 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1852 -537, -537, 724, 957, 590, 292, -537, -537, -537, -537,
1853 -106, -104, -537, 179, -103, -537, 135, -537, 178, 181,
1854 752, -537, -537, 296, 183, 187, 957, 957, 957, 957,
1855 957, -537, -131, 957, 957, 957, 957, 957, 315, 316,
1856 1140, 1140, 1140, 1, -537, 7, -537, 191, 1140, 186,
1857 911, 911, 911, 911, 911, 194, 197, 201, 911, 911,
1858 1140, 1140, 202, -537, 304, 326, -537, 129, -537, -60,
1859 -78, -537, -74, -537, -537, -537, -537, -537, -537, 799,
1860 309, -537, 208, 957, 957, 191, 210, 213, 223, 225,
1861 957, -537, 230, 231, 235, 236, 308, 1140, 1140, 227,
1862 237, 238, 1140, 357, 1140, 911, -537, 239, 1140, 241,
1863 -537, -537, 242, 244, 1140, 1140, 1140, -537, -537, 248,
1864 -537, 911, -537, -537, -537, -537, -537, -537, -537, -537,
1865 -537, 338, 366, 246, 251, 249, 957, 957, 957, 957,
1866 -537, 957, 957, 957, 957, 911, 253, 258, 911, 1140,
1867 1140, 254, -537, 254, -537, 255, 1140, 256, 911, 911,
1868 911, -537, -537, -537, 911, 1140, 390, -537, -537, 957,
1869 957, -537, 265, 260, 266, 267, 268, 272, 274, 275,
1870 277, 400, 29, 255, 280, -537, -537, 363, -537, -537,
1871 911, 278, 1140, -537, -537, -537, 282, -537, -537, 283,
1872 287, 957, -537, 957, 957, -537, -537, -537, -537, -537,
1873 1140, -537, 1229, 60, 381, -537, -537, 286, -537, -537,
1874 -537, 290, 293, 294, -537, 270, -537, 1229, 435, -537,
1875 -537, -537, -537, 436, 302, 1140, 1140, 441, 196, -537,
1876 1140, 442, -537, 1140, -537
Reid Spencer319a7302007-01-05 17:20:02 +00001877};
1878
1879/* YYPGOTO[NTERM-NUM]. */
1880static const short int yypgoto[] =
1881{
Reid Spencerc4d96252007-01-13 00:03:30 +00001882 -537, -537, 226, 361, 362, 365, 209, 214, 368, 370,
1883 -99, -98, -507, -537, 420, 452, -134, -537, -303, 57,
1884 -537, -216, -537, -45, -537, -36, -537, -79, -30, -537,
1885 -111, 245, -210, 104, -537, -537, -537, -537, 431, -537,
1886 -537, -537, -537, 4, -537, 63, -537, -537, 421, -537,
1887 -537, -537, -537, -537, 480, -537, -537, -536, -105, 58,
1888 -88, -537, 445, -537, -93, -537, -537, -537, -537, 42,
1889 -18, -537, -537, 64, -537, -537
Reid Spencer319a7302007-01-05 17:20:02 +00001890};
1891
1892/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1893 positive, shift that token. If negative, reduce the rule which
1894 number is the opposite. If zero, do what YYDEFACT says.
1895 If YYTABLE_NINF, syntax error. */
1896#define YYTABLE_NINF -178
1897static const short int yytable[] =
1898{
Reid Spencerc4d96252007-01-13 00:03:30 +00001899 86, 147, 148, 129, 115, 331, 386, 25, 91, 237,
1900 136, 442, 125, 86, 38, 552, 565, 444, 94, 279,
1901 430, 348, 349, 42, 43, 44, 116, 117, 431, 404,
1902 273, 574, 273, 273, 139, 140, 141, 142, 143, 144,
1903 145, 146, 243, 45, 273, 25, 567, 129, 405, 137,
1904 -112, 414, 244, 129, 243, 415, 133, 443, 133, 133,
1905 138, -177, 135, 443, 353, 139, 140, 141, 142, 143,
1906 144, 145, 146, 430, 324, 4, 19, 430, 20, 28,
1907 327, 466, 220, 221, 38, 238, 328, 467, 131, 47,
1908 310, 430, 5, 314, 48, 6, 242, 465, 315, 316,
1909 317, 318, 247, 7, 8, 9, 10, 11, 12, 13,
1910 56, 280, 281, 282, 283, 284, 285, 60, 322, 323,
1911 98, 99, 100, 14, 101, 102, 103, 286, 287, 288,
1912 289, 347, 409, 410, 412, 62, 92, 291, 292, 108,
1913 308, 309, 135, 311, 312, 135, 95, 57, 109, 58,
1914 135, 135, 135, 135, 126, 119, 110, 49, 120, 121,
1915 350, 351, 111, 19, 354, 20, 112, 319, 320, 321,
1916 135, 135, 7, 8, 9, 50, 11, 51, 13, 52,
1917 213, 214, 123, 325, 326, -113, 551, 53, 528, 124,
1918 529, 464, 332, 333, 132, 275, 276, 139, 140, 141,
1919 142, 143, 144, 145, 146, 212, 273, 277, 216, 356,
1920 -72, -72, -76, -76, 273, 273, 273, 566, 217, 293,
1921 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
1922 304, 305, 306, 218, 380, -71, -71, 239, 402, -75,
1923 -75, -70, -70, 86, 29, 30, 31, 32, 33, 34,
1924 35, -74, -74, 240, 381, 425, 426, 427, 428, 429,
1925 -69, -69, 432, 433, 434, 435, 436, -73, -73, 334,
1926 335, 382, 101, 102, 245, 273, 273, 273, 278, 400,
1927 329, 354, -79, 273, -80, 338, 352, 360, 86, 401,
1928 135, 361, 362, 366, 367, 273, 273, 368, 369, 370,
1929 373, 374, 449, 375, 451, 452, 453, 376, 377, 378,
1930 457, 379, 473, 474, 383, 399, 385, 388, 403, 480,
1931 389, 390, 413, 391, 392, 393, 422, 394, 398, 419,
1932 437, 438, 273, 273, 462, 420, 423, 273, 416, 273,
1933 424, 448, 445, 273, 463, 454, 404, 485, 455, 273,
1934 273, 273, 456, 461, 135, 450, 135, 135, 135, 472,
1935 417, 476, 135, 458, 477, 512, 513, 514, 515, 387,
1936 516, 517, 518, 519, 478, 492, 479, 395, 396, 397,
1937 488, 481, 482, 356, 273, 273, 483, 484, 489, 490,
1938 496, 273, 498, 499, 506, 500, 508, 509, 539, 540,
1939 273, 504, 510, 511, 521, 527, 530, 532, 538, 135,
1940 533, 534, 535, 522, 542, 550, 541, 543, 544, 443,
1941 568, 573, 545, 147, 148, 505, 546, 273, 547, 548,
1942 561, 549, 562, 563, 554, 556, 558, 559, 439, 440,
1943 441, 560, 555, 569, 570, 273, 447, 571, 572, 520,
1944 575, 576, 135, 577, 147, 148, 580, 583, 459, 460,
1945 337, 104, 135, 135, 135, 203, 204, 364, 135, 205,
1946 273, 273, 206, 365, 207, 273, 54, 470, 273, 114,
1947 122, 346, 469, 26, 97, 581, 536, 495, 0, 475,
1948 0, 0, 0, 0, 135, 486, 487, 0, 0, 0,
1949 491, 0, 493, 0, 0, 0, 497, 0, 0, 0,
1950 0, 0, 501, 502, 503, 127, 64, 65, 66, 67,
1951 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
1952 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
1953 19, 0, 20, 0, 0, 0, 0, 525, 526, 0,
1954 0, 0, 0, 0, 531, 0, 0, 0, 0, 0,
1955 0, 0, 0, 537, 127, 64, 65, 66, 67, 68,
1956 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
1957 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
1958 557, 20, 0, 127, 222, 223, 224, 225, 226, 227,
1959 228, 229, 230, 231, 232, 75, 76, 0, 564, 77,
1960 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
1961 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1962 0, 0, 0, 578, 579, 0, 0, 0, 582, 0,
1963 0, 584, 0, 0, 127, 64, 65, 66, 67, 68,
1964 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
1965 77, 78, 0, 0, 79, 0, 0, 80, 0, 19,
1966 81, 20, 82, 128, 0, 0, 0, 0, 0, 0,
1967 0, 246, 0, 127, 64, 65, 66, 67, 68, 69,
1968 70, 71, 72, 73, 74, 75, 76, 0, 0, 77,
1969 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
1970 20, 0, 0, 79, 0, 0, 80, 0, 0, 81,
1971 355, 82, 241, 0, 0, 0, 0, 127, 222, 223,
1972 224, 225, 226, 227, 228, 229, 230, 231, 232, 75,
1973 76, 0, 79, 77, 78, 80, 0, 0, 81, 0,
1974 82, 411, 19, 0, 20, 127, 64, 65, 66, 67,
1975 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
1976 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
1977 19, 0, 20, 0, 0, 0, 0, 0, 0, 0,
1978 0, 0, 421, 79, 0, 0, 80, 0, 0, 81,
1979 0, 82, 127, 64, 65, 66, 67, 68, 69, 70,
1980 71, 72, 73, 74, 75, 76, 0, 0, 77, 78,
1981 0, 0, 0, 0, 0, 0, 0, 19, 0, 20,
1982 0, 0, 79, 0, 0, 80, 0, 0, 81, 468,
1983 82, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1984 72, 73, 74, 75, 76, 0, 0, 77, 78, 0,
1985 0, 0, 0, 0, 0, 0, 19, 0, 20, 0,
1986 0, 0, 0, 0, 0, 0, 79, 0, 0, 80,
1987 0, 408, 81, 0, 82, 0, 134, 64, 65, 66,
1988 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1989 0, 0, 77, 78, 79, 0, 0, 80, 0, 0,
1990 81, 19, 82, 20, 127, 64, 65, 66, 67, 68,
Reid Spencer319a7302007-01-05 17:20:02 +00001991 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
1992 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
1993 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001994 0, 79, 0, 0, 80, 0, 0, 81, 0, 82,
1995 127, 222, 223, 224, 225, 226, 227, 228, 229, 230,
1996 231, 232, 75, 76, 0, 0, 77, 78, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00001997 0, 0, 0, 0, 0, 19, 0, 20, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001998 79, 0, 0, 80, 0, 0, 81, 0, 82, 0,
1999 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2000 0, 0, 77, 78, 0, 339, 340, 341, 0, 0,
2001 0, 19, 0, 20, 0, 0, 0, 0, 0, 0,
2002 0, 0, 0, 0, 0, 79, 0, 0, 80, 0,
2003 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002004 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002005 0, 0, 0, 79, 0, 0, 80, 0, 0, 81,
Reid Spencerc4d96252007-01-13 00:03:30 +00002006 0, 82, 154, 155, 156, 157, 158, 159, 160, 161,
2007 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
2008 172, 173, 258, 259, 0, 0, 0, 0, 0, 0,
2009 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,
2010 0, 0, 80, 0, 0, 81, 0, 82, 0, 260,
2011 0, 261, 182, 183, 184, 185, 0, 262, 263, 264,
2012 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
2013 200, 201, 202, 0, 0, 0, 0, 0, 342, 0,
2014 0, 343, 0, 344, 0, 0, 345, 249, 250, 77,
2015 78, 251, 252, 253, 254, 255, 256, 0, 19, 0,
2016 20, 0, -82, 19, 0, 20, 0, 0, 0, 6,
2017 -82, -82, 0, 0, 0, 0, 0, -82, -82, -82,
2018 -82, -82, -82, -82, -82, 21, 0, 0, 0, 0,
2019 0, 257, -82, 22, 0, 0, 0, 23, 0, 0,
2020 0, 0, 0, 0, 0, 0, 0, 0, 0, 154,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002021 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
Reid Spencerc4d96252007-01-13 00:03:30 +00002022 165, 166, 167, 168, 169, 170, 171, 172, 173, 258,
2023 259, 0, 0, 0, 0, 0, 249, 250, 0, 0,
2024 251, 252, 253, 254, 255, 256, 0, 0, 0, 0,
2025 0, 0, 0, 0, 0, 0, 260, 0, 261, 182,
2026 183, 184, 185, 0, 262, 263, 264, 190, 191, 192,
2027 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
2028 257, 0, 0, 0, 0, 0, 0, 0, 265, 0,
2029 0, 0, 0, 0, 0, 0, 0, 0, 154, 155,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002030 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
Reid Spencerc4d96252007-01-13 00:03:30 +00002031 166, 167, 168, 169, 170, 171, 172, 173, 258, 259,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002032 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002034 0, 0, 0, 0, 0, 260, 0, 261, 182, 183,
2035 184, 185, 150, 262, 263, 264, 190, 191, 192, 193,
2036 194, 195, 196, 197, 198, 199, 200, 201, 202, 0,
2037 0, 0, 0, 151, 152, 0, 0, 265, 0, 0,
2038 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
2039 0, 0, 0, 154, 155, 156, 157, 158, 159, 160,
2040 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
2041 171, 172, 173, 174, 175, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002042 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002043 0, 0, 0, 0, 0, 176, 177, 178, 0, 0,
2044 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2045 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2046 199, 200, 201, 202
Reid Spencer319a7302007-01-05 17:20:02 +00002047};
2048
2049static const short int yycheck[] =
2050{
Reid Spencerc4d96252007-01-13 00:03:30 +00002051 36, 100, 100, 82, 49, 221, 309, 3, 32, 120,
2052 98, 10, 18, 49, 29, 522, 552, 10, 33, 153,
2053 151, 237, 238, 51, 52, 53, 35, 36, 159, 37,
2054 135, 567, 137, 138, 5, 6, 7, 8, 9, 10,
2055 11, 12, 151, 71, 149, 41, 553, 126, 56, 4,
2056 153, 157, 161, 132, 151, 159, 162, 56, 162, 162,
2057 15, 0, 98, 56, 161, 5, 6, 7, 8, 9,
2058 10, 11, 12, 151, 208, 0, 28, 151, 30, 61,
2059 151, 159, 118, 119, 29, 121, 157, 161, 84, 150,
2060 178, 151, 31, 181, 61, 34, 126, 157, 186, 187,
2061 188, 189, 132, 42, 43, 44, 45, 46, 47, 48,
2062 150, 101, 102, 103, 104, 105, 106, 30, 206, 207,
2063 72, 73, 74, 62, 76, 77, 78, 117, 118, 119,
2064 120, 236, 342, 343, 344, 18, 160, 25, 26, 150,
2065 176, 177, 178, 179, 180, 181, 161, 45, 150, 47,
2066 186, 187, 188, 189, 160, 51, 150, 27, 54, 55,
2067 239, 240, 150, 28, 243, 30, 155, 203, 204, 205,
2068 206, 207, 42, 43, 44, 45, 46, 47, 48, 49,
2069 54, 55, 18, 124, 125, 153, 157, 57, 491, 18,
2070 493, 407, 25, 26, 153, 137, 138, 5, 6, 7,
2071 8, 9, 10, 11, 12, 30, 311, 149, 18, 245,
2072 17, 18, 17, 18, 319, 320, 321, 157, 30, 107,
2073 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2074 118, 119, 120, 30, 279, 17, 18, 156, 326, 17,
2075 18, 17, 18, 279, 64, 65, 66, 67, 68, 69,
2076 70, 17, 18, 156, 290, 366, 367, 368, 369, 370,
2077 17, 18, 373, 374, 375, 376, 377, 17, 18, 17,
2078 18, 307, 76, 77, 153, 380, 381, 382, 59, 324,
2079 151, 360, 21, 388, 21, 21, 159, 151, 324, 325,
2080 326, 154, 63, 153, 153, 400, 401, 153, 153, 153,
2081 153, 153, 390, 153, 392, 393, 394, 153, 153, 151,
2082 398, 151, 423, 424, 151, 39, 151, 155, 30, 430,
2083 151, 151, 30, 151, 151, 151, 30, 151, 151, 151,
2084 15, 15, 437, 438, 30, 154, 153, 442, 159, 444,
2085 153, 155, 151, 448, 18, 151, 37, 39, 151, 454,
2086 455, 456, 151, 151, 390, 391, 392, 393, 394, 151,
2087 356, 151, 398, 399, 151, 476, 477, 478, 479, 311,
2088 481, 482, 483, 484, 151, 18, 151, 319, 320, 321,
2089 153, 151, 151, 419, 489, 490, 151, 151, 151, 151,
2090 151, 496, 151, 151, 56, 151, 30, 151, 509, 510,
2091 505, 153, 151, 154, 151, 151, 151, 151, 18, 445,
2092 498, 499, 500, 155, 154, 15, 151, 151, 151, 56,
2093 39, 151, 154, 522, 522, 461, 154, 532, 154, 154,
2094 541, 154, 543, 544, 154, 157, 154, 154, 380, 381,
2095 382, 154, 530, 157, 154, 550, 388, 154, 154, 485,
2096 15, 15, 488, 151, 553, 553, 15, 15, 400, 401,
2097 234, 41, 498, 499, 500, 104, 104, 258, 504, 104,
2098 575, 576, 104, 259, 104, 580, 24, 420, 583, 48,
2099 59, 236, 419, 3, 39, 578, 504, 445, -1, 425,
2100 -1, -1, -1, -1, 530, 437, 438, -1, -1, -1,
2101 442, -1, 444, -1, -1, -1, 448, -1, -1, -1,
2102 -1, -1, 454, 455, 456, 3, 4, 5, 6, 7,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002103 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002104 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2105 28, -1, 30, -1, -1, -1, -1, 489, 490, -1,
2106 -1, -1, -1, -1, 496, -1, -1, -1, -1, -1,
2107 -1, -1, -1, 505, 3, 4, 5, 6, 7, 8,
2108 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2109 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2110 532, 30, -1, 3, 4, 5, 6, 7, 8, 9,
2111 10, 11, 12, 13, 14, 15, 16, -1, 550, 19,
2112 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2113 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2114 -1, -1, -1, 575, 576, -1, -1, -1, 580, -1,
2115 -1, 583, -1, -1, 3, 4, 5, 6, 7, 8,
2116 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2117 19, 20, -1, -1, 152, -1, -1, 155, -1, 28,
2118 158, 30, 160, 161, -1, -1, -1, -1, -1, -1,
2119 -1, 40, -1, 3, 4, 5, 6, 7, 8, 9,
2120 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
2121 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2122 30, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2123 40, 160, 161, -1, -1, -1, -1, 3, 4, 5,
2124 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2125 16, -1, 152, 19, 20, 155, -1, -1, 158, -1,
2126 160, 161, 28, -1, 30, 3, 4, 5, 6, 7,
2127 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2128 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2129 28, -1, 30, -1, -1, -1, -1, -1, -1, -1,
2130 -1, -1, 40, 152, -1, -1, 155, -1, -1, 158,
2131 -1, 160, 3, 4, 5, 6, 7, 8, 9, 10,
2132 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2133 -1, -1, -1, -1, -1, -1, -1, 28, -1, 30,
2134 -1, -1, 152, -1, -1, 155, -1, -1, 158, 40,
2135 160, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2136 12, 13, 14, 15, 16, -1, -1, 19, 20, -1,
2137 -1, -1, -1, -1, -1, -1, 28, -1, 30, -1,
2138 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2139 -1, 157, 158, -1, 160, -1, 3, 4, 5, 6,
2140 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2141 -1, -1, 19, 20, 152, -1, -1, 155, -1, -1,
2142 158, 28, 160, 30, 3, 4, 5, 6, 7, 8,
Reid Spencer319a7302007-01-05 17:20:02 +00002143 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2144 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2145 -1, 30, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002146 -1, 152, -1, -1, 155, -1, -1, 158, -1, 160,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002147 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2148 13, 14, 15, 16, -1, -1, 19, 20, -1, -1,
2149 -1, -1, -1, -1, -1, 28, -1, 30, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002150 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002151 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002152 -1, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2153 -1, 28, -1, 30, -1, -1, -1, -1, -1, -1,
2154 -1, -1, -1, -1, -1, 152, -1, -1, 155, -1,
2155 -1, 158, -1, 160, -1, -1, -1, -1, -1, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002157 -1, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2158 -1, 160, 79, 80, 81, 82, 83, 84, 85, 86,
2159 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2160 97, 98, 99, 100, -1, -1, -1, -1, -1, -1,
2161 -1, -1, -1, -1, -1, -1, -1, -1, -1, 152,
2162 -1, -1, 155, -1, -1, 158, -1, 160, -1, 126,
2163 -1, 128, 129, 130, 131, 132, -1, 134, 135, 136,
2164 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2165 147, 148, 149, -1, -1, -1, -1, -1, 155, -1,
2166 -1, 158, -1, 160, -1, -1, 163, 17, 18, 19,
2167 20, 21, 22, 23, 24, 25, 26, -1, 28, -1,
2168 30, -1, 27, 28, -1, 30, -1, -1, -1, 34,
2169 35, 36, -1, -1, -1, -1, -1, 42, 43, 44,
2170 45, 46, 47, 48, 49, 50, -1, -1, -1, -1,
2171 -1, 61, 57, 58, -1, -1, -1, 62, -1, -1,
2172 -1, -1, -1, -1, -1, -1, -1, -1, -1, 79,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002173 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2174 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
Reid Spencerc4d96252007-01-13 00:03:30 +00002175 100, -1, -1, -1, -1, -1, 17, 18, -1, -1,
2176 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
2177 -1, -1, -1, -1, -1, -1, 126, -1, 128, 129,
2178 130, 131, 132, -1, 134, 135, 136, 137, 138, 139,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002179 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
Reid Spencerc4d96252007-01-13 00:03:30 +00002180 61, -1, -1, -1, -1, -1, -1, -1, 158, -1,
2181 -1, -1, -1, -1, -1, -1, -1, -1, 79, 80,
2182 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2183 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002184 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2185 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002186 -1, -1, -1, -1, -1, 126, -1, 128, 129, 130,
2187 131, 132, 38, 134, 135, 136, 137, 138, 139, 140,
2188 141, 142, 143, 144, 145, 146, 147, 148, 149, -1,
2189 -1, -1, -1, 59, 60, -1, -1, 158, -1, -1,
2190 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2191 -1, -1, -1, 79, 80, 81, 82, 83, 84, 85,
2192 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2193 96, 97, 98, 99, 100, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002194 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002195 -1, -1, -1, -1, -1, 121, 122, 123, -1, -1,
2196 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2197 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2198 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00002199};
2200
2201/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2202 symbol of state STATE-NUM. */
2203static const unsigned char yystos[] =
2204{
Reid Spencerc4d96252007-01-13 00:03:30 +00002205 0, 198, 199, 201, 0, 31, 34, 42, 43, 44,
2206 45, 46, 47, 48, 62, 179, 214, 216, 218, 28,
2207 30, 50, 58, 62, 178, 207, 218, 219, 61, 64,
2208 65, 66, 67, 68, 69, 70, 180, 212, 29, 225,
2209 226, 227, 51, 52, 53, 71, 204, 150, 61, 27,
2210 45, 47, 49, 57, 179, 200, 150, 45, 47, 217,
2211 30, 202, 18, 3, 4, 5, 6, 7, 8, 9,
2212 10, 11, 12, 13, 14, 15, 16, 19, 20, 152,
2213 155, 158, 160, 165, 187, 188, 189, 190, 191, 207,
2214 222, 32, 160, 213, 33, 161, 215, 226, 72, 73,
2215 74, 76, 77, 78, 178, 228, 229, 231, 150, 150,
2216 150, 150, 155, 205, 202, 187, 35, 36, 197, 197,
2217 197, 197, 212, 18, 18, 18, 160, 3, 161, 191,
2218 192, 207, 153, 162, 3, 189, 224, 4, 15, 5,
2219 6, 7, 8, 9, 10, 11, 12, 174, 175, 176,
2220 38, 59, 60, 75, 79, 80, 81, 82, 83, 84,
2221 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2222 95, 96, 97, 98, 99, 100, 121, 122, 123, 126,
2223 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2224 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2225 147, 148, 149, 167, 168, 169, 172, 173, 235, 236,
2226 238, 239, 30, 54, 55, 203, 18, 30, 30, 206,
2227 189, 189, 4, 5, 6, 7, 8, 9, 10, 11,
2228 12, 13, 14, 174, 175, 177, 189, 194, 189, 156,
2229 156, 161, 192, 151, 161, 153, 40, 192, 193, 17,
2230 18, 21, 22, 23, 24, 25, 26, 61, 99, 100,
2231 126, 128, 134, 135, 136, 158, 167, 168, 169, 172,
2232 173, 195, 221, 222, 223, 223, 223, 223, 59, 180,
2233 101, 102, 103, 104, 105, 106, 117, 118, 119, 120,
2234 170, 25, 26, 107, 108, 109, 110, 111, 112, 113,
2235 114, 115, 116, 117, 118, 119, 120, 171, 189, 189,
2236 224, 189, 189, 232, 224, 224, 224, 224, 224, 189,
2237 189, 189, 224, 224, 180, 124, 125, 151, 157, 151,
2238 185, 185, 25, 26, 17, 18, 166, 166, 21, 22,
2239 23, 24, 155, 158, 160, 163, 195, 222, 185, 185,
2240 191, 191, 159, 161, 191, 40, 189, 209, 210, 211,
2241 151, 154, 63, 220, 170, 171, 153, 153, 153, 153,
2242 153, 194, 196, 153, 153, 153, 153, 153, 151, 151,
2243 187, 189, 189, 151, 182, 151, 182, 223, 155, 151,
2244 151, 151, 151, 151, 151, 223, 223, 223, 151, 39,
2245 187, 189, 224, 30, 37, 56, 183, 186, 157, 196,
2246 196, 161, 196, 30, 157, 159, 159, 207, 208, 151,
2247 154, 40, 30, 153, 153, 194, 194, 194, 194, 194,
2248 151, 159, 194, 194, 194, 194, 194, 15, 15, 223,
2249 223, 223, 10, 56, 10, 151, 237, 223, 155, 224,
2250 189, 224, 224, 224, 151, 151, 151, 224, 189, 223,
2251 223, 151, 30, 18, 185, 157, 159, 161, 40, 209,
2252 183, 184, 151, 194, 194, 237, 151, 151, 151, 151,
2253 194, 151, 151, 151, 151, 39, 223, 223, 153, 151,
2254 151, 223, 18, 223, 224, 233, 151, 223, 151, 151,
2255 151, 223, 223, 223, 153, 189, 56, 181, 30, 151,
2256 151, 154, 194, 194, 194, 194, 194, 194, 194, 194,
2257 189, 151, 155, 233, 234, 223, 223, 151, 182, 182,
2258 151, 223, 151, 224, 224, 224, 234, 223, 18, 194,
2259 194, 151, 154, 151, 151, 154, 154, 154, 154, 154,
2260 15, 157, 176, 230, 154, 224, 157, 223, 154, 154,
2261 154, 194, 194, 194, 223, 221, 157, 176, 39, 157,
2262 154, 154, 154, 151, 221, 15, 15, 151, 223, 223,
2263 15, 228, 223, 15, 223
Reid Spencer319a7302007-01-05 17:20:02 +00002264};
Reid Spencere7c3c602006-11-30 06:36:44 +00002265
2266#define yyerrok (yyerrstatus = 0)
2267#define yyclearin (yychar = YYEMPTY)
Reid Spencer319a7302007-01-05 17:20:02 +00002268#define YYEMPTY (-2)
Reid Spencere7c3c602006-11-30 06:36:44 +00002269#define YYEOF 0
Reid Spencer319a7302007-01-05 17:20:02 +00002270
Reid Spencere7c3c602006-11-30 06:36:44 +00002271#define YYACCEPT goto yyacceptlab
Reid Spencer319a7302007-01-05 17:20:02 +00002272#define YYABORT goto yyabortlab
2273#define YYERROR goto yyerrorlab
2274
2275
2276/* Like YYERROR except do call yyerror. This remains here temporarily
2277 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencere7c3c602006-11-30 06:36:44 +00002278 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer319a7302007-01-05 17:20:02 +00002279
Reid Spencere7c3c602006-11-30 06:36:44 +00002280#define YYFAIL goto yyerrlab
Reid Spencer319a7302007-01-05 17:20:02 +00002281
Reid Spencere7c3c602006-11-30 06:36:44 +00002282#define YYRECOVERING() (!!yyerrstatus)
Reid Spencer319a7302007-01-05 17:20:02 +00002283
2284#define YYBACKUP(Token, Value) \
Reid Spencere7c3c602006-11-30 06:36:44 +00002285do \
2286 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencer319a7302007-01-05 17:20:02 +00002287 { \
2288 yychar = (Token); \
2289 yylval = (Value); \
2290 yytoken = YYTRANSLATE (yychar); \
Reid Spencere7c3c602006-11-30 06:36:44 +00002291 YYPOPSTACK; \
2292 goto yybackup; \
2293 } \
2294 else \
Reid Spencer319a7302007-01-05 17:20:02 +00002295 { \
2296 yyerror (YY_("syntax error: cannot back up")); \
2297 YYERROR; \
2298 } \
Reid Spencere7c3c602006-11-30 06:36:44 +00002299while (0)
2300
Reid Spencer319a7302007-01-05 17:20:02 +00002301
Reid Spencere7c3c602006-11-30 06:36:44 +00002302#define YYTERROR 1
2303#define YYERRCODE 256
2304
Reid Spencer319a7302007-01-05 17:20:02 +00002305
2306/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2307 If N is 0, then set CURRENT to the empty location which ends
2308 the previous symbol: RHS[0] (always defined). */
2309
2310#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2311#ifndef YYLLOC_DEFAULT
2312# define YYLLOC_DEFAULT(Current, Rhs, N) \
2313 do \
2314 if (N) \
2315 { \
2316 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2317 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2318 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2319 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2320 } \
2321 else \
2322 { \
2323 (Current).first_line = (Current).last_line = \
2324 YYRHSLOC (Rhs, 0).last_line; \
2325 (Current).first_column = (Current).last_column = \
2326 YYRHSLOC (Rhs, 0).last_column; \
2327 } \
2328 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002329#endif
2330
Reid Spencer319a7302007-01-05 17:20:02 +00002331
2332/* YY_LOCATION_PRINT -- Print the location on the stream.
2333 This macro was not mandated originally: define only if we know
2334 we won't break user code: when these are the locations we know. */
2335
2336#ifndef YY_LOCATION_PRINT
2337# if YYLTYPE_IS_TRIVIAL
2338# define YY_LOCATION_PRINT(File, Loc) \
2339 fprintf (File, "%d.%d-%d.%d", \
2340 (Loc).first_line, (Loc).first_column, \
2341 (Loc).last_line, (Loc).last_column)
2342# else
2343# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2344# endif
2345#endif
2346
2347
2348/* YYLEX -- calling `yylex' with the right arguments. */
2349
Reid Spencere7c3c602006-11-30 06:36:44 +00002350#ifdef YYLEX_PARAM
Reid Spencer319a7302007-01-05 17:20:02 +00002351# define YYLEX yylex (YYLEX_PARAM)
Reid Spencere7c3c602006-11-30 06:36:44 +00002352#else
Reid Spencer319a7302007-01-05 17:20:02 +00002353# define YYLEX yylex ()
Chris Lattner37e01c52007-01-04 18:46:42 +00002354#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002355
2356/* Enable debugging if requested. */
2357#if YYDEBUG
2358
2359# ifndef YYFPRINTF
2360# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2361# define YYFPRINTF fprintf
2362# endif
2363
2364# define YYDPRINTF(Args) \
2365do { \
2366 if (yydebug) \
2367 YYFPRINTF Args; \
2368} while (0)
2369
2370# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2371do { \
2372 if (yydebug) \
2373 { \
2374 YYFPRINTF (stderr, "%s ", Title); \
2375 yysymprint (stderr, \
2376 Type, Value); \
2377 YYFPRINTF (stderr, "\n"); \
2378 } \
2379} while (0)
2380
2381/*------------------------------------------------------------------.
2382| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2383| TOP (included). |
2384`------------------------------------------------------------------*/
2385
2386#if defined (__STDC__) || defined (__cplusplus)
2387static void
2388yy_stack_print (short int *bottom, short int *top)
Chris Lattner37e01c52007-01-04 18:46:42 +00002389#else
Reid Spencer319a7302007-01-05 17:20:02 +00002390static void
2391yy_stack_print (bottom, top)
2392 short int *bottom;
2393 short int *top;
Chris Lattner37e01c52007-01-04 18:46:42 +00002394#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002395{
2396 YYFPRINTF (stderr, "Stack now");
2397 for (/* Nothing. */; bottom <= top; ++bottom)
2398 YYFPRINTF (stderr, " %d", *bottom);
2399 YYFPRINTF (stderr, "\n");
2400}
2401
2402# define YY_STACK_PRINT(Bottom, Top) \
2403do { \
2404 if (yydebug) \
2405 yy_stack_print ((Bottom), (Top)); \
2406} while (0)
2407
2408
2409/*------------------------------------------------.
2410| Report that the YYRULE is going to be reduced. |
2411`------------------------------------------------*/
2412
2413#if defined (__STDC__) || defined (__cplusplus)
2414static void
2415yy_reduce_print (int yyrule)
2416#else
2417static void
2418yy_reduce_print (yyrule)
2419 int yyrule;
Reid Spencere7c3c602006-11-30 06:36:44 +00002420#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002421{
2422 int yyi;
2423 unsigned long int yylno = yyrline[yyrule];
2424 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2425 yyrule - 1, yylno);
2426 /* Print the symbols being reduced, and their result. */
2427 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2428 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2429 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2430}
Reid Spencere7c3c602006-11-30 06:36:44 +00002431
Reid Spencer319a7302007-01-05 17:20:02 +00002432# define YY_REDUCE_PRINT(Rule) \
2433do { \
2434 if (yydebug) \
2435 yy_reduce_print (Rule); \
2436} while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002437
Reid Spencer319a7302007-01-05 17:20:02 +00002438/* Nonzero means print parse trace. It is left uninitialized so that
2439 multiple parsers can coexist. */
2440int yydebug;
2441#else /* !YYDEBUG */
2442# define YYDPRINTF(Args)
2443# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2444# define YY_STACK_PRINT(Bottom, Top)
2445# define YY_REDUCE_PRINT(Rule)
2446#endif /* !YYDEBUG */
Reid Spencere7c3c602006-11-30 06:36:44 +00002447
Reid Spencere7c3c602006-11-30 06:36:44 +00002448
Reid Spencer319a7302007-01-05 17:20:02 +00002449/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002450#ifndef YYINITDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002451# define YYINITDEPTH 200
Reid Spencere7c3c602006-11-30 06:36:44 +00002452#endif
2453
Reid Spencer319a7302007-01-05 17:20:02 +00002454/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2455 if the built-in stack extension method is used).
Reid Spencere7c3c602006-11-30 06:36:44 +00002456
Reid Spencer319a7302007-01-05 17:20:02 +00002457 Do not make this value too large; the results are undefined if
2458 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2459 evaluated with infinite-precision integer arithmetic. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002460
2461#ifndef YYMAXDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002462# define YYMAXDEPTH 10000
Reid Spencere7c3c602006-11-30 06:36:44 +00002463#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002464
Reid Spencere7c3c602006-11-30 06:36:44 +00002465
2466
Reid Spencer319a7302007-01-05 17:20:02 +00002467#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00002468
Reid Spencer319a7302007-01-05 17:20:02 +00002469# ifndef yystrlen
2470# if defined (__GLIBC__) && defined (_STRING_H)
2471# define yystrlen strlen
2472# else
2473/* Return the length of YYSTR. */
2474static YYSIZE_T
2475# if defined (__STDC__) || defined (__cplusplus)
2476yystrlen (const char *yystr)
2477# else
2478yystrlen (yystr)
2479 const char *yystr;
2480# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002481{
Reid Spencer319a7302007-01-05 17:20:02 +00002482 const char *yys = yystr;
Chris Lattner37e01c52007-01-04 18:46:42 +00002483
Reid Spencer319a7302007-01-05 17:20:02 +00002484 while (*yys++ != '\0')
2485 continue;
2486
2487 return yys - yystr - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002488}
Reid Spencer319a7302007-01-05 17:20:02 +00002489# endif
2490# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002491
Reid Spencer319a7302007-01-05 17:20:02 +00002492# ifndef yystpcpy
2493# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2494# define yystpcpy stpcpy
2495# else
2496/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2497 YYDEST. */
2498static char *
2499# if defined (__STDC__) || defined (__cplusplus)
2500yystpcpy (char *yydest, const char *yysrc)
2501# else
2502yystpcpy (yydest, yysrc)
2503 char *yydest;
2504 const char *yysrc;
2505# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002506{
Reid Spencer319a7302007-01-05 17:20:02 +00002507 char *yyd = yydest;
2508 const char *yys = yysrc;
Chris Lattner37e01c52007-01-04 18:46:42 +00002509
Reid Spencer319a7302007-01-05 17:20:02 +00002510 while ((*yyd++ = *yys++) != '\0')
2511 continue;
2512
2513 return yyd - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002514}
Reid Spencer319a7302007-01-05 17:20:02 +00002515# endif
2516# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002517
Reid Spencer319a7302007-01-05 17:20:02 +00002518# ifndef yytnamerr
2519/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2520 quotes and backslashes, so that it's suitable for yyerror. The
2521 heuristic is that double-quoting is unnecessary unless the string
2522 contains an apostrophe, a comma, or backslash (other than
2523 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2524 null, do not copy; instead, return the length of what the result
2525 would have been. */
2526static YYSIZE_T
2527yytnamerr (char *yyres, const char *yystr)
2528{
2529 if (*yystr == '"')
2530 {
2531 size_t yyn = 0;
2532 char const *yyp = yystr;
2533
2534 for (;;)
2535 switch (*++yyp)
2536 {
2537 case '\'':
2538 case ',':
2539 goto do_not_strip_quotes;
2540
2541 case '\\':
2542 if (*++yyp != '\\')
2543 goto do_not_strip_quotes;
2544 /* Fall through. */
2545 default:
2546 if (yyres)
2547 yyres[yyn] = *yyp;
2548 yyn++;
2549 break;
2550
2551 case '"':
2552 if (yyres)
2553 yyres[yyn] = '\0';
2554 return yyn;
2555 }
2556 do_not_strip_quotes: ;
2557 }
2558
2559 if (! yyres)
2560 return yystrlen (yystr);
2561
2562 return yystpcpy (yyres, yystr) - yyres;
2563}
2564# endif
2565
2566#endif /* YYERROR_VERBOSE */
2567
Reid Spencere7c3c602006-11-30 06:36:44 +00002568
2569
Reid Spencer319a7302007-01-05 17:20:02 +00002570#if YYDEBUG
2571/*--------------------------------.
2572| Print this symbol on YYOUTPUT. |
2573`--------------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002574
Reid Spencer319a7302007-01-05 17:20:02 +00002575#if defined (__STDC__) || defined (__cplusplus)
2576static void
2577yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Chris Lattner37e01c52007-01-04 18:46:42 +00002578#else
Reid Spencer319a7302007-01-05 17:20:02 +00002579static void
2580yysymprint (yyoutput, yytype, yyvaluep)
2581 FILE *yyoutput;
2582 int yytype;
2583 YYSTYPE *yyvaluep;
2584#endif
2585{
2586 /* Pacify ``unused variable'' warnings. */
2587 (void) yyvaluep;
2588
2589 if (yytype < YYNTOKENS)
2590 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2591 else
2592 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2593
2594
2595# ifdef YYPRINT
2596 if (yytype < YYNTOKENS)
2597 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2598# endif
2599 switch (yytype)
2600 {
2601 default:
2602 break;
2603 }
2604 YYFPRINTF (yyoutput, ")");
2605}
2606
2607#endif /* ! YYDEBUG */
2608/*-----------------------------------------------.
2609| Release the memory associated to this symbol. |
2610`-----------------------------------------------*/
2611
2612#if defined (__STDC__) || defined (__cplusplus)
2613static void
2614yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2615#else
2616static void
2617yydestruct (yymsg, yytype, yyvaluep)
2618 const char *yymsg;
2619 int yytype;
2620 YYSTYPE *yyvaluep;
2621#endif
2622{
2623 /* Pacify ``unused variable'' warnings. */
2624 (void) yyvaluep;
2625
2626 if (!yymsg)
2627 yymsg = "Deleting";
2628 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2629
2630 switch (yytype)
2631 {
2632
2633 default:
2634 break;
2635 }
2636}
2637
2638
2639/* Prevent warnings from -Wmissing-prototypes. */
2640
2641#ifdef YYPARSE_PARAM
2642# if defined (__STDC__) || defined (__cplusplus)
2643int yyparse (void *YYPARSE_PARAM);
2644# else
2645int yyparse ();
2646# endif
2647#else /* ! YYPARSE_PARAM */
2648#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere7c3c602006-11-30 06:36:44 +00002649int yyparse (void);
Chris Lattner37e01c52007-01-04 18:46:42 +00002650#else
Reid Spencer319a7302007-01-05 17:20:02 +00002651int yyparse ();
2652#endif
2653#endif /* ! YYPARSE_PARAM */
2654
2655
2656
2657/* The look-ahead symbol. */
2658int yychar;
2659
2660/* The semantic value of the look-ahead symbol. */
2661YYSTYPE yylval;
2662
2663/* Number of syntax errors so far. */
2664int yynerrs;
2665
2666
2667
2668/*----------.
2669| yyparse. |
2670`----------*/
2671
2672#ifdef YYPARSE_PARAM
2673# if defined (__STDC__) || defined (__cplusplus)
2674int yyparse (void *YYPARSE_PARAM)
2675# else
2676int yyparse (YYPARSE_PARAM)
2677 void *YYPARSE_PARAM;
2678# endif
2679#else /* ! YYPARSE_PARAM */
2680#if defined (__STDC__) || defined (__cplusplus)
2681int
2682yyparse (void)
2683#else
2684int
2685yyparse ()
2686
2687#endif
2688#endif
2689{
2690
2691 int yystate;
2692 int yyn;
2693 int yyresult;
2694 /* Number of tokens to shift before error messages enabled. */
2695 int yyerrstatus;
2696 /* Look-ahead token as an internal (translated) token number. */
2697 int yytoken = 0;
2698
2699 /* Three stacks and their tools:
2700 `yyss': related to states,
2701 `yyvs': related to semantic values,
2702 `yyls': related to locations.
2703
2704 Refer to the stacks thru separate pointers, to allow yyoverflow
2705 to reallocate them elsewhere. */
2706
2707 /* The state stack. */
2708 short int yyssa[YYINITDEPTH];
2709 short int *yyss = yyssa;
2710 short int *yyssp;
2711
2712 /* The semantic value stack. */
2713 YYSTYPE yyvsa[YYINITDEPTH];
2714 YYSTYPE *yyvs = yyvsa;
2715 YYSTYPE *yyvsp;
2716
2717
2718
Reid Spencere7c3c602006-11-30 06:36:44 +00002719#define YYPOPSTACK (yyvsp--, yyssp--)
2720
Reid Spencer319a7302007-01-05 17:20:02 +00002721 YYSIZE_T yystacksize = YYINITDEPTH;
Reid Spencere7c3c602006-11-30 06:36:44 +00002722
Reid Spencer319a7302007-01-05 17:20:02 +00002723 /* The variables used to return semantic value and location from the
2724 action routines. */
2725 YYSTYPE yyval;
Reid Spencere7c3c602006-11-30 06:36:44 +00002726
2727
Reid Spencer319a7302007-01-05 17:20:02 +00002728 /* When reducing, the number of symbols on the RHS of the reduced
2729 rule. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002730 int yylen;
2731
Reid Spencer319a7302007-01-05 17:20:02 +00002732 YYDPRINTF ((stderr, "Starting parse\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002733
2734 yystate = 0;
2735 yyerrstatus = 0;
2736 yynerrs = 0;
2737 yychar = YYEMPTY; /* Cause a token to be read. */
2738
2739 /* Initialize stack pointers.
2740 Waste one element of value and location stack
2741 so that they stay on the same level as the state stack.
2742 The wasted elements are never initialized. */
2743
Reid Spencer319a7302007-01-05 17:20:02 +00002744 yyssp = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002745 yyvsp = yyvs;
2746
Reid Spencer319a7302007-01-05 17:20:02 +00002747 goto yysetstate;
Reid Spencere7c3c602006-11-30 06:36:44 +00002748
Reid Spencer319a7302007-01-05 17:20:02 +00002749/*------------------------------------------------------------.
2750| yynewstate -- Push a new state, which is found in yystate. |
2751`------------------------------------------------------------*/
2752 yynewstate:
2753 /* In all cases, when you get here, the value and location stacks
2754 have just been pushed. so pushing a state here evens the stacks.
2755 */
2756 yyssp++;
Reid Spencere7c3c602006-11-30 06:36:44 +00002757
Reid Spencer319a7302007-01-05 17:20:02 +00002758 yysetstate:
2759 *yyssp = yystate;
2760
2761 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002762 {
2763 /* Get the current used size of the three stacks, in elements. */
Reid Spencer319a7302007-01-05 17:20:02 +00002764 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002765
2766#ifdef yyoverflow
Reid Spencer319a7302007-01-05 17:20:02 +00002767 {
2768 /* Give user a chance to reallocate the stack. Use copies of
2769 these so that the &'s don't force the real ones into
2770 memory. */
2771 YYSTYPE *yyvs1 = yyvs;
2772 short int *yyss1 = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002773
Reid Spencer319a7302007-01-05 17:20:02 +00002774
2775 /* Each stack pointer address is followed by the size of the
2776 data in use in that stack, in bytes. This used to be a
2777 conditional around just the two extra args, but that might
2778 be undefined if yyoverflow is a macro. */
2779 yyoverflow (YY_("memory exhausted"),
2780 &yyss1, yysize * sizeof (*yyssp),
2781 &yyvs1, yysize * sizeof (*yyvsp),
2782
2783 &yystacksize);
2784
2785 yyss = yyss1;
2786 yyvs = yyvs1;
2787 }
Reid Spencere7c3c602006-11-30 06:36:44 +00002788#else /* no yyoverflow */
Reid Spencer319a7302007-01-05 17:20:02 +00002789# ifndef YYSTACK_RELOCATE
2790 goto yyexhaustedlab;
2791# else
Reid Spencere7c3c602006-11-30 06:36:44 +00002792 /* Extend the stack our own way. */
Reid Spencer319a7302007-01-05 17:20:02 +00002793 if (YYMAXDEPTH <= yystacksize)
2794 goto yyexhaustedlab;
Reid Spencere7c3c602006-11-30 06:36:44 +00002795 yystacksize *= 2;
Reid Spencer319a7302007-01-05 17:20:02 +00002796 if (YYMAXDEPTH < yystacksize)
Reid Spencere7c3c602006-11-30 06:36:44 +00002797 yystacksize = YYMAXDEPTH;
Reid Spencer319a7302007-01-05 17:20:02 +00002798
2799 {
2800 short int *yyss1 = yyss;
2801 union yyalloc *yyptr =
2802 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2803 if (! yyptr)
2804 goto yyexhaustedlab;
2805 YYSTACK_RELOCATE (yyss);
2806 YYSTACK_RELOCATE (yyvs);
2807
2808# undef YYSTACK_RELOCATE
2809 if (yyss1 != yyssa)
2810 YYSTACK_FREE (yyss1);
2811 }
2812# endif
Reid Spencere7c3c602006-11-30 06:36:44 +00002813#endif /* no yyoverflow */
2814
Reid Spencer319a7302007-01-05 17:20:02 +00002815 yyssp = yyss + yysize - 1;
2816 yyvsp = yyvs + yysize - 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002817
2818
Reid Spencer319a7302007-01-05 17:20:02 +00002819 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2820 (unsigned long int) yystacksize));
2821
2822 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002823 YYABORT;
2824 }
2825
Reid Spencer319a7302007-01-05 17:20:02 +00002826 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencere7c3c602006-11-30 06:36:44 +00002827
2828 goto yybackup;
Reid Spencer319a7302007-01-05 17:20:02 +00002829
2830/*-----------.
2831| yybackup. |
2832`-----------*/
2833yybackup:
Reid Spencere7c3c602006-11-30 06:36:44 +00002834
2835/* Do appropriate processing given the current state. */
Reid Spencer319a7302007-01-05 17:20:02 +00002836/* Read a look-ahead token if we need one and don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002837/* yyresume: */
2838
Reid Spencer319a7302007-01-05 17:20:02 +00002839 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002840
2841 yyn = yypact[yystate];
Reid Spencer319a7302007-01-05 17:20:02 +00002842 if (yyn == YYPACT_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002843 goto yydefault;
2844
Reid Spencer319a7302007-01-05 17:20:02 +00002845 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002846
Reid Spencer319a7302007-01-05 17:20:02 +00002847 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002848 if (yychar == YYEMPTY)
2849 {
Reid Spencer319a7302007-01-05 17:20:02 +00002850 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencere7c3c602006-11-30 06:36:44 +00002851 yychar = YYLEX;
2852 }
2853
Reid Spencer319a7302007-01-05 17:20:02 +00002854 if (yychar <= YYEOF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002855 {
Reid Spencer319a7302007-01-05 17:20:02 +00002856 yychar = yytoken = YYEOF;
2857 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002858 }
2859 else
2860 {
Reid Spencer319a7302007-01-05 17:20:02 +00002861 yytoken = YYTRANSLATE (yychar);
2862 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00002863 }
2864
Reid Spencer319a7302007-01-05 17:20:02 +00002865 /* If the proper action on seeing token YYTOKEN is to reduce or to
2866 detect an error, take that action. */
2867 yyn += yytoken;
2868 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencere7c3c602006-11-30 06:36:44 +00002869 goto yydefault;
2870 yyn = yytable[yyn];
Reid Spencer319a7302007-01-05 17:20:02 +00002871 if (yyn <= 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002872 {
Reid Spencer319a7302007-01-05 17:20:02 +00002873 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002874 goto yyerrlab;
2875 yyn = -yyn;
2876 goto yyreduce;
2877 }
2878
2879 if (yyn == YYFINAL)
2880 YYACCEPT;
2881
Reid Spencer319a7302007-01-05 17:20:02 +00002882 /* Shift the look-ahead token. */
2883 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00002884
2885 /* Discard the token being shifted unless it is eof. */
2886 if (yychar != YYEOF)
2887 yychar = YYEMPTY;
2888
2889 *++yyvsp = yylval;
2890
Reid Spencer319a7302007-01-05 17:20:02 +00002891
2892 /* Count tokens shifted since error; after three, turn off error
2893 status. */
2894 if (yyerrstatus)
2895 yyerrstatus--;
Reid Spencere7c3c602006-11-30 06:36:44 +00002896
2897 yystate = yyn;
2898 goto yynewstate;
2899
Chris Lattner37e01c52007-01-04 18:46:42 +00002900
Reid Spencer319a7302007-01-05 17:20:02 +00002901/*-----------------------------------------------------------.
2902| yydefault -- do the default action for the current state. |
2903`-----------------------------------------------------------*/
2904yydefault:
Reid Spencere7c3c602006-11-30 06:36:44 +00002905 yyn = yydefact[yystate];
2906 if (yyn == 0)
2907 goto yyerrlab;
Reid Spencer319a7302007-01-05 17:20:02 +00002908 goto yyreduce;
Reid Spencere7c3c602006-11-30 06:36:44 +00002909
Reid Spencer319a7302007-01-05 17:20:02 +00002910
2911/*-----------------------------.
2912| yyreduce -- Do a reduction. |
2913`-----------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002914yyreduce:
Reid Spencer319a7302007-01-05 17:20:02 +00002915 /* yyn is the number of a rule to reduce with. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002916 yylen = yyr2[yyn];
2917
Reid Spencer319a7302007-01-05 17:20:02 +00002918 /* If YYLEN is nonzero, implement the default value of the action:
2919 `$$ = $1'.
2920
2921 Otherwise, the following line sets YYVAL to garbage.
2922 This behavior is undocumented and Bison
2923 users should not rely upon it. Assigning to YYVAL
2924 unconditionally makes the parser a bit smaller, and it avoids a
2925 GCC warning that YYVAL may be used uninitialized. */
2926 yyval = yyvsp[1-yylen];
2927
2928
2929 YY_REDUCE_PRINT (yyn);
2930 switch (yyn)
Reid Spencere7c3c602006-11-30 06:36:44 +00002931 {
Reid Spencer319a7302007-01-05 17:20:02 +00002932 case 81:
Reid Spencerc4d96252007-01-13 00:03:30 +00002933#line 896 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002934 {
2935 (yyval.String) = (yyvsp[-1].String);
2936 ;}
2937 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002938
Reid Spencer319a7302007-01-05 17:20:02 +00002939 case 82:
Reid Spencerc4d96252007-01-13 00:03:30 +00002940#line 899 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002941 {
2942 (yyval.String) = new std::string("");
2943 ;}
2944 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002945
Reid Spencer319a7302007-01-05 17:20:02 +00002946 case 90:
Reid Spencerc4d96252007-01-13 00:03:30 +00002947#line 906 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002948 { (yyval.String) = new std::string(""); ;}
2949 break;
Reid Spencere77e35e2006-12-01 20:26:20 +00002950
Reid Spencer319a7302007-01-05 17:20:02 +00002951 case 97:
Reid Spencerc4d96252007-01-13 00:03:30 +00002952#line 911 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002953 {
2954 *(yyvsp[-1].String) += *(yyvsp[0].String);
2955 delete (yyvsp[0].String);
2956 (yyval.String) = (yyvsp[-1].String);
2957 ;}
2958 break;
Reid Spencer16244f42006-12-01 21:10:07 +00002959
Reid Spencer319a7302007-01-05 17:20:02 +00002960 case 98:
Reid Spencerc4d96252007-01-13 00:03:30 +00002961#line 916 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002962 { (yyval.String) = new std::string(""); ;}
2963 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002964
Reid Spencer319a7302007-01-05 17:20:02 +00002965 case 99:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002966#line 921 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002967 { (yyval.String) = new std::string(); ;}
2968 break;
2969
Reid Spencerc4d96252007-01-13 00:03:30 +00002970 case 100:
Reid Spencer609ca3e2007-01-12 20:10:51 +00002971#line 922 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00002972 { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
2973 break;
2974
2975 case 101:
2976#line 925 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
2977 { (yyval.String) = new std::string(); ;}
2978 break;
2979
2980 case 102:
2981#line 926 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002982 {
2983 (yyvsp[-1].String)->insert(0, ", ");
2984 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
2985 delete (yyvsp[0].String);
2986 (yyval.String) = (yyvsp[-1].String);
2987 ;}
2988 break;
2989
2990 case 103:
Reid Spencerc4d96252007-01-13 00:03:30 +00002991#line 934 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002992 {
2993 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
2994 delete (yyvsp[0].String);
2995 (yyval.String) = (yyvsp[-1].String);
2996 ;}
2997 break;
2998
2999 case 104:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003000#line 940 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003001 { (yyval.String) = new std::string(); ;}
3002 break;
3003
Reid Spencerc4d96252007-01-13 00:03:30 +00003004 case 106:
3005#line 944 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
3006 { (yyval.String) = new std::string(); ;}
3007 break;
3008
Reid Spencer319a7302007-01-05 17:20:02 +00003009 case 107:
Reid Spencerc4d96252007-01-13 00:03:30 +00003010#line 945 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003011 {
3012 (yyvsp[-1].String)->insert(0, ", ");
3013 if (!(yyvsp[0].String)->empty())
3014 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3015 delete (yyvsp[0].String);
3016 (yyval.String) = (yyvsp[-1].String);
3017 ;}
3018 break;
3019
3020 case 109:
Reid Spencerc4d96252007-01-13 00:03:30 +00003021#line 955 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003022 {
3023 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3024 delete (yyvsp[0].String);
3025 (yyval.String) = (yyvsp[-1].String);
3026 ;}
3027 break;
3028
3029 case 127:
Reid Spencerc4d96252007-01-13 00:03:30 +00003030#line 977 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003031 {
3032 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), OpaqueTy);
3033 ;}
3034 break;
3035
3036 case 128:
Reid Spencerc4d96252007-01-13 00:03:30 +00003037#line 980 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003038 {
3039 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UnresolvedTy);
3040 ;}
3041 break;
3042
3043 case 129:
Reid Spencerc4d96252007-01-13 00:03:30 +00003044#line 983 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003045 {
3046 (yyval.Type) = (yyvsp[0].Type);
3047 ;}
3048 break;
3049
3050 case 130:
Reid Spencerc4d96252007-01-13 00:03:30 +00003051#line 986 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003052 { // Type UpReference
3053 (yyvsp[0].String)->insert(0, "\\");
3054 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UpRefTy);
3055 ;}
3056 break;
3057
3058 case 131:
Reid Spencerc4d96252007-01-13 00:03:30 +00003059#line 990 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003060 { // Function derived type?
3061 std::string newTy( (yyvsp[-3].Type)->getNewTy() + "(");
3062 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003063 if (i != 0)
3064 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003065 if ((*(yyvsp[-1].TypeVec))[i]->isVoid())
Reid Spencer52402b02007-01-02 05:45:11 +00003066 newTy += "...";
3067 else
Reid Spencer319a7302007-01-05 17:20:02 +00003068 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003069 }
3070 newTy += ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003071 (yyval.Type) = TypeInfo::get(newTy, (yyvsp[-3].Type), (yyvsp[-1].TypeVec));
3072 ;}
3073 break;
3074
3075 case 132:
Reid Spencerc4d96252007-01-13 00:03:30 +00003076#line 1003 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003077 { // Sized array type?
3078 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3079 (yyvsp[-3].String)->insert(0,"[ ");
3080 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " ]";
3081 (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Type), elems);
3082 ;}
3083 break;
3084
3085 case 133:
Reid Spencerc4d96252007-01-13 00:03:30 +00003086#line 1009 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003087 { // Packed array type?
3088 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3089 (yyvsp[-3].String)->insert(0,"< ");
3090 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " >";
3091 (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), PackedTy, (yyvsp[-1].Type), elems);
3092 ;}
3093 break;
3094
3095 case 134:
Reid Spencerc4d96252007-01-13 00:03:30 +00003096#line 1015 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003097 { // Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003098 std::string newTy("{");
Reid Spencer319a7302007-01-05 17:20:02 +00003099 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003100 if (i != 0)
3101 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003102 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003103 }
3104 newTy += "}";
Reid Spencer319a7302007-01-05 17:20:02 +00003105 (yyval.Type) = TypeInfo::get(newTy, StructTy, (yyvsp[-1].TypeVec));
3106 ;}
3107 break;
3108
3109 case 135:
Reid Spencerc4d96252007-01-13 00:03:30 +00003110#line 1025 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003111 { // Empty structure type?
3112 (yyval.Type) = TypeInfo::get("{}", StructTy, new TypeList());
3113 ;}
3114 break;
3115
3116 case 136:
Reid Spencerc4d96252007-01-13 00:03:30 +00003117#line 1028 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003118 { // Packed Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003119 std::string newTy("<{");
Reid Spencer319a7302007-01-05 17:20:02 +00003120 for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003121 if (i != 0)
3122 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003123 newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003124 }
3125 newTy += "}>";
Reid Spencer319a7302007-01-05 17:20:02 +00003126 (yyval.Type) = TypeInfo::get(newTy, PackedStructTy, (yyvsp[-2].TypeVec));
3127 ;}
3128 break;
3129
3130 case 137:
Reid Spencerc4d96252007-01-13 00:03:30 +00003131#line 1038 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003132 { // Empty packed structure type?
3133 (yyval.Type) = TypeInfo::get("<{}>", PackedStructTy, new TypeList());
3134 ;}
3135 break;
3136
3137 case 138:
Reid Spencerc4d96252007-01-13 00:03:30 +00003138#line 1041 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003139 { // Pointer type?
3140 (yyval.Type) = (yyvsp[-1].Type)->getPointerType();
3141 ;}
3142 break;
3143
3144 case 139:
Reid Spencerc4d96252007-01-13 00:03:30 +00003145#line 1049 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003146 {
3147 (yyval.TypeVec) = new TypeList();
3148 (yyval.TypeVec)->push_back((yyvsp[0].Type));
3149 ;}
3150 break;
3151
3152 case 140:
Reid Spencerc4d96252007-01-13 00:03:30 +00003153#line 1053 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003154 {
3155 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
3156 (yyval.TypeVec)->push_back((yyvsp[0].Type));
3157 ;}
3158 break;
3159
3160 case 142:
Reid Spencerc4d96252007-01-13 00:03:30 +00003161#line 1061 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003162 {
3163 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
3164 (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
3165 delete (yyvsp[0].String);
3166 ;}
3167 break;
3168
3169 case 143:
Reid Spencerc4d96252007-01-13 00:03:30 +00003170#line 1066 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003171 {
3172 (yyval.TypeVec) = new TypeList();
3173 (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
3174 delete (yyvsp[0].String);
3175 ;}
3176 break;
3177
3178 case 144:
Reid Spencerc4d96252007-01-13 00:03:30 +00003179#line 1071 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003180 {
3181 (yyval.TypeVec) = new TypeList();
3182 ;}
3183 break;
3184
3185 case 145:
Reid Spencerc4d96252007-01-13 00:03:30 +00003186#line 1081 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003187 { // Nonempty unsized arr
3188 (yyval.Const).type = (yyvsp[-3].Type);
3189 (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3190 *(yyval.Const).cnst += " [ " + *(yyvsp[-1].String) + " ]";
3191 delete (yyvsp[-1].String);
3192 ;}
3193 break;
3194
3195 case 146:
Reid Spencerc4d96252007-01-13 00:03:30 +00003196#line 1087 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003197 {
3198 (yyval.Const).type = (yyvsp[-2].Type);
3199 (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3200 *(yyval.Const).cnst += "[ ]";
3201 ;}
3202 break;
3203
3204 case 147:
Reid Spencerc4d96252007-01-13 00:03:30 +00003205#line 1092 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003206 {
3207 (yyval.Const).type = (yyvsp[-2].Type);
3208 (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3209 *(yyval.Const).cnst += " c" + *(yyvsp[0].String);
3210 delete (yyvsp[0].String);
3211 ;}
3212 break;
3213
3214 case 148:
Reid Spencerc4d96252007-01-13 00:03:30 +00003215#line 1098 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003216 { // Nonempty unsized arr
3217 (yyval.Const).type = (yyvsp[-3].Type);
3218 (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3219 *(yyval.Const).cnst += " < " + *(yyvsp[-1].String) + " >";
3220 delete (yyvsp[-1].String);
3221 ;}
3222 break;
3223
3224 case 149:
Reid Spencerc4d96252007-01-13 00:03:30 +00003225#line 1104 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003226 {
3227 (yyval.Const).type = (yyvsp[-3].Type);
3228 (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3229 *(yyval.Const).cnst += " { " + *(yyvsp[-1].String) + " }";
3230 delete (yyvsp[-1].String);
3231 ;}
3232 break;
3233
3234 case 150:
Reid Spencerc4d96252007-01-13 00:03:30 +00003235#line 1110 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003236 {
3237 (yyval.Const).type = (yyvsp[-2].Type);
3238 (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3239 *(yyval.Const).cnst += " {}";
3240 ;}
3241 break;
3242
3243 case 151:
Reid Spencerc4d96252007-01-13 00:03:30 +00003244#line 1115 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003245 {
3246 (yyval.Const).type = (yyvsp[-1].Type);
3247 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3248 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3249 delete (yyvsp[0].String);
3250 ;}
3251 break;
3252
3253 case 152:
Reid Spencerc4d96252007-01-13 00:03:30 +00003254#line 1121 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003255 {
3256 (yyval.Const).type = (yyvsp[-1].Type);
3257 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3258 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3259 delete (yyvsp[0].String);
3260 ;}
3261 break;
3262
3263 case 153:
Reid Spencerc4d96252007-01-13 00:03:30 +00003264#line 1127 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003265 {
3266 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve(), true);
3267 (yyval.Const).type = (yyvsp[-1].Type);
3268 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3269 *(yyval.Const).cnst += " " + Name;
3270 delete (yyvsp[0].String);
3271 ;}
3272 break;
3273
3274 case 154:
Reid Spencerc4d96252007-01-13 00:03:30 +00003275#line 1134 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003276 {
3277 (yyval.Const).type = (yyvsp[-1].Type);
3278 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3279 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3280 delete (yyvsp[0].String);
3281 ;}
3282 break;
3283
3284 case 155:
Reid Spencerc4d96252007-01-13 00:03:30 +00003285#line 1140 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003286 {
3287 (yyval.Const).type = (yyvsp[-1].Type);
3288 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3289 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3290 delete (yyvsp[0].String);
3291 ;}
3292 break;
3293
3294 case 156:
Reid Spencerc4d96252007-01-13 00:03:30 +00003295#line 1146 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003296 { // integral constants
3297 (yyval.Const).type = (yyvsp[-1].Type);
3298 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3299 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3300 delete (yyvsp[0].String);
3301 ;}
3302 break;
3303
3304 case 157:
Reid Spencerc4d96252007-01-13 00:03:30 +00003305#line 1152 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003306 { // integral constants
3307 (yyval.Const).type = (yyvsp[-1].Type);
3308 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3309 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3310 delete (yyvsp[0].String);
3311 ;}
3312 break;
3313
3314 case 158:
Reid Spencerc4d96252007-01-13 00:03:30 +00003315#line 1158 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003316 { // Boolean constants
3317 (yyval.Const).type = (yyvsp[-1].Type);
3318 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3319 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3320 delete (yyvsp[0].String);
3321 ;}
3322 break;
3323
3324 case 159:
Reid Spencerc4d96252007-01-13 00:03:30 +00003325#line 1164 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003326 { // Boolean constants
3327 (yyval.Const).type = (yyvsp[-1].Type);
3328 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3329 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3330 delete (yyvsp[0].String);
3331 ;}
3332 break;
3333
3334 case 160:
Reid Spencerc4d96252007-01-13 00:03:30 +00003335#line 1170 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003336 { // Float & Double constants
3337 (yyval.Const).type = (yyvsp[-1].Type);
3338 (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3339 *(yyval.Const).cnst += " " + *(yyvsp[0].String);
3340 delete (yyvsp[0].String);
3341 ;}
3342 break;
3343
3344 case 161:
Reid Spencerc4d96252007-01-13 00:03:30 +00003345#line 1178 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003346 {
3347 std::string source = *(yyvsp[-3].Const).cnst;
3348 const TypeInfo* SrcTy = (yyvsp[-3].Const).type->resolve();
3349 const TypeInfo* DstTy = (yyvsp[-1].Type)->resolve();
3350 if (*(yyvsp[-5].String) == "cast") {
Reid Spencera50d5962006-12-02 04:11:07 +00003351 // Call getCastUpgrade to upgrade the old cast
Reid Spencer319a7302007-01-05 17:20:02 +00003352 (yyval.String) = new std::string(getCastUpgrade(source, SrcTy, DstTy, true));
Reid Spencera50d5962006-12-02 04:11:07 +00003353 } else {
3354 // Nothing to upgrade, just create the cast constant expr
Reid Spencer319a7302007-01-05 17:20:02 +00003355 (yyval.String) = new std::string(*(yyvsp[-5].String));
3356 *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Type)->getNewTy() + ")";
Reid Spencer280d8012006-12-01 23:40:53 +00003357 }
Reid Spencer319a7302007-01-05 17:20:02 +00003358 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String);
3359 ;}
3360 break;
3361
3362 case 162:
Reid Spencerc4d96252007-01-13 00:03:30 +00003363#line 1192 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003364 {
3365 *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst;
3366 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
3367 ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
3368 *(yyvsp[-4].String) += ", " + *VI.val;
Reid Spencerf8483652006-12-02 15:16:01 +00003369 VI.destroy();
3370 }
Reid Spencer319a7302007-01-05 17:20:02 +00003371 *(yyvsp[-4].String) += ")";
3372 (yyval.String) = (yyvsp[-4].String);
3373 (yyvsp[-2].Const).destroy();
3374 delete (yyvsp[-1].ValList);
3375 ;}
3376 break;
3377
3378 case 163:
Reid Spencerc4d96252007-01-13 00:03:30 +00003379#line 1204 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003380 {
3381 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3382 (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3383 (yyval.String) = (yyvsp[-7].String);
3384 ;}
3385 break;
3386
3387 case 164:
Reid Spencerc4d96252007-01-13 00:03:30 +00003388#line 1209 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003389 {
3390 const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
3391 (yyval.String) = new std::string(op);
3392 *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3393 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3394 ;}
3395 break;
3396
3397 case 165:
Reid Spencerc4d96252007-01-13 00:03:30 +00003398#line 1215 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003399 {
3400 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3401 (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3402 (yyval.String) = (yyvsp[-5].String);
3403 ;}
3404 break;
3405
3406 case 166:
Reid Spencerc4d96252007-01-13 00:03:30 +00003407#line 1220 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003408 {
3409 *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
3410 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3411 (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3412 (yyval.String) = (yyvsp[-5].String);
3413 ;}
3414 break;
3415
3416 case 167:
Reid Spencerc4d96252007-01-13 00:03:30 +00003417#line 1226 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003418 {
Reid Spencera7c46fa2007-01-06 00:23:53 +00003419 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003420 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3421 (yyval.String) = (yyvsp[-6].String);
3422 ;}
3423 break;
3424
3425 case 168:
Reid Spencerc4d96252007-01-13 00:03:30 +00003426#line 1231 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003427 {
Reid Spencera7c46fa2007-01-06 00:23:53 +00003428 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003429 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3430 (yyval.String) = (yyvsp[-6].String);
3431 ;}
3432 break;
3433
3434 case 169:
Reid Spencerc4d96252007-01-13 00:03:30 +00003435#line 1236 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003436 {
3437 const char* shiftop = (yyvsp[-5].String)->c_str();
3438 if (*(yyvsp[-5].String) == "shr")
3439 shiftop = ((yyvsp[-3].Const).type->isUnsigned()) ? "lshr" : "ashr";
3440 (yyval.String) = new std::string(shiftop);
3441 *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3442 delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3443 ;}
3444 break;
3445
3446 case 170:
Reid Spencerc4d96252007-01-13 00:03:30 +00003447#line 1244 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003448 {
3449 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3450 (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3451 (yyval.String) = (yyvsp[-5].String);
3452 ;}
3453 break;
3454
3455 case 171:
Reid Spencerc4d96252007-01-13 00:03:30 +00003456#line 1249 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003457 {
3458 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3459 (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3460 (yyval.String) = (yyvsp[-7].String);
3461 ;}
3462 break;
3463
3464 case 172:
Reid Spencerc4d96252007-01-13 00:03:30 +00003465#line 1254 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003466 {
3467 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
3468 (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
3469 (yyval.String) = (yyvsp[-7].String);
3470 ;}
3471 break;
3472
3473 case 173:
Reid Spencerc4d96252007-01-13 00:03:30 +00003474#line 1264 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003475 {
3476 *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst;
3477 (yyvsp[0].Const).destroy();
3478 (yyval.String) = (yyvsp[-2].String);
3479 ;}
3480 break;
3481
3482 case 174:
Reid Spencerc4d96252007-01-13 00:03:30 +00003483#line 1269 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003484 { (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;}
3485 break;
3486
3487 case 177:
Reid Spencerc4d96252007-01-13 00:03:30 +00003488#line 1284 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003489 {
3490;}
3491 break;
3492
3493 case 178:
Reid Spencerc4d96252007-01-13 00:03:30 +00003494#line 1289 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003495 {
3496 (yyval.String) = 0;
3497 ;}
3498 break;
3499
3500 case 179:
Reid Spencerc4d96252007-01-13 00:03:30 +00003501#line 1292 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003502 {
3503 *O << *(yyvsp[0].String) << '\n';
3504 delete (yyvsp[0].String);
3505 (yyval.String) = 0;
3506 ;}
3507 break;
3508
3509 case 180:
Reid Spencerc4d96252007-01-13 00:03:30 +00003510#line 1297 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003511 {
3512 *O << "module asm " << ' ' << *(yyvsp[0].String) << '\n';
3513 (yyval.String) = 0;
3514 ;}
3515 break;
3516
3517 case 181:
Reid Spencerc4d96252007-01-13 00:03:30 +00003518#line 1301 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003519 {
Reid Spencerd154b572006-12-01 20:36:40 +00003520 *O << "implementation\n";
Reid Spencer319a7302007-01-05 17:20:02 +00003521 (yyval.String) = 0;
3522 ;}
3523 break;
3524
3525 case 182:
Reid Spencerc4d96252007-01-13 00:03:30 +00003526#line 1305 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003527 { (yyval.String) = 0; ;}
3528 break;
3529
3530 case 184:
Reid Spencerc4d96252007-01-13 00:03:30 +00003531#line 1307 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003532 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
3533 break;
3534
3535 case 185:
Reid Spencerc4d96252007-01-13 00:03:30 +00003536#line 1310 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003537 {
3538 EnumeratedTypes.push_back((yyvsp[0].Type));
3539 if (!(yyvsp[-2].String)->empty()) {
3540 NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Type);
3541 *O << *(yyvsp[-2].String) << " = ";
Reid Spencera50d5962006-12-02 04:11:07 +00003542 }
Reid Spencer319a7302007-01-05 17:20:02 +00003543 *O << "type " << (yyvsp[0].Type)->getNewTy() << '\n';
3544 delete (yyvsp[-2].String); delete (yyvsp[-1].String);
3545 (yyval.String) = 0;
3546 ;}
3547 break;
3548
3549 case 186:
Reid Spencerc4d96252007-01-13 00:03:30 +00003550#line 1320 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003551 { // Function prototypes can be in const pool
3552 *O << *(yyvsp[0].String) << '\n';
3553 delete (yyvsp[0].String);
3554 (yyval.String) = 0;
3555 ;}
3556 break;
3557
3558 case 187:
Reid Spencerc4d96252007-01-13 00:03:30 +00003559#line 1325 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003560 { // Asm blocks can be in the const pool
3561 *O << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3562 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3563 (yyval.String) = 0;
3564 ;}
3565 break;
3566
3567 case 188:
Reid Spencerc4d96252007-01-13 00:03:30 +00003568#line 1330 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003569 {
3570 if (!(yyvsp[-4].String)->empty()) {
3571 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const).type->getPointerType(),
3572 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003573 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003574 }
Reid Spencer319a7302007-01-05 17:20:02 +00003575 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const).cnst << ' ' << *(yyvsp[0].String) << '\n';
3576 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3577 (yyval.String) = 0;
3578 ;}
3579 break;
3580
3581 case 189:
Reid Spencerc4d96252007-01-13 00:03:30 +00003582#line 1340 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003583 {
3584 if (!(yyvsp[-4].String)->empty()) {
3585 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3586 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003587 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003588 }
Reid Spencer319a7302007-01-05 17:20:02 +00003589 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3590 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3591 (yyval.String) = 0;
3592 ;}
3593 break;
3594
3595 case 190:
Reid Spencerc4d96252007-01-13 00:03:30 +00003596#line 1350 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003597 {
3598 if (!(yyvsp[-4].String)->empty()) {
3599 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3600 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003601 *O << Name << " = ";
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003602 }
Reid Spencer319a7302007-01-05 17:20:02 +00003603 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3604 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3605 (yyval.String) = 0;
3606 ;}
3607 break;
3608
3609 case 191:
Reid Spencerc4d96252007-01-13 00:03:30 +00003610#line 1360 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003611 {
3612 if (!(yyvsp[-4].String)->empty()) {
3613 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3614 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003615 *O << Name << " = ";
Reid Spencerf5626a32007-01-01 01:20:41 +00003616 }
Reid Spencer319a7302007-01-05 17:20:02 +00003617 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3618 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3619 (yyval.String) = 0;
3620 ;}
3621 break;
3622
3623 case 192:
Reid Spencerc4d96252007-01-13 00:03:30 +00003624#line 1370 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003625 {
3626 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3627 delete (yyvsp[-1].String); delete (yyvsp[0].String);
3628 (yyval.String) = 0;
3629 ;}
3630 break;
3631
3632 case 193:
Reid Spencerc4d96252007-01-13 00:03:30 +00003633#line 1375 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003634 {
3635 *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n';
3636 delete (yyvsp[-2].String); delete (yyvsp[0].String);
3637 (yyval.String) = 0;
3638 ;}
3639 break;
3640
3641 case 194:
Reid Spencerc4d96252007-01-13 00:03:30 +00003642#line 1380 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003643 {
3644 (yyval.String) = 0;
3645 ;}
3646 break;
3647
3648 case 198:
Reid Spencerc4d96252007-01-13 00:03:30 +00003649#line 1390 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003650 {
3651 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3652 delete (yyvsp[0].String);
3653 (yyval.String) = (yyvsp[-2].String);
3654 ;}
3655 break;
3656
3657 case 199:
Reid Spencerc4d96252007-01-13 00:03:30 +00003658#line 1395 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003659 {
3660 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3661 if (*(yyvsp[0].String) == "64")
Reid Spencere77e35e2006-12-01 20:26:20 +00003662 SizeOfPointer = 64;
Reid Spencer319a7302007-01-05 17:20:02 +00003663 delete (yyvsp[0].String);
3664 (yyval.String) = (yyvsp[-2].String);
3665 ;}
3666 break;
3667
3668 case 200:
Reid Spencerc4d96252007-01-13 00:03:30 +00003669#line 1402 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003670 {
3671 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3672 delete (yyvsp[0].String);
3673 (yyval.String) = (yyvsp[-2].String);
3674 ;}
3675 break;
3676
3677 case 201:
Reid Spencerc4d96252007-01-13 00:03:30 +00003678#line 1407 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003679 {
3680 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3681 delete (yyvsp[0].String);
3682 (yyval.String) = (yyvsp[-2].String);
3683 ;}
3684 break;
3685
3686 case 202:
Reid Spencerc4d96252007-01-13 00:03:30 +00003687#line 1414 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003688 {
3689 (yyvsp[-1].String)->insert(0, "[ ");
3690 *(yyvsp[-1].String) += " ]";
3691 (yyval.String) = (yyvsp[-1].String);
3692 ;}
3693 break;
3694
3695 case 203:
Reid Spencerc4d96252007-01-13 00:03:30 +00003696#line 1421 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003697 {
3698 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3699 delete (yyvsp[0].String);
3700 (yyval.String) = (yyvsp[-2].String);
3701 ;}
3702 break;
3703
3704 case 205:
Reid Spencerc4d96252007-01-13 00:03:30 +00003705#line 1427 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003706 {
3707 (yyval.String) = new std::string();
3708 ;}
3709 break;
3710
3711 case 209:
Reid Spencerc4d96252007-01-13 00:03:30 +00003712#line 1436 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003713 { (yyval.String) = new std::string(); ;}
3714 break;
3715
3716 case 210:
Reid Spencerc4d96252007-01-13 00:03:30 +00003717#line 1438 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003718 {
3719 (yyval.String) = new std::string((yyvsp[-1].Type)->getNewTy());
3720 if (!(yyvsp[0].String)->empty()) {
3721 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve());
3722 *(yyval.String) += " " + Name;
Reid Spencer52402b02007-01-02 05:45:11 +00003723 }
Reid Spencer319a7302007-01-05 17:20:02 +00003724 delete (yyvsp[0].String);
3725;}
3726 break;
3727
3728 case 211:
Reid Spencerc4d96252007-01-13 00:03:30 +00003729#line 1447 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003730 {
3731 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3732 delete (yyvsp[0].String);
3733 ;}
3734 break;
3735
3736 case 212:
Reid Spencer609ca3e2007-01-12 20:10:51 +00003737#line 1451 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003738 {
3739 (yyval.String) = (yyvsp[0].String);
3740 ;}
3741 break;
3742
Reid Spencerc4d96252007-01-13 00:03:30 +00003743 case 213:
3744#line 1455 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
3745 {
3746 (yyval.String) = (yyvsp[0].String);
3747 ;}
3748 break;
3749
Reid Spencer319a7302007-01-05 17:20:02 +00003750 case 214:
Reid Spencerc4d96252007-01-13 00:03:30 +00003751#line 1458 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003752 {
3753 *(yyvsp[-2].String) += ", ...";
3754 (yyval.String) = (yyvsp[-2].String);
3755 delete (yyvsp[0].String);
3756 ;}
3757 break;
3758
3759 case 215:
Reid Spencerc4d96252007-01-13 00:03:30 +00003760#line 1463 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003761 {
3762 (yyval.String) = (yyvsp[0].String);
3763 ;}
3764 break;
3765
3766 case 216:
Reid Spencerc4d96252007-01-13 00:03:30 +00003767#line 1466 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003768 { (yyval.String) = new std::string(); ;}
3769 break;
3770
3771 case 217:
Reid Spencerc4d96252007-01-13 00:03:30 +00003772#line 1469 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003773 {
Reid Spencerc4d96252007-01-13 00:03:30 +00003774 if (*(yyvsp[-5].String) == "%llvm.va_start" || *(yyvsp[-5].String) == "%llvm.va_end") {
Reid Spencerf0c9a652007-01-13 00:13:49 +00003775 *(yyvsp[-3].String) = "i8*";
Reid Spencerc4d96252007-01-13 00:03:30 +00003776 } else if (*(yyvsp[-5].String) == "%llvm.va_copy") {
3777 *(yyvsp[-3].String) = "i8*, i8*";
3778 }
Reid Spencer319a7302007-01-05 17:20:02 +00003779 if (!(yyvsp[-7].String)->empty()) {
3780 *(yyvsp[-7].String) += " ";
Reid Spencere77e35e2006-12-01 20:26:20 +00003781 }
Reid Spencer319a7302007-01-05 17:20:02 +00003782 *(yyvsp[-7].String) += (yyvsp[-6].Type)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
3783 if (!(yyvsp[-1].String)->empty()) {
3784 *(yyvsp[-7].String) += " " + *(yyvsp[-1].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003785 }
Reid Spencer319a7302007-01-05 17:20:02 +00003786 if (!(yyvsp[0].String)->empty()) {
3787 *(yyvsp[-7].String) += " " + *(yyvsp[0].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003788 }
Reid Spencer319a7302007-01-05 17:20:02 +00003789 delete (yyvsp[-5].String);
3790 delete (yyvsp[-3].String);
3791 delete (yyvsp[-1].String);
3792 delete (yyvsp[0].String);
3793 (yyval.String) = (yyvsp[-7].String);
3794 ;}
3795 break;
3796
3797 case 218:
Reid Spencerc4d96252007-01-13 00:03:30 +00003798#line 1492 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003799 { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
3800 break;
3801
3802 case 219:
Reid Spencerc4d96252007-01-13 00:03:30 +00003803#line 1493 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003804 { (yyval.String) = new std::string ("{"); ;}
3805 break;
3806
3807 case 220:
Reid Spencerc4d96252007-01-13 00:03:30 +00003808#line 1496 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003809 {
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003810 *O << "define ";
Reid Spencer319a7302007-01-05 17:20:02 +00003811 if (!(yyvsp[-2].String)->empty()) {
3812 *O << *(yyvsp[-2].String) << ' ';
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003813 }
Reid Spencer319a7302007-01-05 17:20:02 +00003814 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3815 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3816 (yyval.String) = 0;
3817 ;}
3818 break;
3819
3820 case 221:
Reid Spencerc4d96252007-01-13 00:03:30 +00003821#line 1507 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003822 { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
3823 break;
3824
3825 case 222:
Reid Spencerc4d96252007-01-13 00:03:30 +00003826#line 1508 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003827 { (yyval.String) = new std::string("}"); ;}
3828 break;
3829
3830 case 223:
Reid Spencerc4d96252007-01-13 00:03:30 +00003831#line 1510 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003832 {
3833 if ((yyvsp[-1].String))
3834 *O << *(yyvsp[-1].String);
3835 *O << *(yyvsp[0].String) << "\n\n";
3836 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3837 (yyval.String) = 0;
3838;}
3839 break;
3840
3841 case 224:
Reid Spencerc4d96252007-01-13 00:03:30 +00003842#line 1519 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003843 { (yyval.String) = new std::string(); ;}
3844 break;
3845
3846 case 227:
Reid Spencerc4d96252007-01-13 00:03:30 +00003847#line 1525 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
3848 { isDeclare = true; ;}
Reid Spencer319a7302007-01-05 17:20:02 +00003849 break;
3850
3851 case 228:
Reid Spencerc4d96252007-01-13 00:03:30 +00003852#line 1525 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
3853 {
3854 if (!(yyvsp[-1].String)->empty())
3855 *(yyvsp[-3].String) += " " + *(yyvsp[-1].String);
3856 *(yyvsp[-3].String) += " " + *(yyvsp[0].String);
3857 delete (yyvsp[-1].String);
3858 delete (yyvsp[0].String);
3859 (yyval.String) = (yyvsp[-3].String);
3860 isDeclare = false;
3861 ;}
3862 break;
3863
3864 case 229:
3865#line 1539 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003866 { (yyval.String) = new std::string(); ;}
3867 break;
3868
Reid Spencerc4d96252007-01-13 00:03:30 +00003869 case 239:
3870#line 1545 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003871 {
3872 (yyvsp[-1].String)->insert(0, "<");
3873 *(yyvsp[-1].String) += ">";
3874 (yyval.String) = (yyvsp[-1].String);
3875 ;}
3876 break;
3877
Reid Spencerc4d96252007-01-13 00:03:30 +00003878 case 241:
3879#line 1551 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003880 {
3881 if (!(yyvsp[-3].String)->empty()) {
3882 *(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003883 }
Reid Spencer319a7302007-01-05 17:20:02 +00003884 *(yyvsp[-4].String) += " " + *(yyvsp[-2].String) + ", " + *(yyvsp[0].String);
3885 delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3886 (yyval.String) = (yyvsp[-4].String);
3887 ;}
3888 break;
3889
Reid Spencerc4d96252007-01-13 00:03:30 +00003890 case 244:
3891#line 1564 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003892 {
3893 (yyval.Value).val = (yyvsp[0].String);
3894 (yyval.Value).constant = false;
3895 (yyval.Value).type = 0;
3896 ;}
3897 break;
3898
Reid Spencerc4d96252007-01-13 00:03:30 +00003899 case 245:
3900#line 1569 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003901 {
3902 (yyval.Value).val = (yyvsp[0].String);
3903 (yyval.Value).constant = true;
3904 (yyval.Value).type = 0;
3905 ;}
3906 break;
3907
Reid Spencerc4d96252007-01-13 00:03:30 +00003908 case 246:
3909#line 1579 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003910 {
3911 (yyvsp[-1].Type) = (yyvsp[-1].Type)->resolve();
3912 std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
3913 (yyval.Value) = (yyvsp[0].Value);
3914 delete (yyval.Value).val;
3915 (yyval.Value).val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name);
3916 (yyval.Value).type = (yyvsp[-1].Type);
3917 ;}
3918 break;
3919
Reid Spencer319a7302007-01-05 17:20:02 +00003920 case 247:
Reid Spencerc4d96252007-01-13 00:03:30 +00003921#line 1588 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
3922 {
Reid Spencer319a7302007-01-05 17:20:02 +00003923 (yyval.String) = 0;
3924 ;}
3925 break;
3926
3927 case 248:
Reid Spencerc4d96252007-01-13 00:03:30 +00003928#line 1591 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
3929 { // Do not allow functions with 0 basic blocks
Reid Spencer319a7302007-01-05 17:20:02 +00003930 (yyval.String) = 0;
3931 ;}
3932 break;
3933
3934 case 249:
Reid Spencerc4d96252007-01-13 00:03:30 +00003935#line 1599 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
3936 {
3937 (yyval.String) = 0;
3938 ;}
3939 break;
3940
3941 case 250:
3942#line 1603 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003943 {
3944 *O << " " << *(yyvsp[0].String) << '\n';
3945 delete (yyvsp[0].String);
3946 (yyval.String) = 0;
3947 ;}
3948 break;
3949
Reid Spencerc4d96252007-01-13 00:03:30 +00003950 case 251:
3951#line 1608 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003952 {
3953 (yyval.String) = 0;
3954 ;}
3955 break;
3956
Reid Spencerc4d96252007-01-13 00:03:30 +00003957 case 252:
3958#line 1611 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003959 {
3960 *O << *(yyvsp[0].String) << '\n';
3961 delete (yyvsp[0].String);
3962 (yyval.String) = 0;
3963 ;}
3964 break;
3965
Reid Spencerc4d96252007-01-13 00:03:30 +00003966 case 254:
3967#line 1617 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003968 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
3969 break;
3970
Reid Spencerc4d96252007-01-13 00:03:30 +00003971 case 255:
3972#line 1619 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003973 { // Return with a result...
3974 *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Value).val << '\n';
3975 delete (yyvsp[-1].String); (yyvsp[0].Value).destroy();
3976 (yyval.String) = 0;
3977 ;}
3978 break;
3979
Reid Spencerc4d96252007-01-13 00:03:30 +00003980 case 256:
3981#line 1624 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003982 { // Return with no result...
3983 *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Type)->getNewTy() << '\n';
3984 delete (yyvsp[-1].String);
3985 (yyval.String) = 0;
3986 ;}
3987 break;
3988
Reid Spencerc4d96252007-01-13 00:03:30 +00003989 case 257:
3990#line 1629 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003991 { // Unconditional Branch...
3992 *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
3993 delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
3994 (yyval.String) = 0;
3995 ;}
3996 break;
3997
Reid Spencerc4d96252007-01-13 00:03:30 +00003998 case 258:
3999#line 1634 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004000 {
4001 std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type));
4002 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", "
4003 << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ", " << (yyvsp[-1].Type)->getNewTy() << ' '
4004 << *(yyvsp[0].Value).val << '\n';
4005 delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy();
4006 (yyval.String) = 0;
4007 ;}
4008 break;
4009
Reid Spencerc4d96252007-01-13 00:03:30 +00004010 case 259:
4011#line 1642 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004012 {
4013 std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type));
4014 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", "
4015 << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n";
4016 delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy();
4017 delete (yyvsp[-1].String);
4018 (yyval.String) = 0;
4019 ;}
4020 break;
4021
Reid Spencerc4d96252007-01-13 00:03:30 +00004022 case 260:
4023#line 1650 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004024 {
4025 std::string Name = getUniqueName((yyvsp[-5].Value).val, (yyvsp[-6].Type));
4026 *O << " " << *(yyvsp[-7].String) << ' ' << (yyvsp[-6].Type)->getNewTy() << ' ' << Name << ", "
4027 << (yyvsp[-3].Type)->getNewTy() << ' ' << *(yyvsp[-2].Value).val << "[]\n";
4028 delete (yyvsp[-7].String); (yyvsp[-5].Value).destroy(); (yyvsp[-2].Value).destroy();
4029 (yyval.String) = 0;
4030 ;}
4031 break;
4032
Reid Spencerc4d96252007-01-13 00:03:30 +00004033 case 261:
4034#line 1658 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004035 {
4036 const TypeInfo* ResTy = getFunctionReturnType((yyvsp[-10].Type));
Reid Spencer16244f42006-12-01 21:10:07 +00004037 *O << " ";
Reid Spencer319a7302007-01-05 17:20:02 +00004038 if (!(yyvsp[-13].String)->empty()) {
4039 std::string Name = getUniqueName((yyvsp[-13].String), ResTy);
Reid Spencer52402b02007-01-02 05:45:11 +00004040 *O << Name << " = ";
4041 }
Reid Spencer319a7302007-01-05 17:20:02 +00004042 *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Type)->getNewTy() << ' ' << *(yyvsp[-9].Value).val << " (";
4043 for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) {
4044 ValueInfo& VI = (*(yyvsp[-7].ValList))[i];
Reid Spencerf8483652006-12-02 15:16:01 +00004045 *O << *VI.val;
Reid Spencer319a7302007-01-05 17:20:02 +00004046 if (i+1 < (yyvsp[-7].ValList)->size())
Reid Spencerf8483652006-12-02 15:16:01 +00004047 *O << ", ";
4048 VI.destroy();
4049 }
Reid Spencer319a7302007-01-05 17:20:02 +00004050 *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ' '
4051 << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n';
4052 delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList);
4053 delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
4054 (yyval.String) = 0;
4055 ;}
4056 break;
4057
Reid Spencer319a7302007-01-05 17:20:02 +00004058 case 262:
Reid Spencerc4d96252007-01-13 00:03:30 +00004059#line 1679 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004060 {
4061 *O << " " << *(yyvsp[0].String) << '\n';
4062 delete (yyvsp[0].String);
4063 (yyval.String) = 0;
4064 ;}
4065 break;
4066
4067 case 263:
Reid Spencerc4d96252007-01-13 00:03:30 +00004068#line 1684 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
4069 {
4070 *O << " " << *(yyvsp[0].String) << '\n';
4071 delete (yyvsp[0].String);
4072 (yyval.String) = 0;
4073 ;}
4074 break;
4075
4076 case 264:
4077#line 1690 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004078 {
4079 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Type)->getNewTy() + " " +
4080 *(yyvsp[0].Value).val;
4081 delete (yyvsp[-3].String); (yyvsp[0].Value).destroy();
4082 (yyval.String) = (yyvsp[-5].String);
4083 ;}
4084 break;
4085
Reid Spencerc4d96252007-01-13 00:03:30 +00004086 case 265:
4087#line 1696 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004088 {
4089 (yyvsp[-3].String)->insert(0, (yyvsp[-4].Type)->getNewTy() + " " );
4090 *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value).val;
4091 (yyvsp[0].Value).destroy();
4092 (yyval.String) = (yyvsp[-3].String);
4093 ;}
4094 break;
4095
Reid Spencerc4d96252007-01-13 00:03:30 +00004096 case 266:
4097#line 1704 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004098 {
4099 if (!(yyvsp[-1].String)->empty()) {
4100 // Get a unique name for this value, based on its type.
4101 std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value).type);
4102 *(yyvsp[-1].String) = Name + " = ";
4103 if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
4104 // don't actually delete it, just comment it out
4105 (yyvsp[-1].String)->insert(0, "; USELSS BITCAST: ");
Reid Spencerf5626a32007-01-01 01:20:41 +00004106 delete deleteUselessCastName;
Reid Spencerf5626a32007-01-01 01:20:41 +00004107 }
4108 }
Reid Spencer319a7302007-01-05 17:20:02 +00004109 *(yyvsp[-1].String) += *(yyvsp[0].Value).val;
4110 (yyvsp[0].Value).destroy();
Reid Spencerf5626a32007-01-01 01:20:41 +00004111 deleteUselessCastFlag = false;
Reid Spencer319a7302007-01-05 17:20:02 +00004112 (yyval.String) = (yyvsp[-1].String);
4113 ;}
4114 break;
4115
Reid Spencerc4d96252007-01-13 00:03:30 +00004116 case 267:
4117#line 1722 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004118 { // Used for PHI nodes
4119 std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-5].Type));
4120 Name.insert(0, (yyvsp[-5].Type)->getNewTy() + "[");
4121 Name += "," + *(yyvsp[-1].Value).val + "]";
4122 (yyval.Value).val = new std::string(Name);
4123 (yyval.Value).type = (yyvsp[-5].Type);
4124 (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
4125 ;}
4126 break;
4127
Reid Spencerc4d96252007-01-13 00:03:30 +00004128 case 268:
4129#line 1730 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004130 {
4131 std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-6].Value).type);
4132 *(yyvsp[-6].Value).val += ", [" + Name + "," + *(yyvsp[-1].Value).val + "]";
4133 (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
4134 (yyval.Value) = (yyvsp[-6].Value);
4135 ;}
4136 break;
4137
Reid Spencerc4d96252007-01-13 00:03:30 +00004138 case 269:
4139#line 1739 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004140 {
4141 (yyval.ValList) = new ValueList();
4142 (yyval.ValList)->push_back((yyvsp[0].Value));
4143 ;}
4144 break;
4145
Reid Spencerc4d96252007-01-13 00:03:30 +00004146 case 270:
4147#line 1743 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004148 {
4149 (yyval.ValList) = (yyvsp[-2].ValList);
4150 (yyval.ValList)->push_back((yyvsp[0].Value));
4151 ;}
4152 break;
4153
Reid Spencerc4d96252007-01-13 00:03:30 +00004154 case 271:
4155#line 1750 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004156 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4157 break;
4158
Reid Spencerc4d96252007-01-13 00:03:30 +00004159 case 272:
4160#line 1751 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004161 { (yyval.ValList) = new ValueList(); ;}
4162 break;
4163
Reid Spencerc4d96252007-01-13 00:03:30 +00004164 case 273:
4165#line 1755 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004166 {
4167 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
4168 delete (yyvsp[0].String);
4169 (yyval.String) = (yyvsp[-1].String);
4170 ;}
4171 break;
4172
Reid Spencerc4d96252007-01-13 00:03:30 +00004173 case 275:
4174#line 1763 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004175 {
4176 const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type));
4177 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4178 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4179 (yyval.Value).val = new std::string(op);
4180 *(yyval.Value).val += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
4181 (yyval.Value).type = (yyvsp[-3].Type);
4182 delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4183 ;}
4184 break;
4185
Reid Spencerc4d96252007-01-13 00:03:30 +00004186 case 276:
4187#line 1772 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004188 {
4189 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4190 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4191 *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
4192 (yyval.Value).val = (yyvsp[-4].String);
4193 (yyval.Value).type = (yyvsp[-3].Type);
4194 (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4195 ;}
4196 break;
4197
Reid Spencerc4d96252007-01-13 00:03:30 +00004198 case 277:
4199#line 1780 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004200 {
4201 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4202 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4203 *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
4204 *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
4205 (yyval.Value).val = (yyvsp[-4].String);
Reid Spencer195a32e52007-01-13 04:40:16 +00004206 (yyval.Value).type = TypeInfo::get("i1",BoolTy);
Reid Spencer319a7302007-01-05 17:20:02 +00004207 (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4208 ;}
4209 break;
4210
Reid Spencer319a7302007-01-05 17:20:02 +00004211 case 278:
Reid Spencerc4d96252007-01-13 00:03:30 +00004212#line 1789 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004213 {
4214 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4215 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4216 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
4217 (yyval.Value).val = (yyvsp[-5].String);
Reid Spencer195a32e52007-01-13 04:40:16 +00004218 (yyval.Value).type = TypeInfo::get("i1",BoolTy);
Reid Spencer319a7302007-01-05 17:20:02 +00004219 delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4220 ;}
4221 break;
4222
4223 case 279:
Reid Spencerc4d96252007-01-13 00:03:30 +00004224#line 1797 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
4225 {
4226 std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type));
4227 std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type));
4228 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
4229 (yyval.Value).val = (yyvsp[-5].String);
Reid Spencer195a32e52007-01-13 04:40:16 +00004230 (yyval.Value).type = TypeInfo::get("i1",BoolTy);
Reid Spencerc4d96252007-01-13 00:03:30 +00004231 delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4232 ;}
4233 break;
4234
4235 case 280:
4236#line 1805 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004237 {
4238 const char* shiftop = (yyvsp[-3].String)->c_str();
4239 if (*(yyvsp[-3].String) == "shr")
4240 shiftop = ((yyvsp[-2].Value).type->isUnsigned()) ? "lshr" : "ashr";
4241 (yyval.Value).val = new std::string(shiftop);
4242 *(yyval.Value).val += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4243 (yyval.Value).type = (yyvsp[-2].Value).type;
Reid Spencerf8383de2007-01-06 06:04:32 +00004244 delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004245 ;}
4246 break;
4247
Reid Spencerc4d96252007-01-13 00:03:30 +00004248 case 281:
4249#line 1814 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004250 {
4251 std::string source = *(yyvsp[-2].Value).val;
4252 const TypeInfo* SrcTy = (yyvsp[-2].Value).type->resolve();
4253 const TypeInfo* DstTy = (yyvsp[0].Type)->resolve();
4254 (yyval.Value).val = new std::string();
4255 (yyval.Value).type = DstTy;
4256 if (*(yyvsp[-3].String) == "cast") {
4257 *(yyval.Value).val += getCastUpgrade(source, SrcTy, DstTy, false);
Reid Spencera50d5962006-12-02 04:11:07 +00004258 } else {
Reid Spencer319a7302007-01-05 17:20:02 +00004259 *(yyval.Value).val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
Reid Spencer280d8012006-12-01 23:40:53 +00004260 }
Reid Spencerf5626a32007-01-01 01:20:41 +00004261 // Check to see if this is a useless cast of a value to the same name
4262 // and the same type. Such casts will probably cause redefinition errors
4263 // when assembled and perform no code gen action so just remove them.
Reid Spencer319a7302007-01-05 17:20:02 +00004264 if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast")
4265 if (SrcTy->isInteger() && DstTy->isInteger() &&
4266 SrcTy->getBitWidth() == DstTy->getBitWidth()) {
Reid Spencerf5626a32007-01-01 01:20:41 +00004267 deleteUselessCastFlag = true; // Flag the "Inst" rule
Reid Spencer319a7302007-01-05 17:20:02 +00004268 deleteUselessCastName = new std::string(*(yyvsp[-2].Value).val); // save the name
Reid Spencerf5626a32007-01-01 01:20:41 +00004269 size_t pos = deleteUselessCastName->find_first_of("%\"",0);
4270 if (pos != std::string::npos) {
4271 // remove the type portion before val
4272 deleteUselessCastName->erase(0, pos);
4273 }
4274 }
Reid Spencer319a7302007-01-05 17:20:02 +00004275 delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy();
4276 delete (yyvsp[-1].String);
4277 ;}
4278 break;
4279
Reid Spencerc4d96252007-01-13 00:03:30 +00004280 case 282:
4281#line 1842 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004282 {
4283 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4284 (yyval.Value).val = (yyvsp[-5].String);
4285 (yyval.Value).type = (yyvsp[-2].Value).type;
Reid Spencerf8383de2007-01-06 06:04:32 +00004286 (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004287 ;}
4288 break;
4289
Reid Spencerc4d96252007-01-13 00:03:30 +00004290 case 283:
4291#line 1848 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004292 {
4293 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + (yyvsp[0].Type)->getNewTy();
4294 (yyval.Value).val = (yyvsp[-3].String);
4295 (yyval.Value).type = (yyvsp[0].Type);
4296 (yyvsp[-2].Value).destroy();
4297 ;}
4298 break;
4299
Reid Spencerc4d96252007-01-13 00:03:30 +00004300 case 284:
4301#line 1854 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004302 {
4303 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4304 (yyval.Value).val = (yyvsp[-3].String);
4305 (yyvsp[-2].Value).type = (yyvsp[-2].Value).type->resolve();;
4306 (yyval.Value).type = (yyvsp[-2].Value).type->getElementType();
Reid Spencerf8383de2007-01-06 06:04:32 +00004307 (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004308 ;}
4309 break;
4310
4311 case 285:
Reid Spencerc4d96252007-01-13 00:03:30 +00004312#line 1861 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004313 {
4314 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4315 (yyval.Value).val = (yyvsp[-5].String);
4316 (yyval.Value).type = (yyvsp[-4].Value).type;
Reid Spencerf8383de2007-01-06 06:04:32 +00004317 (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
Reid Spencer319a7302007-01-05 17:20:02 +00004318 ;}
4319 break;
4320
4321 case 286:
Reid Spencerc4d96252007-01-13 00:03:30 +00004322#line 1867 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
4323 {
4324 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
4325 (yyval.Value).val = (yyvsp[-5].String);
4326 (yyval.Value).type = (yyvsp[-4].Value).type;
4327 (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
4328 ;}
4329 break;
4330
4331 case 287:
4332#line 1873 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004333 {
4334 *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
4335 (yyval.Value).val = (yyvsp[-1].String);
4336 (yyval.Value).type = (yyvsp[0].Value).type;
4337 delete (yyvsp[0].Value).val;
4338 ;}
4339 break;
4340
Reid Spencerc4d96252007-01-13 00:03:30 +00004341 case 288:
4342#line 1879 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004343 {
Reid Spencer12969882007-01-07 08:07:39 +00004344 // map llvm.isunordered to "fcmp uno"
4345 if (*(yyvsp[-3].Value).val == "%llvm.isunordered.f32" ||
4346 *(yyvsp[-3].Value).val == "%llvm.isunordered.f64") {
4347 (yyval.Value).val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0].val + ", ");
4348 size_t pos = (*(yyvsp[-1].ValList))[1].val->find(' ');
4349 assert(pos != std::string::npos && "no space?");
4350 *(yyval.Value).val += (*(yyvsp[-1].ValList))[1].val->substr(pos+1);
Reid Spencer195a32e52007-01-13 04:40:16 +00004351 (yyval.Value).type = TypeInfo::get("i1", BoolTy);
Reid Spencer12969882007-01-07 08:07:39 +00004352 } else {
Reid Spencerc4d96252007-01-13 00:03:30 +00004353 static unsigned upgradeCount = 1;
4354 if (*(yyvsp[-3].Value).val == "%llvm.va_start" || *(yyvsp[-3].Value).val == "%llvm.va_end") {
Reid Spencerf6e54592007-01-13 00:23:06 +00004355 if (!(yyvsp[-1].ValList)->empty()) {
4356 std::string name("%va_upgrade");
4357 name += llvm::utostr(upgradeCount++);
4358 (yyvsp[-6].String)->insert(0, name + " = bitcast " + *(*(yyvsp[-1].ValList))[0].val + " to i8*\n ");
4359 *(*(yyvsp[-1].ValList))[0].val = "i8* " + name;
4360 (*(yyvsp[-1].ValList))[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
4361 }
Reid Spencerc4d96252007-01-13 00:03:30 +00004362 } else if (*(yyvsp[-3].Value).val == "%llvm.va_copy") {
4363 std::string name0("%va_upgrade");
4364 name0 += llvm::utostr(upgradeCount++);
4365 std::string name1("%va_upgrade");
4366 name1 += llvm::utostr(upgradeCount++);
4367 (yyvsp[-6].String)->insert(0, name0 + " = bitcast " + *(*(yyvsp[-1].ValList))[0].val + " to i8*\n " +
4368 name1 + " = bitcast " + *(*(yyvsp[-1].ValList))[1].val + " to i8*\n ");
4369 *(*(yyvsp[-1].ValList))[0].val = "i8* " + name0;
4370 (*(yyvsp[-1].ValList))[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
4371 *(*(yyvsp[-1].ValList))[1].val = "i8* " + name1;
4372 (*(yyvsp[-1].ValList))[0].type = TypeInfo::get("i8", UByteTy)->getPointerType();
4373 }
Reid Spencer12969882007-01-07 08:07:39 +00004374 if (!(yyvsp[-5].String)->empty())
4375 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
4376 if (!(yyvsp[-6].String)->empty())
4377 *(yyvsp[-6].String) += " ";
4378 *(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].Value).val + "(";
4379 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
4380 ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
4381 *(yyvsp[-6].String) += *VI.val;
4382 if (i+1 < (yyvsp[-1].ValList)->size())
4383 *(yyvsp[-6].String) += ", ";
4384 VI.destroy();
4385 }
4386 *(yyvsp[-6].String) += ")";
4387 (yyval.Value).val = (yyvsp[-6].String);
4388 (yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type));
Reid Spencerf8483652006-12-02 15:16:01 +00004389 }
Reid Spencer319a7302007-01-05 17:20:02 +00004390 delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList);
4391 ;}
4392 break;
4393
Reid Spencerc4d96252007-01-13 00:03:30 +00004394 case 290:
Reid Spencerf6e54592007-01-13 00:23:06 +00004395#line 1933 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004396 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4397 break;
4398
Reid Spencerc4d96252007-01-13 00:03:30 +00004399 case 291:
Reid Spencerf6e54592007-01-13 00:23:06 +00004400#line 1934 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004401 { (yyval.ValList) = new ValueList(); ;}
4402 break;
4403
Reid Spencerc4d96252007-01-13 00:03:30 +00004404 case 293:
Reid Spencerf6e54592007-01-13 00:23:06 +00004405#line 1939 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004406 { (yyval.String) = new std::string(); ;}
4407 break;
4408
Reid Spencerc4d96252007-01-13 00:03:30 +00004409 case 294:
Reid Spencerf6e54592007-01-13 00:23:06 +00004410#line 1942 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004411 {
4412 *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
4413 if (!(yyvsp[0].String)->empty())
4414 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
4415 (yyval.Value).val = (yyvsp[-2].String);
4416 (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
4417 delete (yyvsp[0].String);
4418 ;}
4419 break;
4420
4421 case 295:
Reid Spencerf6e54592007-01-13 00:23:06 +00004422#line 1950 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004423 {
4424 std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
4425 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4426 if (!(yyvsp[0].String)->empty())
4427 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
4428 (yyval.Value).val = (yyvsp[-5].String);
4429 (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
4430 (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
4431 ;}
4432 break;
4433
Reid Spencerc4d96252007-01-13 00:03:30 +00004434 case 296:
Reid Spencerf6e54592007-01-13 00:23:06 +00004435#line 1959 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004436 {
4437 *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
4438 if (!(yyvsp[0].String)->empty())
4439 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
4440 (yyval.Value).val = (yyvsp[-2].String);
4441 (yyval.Value).type = (yyvsp[-1].Type)->getPointerType();
4442 delete (yyvsp[0].String);
4443 ;}
4444 break;
4445
Reid Spencer609ca3e2007-01-12 20:10:51 +00004446 case 297:
Reid Spencerf6e54592007-01-13 00:23:06 +00004447#line 1967 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004448 {
4449 std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
4450 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4451 if (!(yyvsp[0].String)->empty())
4452 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
4453 (yyval.Value).val = (yyvsp[-5].String);
4454 (yyval.Value).type = (yyvsp[-4].Type)->getPointerType();
4455 (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String);
4456 ;}
4457 break;
4458
4459 case 298:
Reid Spencerf6e54592007-01-13 00:23:06 +00004460#line 1976 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004461 {
4462 *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
4463 (yyval.Value).val = (yyvsp[-1].String);
4464 (yyval.Value).type = TypeInfo::get("void", VoidTy);
4465 (yyvsp[0].Value).destroy();
4466 ;}
4467 break;
4468
Reid Spencerc4d96252007-01-13 00:03:30 +00004469 case 299:
Reid Spencerf6e54592007-01-13 00:23:06 +00004470#line 1982 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004471 {
4472 std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
4473 if (!(yyvsp[-3].String)->empty())
4474 *(yyvsp[-3].String) += " ";
4475 *(yyvsp[-3].String) += *(yyvsp[-2].String) + " " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
4476 (yyval.Value).val = (yyvsp[-3].String);
4477 (yyval.Value).type = (yyvsp[-1].Type)->getElementType();
4478 delete (yyvsp[-2].String); (yyvsp[0].Value).destroy();
4479 ;}
4480 break;
4481
Reid Spencerc4d96252007-01-13 00:03:30 +00004482 case 300:
Reid Spencerf6e54592007-01-13 00:23:06 +00004483#line 1991 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004484 {
4485 std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type));
4486 if (!(yyvsp[-5].String)->empty())
4487 *(yyvsp[-5].String) += " ";
4488 *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Value).val + ", " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
4489 (yyval.Value).val = (yyvsp[-5].String);
4490 (yyval.Value).type = TypeInfo::get("void", VoidTy);
4491 delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy();
4492 ;}
4493 break;
4494
Reid Spencerc4d96252007-01-13 00:03:30 +00004495 case 301:
Reid Spencerf6e54592007-01-13 00:23:06 +00004496#line 2000 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004497 {
4498 std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
Reid Spencerf459d392006-12-02 16:19:52 +00004499 // Upgrade the indices
Reid Spencer319a7302007-01-05 17:20:02 +00004500 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
4501 ValueInfo& VI = (*(yyvsp[0].ValList))[i];
Reid Spencer52402b02007-01-02 05:45:11 +00004502 if (VI.type->isUnsigned() && !VI.isConstant() &&
4503 VI.type->getBitWidth() < 64) {
Reid Spencerf8383de2007-01-06 06:04:32 +00004504 *O << " %gep_upgrade" << unique << " = zext " << *VI.val
Reid Spencer71d2ec92006-12-31 06:02:26 +00004505 << " to i64\n";
Reid Spencerf8383de2007-01-06 06:04:32 +00004506 *VI.val = "i64 %gep_upgrade" + llvm::utostr(unique++);
Reid Spencer319a7302007-01-05 17:20:02 +00004507 VI.type = TypeInfo::get("i64",ULongTy);
Reid Spencerf459d392006-12-02 16:19:52 +00004508 }
4509 }
Reid Spencer319a7302007-01-05 17:20:02 +00004510 *(yyvsp[-3].String) += " " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4511 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
4512 ValueInfo& VI = (*(yyvsp[0].ValList))[i];
4513 *(yyvsp[-3].String) += ", " + *VI.val;
Reid Spencerf8483652006-12-02 15:16:01 +00004514 }
Reid Spencer319a7302007-01-05 17:20:02 +00004515 (yyval.Value).val = (yyvsp[-3].String);
4516 (yyval.Value).type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList));
4517 (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList);
4518 ;}
4519 break;
4520
4521
4522 default: break;
4523 }
4524
4525/* Line 1126 of yacc.c. */
Reid Spencerf6e54592007-01-13 00:23:06 +00004526#line 4527 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00004527
4528 yyvsp -= yylen;
4529 yyssp -= yylen;
4530
Reid Spencer319a7302007-01-05 17:20:02 +00004531
4532 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004533
4534 *++yyvsp = yyval;
4535
4536
Reid Spencer319a7302007-01-05 17:20:02 +00004537 /* Now `shift' the result of the reduction. Determine what state
4538 that goes to, based on the state we popped back to and the rule
4539 number reduced by. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004540
4541 yyn = yyr1[yyn];
4542
Reid Spencer319a7302007-01-05 17:20:02 +00004543 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4544 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00004545 yystate = yytable[yystate];
4546 else
Reid Spencer319a7302007-01-05 17:20:02 +00004547 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencere7c3c602006-11-30 06:36:44 +00004548
4549 goto yynewstate;
4550
4551
Reid Spencer319a7302007-01-05 17:20:02 +00004552/*------------------------------------.
4553| yyerrlab -- here on detecting error |
4554`------------------------------------*/
4555yyerrlab:
4556 /* If not already recovering from an error, report this error. */
4557 if (!yyerrstatus)
Reid Spencere7c3c602006-11-30 06:36:44 +00004558 {
4559 ++yynerrs;
Reid Spencer319a7302007-01-05 17:20:02 +00004560#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00004561 yyn = yypact[yystate];
4562
Reid Spencer319a7302007-01-05 17:20:02 +00004563 if (YYPACT_NINF < yyn && yyn < YYLAST)
Reid Spencere7c3c602006-11-30 06:36:44 +00004564 {
Reid Spencer319a7302007-01-05 17:20:02 +00004565 int yytype = YYTRANSLATE (yychar);
4566 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
4567 YYSIZE_T yysize = yysize0;
4568 YYSIZE_T yysize1;
4569 int yysize_overflow = 0;
4570 char *yymsg = 0;
4571# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
4572 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
4573 int yyx;
Reid Spencere7c3c602006-11-30 06:36:44 +00004574
Reid Spencer319a7302007-01-05 17:20:02 +00004575#if 0
4576 /* This is so xgettext sees the translatable formats that are
4577 constructed on the fly. */
4578 YY_("syntax error, unexpected %s");
4579 YY_("syntax error, unexpected %s, expecting %s");
4580 YY_("syntax error, unexpected %s, expecting %s or %s");
4581 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
4582 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
4583#endif
4584 char *yyfmt;
4585 char const *yyf;
4586 static char const yyunexpected[] = "syntax error, unexpected %s";
4587 static char const yyexpecting[] = ", expecting %s";
4588 static char const yyor[] = " or %s";
4589 char yyformat[sizeof yyunexpected
4590 + sizeof yyexpecting - 1
4591 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
4592 * (sizeof yyor - 1))];
4593 char const *yyprefix = yyexpecting;
4594
4595 /* Start YYX at -YYN if negative to avoid negative indexes in
4596 YYCHECK. */
4597 int yyxbegin = yyn < 0 ? -yyn : 0;
4598
4599 /* Stay within bounds of both yycheck and yytname. */
4600 int yychecklim = YYLAST - yyn;
4601 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4602 int yycount = 1;
4603
4604 yyarg[0] = yytname[yytype];
4605 yyfmt = yystpcpy (yyformat, yyunexpected);
4606
4607 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4608 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4609 {
4610 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
4611 {
4612 yycount = 1;
4613 yysize = yysize0;
4614 yyformat[sizeof yyunexpected - 1] = '\0';
4615 break;
4616 }
4617 yyarg[yycount++] = yytname[yyx];
4618 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
4619 yysize_overflow |= yysize1 < yysize;
4620 yysize = yysize1;
4621 yyfmt = yystpcpy (yyfmt, yyprefix);
4622 yyprefix = yyor;
4623 }
4624
4625 yyf = YY_(yyformat);
4626 yysize1 = yysize + yystrlen (yyf);
4627 yysize_overflow |= yysize1 < yysize;
4628 yysize = yysize1;
4629
4630 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
4631 yymsg = (char *) YYSTACK_ALLOC (yysize);
4632 if (yymsg)
Reid Spencere7c3c602006-11-30 06:36:44 +00004633 {
Reid Spencer319a7302007-01-05 17:20:02 +00004634 /* Avoid sprintf, as that infringes on the user's name space.
4635 Don't have undefined behavior even if the translation
4636 produced a string with the wrong number of "%s"s. */
4637 char *yyp = yymsg;
4638 int yyi = 0;
4639 while ((*yyp = *yyf))
Reid Spencere7c3c602006-11-30 06:36:44 +00004640 {
Reid Spencer319a7302007-01-05 17:20:02 +00004641 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
4642 {
4643 yyp += yytnamerr (yyp, yyarg[yyi++]);
4644 yyf += 2;
4645 }
4646 else
4647 {
4648 yyp++;
4649 yyf++;
4650 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004651 }
Reid Spencer319a7302007-01-05 17:20:02 +00004652 yyerror (yymsg);
4653 YYSTACK_FREE (yymsg);
Reid Spencere7c3c602006-11-30 06:36:44 +00004654 }
4655 else
Reid Spencer319a7302007-01-05 17:20:02 +00004656 {
4657 yyerror (YY_("syntax error"));
4658 goto yyexhaustedlab;
4659 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004660 }
4661 else
4662#endif /* YYERROR_VERBOSE */
Reid Spencer319a7302007-01-05 17:20:02 +00004663 yyerror (YY_("syntax error"));
Reid Spencere7c3c602006-11-30 06:36:44 +00004664 }
4665
Reid Spencer319a7302007-01-05 17:20:02 +00004666
Reid Spencere7c3c602006-11-30 06:36:44 +00004667
4668 if (yyerrstatus == 3)
4669 {
Reid Spencer319a7302007-01-05 17:20:02 +00004670 /* If just tried and failed to reuse look-ahead token after an
4671 error, discard it. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004672
Reid Spencer319a7302007-01-05 17:20:02 +00004673 if (yychar <= YYEOF)
4674 {
4675 /* Return failure if at end of input. */
4676 if (yychar == YYEOF)
4677 YYABORT;
4678 }
4679 else
4680 {
4681 yydestruct ("Error: discarding", yytoken, &yylval);
4682 yychar = YYEMPTY;
4683 }
4684 }
4685
4686 /* Else will try to reuse look-ahead token after shifting the error
4687 token. */
4688 goto yyerrlab1;
4689
4690
4691/*---------------------------------------------------.
4692| yyerrorlab -- error raised explicitly by YYERROR. |
4693`---------------------------------------------------*/
4694yyerrorlab:
4695
4696 /* Pacify compilers like GCC when the user code never invokes
4697 YYERROR and the label yyerrorlab therefore never appears in user
4698 code. */
4699 if (0)
4700 goto yyerrorlab;
4701
4702yyvsp -= yylen;
4703 yyssp -= yylen;
4704 yystate = *yyssp;
4705 goto yyerrlab1;
4706
4707
4708/*-------------------------------------------------------------.
4709| yyerrlab1 -- common code for both syntax error and YYERROR. |
4710`-------------------------------------------------------------*/
4711yyerrlab1:
4712 yyerrstatus = 3; /* Each real token shifted decrements this. */
4713
4714 for (;;)
4715 {
4716 yyn = yypact[yystate];
4717 if (yyn != YYPACT_NINF)
4718 {
4719 yyn += YYTERROR;
4720 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4721 {
4722 yyn = yytable[yyn];
4723 if (0 < yyn)
4724 break;
4725 }
4726 }
4727
4728 /* Pop the current state because it cannot handle the error token. */
4729 if (yyssp == yyss)
Reid Spencere7c3c602006-11-30 06:36:44 +00004730 YYABORT;
4731
4732
Reid Spencer319a7302007-01-05 17:20:02 +00004733 yydestruct ("Error: popping", yystos[yystate], yyvsp);
4734 YYPOPSTACK;
4735 yystate = *yyssp;
4736 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004737 }
4738
4739 if (yyn == YYFINAL)
4740 YYACCEPT;
4741
4742 *++yyvsp = yylval;
Reid Spencer319a7302007-01-05 17:20:02 +00004743
4744
4745 /* Shift the error token. */
4746 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004747
4748 yystate = yyn;
4749 goto yynewstate;
4750
Chris Lattner37e01c52007-01-04 18:46:42 +00004751
Reid Spencer319a7302007-01-05 17:20:02 +00004752/*-------------------------------------.
4753| yyacceptlab -- YYACCEPT comes here. |
4754`-------------------------------------*/
4755yyacceptlab:
4756 yyresult = 0;
4757 goto yyreturn;
4758
4759/*-----------------------------------.
4760| yyabortlab -- YYABORT comes here. |
4761`-----------------------------------*/
4762yyabortlab:
4763 yyresult = 1;
4764 goto yyreturn;
4765
4766#ifndef yyoverflow
4767/*-------------------------------------------------.
4768| yyexhaustedlab -- memory exhaustion comes here. |
4769`-------------------------------------------------*/
4770yyexhaustedlab:
4771 yyerror (YY_("memory exhausted"));
4772 yyresult = 2;
4773 /* Fall through. */
Chris Lattner37e01c52007-01-04 18:46:42 +00004774#endif
Reid Spencer319a7302007-01-05 17:20:02 +00004775
4776yyreturn:
4777 if (yychar != YYEOF && yychar != YYEMPTY)
4778 yydestruct ("Cleanup: discarding lookahead",
4779 yytoken, &yylval);
4780 while (yyssp != yyss)
4781 {
4782 yydestruct ("Cleanup: popping",
4783 yystos[*yyssp], yyvsp);
4784 YYPOPSTACK;
Chris Lattner37e01c52007-01-04 18:46:42 +00004785 }
Reid Spencer319a7302007-01-05 17:20:02 +00004786#ifndef yyoverflow
4787 if (yyss != yyssa)
4788 YYSTACK_FREE (yyss);
4789#endif
4790 return yyresult;
Reid Spencere7c3c602006-11-30 06:36:44 +00004791}
Reid Spencer319a7302007-01-05 17:20:02 +00004792
4793
Reid Spencerf6e54592007-01-13 00:23:06 +00004794#line 2023 "/proj/llvm/llvm-4/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencere7c3c602006-11-30 06:36:44 +00004795
4796
4797int yyerror(const char *ErrorMsg) {
4798 std::string where
4799 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4800 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
Reid Spencer319a7302007-01-05 17:20:02 +00004801 std::string errMsg = where + "error: " + std::string(ErrorMsg) +
4802 " while reading ";
Reid Spencere7c3c602006-11-30 06:36:44 +00004803 if (yychar == YYEMPTY || yychar == 0)
4804 errMsg += "end-of-file.";
4805 else
4806 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
Reid Spencer71d2ec92006-12-31 06:02:26 +00004807 std::cerr << "llvm-upgrade: " << errMsg << '\n';
Chris Lattner37e01c52007-01-04 18:46:42 +00004808 *O << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +00004809 exit(1);
4810}
Reid Spencer319a7302007-01-05 17:20:02 +00004811
4812static void warning(const std::string& ErrorMsg) {
4813 std::string where
4814 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4815 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
4816 std::string errMsg = where + "warning: " + std::string(ErrorMsg) +
4817 " while reading ";
4818 if (yychar == YYEMPTY || yychar == 0)
4819 errMsg += "end-of-file.";
4820 else
4821 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
4822 std::cerr << "llvm-upgrade: " << errMsg << '\n';
4823}
4824