blob: 5ae0db7529d45c6aeab556157523b5c309d61182 [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 Spencer30d0c582007-01-15 00:26:18 +0000369#line 14 "/proj/llvm/llvm-2/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 Spencer30d0c582007-01-15 00:26:18 +0000389
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 Spencer319a7302007-01-05 17:20:02 +0000395static void warning(const std::string& msg);
Reid Spencera50d5962006-12-02 04:11:07 +0000396
Reid Spencer96839be2006-11-30 16:50:26 +0000397void UpgradeAssembly(const std::string &infile, std::istream& in,
Reid Spencer71d2ec92006-12-31 06:02:26 +0000398 std::ostream &out, bool debug, bool addAttrs)
Reid Spencere7c3c602006-11-30 06:36:44 +0000399{
400 Upgradelineno = 1;
401 CurFilename = infile;
Reid Spencer96839be2006-11-30 16:50:26 +0000402 LexInput = &in;
Reid Spencere77e35e2006-12-01 20:26:20 +0000403 yydebug = debug;
Reid Spencer71d2ec92006-12-31 06:02:26 +0000404 AddAttributes = addAttrs;
Reid Spencere7c3c602006-11-30 06:36:44 +0000405 O = &out;
406
407 if (yyparse()) {
Reid Spencer30d0c582007-01-15 00:26:18 +0000408 std::cerr << "llvm-upgrade: parse failed.\n";
409 out << "llvm-upgrade: parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +0000410 exit(1);
411 }
412}
413
Reid Spencer30d0c582007-01-15 00:26:18 +0000414namespace { // Anonymous namespace to keep our implementation local
415
416
417/// This type is used to keep track of the signedness of values. Instead
418/// of creating llvm::Value directly, the parser will create ValueInfo which
419/// associates a Value* with a Signedness indication.
420struct ValueInfo {
421 std::string* val;
422 const TypeInfo* type;
423 bool constant;
424 bool isConstant() const { return constant; }
425 ~ValueInfo() { delete val; }
426};
427
428
429/// This type is used to keep track of the signedness of the obsolete
430/// integer types. Instead of creating an llvm::Type directly, the Lexer will
431/// create instances of TypeInfo which retains the signedness indication so
432/// it can be used by the parser for upgrade decisions.
433/// For example if "uint" is encountered then the "first" field will be set
434/// to "int32" and the "second" field will be set to "isUnsigned". If the
435/// type is not obsolete then "second" will be set to "isSignless".
436class TypeInfo {
437public:
438 static const TypeInfo* get(const std::string &newType, Types oldType);
439 static const TypeInfo* get(const std::string& newType, Types oldType,
440 const TypeInfo* eTy, const TypeInfo* rTy);
441
442 static const TypeInfo* get(const std::string& newType, Types oldType,
443 const TypeInfo *eTy, uint64_t elems);
444
445 static const TypeInfo* get(const std::string& newType, Types oldType,
446 TypeList* TL);
447
448 static const TypeInfo* get(const std::string& newType, const TypeInfo* resTy,
449 TypeList* TL);
450
451 const TypeInfo* resolve() const;
452 bool operator<(const TypeInfo& that) const;
453
454 bool sameNewTyAs(const TypeInfo* that) const {
455 return this->newTy == that->newTy;
456 }
457
458 bool sameOldTyAs(const TypeInfo* that) const;
459
460 Types getElementTy() const {
461 if (elemTy) {
462 return elemTy->oldTy;
463 }
464 return UnresolvedTy;
465 }
466
467 unsigned getUpRefNum() const {
468 assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference");
469 return atoi(&((getNewTy().c_str())[1])); // skip the slash
470 }
471
472 typedef std::vector<const TypeInfo*> UpRefStack;
473 void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const;
474 std::string makeUniqueName(const std::string& BaseName) const;
475
476 const std::string& getNewTy() const { return newTy; }
477 const TypeInfo* getResultType() const { return resultTy; }
478 const TypeInfo* getElementType() const { return elemTy; }
479
480 const TypeInfo* getPointerType() const {
481 return get(newTy + "*", PointerTy, this, (TypeInfo*)0);
482 }
483
484 bool isUnresolved() const { return oldTy == UnresolvedTy; }
485 bool isUpReference() const { return oldTy == UpRefTy; }
486 bool isVoid() const { return oldTy == VoidTy; }
487 bool isBool() const { return oldTy == BoolTy; }
488 bool isSigned() const {
489 return oldTy == SByteTy || oldTy == ShortTy ||
490 oldTy == IntTy || oldTy == LongTy;
491 }
492
493 bool isUnsigned() const {
494 return oldTy == UByteTy || oldTy == UShortTy ||
495 oldTy == UIntTy || oldTy == ULongTy;
496 }
497 bool isSignless() const { return !isSigned() && !isUnsigned(); }
498 bool isInteger() const { return isSigned() || isUnsigned(); }
499 bool isIntegral() const { return oldTy == BoolTy || isInteger(); }
500 bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; }
501 bool isPacked() const { return oldTy == PackedTy; }
502 bool isPointer() const { return oldTy == PointerTy; }
503 bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; }
504 bool isArray() const { return oldTy == ArrayTy; }
505 bool isOther() const {
506 return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); }
507 bool isFunction() const { return oldTy == FunctionTy; }
508 bool isComposite() const {
509 return isStruct() || isPointer() || isArray() || isPacked();
510 }
511
512 bool isAttributeCandidate() const {
513 return isIntegral() && getBitWidth() < 32;
514 }
515
516 bool isUnresolvedDeep() const;
517
518 unsigned getBitWidth() const;
519
520 const TypeInfo* getIndexedType(const ValueInfo* VI) const;
521
522 unsigned getNumStructElements() const {
523 return (elements ? elements->size() : 0);
524 }
525
526 const TypeInfo* getElement(unsigned idx) const {
527 if (elements)
528 if (idx < elements->size())
529 return (*elements)[idx];
530 return 0;
531 }
532
533private:
534 TypeInfo()
535 : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
536 nelems(0) {
537 }
538
539 TypeInfo(const TypeInfo& that); // do not implement
540 TypeInfo& operator=(const TypeInfo& that); // do not implement
541
542 ~TypeInfo() { delete elements; }
543
544 struct ltfunctor
545 {
546 bool operator()(const TypeInfo* X, const TypeInfo* Y) const {
547 assert(X && "Can't compare null pointer");
548 assert(Y && "Can't compare null pointer");
549 return *X < *Y;
550 }
551 };
552
553 typedef std::set<const TypeInfo*, ltfunctor> TypeRegMap;
554
555 static const TypeInfo* add_new_type(TypeInfo* existing);
556
557 std::string newTy;
558 Types oldTy;
559 TypeInfo *elemTy;
560 TypeInfo *resultTy;
561 TypeList *elements;
562 uint64_t nelems;
563 static TypeRegMap registry;
564public:
565 typedef std::vector<const TypeInfo*> TypeVector;
566 typedef std::map<std::string,const TypeInfo*> TypeMap;
567 typedef std::map<const TypeInfo*,std::string> TypePlaneMap;
568 typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
569 static TypeVector EnumeratedTypes;
570 static TypeMap NamedTypes;
571 static GlobalsTypeMap Globals;
572};
573
574TypeInfo::TypeRegMap TypeInfo::registry;
575TypeInfo::TypeVector TypeInfo::EnumeratedTypes;
576TypeInfo::TypeMap TypeInfo::NamedTypes;
577TypeInfo::GlobalsTypeMap TypeInfo::Globals;
Reid Spencer319a7302007-01-05 17:20:02 +0000578
579const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) {
580 TypeInfo* Ty = new TypeInfo();
581 Ty->newTy = newType;
582 Ty->oldTy = oldType;
583 return add_new_type(Ty);
584}
585
586const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
587 const TypeInfo* eTy, const TypeInfo* rTy) {
588 TypeInfo* Ty= new TypeInfo();
589 Ty->newTy = newType;
590 Ty->oldTy = oldType;
591 Ty->elemTy = const_cast<TypeInfo*>(eTy);
592 Ty->resultTy = const_cast<TypeInfo*>(rTy);
593 return add_new_type(Ty);
594}
595
596const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
597 const TypeInfo *eTy, uint64_t elems) {
598 TypeInfo* Ty = new TypeInfo();
599 Ty->newTy = newType;
600 Ty->oldTy = oldType;
601 Ty->elemTy = const_cast<TypeInfo*>(eTy);
602 Ty->nelems = elems;
603 return add_new_type(Ty);
604}
605
606const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType,
607 TypeList* TL) {
608 TypeInfo* Ty = new TypeInfo();
609 Ty->newTy = newType;
610 Ty->oldTy = oldType;
611 Ty->elements = TL;
612 return add_new_type(Ty);
613}
614
615const TypeInfo* TypeInfo::get(const std::string& newType, const TypeInfo* resTy,
616 TypeList* TL) {
617 TypeInfo* Ty = new TypeInfo();
618 Ty->newTy = newType;
619 Ty->oldTy = FunctionTy;
620 Ty->resultTy = const_cast<TypeInfo*>(resTy);
621 Ty->elements = TL;
622 return add_new_type(Ty);
623}
624
625const TypeInfo* TypeInfo::resolve() const {
626 if (isUnresolved()) {
Reid Spencerf8383de2007-01-06 06:04:32 +0000627 if (getNewTy()[0] == '%' && isdigit(newTy[1])) {
628 unsigned ref = atoi(&((newTy.c_str())[1])); // skip the %
Reid Spencereff838e2007-01-03 23:45:42 +0000629 if (ref < EnumeratedTypes.size()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000630 return EnumeratedTypes[ref];
Reid Spencereff838e2007-01-03 23:45:42 +0000631 } else {
632 std::string msg("Can't resolve numbered type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000633 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000634 yyerror(msg.c_str());
635 }
Reid Spencer78720742006-12-02 20:21:22 +0000636 } else {
Reid Spencer30d0c582007-01-15 00:26:18 +0000637 TypeInfo::TypeMap::iterator I = NamedTypes.find(newTy);
Reid Spencereff838e2007-01-03 23:45:42 +0000638 if (I != NamedTypes.end()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000639 return I->second;
Reid Spencereff838e2007-01-03 23:45:42 +0000640 } else {
641 std::string msg("Cannot resolve type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000642 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000643 yyerror(msg.c_str());
644 }
Reid Spencera50d5962006-12-02 04:11:07 +0000645 }
Reid Spencer280d8012006-12-01 23:40:53 +0000646 }
Reid Spencera50d5962006-12-02 04:11:07 +0000647 // otherwise its already resolved.
Reid Spencer319a7302007-01-05 17:20:02 +0000648 return this;
649}
650
651bool TypeInfo::operator<(const TypeInfo& that) const {
652 if (this == &that)
653 return false;
654 if (oldTy != that.oldTy)
655 return oldTy < that.oldTy;
656 switch (oldTy) {
657 case UpRefTy: {
658 unsigned thisUp = this->getUpRefNum();
659 unsigned thatUp = that.getUpRefNum();
660 return thisUp < thatUp;
661 }
662 case PackedTy:
663 case ArrayTy:
664 if (this->nelems != that.nelems)
665 return nelems < that.nelems;
666 case PointerTy: {
667 const TypeInfo* thisTy = this->elemTy;
668 const TypeInfo* thatTy = that.elemTy;
669 return *thisTy < *thatTy;
670 }
671 case FunctionTy: {
672 const TypeInfo* thisTy = this->resultTy;
673 const TypeInfo* thatTy = that.resultTy;
674 if (!thisTy->sameOldTyAs(thatTy))
675 return *thisTy < *thatTy;
676 /* FALL THROUGH */
677 }
678 case StructTy:
679 case PackedStructTy: {
680 if (elements->size() != that.elements->size())
681 return elements->size() < that.elements->size();
682 for (unsigned i = 0; i < elements->size(); i++) {
683 const TypeInfo* thisTy = (*this->elements)[i];
684 const TypeInfo* thatTy = (*that.elements)[i];
685 if (!thisTy->sameOldTyAs(thatTy))
686 return *thisTy < *thatTy;
687 }
688 break;
689 }
690 case UnresolvedTy:
691 return this->newTy < that.newTy;
692 default:
693 break;
694 }
695 return false;
696}
697
698bool TypeInfo::sameOldTyAs(const TypeInfo* that) const {
699 if (that == 0)
700 return false;
701 if ( this == that )
702 return true;
703 if (oldTy != that->oldTy)
704 return false;
705 switch (oldTy) {
706 case PackedTy:
707 case ArrayTy:
708 if (nelems != that->nelems)
709 return false;
710 /* FALL THROUGH */
711 case PointerTy: {
712 const TypeInfo* thisTy = this->elemTy;
713 const TypeInfo* thatTy = that->elemTy;
714 return thisTy->sameOldTyAs(thatTy);
715 }
716 case FunctionTy: {
717 const TypeInfo* thisTy = this->resultTy;
718 const TypeInfo* thatTy = that->resultTy;
719 if (!thisTy->sameOldTyAs(thatTy))
720 return false;
721 /* FALL THROUGH */
722 }
723 case StructTy:
724 case PackedStructTy: {
725 if (elements->size() != that->elements->size())
726 return false;
727 for (unsigned i = 0; i < elements->size(); i++) {
728 const TypeInfo* thisTy = (*this->elements)[i];
729 const TypeInfo* thatTy = (*that->elements)[i];
730 if (!thisTy->sameOldTyAs(thatTy))
731 return false;
732 }
733 return true;
734 }
735 case UnresolvedTy:
736 return this->newTy == that->newTy;
737 default:
738 return true; // for all others oldTy == that->oldTy is sufficient
739 }
740 return true;
741}
742
743bool TypeInfo::isUnresolvedDeep() const {
744 switch (oldTy) {
745 case UnresolvedTy:
746 return true;
747 case PackedTy:
748 case ArrayTy:
749 case PointerTy:
750 return elemTy->isUnresolvedDeep();
751 case PackedStructTy:
752 case StructTy:
753 for (unsigned i = 0; i < elements->size(); i++)
754 if ((*elements)[i]->isUnresolvedDeep())
755 return true;
756 return false;
757 default:
758 return false;
759 }
760}
761
762unsigned TypeInfo::getBitWidth() const {
763 switch (oldTy) {
764 default:
765 case LabelTy:
766 case VoidTy : return 0;
767 case BoolTy : return 1;
768 case SByteTy: case UByteTy : return 8;
769 case ShortTy: case UShortTy : return 16;
770 case IntTy: case UIntTy: case FloatTy: return 32;
771 case LongTy: case ULongTy: case DoubleTy : return 64;
772 case PointerTy: return SizeOfPointer; // global var
773 case PackedTy:
774 case ArrayTy:
775 return nelems * elemTy->getBitWidth();
776 case StructTy:
777 case PackedStructTy: {
778 uint64_t size = 0;
779 for (unsigned i = 0; i < elements->size(); i++) {
780 size += (*elements)[i]->getBitWidth();
781 }
782 return size;
783 }
784 }
785}
786
Reid Spencer30d0c582007-01-15 00:26:18 +0000787const TypeInfo* TypeInfo::getIndexedType(const ValueInfo* VI) const {
Reid Spencer319a7302007-01-05 17:20:02 +0000788 if (isStruct()) {
Reid Spencer30d0c582007-01-15 00:26:18 +0000789 if (VI->isConstant() && VI->type->isInteger()) {
790 size_t pos = VI->val->find(' ') + 1;
791 if (pos < VI->val->size()) {
792 uint64_t idx = atoi(VI->val->substr(pos).c_str());
Reid Spencer319a7302007-01-05 17:20:02 +0000793 return (*elements)[idx];
794 } else {
795 yyerror("Invalid value for constant integer");
796 return 0;
797 }
798 } else {
799 yyerror("Structure requires constant index");
800 return 0;
801 }
802 }
803 if (isArray() || isPacked() || isPointer())
804 return elemTy;
805 yyerror("Invalid type for getIndexedType");
806 return 0;
807}
808
Reid Spencerf8383de2007-01-06 06:04:32 +0000809void TypeInfo::getSignedness(unsigned &sNum, unsigned &uNum,
810 UpRefStack& stack) const {
811 switch (oldTy) {
812 default:
813 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy:
814 case FloatTy : case DoubleTy: case UpRefTy:
815 return;
816 case SByteTy: case ShortTy: case LongTy: case IntTy:
817 sNum++;
818 return;
819 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
820 uNum++;
821 return;
822 case PointerTy:
823 case PackedTy:
824 case ArrayTy:
825 stack.push_back(this);
826 elemTy->getSignedness(sNum, uNum, stack);
827 return;
828 case StructTy:
829 case PackedStructTy: {
830 stack.push_back(this);
831 for (unsigned i = 0; i < elements->size(); i++) {
832 (*elements)[i]->getSignedness(sNum, uNum, stack);
833 }
834 return;
835 }
836 case UnresolvedTy: {
837 const TypeInfo* Ty = this->resolve();
838 // Let's not recurse.
839 UpRefStack::const_iterator I = stack.begin(), E = stack.end();
840 for ( ; I != E && *I != Ty; ++I)
841 ;
842 if (I == E)
843 Ty->getSignedness(sNum, uNum, stack);
844 return;
845 }
846 }
847}
848
849std::string AddSuffix(const std::string& Name, const std::string& Suffix) {
850 if (Name[Name.size()-1] == '"') {
851 std::string Result = Name;
852 Result.insert(Result.size()-1, Suffix);
853 return Result;
854 }
855 return Name + Suffix;
856}
857
858std::string TypeInfo::makeUniqueName(const std::string& BaseName) const {
859 if (BaseName == "\"alloca point\"")
860 return BaseName;
861 switch (oldTy) {
862 default:
863 break;
864 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy:
865 case FloatTy : case DoubleTy: case UnresolvedTy:
866 return BaseName;
867 case SByteTy: case ShortTy: case LongTy: case IntTy:
868 return AddSuffix(BaseName, ".s");
869 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
870 return AddSuffix(BaseName, ".u");
871 }
872
873 unsigned uNum = 0, sNum = 0;
874 std::string Suffix;
875 switch (oldTy) {
876 case PointerTy:
877 case PackedTy:
878 case ArrayTy: {
879 TypeInfo::UpRefStack stack;
880 elemTy->resolve()->getSignedness(sNum, uNum, stack);
881 break;
882 }
883 case StructTy:
884 case PackedStructTy: {
885 for (unsigned i = 0; i < elements->size(); i++) {
886 TypeInfo::UpRefStack stack;
887 (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack);
888 }
889 break;
890 }
891 default:
892 assert(0 && "Invalid Type");
893 break;
894 }
895
896 if (sNum == 0 && uNum == 0)
897 return BaseName;
898
899 switch (oldTy) {
900 default: Suffix += ".nada"; break;
901 case PointerTy: Suffix += ".pntr"; break;
902 case PackedTy: Suffix += ".pckd"; break;
903 case ArrayTy: Suffix += ".arry"; break;
904 case StructTy: Suffix += ".strc"; break;
905 case PackedStructTy: Suffix += ".pstr"; break;
906 }
907
908 Suffix += ".s" + llvm::utostr(sNum);
909 Suffix += ".u" + llvm::utostr(uNum);
910 return AddSuffix(BaseName, Suffix);
911}
912
Reid Spencer319a7302007-01-05 17:20:02 +0000913TypeInfo& TypeInfo::operator=(const TypeInfo& that) {
914 oldTy = that.oldTy;
915 nelems = that.nelems;
916 newTy = that.newTy;
917 elemTy = that.elemTy;
918 resultTy = that.resultTy;
919 if (that.elements) {
920 elements = new TypeList(that.elements->size());
921 *elements = *that.elements;
922 } else {
923 elements = 0;
924 }
925 return *this;
926}
927
928const TypeInfo* TypeInfo::add_new_type(TypeInfo* newTy) {
929 TypeRegMap::iterator I = registry.find(newTy);
930 if (I != registry.end()) {
931 delete newTy;
932 return *I;
933 }
934 registry.insert(newTy);
935 return newTy;
Reid Spencer280d8012006-12-01 23:40:53 +0000936}
937
Reid Spencer30d0c582007-01-15 00:26:18 +0000938/// This type is used to keep track of the signedness of constants.
939struct ConstInfo {
940 std::string *cnst;
941 const TypeInfo *type;
942 ~ConstInfo() { delete cnst; }
943};
944
945/// This variable provides a counter for unique names. It is used in various
946/// productions to ensure a unique name is generated.
947static uint64_t UniqueNameCounter = 1;
948
949// This is set when a DECLARE keyword is recognized so that subsequent parsing
950// of a function prototype can know if its a declaration or definition.
951static bool isDeclare = false;
952
953// This bool is used to communicate between the InstVal and Inst rules about
954// whether or not a cast should be deleted. When the flag is set, InstVal has
955// determined that the cast is a candidate. However, it can only be deleted if
956// the value being casted is the same value name as the instruction. The Inst
957// rule makes that comparison if the flag is set and comments out the
958// instruction if they match.
959static bool deleteUselessCastFlag = false;
960static std::string* deleteUselessCastName = 0;
961
962
963
964const char* getCastOpcode(std::string& Source, const TypeInfo* SrcTy,
965 const TypeInfo* DstTy) {
Reid Spencer52402b02007-01-02 05:45:11 +0000966 unsigned SrcBits = SrcTy->getBitWidth();
967 unsigned DstBits = DstTy->getBitWidth();
Reid Spencere77e35e2006-12-01 20:26:20 +0000968 const char* opcode = "bitcast";
969 // Run through the possibilities ...
Reid Spencer52402b02007-01-02 05:45:11 +0000970 if (DstTy->isIntegral()) { // Casting to integral
971 if (SrcTy->isIntegral()) { // Casting from integral
Reid Spencere77e35e2006-12-01 20:26:20 +0000972 if (DstBits < SrcBits)
973 opcode = "trunc";
974 else if (DstBits > SrcBits) { // its an extension
Reid Spencer52402b02007-01-02 05:45:11 +0000975 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000976 opcode ="sext"; // signed -> SEXT
977 else
978 opcode = "zext"; // unsigned -> ZEXT
979 } else {
980 opcode = "bitcast"; // Same size, No-op cast
981 }
Reid Spencer52402b02007-01-02 05:45:11 +0000982 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
983 if (DstTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000984 opcode = "fptosi"; // FP -> sint
985 else
986 opcode = "fptoui"; // FP -> uint
Reid Spencer52402b02007-01-02 05:45:11 +0000987 } else if (SrcTy->isPacked()) {
988 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000989 "Casting packed to integer of different width");
990 opcode = "bitcast"; // same size, no-op cast
991 } else {
Reid Spencer52402b02007-01-02 05:45:11 +0000992 assert(SrcTy->isPointer() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000993 "Casting from a value that is not first-class type");
994 opcode = "ptrtoint"; // ptr -> int
995 }
Reid Spencer52402b02007-01-02 05:45:11 +0000996 } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
997 if (SrcTy->isIntegral()) { // Casting from integral
998 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000999 opcode = "sitofp"; // sint -> FP
1000 else
1001 opcode = "uitofp"; // uint -> FP
Reid Spencer52402b02007-01-02 05:45:11 +00001002 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
Reid Spencere77e35e2006-12-01 20:26:20 +00001003 if (DstBits < SrcBits) {
1004 opcode = "fptrunc"; // FP -> smaller FP
1005 } else if (DstBits > SrcBits) {
1006 opcode = "fpext"; // FP -> larger FP
1007 } else {
1008 opcode ="bitcast"; // same size, no-op cast
1009 }
Reid Spencer52402b02007-01-02 05:45:11 +00001010 } else if (SrcTy->isPacked()) {
1011 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +00001012 "Casting packed to floating point of different width");
1013 opcode = "bitcast"; // same size, no-op cast
1014 } else {
1015 assert(0 && "Casting pointer or non-first class to float");
1016 }
Reid Spencer52402b02007-01-02 05:45:11 +00001017 } else if (DstTy->isPacked()) {
1018 if (SrcTy->isPacked()) {
1019 assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +00001020 "Casting packed to packed of different widths");
1021 opcode = "bitcast"; // packed -> packed
Reid Spencer52402b02007-01-02 05:45:11 +00001022 } else if (DstTy->getBitWidth() == SrcBits) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001023 opcode = "bitcast"; // float/int -> packed
1024 } else {
1025 assert(!"Illegal cast to packed (wrong type or size)");
1026 }
Reid Spencer52402b02007-01-02 05:45:11 +00001027 } else if (DstTy->isPointer()) {
1028 if (SrcTy->isPointer()) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001029 opcode = "bitcast"; // ptr -> ptr
Reid Spencer52402b02007-01-02 05:45:11 +00001030 } else if (SrcTy->isIntegral()) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001031 opcode = "inttoptr"; // int -> ptr
1032 } else {
Reid Spencera50d5962006-12-02 04:11:07 +00001033 assert(!"Casting invalid type to pointer");
Reid Spencere77e35e2006-12-01 20:26:20 +00001034 }
1035 } else {
1036 assert(!"Casting to type that is not first-class");
1037 }
1038 return opcode;
1039}
1040
Reid Spencer30d0c582007-01-15 00:26:18 +00001041std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy,
1042 const TypeInfo* DstTy, bool isConst) {
Reid Spencera50d5962006-12-02 04:11:07 +00001043 std::string Result;
1044 std::string Source = Src;
Reid Spencer52402b02007-01-02 05:45:11 +00001045 if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
Reid Spencera50d5962006-12-02 04:11:07 +00001046 // fp -> ptr cast is no longer supported but we must upgrade this
1047 // by doing a double cast: fp -> int -> ptr
1048 if (isConst)
Reid Spencer71d2ec92006-12-31 06:02:26 +00001049 Source = "i64 fptoui(" + Source + " to i64)";
Reid Spencera50d5962006-12-02 04:11:07 +00001050 else {
Reid Spencer30d0c582007-01-15 00:26:18 +00001051 *O << " %cast_upgrade" << UniqueNameCounter++ << " = fptoui "
1052 << Source << " to i64\n";
1053 Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter);
Reid Spencera50d5962006-12-02 04:11:07 +00001054 }
1055 // Update the SrcTy for the getCastOpcode call below
Reid Spencer319a7302007-01-05 17:20:02 +00001056 SrcTy = TypeInfo::get("i64", ULongTy);
Reid Spencer52402b02007-01-02 05:45:11 +00001057 } else if (DstTy->isBool()) {
1058 // cast type %x to bool was previously defined as setne type %x, null
1059 // The cast semantic is now to truncate, not compare so we must retain
1060 // the original intent by replacing the cast with a setne
1061 const char* comparator = SrcTy->isPointer() ? ", null" :
1062 (SrcTy->isFloatingPoint() ? ", 0.0" :
1063 (SrcTy->isBool() ? ", false" : ", 0"));
1064 const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
Reid Spencer187ccf82006-12-09 16:57:22 +00001065 if (isConst) {
1066 Result = "(" + Source + comparator + ")";
1067 Result = compareOp + Result;
1068 } else
1069 Result = compareOp + Source + comparator;
Reid Spencera50d5962006-12-02 04:11:07 +00001070 return Result; // skip cast processing below
1071 }
Reid Spencer319a7302007-01-05 17:20:02 +00001072 SrcTy = SrcTy->resolve();
1073 DstTy = DstTy->resolve();
Reid Spencera50d5962006-12-02 04:11:07 +00001074 std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
1075 if (isConst)
Reid Spencer52402b02007-01-02 05:45:11 +00001076 Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
Reid Spencera50d5962006-12-02 04:11:07 +00001077 else
Reid Spencer52402b02007-01-02 05:45:11 +00001078 Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
Reid Spencera50d5962006-12-02 04:11:07 +00001079 return Result;
1080}
1081
Reid Spencer319a7302007-01-05 17:20:02 +00001082const char* getDivRemOpcode(const std::string& opcode, const TypeInfo* TI) {
Reid Spencer78720742006-12-02 20:21:22 +00001083 const char* op = opcode.c_str();
Reid Spencer319a7302007-01-05 17:20:02 +00001084 const TypeInfo* Ty = TI->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001085 if (Ty->isPacked())
1086 Ty = Ty->getElementType();
Reid Spencer78720742006-12-02 20:21:22 +00001087 if (opcode == "div")
Reid Spencer52402b02007-01-02 05:45:11 +00001088 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +00001089 op = "fdiv";
Reid Spencer52402b02007-01-02 05:45:11 +00001090 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +00001091 op = "udiv";
Reid Spencer52402b02007-01-02 05:45:11 +00001092 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +00001093 op = "sdiv";
1094 else
1095 yyerror("Invalid type for div instruction");
1096 else if (opcode == "rem")
Reid Spencer52402b02007-01-02 05:45:11 +00001097 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +00001098 op = "frem";
Reid Spencer52402b02007-01-02 05:45:11 +00001099 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +00001100 op = "urem";
Reid Spencer52402b02007-01-02 05:45:11 +00001101 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +00001102 op = "srem";
1103 else
1104 yyerror("Invalid type for rem instruction");
1105 return op;
1106}
Reid Spencere7c3c602006-11-30 06:36:44 +00001107
Reid Spencer30d0c582007-01-15 00:26:18 +00001108std::string getCompareOp(const std::string& setcc, const TypeInfo* TI) {
Reid Spencer229e9362006-12-02 22:14:11 +00001109 assert(setcc.length() == 5);
1110 char cc1 = setcc[3];
1111 char cc2 = setcc[4];
1112 assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
1113 assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
1114 std::string result("xcmp xxx");
1115 result[6] = cc1;
1116 result[7] = cc2;
Reid Spencer52402b02007-01-02 05:45:11 +00001117 if (TI->isFloatingPoint()) {
Reid Spencer229e9362006-12-02 22:14:11 +00001118 result[0] = 'f';
Reid Spencere4d87aa2006-12-23 06:05:41 +00001119 result[5] = 'o';
Reid Spencerf0cf1322006-12-07 04:23:03 +00001120 if (cc1 == 'n')
1121 result[5] = 'u'; // NE maps to unordered
1122 else
1123 result[5] = 'o'; // everything else maps to ordered
Reid Spencer52402b02007-01-02 05:45:11 +00001124 } else if (TI->isIntegral() || TI->isPointer()) {
Reid Spencer229e9362006-12-02 22:14:11 +00001125 result[0] = 'i';
1126 if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
1127 result.erase(5,1);
Reid Spencer52402b02007-01-02 05:45:11 +00001128 else if (TI->isSigned())
Reid Spencer229e9362006-12-02 22:14:11 +00001129 result[5] = 's';
Reid Spencer52402b02007-01-02 05:45:11 +00001130 else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
Reid Spencer229e9362006-12-02 22:14:11 +00001131 result[5] = 'u';
1132 else
1133 yyerror("Invalid integral type for setcc");
1134 }
1135 return result;
1136}
1137
Reid Spencer30d0c582007-01-15 00:26:18 +00001138const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) {
Reid Spencer319a7302007-01-05 17:20:02 +00001139 PFTy = PFTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001140 if (PFTy->isPointer()) {
Reid Spencer319a7302007-01-05 17:20:02 +00001141 const TypeInfo* ElemTy = PFTy->getElementType();
1142 ElemTy = ElemTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001143 if (ElemTy->isFunction())
Reid Spencer319a7302007-01-05 17:20:02 +00001144 return ElemTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +00001145 } else if (PFTy->isFunction()) {
Reid Spencer319a7302007-01-05 17:20:02 +00001146 return PFTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +00001147 }
Reid Spencer319a7302007-01-05 17:20:02 +00001148 return PFTy;
Reid Spencer52402b02007-01-02 05:45:11 +00001149}
1150
Reid Spencer30d0c582007-01-15 00:26:18 +00001151const TypeInfo* ResolveUpReference(const TypeInfo* Ty,
1152 TypeInfo::UpRefStack* stack) {
Reid Spencereff838e2007-01-03 23:45:42 +00001153 assert(Ty->isUpReference() && "Can't resolve a non-upreference");
Reid Spencer319a7302007-01-05 17:20:02 +00001154 unsigned upref = Ty->getUpRefNum();
Reid Spencereff838e2007-01-03 23:45:42 +00001155 assert(upref < stack->size() && "Invalid up reference");
1156 return (*stack)[upref - stack->size() - 1];
1157}
1158
Reid Spencer30d0c582007-01-15 00:26:18 +00001159const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) {
Reid Spencer319a7302007-01-05 17:20:02 +00001160 const TypeInfo* Result = PTy = PTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001161 assert(PTy->isPointer() && "GEP Operand is not a pointer?");
Reid Spencerf8383de2007-01-06 06:04:32 +00001162 TypeInfo::UpRefStack stack;
Reid Spencereff838e2007-01-03 23:45:42 +00001163 for (unsigned i = 0; i < idxs->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00001164 if (Result->isComposite()) {
1165 Result = Result->getIndexedType((*idxs)[i]);
Reid Spencer319a7302007-01-05 17:20:02 +00001166 Result = Result->resolve();
Reid Spencereff838e2007-01-03 23:45:42 +00001167 stack.push_back(Result);
Reid Spencer52402b02007-01-02 05:45:11 +00001168 } else
1169 yyerror("Invalid type for index");
1170 }
Reid Spencereff838e2007-01-03 23:45:42 +00001171 // Resolve upreferences so we can return a more natural type
1172 if (Result->isPointer()) {
1173 if (Result->getElementType()->isUpReference()) {
1174 stack.push_back(Result);
1175 Result = ResolveUpReference(Result->getElementType(), &stack);
1176 }
1177 } else if (Result->isUpReference()) {
1178 Result = ResolveUpReference(Result->getElementType(), &stack);
1179 }
Reid Spencer52402b02007-01-02 05:45:11 +00001180 return Result->getPointerType();
1181}
1182
Reid Spencer52402b02007-01-02 05:45:11 +00001183// This function handles appending .u or .s to integer value names that
1184// were previously unsigned or signed, respectively. This avoids name
1185// collisions since the unsigned and signed type planes have collapsed
1186// into a single signless type plane.
Reid Spencer30d0c582007-01-15 00:26:18 +00001187std::string getUniqueName(const std::string *Name, const TypeInfo* Ty,
1188 bool isGlobal = false, bool isDef = false) {
Reid Spencer319a7302007-01-05 17:20:02 +00001189
Reid Spencer52402b02007-01-02 05:45:11 +00001190 // If its not a symbolic name, don't modify it, probably a constant val.
1191 if ((*Name)[0] != '%' && (*Name)[0] != '"')
1192 return *Name;
Reid Spencer319a7302007-01-05 17:20:02 +00001193
Reid Spencer52402b02007-01-02 05:45:11 +00001194 // If its a numeric reference, just leave it alone.
1195 if (isdigit((*Name)[1]))
1196 return *Name;
1197
1198 // Resolve the type
Reid Spencer319a7302007-01-05 17:20:02 +00001199 Ty = Ty->resolve();
1200
1201 // If its a global name, get its uniquified name, if any
Reid Spencer30d0c582007-01-15 00:26:18 +00001202 TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
1203 if (GI != TypeInfo::Globals.end()) {
1204 TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
1205 TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
Reid Spencer319a7302007-01-05 17:20:02 +00001206 for ( ; TPI != TPE ; ++TPI) {
1207 if (TPI->first->sameNewTyAs(Ty))
1208 return TPI->second;
1209 }
1210 }
1211
1212 if (isGlobal) {
1213 // We didn't find a global name, but if its supposed to be global then all
1214 // we can do is return the name. This is probably a forward reference of a
1215 // global value that hasn't been defined yet. Since we have no definition
1216 // we don't know its linkage class. Just assume its an external and the name
1217 // shouldn't change.
1218 return *Name;
1219 }
Reid Spencer52402b02007-01-02 05:45:11 +00001220
1221 // Default the result to the current name
Reid Spencerf8383de2007-01-06 06:04:32 +00001222 std::string Result = Ty->makeUniqueName(*Name);
Reid Spencer52402b02007-01-02 05:45:11 +00001223
Reid Spencer52402b02007-01-02 05:45:11 +00001224 return Result;
1225}
1226
Reid Spencer319a7302007-01-05 17:20:02 +00001227std::string getGlobalName(const std::string* Name, const std::string Linkage,
1228 const TypeInfo* Ty, bool isConstant) {
1229 // Default to given name
1230 std::string Result = *Name;
1231 // Look up the name in the Globals Map
Reid Spencer30d0c582007-01-15 00:26:18 +00001232 TypeInfo::GlobalsTypeMap::iterator GI = TypeInfo::Globals.find(*Name);
Reid Spencer319a7302007-01-05 17:20:02 +00001233 // Did we see this global name before?
Reid Spencer30d0c582007-01-15 00:26:18 +00001234 if (GI != TypeInfo::Globals.end()) {
Reid Spencer319a7302007-01-05 17:20:02 +00001235 if (Ty->isUnresolvedDeep()) {
1236 // The Gval's type is unresolved. Consequently, we can't disambiguate it
1237 // by type. We'll just change its name and emit a warning.
1238 warning("Cannot disambiguate global value '" + *Name +
1239 "' because type '" + Ty->getNewTy() + "'is unresolved.\n");
1240 Result = *Name + ".unique";
1241 UniqueNameCounter++;
1242 Result += llvm::utostr(UniqueNameCounter);
1243 return Result;
1244 } else {
Reid Spencer30d0c582007-01-15 00:26:18 +00001245 TypeInfo::TypePlaneMap::iterator TPI = GI->second.find(Ty);
Reid Spencer319a7302007-01-05 17:20:02 +00001246 if (TPI != GI->second.end()) {
1247 // We found an existing name of the same old type. This isn't allowed
1248 // in LLVM 2.0. Consequently, we must alter the name of the global so it
1249 // can at least compile. References to the global will yield the first
1250 // definition, which is okay. We also must warn about this.
1251 Result = *Name + ".unique";
1252 UniqueNameCounter++;
1253 Result += llvm::utostr(UniqueNameCounter);
1254 warning(std::string("Global variable '") + *Name + "' was renamed to '"+
1255 Result + "'");
1256 } else {
1257 // There isn't an existing definition for this name according to the
1258 // old types. Now search the TypePlanMap for types with the same new
1259 // name.
Reid Spencer30d0c582007-01-15 00:26:18 +00001260 TypeInfo::TypePlaneMap::iterator TPI = GI->second.begin();
1261 TypeInfo::TypePlaneMap::iterator TPE = GI->second.end();
Reid Spencer319a7302007-01-05 17:20:02 +00001262 for ( ; TPI != TPE; ++TPI) {
1263 if (TPI->first->sameNewTyAs(Ty)) {
1264 // The new types are the same but the old types are different so
1265 // this is a global name collision resulting from type planes
1266 // collapsing.
1267 if (Linkage == "external" || Linkage == "dllimport" ||
1268 Linkage == "extern_weak" || Linkage == "") {
1269 // The linkage of this gval is external so we can't reliably
1270 // rename it because it could potentially create a linking
1271 // problem. However, we can't leave the name conflict in the
1272 // output either or it won't assemble with LLVM 2.0. So, all we
1273 // can do is rename this one to something unique and emit a
1274 // warning about the problem.
1275 Result = *Name + ".unique";
1276 UniqueNameCounter++;
1277 Result += llvm::utostr(UniqueNameCounter);
1278 warning("Renaming global value '" + *Name + "' to '" + Result +
1279 "' may cause linkage errors.");
1280 return Result;
1281 } else {
1282 // Its linkage is internal and its type is known so we can
1283 // disambiguate the name collision successfully based on the type.
1284 Result = getUniqueName(Name, Ty);
1285 TPI->second = Result;
1286 return Result;
1287 }
1288 }
1289 }
1290 // We didn't find an entry in the type plane with the same new type and
1291 // the old types differ so this is a new type plane for this global
1292 // variable. We just fall through to the logic below which inserts
1293 // the global.
1294 }
1295 }
1296 }
1297
1298 // Its a new global name, if it is external we can't change it
1299 if (isConstant || Linkage == "external" || Linkage == "dllimport" ||
1300 Linkage == "extern_weak" || Linkage == "") {
Reid Spencer30d0c582007-01-15 00:26:18 +00001301 TypeInfo::Globals[Result][Ty] = Result;
Reid Spencer319a7302007-01-05 17:20:02 +00001302 return Result;
1303 }
1304
1305 // Its a new global name, and it is internal, change the name to make it
1306 // unique for its type.
1307 // Result = getUniqueName(Name, Ty);
Reid Spencer30d0c582007-01-15 00:26:18 +00001308 TypeInfo::Globals[*Name][Ty] = Result;
Reid Spencer319a7302007-01-05 17:20:02 +00001309 return Result;
1310}
1311
Reid Spencer30d0c582007-01-15 00:26:18 +00001312} // End anonymous namespace
1313
1314// This function is used by the Lexer to create a TypeInfo. It can't be
1315// in the anonymous namespace.
1316const TypeInfo* getTypeInfo(const std::string& newTy, Types oldTy) {
1317 return TypeInfo::get(newTy, oldTy);
1318}
1319
1320
Reid Spencer319a7302007-01-05 17:20:02 +00001321
1322/* Enabling traces. */
1323#ifndef YYDEBUG
1324# define YYDEBUG 0
1325#endif
1326
1327/* Enabling verbose error messages. */
1328#ifdef YYERROR_VERBOSE
1329# undef YYERROR_VERBOSE
1330# define YYERROR_VERBOSE 1
1331#else
1332# define YYERROR_VERBOSE 0
1333#endif
1334
1335/* Enabling the token table. */
1336#ifndef YYTOKEN_TABLE
1337# define YYTOKEN_TABLE 0
1338#endif
1339
1340#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
Reid Spencer30d0c582007-01-15 00:26:18 +00001341#line 968 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00001342typedef union YYSTYPE {
Reid Spencere77e35e2006-12-01 20:26:20 +00001343 std::string* String;
Reid Spencer319a7302007-01-05 17:20:02 +00001344 const TypeInfo* Type;
Reid Spencer30d0c582007-01-15 00:26:18 +00001345 ValueInfo* Value;
1346 ConstInfo* Const;
Reid Spencerf8483652006-12-02 15:16:01 +00001347 ValueList* ValList;
Reid Spencer52402b02007-01-02 05:45:11 +00001348 TypeList* TypeVec;
Reid Spencere77e35e2006-12-01 20:26:20 +00001349} YYSTYPE;
Reid Spencer319a7302007-01-05 17:20:02 +00001350/* Line 196 of yacc.c. */
Reid Spencer30d0c582007-01-15 00:26:18 +00001351#line 1352 "UpgradeParser.tab.c"
Reid Spencer319a7302007-01-05 17:20:02 +00001352# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1353# define YYSTYPE_IS_DECLARED 1
1354# define YYSTYPE_IS_TRIVIAL 1
Reid Spencere7c3c602006-11-30 06:36:44 +00001355#endif
1356
1357
1358
Reid Spencer319a7302007-01-05 17:20:02 +00001359/* Copy the second part of user declarations. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001360
1361
Reid Spencer319a7302007-01-05 17:20:02 +00001362/* Line 219 of yacc.c. */
Reid Spencer30d0c582007-01-15 00:26:18 +00001363#line 1364 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00001364
Reid Spencer319a7302007-01-05 17:20:02 +00001365#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1366# define YYSIZE_T __SIZE_TYPE__
1367#endif
1368#if ! defined (YYSIZE_T) && defined (size_t)
1369# define YYSIZE_T size_t
1370#endif
1371#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1372# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1373# define YYSIZE_T size_t
1374#endif
1375#if ! defined (YYSIZE_T)
1376# define YYSIZE_T unsigned int
1377#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001378
Reid Spencer319a7302007-01-05 17:20:02 +00001379#ifndef YY_
1380# if YYENABLE_NLS
1381# if ENABLE_NLS
1382# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1383# define YY_(msgid) dgettext ("bison-runtime", msgid)
1384# endif
1385# endif
1386# ifndef YY_
1387# define YY_(msgid) msgid
1388# endif
1389#endif
1390
1391#if ! defined (yyoverflow) || YYERROR_VERBOSE
1392
1393/* The parser invokes alloca or malloc; define the necessary symbols. */
1394
1395# ifdef YYSTACK_USE_ALLOCA
1396# if YYSTACK_USE_ALLOCA
1397# ifdef __GNUC__
1398# define YYSTACK_ALLOC __builtin_alloca
1399# else
1400# define YYSTACK_ALLOC alloca
1401# if defined (__STDC__) || defined (__cplusplus)
1402# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1403# define YYINCLUDED_STDLIB_H
1404# endif
1405# endif
1406# endif
1407# endif
1408
1409# ifdef YYSTACK_ALLOC
1410 /* Pacify GCC's `empty if-body' warning. */
1411# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1412# ifndef YYSTACK_ALLOC_MAXIMUM
1413 /* The OS might guarantee only one guard page at the bottom of the stack,
1414 and a page size can be as small as 4096 bytes. So we cannot safely
1415 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1416 to allow for a few compiler-allocated temporary stack slots. */
1417# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1418# endif
1419# else
1420# define YYSTACK_ALLOC YYMALLOC
1421# define YYSTACK_FREE YYFREE
1422# ifndef YYSTACK_ALLOC_MAXIMUM
1423# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1424# endif
1425# ifdef __cplusplus
1426extern "C" {
1427# endif
1428# ifndef YYMALLOC
1429# define YYMALLOC malloc
1430# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1431 && (defined (__STDC__) || defined (__cplusplus)))
1432void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1433# endif
1434# endif
1435# ifndef YYFREE
1436# define YYFREE free
1437# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1438 && (defined (__STDC__) || defined (__cplusplus)))
1439void free (void *); /* INFRINGES ON USER NAME SPACE */
1440# endif
1441# endif
1442# ifdef __cplusplus
1443}
1444# endif
1445# endif
1446#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1447
1448
1449#if (! defined (yyoverflow) \
1450 && (! defined (__cplusplus) \
1451 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1452
1453/* A type that is properly aligned for any stack member. */
1454union yyalloc
1455{
1456 short int yyss;
1457 YYSTYPE yyvs;
1458 };
1459
1460/* The size of the maximum gap between one aligned stack and the next. */
1461# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1462
1463/* The size of an array large to enough to hold all stacks, each with
1464 N elements. */
1465# define YYSTACK_BYTES(N) \
1466 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1467 + YYSTACK_GAP_MAXIMUM)
1468
1469/* Copy COUNT objects from FROM to TO. The source and destination do
1470 not overlap. */
1471# ifndef YYCOPY
1472# if defined (__GNUC__) && 1 < __GNUC__
1473# define YYCOPY(To, From, Count) \
1474 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1475# else
1476# define YYCOPY(To, From, Count) \
1477 do \
1478 { \
1479 YYSIZE_T yyi; \
1480 for (yyi = 0; yyi < (Count); yyi++) \
1481 (To)[yyi] = (From)[yyi]; \
1482 } \
1483 while (0)
1484# endif
1485# endif
1486
1487/* Relocate STACK from its old location to the new one. The
1488 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1489 elements in the stack, and YYPTR gives the new location of the
1490 stack. Advance YYPTR to a properly aligned location for the next
1491 stack. */
1492# define YYSTACK_RELOCATE(Stack) \
1493 do \
1494 { \
1495 YYSIZE_T yynewbytes; \
1496 YYCOPY (&yyptr->Stack, Stack, yysize); \
1497 Stack = &yyptr->Stack; \
1498 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1499 yyptr += yynewbytes / sizeof (*yyptr); \
1500 } \
1501 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00001502
1503#endif
1504
Reid Spencer319a7302007-01-05 17:20:02 +00001505#if defined (__STDC__) || defined (__cplusplus)
1506 typedef signed char yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001507#else
Reid Spencer319a7302007-01-05 17:20:02 +00001508 typedef short int yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001509#endif
1510
Reid Spencer319a7302007-01-05 17:20:02 +00001511/* YYFINAL -- State number of the termination state. */
1512#define YYFINAL 4
1513/* YYLAST -- Last index in YYTABLE. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001514#define YYLAST 1473
Reid Spencer319a7302007-01-05 17:20:02 +00001515
1516/* YYNTOKENS -- Number of terminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001517#define YYNTOKENS 164
Reid Spencer319a7302007-01-05 17:20:02 +00001518/* YYNNTS -- Number of nonterminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001519#define YYNNTS 76
Reid Spencer319a7302007-01-05 17:20:02 +00001520/* YYNRULES -- Number of rules. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001521#define YYNRULES 301
Reid Spencer319a7302007-01-05 17:20:02 +00001522/* YYNRULES -- Number of states. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001523#define YYNSTATES 585
Reid Spencer319a7302007-01-05 17:20:02 +00001524
1525/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1526#define YYUNDEFTOK 2
Reid Spencerc4d96252007-01-13 00:03:30 +00001527#define YYMAXUTOK 404
Reid Spencer319a7302007-01-05 17:20:02 +00001528
1529#define YYTRANSLATE(YYX) \
1530 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1531
1532/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1533static const unsigned char yytranslate[] =
1534{
1535 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001539 153, 154, 162, 2, 151, 2, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001541 158, 150, 159, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001544 2, 155, 152, 157, 2, 2, 2, 2, 2, 163,
Reid Spencer319a7302007-01-05 17:20:02 +00001545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001547 156, 2, 2, 160, 2, 161, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1560 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1561 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1562 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1563 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1564 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1565 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1566 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1567 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1568 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1569 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1570 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1571 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1572 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1573 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1574 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Reid Spencerc4d96252007-01-13 00:03:30 +00001575 145, 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00001576};
1577
1578#if YYDEBUG
1579/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1580 YYRHS. */
1581static const unsigned short int yyprhs[] =
1582{
1583 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1584 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1585 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1586 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1587 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1588 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1589 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1590 139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1591 159, 161, 164, 165, 167, 169, 171, 173, 175, 177,
1592 179, 180, 182, 184, 186, 188, 190, 192, 195, 196,
1593 197, 200, 201, 205, 208, 209, 211, 212, 216, 218,
1594 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1595 241, 243, 245, 247, 249, 251, 253, 255, 257, 259,
1596 261, 264, 269, 275, 281, 285, 288, 294, 299, 302,
1597 304, 308, 310, 314, 316, 317, 322, 326, 330, 335,
1598 340, 344, 347, 350, 353, 356, 359, 362, 365, 368,
1599 371, 374, 381, 387, 396, 403, 410, 417, 425, 433,
1600 440, 447, 456, 465, 469, 471, 473, 475, 477, 480,
1601 483, 488, 491, 493, 495, 497, 502, 505, 510, 517,
1602 524, 531, 538, 542, 547, 548, 550, 552, 554, 558,
1603 562, 566, 570, 574, 578, 580, 581, 583, 585, 587,
1604 588, 591, 595, 597, 599, 603, 605, 606, 615, 617,
Reid Spencerc4d96252007-01-13 00:03:30 +00001605 619, 623, 625, 627, 631, 632, 634, 636, 637, 642,
1606 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
1607 665, 667, 673, 675, 677, 679, 681, 684, 687, 689,
1608 692, 695, 696, 698, 700, 702, 705, 708, 712, 722,
1609 732, 741, 756, 758, 760, 767, 773, 776, 783, 791,
1610 793, 797, 799, 800, 803, 805, 811, 817, 823, 830,
1611 837, 842, 847, 854, 859, 864, 871, 878, 881, 889,
1612 891, 894, 895, 897, 898, 902, 909, 913, 920, 923,
1613 928, 935
Reid Spencer319a7302007-01-05 17:20:02 +00001614};
1615
1616/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1617static const short int yyrhs[] =
1618{
Reid Spencerc4d96252007-01-13 00:03:30 +00001619 198, 0, -1, 19, -1, 20, -1, 17, -1, 18,
1620 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1621 -1, 84, -1, 85, -1, 86, -1, 87, -1, 88,
1622 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1623 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1624 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1625 -1, 106, -1, 117, -1, 118, -1, 119, -1, 120,
1626 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1627 -1, 112, -1, 113, -1, 114, -1, 115, -1, 116,
1628 -1, 117, -1, 118, -1, 119, -1, 120, -1, 25,
1629 -1, 26, -1, 129, -1, 130, -1, 131, -1, 132,
1630 -1, 138, -1, 139, -1, 140, -1, 141, -1, 142,
1631 -1, 143, -1, 144, -1, 145, -1, 146, -1, 147,
1632 -1, 148, -1, 149, -1, 137, -1, 11, -1, 9,
Reid Spencer319a7302007-01-05 17:20:02 +00001633 -1, 7, -1, 5, -1, 12, -1, 10, -1, 8,
Reid Spencerc4d96252007-01-13 00:03:30 +00001634 -1, 6, -1, 174, -1, 175, -1, 13, -1, 14,
1635 -1, 207, 150, -1, -1, 42, -1, 43, -1, 44,
Reid Spencer319a7302007-01-05 17:20:02 +00001636 -1, 48, -1, 45, -1, 46, -1, 47, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001637 65, -1, 66, -1, 67, -1, 68, -1, 69, -1,
1638 70, -1, 64, 18, -1, -1, -1, 56, 18, -1,
1639 -1, 151, 56, 18, -1, 37, 30, -1, -1, 183,
1640 -1, -1, 151, 186, 185, -1, 183, -1, 56, 18,
1641 -1, 189, -1, 3, -1, 191, -1, 3, -1, 191,
Reid Spencer319a7302007-01-05 17:20:02 +00001642 -1, 4, -1, 5, -1, 6, -1, 7, -1, 8,
1643 -1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
Reid Spencerc4d96252007-01-13 00:03:30 +00001644 -1, 14, -1, 15, -1, 16, -1, 222, -1, 190,
1645 -1, 152, 18, -1, 188, 153, 193, 154, -1, 155,
1646 18, 156, 191, 157, -1, 158, 18, 156, 191, 159,
1647 -1, 160, 192, 161, -1, 160, 161, -1, 158, 160,
1648 192, 161, 159, -1, 158, 160, 161, 159, -1, 191,
1649 162, -1, 191, -1, 192, 151, 191, -1, 192, -1,
1650 192, 151, 40, -1, 40, -1, -1, 189, 155, 196,
1651 157, -1, 189, 155, 157, -1, 189, 163, 30, -1,
1652 189, 158, 196, 159, -1, 189, 160, 196, 161, -1,
1653 189, 160, 161, -1, 189, 22, -1, 189, 23, -1,
1654 189, 222, -1, 189, 195, -1, 189, 24, -1, 174,
1655 166, -1, 175, 166, -1, 4, 25, -1, 4, 26,
1656 -1, 177, 21, -1, 173, 153, 194, 39, 189, 154,
1657 -1, 126, 153, 194, 237, 154, -1, 128, 153, 194,
1658 151, 194, 151, 194, 154, -1, 167, 153, 194, 151,
1659 194, 154, -1, 168, 153, 194, 151, 194, 154, -1,
1660 169, 153, 194, 151, 194, 154, -1, 99, 170, 153,
1661 194, 151, 194, 154, -1, 100, 171, 153, 194, 151,
1662 194, 154, -1, 172, 153, 194, 151, 194, 154, -1,
1663 134, 153, 194, 151, 194, 154, -1, 135, 153, 194,
1664 151, 194, 151, 194, 154, -1, 136, 153, 194, 151,
1665 194, 151, 194, 154, -1, 196, 151, 194, -1, 194,
1666 -1, 35, -1, 36, -1, 199, -1, 199, 216, -1,
1667 199, 218, -1, 199, 62, 61, 202, -1, 199, 31,
1668 -1, 201, -1, 49, -1, 57, -1, 201, 178, 27,
1669 187, -1, 201, 218, -1, 201, 62, 61, 202, -1,
1670 201, 178, 179, 197, 194, 185, -1, 201, 178, 200,
1671 197, 189, 185, -1, 201, 178, 45, 197, 189, 185,
1672 -1, 201, 178, 47, 197, 189, 185, -1, 201, 50,
1673 204, -1, 201, 58, 150, 205, -1, -1, 30, -1,
1674 55, -1, 54, -1, 52, 150, 203, -1, 53, 150,
1675 18, -1, 51, 150, 30, -1, 71, 150, 30, -1,
1676 155, 206, 157, -1, 206, 151, 30, -1, 30, -1,
1677 -1, 28, -1, 30, -1, 207, -1, -1, 189, 208,
1678 -1, 210, 151, 209, -1, 209, -1, 210, -1, 210,
1679 151, 40, -1, 40, -1, -1, 180, 187, 207, 153,
1680 211, 154, 184, 181, -1, 32, -1, 160, -1, 179,
1681 212, 213, -1, 33, -1, 161, -1, 214, 225, 215,
1682 -1, -1, 45, -1, 47, -1, -1, 34, 219, 217,
1683 212, -1, -1, 63, -1, 17, -1, 18, -1, 21,
1684 -1, 25, -1, 26, -1, 22, -1, 23, -1, 24,
1685 -1, 158, 196, 159, -1, 195, -1, 61, 220, 30,
1686 151, 30, -1, 165, -1, 207, -1, 222, -1, 221,
1687 -1, 189, 223, -1, 225, 226, -1, 226, -1, 227,
1688 229, -1, 227, 231, -1, -1, 29, -1, 77, -1,
1689 76, -1, 72, 224, -1, 72, 3, -1, 73, 15,
1690 223, -1, 73, 4, 223, 151, 15, 223, 151, 15,
1691 223, -1, 74, 176, 223, 151, 15, 223, 155, 230,
1692 157, -1, 74, 176, 223, 151, 15, 223, 155, 157,
1693 -1, 178, 75, 180, 187, 223, 153, 234, 154, 39,
1694 15, 223, 228, 15, 223, -1, 228, -1, 78, -1,
1695 230, 176, 221, 151, 15, 223, -1, 176, 221, 151,
1696 15, 223, -1, 178, 236, -1, 189, 155, 223, 151,
1697 223, 157, -1, 232, 151, 155, 223, 151, 223, 157,
1698 -1, 224, -1, 233, 151, 224, -1, 233, -1, -1,
1699 60, 59, -1, 59, -1, 167, 189, 223, 151, 223,
1700 -1, 168, 189, 223, 151, 223, -1, 169, 189, 223,
1701 151, 223, -1, 99, 170, 189, 223, 151, 223, -1,
1702 100, 171, 189, 223, 151, 223, -1, 172, 224, 151,
1703 224, -1, 173, 224, 39, 189, -1, 128, 224, 151,
1704 224, 151, 224, -1, 133, 224, 151, 189, -1, 134,
1705 224, 151, 224, -1, 135, 224, 151, 224, 151, 224,
1706 -1, 136, 224, 151, 224, 151, 224, -1, 127, 232,
1707 -1, 235, 180, 187, 223, 153, 234, 154, -1, 239,
1708 -1, 151, 233, -1, -1, 38, -1, -1, 121, 189,
1709 182, -1, 121, 189, 151, 10, 223, 182, -1, 122,
1710 189, 182, -1, 122, 189, 151, 10, 223, 182, -1,
1711 123, 224, -1, 238, 124, 189, 223, -1, 238, 125,
1712 224, 151, 189, 223, -1, 126, 189, 223, 237, -1
Reid Spencer319a7302007-01-05 17:20:02 +00001713};
1714
1715/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1716static const unsigned short int yyrline[] =
1717{
Reid Spencer30d0c582007-01-15 00:26:18 +00001718 0, 1033, 1033, 1033, 1034, 1034, 1038, 1038, 1038, 1038,
1719 1038, 1038, 1038, 1039, 1039, 1039, 1039, 1040, 1040, 1040,
1720 1041, 1041, 1041, 1041, 1041, 1041, 1042, 1042, 1042, 1042,
1721 1042, 1042, 1042, 1042, 1042, 1042, 1043, 1043, 1043, 1043,
1722 1043, 1043, 1043, 1043, 1043, 1043, 1044, 1044, 1044, 1044,
1723 1044, 1044, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046,
1724 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1052,
1725 1052, 1052, 1052, 1053, 1053, 1053, 1053, 1054, 1054, 1055,
1726 1055, 1058, 1061, 1066, 1066, 1066, 1066, 1066, 1066, 1067,
1727 1068, 1071, 1071, 1071, 1071, 1071, 1072, 1073, 1078, 1083,
1728 1084, 1087, 1088, 1096, 1102, 1103, 1106, 1107, 1116, 1117,
1729 1130, 1130, 1131, 1131, 1132, 1136, 1136, 1136, 1136, 1136,
1730 1136, 1136, 1137, 1137, 1137, 1137, 1137, 1139, 1142, 1145,
1731 1148, 1152, 1165, 1171, 1177, 1187, 1190, 1200, 1203, 1211,
1732 1215, 1222, 1223, 1228, 1233, 1243, 1250, 1256, 1263, 1270,
1733 1277, 1283, 1290, 1297, 1305, 1312, 1319, 1326, 1333, 1340,
1734 1347, 1355, 1369, 1381, 1386, 1392, 1397, 1403, 1408, 1413,
1735 1421, 1426, 1431, 1441, 1446, 1451, 1451, 1461, 1466, 1469,
1736 1474, 1478, 1482, 1484, 1484, 1487, 1497, 1502, 1507, 1517,
1737 1527, 1537, 1547, 1552, 1557, 1562, 1564, 1564, 1567, 1572,
1738 1579, 1584, 1591, 1598, 1603, 1604, 1612, 1612, 1613, 1613,
1739 1615, 1624, 1628, 1632, 1635, 1640, 1643, 1646, 1669, 1670,
1740 1673, 1684, 1685, 1687, 1696, 1697, 1698, 1702, 1702, 1716,
1741 1717, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1721, 1722,
1742 1727, 1728, 1737, 1737, 1741, 1747, 1758, 1767, 1770, 1778,
1743 1782, 1787, 1790, 1796, 1796, 1798, 1803, 1808, 1813, 1821,
1744 1831, 1840, 1862, 1867, 1873, 1879, 1887, 1905, 1914, 1924,
1745 1928, 1935, 1936, 1940, 1945, 1948, 1959, 1969, 1980, 1990,
1746 2000, 2011, 2041, 2050, 2057, 2066, 2073, 2080, 2086, 2137,
1747 2142, 2143, 2147, 2148, 2151, 2160, 2170, 2179, 2190, 2197,
1748 2208, 2219
Reid Spencer319a7302007-01-05 17:20:02 +00001749};
1750#endif
1751
1752#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1753/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1754 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1755static const char *const yytname[] =
1756{
1757 "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE",
1758 "SHORT", "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE",
1759 "LABEL", "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL",
1760 "FPVAL", "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK",
1761 "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1762 "BEGINTOK", "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION",
1763 "VOLATILE", "TO", "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK",
Reid Spencerc4d96252007-01-13 00:03:30 +00001764 "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "EXTERNAL",
Reid Spencer319a7302007-01-05 17:20:02 +00001765 "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN",
1766 "UNINITIALIZED", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1767 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1768 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1769 "RET", "BR", "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE",
1770 "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM",
1771 "SREM", "FREM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT",
1772 "SETEQ", "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1773 "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE",
1774 "ULT", "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1775 "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR",
1776 "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST",
1777 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI",
1778 "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','",
1779 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1780 "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps",
1781 "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps",
1782 "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1783 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString",
1784 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV",
1785 "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
1786 "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1787 "Module", "DefinitionList", "External", "ConstPool", "AsmBlock",
1788 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1789 "Name", "OptName", "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH",
1790 "BEGIN", "FunctionHeader", "END", "Function", "FnDeclareLinkage",
Reid Spencerc4d96252007-01-13 00:03:30 +00001791 "FunctionProto", "@1", "OptSideEffect", "ConstValueRef",
1792 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1793 "BasicBlock", "InstructionList", "Unwind", "BBTerminatorInst",
1794 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE",
1795 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0
Reid Spencer319a7302007-01-05 17:20:02 +00001796};
1797#endif
1798
1799# ifdef YYPRINT
1800/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1801 token YYLEX-NUM. */
1802static const unsigned short int yytoknum[] =
1803{
1804 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1805 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1806 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1807 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1808 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1809 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1810 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1811 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1812 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1813 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1814 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1815 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1816 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1817 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1818 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Reid Spencerc4d96252007-01-13 00:03:30 +00001819 61, 44, 92, 40, 41, 91, 120, 93, 60, 62,
1820 123, 125, 42, 99
Reid Spencer319a7302007-01-05 17:20:02 +00001821};
1822# endif
1823
1824/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1825static const unsigned char yyr1[] =
1826{
Reid Spencerc4d96252007-01-13 00:03:30 +00001827 0, 164, 165, 165, 166, 166, 167, 167, 167, 167,
1828 167, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1829 169, 169, 169, 169, 169, 169, 170, 170, 170, 170,
Reid Spencer319a7302007-01-05 17:20:02 +00001830 170, 170, 170, 170, 170, 170, 171, 171, 171, 171,
Reid Spencerc4d96252007-01-13 00:03:30 +00001831 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1832 171, 171, 172, 172, 172, 172, 173, 173, 173, 173,
1833 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1834 174, 174, 174, 175, 175, 175, 175, 176, 176, 177,
1835 177, 178, 178, 179, 179, 179, 179, 179, 179, 179,
1836 179, 180, 180, 180, 180, 180, 180, 180, 180, 181,
1837 181, 182, 182, 183, 184, 184, 185, 185, 186, 186,
1838 187, 187, 188, 188, 189, 190, 190, 190, 190, 190,
1839 190, 190, 190, 190, 190, 190, 190, 191, 191, 191,
1840 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1841 192, 193, 193, 193, 193, 194, 194, 194, 194, 194,
1842 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
1843 194, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1844 195, 195, 195, 196, 196, 197, 197, 198, 199, 199,
1845 199, 199, 199, 200, 200, 201, 201, 201, 201, 201,
1846 201, 201, 201, 201, 201, 202, 203, 203, 204, 204,
1847 204, 204, 205, 206, 206, 206, 207, 207, 208, 208,
1848 209, 210, 210, 211, 211, 211, 211, 212, 213, 213,
1849 214, 215, 215, 216, 217, 217, 217, 219, 218, 220,
1850 220, 221, 221, 221, 221, 221, 221, 221, 221, 221,
1851 221, 221, 222, 222, 223, 223, 224, 225, 225, 226,
1852 227, 227, 227, 228, 228, 229, 229, 229, 229, 229,
1853 229, 229, 229, 229, 230, 230, 231, 232, 232, 233,
1854 233, 234, 234, 235, 235, 236, 236, 236, 236, 236,
1855 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1856 237, 237, 238, 238, 239, 239, 239, 239, 239, 239,
1857 239, 239
Reid Spencer319a7302007-01-05 17:20:02 +00001858};
1859
1860/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1861static const unsigned char yyr2[] =
1862{
1863 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1864 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1865 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1866 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1867 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1868 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1869 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1870 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1871 1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1872 0, 1, 1, 1, 1, 1, 1, 2, 0, 0,
1873 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1874 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1875 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1876 2, 4, 5, 5, 3, 2, 5, 4, 2, 1,
1877 3, 1, 3, 1, 0, 4, 3, 3, 4, 4,
1878 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1879 2, 6, 5, 8, 6, 6, 6, 7, 7, 6,
1880 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1881 4, 2, 1, 1, 1, 4, 2, 4, 6, 6,
1882 6, 6, 3, 4, 0, 1, 1, 1, 3, 3,
1883 3, 3, 3, 3, 1, 0, 1, 1, 1, 0,
1884 2, 3, 1, 1, 3, 1, 0, 8, 1, 1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001885 3, 1, 1, 3, 0, 1, 1, 0, 4, 0,
1886 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1887 1, 5, 1, 1, 1, 1, 2, 2, 1, 2,
1888 2, 0, 1, 1, 1, 2, 2, 3, 9, 9,
1889 8, 14, 1, 1, 6, 5, 2, 6, 7, 1,
1890 3, 1, 0, 2, 1, 5, 5, 5, 6, 6,
1891 4, 4, 6, 4, 4, 6, 6, 2, 7, 1,
1892 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
1893 6, 4
Reid Spencer319a7302007-01-05 17:20:02 +00001894};
1895
1896/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1897 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1898 means the default is an error. */
1899static const unsigned short int yydefact[] =
1900{
Reid Spencerc4d96252007-01-13 00:03:30 +00001901 194, 0, 90, 182, 1, 181, 227, 83, 84, 85,
1902 87, 88, 89, 86, 0, 98, 251, 178, 179, 206,
1903 207, 0, 0, 0, 90, 0, 186, 224, 0, 0,
1904 91, 92, 93, 94, 95, 96, 0, 0, 252, 251,
1905 248, 82, 0, 0, 0, 0, 192, 0, 0, 0,
1906 0, 0, 183, 184, 0, 0, 81, 225, 226, 98,
Reid Spencer319a7302007-01-05 17:20:02 +00001907 195, 180, 97, 111, 115, 116, 117, 118, 119, 120,
1908 121, 122, 123, 124, 125, 126, 127, 2, 3, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001909 0, 0, 0, 242, 0, 0, 110, 129, 114, 243,
1910 128, 218, 219, 220, 221, 222, 223, 247, 0, 0,
1911 0, 254, 253, 263, 293, 262, 249, 250, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001912 0, 0, 205, 193, 187, 185, 175, 176, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001913 0, 0, 228, 130, 0, 0, 0, 113, 135, 139,
1914 0, 0, 144, 138, 256, 0, 255, 0, 0, 72,
1915 76, 71, 75, 70, 74, 69, 73, 77, 78, 0,
1916 292, 274, 0, 98, 6, 7, 8, 9, 10, 11,
1917 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1918 22, 23, 24, 25, 0, 0, 0, 0, 0, 0,
1919 0, 0, 52, 53, 54, 55, 0, 0, 0, 0,
1920 68, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1921 65, 66, 67, 0, 0, 0, 0, 0, 98, 266,
1922 0, 289, 200, 197, 196, 198, 199, 201, 204, 0,
1923 106, 106, 115, 116, 117, 118, 119, 120, 121, 122,
1924 123, 124, 125, 0, 0, 0, 0, 106, 106, 0,
1925 0, 0, 0, 0, 134, 216, 143, 141, 0, 231,
1926 232, 233, 236, 237, 238, 234, 235, 229, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001927 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001928 0, 240, 245, 244, 246, 0, 257, 0, 273, 0,
1929 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1930 0, 50, 51, 36, 37, 38, 39, 40, 41, 42,
1931 43, 44, 45, 46, 47, 48, 49, 0, 101, 101,
1932 298, 0, 0, 287, 0, 0, 0, 0, 0, 0,
1933 0, 0, 0, 0, 0, 0, 0, 0, 202, 0,
1934 190, 191, 158, 159, 4, 5, 156, 157, 160, 151,
1935 152, 155, 0, 0, 0, 0, 154, 153, 188, 189,
1936 112, 112, 137, 0, 140, 215, 209, 212, 213, 0,
1937 0, 131, 230, 0, 0, 0, 0, 0, 0, 0,
1938 0, 174, 0, 0, 0, 0, 0, 0, 0, 0,
1939 0, 0, 0, 0, 294, 0, 296, 291, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001940 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001941 0, 0, 0, 203, 0, 0, 108, 106, 146, 0,
1942 0, 150, 0, 147, 132, 133, 136, 208, 210, 0,
1943 104, 142, 0, 0, 0, 291, 0, 0, 0, 0,
1944 0, 239, 0, 0, 0, 0, 0, 0, 0, 0,
1945 0, 0, 0, 0, 0, 0, 301, 0, 0, 0,
1946 283, 284, 0, 0, 0, 0, 0, 280, 281, 0,
1947 299, 0, 103, 109, 107, 145, 148, 149, 214, 211,
1948 105, 99, 0, 0, 0, 0, 0, 0, 0, 0,
1949 173, 0, 0, 0, 0, 0, 0, 0, 272, 0,
1950 0, 101, 102, 101, 269, 290, 0, 0, 0, 0,
1951 0, 275, 276, 277, 272, 0, 0, 217, 241, 0,
1952 0, 162, 0, 0, 0, 0, 0, 0, 0, 0,
1953 0, 0, 0, 271, 0, 278, 279, 0, 295, 297,
1954 0, 0, 0, 282, 285, 286, 0, 300, 100, 0,
1955 0, 0, 170, 0, 0, 164, 165, 166, 169, 161,
1956 0, 260, 0, 0, 0, 270, 267, 0, 288, 167,
1957 168, 0, 0, 0, 258, 0, 259, 0, 0, 268,
1958 163, 171, 172, 0, 0, 0, 0, 0, 0, 265,
1959 0, 0, 264, 0, 261
Reid Spencer319a7302007-01-05 17:20:02 +00001960};
1961
1962/* YYDEFGOTO[NTERM-NUM]. */
1963static const short int yydefgoto[] =
1964{
Reid Spencerc4d96252007-01-13 00:03:30 +00001965 -1, 83, 336, 266, 267, 268, 290, 307, 269, 270,
1966 233, 234, 149, 235, 24, 15, 36, 507, 384, 406,
1967 471, 330, 407, 84, 85, 236, 87, 88, 130, 248,
1968 371, 271, 372, 118, 1, 2, 55, 3, 61, 215,
1969 46, 113, 219, 89, 418, 357, 358, 359, 37, 93,
1970 16, 96, 17, 59, 18, 27, 363, 272, 90, 274,
1971 494, 39, 40, 41, 105, 106, 553, 107, 313, 523,
1972 524, 208, 209, 446, 210, 211
Reid Spencer319a7302007-01-05 17:20:02 +00001973};
1974
1975/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1976 STATE-NUM. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001977#define YYPACT_NINF -537
Reid Spencer319a7302007-01-05 17:20:02 +00001978static const short int yypact[] =
1979{
Reid Spencerc4d96252007-01-13 00:03:30 +00001980 -537, 75, 61, 1145, -537, -537, -537, -537, -537, -537,
1981 -537, -537, -537, -537, 18, 180, 55, -537, -537, -537,
1982 -537, -28, -61, 33, 130, -40, -537, 102, 87, 117,
1983 -537, -537, -537, -537, -537, -537, 838, -24, -537, -15,
1984 -537, 48, -11, -2, 6, 12, -537, 11, 87, 838,
1985 -9, -9, -537, -537, -9, -9, -537, -537, -537, 180,
1986 -537, -537, -537, 32, -537, -537, -537, -537, -537, -537,
1987 -537, -537, -537, -537, -537, -537, -537, -537, -537, 164,
1988 171, -6, 512, -537, 135, 41, -537, -537, -103, -537,
1989 -537, -537, -537, -537, -537, -537, -537, -537, 883, 45,
1990 192, -537, -537, -537, 1324, -537, -537, -537, 175, 126,
1991 190, 188, 203, -537, -537, -537, -537, -537, 911, 911,
1992 957, 911, -537, -537, 81, 97, 561, -537, -537, -103,
1993 -109, 121, 641, -537, 32, 1140, -537, 1140, 1140, -537,
1994 -537, -537, -537, -537, -537, -537, -537, -537, -537, 1140,
1995 -537, -537, 219, 180, -537, -537, -537, -537, -537, -537,
1996 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1997 -537, -537, -537, -537, 10, 112, 911, 911, 911, 911,
1998 911, 911, -537, -537, -537, -537, 911, 911, 911, 911,
1999 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2000 -537, -537, -537, 911, 911, 911, 911, 911, 180, -537,
2001 59, -537, -537, -537, -537, -537, -537, -537, -537, -71,
2002 129, 129, 167, 193, 195, 218, 222, 224, 234, 243,
2003 250, 261, 263, 252, 252, 264, 993, 129, 129, 911,
2004 911, 127, -97, 911, -537, 680, -537, 136, 137, -537,
2005 -537, -537, -537, -537, -537, -537, -537, 229, 10, 112,
2006 140, 141, 144, 145, 146, 957, 147, 148, 150, 154,
2007 155, -537, -537, -537, -537, 158, -537, 160, -537, 838,
2008 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2009 911, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2010 -537, -537, -537, -537, -537, -537, -537, 911, 163, 165,
2011 -537, 1140, 162, 169, 170, 172, 173, 174, 176, 1140,
2012 1140, 1140, 177, 276, 838, 911, 911, 288, -537, -8,
2013 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2014 -537, -537, 724, 957, 590, 292, -537, -537, -537, -537,
2015 -106, -104, -537, 179, -103, -537, 135, -537, 178, 181,
2016 752, -537, -537, 296, 183, 187, 957, 957, 957, 957,
2017 957, -537, -131, 957, 957, 957, 957, 957, 315, 316,
2018 1140, 1140, 1140, 1, -537, 7, -537, 191, 1140, 186,
2019 911, 911, 911, 911, 911, 194, 197, 201, 911, 911,
2020 1140, 1140, 202, -537, 304, 326, -537, 129, -537, -60,
2021 -78, -537, -74, -537, -537, -537, -537, -537, -537, 799,
2022 309, -537, 208, 957, 957, 191, 210, 213, 223, 225,
2023 957, -537, 230, 231, 235, 236, 308, 1140, 1140, 227,
2024 237, 238, 1140, 357, 1140, 911, -537, 239, 1140, 241,
2025 -537, -537, 242, 244, 1140, 1140, 1140, -537, -537, 248,
2026 -537, 911, -537, -537, -537, -537, -537, -537, -537, -537,
2027 -537, 338, 366, 246, 251, 249, 957, 957, 957, 957,
2028 -537, 957, 957, 957, 957, 911, 253, 258, 911, 1140,
2029 1140, 254, -537, 254, -537, 255, 1140, 256, 911, 911,
2030 911, -537, -537, -537, 911, 1140, 390, -537, -537, 957,
2031 957, -537, 265, 260, 266, 267, 268, 272, 274, 275,
2032 277, 400, 29, 255, 280, -537, -537, 363, -537, -537,
2033 911, 278, 1140, -537, -537, -537, 282, -537, -537, 283,
2034 287, 957, -537, 957, 957, -537, -537, -537, -537, -537,
2035 1140, -537, 1229, 60, 381, -537, -537, 286, -537, -537,
2036 -537, 290, 293, 294, -537, 270, -537, 1229, 435, -537,
2037 -537, -537, -537, 436, 302, 1140, 1140, 441, 196, -537,
2038 1140, 442, -537, 1140, -537
Reid Spencer319a7302007-01-05 17:20:02 +00002039};
2040
2041/* YYPGOTO[NTERM-NUM]. */
2042static const short int yypgoto[] =
2043{
Reid Spencerc4d96252007-01-13 00:03:30 +00002044 -537, -537, 226, 361, 362, 365, 209, 214, 368, 370,
2045 -99, -98, -507, -537, 420, 452, -134, -537, -303, 57,
2046 -537, -216, -537, -45, -537, -36, -537, -79, -30, -537,
2047 -111, 245, -210, 104, -537, -537, -537, -537, 431, -537,
2048 -537, -537, -537, 4, -537, 63, -537, -537, 421, -537,
2049 -537, -537, -537, -537, 480, -537, -537, -536, -105, 58,
2050 -88, -537, 445, -537, -93, -537, -537, -537, -537, 42,
2051 -18, -537, -537, 64, -537, -537
Reid Spencer319a7302007-01-05 17:20:02 +00002052};
2053
2054/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2055 positive, shift that token. If negative, reduce the rule which
2056 number is the opposite. If zero, do what YYDEFACT says.
2057 If YYTABLE_NINF, syntax error. */
2058#define YYTABLE_NINF -178
2059static const short int yytable[] =
2060{
Reid Spencerc4d96252007-01-13 00:03:30 +00002061 86, 147, 148, 129, 115, 331, 386, 25, 91, 237,
2062 136, 442, 125, 86, 38, 552, 565, 444, 94, 279,
2063 430, 348, 349, 42, 43, 44, 116, 117, 431, 404,
2064 273, 574, 273, 273, 139, 140, 141, 142, 143, 144,
2065 145, 146, 243, 45, 273, 25, 567, 129, 405, 137,
2066 -112, 414, 244, 129, 243, 415, 133, 443, 133, 133,
2067 138, -177, 135, 443, 353, 139, 140, 141, 142, 143,
2068 144, 145, 146, 430, 324, 4, 19, 430, 20, 28,
2069 327, 466, 220, 221, 38, 238, 328, 467, 131, 47,
2070 310, 430, 5, 314, 48, 6, 242, 465, 315, 316,
2071 317, 318, 247, 7, 8, 9, 10, 11, 12, 13,
2072 56, 280, 281, 282, 283, 284, 285, 60, 322, 323,
2073 98, 99, 100, 14, 101, 102, 103, 286, 287, 288,
2074 289, 347, 409, 410, 412, 62, 92, 291, 292, 108,
2075 308, 309, 135, 311, 312, 135, 95, 57, 109, 58,
2076 135, 135, 135, 135, 126, 119, 110, 49, 120, 121,
2077 350, 351, 111, 19, 354, 20, 112, 319, 320, 321,
2078 135, 135, 7, 8, 9, 50, 11, 51, 13, 52,
2079 213, 214, 123, 325, 326, -113, 551, 53, 528, 124,
2080 529, 464, 332, 333, 132, 275, 276, 139, 140, 141,
2081 142, 143, 144, 145, 146, 212, 273, 277, 216, 356,
2082 -72, -72, -76, -76, 273, 273, 273, 566, 217, 293,
2083 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
2084 304, 305, 306, 218, 380, -71, -71, 239, 402, -75,
2085 -75, -70, -70, 86, 29, 30, 31, 32, 33, 34,
2086 35, -74, -74, 240, 381, 425, 426, 427, 428, 429,
2087 -69, -69, 432, 433, 434, 435, 436, -73, -73, 334,
2088 335, 382, 101, 102, 245, 273, 273, 273, 278, 400,
2089 329, 354, -79, 273, -80, 338, 352, 360, 86, 401,
2090 135, 361, 362, 366, 367, 273, 273, 368, 369, 370,
2091 373, 374, 449, 375, 451, 452, 453, 376, 377, 378,
2092 457, 379, 473, 474, 383, 399, 385, 388, 403, 480,
2093 389, 390, 413, 391, 392, 393, 422, 394, 398, 419,
2094 437, 438, 273, 273, 462, 420, 423, 273, 416, 273,
2095 424, 448, 445, 273, 463, 454, 404, 485, 455, 273,
2096 273, 273, 456, 461, 135, 450, 135, 135, 135, 472,
2097 417, 476, 135, 458, 477, 512, 513, 514, 515, 387,
2098 516, 517, 518, 519, 478, 492, 479, 395, 396, 397,
2099 488, 481, 482, 356, 273, 273, 483, 484, 489, 490,
2100 496, 273, 498, 499, 506, 500, 508, 509, 539, 540,
2101 273, 504, 510, 511, 521, 527, 530, 532, 538, 135,
2102 533, 534, 535, 522, 542, 550, 541, 543, 544, 443,
2103 568, 573, 545, 147, 148, 505, 546, 273, 547, 548,
2104 561, 549, 562, 563, 554, 556, 558, 559, 439, 440,
2105 441, 560, 555, 569, 570, 273, 447, 571, 572, 520,
2106 575, 576, 135, 577, 147, 148, 580, 583, 459, 460,
2107 337, 104, 135, 135, 135, 203, 204, 364, 135, 205,
2108 273, 273, 206, 365, 207, 273, 54, 470, 273, 114,
2109 122, 346, 469, 26, 97, 581, 536, 495, 0, 475,
2110 0, 0, 0, 0, 135, 486, 487, 0, 0, 0,
2111 491, 0, 493, 0, 0, 0, 497, 0, 0, 0,
2112 0, 0, 501, 502, 503, 127, 64, 65, 66, 67,
2113 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2114 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2115 19, 0, 20, 0, 0, 0, 0, 525, 526, 0,
2116 0, 0, 0, 0, 531, 0, 0, 0, 0, 0,
2117 0, 0, 0, 537, 127, 64, 65, 66, 67, 68,
2118 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2119 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2120 557, 20, 0, 127, 222, 223, 224, 225, 226, 227,
2121 228, 229, 230, 231, 232, 75, 76, 0, 564, 77,
2122 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2123 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2124 0, 0, 0, 578, 579, 0, 0, 0, 582, 0,
2125 0, 584, 0, 0, 127, 64, 65, 66, 67, 68,
2126 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2127 77, 78, 0, 0, 79, 0, 0, 80, 0, 19,
2128 81, 20, 82, 128, 0, 0, 0, 0, 0, 0,
2129 0, 246, 0, 127, 64, 65, 66, 67, 68, 69,
2130 70, 71, 72, 73, 74, 75, 76, 0, 0, 77,
2131 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2132 20, 0, 0, 79, 0, 0, 80, 0, 0, 81,
2133 355, 82, 241, 0, 0, 0, 0, 127, 222, 223,
2134 224, 225, 226, 227, 228, 229, 230, 231, 232, 75,
2135 76, 0, 79, 77, 78, 80, 0, 0, 81, 0,
2136 82, 411, 19, 0, 20, 127, 64, 65, 66, 67,
2137 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2138 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2139 19, 0, 20, 0, 0, 0, 0, 0, 0, 0,
2140 0, 0, 421, 79, 0, 0, 80, 0, 0, 81,
2141 0, 82, 127, 64, 65, 66, 67, 68, 69, 70,
2142 71, 72, 73, 74, 75, 76, 0, 0, 77, 78,
2143 0, 0, 0, 0, 0, 0, 0, 19, 0, 20,
2144 0, 0, 79, 0, 0, 80, 0, 0, 81, 468,
2145 82, 63, 64, 65, 66, 67, 68, 69, 70, 71,
2146 72, 73, 74, 75, 76, 0, 0, 77, 78, 0,
2147 0, 0, 0, 0, 0, 0, 19, 0, 20, 0,
2148 0, 0, 0, 0, 0, 0, 79, 0, 0, 80,
2149 0, 408, 81, 0, 82, 0, 134, 64, 65, 66,
2150 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2151 0, 0, 77, 78, 79, 0, 0, 80, 0, 0,
2152 81, 19, 82, 20, 127, 64, 65, 66, 67, 68,
Reid Spencer319a7302007-01-05 17:20:02 +00002153 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2154 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2155 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002156 0, 79, 0, 0, 80, 0, 0, 81, 0, 82,
2157 127, 222, 223, 224, 225, 226, 227, 228, 229, 230,
2158 231, 232, 75, 76, 0, 0, 77, 78, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002159 0, 0, 0, 0, 0, 19, 0, 20, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002160 79, 0, 0, 80, 0, 0, 81, 0, 82, 0,
2161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2162 0, 0, 77, 78, 0, 339, 340, 341, 0, 0,
2163 0, 19, 0, 20, 0, 0, 0, 0, 0, 0,
2164 0, 0, 0, 0, 0, 79, 0, 0, 80, 0,
2165 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002166 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002167 0, 0, 0, 79, 0, 0, 80, 0, 0, 81,
Reid Spencerc4d96252007-01-13 00:03:30 +00002168 0, 82, 154, 155, 156, 157, 158, 159, 160, 161,
2169 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
2170 172, 173, 258, 259, 0, 0, 0, 0, 0, 0,
2171 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,
2172 0, 0, 80, 0, 0, 81, 0, 82, 0, 260,
2173 0, 261, 182, 183, 184, 185, 0, 262, 263, 264,
2174 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
2175 200, 201, 202, 0, 0, 0, 0, 0, 342, 0,
2176 0, 343, 0, 344, 0, 0, 345, 249, 250, 77,
2177 78, 251, 252, 253, 254, 255, 256, 0, 19, 0,
2178 20, 0, -82, 19, 0, 20, 0, 0, 0, 6,
2179 -82, -82, 0, 0, 0, 0, 0, -82, -82, -82,
2180 -82, -82, -82, -82, -82, 21, 0, 0, 0, 0,
2181 0, 257, -82, 22, 0, 0, 0, 23, 0, 0,
2182 0, 0, 0, 0, 0, 0, 0, 0, 0, 154,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002183 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
Reid Spencerc4d96252007-01-13 00:03:30 +00002184 165, 166, 167, 168, 169, 170, 171, 172, 173, 258,
2185 259, 0, 0, 0, 0, 0, 249, 250, 0, 0,
2186 251, 252, 253, 254, 255, 256, 0, 0, 0, 0,
2187 0, 0, 0, 0, 0, 0, 260, 0, 261, 182,
2188 183, 184, 185, 0, 262, 263, 264, 190, 191, 192,
2189 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
2190 257, 0, 0, 0, 0, 0, 0, 0, 265, 0,
2191 0, 0, 0, 0, 0, 0, 0, 0, 154, 155,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002192 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
Reid Spencerc4d96252007-01-13 00:03:30 +00002193 166, 167, 168, 169, 170, 171, 172, 173, 258, 259,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002194 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2195 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002196 0, 0, 0, 0, 0, 260, 0, 261, 182, 183,
2197 184, 185, 150, 262, 263, 264, 190, 191, 192, 193,
2198 194, 195, 196, 197, 198, 199, 200, 201, 202, 0,
2199 0, 0, 0, 151, 152, 0, 0, 265, 0, 0,
2200 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
2201 0, 0, 0, 154, 155, 156, 157, 158, 159, 160,
2202 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
2203 171, 172, 173, 174, 175, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002204 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002205 0, 0, 0, 0, 0, 176, 177, 178, 0, 0,
2206 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2207 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2208 199, 200, 201, 202
Reid Spencer319a7302007-01-05 17:20:02 +00002209};
2210
2211static const short int yycheck[] =
2212{
Reid Spencerc4d96252007-01-13 00:03:30 +00002213 36, 100, 100, 82, 49, 221, 309, 3, 32, 120,
2214 98, 10, 18, 49, 29, 522, 552, 10, 33, 153,
2215 151, 237, 238, 51, 52, 53, 35, 36, 159, 37,
2216 135, 567, 137, 138, 5, 6, 7, 8, 9, 10,
2217 11, 12, 151, 71, 149, 41, 553, 126, 56, 4,
2218 153, 157, 161, 132, 151, 159, 162, 56, 162, 162,
2219 15, 0, 98, 56, 161, 5, 6, 7, 8, 9,
2220 10, 11, 12, 151, 208, 0, 28, 151, 30, 61,
2221 151, 159, 118, 119, 29, 121, 157, 161, 84, 150,
2222 178, 151, 31, 181, 61, 34, 126, 157, 186, 187,
2223 188, 189, 132, 42, 43, 44, 45, 46, 47, 48,
2224 150, 101, 102, 103, 104, 105, 106, 30, 206, 207,
2225 72, 73, 74, 62, 76, 77, 78, 117, 118, 119,
2226 120, 236, 342, 343, 344, 18, 160, 25, 26, 150,
2227 176, 177, 178, 179, 180, 181, 161, 45, 150, 47,
2228 186, 187, 188, 189, 160, 51, 150, 27, 54, 55,
2229 239, 240, 150, 28, 243, 30, 155, 203, 204, 205,
2230 206, 207, 42, 43, 44, 45, 46, 47, 48, 49,
2231 54, 55, 18, 124, 125, 153, 157, 57, 491, 18,
2232 493, 407, 25, 26, 153, 137, 138, 5, 6, 7,
2233 8, 9, 10, 11, 12, 30, 311, 149, 18, 245,
2234 17, 18, 17, 18, 319, 320, 321, 157, 30, 107,
2235 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2236 118, 119, 120, 30, 279, 17, 18, 156, 326, 17,
2237 18, 17, 18, 279, 64, 65, 66, 67, 68, 69,
2238 70, 17, 18, 156, 290, 366, 367, 368, 369, 370,
2239 17, 18, 373, 374, 375, 376, 377, 17, 18, 17,
2240 18, 307, 76, 77, 153, 380, 381, 382, 59, 324,
2241 151, 360, 21, 388, 21, 21, 159, 151, 324, 325,
2242 326, 154, 63, 153, 153, 400, 401, 153, 153, 153,
2243 153, 153, 390, 153, 392, 393, 394, 153, 153, 151,
2244 398, 151, 423, 424, 151, 39, 151, 155, 30, 430,
2245 151, 151, 30, 151, 151, 151, 30, 151, 151, 151,
2246 15, 15, 437, 438, 30, 154, 153, 442, 159, 444,
2247 153, 155, 151, 448, 18, 151, 37, 39, 151, 454,
2248 455, 456, 151, 151, 390, 391, 392, 393, 394, 151,
2249 356, 151, 398, 399, 151, 476, 477, 478, 479, 311,
2250 481, 482, 483, 484, 151, 18, 151, 319, 320, 321,
2251 153, 151, 151, 419, 489, 490, 151, 151, 151, 151,
2252 151, 496, 151, 151, 56, 151, 30, 151, 509, 510,
2253 505, 153, 151, 154, 151, 151, 151, 151, 18, 445,
2254 498, 499, 500, 155, 154, 15, 151, 151, 151, 56,
2255 39, 151, 154, 522, 522, 461, 154, 532, 154, 154,
2256 541, 154, 543, 544, 154, 157, 154, 154, 380, 381,
2257 382, 154, 530, 157, 154, 550, 388, 154, 154, 485,
2258 15, 15, 488, 151, 553, 553, 15, 15, 400, 401,
2259 234, 41, 498, 499, 500, 104, 104, 258, 504, 104,
2260 575, 576, 104, 259, 104, 580, 24, 420, 583, 48,
2261 59, 236, 419, 3, 39, 578, 504, 445, -1, 425,
2262 -1, -1, -1, -1, 530, 437, 438, -1, -1, -1,
2263 442, -1, 444, -1, -1, -1, 448, -1, -1, -1,
2264 -1, -1, 454, 455, 456, 3, 4, 5, 6, 7,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002265 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002266 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2267 28, -1, 30, -1, -1, -1, -1, 489, 490, -1,
2268 -1, -1, -1, -1, 496, -1, -1, -1, -1, -1,
2269 -1, -1, -1, 505, 3, 4, 5, 6, 7, 8,
2270 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2271 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2272 532, 30, -1, 3, 4, 5, 6, 7, 8, 9,
2273 10, 11, 12, 13, 14, 15, 16, -1, 550, 19,
2274 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2275 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2276 -1, -1, -1, 575, 576, -1, -1, -1, 580, -1,
2277 -1, 583, -1, -1, 3, 4, 5, 6, 7, 8,
2278 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2279 19, 20, -1, -1, 152, -1, -1, 155, -1, 28,
2280 158, 30, 160, 161, -1, -1, -1, -1, -1, -1,
2281 -1, 40, -1, 3, 4, 5, 6, 7, 8, 9,
2282 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
2283 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2284 30, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2285 40, 160, 161, -1, -1, -1, -1, 3, 4, 5,
2286 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2287 16, -1, 152, 19, 20, 155, -1, -1, 158, -1,
2288 160, 161, 28, -1, 30, 3, 4, 5, 6, 7,
2289 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2290 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2291 28, -1, 30, -1, -1, -1, -1, -1, -1, -1,
2292 -1, -1, 40, 152, -1, -1, 155, -1, -1, 158,
2293 -1, 160, 3, 4, 5, 6, 7, 8, 9, 10,
2294 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2295 -1, -1, -1, -1, -1, -1, -1, 28, -1, 30,
2296 -1, -1, 152, -1, -1, 155, -1, -1, 158, 40,
2297 160, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2298 12, 13, 14, 15, 16, -1, -1, 19, 20, -1,
2299 -1, -1, -1, -1, -1, -1, 28, -1, 30, -1,
2300 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2301 -1, 157, 158, -1, 160, -1, 3, 4, 5, 6,
2302 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2303 -1, -1, 19, 20, 152, -1, -1, 155, -1, -1,
2304 158, 28, 160, 30, 3, 4, 5, 6, 7, 8,
Reid Spencer319a7302007-01-05 17:20:02 +00002305 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2306 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2307 -1, 30, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002308 -1, 152, -1, -1, 155, -1, -1, 158, -1, 160,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002309 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2310 13, 14, 15, 16, -1, -1, 19, 20, -1, -1,
2311 -1, -1, -1, -1, -1, 28, -1, 30, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002312 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002313 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002314 -1, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2315 -1, 28, -1, 30, -1, -1, -1, -1, -1, -1,
2316 -1, -1, -1, -1, -1, 152, -1, -1, 155, -1,
2317 -1, 158, -1, 160, -1, -1, -1, -1, -1, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002318 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002319 -1, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2320 -1, 160, 79, 80, 81, 82, 83, 84, 85, 86,
2321 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2322 97, 98, 99, 100, -1, -1, -1, -1, -1, -1,
2323 -1, -1, -1, -1, -1, -1, -1, -1, -1, 152,
2324 -1, -1, 155, -1, -1, 158, -1, 160, -1, 126,
2325 -1, 128, 129, 130, 131, 132, -1, 134, 135, 136,
2326 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2327 147, 148, 149, -1, -1, -1, -1, -1, 155, -1,
2328 -1, 158, -1, 160, -1, -1, 163, 17, 18, 19,
2329 20, 21, 22, 23, 24, 25, 26, -1, 28, -1,
2330 30, -1, 27, 28, -1, 30, -1, -1, -1, 34,
2331 35, 36, -1, -1, -1, -1, -1, 42, 43, 44,
2332 45, 46, 47, 48, 49, 50, -1, -1, -1, -1,
2333 -1, 61, 57, 58, -1, -1, -1, 62, -1, -1,
2334 -1, -1, -1, -1, -1, -1, -1, -1, -1, 79,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002335 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2336 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
Reid Spencerc4d96252007-01-13 00:03:30 +00002337 100, -1, -1, -1, -1, -1, 17, 18, -1, -1,
2338 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
2339 -1, -1, -1, -1, -1, -1, 126, -1, 128, 129,
2340 130, 131, 132, -1, 134, 135, 136, 137, 138, 139,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002341 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
Reid Spencerc4d96252007-01-13 00:03:30 +00002342 61, -1, -1, -1, -1, -1, -1, -1, 158, -1,
2343 -1, -1, -1, -1, -1, -1, -1, -1, 79, 80,
2344 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2345 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002346 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2347 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002348 -1, -1, -1, -1, -1, 126, -1, 128, 129, 130,
2349 131, 132, 38, 134, 135, 136, 137, 138, 139, 140,
2350 141, 142, 143, 144, 145, 146, 147, 148, 149, -1,
2351 -1, -1, -1, 59, 60, -1, -1, 158, -1, -1,
2352 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2353 -1, -1, -1, 79, 80, 81, 82, 83, 84, 85,
2354 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2355 96, 97, 98, 99, 100, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002356 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002357 -1, -1, -1, -1, -1, 121, 122, 123, -1, -1,
2358 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2359 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2360 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00002361};
2362
2363/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2364 symbol of state STATE-NUM. */
2365static const unsigned char yystos[] =
2366{
Reid Spencerc4d96252007-01-13 00:03:30 +00002367 0, 198, 199, 201, 0, 31, 34, 42, 43, 44,
2368 45, 46, 47, 48, 62, 179, 214, 216, 218, 28,
2369 30, 50, 58, 62, 178, 207, 218, 219, 61, 64,
2370 65, 66, 67, 68, 69, 70, 180, 212, 29, 225,
2371 226, 227, 51, 52, 53, 71, 204, 150, 61, 27,
2372 45, 47, 49, 57, 179, 200, 150, 45, 47, 217,
2373 30, 202, 18, 3, 4, 5, 6, 7, 8, 9,
2374 10, 11, 12, 13, 14, 15, 16, 19, 20, 152,
2375 155, 158, 160, 165, 187, 188, 189, 190, 191, 207,
2376 222, 32, 160, 213, 33, 161, 215, 226, 72, 73,
2377 74, 76, 77, 78, 178, 228, 229, 231, 150, 150,
2378 150, 150, 155, 205, 202, 187, 35, 36, 197, 197,
2379 197, 197, 212, 18, 18, 18, 160, 3, 161, 191,
2380 192, 207, 153, 162, 3, 189, 224, 4, 15, 5,
2381 6, 7, 8, 9, 10, 11, 12, 174, 175, 176,
2382 38, 59, 60, 75, 79, 80, 81, 82, 83, 84,
2383 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2384 95, 96, 97, 98, 99, 100, 121, 122, 123, 126,
2385 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2386 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2387 147, 148, 149, 167, 168, 169, 172, 173, 235, 236,
2388 238, 239, 30, 54, 55, 203, 18, 30, 30, 206,
2389 189, 189, 4, 5, 6, 7, 8, 9, 10, 11,
2390 12, 13, 14, 174, 175, 177, 189, 194, 189, 156,
2391 156, 161, 192, 151, 161, 153, 40, 192, 193, 17,
2392 18, 21, 22, 23, 24, 25, 26, 61, 99, 100,
2393 126, 128, 134, 135, 136, 158, 167, 168, 169, 172,
2394 173, 195, 221, 222, 223, 223, 223, 223, 59, 180,
2395 101, 102, 103, 104, 105, 106, 117, 118, 119, 120,
2396 170, 25, 26, 107, 108, 109, 110, 111, 112, 113,
2397 114, 115, 116, 117, 118, 119, 120, 171, 189, 189,
2398 224, 189, 189, 232, 224, 224, 224, 224, 224, 189,
2399 189, 189, 224, 224, 180, 124, 125, 151, 157, 151,
2400 185, 185, 25, 26, 17, 18, 166, 166, 21, 22,
2401 23, 24, 155, 158, 160, 163, 195, 222, 185, 185,
2402 191, 191, 159, 161, 191, 40, 189, 209, 210, 211,
2403 151, 154, 63, 220, 170, 171, 153, 153, 153, 153,
2404 153, 194, 196, 153, 153, 153, 153, 153, 151, 151,
2405 187, 189, 189, 151, 182, 151, 182, 223, 155, 151,
2406 151, 151, 151, 151, 151, 223, 223, 223, 151, 39,
2407 187, 189, 224, 30, 37, 56, 183, 186, 157, 196,
2408 196, 161, 196, 30, 157, 159, 159, 207, 208, 151,
2409 154, 40, 30, 153, 153, 194, 194, 194, 194, 194,
2410 151, 159, 194, 194, 194, 194, 194, 15, 15, 223,
2411 223, 223, 10, 56, 10, 151, 237, 223, 155, 224,
2412 189, 224, 224, 224, 151, 151, 151, 224, 189, 223,
2413 223, 151, 30, 18, 185, 157, 159, 161, 40, 209,
2414 183, 184, 151, 194, 194, 237, 151, 151, 151, 151,
2415 194, 151, 151, 151, 151, 39, 223, 223, 153, 151,
2416 151, 223, 18, 223, 224, 233, 151, 223, 151, 151,
2417 151, 223, 223, 223, 153, 189, 56, 181, 30, 151,
2418 151, 154, 194, 194, 194, 194, 194, 194, 194, 194,
2419 189, 151, 155, 233, 234, 223, 223, 151, 182, 182,
2420 151, 223, 151, 224, 224, 224, 234, 223, 18, 194,
2421 194, 151, 154, 151, 151, 154, 154, 154, 154, 154,
2422 15, 157, 176, 230, 154, 224, 157, 223, 154, 154,
2423 154, 194, 194, 194, 223, 221, 157, 176, 39, 157,
2424 154, 154, 154, 151, 221, 15, 15, 151, 223, 223,
2425 15, 228, 223, 15, 223
Reid Spencer319a7302007-01-05 17:20:02 +00002426};
Reid Spencere7c3c602006-11-30 06:36:44 +00002427
2428#define yyerrok (yyerrstatus = 0)
2429#define yyclearin (yychar = YYEMPTY)
Reid Spencer319a7302007-01-05 17:20:02 +00002430#define YYEMPTY (-2)
Reid Spencere7c3c602006-11-30 06:36:44 +00002431#define YYEOF 0
Reid Spencer319a7302007-01-05 17:20:02 +00002432
Reid Spencere7c3c602006-11-30 06:36:44 +00002433#define YYACCEPT goto yyacceptlab
Reid Spencer319a7302007-01-05 17:20:02 +00002434#define YYABORT goto yyabortlab
2435#define YYERROR goto yyerrorlab
2436
2437
2438/* Like YYERROR except do call yyerror. This remains here temporarily
2439 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencere7c3c602006-11-30 06:36:44 +00002440 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer319a7302007-01-05 17:20:02 +00002441
Reid Spencere7c3c602006-11-30 06:36:44 +00002442#define YYFAIL goto yyerrlab
Reid Spencer319a7302007-01-05 17:20:02 +00002443
Reid Spencere7c3c602006-11-30 06:36:44 +00002444#define YYRECOVERING() (!!yyerrstatus)
Reid Spencer319a7302007-01-05 17:20:02 +00002445
2446#define YYBACKUP(Token, Value) \
Reid Spencere7c3c602006-11-30 06:36:44 +00002447do \
2448 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencer319a7302007-01-05 17:20:02 +00002449 { \
2450 yychar = (Token); \
2451 yylval = (Value); \
2452 yytoken = YYTRANSLATE (yychar); \
Reid Spencere7c3c602006-11-30 06:36:44 +00002453 YYPOPSTACK; \
2454 goto yybackup; \
2455 } \
2456 else \
Reid Spencer319a7302007-01-05 17:20:02 +00002457 { \
2458 yyerror (YY_("syntax error: cannot back up")); \
2459 YYERROR; \
2460 } \
Reid Spencere7c3c602006-11-30 06:36:44 +00002461while (0)
2462
Reid Spencer319a7302007-01-05 17:20:02 +00002463
Reid Spencere7c3c602006-11-30 06:36:44 +00002464#define YYTERROR 1
2465#define YYERRCODE 256
2466
Reid Spencer319a7302007-01-05 17:20:02 +00002467
2468/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2469 If N is 0, then set CURRENT to the empty location which ends
2470 the previous symbol: RHS[0] (always defined). */
2471
2472#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2473#ifndef YYLLOC_DEFAULT
2474# define YYLLOC_DEFAULT(Current, Rhs, N) \
2475 do \
2476 if (N) \
2477 { \
2478 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2479 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2480 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2481 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2482 } \
2483 else \
2484 { \
2485 (Current).first_line = (Current).last_line = \
2486 YYRHSLOC (Rhs, 0).last_line; \
2487 (Current).first_column = (Current).last_column = \
2488 YYRHSLOC (Rhs, 0).last_column; \
2489 } \
2490 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002491#endif
2492
Reid Spencer319a7302007-01-05 17:20:02 +00002493
2494/* YY_LOCATION_PRINT -- Print the location on the stream.
2495 This macro was not mandated originally: define only if we know
2496 we won't break user code: when these are the locations we know. */
2497
2498#ifndef YY_LOCATION_PRINT
2499# if YYLTYPE_IS_TRIVIAL
2500# define YY_LOCATION_PRINT(File, Loc) \
2501 fprintf (File, "%d.%d-%d.%d", \
2502 (Loc).first_line, (Loc).first_column, \
2503 (Loc).last_line, (Loc).last_column)
2504# else
2505# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2506# endif
2507#endif
2508
2509
2510/* YYLEX -- calling `yylex' with the right arguments. */
2511
Reid Spencere7c3c602006-11-30 06:36:44 +00002512#ifdef YYLEX_PARAM
Reid Spencer319a7302007-01-05 17:20:02 +00002513# define YYLEX yylex (YYLEX_PARAM)
Reid Spencere7c3c602006-11-30 06:36:44 +00002514#else
Reid Spencer319a7302007-01-05 17:20:02 +00002515# define YYLEX yylex ()
Chris Lattner37e01c52007-01-04 18:46:42 +00002516#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002517
2518/* Enable debugging if requested. */
2519#if YYDEBUG
2520
2521# ifndef YYFPRINTF
2522# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2523# define YYFPRINTF fprintf
2524# endif
2525
2526# define YYDPRINTF(Args) \
2527do { \
2528 if (yydebug) \
2529 YYFPRINTF Args; \
2530} while (0)
2531
2532# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2533do { \
2534 if (yydebug) \
2535 { \
2536 YYFPRINTF (stderr, "%s ", Title); \
2537 yysymprint (stderr, \
2538 Type, Value); \
2539 YYFPRINTF (stderr, "\n"); \
2540 } \
2541} while (0)
2542
2543/*------------------------------------------------------------------.
2544| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2545| TOP (included). |
2546`------------------------------------------------------------------*/
2547
2548#if defined (__STDC__) || defined (__cplusplus)
2549static void
2550yy_stack_print (short int *bottom, short int *top)
Chris Lattner37e01c52007-01-04 18:46:42 +00002551#else
Reid Spencer319a7302007-01-05 17:20:02 +00002552static void
2553yy_stack_print (bottom, top)
2554 short int *bottom;
2555 short int *top;
Chris Lattner37e01c52007-01-04 18:46:42 +00002556#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002557{
2558 YYFPRINTF (stderr, "Stack now");
2559 for (/* Nothing. */; bottom <= top; ++bottom)
2560 YYFPRINTF (stderr, " %d", *bottom);
2561 YYFPRINTF (stderr, "\n");
2562}
2563
2564# define YY_STACK_PRINT(Bottom, Top) \
2565do { \
2566 if (yydebug) \
2567 yy_stack_print ((Bottom), (Top)); \
2568} while (0)
2569
2570
2571/*------------------------------------------------.
2572| Report that the YYRULE is going to be reduced. |
2573`------------------------------------------------*/
2574
2575#if defined (__STDC__) || defined (__cplusplus)
2576static void
2577yy_reduce_print (int yyrule)
2578#else
2579static void
2580yy_reduce_print (yyrule)
2581 int yyrule;
Reid Spencere7c3c602006-11-30 06:36:44 +00002582#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002583{
2584 int yyi;
2585 unsigned long int yylno = yyrline[yyrule];
2586 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2587 yyrule - 1, yylno);
2588 /* Print the symbols being reduced, and their result. */
2589 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2590 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2591 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2592}
Reid Spencere7c3c602006-11-30 06:36:44 +00002593
Reid Spencer319a7302007-01-05 17:20:02 +00002594# define YY_REDUCE_PRINT(Rule) \
2595do { \
2596 if (yydebug) \
2597 yy_reduce_print (Rule); \
2598} while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002599
Reid Spencer319a7302007-01-05 17:20:02 +00002600/* Nonzero means print parse trace. It is left uninitialized so that
2601 multiple parsers can coexist. */
2602int yydebug;
2603#else /* !YYDEBUG */
2604# define YYDPRINTF(Args)
2605# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2606# define YY_STACK_PRINT(Bottom, Top)
2607# define YY_REDUCE_PRINT(Rule)
2608#endif /* !YYDEBUG */
Reid Spencere7c3c602006-11-30 06:36:44 +00002609
Reid Spencere7c3c602006-11-30 06:36:44 +00002610
Reid Spencer319a7302007-01-05 17:20:02 +00002611/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002612#ifndef YYINITDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002613# define YYINITDEPTH 200
Reid Spencere7c3c602006-11-30 06:36:44 +00002614#endif
2615
Reid Spencer319a7302007-01-05 17:20:02 +00002616/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2617 if the built-in stack extension method is used).
Reid Spencere7c3c602006-11-30 06:36:44 +00002618
Reid Spencer319a7302007-01-05 17:20:02 +00002619 Do not make this value too large; the results are undefined if
2620 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2621 evaluated with infinite-precision integer arithmetic. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002622
2623#ifndef YYMAXDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002624# define YYMAXDEPTH 10000
Reid Spencere7c3c602006-11-30 06:36:44 +00002625#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002626
Reid Spencere7c3c602006-11-30 06:36:44 +00002627
2628
Reid Spencer319a7302007-01-05 17:20:02 +00002629#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00002630
Reid Spencer319a7302007-01-05 17:20:02 +00002631# ifndef yystrlen
2632# if defined (__GLIBC__) && defined (_STRING_H)
2633# define yystrlen strlen
2634# else
2635/* Return the length of YYSTR. */
2636static YYSIZE_T
2637# if defined (__STDC__) || defined (__cplusplus)
2638yystrlen (const char *yystr)
2639# else
2640yystrlen (yystr)
2641 const char *yystr;
2642# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002643{
Reid Spencer319a7302007-01-05 17:20:02 +00002644 const char *yys = yystr;
Chris Lattner37e01c52007-01-04 18:46:42 +00002645
Reid Spencer319a7302007-01-05 17:20:02 +00002646 while (*yys++ != '\0')
2647 continue;
2648
2649 return yys - yystr - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002650}
Reid Spencer319a7302007-01-05 17:20:02 +00002651# endif
2652# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002653
Reid Spencer319a7302007-01-05 17:20:02 +00002654# ifndef yystpcpy
2655# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2656# define yystpcpy stpcpy
2657# else
2658/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2659 YYDEST. */
2660static char *
2661# if defined (__STDC__) || defined (__cplusplus)
2662yystpcpy (char *yydest, const char *yysrc)
2663# else
2664yystpcpy (yydest, yysrc)
2665 char *yydest;
2666 const char *yysrc;
2667# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002668{
Reid Spencer319a7302007-01-05 17:20:02 +00002669 char *yyd = yydest;
2670 const char *yys = yysrc;
Chris Lattner37e01c52007-01-04 18:46:42 +00002671
Reid Spencer319a7302007-01-05 17:20:02 +00002672 while ((*yyd++ = *yys++) != '\0')
2673 continue;
2674
2675 return yyd - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002676}
Reid Spencer319a7302007-01-05 17:20:02 +00002677# endif
2678# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002679
Reid Spencer319a7302007-01-05 17:20:02 +00002680# ifndef yytnamerr
2681/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2682 quotes and backslashes, so that it's suitable for yyerror. The
2683 heuristic is that double-quoting is unnecessary unless the string
2684 contains an apostrophe, a comma, or backslash (other than
2685 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2686 null, do not copy; instead, return the length of what the result
2687 would have been. */
2688static YYSIZE_T
2689yytnamerr (char *yyres, const char *yystr)
2690{
2691 if (*yystr == '"')
2692 {
2693 size_t yyn = 0;
2694 char const *yyp = yystr;
2695
2696 for (;;)
2697 switch (*++yyp)
2698 {
2699 case '\'':
2700 case ',':
2701 goto do_not_strip_quotes;
2702
2703 case '\\':
2704 if (*++yyp != '\\')
2705 goto do_not_strip_quotes;
2706 /* Fall through. */
2707 default:
2708 if (yyres)
2709 yyres[yyn] = *yyp;
2710 yyn++;
2711 break;
2712
2713 case '"':
2714 if (yyres)
2715 yyres[yyn] = '\0';
2716 return yyn;
2717 }
2718 do_not_strip_quotes: ;
2719 }
2720
2721 if (! yyres)
2722 return yystrlen (yystr);
2723
2724 return yystpcpy (yyres, yystr) - yyres;
2725}
2726# endif
2727
2728#endif /* YYERROR_VERBOSE */
2729
Reid Spencere7c3c602006-11-30 06:36:44 +00002730
2731
Reid Spencer319a7302007-01-05 17:20:02 +00002732#if YYDEBUG
2733/*--------------------------------.
2734| Print this symbol on YYOUTPUT. |
2735`--------------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002736
Reid Spencer319a7302007-01-05 17:20:02 +00002737#if defined (__STDC__) || defined (__cplusplus)
2738static void
2739yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Chris Lattner37e01c52007-01-04 18:46:42 +00002740#else
Reid Spencer319a7302007-01-05 17:20:02 +00002741static void
2742yysymprint (yyoutput, yytype, yyvaluep)
2743 FILE *yyoutput;
2744 int yytype;
2745 YYSTYPE *yyvaluep;
2746#endif
2747{
2748 /* Pacify ``unused variable'' warnings. */
2749 (void) yyvaluep;
2750
2751 if (yytype < YYNTOKENS)
2752 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2753 else
2754 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2755
2756
2757# ifdef YYPRINT
2758 if (yytype < YYNTOKENS)
2759 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2760# endif
2761 switch (yytype)
2762 {
2763 default:
2764 break;
2765 }
2766 YYFPRINTF (yyoutput, ")");
2767}
2768
2769#endif /* ! YYDEBUG */
2770/*-----------------------------------------------.
2771| Release the memory associated to this symbol. |
2772`-----------------------------------------------*/
2773
2774#if defined (__STDC__) || defined (__cplusplus)
2775static void
2776yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2777#else
2778static void
2779yydestruct (yymsg, yytype, yyvaluep)
2780 const char *yymsg;
2781 int yytype;
2782 YYSTYPE *yyvaluep;
2783#endif
2784{
2785 /* Pacify ``unused variable'' warnings. */
2786 (void) yyvaluep;
2787
2788 if (!yymsg)
2789 yymsg = "Deleting";
2790 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2791
2792 switch (yytype)
2793 {
2794
2795 default:
2796 break;
2797 }
2798}
2799
2800
2801/* Prevent warnings from -Wmissing-prototypes. */
2802
2803#ifdef YYPARSE_PARAM
2804# if defined (__STDC__) || defined (__cplusplus)
2805int yyparse (void *YYPARSE_PARAM);
2806# else
2807int yyparse ();
2808# endif
2809#else /* ! YYPARSE_PARAM */
2810#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere7c3c602006-11-30 06:36:44 +00002811int yyparse (void);
Chris Lattner37e01c52007-01-04 18:46:42 +00002812#else
Reid Spencer319a7302007-01-05 17:20:02 +00002813int yyparse ();
2814#endif
2815#endif /* ! YYPARSE_PARAM */
2816
2817
2818
2819/* The look-ahead symbol. */
2820int yychar;
2821
2822/* The semantic value of the look-ahead symbol. */
2823YYSTYPE yylval;
2824
2825/* Number of syntax errors so far. */
2826int yynerrs;
2827
2828
2829
2830/*----------.
2831| yyparse. |
2832`----------*/
2833
2834#ifdef YYPARSE_PARAM
2835# if defined (__STDC__) || defined (__cplusplus)
2836int yyparse (void *YYPARSE_PARAM)
2837# else
2838int yyparse (YYPARSE_PARAM)
2839 void *YYPARSE_PARAM;
2840# endif
2841#else /* ! YYPARSE_PARAM */
2842#if defined (__STDC__) || defined (__cplusplus)
2843int
2844yyparse (void)
2845#else
2846int
2847yyparse ()
2848
2849#endif
2850#endif
2851{
2852
2853 int yystate;
2854 int yyn;
2855 int yyresult;
2856 /* Number of tokens to shift before error messages enabled. */
2857 int yyerrstatus;
2858 /* Look-ahead token as an internal (translated) token number. */
2859 int yytoken = 0;
2860
2861 /* Three stacks and their tools:
2862 `yyss': related to states,
2863 `yyvs': related to semantic values,
2864 `yyls': related to locations.
2865
2866 Refer to the stacks thru separate pointers, to allow yyoverflow
2867 to reallocate them elsewhere. */
2868
2869 /* The state stack. */
2870 short int yyssa[YYINITDEPTH];
2871 short int *yyss = yyssa;
2872 short int *yyssp;
2873
2874 /* The semantic value stack. */
2875 YYSTYPE yyvsa[YYINITDEPTH];
2876 YYSTYPE *yyvs = yyvsa;
2877 YYSTYPE *yyvsp;
2878
2879
2880
Reid Spencere7c3c602006-11-30 06:36:44 +00002881#define YYPOPSTACK (yyvsp--, yyssp--)
2882
Reid Spencer319a7302007-01-05 17:20:02 +00002883 YYSIZE_T yystacksize = YYINITDEPTH;
Reid Spencere7c3c602006-11-30 06:36:44 +00002884
Reid Spencer319a7302007-01-05 17:20:02 +00002885 /* The variables used to return semantic value and location from the
2886 action routines. */
2887 YYSTYPE yyval;
Reid Spencere7c3c602006-11-30 06:36:44 +00002888
2889
Reid Spencer319a7302007-01-05 17:20:02 +00002890 /* When reducing, the number of symbols on the RHS of the reduced
2891 rule. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002892 int yylen;
2893
Reid Spencer319a7302007-01-05 17:20:02 +00002894 YYDPRINTF ((stderr, "Starting parse\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002895
2896 yystate = 0;
2897 yyerrstatus = 0;
2898 yynerrs = 0;
2899 yychar = YYEMPTY; /* Cause a token to be read. */
2900
2901 /* Initialize stack pointers.
2902 Waste one element of value and location stack
2903 so that they stay on the same level as the state stack.
2904 The wasted elements are never initialized. */
2905
Reid Spencer319a7302007-01-05 17:20:02 +00002906 yyssp = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002907 yyvsp = yyvs;
2908
Reid Spencer319a7302007-01-05 17:20:02 +00002909 goto yysetstate;
Reid Spencere7c3c602006-11-30 06:36:44 +00002910
Reid Spencer319a7302007-01-05 17:20:02 +00002911/*------------------------------------------------------------.
2912| yynewstate -- Push a new state, which is found in yystate. |
2913`------------------------------------------------------------*/
2914 yynewstate:
2915 /* In all cases, when you get here, the value and location stacks
2916 have just been pushed. so pushing a state here evens the stacks.
2917 */
2918 yyssp++;
Reid Spencere7c3c602006-11-30 06:36:44 +00002919
Reid Spencer319a7302007-01-05 17:20:02 +00002920 yysetstate:
2921 *yyssp = yystate;
2922
2923 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002924 {
2925 /* Get the current used size of the three stacks, in elements. */
Reid Spencer319a7302007-01-05 17:20:02 +00002926 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002927
2928#ifdef yyoverflow
Reid Spencer319a7302007-01-05 17:20:02 +00002929 {
2930 /* Give user a chance to reallocate the stack. Use copies of
2931 these so that the &'s don't force the real ones into
2932 memory. */
2933 YYSTYPE *yyvs1 = yyvs;
2934 short int *yyss1 = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002935
Reid Spencer319a7302007-01-05 17:20:02 +00002936
2937 /* Each stack pointer address is followed by the size of the
2938 data in use in that stack, in bytes. This used to be a
2939 conditional around just the two extra args, but that might
2940 be undefined if yyoverflow is a macro. */
2941 yyoverflow (YY_("memory exhausted"),
2942 &yyss1, yysize * sizeof (*yyssp),
2943 &yyvs1, yysize * sizeof (*yyvsp),
2944
2945 &yystacksize);
2946
2947 yyss = yyss1;
2948 yyvs = yyvs1;
2949 }
Reid Spencere7c3c602006-11-30 06:36:44 +00002950#else /* no yyoverflow */
Reid Spencer319a7302007-01-05 17:20:02 +00002951# ifndef YYSTACK_RELOCATE
2952 goto yyexhaustedlab;
2953# else
Reid Spencere7c3c602006-11-30 06:36:44 +00002954 /* Extend the stack our own way. */
Reid Spencer319a7302007-01-05 17:20:02 +00002955 if (YYMAXDEPTH <= yystacksize)
2956 goto yyexhaustedlab;
Reid Spencere7c3c602006-11-30 06:36:44 +00002957 yystacksize *= 2;
Reid Spencer319a7302007-01-05 17:20:02 +00002958 if (YYMAXDEPTH < yystacksize)
Reid Spencere7c3c602006-11-30 06:36:44 +00002959 yystacksize = YYMAXDEPTH;
Reid Spencer319a7302007-01-05 17:20:02 +00002960
2961 {
2962 short int *yyss1 = yyss;
2963 union yyalloc *yyptr =
2964 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2965 if (! yyptr)
2966 goto yyexhaustedlab;
2967 YYSTACK_RELOCATE (yyss);
2968 YYSTACK_RELOCATE (yyvs);
2969
2970# undef YYSTACK_RELOCATE
2971 if (yyss1 != yyssa)
2972 YYSTACK_FREE (yyss1);
2973 }
2974# endif
Reid Spencere7c3c602006-11-30 06:36:44 +00002975#endif /* no yyoverflow */
2976
Reid Spencer319a7302007-01-05 17:20:02 +00002977 yyssp = yyss + yysize - 1;
2978 yyvsp = yyvs + yysize - 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002979
2980
Reid Spencer319a7302007-01-05 17:20:02 +00002981 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2982 (unsigned long int) yystacksize));
2983
2984 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002985 YYABORT;
2986 }
2987
Reid Spencer319a7302007-01-05 17:20:02 +00002988 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencere7c3c602006-11-30 06:36:44 +00002989
2990 goto yybackup;
Reid Spencer319a7302007-01-05 17:20:02 +00002991
2992/*-----------.
2993| yybackup. |
2994`-----------*/
2995yybackup:
Reid Spencere7c3c602006-11-30 06:36:44 +00002996
2997/* Do appropriate processing given the current state. */
Reid Spencer319a7302007-01-05 17:20:02 +00002998/* Read a look-ahead token if we need one and don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002999/* yyresume: */
3000
Reid Spencer319a7302007-01-05 17:20:02 +00003001 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003002
3003 yyn = yypact[yystate];
Reid Spencer319a7302007-01-05 17:20:02 +00003004 if (yyn == YYPACT_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00003005 goto yydefault;
3006
Reid Spencer319a7302007-01-05 17:20:02 +00003007 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003008
Reid Spencer319a7302007-01-05 17:20:02 +00003009 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003010 if (yychar == YYEMPTY)
3011 {
Reid Spencer319a7302007-01-05 17:20:02 +00003012 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencere7c3c602006-11-30 06:36:44 +00003013 yychar = YYLEX;
3014 }
3015
Reid Spencer319a7302007-01-05 17:20:02 +00003016 if (yychar <= YYEOF)
Reid Spencere7c3c602006-11-30 06:36:44 +00003017 {
Reid Spencer319a7302007-01-05 17:20:02 +00003018 yychar = yytoken = YYEOF;
3019 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00003020 }
3021 else
3022 {
Reid Spencer319a7302007-01-05 17:20:02 +00003023 yytoken = YYTRANSLATE (yychar);
3024 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00003025 }
3026
Reid Spencer319a7302007-01-05 17:20:02 +00003027 /* If the proper action on seeing token YYTOKEN is to reduce or to
3028 detect an error, take that action. */
3029 yyn += yytoken;
3030 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencere7c3c602006-11-30 06:36:44 +00003031 goto yydefault;
3032 yyn = yytable[yyn];
Reid Spencer319a7302007-01-05 17:20:02 +00003033 if (yyn <= 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00003034 {
Reid Spencer319a7302007-01-05 17:20:02 +00003035 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00003036 goto yyerrlab;
3037 yyn = -yyn;
3038 goto yyreduce;
3039 }
3040
3041 if (yyn == YYFINAL)
3042 YYACCEPT;
3043
Reid Spencer319a7302007-01-05 17:20:02 +00003044 /* Shift the look-ahead token. */
3045 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00003046
3047 /* Discard the token being shifted unless it is eof. */
3048 if (yychar != YYEOF)
3049 yychar = YYEMPTY;
3050
3051 *++yyvsp = yylval;
3052
Reid Spencer319a7302007-01-05 17:20:02 +00003053
3054 /* Count tokens shifted since error; after three, turn off error
3055 status. */
3056 if (yyerrstatus)
3057 yyerrstatus--;
Reid Spencere7c3c602006-11-30 06:36:44 +00003058
3059 yystate = yyn;
3060 goto yynewstate;
3061
Chris Lattner37e01c52007-01-04 18:46:42 +00003062
Reid Spencer319a7302007-01-05 17:20:02 +00003063/*-----------------------------------------------------------.
3064| yydefault -- do the default action for the current state. |
3065`-----------------------------------------------------------*/
3066yydefault:
Reid Spencere7c3c602006-11-30 06:36:44 +00003067 yyn = yydefact[yystate];
3068 if (yyn == 0)
3069 goto yyerrlab;
Reid Spencer319a7302007-01-05 17:20:02 +00003070 goto yyreduce;
Reid Spencere7c3c602006-11-30 06:36:44 +00003071
Reid Spencer319a7302007-01-05 17:20:02 +00003072
3073/*-----------------------------.
3074| yyreduce -- Do a reduction. |
3075`-----------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00003076yyreduce:
Reid Spencer319a7302007-01-05 17:20:02 +00003077 /* yyn is the number of a rule to reduce with. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003078 yylen = yyr2[yyn];
3079
Reid Spencer319a7302007-01-05 17:20:02 +00003080 /* If YYLEN is nonzero, implement the default value of the action:
3081 `$$ = $1'.
3082
3083 Otherwise, the following line sets YYVAL to garbage.
3084 This behavior is undocumented and Bison
3085 users should not rely upon it. Assigning to YYVAL
3086 unconditionally makes the parser a bit smaller, and it avoids a
3087 GCC warning that YYVAL may be used uninitialized. */
3088 yyval = yyvsp[1-yylen];
3089
3090
3091 YY_REDUCE_PRINT (yyn);
3092 switch (yyn)
Reid Spencere7c3c602006-11-30 06:36:44 +00003093 {
Reid Spencer319a7302007-01-05 17:20:02 +00003094 case 81:
Reid Spencer30d0c582007-01-15 00:26:18 +00003095#line 1058 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003096 {
3097 (yyval.String) = (yyvsp[-1].String);
3098 ;}
3099 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00003100
Reid Spencer319a7302007-01-05 17:20:02 +00003101 case 82:
Reid Spencer30d0c582007-01-15 00:26:18 +00003102#line 1061 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003103 {
3104 (yyval.String) = new std::string("");
3105 ;}
3106 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00003107
Reid Spencer319a7302007-01-05 17:20:02 +00003108 case 90:
Reid Spencer30d0c582007-01-15 00:26:18 +00003109#line 1068 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003110 { (yyval.String) = new std::string(""); ;}
3111 break;
Reid Spencere77e35e2006-12-01 20:26:20 +00003112
Reid Spencer319a7302007-01-05 17:20:02 +00003113 case 97:
Reid Spencer30d0c582007-01-15 00:26:18 +00003114#line 1073 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003115 {
3116 *(yyvsp[-1].String) += *(yyvsp[0].String);
3117 delete (yyvsp[0].String);
3118 (yyval.String) = (yyvsp[-1].String);
3119 ;}
3120 break;
Reid Spencer16244f42006-12-01 21:10:07 +00003121
Reid Spencer319a7302007-01-05 17:20:02 +00003122 case 98:
Reid Spencer30d0c582007-01-15 00:26:18 +00003123#line 1078 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003124 { (yyval.String) = new std::string(""); ;}
3125 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00003126
Reid Spencer319a7302007-01-05 17:20:02 +00003127 case 99:
Reid Spencer30d0c582007-01-15 00:26:18 +00003128#line 1083 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003129 { (yyval.String) = new std::string(); ;}
3130 break;
3131
Reid Spencerc4d96252007-01-13 00:03:30 +00003132 case 100:
Reid Spencer30d0c582007-01-15 00:26:18 +00003133#line 1084 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003134 { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
3135 break;
3136
3137 case 101:
Reid Spencer30d0c582007-01-15 00:26:18 +00003138#line 1087 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003139 { (yyval.String) = new std::string(); ;}
3140 break;
3141
3142 case 102:
Reid Spencer30d0c582007-01-15 00:26:18 +00003143#line 1088 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003144 {
3145 (yyvsp[-1].String)->insert(0, ", ");
3146 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3147 delete (yyvsp[0].String);
3148 (yyval.String) = (yyvsp[-1].String);
3149 ;}
3150 break;
3151
3152 case 103:
Reid Spencer30d0c582007-01-15 00:26:18 +00003153#line 1096 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003154 {
3155 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3156 delete (yyvsp[0].String);
3157 (yyval.String) = (yyvsp[-1].String);
3158 ;}
3159 break;
3160
3161 case 104:
Reid Spencer30d0c582007-01-15 00:26:18 +00003162#line 1102 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003163 { (yyval.String) = new std::string(); ;}
3164 break;
3165
Reid Spencerc4d96252007-01-13 00:03:30 +00003166 case 106:
Reid Spencer30d0c582007-01-15 00:26:18 +00003167#line 1106 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003168 { (yyval.String) = new std::string(); ;}
3169 break;
3170
Reid Spencer319a7302007-01-05 17:20:02 +00003171 case 107:
Reid Spencer30d0c582007-01-15 00:26:18 +00003172#line 1107 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003173 {
3174 (yyvsp[-1].String)->insert(0, ", ");
3175 if (!(yyvsp[0].String)->empty())
3176 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3177 delete (yyvsp[0].String);
3178 (yyval.String) = (yyvsp[-1].String);
3179 ;}
3180 break;
3181
3182 case 109:
Reid Spencer30d0c582007-01-15 00:26:18 +00003183#line 1117 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003184 {
3185 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3186 delete (yyvsp[0].String);
3187 (yyval.String) = (yyvsp[-1].String);
3188 ;}
3189 break;
3190
3191 case 127:
Reid Spencer30d0c582007-01-15 00:26:18 +00003192#line 1139 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003193 {
3194 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), OpaqueTy);
3195 ;}
3196 break;
3197
3198 case 128:
Reid Spencer30d0c582007-01-15 00:26:18 +00003199#line 1142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003200 {
3201 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UnresolvedTy);
3202 ;}
3203 break;
3204
3205 case 129:
Reid Spencer30d0c582007-01-15 00:26:18 +00003206#line 1145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003207 {
3208 (yyval.Type) = (yyvsp[0].Type);
3209 ;}
3210 break;
3211
3212 case 130:
Reid Spencer30d0c582007-01-15 00:26:18 +00003213#line 1148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003214 { // Type UpReference
3215 (yyvsp[0].String)->insert(0, "\\");
3216 (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UpRefTy);
3217 ;}
3218 break;
3219
3220 case 131:
Reid Spencer30d0c582007-01-15 00:26:18 +00003221#line 1152 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003222 { // Function derived type?
3223 std::string newTy( (yyvsp[-3].Type)->getNewTy() + "(");
3224 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003225 if (i != 0)
3226 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003227 if ((*(yyvsp[-1].TypeVec))[i]->isVoid())
Reid Spencer52402b02007-01-02 05:45:11 +00003228 newTy += "...";
3229 else
Reid Spencer319a7302007-01-05 17:20:02 +00003230 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003231 }
3232 newTy += ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003233 (yyval.Type) = TypeInfo::get(newTy, (yyvsp[-3].Type), (yyvsp[-1].TypeVec));
3234 ;}
3235 break;
3236
3237 case 132:
Reid Spencer30d0c582007-01-15 00:26:18 +00003238#line 1165 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003239 { // Sized array type?
3240 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3241 (yyvsp[-3].String)->insert(0,"[ ");
3242 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " ]";
3243 (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Type), elems);
3244 ;}
3245 break;
3246
3247 case 133:
Reid Spencer30d0c582007-01-15 00:26:18 +00003248#line 1171 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003249 { // Packed array type?
3250 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3251 (yyvsp[-3].String)->insert(0,"< ");
3252 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " >";
3253 (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), PackedTy, (yyvsp[-1].Type), elems);
3254 ;}
3255 break;
3256
3257 case 134:
Reid Spencer30d0c582007-01-15 00:26:18 +00003258#line 1177 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003259 { // Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003260 std::string newTy("{");
Reid Spencer319a7302007-01-05 17:20:02 +00003261 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003262 if (i != 0)
3263 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003264 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003265 }
3266 newTy += "}";
Reid Spencer319a7302007-01-05 17:20:02 +00003267 (yyval.Type) = TypeInfo::get(newTy, StructTy, (yyvsp[-1].TypeVec));
3268 ;}
3269 break;
3270
3271 case 135:
Reid Spencer30d0c582007-01-15 00:26:18 +00003272#line 1187 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003273 { // Empty structure type?
3274 (yyval.Type) = TypeInfo::get("{}", StructTy, new TypeList());
3275 ;}
3276 break;
3277
3278 case 136:
Reid Spencer30d0c582007-01-15 00:26:18 +00003279#line 1190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003280 { // Packed Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003281 std::string newTy("<{");
Reid Spencer319a7302007-01-05 17:20:02 +00003282 for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003283 if (i != 0)
3284 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003285 newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003286 }
3287 newTy += "}>";
Reid Spencer319a7302007-01-05 17:20:02 +00003288 (yyval.Type) = TypeInfo::get(newTy, PackedStructTy, (yyvsp[-2].TypeVec));
3289 ;}
3290 break;
3291
3292 case 137:
Reid Spencer30d0c582007-01-15 00:26:18 +00003293#line 1200 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003294 { // Empty packed structure type?
3295 (yyval.Type) = TypeInfo::get("<{}>", PackedStructTy, new TypeList());
3296 ;}
3297 break;
3298
3299 case 138:
Reid Spencer30d0c582007-01-15 00:26:18 +00003300#line 1203 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003301 { // Pointer type?
3302 (yyval.Type) = (yyvsp[-1].Type)->getPointerType();
3303 ;}
3304 break;
3305
3306 case 139:
Reid Spencer30d0c582007-01-15 00:26:18 +00003307#line 1211 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003308 {
3309 (yyval.TypeVec) = new TypeList();
3310 (yyval.TypeVec)->push_back((yyvsp[0].Type));
3311 ;}
3312 break;
3313
3314 case 140:
Reid Spencer30d0c582007-01-15 00:26:18 +00003315#line 1215 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003316 {
3317 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
3318 (yyval.TypeVec)->push_back((yyvsp[0].Type));
3319 ;}
3320 break;
3321
3322 case 142:
Reid Spencer30d0c582007-01-15 00:26:18 +00003323#line 1223 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003324 {
3325 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
3326 (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
3327 delete (yyvsp[0].String);
3328 ;}
3329 break;
3330
3331 case 143:
Reid Spencer30d0c582007-01-15 00:26:18 +00003332#line 1228 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003333 {
3334 (yyval.TypeVec) = new TypeList();
3335 (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy));
3336 delete (yyvsp[0].String);
3337 ;}
3338 break;
3339
3340 case 144:
Reid Spencer30d0c582007-01-15 00:26:18 +00003341#line 1233 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003342 {
3343 (yyval.TypeVec) = new TypeList();
3344 ;}
3345 break;
3346
3347 case 145:
Reid Spencer30d0c582007-01-15 00:26:18 +00003348#line 1243 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003349 { // Nonempty unsized arr
Reid Spencer30d0c582007-01-15 00:26:18 +00003350 (yyval.Const) = new ConstInfo;
3351 (yyval.Const)->type = (yyvsp[-3].Type);
3352 (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3353 *(yyval.Const)->cnst += " [ " + *(yyvsp[-1].String) + " ]";
Reid Spencer319a7302007-01-05 17:20:02 +00003354 delete (yyvsp[-1].String);
3355 ;}
3356 break;
3357
3358 case 146:
Reid Spencer30d0c582007-01-15 00:26:18 +00003359#line 1250 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003360 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003361 (yyval.Const) = new ConstInfo;
3362 (yyval.Const)->type = (yyvsp[-2].Type);
3363 (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3364 *(yyval.Const)->cnst += "[ ]";
Reid Spencer319a7302007-01-05 17:20:02 +00003365 ;}
3366 break;
3367
3368 case 147:
Reid Spencer30d0c582007-01-15 00:26:18 +00003369#line 1256 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003370 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003371 (yyval.Const) = new ConstInfo;
3372 (yyval.Const)->type = (yyvsp[-2].Type);
3373 (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3374 *(yyval.Const)->cnst += " c" + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003375 delete (yyvsp[0].String);
3376 ;}
3377 break;
3378
3379 case 148:
Reid Spencer30d0c582007-01-15 00:26:18 +00003380#line 1263 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003381 { // Nonempty unsized arr
Reid Spencer30d0c582007-01-15 00:26:18 +00003382 (yyval.Const) = new ConstInfo;
3383 (yyval.Const)->type = (yyvsp[-3].Type);
3384 (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3385 *(yyval.Const)->cnst += " < " + *(yyvsp[-1].String) + " >";
Reid Spencer319a7302007-01-05 17:20:02 +00003386 delete (yyvsp[-1].String);
3387 ;}
3388 break;
3389
3390 case 149:
Reid Spencer30d0c582007-01-15 00:26:18 +00003391#line 1270 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003392 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003393 (yyval.Const) = new ConstInfo;
3394 (yyval.Const)->type = (yyvsp[-3].Type);
3395 (yyval.Const)->cnst = new std::string((yyvsp[-3].Type)->getNewTy());
3396 *(yyval.Const)->cnst += " { " + *(yyvsp[-1].String) + " }";
Reid Spencer319a7302007-01-05 17:20:02 +00003397 delete (yyvsp[-1].String);
3398 ;}
3399 break;
3400
3401 case 150:
Reid Spencer30d0c582007-01-15 00:26:18 +00003402#line 1277 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003403 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003404 (yyval.Const) = new ConstInfo;
3405 (yyval.Const)->type = (yyvsp[-2].Type);
3406 (yyval.Const)->cnst = new std::string((yyvsp[-2].Type)->getNewTy());
3407 *(yyval.Const)->cnst += " {}";
Reid Spencer319a7302007-01-05 17:20:02 +00003408 ;}
3409 break;
3410
3411 case 151:
Reid Spencer30d0c582007-01-15 00:26:18 +00003412#line 1283 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003413 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003414 (yyval.Const) = new ConstInfo;
3415 (yyval.Const)->type = (yyvsp[-1].Type);
3416 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3417 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003418 delete (yyvsp[0].String);
3419 ;}
3420 break;
3421
3422 case 152:
Reid Spencer30d0c582007-01-15 00:26:18 +00003423#line 1290 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003424 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003425 (yyval.Const) = new ConstInfo;
3426 (yyval.Const)->type = (yyvsp[-1].Type);
3427 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3428 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003429 delete (yyvsp[0].String);
3430 ;}
3431 break;
3432
3433 case 153:
Reid Spencer30d0c582007-01-15 00:26:18 +00003434#line 1297 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003435 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003436 (yyval.Const) = new ConstInfo;
Reid Spencer319a7302007-01-05 17:20:02 +00003437 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve(), true);
Reid Spencer30d0c582007-01-15 00:26:18 +00003438 (yyval.Const)->type = (yyvsp[-1].Type);
3439 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3440 *(yyval.Const)->cnst += " " + Name;
Reid Spencer319a7302007-01-05 17:20:02 +00003441 delete (yyvsp[0].String);
3442 ;}
3443 break;
3444
3445 case 154:
Reid Spencer30d0c582007-01-15 00:26:18 +00003446#line 1305 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003447 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003448 (yyval.Const) = new ConstInfo;
3449 (yyval.Const)->type = (yyvsp[-1].Type);
3450 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3451 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003452 delete (yyvsp[0].String);
3453 ;}
3454 break;
3455
3456 case 155:
Reid Spencer30d0c582007-01-15 00:26:18 +00003457#line 1312 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003458 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003459 (yyval.Const) = new ConstInfo;
3460 (yyval.Const)->type = (yyvsp[-1].Type);
3461 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3462 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003463 delete (yyvsp[0].String);
3464 ;}
3465 break;
3466
3467 case 156:
Reid Spencer30d0c582007-01-15 00:26:18 +00003468#line 1319 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003469 { // integral constants
Reid Spencer30d0c582007-01-15 00:26:18 +00003470 (yyval.Const) = new ConstInfo;
3471 (yyval.Const)->type = (yyvsp[-1].Type);
3472 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3473 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003474 delete (yyvsp[0].String);
3475 ;}
3476 break;
3477
3478 case 157:
Reid Spencer30d0c582007-01-15 00:26:18 +00003479#line 1326 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003480 { // integral constants
Reid Spencer30d0c582007-01-15 00:26:18 +00003481 (yyval.Const) = new ConstInfo;
3482 (yyval.Const)->type = (yyvsp[-1].Type);
3483 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3484 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003485 delete (yyvsp[0].String);
3486 ;}
3487 break;
3488
3489 case 158:
Reid Spencer30d0c582007-01-15 00:26:18 +00003490#line 1333 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003491 { // Boolean constants
Reid Spencer30d0c582007-01-15 00:26:18 +00003492 (yyval.Const) = new ConstInfo;
3493 (yyval.Const)->type = (yyvsp[-1].Type);
3494 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3495 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003496 delete (yyvsp[0].String);
3497 ;}
3498 break;
3499
3500 case 159:
Reid Spencer30d0c582007-01-15 00:26:18 +00003501#line 1340 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003502 { // Boolean constants
Reid Spencer30d0c582007-01-15 00:26:18 +00003503 (yyval.Const) = new ConstInfo;
3504 (yyval.Const)->type = (yyvsp[-1].Type);
3505 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3506 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003507 delete (yyvsp[0].String);
3508 ;}
3509 break;
3510
3511 case 160:
Reid Spencer30d0c582007-01-15 00:26:18 +00003512#line 1347 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003513 { // Float & Double constants
Reid Spencer30d0c582007-01-15 00:26:18 +00003514 (yyval.Const) = new ConstInfo;
3515 (yyval.Const)->type = (yyvsp[-1].Type);
3516 (yyval.Const)->cnst = new std::string((yyvsp[-1].Type)->getNewTy());
3517 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003518 delete (yyvsp[0].String);
3519 ;}
3520 break;
3521
3522 case 161:
Reid Spencer30d0c582007-01-15 00:26:18 +00003523#line 1355 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003524 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003525 std::string source = *(yyvsp[-3].Const)->cnst;
3526 const TypeInfo* SrcTy = (yyvsp[-3].Const)->type->resolve();
Reid Spencer319a7302007-01-05 17:20:02 +00003527 const TypeInfo* DstTy = (yyvsp[-1].Type)->resolve();
3528 if (*(yyvsp[-5].String) == "cast") {
Reid Spencera50d5962006-12-02 04:11:07 +00003529 // Call getCastUpgrade to upgrade the old cast
Reid Spencer319a7302007-01-05 17:20:02 +00003530 (yyval.String) = new std::string(getCastUpgrade(source, SrcTy, DstTy, true));
Reid Spencera50d5962006-12-02 04:11:07 +00003531 } else {
3532 // Nothing to upgrade, just create the cast constant expr
Reid Spencer319a7302007-01-05 17:20:02 +00003533 (yyval.String) = new std::string(*(yyvsp[-5].String));
3534 *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Type)->getNewTy() + ")";
Reid Spencer280d8012006-12-01 23:40:53 +00003535 }
Reid Spencer30d0c582007-01-15 00:26:18 +00003536 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-2].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003537 ;}
3538 break;
3539
3540 case 162:
Reid Spencer30d0c582007-01-15 00:26:18 +00003541#line 1369 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003542 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003543 *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const)->cnst;
Reid Spencer319a7302007-01-05 17:20:02 +00003544 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
Reid Spencer30d0c582007-01-15 00:26:18 +00003545 ValueInfo* VI = (*(yyvsp[-1].ValList))[i];
3546 *(yyvsp[-4].String) += ", " + *VI->val;
3547 delete VI;
Reid Spencerf8483652006-12-02 15:16:01 +00003548 }
Reid Spencer319a7302007-01-05 17:20:02 +00003549 *(yyvsp[-4].String) += ")";
3550 (yyval.String) = (yyvsp[-4].String);
Reid Spencer30d0c582007-01-15 00:26:18 +00003551 delete (yyvsp[-2].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003552 delete (yyvsp[-1].ValList);
3553 ;}
3554 break;
3555
3556 case 163:
Reid Spencer30d0c582007-01-15 00:26:18 +00003557#line 1381 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003558 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003559 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3560 delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003561 (yyval.String) = (yyvsp[-7].String);
3562 ;}
3563 break;
3564
3565 case 164:
Reid Spencer30d0c582007-01-15 00:26:18 +00003566#line 1386 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003567 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003568 const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const)->type);
Reid Spencer319a7302007-01-05 17:20:02 +00003569 (yyval.String) = new std::string(op);
Reid Spencer30d0c582007-01-15 00:26:18 +00003570 *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3571 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003572 ;}
3573 break;
3574
3575 case 165:
Reid Spencer30d0c582007-01-15 00:26:18 +00003576#line 1392 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003577 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003578 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3579 delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003580 (yyval.String) = (yyvsp[-5].String);
3581 ;}
3582 break;
3583
3584 case 166:
Reid Spencer30d0c582007-01-15 00:26:18 +00003585#line 1397 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003586 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003587 *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const)->type);
3588 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3589 delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003590 (yyval.String) = (yyvsp[-5].String);
3591 ;}
3592 break;
3593
3594 case 167:
Reid Spencer30d0c582007-01-15 00:26:18 +00003595#line 1403 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003596 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003597 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3598 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003599 (yyval.String) = (yyvsp[-6].String);
3600 ;}
3601 break;
3602
3603 case 168:
Reid Spencer30d0c582007-01-15 00:26:18 +00003604#line 1408 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003605 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003606 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3607 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003608 (yyval.String) = (yyvsp[-6].String);
3609 ;}
3610 break;
3611
3612 case 169:
Reid Spencer30d0c582007-01-15 00:26:18 +00003613#line 1413 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003614 {
3615 const char* shiftop = (yyvsp[-5].String)->c_str();
3616 if (*(yyvsp[-5].String) == "shr")
Reid Spencer30d0c582007-01-15 00:26:18 +00003617 shiftop = ((yyvsp[-3].Const)->type->isUnsigned()) ? "lshr" : "ashr";
Reid Spencer319a7302007-01-05 17:20:02 +00003618 (yyval.String) = new std::string(shiftop);
Reid Spencer30d0c582007-01-15 00:26:18 +00003619 *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3620 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003621 ;}
3622 break;
3623
3624 case 170:
Reid Spencer30d0c582007-01-15 00:26:18 +00003625#line 1421 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003626 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003627 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3628 delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003629 (yyval.String) = (yyvsp[-5].String);
3630 ;}
3631 break;
3632
3633 case 171:
Reid Spencer30d0c582007-01-15 00:26:18 +00003634#line 1426 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003635 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003636 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3637 delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003638 (yyval.String) = (yyvsp[-7].String);
3639 ;}
3640 break;
3641
3642 case 172:
Reid Spencer30d0c582007-01-15 00:26:18 +00003643#line 1431 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003644 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003645 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3646 delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003647 (yyval.String) = (yyvsp[-7].String);
3648 ;}
3649 break;
3650
3651 case 173:
Reid Spencer30d0c582007-01-15 00:26:18 +00003652#line 1441 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003653 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003654 *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const)->cnst;
3655 delete (yyvsp[0].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003656 (yyval.String) = (yyvsp[-2].String);
3657 ;}
3658 break;
3659
3660 case 174:
Reid Spencer30d0c582007-01-15 00:26:18 +00003661#line 1446 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
3662 { (yyval.String) = new std::string(*(yyvsp[0].Const)->cnst); delete (yyvsp[0].Const); ;}
Reid Spencer319a7302007-01-05 17:20:02 +00003663 break;
3664
3665 case 177:
Reid Spencer30d0c582007-01-15 00:26:18 +00003666#line 1461 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003667 {
3668;}
3669 break;
3670
3671 case 178:
Reid Spencer30d0c582007-01-15 00:26:18 +00003672#line 1466 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003673 {
3674 (yyval.String) = 0;
3675 ;}
3676 break;
3677
3678 case 179:
Reid Spencer30d0c582007-01-15 00:26:18 +00003679#line 1469 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003680 {
3681 *O << *(yyvsp[0].String) << '\n';
3682 delete (yyvsp[0].String);
3683 (yyval.String) = 0;
3684 ;}
3685 break;
3686
3687 case 180:
Reid Spencer30d0c582007-01-15 00:26:18 +00003688#line 1474 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003689 {
3690 *O << "module asm " << ' ' << *(yyvsp[0].String) << '\n';
3691 (yyval.String) = 0;
3692 ;}
3693 break;
3694
3695 case 181:
Reid Spencer30d0c582007-01-15 00:26:18 +00003696#line 1478 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003697 {
Reid Spencerd154b572006-12-01 20:36:40 +00003698 *O << "implementation\n";
Reid Spencer319a7302007-01-05 17:20:02 +00003699 (yyval.String) = 0;
3700 ;}
3701 break;
3702
3703 case 182:
Reid Spencer30d0c582007-01-15 00:26:18 +00003704#line 1482 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003705 { (yyval.String) = 0; ;}
3706 break;
3707
3708 case 184:
Reid Spencer30d0c582007-01-15 00:26:18 +00003709#line 1484 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003710 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
3711 break;
3712
3713 case 185:
Reid Spencer30d0c582007-01-15 00:26:18 +00003714#line 1487 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003715 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003716 TypeInfo::EnumeratedTypes.push_back((yyvsp[0].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00003717 if (!(yyvsp[-2].String)->empty()) {
Reid Spencer30d0c582007-01-15 00:26:18 +00003718 TypeInfo::NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Type);
Reid Spencer319a7302007-01-05 17:20:02 +00003719 *O << *(yyvsp[-2].String) << " = ";
Reid Spencera50d5962006-12-02 04:11:07 +00003720 }
Reid Spencer319a7302007-01-05 17:20:02 +00003721 *O << "type " << (yyvsp[0].Type)->getNewTy() << '\n';
3722 delete (yyvsp[-2].String); delete (yyvsp[-1].String);
3723 (yyval.String) = 0;
3724 ;}
3725 break;
3726
3727 case 186:
Reid Spencer30d0c582007-01-15 00:26:18 +00003728#line 1497 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003729 { // Function prototypes can be in const pool
3730 *O << *(yyvsp[0].String) << '\n';
3731 delete (yyvsp[0].String);
3732 (yyval.String) = 0;
3733 ;}
3734 break;
3735
3736 case 187:
Reid Spencer30d0c582007-01-15 00:26:18 +00003737#line 1502 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003738 { // Asm blocks can be in the const pool
3739 *O << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3740 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3741 (yyval.String) = 0;
3742 ;}
3743 break;
3744
3745 case 188:
Reid Spencer30d0c582007-01-15 00:26:18 +00003746#line 1507 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003747 {
3748 if (!(yyvsp[-4].String)->empty()) {
Reid Spencer30d0c582007-01-15 00:26:18 +00003749 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const)->type->getPointerType(),
Reid Spencer319a7302007-01-05 17:20:02 +00003750 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003751 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003752 }
Reid Spencer30d0c582007-01-15 00:26:18 +00003753 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const)->cnst << ' ' << *(yyvsp[0].String) << '\n';
Reid Spencer319a7302007-01-05 17:20:02 +00003754 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3755 (yyval.String) = 0;
3756 ;}
3757 break;
3758
3759 case 189:
Reid Spencer30d0c582007-01-15 00:26:18 +00003760#line 1517 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003761 {
3762 if (!(yyvsp[-4].String)->empty()) {
3763 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3764 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003765 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003766 }
Reid Spencer319a7302007-01-05 17:20:02 +00003767 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3768 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3769 (yyval.String) = 0;
3770 ;}
3771 break;
3772
3773 case 190:
Reid Spencer30d0c582007-01-15 00:26:18 +00003774#line 1527 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003775 {
3776 if (!(yyvsp[-4].String)->empty()) {
3777 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3778 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003779 *O << Name << " = ";
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003780 }
Reid Spencer319a7302007-01-05 17:20:02 +00003781 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3782 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3783 (yyval.String) = 0;
3784 ;}
3785 break;
3786
3787 case 191:
Reid Spencer30d0c582007-01-15 00:26:18 +00003788#line 1537 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003789 {
3790 if (!(yyvsp[-4].String)->empty()) {
3791 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(),
3792 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003793 *O << Name << " = ";
Reid Spencerf5626a32007-01-01 01:20:41 +00003794 }
Reid Spencer319a7302007-01-05 17:20:02 +00003795 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
3796 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3797 (yyval.String) = 0;
3798 ;}
3799 break;
3800
3801 case 192:
Reid Spencer30d0c582007-01-15 00:26:18 +00003802#line 1547 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003803 {
3804 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3805 delete (yyvsp[-1].String); delete (yyvsp[0].String);
3806 (yyval.String) = 0;
3807 ;}
3808 break;
3809
3810 case 193:
Reid Spencer30d0c582007-01-15 00:26:18 +00003811#line 1552 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003812 {
3813 *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n';
3814 delete (yyvsp[-2].String); delete (yyvsp[0].String);
3815 (yyval.String) = 0;
3816 ;}
3817 break;
3818
3819 case 194:
Reid Spencer30d0c582007-01-15 00:26:18 +00003820#line 1557 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003821 {
3822 (yyval.String) = 0;
3823 ;}
3824 break;
3825
3826 case 198:
Reid Spencer30d0c582007-01-15 00:26:18 +00003827#line 1567 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003828 {
3829 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3830 delete (yyvsp[0].String);
3831 (yyval.String) = (yyvsp[-2].String);
3832 ;}
3833 break;
3834
3835 case 199:
Reid Spencer30d0c582007-01-15 00:26:18 +00003836#line 1572 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003837 {
3838 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3839 if (*(yyvsp[0].String) == "64")
Reid Spencere77e35e2006-12-01 20:26:20 +00003840 SizeOfPointer = 64;
Reid Spencer319a7302007-01-05 17:20:02 +00003841 delete (yyvsp[0].String);
3842 (yyval.String) = (yyvsp[-2].String);
3843 ;}
3844 break;
3845
3846 case 200:
Reid Spencer30d0c582007-01-15 00:26:18 +00003847#line 1579 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003848 {
3849 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3850 delete (yyvsp[0].String);
3851 (yyval.String) = (yyvsp[-2].String);
3852 ;}
3853 break;
3854
3855 case 201:
Reid Spencer30d0c582007-01-15 00:26:18 +00003856#line 1584 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003857 {
3858 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3859 delete (yyvsp[0].String);
3860 (yyval.String) = (yyvsp[-2].String);
3861 ;}
3862 break;
3863
3864 case 202:
Reid Spencer30d0c582007-01-15 00:26:18 +00003865#line 1591 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003866 {
3867 (yyvsp[-1].String)->insert(0, "[ ");
3868 *(yyvsp[-1].String) += " ]";
3869 (yyval.String) = (yyvsp[-1].String);
3870 ;}
3871 break;
3872
3873 case 203:
Reid Spencer30d0c582007-01-15 00:26:18 +00003874#line 1598 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003875 {
3876 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3877 delete (yyvsp[0].String);
3878 (yyval.String) = (yyvsp[-2].String);
3879 ;}
3880 break;
3881
3882 case 205:
Reid Spencer30d0c582007-01-15 00:26:18 +00003883#line 1604 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003884 {
3885 (yyval.String) = new std::string();
3886 ;}
3887 break;
3888
3889 case 209:
Reid Spencer30d0c582007-01-15 00:26:18 +00003890#line 1613 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003891 { (yyval.String) = new std::string(); ;}
3892 break;
3893
3894 case 210:
Reid Spencer30d0c582007-01-15 00:26:18 +00003895#line 1615 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003896 {
3897 (yyval.String) = new std::string((yyvsp[-1].Type)->getNewTy());
3898 if (!(yyvsp[0].String)->empty()) {
3899 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve());
3900 *(yyval.String) += " " + Name;
Reid Spencer52402b02007-01-02 05:45:11 +00003901 }
Reid Spencer319a7302007-01-05 17:20:02 +00003902 delete (yyvsp[0].String);
3903;}
3904 break;
3905
3906 case 211:
Reid Spencer30d0c582007-01-15 00:26:18 +00003907#line 1624 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003908 {
3909 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3910 delete (yyvsp[0].String);
3911 ;}
3912 break;
3913
3914 case 212:
Reid Spencer30d0c582007-01-15 00:26:18 +00003915#line 1628 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003916 {
3917 (yyval.String) = (yyvsp[0].String);
3918 ;}
3919 break;
3920
Reid Spencerc4d96252007-01-13 00:03:30 +00003921 case 213:
Reid Spencer30d0c582007-01-15 00:26:18 +00003922#line 1632 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003923 {
3924 (yyval.String) = (yyvsp[0].String);
3925 ;}
3926 break;
3927
Reid Spencer319a7302007-01-05 17:20:02 +00003928 case 214:
Reid Spencer30d0c582007-01-15 00:26:18 +00003929#line 1635 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003930 {
3931 *(yyvsp[-2].String) += ", ...";
3932 (yyval.String) = (yyvsp[-2].String);
3933 delete (yyvsp[0].String);
3934 ;}
3935 break;
3936
3937 case 215:
Reid Spencer30d0c582007-01-15 00:26:18 +00003938#line 1640 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003939 {
3940 (yyval.String) = (yyvsp[0].String);
3941 ;}
3942 break;
3943
3944 case 216:
Reid Spencer30d0c582007-01-15 00:26:18 +00003945#line 1643 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003946 { (yyval.String) = new std::string(); ;}
3947 break;
3948
3949 case 217:
Reid Spencer30d0c582007-01-15 00:26:18 +00003950#line 1646 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003951 {
Reid Spencerc4d96252007-01-13 00:03:30 +00003952 if (*(yyvsp[-5].String) == "%llvm.va_start" || *(yyvsp[-5].String) == "%llvm.va_end") {
Reid Spencerf0c9a652007-01-13 00:13:49 +00003953 *(yyvsp[-3].String) = "i8*";
Reid Spencerc4d96252007-01-13 00:03:30 +00003954 } else if (*(yyvsp[-5].String) == "%llvm.va_copy") {
3955 *(yyvsp[-3].String) = "i8*, i8*";
3956 }
Reid Spencer319a7302007-01-05 17:20:02 +00003957 if (!(yyvsp[-7].String)->empty()) {
3958 *(yyvsp[-7].String) += " ";
Reid Spencere77e35e2006-12-01 20:26:20 +00003959 }
Reid Spencer319a7302007-01-05 17:20:02 +00003960 *(yyvsp[-7].String) += (yyvsp[-6].Type)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
3961 if (!(yyvsp[-1].String)->empty()) {
3962 *(yyvsp[-7].String) += " " + *(yyvsp[-1].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003963 }
Reid Spencer319a7302007-01-05 17:20:02 +00003964 if (!(yyvsp[0].String)->empty()) {
3965 *(yyvsp[-7].String) += " " + *(yyvsp[0].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003966 }
Reid Spencer319a7302007-01-05 17:20:02 +00003967 delete (yyvsp[-5].String);
3968 delete (yyvsp[-3].String);
3969 delete (yyvsp[-1].String);
3970 delete (yyvsp[0].String);
3971 (yyval.String) = (yyvsp[-7].String);
3972 ;}
3973 break;
3974
3975 case 218:
Reid Spencer30d0c582007-01-15 00:26:18 +00003976#line 1669 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003977 { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
3978 break;
3979
3980 case 219:
Reid Spencer30d0c582007-01-15 00:26:18 +00003981#line 1670 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003982 { (yyval.String) = new std::string ("{"); ;}
3983 break;
3984
3985 case 220:
Reid Spencer30d0c582007-01-15 00:26:18 +00003986#line 1673 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003987 {
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003988 *O << "define ";
Reid Spencer319a7302007-01-05 17:20:02 +00003989 if (!(yyvsp[-2].String)->empty()) {
3990 *O << *(yyvsp[-2].String) << ' ';
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003991 }
Reid Spencer319a7302007-01-05 17:20:02 +00003992 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3993 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3994 (yyval.String) = 0;
3995 ;}
3996 break;
3997
3998 case 221:
Reid Spencer30d0c582007-01-15 00:26:18 +00003999#line 1684 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004000 { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
4001 break;
4002
4003 case 222:
Reid Spencer30d0c582007-01-15 00:26:18 +00004004#line 1685 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004005 { (yyval.String) = new std::string("}"); ;}
4006 break;
4007
4008 case 223:
Reid Spencer30d0c582007-01-15 00:26:18 +00004009#line 1687 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004010 {
4011 if ((yyvsp[-1].String))
4012 *O << *(yyvsp[-1].String);
4013 *O << *(yyvsp[0].String) << "\n\n";
4014 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
4015 (yyval.String) = 0;
4016;}
4017 break;
4018
4019 case 224:
Reid Spencer30d0c582007-01-15 00:26:18 +00004020#line 1696 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004021 { (yyval.String) = new std::string(); ;}
4022 break;
4023
4024 case 227:
Reid Spencer30d0c582007-01-15 00:26:18 +00004025#line 1702 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004026 { isDeclare = true; ;}
Reid Spencer319a7302007-01-05 17:20:02 +00004027 break;
4028
4029 case 228:
Reid Spencer30d0c582007-01-15 00:26:18 +00004030#line 1702 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004031 {
4032 if (!(yyvsp[-1].String)->empty())
4033 *(yyvsp[-3].String) += " " + *(yyvsp[-1].String);
4034 *(yyvsp[-3].String) += " " + *(yyvsp[0].String);
4035 delete (yyvsp[-1].String);
4036 delete (yyvsp[0].String);
4037 (yyval.String) = (yyvsp[-3].String);
4038 isDeclare = false;
4039 ;}
4040 break;
4041
4042 case 229:
Reid Spencer30d0c582007-01-15 00:26:18 +00004043#line 1716 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004044 { (yyval.String) = new std::string(); ;}
4045 break;
4046
Reid Spencerc4d96252007-01-13 00:03:30 +00004047 case 239:
Reid Spencer30d0c582007-01-15 00:26:18 +00004048#line 1722 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004049 {
4050 (yyvsp[-1].String)->insert(0, "<");
4051 *(yyvsp[-1].String) += ">";
4052 (yyval.String) = (yyvsp[-1].String);
4053 ;}
4054 break;
4055
Reid Spencerc4d96252007-01-13 00:03:30 +00004056 case 241:
Reid Spencer30d0c582007-01-15 00:26:18 +00004057#line 1728 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004058 {
4059 if (!(yyvsp[-3].String)->empty()) {
4060 *(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00004061 }
Reid Spencer319a7302007-01-05 17:20:02 +00004062 *(yyvsp[-4].String) += " " + *(yyvsp[-2].String) + ", " + *(yyvsp[0].String);
4063 delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
4064 (yyval.String) = (yyvsp[-4].String);
4065 ;}
4066 break;
4067
Reid Spencerc4d96252007-01-13 00:03:30 +00004068 case 244:
Reid Spencer30d0c582007-01-15 00:26:18 +00004069#line 1741 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004070 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004071 (yyval.Value) = new ValueInfo;
4072 (yyval.Value)->val = (yyvsp[0].String);
4073 (yyval.Value)->constant = false;
4074 (yyval.Value)->type = 0;
Reid Spencer319a7302007-01-05 17:20:02 +00004075 ;}
4076 break;
4077
Reid Spencerc4d96252007-01-13 00:03:30 +00004078 case 245:
Reid Spencer30d0c582007-01-15 00:26:18 +00004079#line 1747 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004080 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004081 (yyval.Value) = new ValueInfo;
4082 (yyval.Value)->val = (yyvsp[0].String);
4083 (yyval.Value)->constant = true;
4084 (yyval.Value)->type = 0;
Reid Spencer319a7302007-01-05 17:20:02 +00004085 ;}
4086 break;
4087
Reid Spencerc4d96252007-01-13 00:03:30 +00004088 case 246:
Reid Spencer30d0c582007-01-15 00:26:18 +00004089#line 1758 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004090 {
4091 (yyvsp[-1].Type) = (yyvsp[-1].Type)->resolve();
Reid Spencer30d0c582007-01-15 00:26:18 +00004092 std::string Name = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-1].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004093 (yyval.Value) = (yyvsp[0].Value);
Reid Spencer30d0c582007-01-15 00:26:18 +00004094 delete (yyval.Value)->val;
4095 (yyval.Value)->val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name);
4096 (yyval.Value)->type = (yyvsp[-1].Type);
Reid Spencer319a7302007-01-05 17:20:02 +00004097 ;}
4098 break;
4099
Reid Spencer319a7302007-01-05 17:20:02 +00004100 case 247:
Reid Spencer30d0c582007-01-15 00:26:18 +00004101#line 1767 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004102 {
Reid Spencer319a7302007-01-05 17:20:02 +00004103 (yyval.String) = 0;
4104 ;}
4105 break;
4106
4107 case 248:
Reid Spencer30d0c582007-01-15 00:26:18 +00004108#line 1770 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004109 { // Do not allow functions with 0 basic blocks
Reid Spencer319a7302007-01-05 17:20:02 +00004110 (yyval.String) = 0;
4111 ;}
4112 break;
4113
4114 case 249:
Reid Spencer30d0c582007-01-15 00:26:18 +00004115#line 1778 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004116 {
4117 (yyval.String) = 0;
4118 ;}
4119 break;
4120
4121 case 250:
Reid Spencer30d0c582007-01-15 00:26:18 +00004122#line 1782 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004123 {
4124 *O << " " << *(yyvsp[0].String) << '\n';
4125 delete (yyvsp[0].String);
4126 (yyval.String) = 0;
4127 ;}
4128 break;
4129
Reid Spencerc4d96252007-01-13 00:03:30 +00004130 case 251:
Reid Spencer30d0c582007-01-15 00:26:18 +00004131#line 1787 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004132 {
4133 (yyval.String) = 0;
4134 ;}
4135 break;
4136
Reid Spencerc4d96252007-01-13 00:03:30 +00004137 case 252:
Reid Spencer30d0c582007-01-15 00:26:18 +00004138#line 1790 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004139 {
4140 *O << *(yyvsp[0].String) << '\n';
4141 delete (yyvsp[0].String);
4142 (yyval.String) = 0;
4143 ;}
4144 break;
4145
Reid Spencerc4d96252007-01-13 00:03:30 +00004146 case 254:
Reid Spencer30d0c582007-01-15 00:26:18 +00004147#line 1796 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004148 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
4149 break;
4150
Reid Spencerc4d96252007-01-13 00:03:30 +00004151 case 255:
Reid Spencer30d0c582007-01-15 00:26:18 +00004152#line 1798 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004153 { // Return with a result...
Reid Spencer30d0c582007-01-15 00:26:18 +00004154 *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Value)->val << '\n';
4155 delete (yyvsp[-1].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004156 (yyval.String) = 0;
4157 ;}
4158 break;
4159
Reid Spencerc4d96252007-01-13 00:03:30 +00004160 case 256:
Reid Spencer30d0c582007-01-15 00:26:18 +00004161#line 1803 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004162 { // Return with no result...
4163 *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Type)->getNewTy() << '\n';
4164 delete (yyvsp[-1].String);
4165 (yyval.String) = 0;
4166 ;}
4167 break;
4168
Reid Spencerc4d96252007-01-13 00:03:30 +00004169 case 257:
Reid Spencer30d0c582007-01-15 00:26:18 +00004170#line 1808 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004171 { // Unconditional Branch...
Reid Spencer30d0c582007-01-15 00:26:18 +00004172 *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value)->val << '\n';
4173 delete (yyvsp[-2].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004174 (yyval.String) = 0;
4175 ;}
4176 break;
4177
Reid Spencerc4d96252007-01-13 00:03:30 +00004178 case 258:
Reid Spencer30d0c582007-01-15 00:26:18 +00004179#line 1813 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004180 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004181 std::string Name = getUniqueName((yyvsp[-6].Value)->val, (yyvsp[-7].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004182 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", "
Reid Spencer30d0c582007-01-15 00:26:18 +00004183 << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value)->val << ", " << (yyvsp[-1].Type)->getNewTy() << ' '
4184 << *(yyvsp[0].Value)->val << '\n';
4185 delete (yyvsp[-8].String); delete (yyvsp[-6].Value); delete (yyvsp[-3].Value); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004186 (yyval.String) = 0;
4187 ;}
4188 break;
4189
Reid Spencerc4d96252007-01-13 00:03:30 +00004190 case 259:
Reid Spencer30d0c582007-01-15 00:26:18 +00004191#line 1821 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004192 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004193 std::string Name = getUniqueName((yyvsp[-6].Value)->val, (yyvsp[-7].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004194 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", "
Reid Spencer30d0c582007-01-15 00:26:18 +00004195 << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value)->val << " [" << *(yyvsp[-1].String) << " ]\n";
4196 delete (yyvsp[-8].String);
4197 delete (yyvsp[-6].Value);
4198 delete (yyvsp[-3].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004199 delete (yyvsp[-1].String);
4200 (yyval.String) = 0;
4201 ;}
4202 break;
4203
Reid Spencerc4d96252007-01-13 00:03:30 +00004204 case 260:
Reid Spencer30d0c582007-01-15 00:26:18 +00004205#line 1831 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004206 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004207 std::string Name = getUniqueName((yyvsp[-5].Value)->val, (yyvsp[-6].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004208 *O << " " << *(yyvsp[-7].String) << ' ' << (yyvsp[-6].Type)->getNewTy() << ' ' << Name << ", "
Reid Spencer30d0c582007-01-15 00:26:18 +00004209 << (yyvsp[-3].Type)->getNewTy() << ' ' << *(yyvsp[-2].Value)->val << "[]\n";
4210 delete (yyvsp[-7].String);
4211 delete (yyvsp[-5].Value);
4212 delete (yyvsp[-2].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004213 (yyval.String) = 0;
4214 ;}
4215 break;
4216
Reid Spencerc4d96252007-01-13 00:03:30 +00004217 case 261:
Reid Spencer30d0c582007-01-15 00:26:18 +00004218#line 1841 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004219 {
4220 const TypeInfo* ResTy = getFunctionReturnType((yyvsp[-10].Type));
Reid Spencer16244f42006-12-01 21:10:07 +00004221 *O << " ";
Reid Spencer319a7302007-01-05 17:20:02 +00004222 if (!(yyvsp[-13].String)->empty()) {
4223 std::string Name = getUniqueName((yyvsp[-13].String), ResTy);
Reid Spencer52402b02007-01-02 05:45:11 +00004224 *O << Name << " = ";
4225 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004226 *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Type)->getNewTy() << ' ' << *(yyvsp[-9].Value)->val << " (";
Reid Spencer319a7302007-01-05 17:20:02 +00004227 for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) {
Reid Spencer30d0c582007-01-15 00:26:18 +00004228 ValueInfo* VI = (*(yyvsp[-7].ValList))[i];
4229 *O << *VI->val;
Reid Spencer319a7302007-01-05 17:20:02 +00004230 if (i+1 < (yyvsp[-7].ValList)->size())
Reid Spencerf8483652006-12-02 15:16:01 +00004231 *O << ", ";
Reid Spencer30d0c582007-01-15 00:26:18 +00004232 delete VI;
Reid Spencerf8483652006-12-02 15:16:01 +00004233 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004234 *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value)->val << ' '
4235 << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value)->val << '\n';
4236 delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); delete (yyvsp[-9].Value); delete (yyvsp[-7].ValList);
4237 delete (yyvsp[-5].String); delete (yyvsp[-3].Value); delete (yyvsp[-2].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004238 (yyval.String) = 0;
4239 ;}
4240 break;
4241
Reid Spencer319a7302007-01-05 17:20:02 +00004242 case 262:
Reid Spencer30d0c582007-01-15 00:26:18 +00004243#line 1862 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004244 {
4245 *O << " " << *(yyvsp[0].String) << '\n';
4246 delete (yyvsp[0].String);
4247 (yyval.String) = 0;
4248 ;}
4249 break;
4250
4251 case 263:
Reid Spencer30d0c582007-01-15 00:26:18 +00004252#line 1867 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004253 {
4254 *O << " " << *(yyvsp[0].String) << '\n';
4255 delete (yyvsp[0].String);
4256 (yyval.String) = 0;
4257 ;}
4258 break;
4259
4260 case 264:
Reid Spencer30d0c582007-01-15 00:26:18 +00004261#line 1873 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004262 {
4263 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Type)->getNewTy() + " " +
Reid Spencer30d0c582007-01-15 00:26:18 +00004264 *(yyvsp[0].Value)->val;
4265 delete (yyvsp[-3].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004266 (yyval.String) = (yyvsp[-5].String);
4267 ;}
4268 break;
4269
Reid Spencerc4d96252007-01-13 00:03:30 +00004270 case 265:
Reid Spencer30d0c582007-01-15 00:26:18 +00004271#line 1879 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004272 {
4273 (yyvsp[-3].String)->insert(0, (yyvsp[-4].Type)->getNewTy() + " " );
Reid Spencer30d0c582007-01-15 00:26:18 +00004274 *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value)->val;
4275 delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004276 (yyval.String) = (yyvsp[-3].String);
4277 ;}
4278 break;
4279
Reid Spencerc4d96252007-01-13 00:03:30 +00004280 case 266:
Reid Spencer30d0c582007-01-15 00:26:18 +00004281#line 1887 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004282 {
4283 if (!(yyvsp[-1].String)->empty()) {
4284 // Get a unique name for this value, based on its type.
Reid Spencer30d0c582007-01-15 00:26:18 +00004285 std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value)->type);
Reid Spencer319a7302007-01-05 17:20:02 +00004286 *(yyvsp[-1].String) = Name + " = ";
4287 if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
4288 // don't actually delete it, just comment it out
4289 (yyvsp[-1].String)->insert(0, "; USELSS BITCAST: ");
Reid Spencerf5626a32007-01-01 01:20:41 +00004290 delete deleteUselessCastName;
Reid Spencerf5626a32007-01-01 01:20:41 +00004291 }
4292 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004293 *(yyvsp[-1].String) += *(yyvsp[0].Value)->val;
4294 delete (yyvsp[0].Value);
Reid Spencerf5626a32007-01-01 01:20:41 +00004295 deleteUselessCastFlag = false;
Reid Spencer319a7302007-01-05 17:20:02 +00004296 (yyval.String) = (yyvsp[-1].String);
4297 ;}
4298 break;
4299
Reid Spencerc4d96252007-01-13 00:03:30 +00004300 case 267:
Reid Spencer30d0c582007-01-15 00:26:18 +00004301#line 1905 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004302 { // Used for PHI nodes
Reid Spencer30d0c582007-01-15 00:26:18 +00004303 std::string Name = getUniqueName((yyvsp[-3].Value)->val, (yyvsp[-5].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004304 Name.insert(0, (yyvsp[-5].Type)->getNewTy() + "[");
Reid Spencer30d0c582007-01-15 00:26:18 +00004305 Name += "," + *(yyvsp[-1].Value)->val + "]";
4306 (yyval.Value) = new ValueInfo;
4307 (yyval.Value)->val = new std::string(Name);
4308 (yyval.Value)->type = (yyvsp[-5].Type);
4309 delete (yyvsp[-3].Value); delete (yyvsp[-1].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004310 ;}
4311 break;
4312
Reid Spencerc4d96252007-01-13 00:03:30 +00004313 case 268:
Reid Spencer30d0c582007-01-15 00:26:18 +00004314#line 1914 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004315 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004316 std::string Name = getUniqueName((yyvsp[-3].Value)->val, (yyvsp[-6].Value)->type);
4317 *(yyvsp[-6].Value)->val += ", [" + Name + "," + *(yyvsp[-1].Value)->val + "]";
4318 delete (yyvsp[-3].Value);
4319 delete (yyvsp[-1].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004320 (yyval.Value) = (yyvsp[-6].Value);
4321 ;}
4322 break;
4323
Reid Spencerc4d96252007-01-13 00:03:30 +00004324 case 269:
Reid Spencer30d0c582007-01-15 00:26:18 +00004325#line 1924 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004326 {
4327 (yyval.ValList) = new ValueList();
4328 (yyval.ValList)->push_back((yyvsp[0].Value));
4329 ;}
4330 break;
4331
Reid Spencerc4d96252007-01-13 00:03:30 +00004332 case 270:
Reid Spencer30d0c582007-01-15 00:26:18 +00004333#line 1928 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004334 {
4335 (yyval.ValList) = (yyvsp[-2].ValList);
4336 (yyval.ValList)->push_back((yyvsp[0].Value));
4337 ;}
4338 break;
4339
Reid Spencerc4d96252007-01-13 00:03:30 +00004340 case 271:
Reid Spencer30d0c582007-01-15 00:26:18 +00004341#line 1935 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004342 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4343 break;
4344
Reid Spencerc4d96252007-01-13 00:03:30 +00004345 case 272:
Reid Spencer30d0c582007-01-15 00:26:18 +00004346#line 1936 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004347 { (yyval.ValList) = new ValueList(); ;}
4348 break;
4349
Reid Spencerc4d96252007-01-13 00:03:30 +00004350 case 273:
Reid Spencer30d0c582007-01-15 00:26:18 +00004351#line 1940 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004352 {
4353 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
4354 delete (yyvsp[0].String);
4355 (yyval.String) = (yyvsp[-1].String);
4356 ;}
4357 break;
4358
Reid Spencerc4d96252007-01-13 00:03:30 +00004359 case 275:
Reid Spencer30d0c582007-01-15 00:26:18 +00004360#line 1948 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004361 {
4362 const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type));
Reid Spencer30d0c582007-01-15 00:26:18 +00004363 std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
4364 std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
4365 (yyval.Value) = (yyvsp[-2].Value);
4366 delete (yyval.Value)->val;
4367 (yyval.Value)->val = new std::string(op);
4368 *(yyval.Value)->val += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
4369 (yyval.Value)->type = (yyvsp[-3].Type);
4370 delete (yyvsp[-4].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004371 ;}
4372 break;
4373
Reid Spencerc4d96252007-01-13 00:03:30 +00004374 case 276:
Reid Spencer30d0c582007-01-15 00:26:18 +00004375#line 1959 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004376 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004377 std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
4378 std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004379 *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
Reid Spencer30d0c582007-01-15 00:26:18 +00004380 (yyval.Value) = (yyvsp[-2].Value);
4381 delete (yyval.Value)->val;
4382 (yyval.Value)->val = (yyvsp[-4].String);
4383 (yyval.Value)->type = (yyvsp[-3].Type);
4384 delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004385 ;}
4386 break;
4387
Reid Spencerc4d96252007-01-13 00:03:30 +00004388 case 277:
Reid Spencer30d0c582007-01-15 00:26:18 +00004389#line 1969 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004390 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004391 std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
4392 std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004393 *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
4394 *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2;
Reid Spencer30d0c582007-01-15 00:26:18 +00004395 (yyval.Value) = (yyvsp[-2].Value);
4396 delete (yyval.Value)->val;
4397 (yyval.Value)->val = (yyvsp[-4].String);
4398 (yyval.Value)->type = TypeInfo::get("i1",BoolTy);
4399 delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004400 ;}
4401 break;
4402
Reid Spencer319a7302007-01-05 17:20:02 +00004403 case 278:
Reid Spencer30d0c582007-01-15 00:26:18 +00004404#line 1980 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004405 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004406 std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
4407 std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004408 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
Reid Spencer30d0c582007-01-15 00:26:18 +00004409 (yyval.Value) = (yyvsp[-2].Value);
4410 delete (yyval.Value)->val;
4411 (yyval.Value)->val = (yyvsp[-5].String);
4412 (yyval.Value)->type = TypeInfo::get("i1",BoolTy);
4413 delete (yyvsp[-4].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004414 ;}
4415 break;
4416
4417 case 279:
Reid Spencer30d0c582007-01-15 00:26:18 +00004418#line 1990 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004419 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004420 std::string Name1 = getUniqueName((yyvsp[-2].Value)->val, (yyvsp[-3].Type));
4421 std::string Name2 = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-3].Type));
Reid Spencerc4d96252007-01-13 00:03:30 +00004422 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2;
Reid Spencer30d0c582007-01-15 00:26:18 +00004423 (yyval.Value) = (yyvsp[-2].Value);
4424 delete (yyval.Value)->val;
4425 (yyval.Value)->val = (yyvsp[-5].String);
4426 (yyval.Value)->type = TypeInfo::get("i1",BoolTy);
4427 delete (yyvsp[-4].String); delete (yyvsp[0].Value);
Reid Spencerc4d96252007-01-13 00:03:30 +00004428 ;}
4429 break;
4430
4431 case 280:
Reid Spencer30d0c582007-01-15 00:26:18 +00004432#line 2000 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004433 {
4434 const char* shiftop = (yyvsp[-3].String)->c_str();
4435 if (*(yyvsp[-3].String) == "shr")
Reid Spencer30d0c582007-01-15 00:26:18 +00004436 shiftop = ((yyvsp[-2].Value)->type->isUnsigned()) ? "lshr" : "ashr";
4437 std::string *val = new std::string(shiftop);
4438 *val += " " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
4439 (yyval.Value) = (yyvsp[-2].Value);
4440 delete (yyval.Value)->val;
4441 (yyval.Value)->val = val;
4442 delete (yyvsp[-3].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004443 ;}
4444 break;
4445
Reid Spencerc4d96252007-01-13 00:03:30 +00004446 case 281:
Reid Spencer30d0c582007-01-15 00:26:18 +00004447#line 2011 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004448 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004449 std::string source = *(yyvsp[-2].Value)->val;
4450 const TypeInfo* SrcTy = (yyvsp[-2].Value)->type->resolve();
Reid Spencer319a7302007-01-05 17:20:02 +00004451 const TypeInfo* DstTy = (yyvsp[0].Type)->resolve();
Reid Spencer30d0c582007-01-15 00:26:18 +00004452 (yyval.Value) = (yyvsp[-2].Value);
4453 delete (yyval.Value)->val;
4454 (yyval.Value)->val = new std::string();
4455 (yyval.Value)->type = DstTy;
Reid Spencer319a7302007-01-05 17:20:02 +00004456 if (*(yyvsp[-3].String) == "cast") {
Reid Spencer30d0c582007-01-15 00:26:18 +00004457 *(yyval.Value)->val += getCastUpgrade(source, SrcTy, DstTy, false);
Reid Spencera50d5962006-12-02 04:11:07 +00004458 } else {
Reid Spencer30d0c582007-01-15 00:26:18 +00004459 *(yyval.Value)->val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
Reid Spencer280d8012006-12-01 23:40:53 +00004460 }
Reid Spencerf5626a32007-01-01 01:20:41 +00004461 // Check to see if this is a useless cast of a value to the same name
4462 // and the same type. Such casts will probably cause redefinition errors
4463 // when assembled and perform no code gen action so just remove them.
Reid Spencer319a7302007-01-05 17:20:02 +00004464 if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast")
4465 if (SrcTy->isInteger() && DstTy->isInteger() &&
4466 SrcTy->getBitWidth() == DstTy->getBitWidth()) {
Reid Spencerf5626a32007-01-01 01:20:41 +00004467 deleteUselessCastFlag = true; // Flag the "Inst" rule
Reid Spencer30d0c582007-01-15 00:26:18 +00004468 deleteUselessCastName = new std::string(*(yyvsp[-2].Value)->val); // save the name
Reid Spencerf5626a32007-01-01 01:20:41 +00004469 size_t pos = deleteUselessCastName->find_first_of("%\"",0);
4470 if (pos != std::string::npos) {
4471 // remove the type portion before val
4472 deleteUselessCastName->erase(0, pos);
4473 }
4474 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004475 delete (yyvsp[-3].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004476 delete (yyvsp[-1].String);
4477 ;}
4478 break;
4479
Reid Spencerc4d96252007-01-13 00:03:30 +00004480 case 282:
Reid Spencer30d0c582007-01-15 00:26:18 +00004481#line 2041 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004482 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004483 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value)->val + ", " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
4484 (yyval.Value) = (yyvsp[-4].Value);
4485 delete (yyval.Value)->val;
4486 (yyval.Value)->val = (yyvsp[-5].String);
4487 (yyval.Value)->type = (yyvsp[-2].Value)->type;
4488 delete (yyvsp[-2].Value);
4489 delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004490 ;}
4491 break;
4492
Reid Spencerc4d96252007-01-13 00:03:30 +00004493 case 283:
Reid Spencer30d0c582007-01-15 00:26:18 +00004494#line 2050 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004495 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004496 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value)->val + ", " + (yyvsp[0].Type)->getNewTy();
4497 (yyval.Value) = (yyvsp[-2].Value);
4498 delete (yyval.Value)->val;
4499 (yyval.Value)->val = (yyvsp[-3].String);
4500 (yyval.Value)->type = (yyvsp[0].Type);
Reid Spencer319a7302007-01-05 17:20:02 +00004501 ;}
4502 break;
4503
Reid Spencerc4d96252007-01-13 00:03:30 +00004504 case 284:
Reid Spencer30d0c582007-01-15 00:26:18 +00004505#line 2057 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004506 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004507 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
4508 (yyval.Value) = (yyvsp[-2].Value);
4509 delete (yyval.Value)->val;
4510 (yyval.Value)->val = (yyvsp[-3].String);
4511 (yyval.Value)->type = (yyval.Value)->type->resolve();
4512 (yyval.Value)->type = (yyval.Value)->type->getElementType();
4513 delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004514 ;}
4515 break;
4516
4517 case 285:
Reid Spencer30d0c582007-01-15 00:26:18 +00004518#line 2066 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004519 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004520 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value)->val + ", " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
4521 (yyval.Value) = (yyvsp[-4].Value);
4522 delete (yyval.Value)->val;
4523 (yyval.Value)->val = (yyvsp[-5].String);
4524 delete (yyvsp[-2].Value); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004525 ;}
4526 break;
4527
4528 case 286:
Reid Spencer30d0c582007-01-15 00:26:18 +00004529#line 2073 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004530 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004531 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value)->val + ", " + *(yyvsp[-2].Value)->val + ", " + *(yyvsp[0].Value)->val;
4532 (yyval.Value) = (yyvsp[-4].Value);
4533 delete (yyval.Value)->val;
4534 (yyval.Value)->val = (yyvsp[-5].String);
4535 delete (yyvsp[-2].Value); delete (yyvsp[0].Value);
Reid Spencerc4d96252007-01-13 00:03:30 +00004536 ;}
4537 break;
4538
4539 case 287:
Reid Spencer30d0c582007-01-15 00:26:18 +00004540#line 2080 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004541 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004542 *(yyvsp[-1].String) += " " + *(yyvsp[0].Value)->val;
4543 (yyval.Value) = (yyvsp[0].Value);
4544 delete (yyvsp[0].Value)->val;
4545 (yyval.Value)->val = (yyvsp[-1].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004546 ;}
4547 break;
4548
Reid Spencerc4d96252007-01-13 00:03:30 +00004549 case 288:
Reid Spencer30d0c582007-01-15 00:26:18 +00004550#line 2086 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004551 {
Reid Spencer12969882007-01-07 08:07:39 +00004552 // map llvm.isunordered to "fcmp uno"
Reid Spencer30d0c582007-01-15 00:26:18 +00004553 (yyval.Value) = new ValueInfo;
4554 if (*(yyvsp[-3].Value)->val == "%llvm.isunordered.f32" ||
4555 *(yyvsp[-3].Value)->val == "%llvm.isunordered.f64") {
4556 (yyval.Value)->val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0]->val + ", ");
4557 size_t pos = (*(yyvsp[-1].ValList))[1]->val->find(' ');
Reid Spencer12969882007-01-07 08:07:39 +00004558 assert(pos != std::string::npos && "no space?");
Reid Spencer30d0c582007-01-15 00:26:18 +00004559 *(yyval.Value)->val += (*(yyvsp[-1].ValList))[1]->val->substr(pos+1);
4560 (yyval.Value)->type = TypeInfo::get("i1", BoolTy);
Reid Spencer12969882007-01-07 08:07:39 +00004561 } else {
Reid Spencerc4d96252007-01-13 00:03:30 +00004562 static unsigned upgradeCount = 1;
Reid Spencer30d0c582007-01-15 00:26:18 +00004563 if (*(yyvsp[-3].Value)->val == "%llvm.va_start" || *(yyvsp[-3].Value)->val == "%llvm.va_end") {
Reid Spencerf6e54592007-01-13 00:23:06 +00004564 if (!(yyvsp[-1].ValList)->empty()) {
4565 std::string name("%va_upgrade");
4566 name += llvm::utostr(upgradeCount++);
Reid Spencer30d0c582007-01-15 00:26:18 +00004567 (yyvsp[-6].String)->insert(0, name + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n ");
4568 *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name;
4569 (*(yyvsp[-1].ValList))[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
Reid Spencerf6e54592007-01-13 00:23:06 +00004570 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004571 } else if (*(yyvsp[-3].Value)->val == "%llvm.va_copy") {
Reid Spencerc4d96252007-01-13 00:03:30 +00004572 std::string name0("%va_upgrade");
4573 name0 += llvm::utostr(upgradeCount++);
4574 std::string name1("%va_upgrade");
4575 name1 += llvm::utostr(upgradeCount++);
Reid Spencer30d0c582007-01-15 00:26:18 +00004576 (yyvsp[-6].String)->insert(0, name0 + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n " +
4577 name1 + " = bitcast " + *(*(yyvsp[-1].ValList))[1]->val + " to i8*\n ");
4578 *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name0;
4579 (*(yyvsp[-1].ValList))[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
4580 *(*(yyvsp[-1].ValList))[1]->val = "i8* " + name1;
4581 (*(yyvsp[-1].ValList))[0]->type = TypeInfo::get("i8", UByteTy)->getPointerType();
Reid Spencerc4d96252007-01-13 00:03:30 +00004582 }
Reid Spencer12969882007-01-07 08:07:39 +00004583 if (!(yyvsp[-5].String)->empty())
4584 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
4585 if (!(yyvsp[-6].String)->empty())
4586 *(yyvsp[-6].String) += " ";
Reid Spencer30d0c582007-01-15 00:26:18 +00004587 *(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].Value)->val + "(";
Reid Spencer12969882007-01-07 08:07:39 +00004588 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
Reid Spencer30d0c582007-01-15 00:26:18 +00004589 ValueInfo* VI = (*(yyvsp[-1].ValList))[i];
4590 *(yyvsp[-6].String) += *VI->val;
Reid Spencer12969882007-01-07 08:07:39 +00004591 if (i+1 < (yyvsp[-1].ValList)->size())
4592 *(yyvsp[-6].String) += ", ";
Reid Spencer30d0c582007-01-15 00:26:18 +00004593 delete VI;
Reid Spencer12969882007-01-07 08:07:39 +00004594 }
4595 *(yyvsp[-6].String) += ")";
Reid Spencer30d0c582007-01-15 00:26:18 +00004596 (yyval.Value) = new ValueInfo;
4597 (yyval.Value)->val = (yyvsp[-6].String);
4598 (yyval.Value)->type = getFunctionReturnType((yyvsp[-4].Type));
Reid Spencerf8483652006-12-02 15:16:01 +00004599 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004600 delete (yyvsp[-5].String); delete (yyvsp[-3].Value); delete (yyvsp[-1].ValList);
Reid Spencer319a7302007-01-05 17:20:02 +00004601 ;}
4602 break;
4603
Reid Spencerc4d96252007-01-13 00:03:30 +00004604 case 290:
Reid Spencer30d0c582007-01-15 00:26:18 +00004605#line 2142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004606 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4607 break;
4608
Reid Spencerc4d96252007-01-13 00:03:30 +00004609 case 291:
Reid Spencer30d0c582007-01-15 00:26:18 +00004610#line 2143 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004611 { (yyval.ValList) = new ValueList(); ;}
4612 break;
4613
Reid Spencerc4d96252007-01-13 00:03:30 +00004614 case 293:
Reid Spencer30d0c582007-01-15 00:26:18 +00004615#line 2148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004616 { (yyval.String) = new std::string(); ;}
4617 break;
4618
Reid Spencerc4d96252007-01-13 00:03:30 +00004619 case 294:
Reid Spencer30d0c582007-01-15 00:26:18 +00004620#line 2151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004621 {
4622 *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
4623 if (!(yyvsp[0].String)->empty())
4624 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
Reid Spencer30d0c582007-01-15 00:26:18 +00004625 (yyval.Value) = new ValueInfo;
4626 (yyval.Value)->val = (yyvsp[-2].String);
4627 (yyval.Value)->type = (yyvsp[-1].Type)->getPointerType();
Reid Spencer319a7302007-01-05 17:20:02 +00004628 delete (yyvsp[0].String);
4629 ;}
4630 break;
4631
4632 case 295:
Reid Spencer30d0c582007-01-15 00:26:18 +00004633#line 2160 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004634 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004635 std::string Name = getUniqueName((yyvsp[-1].Value)->val, (yyvsp[-2].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004636 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4637 if (!(yyvsp[0].String)->empty())
4638 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
Reid Spencer30d0c582007-01-15 00:26:18 +00004639 (yyval.Value) = new ValueInfo;
4640 (yyval.Value)->val = (yyvsp[-5].String);
4641 (yyval.Value)->type = (yyvsp[-4].Type)->getPointerType();
4642 delete (yyvsp[-1].Value); delete (yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004643 ;}
4644 break;
4645
Reid Spencerc4d96252007-01-13 00:03:30 +00004646 case 296:
Reid Spencer30d0c582007-01-15 00:26:18 +00004647#line 2170 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004648 {
4649 *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
4650 if (!(yyvsp[0].String)->empty())
4651 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
Reid Spencer30d0c582007-01-15 00:26:18 +00004652 (yyval.Value) = new ValueInfo;
4653 (yyval.Value)->val = (yyvsp[-2].String);
4654 (yyval.Value)->type = (yyvsp[-1].Type)->getPointerType();
Reid Spencerc4d96252007-01-13 00:03:30 +00004655 delete (yyvsp[0].String);
4656 ;}
4657 break;
4658
Reid Spencer609ca3e2007-01-12 20:10:51 +00004659 case 297:
Reid Spencer30d0c582007-01-15 00:26:18 +00004660#line 2179 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004661 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004662 std::string Name = getUniqueName((yyvsp[-1].Value)->val, (yyvsp[-2].Type));
Reid Spencerc4d96252007-01-13 00:03:30 +00004663 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4664 if (!(yyvsp[0].String)->empty())
4665 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
Reid Spencer30d0c582007-01-15 00:26:18 +00004666 (yyval.Value) = (yyvsp[-1].Value);
4667 delete (yyval.Value)->val;
4668 (yyval.Value)->val = (yyvsp[-5].String);
4669 (yyval.Value)->type = (yyvsp[-4].Type)->getPointerType();
4670 delete (yyvsp[0].String);
Reid Spencerc4d96252007-01-13 00:03:30 +00004671 ;}
4672 break;
4673
4674 case 298:
Reid Spencer30d0c582007-01-15 00:26:18 +00004675#line 2190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004676 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004677 *(yyvsp[-1].String) += " " + *(yyvsp[0].Value)->val;
4678 (yyval.Value) = (yyvsp[0].Value);
4679 delete (yyvsp[0].Value)->val;
4680 (yyval.Value)->val = (yyvsp[-1].String);
4681 (yyval.Value)->type = TypeInfo::get("void", VoidTy);
Reid Spencer319a7302007-01-05 17:20:02 +00004682 ;}
4683 break;
4684
Reid Spencerc4d96252007-01-13 00:03:30 +00004685 case 299:
Reid Spencer30d0c582007-01-15 00:26:18 +00004686#line 2197 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004687 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004688 std::string Name = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-1].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004689 if (!(yyvsp[-3].String)->empty())
4690 *(yyvsp[-3].String) += " ";
4691 *(yyvsp[-3].String) += *(yyvsp[-2].String) + " " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
Reid Spencer30d0c582007-01-15 00:26:18 +00004692 (yyval.Value) = (yyvsp[0].Value);
4693 delete (yyval.Value)->val;
4694 (yyval.Value)->val = (yyvsp[-3].String);
4695 (yyval.Value)->type = (yyvsp[-1].Type)->getElementType();
4696 delete (yyvsp[-2].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004697 ;}
4698 break;
4699
Reid Spencerc4d96252007-01-13 00:03:30 +00004700 case 300:
Reid Spencer30d0c582007-01-15 00:26:18 +00004701#line 2208 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004702 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004703 std::string Name = getUniqueName((yyvsp[0].Value)->val, (yyvsp[-1].Type));
Reid Spencer319a7302007-01-05 17:20:02 +00004704 if (!(yyvsp[-5].String)->empty())
4705 *(yyvsp[-5].String) += " ";
Reid Spencer30d0c582007-01-15 00:26:18 +00004706 *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Value)->val + ", " + (yyvsp[-1].Type)->getNewTy() + " " + Name;
4707 (yyval.Value) = (yyvsp[-3].Value);
4708 delete (yyval.Value)->val;
4709 (yyval.Value)->val = (yyvsp[-5].String);
4710 (yyval.Value)->type = TypeInfo::get("void", VoidTy);
4711 delete (yyvsp[-4].String); delete (yyvsp[0].Value);
Reid Spencer319a7302007-01-05 17:20:02 +00004712 ;}
4713 break;
4714
Reid Spencerc4d96252007-01-13 00:03:30 +00004715 case 301:
Reid Spencer30d0c582007-01-15 00:26:18 +00004716#line 2219 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004717 {
Reid Spencer30d0c582007-01-15 00:26:18 +00004718 std::string Name = getUniqueName((yyvsp[-1].Value)->val, (yyvsp[-2].Type));
Reid Spencerf459d392006-12-02 16:19:52 +00004719 // Upgrade the indices
Reid Spencer319a7302007-01-05 17:20:02 +00004720 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
Reid Spencer30d0c582007-01-15 00:26:18 +00004721 ValueInfo* VI = (*(yyvsp[0].ValList))[i];
4722 if (VI->type->isUnsigned() && !VI->isConstant() &&
4723 VI->type->getBitWidth() < 64) {
4724 *O << " %gep_upgrade" << UniqueNameCounter << " = zext " << *VI->val
Reid Spencer71d2ec92006-12-31 06:02:26 +00004725 << " to i64\n";
Reid Spencer30d0c582007-01-15 00:26:18 +00004726 *VI->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++);
4727 VI->type = TypeInfo::get("i64",ULongTy);
Reid Spencerf459d392006-12-02 16:19:52 +00004728 }
4729 }
Reid Spencer319a7302007-01-05 17:20:02 +00004730 *(yyvsp[-3].String) += " " + (yyvsp[-2].Type)->getNewTy() + " " + Name;
4731 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
Reid Spencer30d0c582007-01-15 00:26:18 +00004732 ValueInfo* VI = (*(yyvsp[0].ValList))[i];
4733 *(yyvsp[-3].String) += ", " + *VI->val;
Reid Spencerf8483652006-12-02 15:16:01 +00004734 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004735 (yyval.Value) = (yyvsp[-1].Value);
4736 delete (yyval.Value)->val;
4737 (yyval.Value)->val = (yyvsp[-3].String);
4738 (yyval.Value)->type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList));
4739 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i)
4740 delete (*(yyvsp[0].ValList))[i];
4741 delete (yyvsp[0].ValList);
Reid Spencer319a7302007-01-05 17:20:02 +00004742 ;}
4743 break;
4744
4745
4746 default: break;
4747 }
4748
4749/* Line 1126 of yacc.c. */
Reid Spencer30d0c582007-01-15 00:26:18 +00004750#line 4751 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00004751
4752 yyvsp -= yylen;
4753 yyssp -= yylen;
4754
Reid Spencer319a7302007-01-05 17:20:02 +00004755
4756 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004757
4758 *++yyvsp = yyval;
4759
4760
Reid Spencer319a7302007-01-05 17:20:02 +00004761 /* Now `shift' the result of the reduction. Determine what state
4762 that goes to, based on the state we popped back to and the rule
4763 number reduced by. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004764
4765 yyn = yyr1[yyn];
4766
Reid Spencer319a7302007-01-05 17:20:02 +00004767 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4768 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00004769 yystate = yytable[yystate];
4770 else
Reid Spencer319a7302007-01-05 17:20:02 +00004771 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencere7c3c602006-11-30 06:36:44 +00004772
4773 goto yynewstate;
4774
4775
Reid Spencer319a7302007-01-05 17:20:02 +00004776/*------------------------------------.
4777| yyerrlab -- here on detecting error |
4778`------------------------------------*/
4779yyerrlab:
4780 /* If not already recovering from an error, report this error. */
4781 if (!yyerrstatus)
Reid Spencere7c3c602006-11-30 06:36:44 +00004782 {
4783 ++yynerrs;
Reid Spencer319a7302007-01-05 17:20:02 +00004784#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00004785 yyn = yypact[yystate];
4786
Reid Spencer319a7302007-01-05 17:20:02 +00004787 if (YYPACT_NINF < yyn && yyn < YYLAST)
Reid Spencere7c3c602006-11-30 06:36:44 +00004788 {
Reid Spencer319a7302007-01-05 17:20:02 +00004789 int yytype = YYTRANSLATE (yychar);
4790 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
4791 YYSIZE_T yysize = yysize0;
4792 YYSIZE_T yysize1;
4793 int yysize_overflow = 0;
4794 char *yymsg = 0;
4795# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
4796 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
4797 int yyx;
Reid Spencere7c3c602006-11-30 06:36:44 +00004798
Reid Spencer319a7302007-01-05 17:20:02 +00004799#if 0
4800 /* This is so xgettext sees the translatable formats that are
4801 constructed on the fly. */
4802 YY_("syntax error, unexpected %s");
4803 YY_("syntax error, unexpected %s, expecting %s");
4804 YY_("syntax error, unexpected %s, expecting %s or %s");
4805 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
4806 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
4807#endif
4808 char *yyfmt;
4809 char const *yyf;
4810 static char const yyunexpected[] = "syntax error, unexpected %s";
4811 static char const yyexpecting[] = ", expecting %s";
4812 static char const yyor[] = " or %s";
4813 char yyformat[sizeof yyunexpected
4814 + sizeof yyexpecting - 1
4815 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
4816 * (sizeof yyor - 1))];
4817 char const *yyprefix = yyexpecting;
4818
4819 /* Start YYX at -YYN if negative to avoid negative indexes in
4820 YYCHECK. */
4821 int yyxbegin = yyn < 0 ? -yyn : 0;
4822
4823 /* Stay within bounds of both yycheck and yytname. */
4824 int yychecklim = YYLAST - yyn;
4825 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4826 int yycount = 1;
4827
4828 yyarg[0] = yytname[yytype];
4829 yyfmt = yystpcpy (yyformat, yyunexpected);
4830
4831 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4832 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4833 {
4834 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
4835 {
4836 yycount = 1;
4837 yysize = yysize0;
4838 yyformat[sizeof yyunexpected - 1] = '\0';
4839 break;
4840 }
4841 yyarg[yycount++] = yytname[yyx];
4842 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
4843 yysize_overflow |= yysize1 < yysize;
4844 yysize = yysize1;
4845 yyfmt = yystpcpy (yyfmt, yyprefix);
4846 yyprefix = yyor;
4847 }
4848
4849 yyf = YY_(yyformat);
4850 yysize1 = yysize + yystrlen (yyf);
4851 yysize_overflow |= yysize1 < yysize;
4852 yysize = yysize1;
4853
4854 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
4855 yymsg = (char *) YYSTACK_ALLOC (yysize);
4856 if (yymsg)
Reid Spencere7c3c602006-11-30 06:36:44 +00004857 {
Reid Spencer319a7302007-01-05 17:20:02 +00004858 /* Avoid sprintf, as that infringes on the user's name space.
4859 Don't have undefined behavior even if the translation
4860 produced a string with the wrong number of "%s"s. */
4861 char *yyp = yymsg;
4862 int yyi = 0;
4863 while ((*yyp = *yyf))
Reid Spencere7c3c602006-11-30 06:36:44 +00004864 {
Reid Spencer319a7302007-01-05 17:20:02 +00004865 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
4866 {
4867 yyp += yytnamerr (yyp, yyarg[yyi++]);
4868 yyf += 2;
4869 }
4870 else
4871 {
4872 yyp++;
4873 yyf++;
4874 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004875 }
Reid Spencer319a7302007-01-05 17:20:02 +00004876 yyerror (yymsg);
4877 YYSTACK_FREE (yymsg);
Reid Spencere7c3c602006-11-30 06:36:44 +00004878 }
4879 else
Reid Spencer319a7302007-01-05 17:20:02 +00004880 {
4881 yyerror (YY_("syntax error"));
4882 goto yyexhaustedlab;
4883 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004884 }
4885 else
4886#endif /* YYERROR_VERBOSE */
Reid Spencer319a7302007-01-05 17:20:02 +00004887 yyerror (YY_("syntax error"));
Reid Spencere7c3c602006-11-30 06:36:44 +00004888 }
4889
Reid Spencer319a7302007-01-05 17:20:02 +00004890
Reid Spencere7c3c602006-11-30 06:36:44 +00004891
4892 if (yyerrstatus == 3)
4893 {
Reid Spencer319a7302007-01-05 17:20:02 +00004894 /* If just tried and failed to reuse look-ahead token after an
4895 error, discard it. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004896
Reid Spencer319a7302007-01-05 17:20:02 +00004897 if (yychar <= YYEOF)
4898 {
4899 /* Return failure if at end of input. */
4900 if (yychar == YYEOF)
4901 YYABORT;
4902 }
4903 else
4904 {
4905 yydestruct ("Error: discarding", yytoken, &yylval);
4906 yychar = YYEMPTY;
4907 }
4908 }
4909
4910 /* Else will try to reuse look-ahead token after shifting the error
4911 token. */
4912 goto yyerrlab1;
4913
4914
4915/*---------------------------------------------------.
4916| yyerrorlab -- error raised explicitly by YYERROR. |
4917`---------------------------------------------------*/
4918yyerrorlab:
4919
4920 /* Pacify compilers like GCC when the user code never invokes
4921 YYERROR and the label yyerrorlab therefore never appears in user
4922 code. */
4923 if (0)
4924 goto yyerrorlab;
4925
4926yyvsp -= yylen;
4927 yyssp -= yylen;
4928 yystate = *yyssp;
4929 goto yyerrlab1;
4930
4931
4932/*-------------------------------------------------------------.
4933| yyerrlab1 -- common code for both syntax error and YYERROR. |
4934`-------------------------------------------------------------*/
4935yyerrlab1:
4936 yyerrstatus = 3; /* Each real token shifted decrements this. */
4937
4938 for (;;)
4939 {
4940 yyn = yypact[yystate];
4941 if (yyn != YYPACT_NINF)
4942 {
4943 yyn += YYTERROR;
4944 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4945 {
4946 yyn = yytable[yyn];
4947 if (0 < yyn)
4948 break;
4949 }
4950 }
4951
4952 /* Pop the current state because it cannot handle the error token. */
4953 if (yyssp == yyss)
Reid Spencere7c3c602006-11-30 06:36:44 +00004954 YYABORT;
4955
4956
Reid Spencer319a7302007-01-05 17:20:02 +00004957 yydestruct ("Error: popping", yystos[yystate], yyvsp);
4958 YYPOPSTACK;
4959 yystate = *yyssp;
4960 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004961 }
4962
4963 if (yyn == YYFINAL)
4964 YYACCEPT;
4965
4966 *++yyvsp = yylval;
Reid Spencer319a7302007-01-05 17:20:02 +00004967
4968
4969 /* Shift the error token. */
4970 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004971
4972 yystate = yyn;
4973 goto yynewstate;
4974
Chris Lattner37e01c52007-01-04 18:46:42 +00004975
Reid Spencer319a7302007-01-05 17:20:02 +00004976/*-------------------------------------.
4977| yyacceptlab -- YYACCEPT comes here. |
4978`-------------------------------------*/
4979yyacceptlab:
4980 yyresult = 0;
4981 goto yyreturn;
4982
4983/*-----------------------------------.
4984| yyabortlab -- YYABORT comes here. |
4985`-----------------------------------*/
4986yyabortlab:
4987 yyresult = 1;
4988 goto yyreturn;
4989
4990#ifndef yyoverflow
4991/*-------------------------------------------------.
4992| yyexhaustedlab -- memory exhaustion comes here. |
4993`-------------------------------------------------*/
4994yyexhaustedlab:
4995 yyerror (YY_("memory exhausted"));
4996 yyresult = 2;
4997 /* Fall through. */
Chris Lattner37e01c52007-01-04 18:46:42 +00004998#endif
Reid Spencer319a7302007-01-05 17:20:02 +00004999
5000yyreturn:
5001 if (yychar != YYEOF && yychar != YYEMPTY)
5002 yydestruct ("Cleanup: discarding lookahead",
5003 yytoken, &yylval);
5004 while (yyssp != yyss)
5005 {
5006 yydestruct ("Cleanup: popping",
5007 yystos[*yyssp], yyvsp);
5008 YYPOPSTACK;
Chris Lattner37e01c52007-01-04 18:46:42 +00005009 }
Reid Spencer319a7302007-01-05 17:20:02 +00005010#ifndef yyoverflow
5011 if (yyss != yyssa)
5012 YYSTACK_FREE (yyss);
5013#endif
5014 return yyresult;
Reid Spencere7c3c602006-11-30 06:36:44 +00005015}
Reid Spencer319a7302007-01-05 17:20:02 +00005016
5017
Reid Spencer30d0c582007-01-15 00:26:18 +00005018#line 2246 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencere7c3c602006-11-30 06:36:44 +00005019
5020
5021int yyerror(const char *ErrorMsg) {
5022 std::string where
5023 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5024 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
Reid Spencer319a7302007-01-05 17:20:02 +00005025 std::string errMsg = where + "error: " + std::string(ErrorMsg) +
5026 " while reading ";
Reid Spencere7c3c602006-11-30 06:36:44 +00005027 if (yychar == YYEMPTY || yychar == 0)
5028 errMsg += "end-of-file.";
5029 else
5030 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
Reid Spencer71d2ec92006-12-31 06:02:26 +00005031 std::cerr << "llvm-upgrade: " << errMsg << '\n';
Chris Lattner37e01c52007-01-04 18:46:42 +00005032 *O << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +00005033 exit(1);
5034}
Reid Spencer319a7302007-01-05 17:20:02 +00005035
Reid Spencer30d0c582007-01-15 00:26:18 +00005036void warning(const std::string& ErrorMsg) {
Reid Spencer319a7302007-01-05 17:20:02 +00005037 std::string where
5038 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5039 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
5040 std::string errMsg = where + "warning: " + std::string(ErrorMsg) +
5041 " while reading ";
5042 if (yychar == YYEMPTY || yychar == 0)
5043 errMsg += "end-of-file.";
5044 else
5045 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
5046 std::cerr << "llvm-upgrade: " << errMsg << '\n';
5047}
5048