blob: 5b57b5d8a2af3b7018d675a99d982346435c715d [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
Reid Spencerb6673a92007-01-15 02:41:46 +0000418/// of creating llvm::Value directly, the parser will create Value which
Reid Spencer30d0c582007-01-15 00:26:18 +0000419/// associates a Value* with a Signedness indication.
Reid Spencerb6673a92007-01-15 02:41:46 +0000420struct Value {
Reid Spencer30d0c582007-01-15 00:26:18 +0000421 std::string* val;
Reid Spencerb6673a92007-01-15 02:41:46 +0000422 const Type* type;
Reid Spencer30d0c582007-01-15 00:26:18 +0000423 bool constant;
424 bool isConstant() const { return constant; }
Reid Spencerb6673a92007-01-15 02:41:46 +0000425 ~Value() { delete val; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000426};
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
Reid Spencerb6673a92007-01-15 02:41:46 +0000431/// create instances of Type which retains the signedness indication so
Reid Spencer30d0c582007-01-15 00:26:18 +0000432/// 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".
Reid Spencerb6673a92007-01-15 02:41:46 +0000436class Type {
Reid Spencer30d0c582007-01-15 00:26:18 +0000437public:
Reid Spencerb6673a92007-01-15 02:41:46 +0000438 static const Type* get(const std::string &newType, TypeIDs oldType);
439 static const Type* get(const std::string& newType, TypeIDs oldType,
440 const Type* eTy, const Type* rTy);
Reid Spencer30d0c582007-01-15 00:26:18 +0000441
Reid Spencerb6673a92007-01-15 02:41:46 +0000442 static const Type* get(const std::string& newType, TypeIDs oldType,
443 const Type *eTy, uint64_t elems);
Reid Spencer30d0c582007-01-15 00:26:18 +0000444
Reid Spencerb6673a92007-01-15 02:41:46 +0000445 static const Type* get(const std::string& newType, TypeIDs oldType,
Reid Spencer30d0c582007-01-15 00:26:18 +0000446 TypeList* TL);
447
Reid Spencerb6673a92007-01-15 02:41:46 +0000448 static const Type* get(const std::string& newType, const Type* resTy,
Reid Spencer30d0c582007-01-15 00:26:18 +0000449 TypeList* TL);
450
Reid Spencerb6673a92007-01-15 02:41:46 +0000451 const Type* resolve() const;
452 bool operator<(const Type& that) const;
Reid Spencer30d0c582007-01-15 00:26:18 +0000453
Reid Spencerb6673a92007-01-15 02:41:46 +0000454 bool sameNewTyAs(const Type* that) const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000455 return this->newTy == that->newTy;
456 }
457
Reid Spencerb6673a92007-01-15 02:41:46 +0000458 bool sameOldTyAs(const Type* that) const;
Reid Spencer30d0c582007-01-15 00:26:18 +0000459
Reid Spencerb6673a92007-01-15 02:41:46 +0000460 TypeIDs getElementTy() const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000461 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
Reid Spencerb6673a92007-01-15 02:41:46 +0000472 typedef std::vector<const Type*> UpRefStack;
Reid Spencer30d0c582007-01-15 00:26:18 +0000473 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; }
Reid Spencerb6673a92007-01-15 02:41:46 +0000477 const Type* getResultType() const { return resultTy; }
478 const Type* getElementType() const { return elemTy; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000479
Reid Spencerb6673a92007-01-15 02:41:46 +0000480 const Type* getPointerType() const {
481 return get(newTy + "*", PointerTy, this, (Type*)0);
Reid Spencer30d0c582007-01-15 00:26:18 +0000482 }
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
Reid Spencerb6673a92007-01-15 02:41:46 +0000520 const Type* getIndexedType(const Value* V) const;
Reid Spencer30d0c582007-01-15 00:26:18 +0000521
522 unsigned getNumStructElements() const {
523 return (elements ? elements->size() : 0);
524 }
525
Reid Spencerb6673a92007-01-15 02:41:46 +0000526 const Type* getElement(unsigned idx) const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000527 if (elements)
528 if (idx < elements->size())
529 return (*elements)[idx];
530 return 0;
531 }
532
533private:
Reid Spencerb6673a92007-01-15 02:41:46 +0000534 Type()
Reid Spencer30d0c582007-01-15 00:26:18 +0000535 : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
536 nelems(0) {
537 }
538
Reid Spencerb6673a92007-01-15 02:41:46 +0000539 Type(const Type& that); // do not implement
540 Type& operator=(const Type& that); // do not implement
Reid Spencer30d0c582007-01-15 00:26:18 +0000541
Reid Spencerb6673a92007-01-15 02:41:46 +0000542 ~Type() { delete elements; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000543
544 struct ltfunctor
545 {
Reid Spencerb6673a92007-01-15 02:41:46 +0000546 bool operator()(const Type* X, const Type* Y) const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000547 assert(X && "Can't compare null pointer");
548 assert(Y && "Can't compare null pointer");
549 return *X < *Y;
550 }
551 };
552
Reid Spencerb6673a92007-01-15 02:41:46 +0000553 typedef std::set<const Type*, ltfunctor> TypeRegMap;
Reid Spencer30d0c582007-01-15 00:26:18 +0000554
Reid Spencerb6673a92007-01-15 02:41:46 +0000555 static const Type* add_new_type(Type* existing);
Reid Spencer30d0c582007-01-15 00:26:18 +0000556
557 std::string newTy;
Reid Spencerb6673a92007-01-15 02:41:46 +0000558 TypeIDs oldTy;
559 Type *elemTy;
560 Type *resultTy;
Reid Spencer30d0c582007-01-15 00:26:18 +0000561 TypeList *elements;
562 uint64_t nelems;
563 static TypeRegMap registry;
564public:
Reid Spencerb6673a92007-01-15 02:41:46 +0000565 typedef std::vector<const Type*> TypeVector;
566 typedef std::map<std::string,const Type*> TypeMap;
567 typedef std::map<const Type*,std::string> TypePlaneMap;
Reid Spencer30d0c582007-01-15 00:26:18 +0000568 typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
569 static TypeVector EnumeratedTypes;
570 static TypeMap NamedTypes;
571 static GlobalsTypeMap Globals;
572};
573
Reid Spencerb6673a92007-01-15 02:41:46 +0000574Type::TypeRegMap Type::registry;
575Type::TypeVector Type::EnumeratedTypes;
576Type::TypeMap Type::NamedTypes;
577Type::GlobalsTypeMap Type::Globals;
Reid Spencer319a7302007-01-05 17:20:02 +0000578
Reid Spencerb6673a92007-01-15 02:41:46 +0000579const Type* Type::get(const std::string &newType, TypeIDs oldType) {
580 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000581 Ty->newTy = newType;
582 Ty->oldTy = oldType;
583 return add_new_type(Ty);
584}
585
Reid Spencerb6673a92007-01-15 02:41:46 +0000586const Type* Type::get(const std::string& newType, TypeIDs oldType,
587 const Type* eTy, const Type* rTy) {
588 Type* Ty= new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000589 Ty->newTy = newType;
590 Ty->oldTy = oldType;
Reid Spencerb6673a92007-01-15 02:41:46 +0000591 Ty->elemTy = const_cast<Type*>(eTy);
592 Ty->resultTy = const_cast<Type*>(rTy);
Reid Spencer319a7302007-01-05 17:20:02 +0000593 return add_new_type(Ty);
594}
595
Reid Spencerb6673a92007-01-15 02:41:46 +0000596const Type* Type::get(const std::string& newType, TypeIDs oldType,
597 const Type *eTy, uint64_t elems) {
598 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000599 Ty->newTy = newType;
600 Ty->oldTy = oldType;
Reid Spencerb6673a92007-01-15 02:41:46 +0000601 Ty->elemTy = const_cast<Type*>(eTy);
Reid Spencer319a7302007-01-05 17:20:02 +0000602 Ty->nelems = elems;
603 return add_new_type(Ty);
604}
605
Reid Spencerb6673a92007-01-15 02:41:46 +0000606const Type* Type::get(const std::string& newType, TypeIDs oldType,
Reid Spencer319a7302007-01-05 17:20:02 +0000607 TypeList* TL) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000608 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000609 Ty->newTy = newType;
610 Ty->oldTy = oldType;
611 Ty->elements = TL;
612 return add_new_type(Ty);
613}
614
Reid Spencerb6673a92007-01-15 02:41:46 +0000615const Type* Type::get(const std::string& newType, const Type* resTy,
Reid Spencer319a7302007-01-05 17:20:02 +0000616 TypeList* TL) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000617 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000618 Ty->newTy = newType;
619 Ty->oldTy = FunctionTy;
Reid Spencerb6673a92007-01-15 02:41:46 +0000620 Ty->resultTy = const_cast<Type*>(resTy);
Reid Spencer319a7302007-01-05 17:20:02 +0000621 Ty->elements = TL;
622 return add_new_type(Ty);
623}
624
Reid Spencerb6673a92007-01-15 02:41:46 +0000625const Type* Type::resolve() const {
Reid Spencer319a7302007-01-05 17:20:02 +0000626 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 Spencerb6673a92007-01-15 02:41:46 +0000637 Type::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
Reid Spencerb6673a92007-01-15 02:41:46 +0000651bool Type::operator<(const Type& that) const {
Reid Spencer319a7302007-01-05 17:20:02 +0000652 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: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000667 const Type* thisTy = this->elemTy;
668 const Type* thatTy = that.elemTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000669 return *thisTy < *thatTy;
670 }
671 case FunctionTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000672 const Type* thisTy = this->resultTy;
673 const Type* thatTy = that.resultTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000674 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++) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000683 const Type* thisTy = (*this->elements)[i];
684 const Type* thatTy = (*that.elements)[i];
Reid Spencer319a7302007-01-05 17:20:02 +0000685 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
Reid Spencerb6673a92007-01-15 02:41:46 +0000698bool Type::sameOldTyAs(const Type* that) const {
Reid Spencer319a7302007-01-05 17:20:02 +0000699 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: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000712 const Type* thisTy = this->elemTy;
713 const Type* thatTy = that->elemTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000714 return thisTy->sameOldTyAs(thatTy);
715 }
716 case FunctionTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000717 const Type* thisTy = this->resultTy;
718 const Type* thatTy = that->resultTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000719 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++) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000728 const Type* thisTy = (*this->elements)[i];
729 const Type* thatTy = (*that->elements)[i];
Reid Spencer319a7302007-01-05 17:20:02 +0000730 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
Reid Spencerb6673a92007-01-15 02:41:46 +0000743bool Type::isUnresolvedDeep() const {
Reid Spencer319a7302007-01-05 17:20:02 +0000744 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
Reid Spencerb6673a92007-01-15 02:41:46 +0000762unsigned Type::getBitWidth() const {
Reid Spencer319a7302007-01-05 17:20:02 +0000763 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 Spencerb6673a92007-01-15 02:41:46 +0000787const Type* Type::getIndexedType(const Value* V) const {
Reid Spencer319a7302007-01-05 17:20:02 +0000788 if (isStruct()) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000789 if (V->isConstant() && V->type->isInteger()) {
790 size_t pos = V->val->find(' ') + 1;
791 if (pos < V->val->size()) {
792 uint64_t idx = atoi(V->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 Spencerb6673a92007-01-15 02:41:46 +0000809void Type::getSignedness(unsigned &sNum, unsigned &uNum,
Reid Spencerf8383de2007-01-06 06:04:32 +0000810 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: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000837 const Type* Ty = this->resolve();
Reid Spencerf8383de2007-01-06 06:04:32 +0000838 // 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
Reid Spencerb6673a92007-01-15 02:41:46 +0000858std::string Type::makeUniqueName(const std::string& BaseName) const {
Reid Spencerf8383de2007-01-06 06:04:32 +0000859 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: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000879 Type::UpRefStack stack;
Reid Spencerf8383de2007-01-06 06:04:32 +0000880 elemTy->resolve()->getSignedness(sNum, uNum, stack);
881 break;
882 }
883 case StructTy:
884 case PackedStructTy: {
885 for (unsigned i = 0; i < elements->size(); i++) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000886 Type::UpRefStack stack;
Reid Spencerf8383de2007-01-06 06:04:32 +0000887 (*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 Spencerb6673a92007-01-15 02:41:46 +0000913Type& Type::operator=(const Type& that) {
Reid Spencer319a7302007-01-05 17:20:02 +0000914 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
Reid Spencerb6673a92007-01-15 02:41:46 +0000928const Type* Type::add_new_type(Type* newTy) {
Reid Spencer319a7302007-01-05 17:20:02 +0000929 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 Spencerb6673a92007-01-15 02:41:46 +0000938class Instruction {
939};
940
Reid Spencer30d0c582007-01-15 00:26:18 +0000941/// This type is used to keep track of the signedness of constants.
Reid Spencerb6673a92007-01-15 02:41:46 +0000942struct Constant {
Reid Spencer30d0c582007-01-15 00:26:18 +0000943 std::string *cnst;
Reid Spencerb6673a92007-01-15 02:41:46 +0000944 const Type *type;
945 ~Constant() { delete cnst; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000946};
947
948/// This variable provides a counter for unique names. It is used in various
949/// productions to ensure a unique name is generated.
950static uint64_t UniqueNameCounter = 1;
951
952// This is set when a DECLARE keyword is recognized so that subsequent parsing
953// of a function prototype can know if its a declaration or definition.
954static bool isDeclare = false;
955
956// This bool is used to communicate between the InstVal and Inst rules about
957// whether or not a cast should be deleted. When the flag is set, InstVal has
958// determined that the cast is a candidate. However, it can only be deleted if
959// the value being casted is the same value name as the instruction. The Inst
960// rule makes that comparison if the flag is set and comments out the
961// instruction if they match.
962static bool deleteUselessCastFlag = false;
963static std::string* deleteUselessCastName = 0;
964
965
966
Reid Spencerb6673a92007-01-15 02:41:46 +0000967const char* getCastOpcode(std::string& Source, const Type* SrcTy,
968 const Type* DstTy) {
Reid Spencer52402b02007-01-02 05:45:11 +0000969 unsigned SrcBits = SrcTy->getBitWidth();
970 unsigned DstBits = DstTy->getBitWidth();
Reid Spencere77e35e2006-12-01 20:26:20 +0000971 const char* opcode = "bitcast";
972 // Run through the possibilities ...
Reid Spencer52402b02007-01-02 05:45:11 +0000973 if (DstTy->isIntegral()) { // Casting to integral
974 if (SrcTy->isIntegral()) { // Casting from integral
Reid Spencere77e35e2006-12-01 20:26:20 +0000975 if (DstBits < SrcBits)
976 opcode = "trunc";
977 else if (DstBits > SrcBits) { // its an extension
Reid Spencer52402b02007-01-02 05:45:11 +0000978 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000979 opcode ="sext"; // signed -> SEXT
980 else
981 opcode = "zext"; // unsigned -> ZEXT
982 } else {
983 opcode = "bitcast"; // Same size, No-op cast
984 }
Reid Spencer52402b02007-01-02 05:45:11 +0000985 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
986 if (DstTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000987 opcode = "fptosi"; // FP -> sint
988 else
989 opcode = "fptoui"; // FP -> uint
Reid Spencer52402b02007-01-02 05:45:11 +0000990 } else if (SrcTy->isPacked()) {
991 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000992 "Casting packed to integer of different width");
993 opcode = "bitcast"; // same size, no-op cast
994 } else {
Reid Spencer52402b02007-01-02 05:45:11 +0000995 assert(SrcTy->isPointer() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000996 "Casting from a value that is not first-class type");
997 opcode = "ptrtoint"; // ptr -> int
998 }
Reid Spencer52402b02007-01-02 05:45:11 +0000999 } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
1000 if (SrcTy->isIntegral()) { // Casting from integral
1001 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +00001002 opcode = "sitofp"; // sint -> FP
1003 else
1004 opcode = "uitofp"; // uint -> FP
Reid Spencer52402b02007-01-02 05:45:11 +00001005 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
Reid Spencere77e35e2006-12-01 20:26:20 +00001006 if (DstBits < SrcBits) {
1007 opcode = "fptrunc"; // FP -> smaller FP
1008 } else if (DstBits > SrcBits) {
1009 opcode = "fpext"; // FP -> larger FP
1010 } else {
1011 opcode ="bitcast"; // same size, no-op cast
1012 }
Reid Spencer52402b02007-01-02 05:45:11 +00001013 } else if (SrcTy->isPacked()) {
1014 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +00001015 "Casting packed to floating point of different width");
1016 opcode = "bitcast"; // same size, no-op cast
1017 } else {
1018 assert(0 && "Casting pointer or non-first class to float");
1019 }
Reid Spencer52402b02007-01-02 05:45:11 +00001020 } else if (DstTy->isPacked()) {
1021 if (SrcTy->isPacked()) {
1022 assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +00001023 "Casting packed to packed of different widths");
1024 opcode = "bitcast"; // packed -> packed
Reid Spencer52402b02007-01-02 05:45:11 +00001025 } else if (DstTy->getBitWidth() == SrcBits) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001026 opcode = "bitcast"; // float/int -> packed
1027 } else {
1028 assert(!"Illegal cast to packed (wrong type or size)");
1029 }
Reid Spencer52402b02007-01-02 05:45:11 +00001030 } else if (DstTy->isPointer()) {
1031 if (SrcTy->isPointer()) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001032 opcode = "bitcast"; // ptr -> ptr
Reid Spencer52402b02007-01-02 05:45:11 +00001033 } else if (SrcTy->isIntegral()) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001034 opcode = "inttoptr"; // int -> ptr
1035 } else {
Reid Spencera50d5962006-12-02 04:11:07 +00001036 assert(!"Casting invalid type to pointer");
Reid Spencere77e35e2006-12-01 20:26:20 +00001037 }
1038 } else {
1039 assert(!"Casting to type that is not first-class");
1040 }
1041 return opcode;
1042}
1043
Reid Spencerb6673a92007-01-15 02:41:46 +00001044std::string getCastUpgrade(const std::string& Src, const Type* SrcTy,
1045 const Type* DstTy, bool isConst) {
Reid Spencera50d5962006-12-02 04:11:07 +00001046 std::string Result;
1047 std::string Source = Src;
Reid Spencer52402b02007-01-02 05:45:11 +00001048 if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
Reid Spencera50d5962006-12-02 04:11:07 +00001049 // fp -> ptr cast is no longer supported but we must upgrade this
1050 // by doing a double cast: fp -> int -> ptr
1051 if (isConst)
Reid Spencer71d2ec92006-12-31 06:02:26 +00001052 Source = "i64 fptoui(" + Source + " to i64)";
Reid Spencera50d5962006-12-02 04:11:07 +00001053 else {
Reid Spencerb6673a92007-01-15 02:41:46 +00001054 *O << " %cast_upgrade" << UniqueNameCounter << " = fptoui "
Reid Spencer30d0c582007-01-15 00:26:18 +00001055 << Source << " to i64\n";
Reid Spencerb6673a92007-01-15 02:41:46 +00001056 Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter++);
Reid Spencera50d5962006-12-02 04:11:07 +00001057 }
1058 // Update the SrcTy for the getCastOpcode call below
Reid Spencerb6673a92007-01-15 02:41:46 +00001059 SrcTy = Type::get("i64", ULongTy);
Reid Spencer52402b02007-01-02 05:45:11 +00001060 } else if (DstTy->isBool()) {
1061 // cast type %x to bool was previously defined as setne type %x, null
1062 // The cast semantic is now to truncate, not compare so we must retain
1063 // the original intent by replacing the cast with a setne
1064 const char* comparator = SrcTy->isPointer() ? ", null" :
1065 (SrcTy->isFloatingPoint() ? ", 0.0" :
1066 (SrcTy->isBool() ? ", false" : ", 0"));
1067 const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
Reid Spencer187ccf82006-12-09 16:57:22 +00001068 if (isConst) {
1069 Result = "(" + Source + comparator + ")";
1070 Result = compareOp + Result;
1071 } else
1072 Result = compareOp + Source + comparator;
Reid Spencera50d5962006-12-02 04:11:07 +00001073 return Result; // skip cast processing below
1074 }
Reid Spencer319a7302007-01-05 17:20:02 +00001075 SrcTy = SrcTy->resolve();
1076 DstTy = DstTy->resolve();
Reid Spencera50d5962006-12-02 04:11:07 +00001077 std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
1078 if (isConst)
Reid Spencer52402b02007-01-02 05:45:11 +00001079 Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
Reid Spencera50d5962006-12-02 04:11:07 +00001080 else
Reid Spencer52402b02007-01-02 05:45:11 +00001081 Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
Reid Spencera50d5962006-12-02 04:11:07 +00001082 return Result;
1083}
1084
Reid Spencerb6673a92007-01-15 02:41:46 +00001085const char* getDivRemOpcode(const std::string& opcode, const Type* TI) {
Reid Spencer78720742006-12-02 20:21:22 +00001086 const char* op = opcode.c_str();
Reid Spencerb6673a92007-01-15 02:41:46 +00001087 const Type* Ty = TI->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001088 if (Ty->isPacked())
1089 Ty = Ty->getElementType();
Reid Spencer78720742006-12-02 20:21:22 +00001090 if (opcode == "div")
Reid Spencer52402b02007-01-02 05:45:11 +00001091 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +00001092 op = "fdiv";
Reid Spencer52402b02007-01-02 05:45:11 +00001093 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +00001094 op = "udiv";
Reid Spencer52402b02007-01-02 05:45:11 +00001095 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +00001096 op = "sdiv";
1097 else
1098 yyerror("Invalid type for div instruction");
1099 else if (opcode == "rem")
Reid Spencer52402b02007-01-02 05:45:11 +00001100 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +00001101 op = "frem";
Reid Spencer52402b02007-01-02 05:45:11 +00001102 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +00001103 op = "urem";
Reid Spencer52402b02007-01-02 05:45:11 +00001104 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +00001105 op = "srem";
1106 else
1107 yyerror("Invalid type for rem instruction");
1108 return op;
1109}
Reid Spencere7c3c602006-11-30 06:36:44 +00001110
Reid Spencerb6673a92007-01-15 02:41:46 +00001111std::string getCompareOp(const std::string& setcc, const Type* TI) {
Reid Spencer229e9362006-12-02 22:14:11 +00001112 assert(setcc.length() == 5);
1113 char cc1 = setcc[3];
1114 char cc2 = setcc[4];
1115 assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
1116 assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
1117 std::string result("xcmp xxx");
1118 result[6] = cc1;
1119 result[7] = cc2;
Reid Spencer52402b02007-01-02 05:45:11 +00001120 if (TI->isFloatingPoint()) {
Reid Spencer229e9362006-12-02 22:14:11 +00001121 result[0] = 'f';
Reid Spencere4d87aa2006-12-23 06:05:41 +00001122 result[5] = 'o';
Reid Spencerf0cf1322006-12-07 04:23:03 +00001123 if (cc1 == 'n')
1124 result[5] = 'u'; // NE maps to unordered
1125 else
1126 result[5] = 'o'; // everything else maps to ordered
Reid Spencer52402b02007-01-02 05:45:11 +00001127 } else if (TI->isIntegral() || TI->isPointer()) {
Reid Spencer229e9362006-12-02 22:14:11 +00001128 result[0] = 'i';
1129 if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
1130 result.erase(5,1);
Reid Spencer52402b02007-01-02 05:45:11 +00001131 else if (TI->isSigned())
Reid Spencer229e9362006-12-02 22:14:11 +00001132 result[5] = 's';
Reid Spencer52402b02007-01-02 05:45:11 +00001133 else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
Reid Spencer229e9362006-12-02 22:14:11 +00001134 result[5] = 'u';
1135 else
1136 yyerror("Invalid integral type for setcc");
1137 }
1138 return result;
1139}
1140
Reid Spencerb6673a92007-01-15 02:41:46 +00001141const Type* getFunctionReturnType(const Type* PFTy) {
Reid Spencer319a7302007-01-05 17:20:02 +00001142 PFTy = PFTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001143 if (PFTy->isPointer()) {
Reid Spencerb6673a92007-01-15 02:41:46 +00001144 const Type* ElemTy = PFTy->getElementType();
Reid Spencer319a7302007-01-05 17:20:02 +00001145 ElemTy = ElemTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001146 if (ElemTy->isFunction())
Reid Spencer319a7302007-01-05 17:20:02 +00001147 return ElemTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +00001148 } else if (PFTy->isFunction()) {
Reid Spencer319a7302007-01-05 17:20:02 +00001149 return PFTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +00001150 }
Reid Spencer319a7302007-01-05 17:20:02 +00001151 return PFTy;
Reid Spencer52402b02007-01-02 05:45:11 +00001152}
1153
Reid Spencerb6673a92007-01-15 02:41:46 +00001154const Type* ResolveUpReference(const Type* Ty,
1155 Type::UpRefStack* stack) {
Reid Spencereff838e2007-01-03 23:45:42 +00001156 assert(Ty->isUpReference() && "Can't resolve a non-upreference");
Reid Spencer319a7302007-01-05 17:20:02 +00001157 unsigned upref = Ty->getUpRefNum();
Reid Spencereff838e2007-01-03 23:45:42 +00001158 assert(upref < stack->size() && "Invalid up reference");
1159 return (*stack)[upref - stack->size() - 1];
1160}
1161
Reid Spencerb6673a92007-01-15 02:41:46 +00001162const Type* getGEPIndexedType(const Type* PTy, ValueList* idxs) {
1163 const Type* Result = PTy = PTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001164 assert(PTy->isPointer() && "GEP Operand is not a pointer?");
Reid Spencerb6673a92007-01-15 02:41:46 +00001165 Type::UpRefStack stack;
Reid Spencereff838e2007-01-03 23:45:42 +00001166 for (unsigned i = 0; i < idxs->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00001167 if (Result->isComposite()) {
1168 Result = Result->getIndexedType((*idxs)[i]);
Reid Spencer319a7302007-01-05 17:20:02 +00001169 Result = Result->resolve();
Reid Spencereff838e2007-01-03 23:45:42 +00001170 stack.push_back(Result);
Reid Spencer52402b02007-01-02 05:45:11 +00001171 } else
1172 yyerror("Invalid type for index");
1173 }
Reid Spencereff838e2007-01-03 23:45:42 +00001174 // Resolve upreferences so we can return a more natural type
1175 if (Result->isPointer()) {
1176 if (Result->getElementType()->isUpReference()) {
1177 stack.push_back(Result);
1178 Result = ResolveUpReference(Result->getElementType(), &stack);
1179 }
1180 } else if (Result->isUpReference()) {
1181 Result = ResolveUpReference(Result->getElementType(), &stack);
1182 }
Reid Spencer52402b02007-01-02 05:45:11 +00001183 return Result->getPointerType();
1184}
1185
Reid Spencer52402b02007-01-02 05:45:11 +00001186// This function handles appending .u or .s to integer value names that
1187// were previously unsigned or signed, respectively. This avoids name
1188// collisions since the unsigned and signed type planes have collapsed
1189// into a single signless type plane.
Reid Spencerb6673a92007-01-15 02:41:46 +00001190std::string getUniqueName(const std::string *Name, const Type* Ty,
Reid Spencer30d0c582007-01-15 00:26:18 +00001191 bool isGlobal = false, bool isDef = false) {
Reid Spencer319a7302007-01-05 17:20:02 +00001192
Reid Spencer52402b02007-01-02 05:45:11 +00001193 // If its not a symbolic name, don't modify it, probably a constant val.
1194 if ((*Name)[0] != '%' && (*Name)[0] != '"')
1195 return *Name;
Reid Spencer319a7302007-01-05 17:20:02 +00001196
Reid Spencer52402b02007-01-02 05:45:11 +00001197 // If its a numeric reference, just leave it alone.
1198 if (isdigit((*Name)[1]))
1199 return *Name;
1200
1201 // Resolve the type
Reid Spencer319a7302007-01-05 17:20:02 +00001202 Ty = Ty->resolve();
1203
1204 // If its a global name, get its uniquified name, if any
Reid Spencerb6673a92007-01-15 02:41:46 +00001205 Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
1206 if (GI != Type::Globals.end()) {
1207 Type::TypePlaneMap::iterator TPI = GI->second.begin();
1208 Type::TypePlaneMap::iterator TPE = GI->second.end();
Reid Spencer319a7302007-01-05 17:20:02 +00001209 for ( ; TPI != TPE ; ++TPI) {
1210 if (TPI->first->sameNewTyAs(Ty))
1211 return TPI->second;
1212 }
1213 }
1214
1215 if (isGlobal) {
1216 // We didn't find a global name, but if its supposed to be global then all
1217 // we can do is return the name. This is probably a forward reference of a
1218 // global value that hasn't been defined yet. Since we have no definition
1219 // we don't know its linkage class. Just assume its an external and the name
1220 // shouldn't change.
1221 return *Name;
1222 }
Reid Spencer52402b02007-01-02 05:45:11 +00001223
1224 // Default the result to the current name
Reid Spencerf8383de2007-01-06 06:04:32 +00001225 std::string Result = Ty->makeUniqueName(*Name);
Reid Spencer52402b02007-01-02 05:45:11 +00001226
Reid Spencer52402b02007-01-02 05:45:11 +00001227 return Result;
1228}
1229
Reid Spencer319a7302007-01-05 17:20:02 +00001230std::string getGlobalName(const std::string* Name, const std::string Linkage,
Reid Spencerb6673a92007-01-15 02:41:46 +00001231 const Type* Ty, bool isConstant) {
Reid Spencer319a7302007-01-05 17:20:02 +00001232 // Default to given name
1233 std::string Result = *Name;
1234 // Look up the name in the Globals Map
Reid Spencerb6673a92007-01-15 02:41:46 +00001235 Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
Reid Spencer319a7302007-01-05 17:20:02 +00001236 // Did we see this global name before?
Reid Spencerb6673a92007-01-15 02:41:46 +00001237 if (GI != Type::Globals.end()) {
Reid Spencer319a7302007-01-05 17:20:02 +00001238 if (Ty->isUnresolvedDeep()) {
1239 // The Gval's type is unresolved. Consequently, we can't disambiguate it
1240 // by type. We'll just change its name and emit a warning.
1241 warning("Cannot disambiguate global value '" + *Name +
1242 "' because type '" + Ty->getNewTy() + "'is unresolved.\n");
1243 Result = *Name + ".unique";
1244 UniqueNameCounter++;
1245 Result += llvm::utostr(UniqueNameCounter);
1246 return Result;
1247 } else {
Reid Spencerb6673a92007-01-15 02:41:46 +00001248 Type::TypePlaneMap::iterator TPI = GI->second.find(Ty);
Reid Spencer319a7302007-01-05 17:20:02 +00001249 if (TPI != GI->second.end()) {
1250 // We found an existing name of the same old type. This isn't allowed
1251 // in LLVM 2.0. Consequently, we must alter the name of the global so it
1252 // can at least compile. References to the global will yield the first
1253 // definition, which is okay. We also must warn about this.
1254 Result = *Name + ".unique";
1255 UniqueNameCounter++;
1256 Result += llvm::utostr(UniqueNameCounter);
1257 warning(std::string("Global variable '") + *Name + "' was renamed to '"+
1258 Result + "'");
1259 } else {
1260 // There isn't an existing definition for this name according to the
1261 // old types. Now search the TypePlanMap for types with the same new
1262 // name.
Reid Spencerb6673a92007-01-15 02:41:46 +00001263 Type::TypePlaneMap::iterator TPI = GI->second.begin();
1264 Type::TypePlaneMap::iterator TPE = GI->second.end();
Reid Spencer319a7302007-01-05 17:20:02 +00001265 for ( ; TPI != TPE; ++TPI) {
1266 if (TPI->first->sameNewTyAs(Ty)) {
1267 // The new types are the same but the old types are different so
1268 // this is a global name collision resulting from type planes
1269 // collapsing.
1270 if (Linkage == "external" || Linkage == "dllimport" ||
1271 Linkage == "extern_weak" || Linkage == "") {
1272 // The linkage of this gval is external so we can't reliably
1273 // rename it because it could potentially create a linking
1274 // problem. However, we can't leave the name conflict in the
1275 // output either or it won't assemble with LLVM 2.0. So, all we
1276 // can do is rename this one to something unique and emit a
1277 // warning about the problem.
1278 Result = *Name + ".unique";
1279 UniqueNameCounter++;
1280 Result += llvm::utostr(UniqueNameCounter);
1281 warning("Renaming global value '" + *Name + "' to '" + Result +
1282 "' may cause linkage errors.");
1283 return Result;
1284 } else {
1285 // Its linkage is internal and its type is known so we can
1286 // disambiguate the name collision successfully based on the type.
1287 Result = getUniqueName(Name, Ty);
1288 TPI->second = Result;
1289 return Result;
1290 }
1291 }
1292 }
1293 // We didn't find an entry in the type plane with the same new type and
1294 // the old types differ so this is a new type plane for this global
1295 // variable. We just fall through to the logic below which inserts
1296 // the global.
1297 }
1298 }
1299 }
1300
1301 // Its a new global name, if it is external we can't change it
1302 if (isConstant || Linkage == "external" || Linkage == "dllimport" ||
1303 Linkage == "extern_weak" || Linkage == "") {
Reid Spencerb6673a92007-01-15 02:41:46 +00001304 Type::Globals[Result][Ty] = Result;
Reid Spencer319a7302007-01-05 17:20:02 +00001305 return Result;
1306 }
1307
1308 // Its a new global name, and it is internal, change the name to make it
1309 // unique for its type.
1310 // Result = getUniqueName(Name, Ty);
Reid Spencerb6673a92007-01-15 02:41:46 +00001311 Type::Globals[*Name][Ty] = Result;
Reid Spencer319a7302007-01-05 17:20:02 +00001312 return Result;
1313}
1314
Reid Spencer30d0c582007-01-15 00:26:18 +00001315} // End anonymous namespace
1316
Reid Spencerb6673a92007-01-15 02:41:46 +00001317// This function is used by the Lexer to create a Type. It can't be
Reid Spencer30d0c582007-01-15 00:26:18 +00001318// in the anonymous namespace.
Reid Spencerb6673a92007-01-15 02:41:46 +00001319const Type* getType(const std::string& newTy, TypeIDs oldTy) {
1320 return Type::get(newTy, oldTy);
Reid Spencer30d0c582007-01-15 00:26:18 +00001321}
1322
1323
Reid Spencer319a7302007-01-05 17:20:02 +00001324
1325/* Enabling traces. */
1326#ifndef YYDEBUG
1327# define YYDEBUG 0
1328#endif
1329
1330/* Enabling verbose error messages. */
1331#ifdef YYERROR_VERBOSE
1332# undef YYERROR_VERBOSE
1333# define YYERROR_VERBOSE 1
1334#else
1335# define YYERROR_VERBOSE 0
1336#endif
1337
1338/* Enabling the token table. */
1339#ifndef YYTOKEN_TABLE
1340# define YYTOKEN_TABLE 0
1341#endif
1342
1343#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
Reid Spencerb6673a92007-01-15 02:41:46 +00001344#line 971 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00001345typedef union YYSTYPE {
Reid Spencere77e35e2006-12-01 20:26:20 +00001346 std::string* String;
Reid Spencerb6673a92007-01-15 02:41:46 +00001347 const Type* Ty;
1348 Value* Val;
1349 Constant* Const;
Reid Spencerf8483652006-12-02 15:16:01 +00001350 ValueList* ValList;
Reid Spencer52402b02007-01-02 05:45:11 +00001351 TypeList* TypeVec;
Reid Spencere77e35e2006-12-01 20:26:20 +00001352} YYSTYPE;
Reid Spencer319a7302007-01-05 17:20:02 +00001353/* Line 196 of yacc.c. */
Reid Spencerb6673a92007-01-15 02:41:46 +00001354#line 1355 "UpgradeParser.tab.c"
Reid Spencer319a7302007-01-05 17:20:02 +00001355# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1356# define YYSTYPE_IS_DECLARED 1
1357# define YYSTYPE_IS_TRIVIAL 1
Reid Spencere7c3c602006-11-30 06:36:44 +00001358#endif
1359
1360
1361
Reid Spencer319a7302007-01-05 17:20:02 +00001362/* Copy the second part of user declarations. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001363
1364
Reid Spencer319a7302007-01-05 17:20:02 +00001365/* Line 219 of yacc.c. */
Reid Spencerb6673a92007-01-15 02:41:46 +00001366#line 1367 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00001367
Reid Spencer319a7302007-01-05 17:20:02 +00001368#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1369# define YYSIZE_T __SIZE_TYPE__
1370#endif
1371#if ! defined (YYSIZE_T) && defined (size_t)
1372# define YYSIZE_T size_t
1373#endif
1374#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1375# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1376# define YYSIZE_T size_t
1377#endif
1378#if ! defined (YYSIZE_T)
1379# define YYSIZE_T unsigned int
1380#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001381
Reid Spencer319a7302007-01-05 17:20:02 +00001382#ifndef YY_
1383# if YYENABLE_NLS
1384# if ENABLE_NLS
1385# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1386# define YY_(msgid) dgettext ("bison-runtime", msgid)
1387# endif
1388# endif
1389# ifndef YY_
1390# define YY_(msgid) msgid
1391# endif
1392#endif
1393
1394#if ! defined (yyoverflow) || YYERROR_VERBOSE
1395
1396/* The parser invokes alloca or malloc; define the necessary symbols. */
1397
1398# ifdef YYSTACK_USE_ALLOCA
1399# if YYSTACK_USE_ALLOCA
1400# ifdef __GNUC__
1401# define YYSTACK_ALLOC __builtin_alloca
1402# else
1403# define YYSTACK_ALLOC alloca
1404# if defined (__STDC__) || defined (__cplusplus)
1405# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1406# define YYINCLUDED_STDLIB_H
1407# endif
1408# endif
1409# endif
1410# endif
1411
1412# ifdef YYSTACK_ALLOC
1413 /* Pacify GCC's `empty if-body' warning. */
1414# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1415# ifndef YYSTACK_ALLOC_MAXIMUM
1416 /* The OS might guarantee only one guard page at the bottom of the stack,
1417 and a page size can be as small as 4096 bytes. So we cannot safely
1418 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1419 to allow for a few compiler-allocated temporary stack slots. */
1420# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1421# endif
1422# else
1423# define YYSTACK_ALLOC YYMALLOC
1424# define YYSTACK_FREE YYFREE
1425# ifndef YYSTACK_ALLOC_MAXIMUM
1426# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1427# endif
1428# ifdef __cplusplus
1429extern "C" {
1430# endif
1431# ifndef YYMALLOC
1432# define YYMALLOC malloc
1433# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1434 && (defined (__STDC__) || defined (__cplusplus)))
1435void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1436# endif
1437# endif
1438# ifndef YYFREE
1439# define YYFREE free
1440# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1441 && (defined (__STDC__) || defined (__cplusplus)))
1442void free (void *); /* INFRINGES ON USER NAME SPACE */
1443# endif
1444# endif
1445# ifdef __cplusplus
1446}
1447# endif
1448# endif
1449#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1450
1451
1452#if (! defined (yyoverflow) \
1453 && (! defined (__cplusplus) \
1454 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1455
1456/* A type that is properly aligned for any stack member. */
1457union yyalloc
1458{
1459 short int yyss;
1460 YYSTYPE yyvs;
1461 };
1462
1463/* The size of the maximum gap between one aligned stack and the next. */
1464# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1465
1466/* The size of an array large to enough to hold all stacks, each with
1467 N elements. */
1468# define YYSTACK_BYTES(N) \
1469 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
1470 + YYSTACK_GAP_MAXIMUM)
1471
1472/* Copy COUNT objects from FROM to TO. The source and destination do
1473 not overlap. */
1474# ifndef YYCOPY
1475# if defined (__GNUC__) && 1 < __GNUC__
1476# define YYCOPY(To, From, Count) \
1477 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1478# else
1479# define YYCOPY(To, From, Count) \
1480 do \
1481 { \
1482 YYSIZE_T yyi; \
1483 for (yyi = 0; yyi < (Count); yyi++) \
1484 (To)[yyi] = (From)[yyi]; \
1485 } \
1486 while (0)
1487# endif
1488# endif
1489
1490/* Relocate STACK from its old location to the new one. The
1491 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1492 elements in the stack, and YYPTR gives the new location of the
1493 stack. Advance YYPTR to a properly aligned location for the next
1494 stack. */
1495# define YYSTACK_RELOCATE(Stack) \
1496 do \
1497 { \
1498 YYSIZE_T yynewbytes; \
1499 YYCOPY (&yyptr->Stack, Stack, yysize); \
1500 Stack = &yyptr->Stack; \
1501 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1502 yyptr += yynewbytes / sizeof (*yyptr); \
1503 } \
1504 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00001505
1506#endif
1507
Reid Spencer319a7302007-01-05 17:20:02 +00001508#if defined (__STDC__) || defined (__cplusplus)
1509 typedef signed char yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001510#else
Reid Spencer319a7302007-01-05 17:20:02 +00001511 typedef short int yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001512#endif
1513
Reid Spencer319a7302007-01-05 17:20:02 +00001514/* YYFINAL -- State number of the termination state. */
1515#define YYFINAL 4
1516/* YYLAST -- Last index in YYTABLE. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001517#define YYLAST 1473
Reid Spencer319a7302007-01-05 17:20:02 +00001518
1519/* YYNTOKENS -- Number of terminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001520#define YYNTOKENS 164
Reid Spencer319a7302007-01-05 17:20:02 +00001521/* YYNNTS -- Number of nonterminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001522#define YYNNTS 76
Reid Spencer319a7302007-01-05 17:20:02 +00001523/* YYNRULES -- Number of rules. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001524#define YYNRULES 301
Reid Spencer319a7302007-01-05 17:20:02 +00001525/* YYNRULES -- Number of states. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001526#define YYNSTATES 585
Reid Spencer319a7302007-01-05 17:20:02 +00001527
1528/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1529#define YYUNDEFTOK 2
Reid Spencerc4d96252007-01-13 00:03:30 +00001530#define YYMAXUTOK 404
Reid Spencer319a7302007-01-05 17:20:02 +00001531
1532#define YYTRANSLATE(YYX) \
1533 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1534
1535/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1536static const unsigned char yytranslate[] =
1537{
1538 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001542 153, 154, 162, 2, 151, 2, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001544 158, 150, 159, 2, 2, 2, 2, 2, 2, 2,
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 2, 155, 152, 157, 2, 2, 2, 2, 2, 163,
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,
Reid Spencerc4d96252007-01-13 00:03:30 +00001550 156, 2, 2, 160, 2, 161, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001551 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, 2, 2, 2, 2,
1561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1563 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1564 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1565 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1566 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1567 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1568 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1569 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1570 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1571 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1572 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1573 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1574 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1575 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1576 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1577 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Reid Spencerc4d96252007-01-13 00:03:30 +00001578 145, 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00001579};
1580
1581#if YYDEBUG
1582/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1583 YYRHS. */
1584static const unsigned short int yyprhs[] =
1585{
1586 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1587 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1588 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1589 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1590 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1591 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1592 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1593 139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1594 159, 161, 164, 165, 167, 169, 171, 173, 175, 177,
1595 179, 180, 182, 184, 186, 188, 190, 192, 195, 196,
1596 197, 200, 201, 205, 208, 209, 211, 212, 216, 218,
1597 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1598 241, 243, 245, 247, 249, 251, 253, 255, 257, 259,
1599 261, 264, 269, 275, 281, 285, 288, 294, 299, 302,
1600 304, 308, 310, 314, 316, 317, 322, 326, 330, 335,
1601 340, 344, 347, 350, 353, 356, 359, 362, 365, 368,
1602 371, 374, 381, 387, 396, 403, 410, 417, 425, 433,
1603 440, 447, 456, 465, 469, 471, 473, 475, 477, 480,
1604 483, 488, 491, 493, 495, 497, 502, 505, 510, 517,
1605 524, 531, 538, 542, 547, 548, 550, 552, 554, 558,
1606 562, 566, 570, 574, 578, 580, 581, 583, 585, 587,
1607 588, 591, 595, 597, 599, 603, 605, 606, 615, 617,
Reid Spencerc4d96252007-01-13 00:03:30 +00001608 619, 623, 625, 627, 631, 632, 634, 636, 637, 642,
1609 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
1610 665, 667, 673, 675, 677, 679, 681, 684, 687, 689,
1611 692, 695, 696, 698, 700, 702, 705, 708, 712, 722,
1612 732, 741, 756, 758, 760, 767, 773, 776, 783, 791,
1613 793, 797, 799, 800, 803, 805, 811, 817, 823, 830,
1614 837, 842, 847, 854, 859, 864, 871, 878, 881, 889,
1615 891, 894, 895, 897, 898, 902, 909, 913, 920, 923,
1616 928, 935
Reid Spencer319a7302007-01-05 17:20:02 +00001617};
1618
1619/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1620static const short int yyrhs[] =
1621{
Reid Spencerc4d96252007-01-13 00:03:30 +00001622 198, 0, -1, 19, -1, 20, -1, 17, -1, 18,
1623 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1624 -1, 84, -1, 85, -1, 86, -1, 87, -1, 88,
1625 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1626 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1627 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1628 -1, 106, -1, 117, -1, 118, -1, 119, -1, 120,
1629 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1630 -1, 112, -1, 113, -1, 114, -1, 115, -1, 116,
1631 -1, 117, -1, 118, -1, 119, -1, 120, -1, 25,
1632 -1, 26, -1, 129, -1, 130, -1, 131, -1, 132,
1633 -1, 138, -1, 139, -1, 140, -1, 141, -1, 142,
1634 -1, 143, -1, 144, -1, 145, -1, 146, -1, 147,
1635 -1, 148, -1, 149, -1, 137, -1, 11, -1, 9,
Reid Spencer319a7302007-01-05 17:20:02 +00001636 -1, 7, -1, 5, -1, 12, -1, 10, -1, 8,
Reid Spencerc4d96252007-01-13 00:03:30 +00001637 -1, 6, -1, 174, -1, 175, -1, 13, -1, 14,
1638 -1, 207, 150, -1, -1, 42, -1, 43, -1, 44,
Reid Spencer319a7302007-01-05 17:20:02 +00001639 -1, 48, -1, 45, -1, 46, -1, 47, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001640 65, -1, 66, -1, 67, -1, 68, -1, 69, -1,
1641 70, -1, 64, 18, -1, -1, -1, 56, 18, -1,
1642 -1, 151, 56, 18, -1, 37, 30, -1, -1, 183,
1643 -1, -1, 151, 186, 185, -1, 183, -1, 56, 18,
1644 -1, 189, -1, 3, -1, 191, -1, 3, -1, 191,
Reid Spencer319a7302007-01-05 17:20:02 +00001645 -1, 4, -1, 5, -1, 6, -1, 7, -1, 8,
1646 -1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
Reid Spencerc4d96252007-01-13 00:03:30 +00001647 -1, 14, -1, 15, -1, 16, -1, 222, -1, 190,
1648 -1, 152, 18, -1, 188, 153, 193, 154, -1, 155,
1649 18, 156, 191, 157, -1, 158, 18, 156, 191, 159,
1650 -1, 160, 192, 161, -1, 160, 161, -1, 158, 160,
1651 192, 161, 159, -1, 158, 160, 161, 159, -1, 191,
1652 162, -1, 191, -1, 192, 151, 191, -1, 192, -1,
1653 192, 151, 40, -1, 40, -1, -1, 189, 155, 196,
1654 157, -1, 189, 155, 157, -1, 189, 163, 30, -1,
1655 189, 158, 196, 159, -1, 189, 160, 196, 161, -1,
1656 189, 160, 161, -1, 189, 22, -1, 189, 23, -1,
1657 189, 222, -1, 189, 195, -1, 189, 24, -1, 174,
1658 166, -1, 175, 166, -1, 4, 25, -1, 4, 26,
1659 -1, 177, 21, -1, 173, 153, 194, 39, 189, 154,
1660 -1, 126, 153, 194, 237, 154, -1, 128, 153, 194,
1661 151, 194, 151, 194, 154, -1, 167, 153, 194, 151,
1662 194, 154, -1, 168, 153, 194, 151, 194, 154, -1,
1663 169, 153, 194, 151, 194, 154, -1, 99, 170, 153,
1664 194, 151, 194, 154, -1, 100, 171, 153, 194, 151,
1665 194, 154, -1, 172, 153, 194, 151, 194, 154, -1,
1666 134, 153, 194, 151, 194, 154, -1, 135, 153, 194,
1667 151, 194, 151, 194, 154, -1, 136, 153, 194, 151,
1668 194, 151, 194, 154, -1, 196, 151, 194, -1, 194,
1669 -1, 35, -1, 36, -1, 199, -1, 199, 216, -1,
1670 199, 218, -1, 199, 62, 61, 202, -1, 199, 31,
1671 -1, 201, -1, 49, -1, 57, -1, 201, 178, 27,
1672 187, -1, 201, 218, -1, 201, 62, 61, 202, -1,
1673 201, 178, 179, 197, 194, 185, -1, 201, 178, 200,
1674 197, 189, 185, -1, 201, 178, 45, 197, 189, 185,
1675 -1, 201, 178, 47, 197, 189, 185, -1, 201, 50,
1676 204, -1, 201, 58, 150, 205, -1, -1, 30, -1,
1677 55, -1, 54, -1, 52, 150, 203, -1, 53, 150,
1678 18, -1, 51, 150, 30, -1, 71, 150, 30, -1,
1679 155, 206, 157, -1, 206, 151, 30, -1, 30, -1,
1680 -1, 28, -1, 30, -1, 207, -1, -1, 189, 208,
1681 -1, 210, 151, 209, -1, 209, -1, 210, -1, 210,
1682 151, 40, -1, 40, -1, -1, 180, 187, 207, 153,
1683 211, 154, 184, 181, -1, 32, -1, 160, -1, 179,
1684 212, 213, -1, 33, -1, 161, -1, 214, 225, 215,
1685 -1, -1, 45, -1, 47, -1, -1, 34, 219, 217,
1686 212, -1, -1, 63, -1, 17, -1, 18, -1, 21,
1687 -1, 25, -1, 26, -1, 22, -1, 23, -1, 24,
1688 -1, 158, 196, 159, -1, 195, -1, 61, 220, 30,
1689 151, 30, -1, 165, -1, 207, -1, 222, -1, 221,
1690 -1, 189, 223, -1, 225, 226, -1, 226, -1, 227,
1691 229, -1, 227, 231, -1, -1, 29, -1, 77, -1,
1692 76, -1, 72, 224, -1, 72, 3, -1, 73, 15,
1693 223, -1, 73, 4, 223, 151, 15, 223, 151, 15,
1694 223, -1, 74, 176, 223, 151, 15, 223, 155, 230,
1695 157, -1, 74, 176, 223, 151, 15, 223, 155, 157,
1696 -1, 178, 75, 180, 187, 223, 153, 234, 154, 39,
1697 15, 223, 228, 15, 223, -1, 228, -1, 78, -1,
1698 230, 176, 221, 151, 15, 223, -1, 176, 221, 151,
1699 15, 223, -1, 178, 236, -1, 189, 155, 223, 151,
1700 223, 157, -1, 232, 151, 155, 223, 151, 223, 157,
1701 -1, 224, -1, 233, 151, 224, -1, 233, -1, -1,
1702 60, 59, -1, 59, -1, 167, 189, 223, 151, 223,
1703 -1, 168, 189, 223, 151, 223, -1, 169, 189, 223,
1704 151, 223, -1, 99, 170, 189, 223, 151, 223, -1,
1705 100, 171, 189, 223, 151, 223, -1, 172, 224, 151,
1706 224, -1, 173, 224, 39, 189, -1, 128, 224, 151,
1707 224, 151, 224, -1, 133, 224, 151, 189, -1, 134,
1708 224, 151, 224, -1, 135, 224, 151, 224, 151, 224,
1709 -1, 136, 224, 151, 224, 151, 224, -1, 127, 232,
1710 -1, 235, 180, 187, 223, 153, 234, 154, -1, 239,
1711 -1, 151, 233, -1, -1, 38, -1, -1, 121, 189,
1712 182, -1, 121, 189, 151, 10, 223, 182, -1, 122,
1713 189, 182, -1, 122, 189, 151, 10, 223, 182, -1,
1714 123, 224, -1, 238, 124, 189, 223, -1, 238, 125,
1715 224, 151, 189, 223, -1, 126, 189, 223, 237, -1
Reid Spencer319a7302007-01-05 17:20:02 +00001716};
1717
1718/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1719static const unsigned short int yyrline[] =
1720{
Reid Spencerb6673a92007-01-15 02:41:46 +00001721 0, 1036, 1036, 1036, 1037, 1037, 1041, 1041, 1041, 1041,
1722 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1043, 1043, 1043,
1723 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045,
1724 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046,
1725 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047,
1726 1047, 1047, 1048, 1048, 1048, 1048, 1049, 1049, 1049, 1049,
1727 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1050, 1055,
1728 1055, 1055, 1055, 1056, 1056, 1056, 1056, 1057, 1057, 1058,
1729 1058, 1061, 1064, 1069, 1069, 1069, 1069, 1069, 1069, 1070,
1730 1071, 1074, 1074, 1074, 1074, 1074, 1075, 1076, 1081, 1086,
1731 1087, 1090, 1091, 1099, 1105, 1106, 1109, 1110, 1119, 1120,
1732 1133, 1133, 1134, 1134, 1135, 1139, 1139, 1139, 1139, 1139,
1733 1139, 1139, 1140, 1140, 1140, 1140, 1140, 1142, 1145, 1148,
1734 1151, 1155, 1168, 1174, 1180, 1190, 1193, 1203, 1206, 1214,
1735 1218, 1225, 1226, 1231, 1236, 1246, 1253, 1259, 1266, 1273,
1736 1280, 1286, 1293, 1300, 1308, 1315, 1322, 1329, 1336, 1343,
1737 1350, 1358, 1372, 1384, 1389, 1395, 1400, 1406, 1411, 1416,
1738 1424, 1429, 1434, 1444, 1449, 1454, 1454, 1464, 1469, 1472,
1739 1477, 1481, 1485, 1487, 1487, 1490, 1500, 1505, 1510, 1520,
1740 1530, 1540, 1550, 1555, 1560, 1565, 1567, 1567, 1570, 1575,
1741 1582, 1587, 1594, 1601, 1606, 1607, 1615, 1615, 1616, 1616,
1742 1618, 1627, 1631, 1635, 1638, 1643, 1646, 1649, 1672, 1673,
1743 1676, 1687, 1688, 1690, 1699, 1700, 1701, 1705, 1705, 1719,
1744 1720, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1724, 1725,
1745 1730, 1731, 1740, 1740, 1744, 1750, 1761, 1770, 1773, 1781,
1746 1785, 1790, 1793, 1799, 1799, 1801, 1806, 1811, 1816, 1824,
1747 1834, 1843, 1865, 1870, 1876, 1882, 1890, 1908, 1917, 1927,
1748 1931, 1938, 1939, 1943, 1948, 1951, 1962, 1972, 1983, 1993,
1749 2003, 2014, 2044, 2053, 2060, 2069, 2076, 2083, 2089, 2140,
1750 2145, 2146, 2150, 2151, 2154, 2163, 2173, 2182, 2193, 2200,
1751 2211, 2222
Reid Spencer319a7302007-01-05 17:20:02 +00001752};
1753#endif
1754
1755#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1756/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1757 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1758static const char *const yytname[] =
1759{
1760 "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE",
1761 "SHORT", "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE",
1762 "LABEL", "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL",
1763 "FPVAL", "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK",
1764 "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1765 "BEGINTOK", "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION",
1766 "VOLATILE", "TO", "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK",
Reid Spencerc4d96252007-01-13 00:03:30 +00001767 "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "EXTERNAL",
Reid Spencer319a7302007-01-05 17:20:02 +00001768 "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN",
1769 "UNINITIALIZED", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1770 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1771 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1772 "RET", "BR", "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE",
1773 "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM",
1774 "SREM", "FREM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT",
1775 "SETEQ", "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1776 "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE",
1777 "ULT", "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1778 "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR",
1779 "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST",
1780 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI",
1781 "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','",
1782 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1783 "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps",
1784 "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps",
1785 "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1786 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString",
1787 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV",
1788 "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
1789 "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1790 "Module", "DefinitionList", "External", "ConstPool", "AsmBlock",
1791 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1792 "Name", "OptName", "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH",
1793 "BEGIN", "FunctionHeader", "END", "Function", "FnDeclareLinkage",
Reid Spencerc4d96252007-01-13 00:03:30 +00001794 "FunctionProto", "@1", "OptSideEffect", "ConstValueRef",
1795 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1796 "BasicBlock", "InstructionList", "Unwind", "BBTerminatorInst",
1797 "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE",
1798 "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0
Reid Spencer319a7302007-01-05 17:20:02 +00001799};
1800#endif
1801
1802# ifdef YYPRINT
1803/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1804 token YYLEX-NUM. */
1805static const unsigned short int yytoknum[] =
1806{
1807 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1808 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1809 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1810 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1811 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1812 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1813 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1814 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1815 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1816 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1817 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1818 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1819 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1820 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1821 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Reid Spencerc4d96252007-01-13 00:03:30 +00001822 61, 44, 92, 40, 41, 91, 120, 93, 60, 62,
1823 123, 125, 42, 99
Reid Spencer319a7302007-01-05 17:20:02 +00001824};
1825# endif
1826
1827/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1828static const unsigned char yyr1[] =
1829{
Reid Spencerc4d96252007-01-13 00:03:30 +00001830 0, 164, 165, 165, 166, 166, 167, 167, 167, 167,
1831 167, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1832 169, 169, 169, 169, 169, 169, 170, 170, 170, 170,
Reid Spencer319a7302007-01-05 17:20:02 +00001833 170, 170, 170, 170, 170, 170, 171, 171, 171, 171,
Reid Spencerc4d96252007-01-13 00:03:30 +00001834 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1835 171, 171, 172, 172, 172, 172, 173, 173, 173, 173,
1836 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1837 174, 174, 174, 175, 175, 175, 175, 176, 176, 177,
1838 177, 178, 178, 179, 179, 179, 179, 179, 179, 179,
1839 179, 180, 180, 180, 180, 180, 180, 180, 180, 181,
1840 181, 182, 182, 183, 184, 184, 185, 185, 186, 186,
1841 187, 187, 188, 188, 189, 190, 190, 190, 190, 190,
1842 190, 190, 190, 190, 190, 190, 190, 191, 191, 191,
1843 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1844 192, 193, 193, 193, 193, 194, 194, 194, 194, 194,
1845 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
1846 194, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1847 195, 195, 195, 196, 196, 197, 197, 198, 199, 199,
1848 199, 199, 199, 200, 200, 201, 201, 201, 201, 201,
1849 201, 201, 201, 201, 201, 202, 203, 203, 204, 204,
1850 204, 204, 205, 206, 206, 206, 207, 207, 208, 208,
1851 209, 210, 210, 211, 211, 211, 211, 212, 213, 213,
1852 214, 215, 215, 216, 217, 217, 217, 219, 218, 220,
1853 220, 221, 221, 221, 221, 221, 221, 221, 221, 221,
1854 221, 221, 222, 222, 223, 223, 224, 225, 225, 226,
1855 227, 227, 227, 228, 228, 229, 229, 229, 229, 229,
1856 229, 229, 229, 229, 230, 230, 231, 232, 232, 233,
1857 233, 234, 234, 235, 235, 236, 236, 236, 236, 236,
1858 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1859 237, 237, 238, 238, 239, 239, 239, 239, 239, 239,
1860 239, 239
Reid Spencer319a7302007-01-05 17:20:02 +00001861};
1862
1863/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1864static const unsigned char yyr2[] =
1865{
1866 0, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1872 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1873 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1874 1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1875 0, 1, 1, 1, 1, 1, 1, 2, 0, 0,
1876 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1877 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1878 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1879 2, 4, 5, 5, 3, 2, 5, 4, 2, 1,
1880 3, 1, 3, 1, 0, 4, 3, 3, 4, 4,
1881 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1882 2, 6, 5, 8, 6, 6, 6, 7, 7, 6,
1883 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1884 4, 2, 1, 1, 1, 4, 2, 4, 6, 6,
1885 6, 6, 3, 4, 0, 1, 1, 1, 3, 3,
1886 3, 3, 3, 3, 1, 0, 1, 1, 1, 0,
1887 2, 3, 1, 1, 3, 1, 0, 8, 1, 1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001888 3, 1, 1, 3, 0, 1, 1, 0, 4, 0,
1889 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1890 1, 5, 1, 1, 1, 1, 2, 2, 1, 2,
1891 2, 0, 1, 1, 1, 2, 2, 3, 9, 9,
1892 8, 14, 1, 1, 6, 5, 2, 6, 7, 1,
1893 3, 1, 0, 2, 1, 5, 5, 5, 6, 6,
1894 4, 4, 6, 4, 4, 6, 6, 2, 7, 1,
1895 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
1896 6, 4
Reid Spencer319a7302007-01-05 17:20:02 +00001897};
1898
1899/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1900 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1901 means the default is an error. */
1902static const unsigned short int yydefact[] =
1903{
Reid Spencerc4d96252007-01-13 00:03:30 +00001904 194, 0, 90, 182, 1, 181, 227, 83, 84, 85,
1905 87, 88, 89, 86, 0, 98, 251, 178, 179, 206,
1906 207, 0, 0, 0, 90, 0, 186, 224, 0, 0,
1907 91, 92, 93, 94, 95, 96, 0, 0, 252, 251,
1908 248, 82, 0, 0, 0, 0, 192, 0, 0, 0,
1909 0, 0, 183, 184, 0, 0, 81, 225, 226, 98,
Reid Spencer319a7302007-01-05 17:20:02 +00001910 195, 180, 97, 111, 115, 116, 117, 118, 119, 120,
1911 121, 122, 123, 124, 125, 126, 127, 2, 3, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001912 0, 0, 0, 242, 0, 0, 110, 129, 114, 243,
1913 128, 218, 219, 220, 221, 222, 223, 247, 0, 0,
1914 0, 254, 253, 263, 293, 262, 249, 250, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001915 0, 0, 205, 193, 187, 185, 175, 176, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001916 0, 0, 228, 130, 0, 0, 0, 113, 135, 139,
1917 0, 0, 144, 138, 256, 0, 255, 0, 0, 72,
1918 76, 71, 75, 70, 74, 69, 73, 77, 78, 0,
1919 292, 274, 0, 98, 6, 7, 8, 9, 10, 11,
1920 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1921 22, 23, 24, 25, 0, 0, 0, 0, 0, 0,
1922 0, 0, 52, 53, 54, 55, 0, 0, 0, 0,
1923 68, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1924 65, 66, 67, 0, 0, 0, 0, 0, 98, 266,
1925 0, 289, 200, 197, 196, 198, 199, 201, 204, 0,
1926 106, 106, 115, 116, 117, 118, 119, 120, 121, 122,
1927 123, 124, 125, 0, 0, 0, 0, 106, 106, 0,
1928 0, 0, 0, 0, 134, 216, 143, 141, 0, 231,
1929 232, 233, 236, 237, 238, 234, 235, 229, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001930 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001931 0, 240, 245, 244, 246, 0, 257, 0, 273, 0,
1932 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1933 0, 50, 51, 36, 37, 38, 39, 40, 41, 42,
1934 43, 44, 45, 46, 47, 48, 49, 0, 101, 101,
1935 298, 0, 0, 287, 0, 0, 0, 0, 0, 0,
1936 0, 0, 0, 0, 0, 0, 0, 0, 202, 0,
1937 190, 191, 158, 159, 4, 5, 156, 157, 160, 151,
1938 152, 155, 0, 0, 0, 0, 154, 153, 188, 189,
1939 112, 112, 137, 0, 140, 215, 209, 212, 213, 0,
1940 0, 131, 230, 0, 0, 0, 0, 0, 0, 0,
1941 0, 174, 0, 0, 0, 0, 0, 0, 0, 0,
1942 0, 0, 0, 0, 294, 0, 296, 291, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001943 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001944 0, 0, 0, 203, 0, 0, 108, 106, 146, 0,
1945 0, 150, 0, 147, 132, 133, 136, 208, 210, 0,
1946 104, 142, 0, 0, 0, 291, 0, 0, 0, 0,
1947 0, 239, 0, 0, 0, 0, 0, 0, 0, 0,
1948 0, 0, 0, 0, 0, 0, 301, 0, 0, 0,
1949 283, 284, 0, 0, 0, 0, 0, 280, 281, 0,
1950 299, 0, 103, 109, 107, 145, 148, 149, 214, 211,
1951 105, 99, 0, 0, 0, 0, 0, 0, 0, 0,
1952 173, 0, 0, 0, 0, 0, 0, 0, 272, 0,
1953 0, 101, 102, 101, 269, 290, 0, 0, 0, 0,
1954 0, 275, 276, 277, 272, 0, 0, 217, 241, 0,
1955 0, 162, 0, 0, 0, 0, 0, 0, 0, 0,
1956 0, 0, 0, 271, 0, 278, 279, 0, 295, 297,
1957 0, 0, 0, 282, 285, 286, 0, 300, 100, 0,
1958 0, 0, 170, 0, 0, 164, 165, 166, 169, 161,
1959 0, 260, 0, 0, 0, 270, 267, 0, 288, 167,
1960 168, 0, 0, 0, 258, 0, 259, 0, 0, 268,
1961 163, 171, 172, 0, 0, 0, 0, 0, 0, 265,
1962 0, 0, 264, 0, 261
Reid Spencer319a7302007-01-05 17:20:02 +00001963};
1964
1965/* YYDEFGOTO[NTERM-NUM]. */
1966static const short int yydefgoto[] =
1967{
Reid Spencerc4d96252007-01-13 00:03:30 +00001968 -1, 83, 336, 266, 267, 268, 290, 307, 269, 270,
1969 233, 234, 149, 235, 24, 15, 36, 507, 384, 406,
1970 471, 330, 407, 84, 85, 236, 87, 88, 130, 248,
1971 371, 271, 372, 118, 1, 2, 55, 3, 61, 215,
1972 46, 113, 219, 89, 418, 357, 358, 359, 37, 93,
1973 16, 96, 17, 59, 18, 27, 363, 272, 90, 274,
1974 494, 39, 40, 41, 105, 106, 553, 107, 313, 523,
1975 524, 208, 209, 446, 210, 211
Reid Spencer319a7302007-01-05 17:20:02 +00001976};
1977
1978/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1979 STATE-NUM. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001980#define YYPACT_NINF -537
Reid Spencer319a7302007-01-05 17:20:02 +00001981static const short int yypact[] =
1982{
Reid Spencerc4d96252007-01-13 00:03:30 +00001983 -537, 75, 61, 1145, -537, -537, -537, -537, -537, -537,
1984 -537, -537, -537, -537, 18, 180, 55, -537, -537, -537,
1985 -537, -28, -61, 33, 130, -40, -537, 102, 87, 117,
1986 -537, -537, -537, -537, -537, -537, 838, -24, -537, -15,
1987 -537, 48, -11, -2, 6, 12, -537, 11, 87, 838,
1988 -9, -9, -537, -537, -9, -9, -537, -537, -537, 180,
1989 -537, -537, -537, 32, -537, -537, -537, -537, -537, -537,
1990 -537, -537, -537, -537, -537, -537, -537, -537, -537, 164,
1991 171, -6, 512, -537, 135, 41, -537, -537, -103, -537,
1992 -537, -537, -537, -537, -537, -537, -537, -537, 883, 45,
1993 192, -537, -537, -537, 1324, -537, -537, -537, 175, 126,
1994 190, 188, 203, -537, -537, -537, -537, -537, 911, 911,
1995 957, 911, -537, -537, 81, 97, 561, -537, -537, -103,
1996 -109, 121, 641, -537, 32, 1140, -537, 1140, 1140, -537,
1997 -537, -537, -537, -537, -537, -537, -537, -537, -537, 1140,
1998 -537, -537, 219, 180, -537, -537, -537, -537, -537, -537,
1999 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2000 -537, -537, -537, -537, 10, 112, 911, 911, 911, 911,
2001 911, 911, -537, -537, -537, -537, 911, 911, 911, 911,
2002 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2003 -537, -537, -537, 911, 911, 911, 911, 911, 180, -537,
2004 59, -537, -537, -537, -537, -537, -537, -537, -537, -71,
2005 129, 129, 167, 193, 195, 218, 222, 224, 234, 243,
2006 250, 261, 263, 252, 252, 264, 993, 129, 129, 911,
2007 911, 127, -97, 911, -537, 680, -537, 136, 137, -537,
2008 -537, -537, -537, -537, -537, -537, -537, 229, 10, 112,
2009 140, 141, 144, 145, 146, 957, 147, 148, 150, 154,
2010 155, -537, -537, -537, -537, 158, -537, 160, -537, 838,
2011 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2012 911, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2013 -537, -537, -537, -537, -537, -537, -537, 911, 163, 165,
2014 -537, 1140, 162, 169, 170, 172, 173, 174, 176, 1140,
2015 1140, 1140, 177, 276, 838, 911, 911, 288, -537, -8,
2016 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
2017 -537, -537, 724, 957, 590, 292, -537, -537, -537, -537,
2018 -106, -104, -537, 179, -103, -537, 135, -537, 178, 181,
2019 752, -537, -537, 296, 183, 187, 957, 957, 957, 957,
2020 957, -537, -131, 957, 957, 957, 957, 957, 315, 316,
2021 1140, 1140, 1140, 1, -537, 7, -537, 191, 1140, 186,
2022 911, 911, 911, 911, 911, 194, 197, 201, 911, 911,
2023 1140, 1140, 202, -537, 304, 326, -537, 129, -537, -60,
2024 -78, -537, -74, -537, -537, -537, -537, -537, -537, 799,
2025 309, -537, 208, 957, 957, 191, 210, 213, 223, 225,
2026 957, -537, 230, 231, 235, 236, 308, 1140, 1140, 227,
2027 237, 238, 1140, 357, 1140, 911, -537, 239, 1140, 241,
2028 -537, -537, 242, 244, 1140, 1140, 1140, -537, -537, 248,
2029 -537, 911, -537, -537, -537, -537, -537, -537, -537, -537,
2030 -537, 338, 366, 246, 251, 249, 957, 957, 957, 957,
2031 -537, 957, 957, 957, 957, 911, 253, 258, 911, 1140,
2032 1140, 254, -537, 254, -537, 255, 1140, 256, 911, 911,
2033 911, -537, -537, -537, 911, 1140, 390, -537, -537, 957,
2034 957, -537, 265, 260, 266, 267, 268, 272, 274, 275,
2035 277, 400, 29, 255, 280, -537, -537, 363, -537, -537,
2036 911, 278, 1140, -537, -537, -537, 282, -537, -537, 283,
2037 287, 957, -537, 957, 957, -537, -537, -537, -537, -537,
2038 1140, -537, 1229, 60, 381, -537, -537, 286, -537, -537,
2039 -537, 290, 293, 294, -537, 270, -537, 1229, 435, -537,
2040 -537, -537, -537, 436, 302, 1140, 1140, 441, 196, -537,
2041 1140, 442, -537, 1140, -537
Reid Spencer319a7302007-01-05 17:20:02 +00002042};
2043
2044/* YYPGOTO[NTERM-NUM]. */
2045static const short int yypgoto[] =
2046{
Reid Spencerc4d96252007-01-13 00:03:30 +00002047 -537, -537, 226, 361, 362, 365, 209, 214, 368, 370,
2048 -99, -98, -507, -537, 420, 452, -134, -537, -303, 57,
2049 -537, -216, -537, -45, -537, -36, -537, -79, -30, -537,
2050 -111, 245, -210, 104, -537, -537, -537, -537, 431, -537,
2051 -537, -537, -537, 4, -537, 63, -537, -537, 421, -537,
2052 -537, -537, -537, -537, 480, -537, -537, -536, -105, 58,
2053 -88, -537, 445, -537, -93, -537, -537, -537, -537, 42,
2054 -18, -537, -537, 64, -537, -537
Reid Spencer319a7302007-01-05 17:20:02 +00002055};
2056
2057/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2058 positive, shift that token. If negative, reduce the rule which
2059 number is the opposite. If zero, do what YYDEFACT says.
2060 If YYTABLE_NINF, syntax error. */
2061#define YYTABLE_NINF -178
2062static const short int yytable[] =
2063{
Reid Spencerc4d96252007-01-13 00:03:30 +00002064 86, 147, 148, 129, 115, 331, 386, 25, 91, 237,
2065 136, 442, 125, 86, 38, 552, 565, 444, 94, 279,
2066 430, 348, 349, 42, 43, 44, 116, 117, 431, 404,
2067 273, 574, 273, 273, 139, 140, 141, 142, 143, 144,
2068 145, 146, 243, 45, 273, 25, 567, 129, 405, 137,
2069 -112, 414, 244, 129, 243, 415, 133, 443, 133, 133,
2070 138, -177, 135, 443, 353, 139, 140, 141, 142, 143,
2071 144, 145, 146, 430, 324, 4, 19, 430, 20, 28,
2072 327, 466, 220, 221, 38, 238, 328, 467, 131, 47,
2073 310, 430, 5, 314, 48, 6, 242, 465, 315, 316,
2074 317, 318, 247, 7, 8, 9, 10, 11, 12, 13,
2075 56, 280, 281, 282, 283, 284, 285, 60, 322, 323,
2076 98, 99, 100, 14, 101, 102, 103, 286, 287, 288,
2077 289, 347, 409, 410, 412, 62, 92, 291, 292, 108,
2078 308, 309, 135, 311, 312, 135, 95, 57, 109, 58,
2079 135, 135, 135, 135, 126, 119, 110, 49, 120, 121,
2080 350, 351, 111, 19, 354, 20, 112, 319, 320, 321,
2081 135, 135, 7, 8, 9, 50, 11, 51, 13, 52,
2082 213, 214, 123, 325, 326, -113, 551, 53, 528, 124,
2083 529, 464, 332, 333, 132, 275, 276, 139, 140, 141,
2084 142, 143, 144, 145, 146, 212, 273, 277, 216, 356,
2085 -72, -72, -76, -76, 273, 273, 273, 566, 217, 293,
2086 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
2087 304, 305, 306, 218, 380, -71, -71, 239, 402, -75,
2088 -75, -70, -70, 86, 29, 30, 31, 32, 33, 34,
2089 35, -74, -74, 240, 381, 425, 426, 427, 428, 429,
2090 -69, -69, 432, 433, 434, 435, 436, -73, -73, 334,
2091 335, 382, 101, 102, 245, 273, 273, 273, 278, 400,
2092 329, 354, -79, 273, -80, 338, 352, 360, 86, 401,
2093 135, 361, 362, 366, 367, 273, 273, 368, 369, 370,
2094 373, 374, 449, 375, 451, 452, 453, 376, 377, 378,
2095 457, 379, 473, 474, 383, 399, 385, 388, 403, 480,
2096 389, 390, 413, 391, 392, 393, 422, 394, 398, 419,
2097 437, 438, 273, 273, 462, 420, 423, 273, 416, 273,
2098 424, 448, 445, 273, 463, 454, 404, 485, 455, 273,
2099 273, 273, 456, 461, 135, 450, 135, 135, 135, 472,
2100 417, 476, 135, 458, 477, 512, 513, 514, 515, 387,
2101 516, 517, 518, 519, 478, 492, 479, 395, 396, 397,
2102 488, 481, 482, 356, 273, 273, 483, 484, 489, 490,
2103 496, 273, 498, 499, 506, 500, 508, 509, 539, 540,
2104 273, 504, 510, 511, 521, 527, 530, 532, 538, 135,
2105 533, 534, 535, 522, 542, 550, 541, 543, 544, 443,
2106 568, 573, 545, 147, 148, 505, 546, 273, 547, 548,
2107 561, 549, 562, 563, 554, 556, 558, 559, 439, 440,
2108 441, 560, 555, 569, 570, 273, 447, 571, 572, 520,
2109 575, 576, 135, 577, 147, 148, 580, 583, 459, 460,
2110 337, 104, 135, 135, 135, 203, 204, 364, 135, 205,
2111 273, 273, 206, 365, 207, 273, 54, 470, 273, 114,
2112 122, 346, 469, 26, 97, 581, 536, 495, 0, 475,
2113 0, 0, 0, 0, 135, 486, 487, 0, 0, 0,
2114 491, 0, 493, 0, 0, 0, 497, 0, 0, 0,
2115 0, 0, 501, 502, 503, 127, 64, 65, 66, 67,
2116 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2117 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2118 19, 0, 20, 0, 0, 0, 0, 525, 526, 0,
2119 0, 0, 0, 0, 531, 0, 0, 0, 0, 0,
2120 0, 0, 0, 537, 127, 64, 65, 66, 67, 68,
2121 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2122 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2123 557, 20, 0, 127, 222, 223, 224, 225, 226, 227,
2124 228, 229, 230, 231, 232, 75, 76, 0, 564, 77,
2125 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2126 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2127 0, 0, 0, 578, 579, 0, 0, 0, 582, 0,
2128 0, 584, 0, 0, 127, 64, 65, 66, 67, 68,
2129 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2130 77, 78, 0, 0, 79, 0, 0, 80, 0, 19,
2131 81, 20, 82, 128, 0, 0, 0, 0, 0, 0,
2132 0, 246, 0, 127, 64, 65, 66, 67, 68, 69,
2133 70, 71, 72, 73, 74, 75, 76, 0, 0, 77,
2134 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2135 20, 0, 0, 79, 0, 0, 80, 0, 0, 81,
2136 355, 82, 241, 0, 0, 0, 0, 127, 222, 223,
2137 224, 225, 226, 227, 228, 229, 230, 231, 232, 75,
2138 76, 0, 79, 77, 78, 80, 0, 0, 81, 0,
2139 82, 411, 19, 0, 20, 127, 64, 65, 66, 67,
2140 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2141 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2142 19, 0, 20, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 421, 79, 0, 0, 80, 0, 0, 81,
2144 0, 82, 127, 64, 65, 66, 67, 68, 69, 70,
2145 71, 72, 73, 74, 75, 76, 0, 0, 77, 78,
2146 0, 0, 0, 0, 0, 0, 0, 19, 0, 20,
2147 0, 0, 79, 0, 0, 80, 0, 0, 81, 468,
2148 82, 63, 64, 65, 66, 67, 68, 69, 70, 71,
2149 72, 73, 74, 75, 76, 0, 0, 77, 78, 0,
2150 0, 0, 0, 0, 0, 0, 19, 0, 20, 0,
2151 0, 0, 0, 0, 0, 0, 79, 0, 0, 80,
2152 0, 408, 81, 0, 82, 0, 134, 64, 65, 66,
2153 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2154 0, 0, 77, 78, 79, 0, 0, 80, 0, 0,
2155 81, 19, 82, 20, 127, 64, 65, 66, 67, 68,
Reid Spencer319a7302007-01-05 17:20:02 +00002156 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2157 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2158 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002159 0, 79, 0, 0, 80, 0, 0, 81, 0, 82,
2160 127, 222, 223, 224, 225, 226, 227, 228, 229, 230,
2161 231, 232, 75, 76, 0, 0, 77, 78, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002162 0, 0, 0, 0, 0, 19, 0, 20, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002163 79, 0, 0, 80, 0, 0, 81, 0, 82, 0,
2164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2165 0, 0, 77, 78, 0, 339, 340, 341, 0, 0,
2166 0, 19, 0, 20, 0, 0, 0, 0, 0, 0,
2167 0, 0, 0, 0, 0, 79, 0, 0, 80, 0,
2168 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002170 0, 0, 0, 79, 0, 0, 80, 0, 0, 81,
Reid Spencerc4d96252007-01-13 00:03:30 +00002171 0, 82, 154, 155, 156, 157, 158, 159, 160, 161,
2172 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
2173 172, 173, 258, 259, 0, 0, 0, 0, 0, 0,
2174 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,
2175 0, 0, 80, 0, 0, 81, 0, 82, 0, 260,
2176 0, 261, 182, 183, 184, 185, 0, 262, 263, 264,
2177 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
2178 200, 201, 202, 0, 0, 0, 0, 0, 342, 0,
2179 0, 343, 0, 344, 0, 0, 345, 249, 250, 77,
2180 78, 251, 252, 253, 254, 255, 256, 0, 19, 0,
2181 20, 0, -82, 19, 0, 20, 0, 0, 0, 6,
2182 -82, -82, 0, 0, 0, 0, 0, -82, -82, -82,
2183 -82, -82, -82, -82, -82, 21, 0, 0, 0, 0,
2184 0, 257, -82, 22, 0, 0, 0, 23, 0, 0,
2185 0, 0, 0, 0, 0, 0, 0, 0, 0, 154,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002186 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
Reid Spencerc4d96252007-01-13 00:03:30 +00002187 165, 166, 167, 168, 169, 170, 171, 172, 173, 258,
2188 259, 0, 0, 0, 0, 0, 249, 250, 0, 0,
2189 251, 252, 253, 254, 255, 256, 0, 0, 0, 0,
2190 0, 0, 0, 0, 0, 0, 260, 0, 261, 182,
2191 183, 184, 185, 0, 262, 263, 264, 190, 191, 192,
2192 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
2193 257, 0, 0, 0, 0, 0, 0, 0, 265, 0,
2194 0, 0, 0, 0, 0, 0, 0, 0, 154, 155,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002195 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
Reid Spencerc4d96252007-01-13 00:03:30 +00002196 166, 167, 168, 169, 170, 171, 172, 173, 258, 259,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002197 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2198 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002199 0, 0, 0, 0, 0, 260, 0, 261, 182, 183,
2200 184, 185, 150, 262, 263, 264, 190, 191, 192, 193,
2201 194, 195, 196, 197, 198, 199, 200, 201, 202, 0,
2202 0, 0, 0, 151, 152, 0, 0, 265, 0, 0,
2203 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
2204 0, 0, 0, 154, 155, 156, 157, 158, 159, 160,
2205 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
2206 171, 172, 173, 174, 175, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002207 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002208 0, 0, 0, 0, 0, 176, 177, 178, 0, 0,
2209 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2210 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2211 199, 200, 201, 202
Reid Spencer319a7302007-01-05 17:20:02 +00002212};
2213
2214static const short int yycheck[] =
2215{
Reid Spencerc4d96252007-01-13 00:03:30 +00002216 36, 100, 100, 82, 49, 221, 309, 3, 32, 120,
2217 98, 10, 18, 49, 29, 522, 552, 10, 33, 153,
2218 151, 237, 238, 51, 52, 53, 35, 36, 159, 37,
2219 135, 567, 137, 138, 5, 6, 7, 8, 9, 10,
2220 11, 12, 151, 71, 149, 41, 553, 126, 56, 4,
2221 153, 157, 161, 132, 151, 159, 162, 56, 162, 162,
2222 15, 0, 98, 56, 161, 5, 6, 7, 8, 9,
2223 10, 11, 12, 151, 208, 0, 28, 151, 30, 61,
2224 151, 159, 118, 119, 29, 121, 157, 161, 84, 150,
2225 178, 151, 31, 181, 61, 34, 126, 157, 186, 187,
2226 188, 189, 132, 42, 43, 44, 45, 46, 47, 48,
2227 150, 101, 102, 103, 104, 105, 106, 30, 206, 207,
2228 72, 73, 74, 62, 76, 77, 78, 117, 118, 119,
2229 120, 236, 342, 343, 344, 18, 160, 25, 26, 150,
2230 176, 177, 178, 179, 180, 181, 161, 45, 150, 47,
2231 186, 187, 188, 189, 160, 51, 150, 27, 54, 55,
2232 239, 240, 150, 28, 243, 30, 155, 203, 204, 205,
2233 206, 207, 42, 43, 44, 45, 46, 47, 48, 49,
2234 54, 55, 18, 124, 125, 153, 157, 57, 491, 18,
2235 493, 407, 25, 26, 153, 137, 138, 5, 6, 7,
2236 8, 9, 10, 11, 12, 30, 311, 149, 18, 245,
2237 17, 18, 17, 18, 319, 320, 321, 157, 30, 107,
2238 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2239 118, 119, 120, 30, 279, 17, 18, 156, 326, 17,
2240 18, 17, 18, 279, 64, 65, 66, 67, 68, 69,
2241 70, 17, 18, 156, 290, 366, 367, 368, 369, 370,
2242 17, 18, 373, 374, 375, 376, 377, 17, 18, 17,
2243 18, 307, 76, 77, 153, 380, 381, 382, 59, 324,
2244 151, 360, 21, 388, 21, 21, 159, 151, 324, 325,
2245 326, 154, 63, 153, 153, 400, 401, 153, 153, 153,
2246 153, 153, 390, 153, 392, 393, 394, 153, 153, 151,
2247 398, 151, 423, 424, 151, 39, 151, 155, 30, 430,
2248 151, 151, 30, 151, 151, 151, 30, 151, 151, 151,
2249 15, 15, 437, 438, 30, 154, 153, 442, 159, 444,
2250 153, 155, 151, 448, 18, 151, 37, 39, 151, 454,
2251 455, 456, 151, 151, 390, 391, 392, 393, 394, 151,
2252 356, 151, 398, 399, 151, 476, 477, 478, 479, 311,
2253 481, 482, 483, 484, 151, 18, 151, 319, 320, 321,
2254 153, 151, 151, 419, 489, 490, 151, 151, 151, 151,
2255 151, 496, 151, 151, 56, 151, 30, 151, 509, 510,
2256 505, 153, 151, 154, 151, 151, 151, 151, 18, 445,
2257 498, 499, 500, 155, 154, 15, 151, 151, 151, 56,
2258 39, 151, 154, 522, 522, 461, 154, 532, 154, 154,
2259 541, 154, 543, 544, 154, 157, 154, 154, 380, 381,
2260 382, 154, 530, 157, 154, 550, 388, 154, 154, 485,
2261 15, 15, 488, 151, 553, 553, 15, 15, 400, 401,
2262 234, 41, 498, 499, 500, 104, 104, 258, 504, 104,
2263 575, 576, 104, 259, 104, 580, 24, 420, 583, 48,
2264 59, 236, 419, 3, 39, 578, 504, 445, -1, 425,
2265 -1, -1, -1, -1, 530, 437, 438, -1, -1, -1,
2266 442, -1, 444, -1, -1, -1, 448, -1, -1, -1,
2267 -1, -1, 454, 455, 456, 3, 4, 5, 6, 7,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002268 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002269 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2270 28, -1, 30, -1, -1, -1, -1, 489, 490, -1,
2271 -1, -1, -1, -1, 496, -1, -1, -1, -1, -1,
2272 -1, -1, -1, 505, 3, 4, 5, 6, 7, 8,
2273 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2274 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2275 532, 30, -1, 3, 4, 5, 6, 7, 8, 9,
2276 10, 11, 12, 13, 14, 15, 16, -1, 550, 19,
2277 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2278 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2279 -1, -1, -1, 575, 576, -1, -1, -1, 580, -1,
2280 -1, 583, -1, -1, 3, 4, 5, 6, 7, 8,
2281 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2282 19, 20, -1, -1, 152, -1, -1, 155, -1, 28,
2283 158, 30, 160, 161, -1, -1, -1, -1, -1, -1,
2284 -1, 40, -1, 3, 4, 5, 6, 7, 8, 9,
2285 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
2286 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2287 30, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2288 40, 160, 161, -1, -1, -1, -1, 3, 4, 5,
2289 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2290 16, -1, 152, 19, 20, 155, -1, -1, 158, -1,
2291 160, 161, 28, -1, 30, 3, 4, 5, 6, 7,
2292 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2293 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2294 28, -1, 30, -1, -1, -1, -1, -1, -1, -1,
2295 -1, -1, 40, 152, -1, -1, 155, -1, -1, 158,
2296 -1, 160, 3, 4, 5, 6, 7, 8, 9, 10,
2297 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2298 -1, -1, -1, -1, -1, -1, -1, 28, -1, 30,
2299 -1, -1, 152, -1, -1, 155, -1, -1, 158, 40,
2300 160, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2301 12, 13, 14, 15, 16, -1, -1, 19, 20, -1,
2302 -1, -1, -1, -1, -1, -1, 28, -1, 30, -1,
2303 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2304 -1, 157, 158, -1, 160, -1, 3, 4, 5, 6,
2305 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2306 -1, -1, 19, 20, 152, -1, -1, 155, -1, -1,
2307 158, 28, 160, 30, 3, 4, 5, 6, 7, 8,
Reid Spencer319a7302007-01-05 17:20:02 +00002308 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2309 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2310 -1, 30, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002311 -1, 152, -1, -1, 155, -1, -1, 158, -1, 160,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002312 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2313 13, 14, 15, 16, -1, -1, 19, 20, -1, -1,
2314 -1, -1, -1, -1, -1, 28, -1, 30, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002315 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002316 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002317 -1, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2318 -1, 28, -1, 30, -1, -1, -1, -1, -1, -1,
2319 -1, -1, -1, -1, -1, 152, -1, -1, 155, -1,
2320 -1, 158, -1, 160, -1, -1, -1, -1, -1, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002321 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002322 -1, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2323 -1, 160, 79, 80, 81, 82, 83, 84, 85, 86,
2324 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2325 97, 98, 99, 100, -1, -1, -1, -1, -1, -1,
2326 -1, -1, -1, -1, -1, -1, -1, -1, -1, 152,
2327 -1, -1, 155, -1, -1, 158, -1, 160, -1, 126,
2328 -1, 128, 129, 130, 131, 132, -1, 134, 135, 136,
2329 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2330 147, 148, 149, -1, -1, -1, -1, -1, 155, -1,
2331 -1, 158, -1, 160, -1, -1, 163, 17, 18, 19,
2332 20, 21, 22, 23, 24, 25, 26, -1, 28, -1,
2333 30, -1, 27, 28, -1, 30, -1, -1, -1, 34,
2334 35, 36, -1, -1, -1, -1, -1, 42, 43, 44,
2335 45, 46, 47, 48, 49, 50, -1, -1, -1, -1,
2336 -1, 61, 57, 58, -1, -1, -1, 62, -1, -1,
2337 -1, -1, -1, -1, -1, -1, -1, -1, -1, 79,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002338 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2339 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
Reid Spencerc4d96252007-01-13 00:03:30 +00002340 100, -1, -1, -1, -1, -1, 17, 18, -1, -1,
2341 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
2342 -1, -1, -1, -1, -1, -1, 126, -1, 128, 129,
2343 130, 131, 132, -1, 134, 135, 136, 137, 138, 139,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002344 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
Reid Spencerc4d96252007-01-13 00:03:30 +00002345 61, -1, -1, -1, -1, -1, -1, -1, 158, -1,
2346 -1, -1, -1, -1, -1, -1, -1, -1, 79, 80,
2347 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2348 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002349 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2350 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002351 -1, -1, -1, -1, -1, 126, -1, 128, 129, 130,
2352 131, 132, 38, 134, 135, 136, 137, 138, 139, 140,
2353 141, 142, 143, 144, 145, 146, 147, 148, 149, -1,
2354 -1, -1, -1, 59, 60, -1, -1, 158, -1, -1,
2355 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2356 -1, -1, -1, 79, 80, 81, 82, 83, 84, 85,
2357 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2358 96, 97, 98, 99, 100, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002359 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002360 -1, -1, -1, -1, -1, 121, 122, 123, -1, -1,
2361 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2362 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2363 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00002364};
2365
2366/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2367 symbol of state STATE-NUM. */
2368static const unsigned char yystos[] =
2369{
Reid Spencerc4d96252007-01-13 00:03:30 +00002370 0, 198, 199, 201, 0, 31, 34, 42, 43, 44,
2371 45, 46, 47, 48, 62, 179, 214, 216, 218, 28,
2372 30, 50, 58, 62, 178, 207, 218, 219, 61, 64,
2373 65, 66, 67, 68, 69, 70, 180, 212, 29, 225,
2374 226, 227, 51, 52, 53, 71, 204, 150, 61, 27,
2375 45, 47, 49, 57, 179, 200, 150, 45, 47, 217,
2376 30, 202, 18, 3, 4, 5, 6, 7, 8, 9,
2377 10, 11, 12, 13, 14, 15, 16, 19, 20, 152,
2378 155, 158, 160, 165, 187, 188, 189, 190, 191, 207,
2379 222, 32, 160, 213, 33, 161, 215, 226, 72, 73,
2380 74, 76, 77, 78, 178, 228, 229, 231, 150, 150,
2381 150, 150, 155, 205, 202, 187, 35, 36, 197, 197,
2382 197, 197, 212, 18, 18, 18, 160, 3, 161, 191,
2383 192, 207, 153, 162, 3, 189, 224, 4, 15, 5,
2384 6, 7, 8, 9, 10, 11, 12, 174, 175, 176,
2385 38, 59, 60, 75, 79, 80, 81, 82, 83, 84,
2386 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2387 95, 96, 97, 98, 99, 100, 121, 122, 123, 126,
2388 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2389 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2390 147, 148, 149, 167, 168, 169, 172, 173, 235, 236,
2391 238, 239, 30, 54, 55, 203, 18, 30, 30, 206,
2392 189, 189, 4, 5, 6, 7, 8, 9, 10, 11,
2393 12, 13, 14, 174, 175, 177, 189, 194, 189, 156,
2394 156, 161, 192, 151, 161, 153, 40, 192, 193, 17,
2395 18, 21, 22, 23, 24, 25, 26, 61, 99, 100,
2396 126, 128, 134, 135, 136, 158, 167, 168, 169, 172,
2397 173, 195, 221, 222, 223, 223, 223, 223, 59, 180,
2398 101, 102, 103, 104, 105, 106, 117, 118, 119, 120,
2399 170, 25, 26, 107, 108, 109, 110, 111, 112, 113,
2400 114, 115, 116, 117, 118, 119, 120, 171, 189, 189,
2401 224, 189, 189, 232, 224, 224, 224, 224, 224, 189,
2402 189, 189, 224, 224, 180, 124, 125, 151, 157, 151,
2403 185, 185, 25, 26, 17, 18, 166, 166, 21, 22,
2404 23, 24, 155, 158, 160, 163, 195, 222, 185, 185,
2405 191, 191, 159, 161, 191, 40, 189, 209, 210, 211,
2406 151, 154, 63, 220, 170, 171, 153, 153, 153, 153,
2407 153, 194, 196, 153, 153, 153, 153, 153, 151, 151,
2408 187, 189, 189, 151, 182, 151, 182, 223, 155, 151,
2409 151, 151, 151, 151, 151, 223, 223, 223, 151, 39,
2410 187, 189, 224, 30, 37, 56, 183, 186, 157, 196,
2411 196, 161, 196, 30, 157, 159, 159, 207, 208, 151,
2412 154, 40, 30, 153, 153, 194, 194, 194, 194, 194,
2413 151, 159, 194, 194, 194, 194, 194, 15, 15, 223,
2414 223, 223, 10, 56, 10, 151, 237, 223, 155, 224,
2415 189, 224, 224, 224, 151, 151, 151, 224, 189, 223,
2416 223, 151, 30, 18, 185, 157, 159, 161, 40, 209,
2417 183, 184, 151, 194, 194, 237, 151, 151, 151, 151,
2418 194, 151, 151, 151, 151, 39, 223, 223, 153, 151,
2419 151, 223, 18, 223, 224, 233, 151, 223, 151, 151,
2420 151, 223, 223, 223, 153, 189, 56, 181, 30, 151,
2421 151, 154, 194, 194, 194, 194, 194, 194, 194, 194,
2422 189, 151, 155, 233, 234, 223, 223, 151, 182, 182,
2423 151, 223, 151, 224, 224, 224, 234, 223, 18, 194,
2424 194, 151, 154, 151, 151, 154, 154, 154, 154, 154,
2425 15, 157, 176, 230, 154, 224, 157, 223, 154, 154,
2426 154, 194, 194, 194, 223, 221, 157, 176, 39, 157,
2427 154, 154, 154, 151, 221, 15, 15, 151, 223, 223,
2428 15, 228, 223, 15, 223
Reid Spencer319a7302007-01-05 17:20:02 +00002429};
Reid Spencere7c3c602006-11-30 06:36:44 +00002430
2431#define yyerrok (yyerrstatus = 0)
2432#define yyclearin (yychar = YYEMPTY)
Reid Spencer319a7302007-01-05 17:20:02 +00002433#define YYEMPTY (-2)
Reid Spencere7c3c602006-11-30 06:36:44 +00002434#define YYEOF 0
Reid Spencer319a7302007-01-05 17:20:02 +00002435
Reid Spencere7c3c602006-11-30 06:36:44 +00002436#define YYACCEPT goto yyacceptlab
Reid Spencer319a7302007-01-05 17:20:02 +00002437#define YYABORT goto yyabortlab
2438#define YYERROR goto yyerrorlab
2439
2440
2441/* Like YYERROR except do call yyerror. This remains here temporarily
2442 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencere7c3c602006-11-30 06:36:44 +00002443 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer319a7302007-01-05 17:20:02 +00002444
Reid Spencere7c3c602006-11-30 06:36:44 +00002445#define YYFAIL goto yyerrlab
Reid Spencer319a7302007-01-05 17:20:02 +00002446
Reid Spencere7c3c602006-11-30 06:36:44 +00002447#define YYRECOVERING() (!!yyerrstatus)
Reid Spencer319a7302007-01-05 17:20:02 +00002448
2449#define YYBACKUP(Token, Value) \
Reid Spencere7c3c602006-11-30 06:36:44 +00002450do \
2451 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencer319a7302007-01-05 17:20:02 +00002452 { \
2453 yychar = (Token); \
2454 yylval = (Value); \
2455 yytoken = YYTRANSLATE (yychar); \
Reid Spencere7c3c602006-11-30 06:36:44 +00002456 YYPOPSTACK; \
2457 goto yybackup; \
2458 } \
2459 else \
Reid Spencer319a7302007-01-05 17:20:02 +00002460 { \
2461 yyerror (YY_("syntax error: cannot back up")); \
2462 YYERROR; \
2463 } \
Reid Spencere7c3c602006-11-30 06:36:44 +00002464while (0)
2465
Reid Spencer319a7302007-01-05 17:20:02 +00002466
Reid Spencere7c3c602006-11-30 06:36:44 +00002467#define YYTERROR 1
2468#define YYERRCODE 256
2469
Reid Spencer319a7302007-01-05 17:20:02 +00002470
2471/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2472 If N is 0, then set CURRENT to the empty location which ends
2473 the previous symbol: RHS[0] (always defined). */
2474
2475#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2476#ifndef YYLLOC_DEFAULT
2477# define YYLLOC_DEFAULT(Current, Rhs, N) \
2478 do \
2479 if (N) \
2480 { \
2481 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2482 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2483 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2484 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2485 } \
2486 else \
2487 { \
2488 (Current).first_line = (Current).last_line = \
2489 YYRHSLOC (Rhs, 0).last_line; \
2490 (Current).first_column = (Current).last_column = \
2491 YYRHSLOC (Rhs, 0).last_column; \
2492 } \
2493 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002494#endif
2495
Reid Spencer319a7302007-01-05 17:20:02 +00002496
2497/* YY_LOCATION_PRINT -- Print the location on the stream.
2498 This macro was not mandated originally: define only if we know
2499 we won't break user code: when these are the locations we know. */
2500
2501#ifndef YY_LOCATION_PRINT
2502# if YYLTYPE_IS_TRIVIAL
2503# define YY_LOCATION_PRINT(File, Loc) \
2504 fprintf (File, "%d.%d-%d.%d", \
2505 (Loc).first_line, (Loc).first_column, \
2506 (Loc).last_line, (Loc).last_column)
2507# else
2508# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2509# endif
2510#endif
2511
2512
2513/* YYLEX -- calling `yylex' with the right arguments. */
2514
Reid Spencere7c3c602006-11-30 06:36:44 +00002515#ifdef YYLEX_PARAM
Reid Spencer319a7302007-01-05 17:20:02 +00002516# define YYLEX yylex (YYLEX_PARAM)
Reid Spencere7c3c602006-11-30 06:36:44 +00002517#else
Reid Spencer319a7302007-01-05 17:20:02 +00002518# define YYLEX yylex ()
Chris Lattner37e01c52007-01-04 18:46:42 +00002519#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002520
2521/* Enable debugging if requested. */
2522#if YYDEBUG
2523
2524# ifndef YYFPRINTF
2525# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2526# define YYFPRINTF fprintf
2527# endif
2528
2529# define YYDPRINTF(Args) \
2530do { \
2531 if (yydebug) \
2532 YYFPRINTF Args; \
2533} while (0)
2534
2535# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2536do { \
2537 if (yydebug) \
2538 { \
2539 YYFPRINTF (stderr, "%s ", Title); \
2540 yysymprint (stderr, \
2541 Type, Value); \
2542 YYFPRINTF (stderr, "\n"); \
2543 } \
2544} while (0)
2545
2546/*------------------------------------------------------------------.
2547| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2548| TOP (included). |
2549`------------------------------------------------------------------*/
2550
2551#if defined (__STDC__) || defined (__cplusplus)
2552static void
2553yy_stack_print (short int *bottom, short int *top)
Chris Lattner37e01c52007-01-04 18:46:42 +00002554#else
Reid Spencer319a7302007-01-05 17:20:02 +00002555static void
2556yy_stack_print (bottom, top)
2557 short int *bottom;
2558 short int *top;
Chris Lattner37e01c52007-01-04 18:46:42 +00002559#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002560{
2561 YYFPRINTF (stderr, "Stack now");
2562 for (/* Nothing. */; bottom <= top; ++bottom)
2563 YYFPRINTF (stderr, " %d", *bottom);
2564 YYFPRINTF (stderr, "\n");
2565}
2566
2567# define YY_STACK_PRINT(Bottom, Top) \
2568do { \
2569 if (yydebug) \
2570 yy_stack_print ((Bottom), (Top)); \
2571} while (0)
2572
2573
2574/*------------------------------------------------.
2575| Report that the YYRULE is going to be reduced. |
2576`------------------------------------------------*/
2577
2578#if defined (__STDC__) || defined (__cplusplus)
2579static void
2580yy_reduce_print (int yyrule)
2581#else
2582static void
2583yy_reduce_print (yyrule)
2584 int yyrule;
Reid Spencere7c3c602006-11-30 06:36:44 +00002585#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002586{
2587 int yyi;
2588 unsigned long int yylno = yyrline[yyrule];
2589 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2590 yyrule - 1, yylno);
2591 /* Print the symbols being reduced, and their result. */
2592 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2593 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2594 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2595}
Reid Spencere7c3c602006-11-30 06:36:44 +00002596
Reid Spencer319a7302007-01-05 17:20:02 +00002597# define YY_REDUCE_PRINT(Rule) \
2598do { \
2599 if (yydebug) \
2600 yy_reduce_print (Rule); \
2601} while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002602
Reid Spencer319a7302007-01-05 17:20:02 +00002603/* Nonzero means print parse trace. It is left uninitialized so that
2604 multiple parsers can coexist. */
2605int yydebug;
2606#else /* !YYDEBUG */
2607# define YYDPRINTF(Args)
2608# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2609# define YY_STACK_PRINT(Bottom, Top)
2610# define YY_REDUCE_PRINT(Rule)
2611#endif /* !YYDEBUG */
Reid Spencere7c3c602006-11-30 06:36:44 +00002612
Reid Spencere7c3c602006-11-30 06:36:44 +00002613
Reid Spencer319a7302007-01-05 17:20:02 +00002614/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002615#ifndef YYINITDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002616# define YYINITDEPTH 200
Reid Spencere7c3c602006-11-30 06:36:44 +00002617#endif
2618
Reid Spencer319a7302007-01-05 17:20:02 +00002619/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2620 if the built-in stack extension method is used).
Reid Spencere7c3c602006-11-30 06:36:44 +00002621
Reid Spencer319a7302007-01-05 17:20:02 +00002622 Do not make this value too large; the results are undefined if
2623 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2624 evaluated with infinite-precision integer arithmetic. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002625
2626#ifndef YYMAXDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002627# define YYMAXDEPTH 10000
Reid Spencere7c3c602006-11-30 06:36:44 +00002628#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002629
Reid Spencere7c3c602006-11-30 06:36:44 +00002630
2631
Reid Spencer319a7302007-01-05 17:20:02 +00002632#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00002633
Reid Spencer319a7302007-01-05 17:20:02 +00002634# ifndef yystrlen
2635# if defined (__GLIBC__) && defined (_STRING_H)
2636# define yystrlen strlen
2637# else
2638/* Return the length of YYSTR. */
2639static YYSIZE_T
2640# if defined (__STDC__) || defined (__cplusplus)
2641yystrlen (const char *yystr)
2642# else
2643yystrlen (yystr)
2644 const char *yystr;
2645# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002646{
Reid Spencer319a7302007-01-05 17:20:02 +00002647 const char *yys = yystr;
Chris Lattner37e01c52007-01-04 18:46:42 +00002648
Reid Spencer319a7302007-01-05 17:20:02 +00002649 while (*yys++ != '\0')
2650 continue;
2651
2652 return yys - yystr - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002653}
Reid Spencer319a7302007-01-05 17:20:02 +00002654# endif
2655# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002656
Reid Spencer319a7302007-01-05 17:20:02 +00002657# ifndef yystpcpy
2658# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2659# define yystpcpy stpcpy
2660# else
2661/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2662 YYDEST. */
2663static char *
2664# if defined (__STDC__) || defined (__cplusplus)
2665yystpcpy (char *yydest, const char *yysrc)
2666# else
2667yystpcpy (yydest, yysrc)
2668 char *yydest;
2669 const char *yysrc;
2670# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002671{
Reid Spencer319a7302007-01-05 17:20:02 +00002672 char *yyd = yydest;
2673 const char *yys = yysrc;
Chris Lattner37e01c52007-01-04 18:46:42 +00002674
Reid Spencer319a7302007-01-05 17:20:02 +00002675 while ((*yyd++ = *yys++) != '\0')
2676 continue;
2677
2678 return yyd - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002679}
Reid Spencer319a7302007-01-05 17:20:02 +00002680# endif
2681# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002682
Reid Spencer319a7302007-01-05 17:20:02 +00002683# ifndef yytnamerr
2684/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2685 quotes and backslashes, so that it's suitable for yyerror. The
2686 heuristic is that double-quoting is unnecessary unless the string
2687 contains an apostrophe, a comma, or backslash (other than
2688 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2689 null, do not copy; instead, return the length of what the result
2690 would have been. */
2691static YYSIZE_T
2692yytnamerr (char *yyres, const char *yystr)
2693{
2694 if (*yystr == '"')
2695 {
2696 size_t yyn = 0;
2697 char const *yyp = yystr;
2698
2699 for (;;)
2700 switch (*++yyp)
2701 {
2702 case '\'':
2703 case ',':
2704 goto do_not_strip_quotes;
2705
2706 case '\\':
2707 if (*++yyp != '\\')
2708 goto do_not_strip_quotes;
2709 /* Fall through. */
2710 default:
2711 if (yyres)
2712 yyres[yyn] = *yyp;
2713 yyn++;
2714 break;
2715
2716 case '"':
2717 if (yyres)
2718 yyres[yyn] = '\0';
2719 return yyn;
2720 }
2721 do_not_strip_quotes: ;
2722 }
2723
2724 if (! yyres)
2725 return yystrlen (yystr);
2726
2727 return yystpcpy (yyres, yystr) - yyres;
2728}
2729# endif
2730
2731#endif /* YYERROR_VERBOSE */
2732
Reid Spencere7c3c602006-11-30 06:36:44 +00002733
2734
Reid Spencer319a7302007-01-05 17:20:02 +00002735#if YYDEBUG
2736/*--------------------------------.
2737| Print this symbol on YYOUTPUT. |
2738`--------------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002739
Reid Spencer319a7302007-01-05 17:20:02 +00002740#if defined (__STDC__) || defined (__cplusplus)
2741static void
2742yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Chris Lattner37e01c52007-01-04 18:46:42 +00002743#else
Reid Spencer319a7302007-01-05 17:20:02 +00002744static void
2745yysymprint (yyoutput, yytype, yyvaluep)
2746 FILE *yyoutput;
2747 int yytype;
2748 YYSTYPE *yyvaluep;
2749#endif
2750{
2751 /* Pacify ``unused variable'' warnings. */
2752 (void) yyvaluep;
2753
2754 if (yytype < YYNTOKENS)
2755 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2756 else
2757 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2758
2759
2760# ifdef YYPRINT
2761 if (yytype < YYNTOKENS)
2762 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2763# endif
2764 switch (yytype)
2765 {
2766 default:
2767 break;
2768 }
2769 YYFPRINTF (yyoutput, ")");
2770}
2771
2772#endif /* ! YYDEBUG */
2773/*-----------------------------------------------.
2774| Release the memory associated to this symbol. |
2775`-----------------------------------------------*/
2776
2777#if defined (__STDC__) || defined (__cplusplus)
2778static void
2779yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2780#else
2781static void
2782yydestruct (yymsg, yytype, yyvaluep)
2783 const char *yymsg;
2784 int yytype;
2785 YYSTYPE *yyvaluep;
2786#endif
2787{
2788 /* Pacify ``unused variable'' warnings. */
2789 (void) yyvaluep;
2790
2791 if (!yymsg)
2792 yymsg = "Deleting";
2793 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2794
2795 switch (yytype)
2796 {
2797
2798 default:
2799 break;
2800 }
2801}
2802
2803
2804/* Prevent warnings from -Wmissing-prototypes. */
2805
2806#ifdef YYPARSE_PARAM
2807# if defined (__STDC__) || defined (__cplusplus)
2808int yyparse (void *YYPARSE_PARAM);
2809# else
2810int yyparse ();
2811# endif
2812#else /* ! YYPARSE_PARAM */
2813#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere7c3c602006-11-30 06:36:44 +00002814int yyparse (void);
Chris Lattner37e01c52007-01-04 18:46:42 +00002815#else
Reid Spencer319a7302007-01-05 17:20:02 +00002816int yyparse ();
2817#endif
2818#endif /* ! YYPARSE_PARAM */
2819
2820
2821
2822/* The look-ahead symbol. */
2823int yychar;
2824
2825/* The semantic value of the look-ahead symbol. */
2826YYSTYPE yylval;
2827
2828/* Number of syntax errors so far. */
2829int yynerrs;
2830
2831
2832
2833/*----------.
2834| yyparse. |
2835`----------*/
2836
2837#ifdef YYPARSE_PARAM
2838# if defined (__STDC__) || defined (__cplusplus)
2839int yyparse (void *YYPARSE_PARAM)
2840# else
2841int yyparse (YYPARSE_PARAM)
2842 void *YYPARSE_PARAM;
2843# endif
2844#else /* ! YYPARSE_PARAM */
2845#if defined (__STDC__) || defined (__cplusplus)
2846int
2847yyparse (void)
2848#else
2849int
2850yyparse ()
2851
2852#endif
2853#endif
2854{
2855
2856 int yystate;
2857 int yyn;
2858 int yyresult;
2859 /* Number of tokens to shift before error messages enabled. */
2860 int yyerrstatus;
2861 /* Look-ahead token as an internal (translated) token number. */
2862 int yytoken = 0;
2863
2864 /* Three stacks and their tools:
2865 `yyss': related to states,
2866 `yyvs': related to semantic values,
2867 `yyls': related to locations.
2868
2869 Refer to the stacks thru separate pointers, to allow yyoverflow
2870 to reallocate them elsewhere. */
2871
2872 /* The state stack. */
2873 short int yyssa[YYINITDEPTH];
2874 short int *yyss = yyssa;
2875 short int *yyssp;
2876
2877 /* The semantic value stack. */
2878 YYSTYPE yyvsa[YYINITDEPTH];
2879 YYSTYPE *yyvs = yyvsa;
2880 YYSTYPE *yyvsp;
2881
2882
2883
Reid Spencere7c3c602006-11-30 06:36:44 +00002884#define YYPOPSTACK (yyvsp--, yyssp--)
2885
Reid Spencer319a7302007-01-05 17:20:02 +00002886 YYSIZE_T yystacksize = YYINITDEPTH;
Reid Spencere7c3c602006-11-30 06:36:44 +00002887
Reid Spencer319a7302007-01-05 17:20:02 +00002888 /* The variables used to return semantic value and location from the
2889 action routines. */
2890 YYSTYPE yyval;
Reid Spencere7c3c602006-11-30 06:36:44 +00002891
2892
Reid Spencer319a7302007-01-05 17:20:02 +00002893 /* When reducing, the number of symbols on the RHS of the reduced
2894 rule. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002895 int yylen;
2896
Reid Spencer319a7302007-01-05 17:20:02 +00002897 YYDPRINTF ((stderr, "Starting parse\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002898
2899 yystate = 0;
2900 yyerrstatus = 0;
2901 yynerrs = 0;
2902 yychar = YYEMPTY; /* Cause a token to be read. */
2903
2904 /* Initialize stack pointers.
2905 Waste one element of value and location stack
2906 so that they stay on the same level as the state stack.
2907 The wasted elements are never initialized. */
2908
Reid Spencer319a7302007-01-05 17:20:02 +00002909 yyssp = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002910 yyvsp = yyvs;
2911
Reid Spencer319a7302007-01-05 17:20:02 +00002912 goto yysetstate;
Reid Spencere7c3c602006-11-30 06:36:44 +00002913
Reid Spencer319a7302007-01-05 17:20:02 +00002914/*------------------------------------------------------------.
2915| yynewstate -- Push a new state, which is found in yystate. |
2916`------------------------------------------------------------*/
2917 yynewstate:
2918 /* In all cases, when you get here, the value and location stacks
2919 have just been pushed. so pushing a state here evens the stacks.
2920 */
2921 yyssp++;
Reid Spencere7c3c602006-11-30 06:36:44 +00002922
Reid Spencer319a7302007-01-05 17:20:02 +00002923 yysetstate:
2924 *yyssp = yystate;
2925
2926 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002927 {
2928 /* Get the current used size of the three stacks, in elements. */
Reid Spencer319a7302007-01-05 17:20:02 +00002929 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002930
2931#ifdef yyoverflow
Reid Spencer319a7302007-01-05 17:20:02 +00002932 {
2933 /* Give user a chance to reallocate the stack. Use copies of
2934 these so that the &'s don't force the real ones into
2935 memory. */
2936 YYSTYPE *yyvs1 = yyvs;
2937 short int *yyss1 = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002938
Reid Spencer319a7302007-01-05 17:20:02 +00002939
2940 /* Each stack pointer address is followed by the size of the
2941 data in use in that stack, in bytes. This used to be a
2942 conditional around just the two extra args, but that might
2943 be undefined if yyoverflow is a macro. */
2944 yyoverflow (YY_("memory exhausted"),
2945 &yyss1, yysize * sizeof (*yyssp),
2946 &yyvs1, yysize * sizeof (*yyvsp),
2947
2948 &yystacksize);
2949
2950 yyss = yyss1;
2951 yyvs = yyvs1;
2952 }
Reid Spencere7c3c602006-11-30 06:36:44 +00002953#else /* no yyoverflow */
Reid Spencer319a7302007-01-05 17:20:02 +00002954# ifndef YYSTACK_RELOCATE
2955 goto yyexhaustedlab;
2956# else
Reid Spencere7c3c602006-11-30 06:36:44 +00002957 /* Extend the stack our own way. */
Reid Spencer319a7302007-01-05 17:20:02 +00002958 if (YYMAXDEPTH <= yystacksize)
2959 goto yyexhaustedlab;
Reid Spencere7c3c602006-11-30 06:36:44 +00002960 yystacksize *= 2;
Reid Spencer319a7302007-01-05 17:20:02 +00002961 if (YYMAXDEPTH < yystacksize)
Reid Spencere7c3c602006-11-30 06:36:44 +00002962 yystacksize = YYMAXDEPTH;
Reid Spencer319a7302007-01-05 17:20:02 +00002963
2964 {
2965 short int *yyss1 = yyss;
2966 union yyalloc *yyptr =
2967 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2968 if (! yyptr)
2969 goto yyexhaustedlab;
2970 YYSTACK_RELOCATE (yyss);
2971 YYSTACK_RELOCATE (yyvs);
2972
2973# undef YYSTACK_RELOCATE
2974 if (yyss1 != yyssa)
2975 YYSTACK_FREE (yyss1);
2976 }
2977# endif
Reid Spencere7c3c602006-11-30 06:36:44 +00002978#endif /* no yyoverflow */
2979
Reid Spencer319a7302007-01-05 17:20:02 +00002980 yyssp = yyss + yysize - 1;
2981 yyvsp = yyvs + yysize - 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002982
2983
Reid Spencer319a7302007-01-05 17:20:02 +00002984 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2985 (unsigned long int) yystacksize));
2986
2987 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00002988 YYABORT;
2989 }
2990
Reid Spencer319a7302007-01-05 17:20:02 +00002991 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencere7c3c602006-11-30 06:36:44 +00002992
2993 goto yybackup;
Reid Spencer319a7302007-01-05 17:20:02 +00002994
2995/*-----------.
2996| yybackup. |
2997`-----------*/
2998yybackup:
Reid Spencere7c3c602006-11-30 06:36:44 +00002999
3000/* Do appropriate processing given the current state. */
Reid Spencer319a7302007-01-05 17:20:02 +00003001/* Read a look-ahead token if we need one and don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003002/* yyresume: */
3003
Reid Spencer319a7302007-01-05 17:20:02 +00003004 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003005
3006 yyn = yypact[yystate];
Reid Spencer319a7302007-01-05 17:20:02 +00003007 if (yyn == YYPACT_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00003008 goto yydefault;
3009
Reid Spencer319a7302007-01-05 17:20:02 +00003010 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003011
Reid Spencer319a7302007-01-05 17:20:02 +00003012 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003013 if (yychar == YYEMPTY)
3014 {
Reid Spencer319a7302007-01-05 17:20:02 +00003015 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencere7c3c602006-11-30 06:36:44 +00003016 yychar = YYLEX;
3017 }
3018
Reid Spencer319a7302007-01-05 17:20:02 +00003019 if (yychar <= YYEOF)
Reid Spencere7c3c602006-11-30 06:36:44 +00003020 {
Reid Spencer319a7302007-01-05 17:20:02 +00003021 yychar = yytoken = YYEOF;
3022 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00003023 }
3024 else
3025 {
Reid Spencer319a7302007-01-05 17:20:02 +00003026 yytoken = YYTRANSLATE (yychar);
3027 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00003028 }
3029
Reid Spencer319a7302007-01-05 17:20:02 +00003030 /* If the proper action on seeing token YYTOKEN is to reduce or to
3031 detect an error, take that action. */
3032 yyn += yytoken;
3033 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencere7c3c602006-11-30 06:36:44 +00003034 goto yydefault;
3035 yyn = yytable[yyn];
Reid Spencer319a7302007-01-05 17:20:02 +00003036 if (yyn <= 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00003037 {
Reid Spencer319a7302007-01-05 17:20:02 +00003038 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00003039 goto yyerrlab;
3040 yyn = -yyn;
3041 goto yyreduce;
3042 }
3043
3044 if (yyn == YYFINAL)
3045 YYACCEPT;
3046
Reid Spencer319a7302007-01-05 17:20:02 +00003047 /* Shift the look-ahead token. */
3048 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Reid Spencere7c3c602006-11-30 06:36:44 +00003049
3050 /* Discard the token being shifted unless it is eof. */
3051 if (yychar != YYEOF)
3052 yychar = YYEMPTY;
3053
3054 *++yyvsp = yylval;
3055
Reid Spencer319a7302007-01-05 17:20:02 +00003056
3057 /* Count tokens shifted since error; after three, turn off error
3058 status. */
3059 if (yyerrstatus)
3060 yyerrstatus--;
Reid Spencere7c3c602006-11-30 06:36:44 +00003061
3062 yystate = yyn;
3063 goto yynewstate;
3064
Chris Lattner37e01c52007-01-04 18:46:42 +00003065
Reid Spencer319a7302007-01-05 17:20:02 +00003066/*-----------------------------------------------------------.
3067| yydefault -- do the default action for the current state. |
3068`-----------------------------------------------------------*/
3069yydefault:
Reid Spencere7c3c602006-11-30 06:36:44 +00003070 yyn = yydefact[yystate];
3071 if (yyn == 0)
3072 goto yyerrlab;
Reid Spencer319a7302007-01-05 17:20:02 +00003073 goto yyreduce;
Reid Spencere7c3c602006-11-30 06:36:44 +00003074
Reid Spencer319a7302007-01-05 17:20:02 +00003075
3076/*-----------------------------.
3077| yyreduce -- Do a reduction. |
3078`-----------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00003079yyreduce:
Reid Spencer319a7302007-01-05 17:20:02 +00003080 /* yyn is the number of a rule to reduce with. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003081 yylen = yyr2[yyn];
3082
Reid Spencer319a7302007-01-05 17:20:02 +00003083 /* If YYLEN is nonzero, implement the default value of the action:
3084 `$$ = $1'.
3085
3086 Otherwise, the following line sets YYVAL to garbage.
3087 This behavior is undocumented and Bison
3088 users should not rely upon it. Assigning to YYVAL
3089 unconditionally makes the parser a bit smaller, and it avoids a
3090 GCC warning that YYVAL may be used uninitialized. */
3091 yyval = yyvsp[1-yylen];
3092
3093
3094 YY_REDUCE_PRINT (yyn);
3095 switch (yyn)
Reid Spencere7c3c602006-11-30 06:36:44 +00003096 {
Reid Spencer319a7302007-01-05 17:20:02 +00003097 case 81:
Reid Spencerb6673a92007-01-15 02:41:46 +00003098#line 1061 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003099 {
3100 (yyval.String) = (yyvsp[-1].String);
3101 ;}
3102 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00003103
Reid Spencer319a7302007-01-05 17:20:02 +00003104 case 82:
Reid Spencerb6673a92007-01-15 02:41:46 +00003105#line 1064 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003106 {
3107 (yyval.String) = new std::string("");
3108 ;}
3109 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00003110
Reid Spencer319a7302007-01-05 17:20:02 +00003111 case 90:
Reid Spencerb6673a92007-01-15 02:41:46 +00003112#line 1071 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003113 { (yyval.String) = new std::string(""); ;}
3114 break;
Reid Spencere77e35e2006-12-01 20:26:20 +00003115
Reid Spencer319a7302007-01-05 17:20:02 +00003116 case 97:
Reid Spencerb6673a92007-01-15 02:41:46 +00003117#line 1076 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003118 {
3119 *(yyvsp[-1].String) += *(yyvsp[0].String);
3120 delete (yyvsp[0].String);
3121 (yyval.String) = (yyvsp[-1].String);
3122 ;}
3123 break;
Reid Spencer16244f42006-12-01 21:10:07 +00003124
Reid Spencer319a7302007-01-05 17:20:02 +00003125 case 98:
Reid Spencerb6673a92007-01-15 02:41:46 +00003126#line 1081 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003127 { (yyval.String) = new std::string(""); ;}
3128 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00003129
Reid Spencer319a7302007-01-05 17:20:02 +00003130 case 99:
Reid Spencerb6673a92007-01-15 02:41:46 +00003131#line 1086 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003132 { (yyval.String) = new std::string(); ;}
3133 break;
3134
Reid Spencerc4d96252007-01-13 00:03:30 +00003135 case 100:
Reid Spencerb6673a92007-01-15 02:41:46 +00003136#line 1087 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003137 { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
3138 break;
3139
3140 case 101:
Reid Spencerb6673a92007-01-15 02:41:46 +00003141#line 1090 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003142 { (yyval.String) = new std::string(); ;}
3143 break;
3144
3145 case 102:
Reid Spencerb6673a92007-01-15 02:41:46 +00003146#line 1091 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003147 {
3148 (yyvsp[-1].String)->insert(0, ", ");
3149 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3150 delete (yyvsp[0].String);
3151 (yyval.String) = (yyvsp[-1].String);
3152 ;}
3153 break;
3154
3155 case 103:
Reid Spencerb6673a92007-01-15 02:41:46 +00003156#line 1099 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003157 {
3158 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3159 delete (yyvsp[0].String);
3160 (yyval.String) = (yyvsp[-1].String);
3161 ;}
3162 break;
3163
3164 case 104:
Reid Spencerb6673a92007-01-15 02:41:46 +00003165#line 1105 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003166 { (yyval.String) = new std::string(); ;}
3167 break;
3168
Reid Spencerc4d96252007-01-13 00:03:30 +00003169 case 106:
Reid Spencerb6673a92007-01-15 02:41:46 +00003170#line 1109 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003171 { (yyval.String) = new std::string(); ;}
3172 break;
3173
Reid Spencer319a7302007-01-05 17:20:02 +00003174 case 107:
Reid Spencerb6673a92007-01-15 02:41:46 +00003175#line 1110 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003176 {
3177 (yyvsp[-1].String)->insert(0, ", ");
3178 if (!(yyvsp[0].String)->empty())
3179 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3180 delete (yyvsp[0].String);
3181 (yyval.String) = (yyvsp[-1].String);
3182 ;}
3183 break;
3184
3185 case 109:
Reid Spencerb6673a92007-01-15 02:41:46 +00003186#line 1120 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003187 {
3188 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
3189 delete (yyvsp[0].String);
3190 (yyval.String) = (yyvsp[-1].String);
3191 ;}
3192 break;
3193
3194 case 127:
Reid Spencerb6673a92007-01-15 02:41:46 +00003195#line 1142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003196 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003197 (yyval.Ty) = Type::get(*(yyvsp[0].String), OpaqueTy);
Reid Spencer319a7302007-01-05 17:20:02 +00003198 ;}
3199 break;
3200
3201 case 128:
Reid Spencerb6673a92007-01-15 02:41:46 +00003202#line 1145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003203 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003204 (yyval.Ty) = Type::get(*(yyvsp[0].String), UnresolvedTy);
Reid Spencer319a7302007-01-05 17:20:02 +00003205 ;}
3206 break;
3207
3208 case 129:
Reid Spencerb6673a92007-01-15 02:41:46 +00003209#line 1148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003210 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003211 (yyval.Ty) = (yyvsp[0].Ty);
Reid Spencer319a7302007-01-05 17:20:02 +00003212 ;}
3213 break;
3214
3215 case 130:
Reid Spencerb6673a92007-01-15 02:41:46 +00003216#line 1151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003217 { // Type UpReference
3218 (yyvsp[0].String)->insert(0, "\\");
Reid Spencerb6673a92007-01-15 02:41:46 +00003219 (yyval.Ty) = Type::get(*(yyvsp[0].String), UpRefTy);
Reid Spencer319a7302007-01-05 17:20:02 +00003220 ;}
3221 break;
3222
3223 case 131:
Reid Spencerb6673a92007-01-15 02:41:46 +00003224#line 1155 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003225 { // Function derived type?
Reid Spencerb6673a92007-01-15 02:41:46 +00003226 std::string newTy( (yyvsp[-3].Ty)->getNewTy() + "(");
Reid Spencer319a7302007-01-05 17:20:02 +00003227 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003228 if (i != 0)
3229 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003230 if ((*(yyvsp[-1].TypeVec))[i]->isVoid())
Reid Spencer52402b02007-01-02 05:45:11 +00003231 newTy += "...";
3232 else
Reid Spencer319a7302007-01-05 17:20:02 +00003233 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003234 }
3235 newTy += ")";
Reid Spencerb6673a92007-01-15 02:41:46 +00003236 (yyval.Ty) = Type::get(newTy, (yyvsp[-3].Ty), (yyvsp[-1].TypeVec));
Reid Spencer319a7302007-01-05 17:20:02 +00003237 ;}
3238 break;
3239
3240 case 132:
Reid Spencerb6673a92007-01-15 02:41:46 +00003241#line 1168 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003242 { // Sized array type?
3243 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3244 (yyvsp[-3].String)->insert(0,"[ ");
Reid Spencerb6673a92007-01-15 02:41:46 +00003245 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Ty)->getNewTy() + " ]";
3246 (yyval.Ty) = Type::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Ty), elems);
Reid Spencer319a7302007-01-05 17:20:02 +00003247 ;}
3248 break;
3249
3250 case 133:
Reid Spencerb6673a92007-01-15 02:41:46 +00003251#line 1174 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003252 { // Packed array type?
3253 uint64_t elems = atoi((yyvsp[-3].String)->c_str());
3254 (yyvsp[-3].String)->insert(0,"< ");
Reid Spencerb6673a92007-01-15 02:41:46 +00003255 *(yyvsp[-3].String) += " x " + (yyvsp[-1].Ty)->getNewTy() + " >";
3256 (yyval.Ty) = Type::get(*(yyvsp[-3].String), PackedTy, (yyvsp[-1].Ty), elems);
Reid Spencer319a7302007-01-05 17:20:02 +00003257 ;}
3258 break;
3259
3260 case 134:
Reid Spencerb6673a92007-01-15 02:41:46 +00003261#line 1180 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003262 { // Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003263 std::string newTy("{");
Reid Spencer319a7302007-01-05 17:20:02 +00003264 for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003265 if (i != 0)
3266 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003267 newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003268 }
3269 newTy += "}";
Reid Spencerb6673a92007-01-15 02:41:46 +00003270 (yyval.Ty) = Type::get(newTy, StructTy, (yyvsp[-1].TypeVec));
Reid Spencer319a7302007-01-05 17:20:02 +00003271 ;}
3272 break;
3273
3274 case 135:
Reid Spencerb6673a92007-01-15 02:41:46 +00003275#line 1190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003276 { // Empty structure type?
Reid Spencerb6673a92007-01-15 02:41:46 +00003277 (yyval.Ty) = Type::get("{}", StructTy, new TypeList());
Reid Spencer319a7302007-01-05 17:20:02 +00003278 ;}
3279 break;
3280
3281 case 136:
Reid Spencerb6673a92007-01-15 02:41:46 +00003282#line 1193 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003283 { // Packed Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003284 std::string newTy("<{");
Reid Spencer319a7302007-01-05 17:20:02 +00003285 for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003286 if (i != 0)
3287 newTy += ", ";
Reid Spencer319a7302007-01-05 17:20:02 +00003288 newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003289 }
3290 newTy += "}>";
Reid Spencerb6673a92007-01-15 02:41:46 +00003291 (yyval.Ty) = Type::get(newTy, PackedStructTy, (yyvsp[-2].TypeVec));
Reid Spencer319a7302007-01-05 17:20:02 +00003292 ;}
3293 break;
3294
3295 case 137:
Reid Spencerb6673a92007-01-15 02:41:46 +00003296#line 1203 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003297 { // Empty packed structure type?
Reid Spencerb6673a92007-01-15 02:41:46 +00003298 (yyval.Ty) = Type::get("<{}>", PackedStructTy, new TypeList());
Reid Spencer319a7302007-01-05 17:20:02 +00003299 ;}
3300 break;
3301
3302 case 138:
Reid Spencerb6673a92007-01-15 02:41:46 +00003303#line 1206 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003304 { // Pointer type?
Reid Spencerb6673a92007-01-15 02:41:46 +00003305 (yyval.Ty) = (yyvsp[-1].Ty)->getPointerType();
Reid Spencer319a7302007-01-05 17:20:02 +00003306 ;}
3307 break;
3308
3309 case 139:
Reid Spencerb6673a92007-01-15 02:41:46 +00003310#line 1214 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003311 {
3312 (yyval.TypeVec) = new TypeList();
Reid Spencerb6673a92007-01-15 02:41:46 +00003313 (yyval.TypeVec)->push_back((yyvsp[0].Ty));
Reid Spencer319a7302007-01-05 17:20:02 +00003314 ;}
3315 break;
3316
3317 case 140:
Reid Spencerb6673a92007-01-15 02:41:46 +00003318#line 1218 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003319 {
3320 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
Reid Spencerb6673a92007-01-15 02:41:46 +00003321 (yyval.TypeVec)->push_back((yyvsp[0].Ty));
Reid Spencer319a7302007-01-05 17:20:02 +00003322 ;}
3323 break;
3324
3325 case 142:
Reid Spencerb6673a92007-01-15 02:41:46 +00003326#line 1226 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003327 {
3328 (yyval.TypeVec) = (yyvsp[-2].TypeVec);
Reid Spencerb6673a92007-01-15 02:41:46 +00003329 (yyval.TypeVec)->push_back(Type::get("void",VoidTy));
Reid Spencer319a7302007-01-05 17:20:02 +00003330 delete (yyvsp[0].String);
3331 ;}
3332 break;
3333
3334 case 143:
Reid Spencerb6673a92007-01-15 02:41:46 +00003335#line 1231 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003336 {
3337 (yyval.TypeVec) = new TypeList();
Reid Spencerb6673a92007-01-15 02:41:46 +00003338 (yyval.TypeVec)->push_back(Type::get("void",VoidTy));
Reid Spencer319a7302007-01-05 17:20:02 +00003339 delete (yyvsp[0].String);
3340 ;}
3341 break;
3342
3343 case 144:
Reid Spencerb6673a92007-01-15 02:41:46 +00003344#line 1236 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003345 {
3346 (yyval.TypeVec) = new TypeList();
3347 ;}
3348 break;
3349
3350 case 145:
Reid Spencerb6673a92007-01-15 02:41:46 +00003351#line 1246 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003352 { // Nonempty unsized arr
Reid Spencerb6673a92007-01-15 02:41:46 +00003353 (yyval.Const) = new Constant;
3354 (yyval.Const)->type = (yyvsp[-3].Ty);
3355 (yyval.Const)->cnst = new std::string((yyvsp[-3].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003356 *(yyval.Const)->cnst += " [ " + *(yyvsp[-1].String) + " ]";
Reid Spencer319a7302007-01-05 17:20:02 +00003357 delete (yyvsp[-1].String);
3358 ;}
3359 break;
3360
3361 case 146:
Reid Spencerb6673a92007-01-15 02:41:46 +00003362#line 1253 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003363 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003364 (yyval.Const) = new Constant;
3365 (yyval.Const)->type = (yyvsp[-2].Ty);
3366 (yyval.Const)->cnst = new std::string((yyvsp[-2].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003367 *(yyval.Const)->cnst += "[ ]";
Reid Spencer319a7302007-01-05 17:20:02 +00003368 ;}
3369 break;
3370
3371 case 147:
Reid Spencerb6673a92007-01-15 02:41:46 +00003372#line 1259 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003373 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003374 (yyval.Const) = new Constant;
3375 (yyval.Const)->type = (yyvsp[-2].Ty);
3376 (yyval.Const)->cnst = new std::string((yyvsp[-2].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003377 *(yyval.Const)->cnst += " c" + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003378 delete (yyvsp[0].String);
3379 ;}
3380 break;
3381
3382 case 148:
Reid Spencerb6673a92007-01-15 02:41:46 +00003383#line 1266 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003384 { // Nonempty unsized arr
Reid Spencerb6673a92007-01-15 02:41:46 +00003385 (yyval.Const) = new Constant;
3386 (yyval.Const)->type = (yyvsp[-3].Ty);
3387 (yyval.Const)->cnst = new std::string((yyvsp[-3].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003388 *(yyval.Const)->cnst += " < " + *(yyvsp[-1].String) + " >";
Reid Spencer319a7302007-01-05 17:20:02 +00003389 delete (yyvsp[-1].String);
3390 ;}
3391 break;
3392
3393 case 149:
Reid Spencerb6673a92007-01-15 02:41:46 +00003394#line 1273 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003395 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003396 (yyval.Const) = new Constant;
3397 (yyval.Const)->type = (yyvsp[-3].Ty);
3398 (yyval.Const)->cnst = new std::string((yyvsp[-3].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003399 *(yyval.Const)->cnst += " { " + *(yyvsp[-1].String) + " }";
Reid Spencer319a7302007-01-05 17:20:02 +00003400 delete (yyvsp[-1].String);
3401 ;}
3402 break;
3403
3404 case 150:
Reid Spencerb6673a92007-01-15 02:41:46 +00003405#line 1280 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003406 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003407 (yyval.Const) = new Constant;
3408 (yyval.Const)->type = (yyvsp[-2].Ty);
3409 (yyval.Const)->cnst = new std::string((yyvsp[-2].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003410 *(yyval.Const)->cnst += " {}";
Reid Spencer319a7302007-01-05 17:20:02 +00003411 ;}
3412 break;
3413
3414 case 151:
Reid Spencerb6673a92007-01-15 02:41:46 +00003415#line 1286 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003416 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003417 (yyval.Const) = new Constant;
3418 (yyval.Const)->type = (yyvsp[-1].Ty);
3419 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003420 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003421 delete (yyvsp[0].String);
3422 ;}
3423 break;
3424
3425 case 152:
Reid Spencerb6673a92007-01-15 02:41:46 +00003426#line 1293 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003427 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003428 (yyval.Const) = new Constant;
3429 (yyval.Const)->type = (yyvsp[-1].Ty);
3430 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003431 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003432 delete (yyvsp[0].String);
3433 ;}
3434 break;
3435
3436 case 153:
Reid Spencerb6673a92007-01-15 02:41:46 +00003437#line 1300 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003438 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003439 (yyval.Const) = new Constant;
3440 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Ty)->resolve(), true);
3441 (yyval.Const)->type = (yyvsp[-1].Ty);
3442 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003443 *(yyval.Const)->cnst += " " + Name;
Reid Spencer319a7302007-01-05 17:20:02 +00003444 delete (yyvsp[0].String);
3445 ;}
3446 break;
3447
3448 case 154:
Reid Spencerb6673a92007-01-15 02:41:46 +00003449#line 1308 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003450 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003451 (yyval.Const) = new Constant;
3452 (yyval.Const)->type = (yyvsp[-1].Ty);
3453 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003454 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003455 delete (yyvsp[0].String);
3456 ;}
3457 break;
3458
3459 case 155:
Reid Spencerb6673a92007-01-15 02:41:46 +00003460#line 1315 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003461 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003462 (yyval.Const) = new Constant;
3463 (yyval.Const)->type = (yyvsp[-1].Ty);
3464 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003465 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003466 delete (yyvsp[0].String);
3467 ;}
3468 break;
3469
3470 case 156:
Reid Spencerb6673a92007-01-15 02:41:46 +00003471#line 1322 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003472 { // integral constants
Reid Spencerb6673a92007-01-15 02:41:46 +00003473 (yyval.Const) = new Constant;
3474 (yyval.Const)->type = (yyvsp[-1].Ty);
3475 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003476 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003477 delete (yyvsp[0].String);
3478 ;}
3479 break;
3480
3481 case 157:
Reid Spencerb6673a92007-01-15 02:41:46 +00003482#line 1329 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003483 { // integral constants
Reid Spencerb6673a92007-01-15 02:41:46 +00003484 (yyval.Const) = new Constant;
3485 (yyval.Const)->type = (yyvsp[-1].Ty);
3486 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003487 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003488 delete (yyvsp[0].String);
3489 ;}
3490 break;
3491
3492 case 158:
Reid Spencerb6673a92007-01-15 02:41:46 +00003493#line 1336 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003494 { // Boolean constants
Reid Spencerb6673a92007-01-15 02:41:46 +00003495 (yyval.Const) = new Constant;
3496 (yyval.Const)->type = (yyvsp[-1].Ty);
3497 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003498 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003499 delete (yyvsp[0].String);
3500 ;}
3501 break;
3502
3503 case 159:
Reid Spencerb6673a92007-01-15 02:41:46 +00003504#line 1343 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003505 { // Boolean constants
Reid Spencerb6673a92007-01-15 02:41:46 +00003506 (yyval.Const) = new Constant;
3507 (yyval.Const)->type = (yyvsp[-1].Ty);
3508 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003509 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003510 delete (yyvsp[0].String);
3511 ;}
3512 break;
3513
3514 case 160:
Reid Spencerb6673a92007-01-15 02:41:46 +00003515#line 1350 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003516 { // Float & Double constants
Reid Spencerb6673a92007-01-15 02:41:46 +00003517 (yyval.Const) = new Constant;
3518 (yyval.Const)->type = (yyvsp[-1].Ty);
3519 (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer30d0c582007-01-15 00:26:18 +00003520 *(yyval.Const)->cnst += " " + *(yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003521 delete (yyvsp[0].String);
3522 ;}
3523 break;
3524
3525 case 161:
Reid Spencerb6673a92007-01-15 02:41:46 +00003526#line 1358 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003527 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003528 std::string source = *(yyvsp[-3].Const)->cnst;
Reid Spencerb6673a92007-01-15 02:41:46 +00003529 const Type* SrcTy = (yyvsp[-3].Const)->type->resolve();
3530 const Type* DstTy = (yyvsp[-1].Ty)->resolve();
Reid Spencer319a7302007-01-05 17:20:02 +00003531 if (*(yyvsp[-5].String) == "cast") {
Reid Spencera50d5962006-12-02 04:11:07 +00003532 // Call getCastUpgrade to upgrade the old cast
Reid Spencer319a7302007-01-05 17:20:02 +00003533 (yyval.String) = new std::string(getCastUpgrade(source, SrcTy, DstTy, true));
Reid Spencera50d5962006-12-02 04:11:07 +00003534 } else {
3535 // Nothing to upgrade, just create the cast constant expr
Reid Spencer319a7302007-01-05 17:20:02 +00003536 (yyval.String) = new std::string(*(yyvsp[-5].String));
Reid Spencerb6673a92007-01-15 02:41:46 +00003537 *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Ty)->getNewTy() + ")";
Reid Spencer280d8012006-12-01 23:40:53 +00003538 }
Reid Spencer30d0c582007-01-15 00:26:18 +00003539 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-2].String);
Reid Spencer319a7302007-01-05 17:20:02 +00003540 ;}
3541 break;
3542
3543 case 162:
Reid Spencerb6673a92007-01-15 02:41:46 +00003544#line 1372 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003545 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003546 *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const)->cnst;
Reid Spencer319a7302007-01-05 17:20:02 +00003547 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
Reid Spencerb6673a92007-01-15 02:41:46 +00003548 Value* V = (*(yyvsp[-1].ValList))[i];
3549 *(yyvsp[-4].String) += ", " + *V->val;
3550 delete V;
Reid Spencerf8483652006-12-02 15:16:01 +00003551 }
Reid Spencer319a7302007-01-05 17:20:02 +00003552 *(yyvsp[-4].String) += ")";
3553 (yyval.String) = (yyvsp[-4].String);
Reid Spencer30d0c582007-01-15 00:26:18 +00003554 delete (yyvsp[-2].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003555 delete (yyvsp[-1].ValList);
3556 ;}
3557 break;
3558
3559 case 163:
Reid Spencerb6673a92007-01-15 02:41:46 +00003560#line 1384 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003561 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003562 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3563 delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003564 (yyval.String) = (yyvsp[-7].String);
3565 ;}
3566 break;
3567
3568 case 164:
Reid Spencerb6673a92007-01-15 02:41:46 +00003569#line 1389 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003570 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003571 const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const)->type);
Reid Spencer319a7302007-01-05 17:20:02 +00003572 (yyval.String) = new std::string(op);
Reid Spencer30d0c582007-01-15 00:26:18 +00003573 *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3574 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003575 ;}
3576 break;
3577
3578 case 165:
Reid Spencerb6673a92007-01-15 02:41:46 +00003579#line 1395 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003580 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003581 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3582 delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003583 (yyval.String) = (yyvsp[-5].String);
3584 ;}
3585 break;
3586
3587 case 166:
Reid Spencerb6673a92007-01-15 02:41:46 +00003588#line 1400 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003589 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003590 *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const)->type);
3591 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3592 delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003593 (yyval.String) = (yyvsp[-5].String);
3594 ;}
3595 break;
3596
3597 case 167:
Reid Spencerb6673a92007-01-15 02:41:46 +00003598#line 1406 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003599 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003600 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3601 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003602 (yyval.String) = (yyvsp[-6].String);
3603 ;}
3604 break;
3605
3606 case 168:
Reid Spencerb6673a92007-01-15 02:41:46 +00003607#line 1411 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003608 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003609 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3610 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003611 (yyval.String) = (yyvsp[-6].String);
3612 ;}
3613 break;
3614
3615 case 169:
Reid Spencerb6673a92007-01-15 02:41:46 +00003616#line 1416 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003617 {
3618 const char* shiftop = (yyvsp[-5].String)->c_str();
3619 if (*(yyvsp[-5].String) == "shr")
Reid Spencer30d0c582007-01-15 00:26:18 +00003620 shiftop = ((yyvsp[-3].Const)->type->isUnsigned()) ? "lshr" : "ashr";
Reid Spencer319a7302007-01-05 17:20:02 +00003621 (yyval.String) = new std::string(shiftop);
Reid Spencer30d0c582007-01-15 00:26:18 +00003622 *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3623 delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003624 ;}
3625 break;
3626
3627 case 170:
Reid Spencerb6673a92007-01-15 02:41:46 +00003628#line 1424 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003629 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003630 *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3631 delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003632 (yyval.String) = (yyvsp[-5].String);
3633 ;}
3634 break;
3635
3636 case 171:
Reid Spencerb6673a92007-01-15 02:41:46 +00003637#line 1429 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003638 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003639 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3640 delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003641 (yyval.String) = (yyvsp[-7].String);
3642 ;}
3643 break;
3644
3645 case 172:
Reid Spencerb6673a92007-01-15 02:41:46 +00003646#line 1434 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003647 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003648 *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")";
3649 delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003650 (yyval.String) = (yyvsp[-7].String);
3651 ;}
3652 break;
3653
3654 case 173:
Reid Spencerb6673a92007-01-15 02:41:46 +00003655#line 1444 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003656 {
Reid Spencer30d0c582007-01-15 00:26:18 +00003657 *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const)->cnst;
3658 delete (yyvsp[0].Const);
Reid Spencer319a7302007-01-05 17:20:02 +00003659 (yyval.String) = (yyvsp[-2].String);
3660 ;}
3661 break;
3662
3663 case 174:
Reid Spencerb6673a92007-01-15 02:41:46 +00003664#line 1449 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer30d0c582007-01-15 00:26:18 +00003665 { (yyval.String) = new std::string(*(yyvsp[0].Const)->cnst); delete (yyvsp[0].Const); ;}
Reid Spencer319a7302007-01-05 17:20:02 +00003666 break;
3667
3668 case 177:
Reid Spencerb6673a92007-01-15 02:41:46 +00003669#line 1464 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003670 {
3671;}
3672 break;
3673
3674 case 178:
Reid Spencerb6673a92007-01-15 02:41:46 +00003675#line 1469 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003676 {
3677 (yyval.String) = 0;
3678 ;}
3679 break;
3680
3681 case 179:
Reid Spencerb6673a92007-01-15 02:41:46 +00003682#line 1472 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003683 {
3684 *O << *(yyvsp[0].String) << '\n';
3685 delete (yyvsp[0].String);
3686 (yyval.String) = 0;
3687 ;}
3688 break;
3689
3690 case 180:
Reid Spencerb6673a92007-01-15 02:41:46 +00003691#line 1477 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003692 {
3693 *O << "module asm " << ' ' << *(yyvsp[0].String) << '\n';
3694 (yyval.String) = 0;
3695 ;}
3696 break;
3697
3698 case 181:
Reid Spencerb6673a92007-01-15 02:41:46 +00003699#line 1481 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003700 {
Reid Spencerd154b572006-12-01 20:36:40 +00003701 *O << "implementation\n";
Reid Spencer319a7302007-01-05 17:20:02 +00003702 (yyval.String) = 0;
3703 ;}
3704 break;
3705
3706 case 182:
Reid Spencerb6673a92007-01-15 02:41:46 +00003707#line 1485 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003708 { (yyval.String) = 0; ;}
3709 break;
3710
3711 case 184:
Reid Spencerb6673a92007-01-15 02:41:46 +00003712#line 1487 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003713 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
3714 break;
3715
3716 case 185:
Reid Spencerb6673a92007-01-15 02:41:46 +00003717#line 1490 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003718 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003719 Type::EnumeratedTypes.push_back((yyvsp[0].Ty));
Reid Spencer319a7302007-01-05 17:20:02 +00003720 if (!(yyvsp[-2].String)->empty()) {
Reid Spencerb6673a92007-01-15 02:41:46 +00003721 Type::NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Ty);
Reid Spencer319a7302007-01-05 17:20:02 +00003722 *O << *(yyvsp[-2].String) << " = ";
Reid Spencera50d5962006-12-02 04:11:07 +00003723 }
Reid Spencerb6673a92007-01-15 02:41:46 +00003724 *O << "type " << (yyvsp[0].Ty)->getNewTy() << '\n';
Reid Spencer319a7302007-01-05 17:20:02 +00003725 delete (yyvsp[-2].String); delete (yyvsp[-1].String);
3726 (yyval.String) = 0;
3727 ;}
3728 break;
3729
3730 case 186:
Reid Spencerb6673a92007-01-15 02:41:46 +00003731#line 1500 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003732 { // Function prototypes can be in const pool
3733 *O << *(yyvsp[0].String) << '\n';
3734 delete (yyvsp[0].String);
3735 (yyval.String) = 0;
3736 ;}
3737 break;
3738
3739 case 187:
Reid Spencerb6673a92007-01-15 02:41:46 +00003740#line 1505 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003741 { // Asm blocks can be in the const pool
3742 *O << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3743 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3744 (yyval.String) = 0;
3745 ;}
3746 break;
3747
3748 case 188:
Reid Spencerb6673a92007-01-15 02:41:46 +00003749#line 1510 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003750 {
3751 if (!(yyvsp[-4].String)->empty()) {
Reid Spencer30d0c582007-01-15 00:26:18 +00003752 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const)->type->getPointerType(),
Reid Spencer319a7302007-01-05 17:20:02 +00003753 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003754 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003755 }
Reid Spencer30d0c582007-01-15 00:26:18 +00003756 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const)->cnst << ' ' << *(yyvsp[0].String) << '\n';
Reid Spencer319a7302007-01-05 17:20:02 +00003757 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3758 (yyval.String) = 0;
3759 ;}
3760 break;
3761
3762 case 189:
Reid Spencerb6673a92007-01-15 02:41:46 +00003763#line 1520 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003764 {
3765 if (!(yyvsp[-4].String)->empty()) {
Reid Spencerb6673a92007-01-15 02:41:46 +00003766 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Ty)->getPointerType(),
Reid Spencer319a7302007-01-05 17:20:02 +00003767 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003768 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003769 }
Reid Spencerb6673a92007-01-15 02:41:46 +00003770 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
Reid Spencer319a7302007-01-05 17:20:02 +00003771 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3772 (yyval.String) = 0;
3773 ;}
3774 break;
3775
3776 case 190:
Reid Spencerb6673a92007-01-15 02:41:46 +00003777#line 1530 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003778 {
3779 if (!(yyvsp[-4].String)->empty()) {
Reid Spencerb6673a92007-01-15 02:41:46 +00003780 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Ty)->getPointerType(),
Reid Spencer319a7302007-01-05 17:20:02 +00003781 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003782 *O << Name << " = ";
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003783 }
Reid Spencerb6673a92007-01-15 02:41:46 +00003784 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
Reid Spencer319a7302007-01-05 17:20:02 +00003785 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3786 (yyval.String) = 0;
3787 ;}
3788 break;
3789
3790 case 191:
Reid Spencerb6673a92007-01-15 02:41:46 +00003791#line 1540 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003792 {
3793 if (!(yyvsp[-4].String)->empty()) {
Reid Spencerb6673a92007-01-15 02:41:46 +00003794 std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Ty)->getPointerType(),
Reid Spencer319a7302007-01-05 17:20:02 +00003795 *(yyvsp[-2].String) == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003796 *O << Name << " = ";
Reid Spencerf5626a32007-01-01 01:20:41 +00003797 }
Reid Spencerb6673a92007-01-15 02:41:46 +00003798 *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n';
Reid Spencer319a7302007-01-05 17:20:02 +00003799 delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
3800 (yyval.String) = 0;
3801 ;}
3802 break;
3803
3804 case 192:
Reid Spencerb6673a92007-01-15 02:41:46 +00003805#line 1550 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003806 {
3807 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3808 delete (yyvsp[-1].String); delete (yyvsp[0].String);
3809 (yyval.String) = 0;
3810 ;}
3811 break;
3812
3813 case 193:
Reid Spencerb6673a92007-01-15 02:41:46 +00003814#line 1555 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003815 {
3816 *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n';
3817 delete (yyvsp[-2].String); delete (yyvsp[0].String);
3818 (yyval.String) = 0;
3819 ;}
3820 break;
3821
3822 case 194:
Reid Spencerb6673a92007-01-15 02:41:46 +00003823#line 1560 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003824 {
3825 (yyval.String) = 0;
3826 ;}
3827 break;
3828
3829 case 198:
Reid Spencerb6673a92007-01-15 02:41:46 +00003830#line 1570 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003831 {
3832 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3833 delete (yyvsp[0].String);
3834 (yyval.String) = (yyvsp[-2].String);
3835 ;}
3836 break;
3837
3838 case 199:
Reid Spencerb6673a92007-01-15 02:41:46 +00003839#line 1575 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003840 {
3841 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3842 if (*(yyvsp[0].String) == "64")
Reid Spencere77e35e2006-12-01 20:26:20 +00003843 SizeOfPointer = 64;
Reid Spencer319a7302007-01-05 17:20:02 +00003844 delete (yyvsp[0].String);
3845 (yyval.String) = (yyvsp[-2].String);
3846 ;}
3847 break;
3848
3849 case 200:
Reid Spencerb6673a92007-01-15 02:41:46 +00003850#line 1582 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003851 {
3852 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3853 delete (yyvsp[0].String);
3854 (yyval.String) = (yyvsp[-2].String);
3855 ;}
3856 break;
3857
3858 case 201:
Reid Spencerb6673a92007-01-15 02:41:46 +00003859#line 1587 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003860 {
3861 *(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
3862 delete (yyvsp[0].String);
3863 (yyval.String) = (yyvsp[-2].String);
3864 ;}
3865 break;
3866
3867 case 202:
Reid Spencerb6673a92007-01-15 02:41:46 +00003868#line 1594 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003869 {
3870 (yyvsp[-1].String)->insert(0, "[ ");
3871 *(yyvsp[-1].String) += " ]";
3872 (yyval.String) = (yyvsp[-1].String);
3873 ;}
3874 break;
3875
3876 case 203:
Reid Spencerb6673a92007-01-15 02:41:46 +00003877#line 1601 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003878 {
3879 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3880 delete (yyvsp[0].String);
3881 (yyval.String) = (yyvsp[-2].String);
3882 ;}
3883 break;
3884
3885 case 205:
Reid Spencerb6673a92007-01-15 02:41:46 +00003886#line 1607 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003887 {
3888 (yyval.String) = new std::string();
3889 ;}
3890 break;
3891
3892 case 209:
Reid Spencerb6673a92007-01-15 02:41:46 +00003893#line 1616 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003894 { (yyval.String) = new std::string(); ;}
3895 break;
3896
3897 case 210:
Reid Spencerb6673a92007-01-15 02:41:46 +00003898#line 1618 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003899 {
Reid Spencerb6673a92007-01-15 02:41:46 +00003900 (yyval.String) = new std::string((yyvsp[-1].Ty)->getNewTy());
Reid Spencer319a7302007-01-05 17:20:02 +00003901 if (!(yyvsp[0].String)->empty()) {
Reid Spencerb6673a92007-01-15 02:41:46 +00003902 std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Ty)->resolve());
Reid Spencer319a7302007-01-05 17:20:02 +00003903 *(yyval.String) += " " + Name;
Reid Spencer52402b02007-01-02 05:45:11 +00003904 }
Reid Spencer319a7302007-01-05 17:20:02 +00003905 delete (yyvsp[0].String);
3906;}
3907 break;
3908
3909 case 211:
Reid Spencerb6673a92007-01-15 02:41:46 +00003910#line 1627 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003911 {
3912 *(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
3913 delete (yyvsp[0].String);
3914 ;}
3915 break;
3916
3917 case 212:
Reid Spencerb6673a92007-01-15 02:41:46 +00003918#line 1631 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003919 {
3920 (yyval.String) = (yyvsp[0].String);
3921 ;}
3922 break;
3923
Reid Spencerc4d96252007-01-13 00:03:30 +00003924 case 213:
Reid Spencerb6673a92007-01-15 02:41:46 +00003925#line 1635 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003926 {
3927 (yyval.String) = (yyvsp[0].String);
3928 ;}
3929 break;
3930
Reid Spencer319a7302007-01-05 17:20:02 +00003931 case 214:
Reid Spencerb6673a92007-01-15 02:41:46 +00003932#line 1638 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003933 {
3934 *(yyvsp[-2].String) += ", ...";
3935 (yyval.String) = (yyvsp[-2].String);
3936 delete (yyvsp[0].String);
3937 ;}
3938 break;
3939
3940 case 215:
Reid Spencerb6673a92007-01-15 02:41:46 +00003941#line 1643 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003942 {
3943 (yyval.String) = (yyvsp[0].String);
3944 ;}
3945 break;
3946
3947 case 216:
Reid Spencerb6673a92007-01-15 02:41:46 +00003948#line 1646 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003949 { (yyval.String) = new std::string(); ;}
3950 break;
3951
3952 case 217:
Reid Spencerb6673a92007-01-15 02:41:46 +00003953#line 1649 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003954 {
Reid Spencerc4d96252007-01-13 00:03:30 +00003955 if (*(yyvsp[-5].String) == "%llvm.va_start" || *(yyvsp[-5].String) == "%llvm.va_end") {
Reid Spencerf0c9a652007-01-13 00:13:49 +00003956 *(yyvsp[-3].String) = "i8*";
Reid Spencerc4d96252007-01-13 00:03:30 +00003957 } else if (*(yyvsp[-5].String) == "%llvm.va_copy") {
3958 *(yyvsp[-3].String) = "i8*, i8*";
3959 }
Reid Spencer319a7302007-01-05 17:20:02 +00003960 if (!(yyvsp[-7].String)->empty()) {
3961 *(yyvsp[-7].String) += " ";
Reid Spencere77e35e2006-12-01 20:26:20 +00003962 }
Reid Spencerb6673a92007-01-15 02:41:46 +00003963 *(yyvsp[-7].String) += (yyvsp[-6].Ty)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")";
Reid Spencer319a7302007-01-05 17:20:02 +00003964 if (!(yyvsp[-1].String)->empty()) {
3965 *(yyvsp[-7].String) += " " + *(yyvsp[-1].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003966 }
Reid Spencer319a7302007-01-05 17:20:02 +00003967 if (!(yyvsp[0].String)->empty()) {
3968 *(yyvsp[-7].String) += " " + *(yyvsp[0].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00003969 }
Reid Spencer319a7302007-01-05 17:20:02 +00003970 delete (yyvsp[-5].String);
3971 delete (yyvsp[-3].String);
3972 delete (yyvsp[-1].String);
3973 delete (yyvsp[0].String);
3974 (yyval.String) = (yyvsp[-7].String);
3975 ;}
3976 break;
3977
3978 case 218:
Reid Spencerb6673a92007-01-15 02:41:46 +00003979#line 1672 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003980 { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
3981 break;
3982
3983 case 219:
Reid Spencerb6673a92007-01-15 02:41:46 +00003984#line 1673 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003985 { (yyval.String) = new std::string ("{"); ;}
3986 break;
3987
3988 case 220:
Reid Spencerb6673a92007-01-15 02:41:46 +00003989#line 1676 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003990 {
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003991 *O << "define ";
Reid Spencer319a7302007-01-05 17:20:02 +00003992 if (!(yyvsp[-2].String)->empty()) {
3993 *O << *(yyvsp[-2].String) << ' ';
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003994 }
Reid Spencer319a7302007-01-05 17:20:02 +00003995 *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n';
3996 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
3997 (yyval.String) = 0;
3998 ;}
3999 break;
4000
4001 case 221:
Reid Spencerb6673a92007-01-15 02:41:46 +00004002#line 1687 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004003 { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
4004 break;
4005
4006 case 222:
Reid Spencerb6673a92007-01-15 02:41:46 +00004007#line 1688 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004008 { (yyval.String) = new std::string("}"); ;}
4009 break;
4010
4011 case 223:
Reid Spencerb6673a92007-01-15 02:41:46 +00004012#line 1690 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004013 {
4014 if ((yyvsp[-1].String))
4015 *O << *(yyvsp[-1].String);
4016 *O << *(yyvsp[0].String) << "\n\n";
4017 delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
4018 (yyval.String) = 0;
4019;}
4020 break;
4021
4022 case 224:
Reid Spencerb6673a92007-01-15 02:41:46 +00004023#line 1699 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004024 { (yyval.String) = new std::string(); ;}
4025 break;
4026
4027 case 227:
Reid Spencerb6673a92007-01-15 02:41:46 +00004028#line 1705 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004029 { isDeclare = true; ;}
Reid Spencer319a7302007-01-05 17:20:02 +00004030 break;
4031
4032 case 228:
Reid Spencerb6673a92007-01-15 02:41:46 +00004033#line 1705 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004034 {
4035 if (!(yyvsp[-1].String)->empty())
4036 *(yyvsp[-3].String) += " " + *(yyvsp[-1].String);
4037 *(yyvsp[-3].String) += " " + *(yyvsp[0].String);
4038 delete (yyvsp[-1].String);
4039 delete (yyvsp[0].String);
4040 (yyval.String) = (yyvsp[-3].String);
4041 isDeclare = false;
4042 ;}
4043 break;
4044
4045 case 229:
Reid Spencerb6673a92007-01-15 02:41:46 +00004046#line 1719 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004047 { (yyval.String) = new std::string(); ;}
4048 break;
4049
Reid Spencerc4d96252007-01-13 00:03:30 +00004050 case 239:
Reid Spencerb6673a92007-01-15 02:41:46 +00004051#line 1725 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004052 {
4053 (yyvsp[-1].String)->insert(0, "<");
4054 *(yyvsp[-1].String) += ">";
4055 (yyval.String) = (yyvsp[-1].String);
4056 ;}
4057 break;
4058
Reid Spencerc4d96252007-01-13 00:03:30 +00004059 case 241:
Reid Spencerb6673a92007-01-15 02:41:46 +00004060#line 1731 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004061 {
4062 if (!(yyvsp[-3].String)->empty()) {
4063 *(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
Reid Spencere77e35e2006-12-01 20:26:20 +00004064 }
Reid Spencer319a7302007-01-05 17:20:02 +00004065 *(yyvsp[-4].String) += " " + *(yyvsp[-2].String) + ", " + *(yyvsp[0].String);
4066 delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String);
4067 (yyval.String) = (yyvsp[-4].String);
4068 ;}
4069 break;
4070
Reid Spencerc4d96252007-01-13 00:03:30 +00004071 case 244:
Reid Spencerb6673a92007-01-15 02:41:46 +00004072#line 1744 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004073 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004074 (yyval.Val) = new Value;
4075 (yyval.Val)->val = (yyvsp[0].String);
4076 (yyval.Val)->constant = false;
4077 (yyval.Val)->type = 0;
Reid Spencer319a7302007-01-05 17:20:02 +00004078 ;}
4079 break;
4080
Reid Spencerc4d96252007-01-13 00:03:30 +00004081 case 245:
Reid Spencerb6673a92007-01-15 02:41:46 +00004082#line 1750 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004083 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004084 (yyval.Val) = new Value;
4085 (yyval.Val)->val = (yyvsp[0].String);
4086 (yyval.Val)->constant = true;
4087 (yyval.Val)->type = 0;
Reid Spencer319a7302007-01-05 17:20:02 +00004088 ;}
4089 break;
4090
Reid Spencerc4d96252007-01-13 00:03:30 +00004091 case 246:
Reid Spencerb6673a92007-01-15 02:41:46 +00004092#line 1761 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004093 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004094 (yyvsp[-1].Ty) = (yyvsp[-1].Ty)->resolve();
4095 std::string Name = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-1].Ty));
4096 (yyval.Val) = (yyvsp[0].Val);
4097 delete (yyval.Val)->val;
4098 (yyval.Val)->val = new std::string((yyvsp[-1].Ty)->getNewTy() + " " + Name);
4099 (yyval.Val)->type = (yyvsp[-1].Ty);
Reid Spencer319a7302007-01-05 17:20:02 +00004100 ;}
4101 break;
4102
Reid Spencer319a7302007-01-05 17:20:02 +00004103 case 247:
Reid Spencerb6673a92007-01-15 02:41:46 +00004104#line 1770 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004105 {
Reid Spencer319a7302007-01-05 17:20:02 +00004106 (yyval.String) = 0;
4107 ;}
4108 break;
4109
4110 case 248:
Reid Spencerb6673a92007-01-15 02:41:46 +00004111#line 1773 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004112 { // Do not allow functions with 0 basic blocks
Reid Spencer319a7302007-01-05 17:20:02 +00004113 (yyval.String) = 0;
4114 ;}
4115 break;
4116
4117 case 249:
Reid Spencerb6673a92007-01-15 02:41:46 +00004118#line 1781 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004119 {
4120 (yyval.String) = 0;
4121 ;}
4122 break;
4123
4124 case 250:
Reid Spencerb6673a92007-01-15 02:41:46 +00004125#line 1785 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004126 {
4127 *O << " " << *(yyvsp[0].String) << '\n';
4128 delete (yyvsp[0].String);
4129 (yyval.String) = 0;
4130 ;}
4131 break;
4132
Reid Spencerc4d96252007-01-13 00:03:30 +00004133 case 251:
Reid Spencerb6673a92007-01-15 02:41:46 +00004134#line 1790 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004135 {
4136 (yyval.String) = 0;
4137 ;}
4138 break;
4139
Reid Spencerc4d96252007-01-13 00:03:30 +00004140 case 252:
Reid Spencerb6673a92007-01-15 02:41:46 +00004141#line 1793 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004142 {
4143 *O << *(yyvsp[0].String) << '\n';
4144 delete (yyvsp[0].String);
4145 (yyval.String) = 0;
4146 ;}
4147 break;
4148
Reid Spencerc4d96252007-01-13 00:03:30 +00004149 case 254:
Reid Spencerb6673a92007-01-15 02:41:46 +00004150#line 1799 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004151 { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
4152 break;
4153
Reid Spencerc4d96252007-01-13 00:03:30 +00004154 case 255:
Reid Spencerb6673a92007-01-15 02:41:46 +00004155#line 1801 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004156 { // Return with a result...
Reid Spencerb6673a92007-01-15 02:41:46 +00004157 *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Val)->val << '\n';
4158 delete (yyvsp[-1].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004159 (yyval.String) = 0;
4160 ;}
4161 break;
4162
Reid Spencerc4d96252007-01-13 00:03:30 +00004163 case 256:
Reid Spencerb6673a92007-01-15 02:41:46 +00004164#line 1806 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004165 { // Return with no result...
Reid Spencerb6673a92007-01-15 02:41:46 +00004166 *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Ty)->getNewTy() << '\n';
Reid Spencer319a7302007-01-05 17:20:02 +00004167 delete (yyvsp[-1].String);
4168 (yyval.String) = 0;
4169 ;}
4170 break;
4171
Reid Spencerc4d96252007-01-13 00:03:30 +00004172 case 257:
Reid Spencerb6673a92007-01-15 02:41:46 +00004173#line 1811 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004174 { // Unconditional Branch...
Reid Spencerb6673a92007-01-15 02:41:46 +00004175 *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].Val)->val << '\n';
4176 delete (yyvsp[-2].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004177 (yyval.String) = 0;
4178 ;}
4179 break;
4180
Reid Spencerc4d96252007-01-13 00:03:30 +00004181 case 258:
Reid Spencerb6673a92007-01-15 02:41:46 +00004182#line 1816 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004183 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004184 std::string Name = getUniqueName((yyvsp[-6].Val)->val, (yyvsp[-7].Ty));
4185 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Ty)->getNewTy() << ' ' << Name << ", "
4186 << (yyvsp[-4].Ty)->getNewTy() << ' ' << *(yyvsp[-3].Val)->val << ", " << (yyvsp[-1].Ty)->getNewTy() << ' '
4187 << *(yyvsp[0].Val)->val << '\n';
4188 delete (yyvsp[-8].String); delete (yyvsp[-6].Val); delete (yyvsp[-3].Val); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004189 (yyval.String) = 0;
4190 ;}
4191 break;
4192
Reid Spencerc4d96252007-01-13 00:03:30 +00004193 case 259:
Reid Spencerb6673a92007-01-15 02:41:46 +00004194#line 1824 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004195 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004196 std::string Name = getUniqueName((yyvsp[-6].Val)->val, (yyvsp[-7].Ty));
4197 *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Ty)->getNewTy() << ' ' << Name << ", "
4198 << (yyvsp[-4].Ty)->getNewTy() << ' ' << *(yyvsp[-3].Val)->val << " [" << *(yyvsp[-1].String) << " ]\n";
Reid Spencer30d0c582007-01-15 00:26:18 +00004199 delete (yyvsp[-8].String);
Reid Spencerb6673a92007-01-15 02:41:46 +00004200 delete (yyvsp[-6].Val);
4201 delete (yyvsp[-3].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004202 delete (yyvsp[-1].String);
4203 (yyval.String) = 0;
4204 ;}
4205 break;
4206
Reid Spencerc4d96252007-01-13 00:03:30 +00004207 case 260:
Reid Spencerb6673a92007-01-15 02:41:46 +00004208#line 1834 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004209 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004210 std::string Name = getUniqueName((yyvsp[-5].Val)->val, (yyvsp[-6].Ty));
4211 *O << " " << *(yyvsp[-7].String) << ' ' << (yyvsp[-6].Ty)->getNewTy() << ' ' << Name << ", "
4212 << (yyvsp[-3].Ty)->getNewTy() << ' ' << *(yyvsp[-2].Val)->val << "[]\n";
Reid Spencer30d0c582007-01-15 00:26:18 +00004213 delete (yyvsp[-7].String);
Reid Spencerb6673a92007-01-15 02:41:46 +00004214 delete (yyvsp[-5].Val);
4215 delete (yyvsp[-2].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004216 (yyval.String) = 0;
4217 ;}
4218 break;
4219
Reid Spencerc4d96252007-01-13 00:03:30 +00004220 case 261:
Reid Spencerb6673a92007-01-15 02:41:46 +00004221#line 1844 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004222 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004223 const Type* ResTy = getFunctionReturnType((yyvsp[-10].Ty));
Reid Spencer16244f42006-12-01 21:10:07 +00004224 *O << " ";
Reid Spencer319a7302007-01-05 17:20:02 +00004225 if (!(yyvsp[-13].String)->empty()) {
4226 std::string Name = getUniqueName((yyvsp[-13].String), ResTy);
Reid Spencer52402b02007-01-02 05:45:11 +00004227 *O << Name << " = ";
4228 }
Reid Spencerb6673a92007-01-15 02:41:46 +00004229 *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Ty)->getNewTy() << ' ' << *(yyvsp[-9].Val)->val << " (";
Reid Spencer319a7302007-01-05 17:20:02 +00004230 for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) {
Reid Spencerb6673a92007-01-15 02:41:46 +00004231 Value* V = (*(yyvsp[-7].ValList))[i];
4232 *O << *V->val;
Reid Spencer319a7302007-01-05 17:20:02 +00004233 if (i+1 < (yyvsp[-7].ValList)->size())
Reid Spencerf8483652006-12-02 15:16:01 +00004234 *O << ", ";
Reid Spencerb6673a92007-01-15 02:41:46 +00004235 delete V;
Reid Spencerf8483652006-12-02 15:16:01 +00004236 }
Reid Spencerb6673a92007-01-15 02:41:46 +00004237 *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Ty)->getNewTy() << ' ' << *(yyvsp[-3].Val)->val << ' '
4238 << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].Val)->val << '\n';
4239 delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); delete (yyvsp[-9].Val); delete (yyvsp[-7].ValList);
4240 delete (yyvsp[-5].String); delete (yyvsp[-3].Val); delete (yyvsp[-2].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004241 (yyval.String) = 0;
4242 ;}
4243 break;
4244
Reid Spencer319a7302007-01-05 17:20:02 +00004245 case 262:
Reid Spencerb6673a92007-01-15 02:41:46 +00004246#line 1865 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004247 {
4248 *O << " " << *(yyvsp[0].String) << '\n';
4249 delete (yyvsp[0].String);
4250 (yyval.String) = 0;
4251 ;}
4252 break;
4253
4254 case 263:
Reid Spencerb6673a92007-01-15 02:41:46 +00004255#line 1870 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004256 {
4257 *O << " " << *(yyvsp[0].String) << '\n';
4258 delete (yyvsp[0].String);
4259 (yyval.String) = 0;
4260 ;}
4261 break;
4262
4263 case 264:
Reid Spencerb6673a92007-01-15 02:41:46 +00004264#line 1876 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004265 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004266 *(yyvsp[-5].String) += " " + (yyvsp[-4].Ty)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Ty)->getNewTy() + " " +
4267 *(yyvsp[0].Val)->val;
4268 delete (yyvsp[-3].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004269 (yyval.String) = (yyvsp[-5].String);
4270 ;}
4271 break;
4272
Reid Spencerc4d96252007-01-13 00:03:30 +00004273 case 265:
Reid Spencerb6673a92007-01-15 02:41:46 +00004274#line 1882 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004275 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004276 (yyvsp[-3].String)->insert(0, (yyvsp[-4].Ty)->getNewTy() + " " );
4277 *(yyvsp[-3].String) += ", " + (yyvsp[-1].Ty)->getNewTy() + " " + *(yyvsp[0].Val)->val;
4278 delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004279 (yyval.String) = (yyvsp[-3].String);
4280 ;}
4281 break;
4282
Reid Spencerc4d96252007-01-13 00:03:30 +00004283 case 266:
Reid Spencerb6673a92007-01-15 02:41:46 +00004284#line 1890 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004285 {
4286 if (!(yyvsp[-1].String)->empty()) {
4287 // Get a unique name for this value, based on its type.
Reid Spencerb6673a92007-01-15 02:41:46 +00004288 std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Val)->type);
Reid Spencer319a7302007-01-05 17:20:02 +00004289 *(yyvsp[-1].String) = Name + " = ";
4290 if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
4291 // don't actually delete it, just comment it out
4292 (yyvsp[-1].String)->insert(0, "; USELSS BITCAST: ");
Reid Spencerf5626a32007-01-01 01:20:41 +00004293 delete deleteUselessCastName;
Reid Spencerf5626a32007-01-01 01:20:41 +00004294 }
4295 }
Reid Spencerb6673a92007-01-15 02:41:46 +00004296 *(yyvsp[-1].String) += *(yyvsp[0].Val)->val;
4297 delete (yyvsp[0].Val);
Reid Spencerf5626a32007-01-01 01:20:41 +00004298 deleteUselessCastFlag = false;
Reid Spencer319a7302007-01-05 17:20:02 +00004299 (yyval.String) = (yyvsp[-1].String);
4300 ;}
4301 break;
4302
Reid Spencerc4d96252007-01-13 00:03:30 +00004303 case 267:
Reid Spencerb6673a92007-01-15 02:41:46 +00004304#line 1908 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004305 { // Used for PHI nodes
Reid Spencerb6673a92007-01-15 02:41:46 +00004306 std::string Name = getUniqueName((yyvsp[-3].Val)->val, (yyvsp[-5].Ty));
4307 Name.insert(0, (yyvsp[-5].Ty)->getNewTy() + "[");
4308 Name += "," + *(yyvsp[-1].Val)->val + "]";
4309 (yyval.Val) = new Value;
4310 (yyval.Val)->val = new std::string(Name);
4311 (yyval.Val)->type = (yyvsp[-5].Ty);
4312 delete (yyvsp[-3].Val); delete (yyvsp[-1].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004313 ;}
4314 break;
4315
Reid Spencerc4d96252007-01-13 00:03:30 +00004316 case 268:
Reid Spencerb6673a92007-01-15 02:41:46 +00004317#line 1917 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004318 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004319 std::string Name = getUniqueName((yyvsp[-3].Val)->val, (yyvsp[-6].Val)->type);
4320 *(yyvsp[-6].Val)->val += ", [" + Name + "," + *(yyvsp[-1].Val)->val + "]";
4321 delete (yyvsp[-3].Val);
4322 delete (yyvsp[-1].Val);
4323 (yyval.Val) = (yyvsp[-6].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004324 ;}
4325 break;
4326
Reid Spencerc4d96252007-01-13 00:03:30 +00004327 case 269:
Reid Spencerb6673a92007-01-15 02:41:46 +00004328#line 1927 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004329 {
4330 (yyval.ValList) = new ValueList();
Reid Spencerb6673a92007-01-15 02:41:46 +00004331 (yyval.ValList)->push_back((yyvsp[0].Val));
Reid Spencer319a7302007-01-05 17:20:02 +00004332 ;}
4333 break;
4334
Reid Spencerc4d96252007-01-13 00:03:30 +00004335 case 270:
Reid Spencerb6673a92007-01-15 02:41:46 +00004336#line 1931 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004337 {
4338 (yyval.ValList) = (yyvsp[-2].ValList);
Reid Spencerb6673a92007-01-15 02:41:46 +00004339 (yyval.ValList)->push_back((yyvsp[0].Val));
Reid Spencer319a7302007-01-05 17:20:02 +00004340 ;}
4341 break;
4342
Reid Spencerc4d96252007-01-13 00:03:30 +00004343 case 271:
Reid Spencerb6673a92007-01-15 02:41:46 +00004344#line 1938 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004345 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4346 break;
4347
Reid Spencerc4d96252007-01-13 00:03:30 +00004348 case 272:
Reid Spencerb6673a92007-01-15 02:41:46 +00004349#line 1939 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004350 { (yyval.ValList) = new ValueList(); ;}
4351 break;
4352
Reid Spencerc4d96252007-01-13 00:03:30 +00004353 case 273:
Reid Spencerb6673a92007-01-15 02:41:46 +00004354#line 1943 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004355 {
4356 *(yyvsp[-1].String) += " " + *(yyvsp[0].String);
4357 delete (yyvsp[0].String);
4358 (yyval.String) = (yyvsp[-1].String);
4359 ;}
4360 break;
4361
Reid Spencerc4d96252007-01-13 00:03:30 +00004362 case 275:
Reid Spencerb6673a92007-01-15 02:41:46 +00004363#line 1951 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004364 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004365 const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Ty));
4366 std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty));
4367 std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty));
4368 (yyval.Val) = (yyvsp[-2].Val);
4369 delete (yyval.Val)->val;
4370 (yyval.Val)->val = new std::string(op);
4371 *(yyval.Val)->val += " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + ", " + Name2;
4372 (yyval.Val)->type = (yyvsp[-3].Ty);
4373 delete (yyvsp[-4].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004374 ;}
4375 break;
4376
Reid Spencerc4d96252007-01-13 00:03:30 +00004377 case 276:
Reid Spencerb6673a92007-01-15 02:41:46 +00004378#line 1962 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004379 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004380 std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty));
4381 std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty));
4382 *(yyvsp[-4].String) += " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + ", " + Name2;
4383 (yyval.Val) = (yyvsp[-2].Val);
4384 delete (yyval.Val)->val;
4385 (yyval.Val)->val = (yyvsp[-4].String);
4386 (yyval.Val)->type = (yyvsp[-3].Ty);
4387 delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004388 ;}
4389 break;
4390
Reid Spencerc4d96252007-01-13 00:03:30 +00004391 case 277:
Reid Spencerb6673a92007-01-15 02:41:46 +00004392#line 1972 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004393 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004394 std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty));
4395 std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty));
4396 *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Ty));
4397 *(yyvsp[-4].String) += " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + ", " + Name2;
4398 (yyval.Val) = (yyvsp[-2].Val);
4399 delete (yyval.Val)->val;
4400 (yyval.Val)->val = (yyvsp[-4].String);
4401 (yyval.Val)->type = Type::get("i1",BoolTy);
4402 delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004403 ;}
4404 break;
4405
Reid Spencer319a7302007-01-05 17:20:02 +00004406 case 278:
Reid Spencerb6673a92007-01-15 02:41:46 +00004407#line 1983 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004408 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004409 std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty));
4410 std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty));
4411 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + "," + Name2;
4412 (yyval.Val) = (yyvsp[-2].Val);
4413 delete (yyval.Val)->val;
4414 (yyval.Val)->val = (yyvsp[-5].String);
4415 (yyval.Val)->type = Type::get("i1",BoolTy);
4416 delete (yyvsp[-4].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004417 ;}
4418 break;
4419
4420 case 279:
Reid Spencerb6673a92007-01-15 02:41:46 +00004421#line 1993 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004422 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004423 std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty));
4424 std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty));
4425 *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + "," + Name2;
4426 (yyval.Val) = (yyvsp[-2].Val);
4427 delete (yyval.Val)->val;
4428 (yyval.Val)->val = (yyvsp[-5].String);
4429 (yyval.Val)->type = Type::get("i1",BoolTy);
4430 delete (yyvsp[-4].String); delete (yyvsp[0].Val);
Reid Spencerc4d96252007-01-13 00:03:30 +00004431 ;}
4432 break;
4433
4434 case 280:
Reid Spencerb6673a92007-01-15 02:41:46 +00004435#line 2003 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004436 {
4437 const char* shiftop = (yyvsp[-3].String)->c_str();
4438 if (*(yyvsp[-3].String) == "shr")
Reid Spencerb6673a92007-01-15 02:41:46 +00004439 shiftop = ((yyvsp[-2].Val)->type->isUnsigned()) ? "lshr" : "ashr";
Reid Spencer30d0c582007-01-15 00:26:18 +00004440 std::string *val = new std::string(shiftop);
Reid Spencerb6673a92007-01-15 02:41:46 +00004441 *val += " " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val;
4442 (yyval.Val) = (yyvsp[-2].Val);
4443 delete (yyval.Val)->val;
4444 (yyval.Val)->val = val;
4445 delete (yyvsp[-3].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004446 ;}
4447 break;
4448
Reid Spencerc4d96252007-01-13 00:03:30 +00004449 case 281:
Reid Spencerb6673a92007-01-15 02:41:46 +00004450#line 2014 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004451 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004452 std::string source = *(yyvsp[-2].Val)->val;
4453 const Type* SrcTy = (yyvsp[-2].Val)->type->resolve();
4454 const Type* DstTy = (yyvsp[0].Ty)->resolve();
4455 (yyval.Val) = (yyvsp[-2].Val);
4456 delete (yyval.Val)->val;
4457 (yyval.Val)->val = new std::string();
4458 (yyval.Val)->type = DstTy;
Reid Spencer319a7302007-01-05 17:20:02 +00004459 if (*(yyvsp[-3].String) == "cast") {
Reid Spencerb6673a92007-01-15 02:41:46 +00004460 *(yyval.Val)->val += getCastUpgrade(source, SrcTy, DstTy, false);
Reid Spencera50d5962006-12-02 04:11:07 +00004461 } else {
Reid Spencerb6673a92007-01-15 02:41:46 +00004462 *(yyval.Val)->val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy();
Reid Spencer280d8012006-12-01 23:40:53 +00004463 }
Reid Spencerf5626a32007-01-01 01:20:41 +00004464 // Check to see if this is a useless cast of a value to the same name
4465 // and the same type. Such casts will probably cause redefinition errors
4466 // when assembled and perform no code gen action so just remove them.
Reid Spencer319a7302007-01-05 17:20:02 +00004467 if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast")
4468 if (SrcTy->isInteger() && DstTy->isInteger() &&
4469 SrcTy->getBitWidth() == DstTy->getBitWidth()) {
Reid Spencerf5626a32007-01-01 01:20:41 +00004470 deleteUselessCastFlag = true; // Flag the "Inst" rule
Reid Spencerb6673a92007-01-15 02:41:46 +00004471 deleteUselessCastName = new std::string(*(yyvsp[-2].Val)->val); // save the name
Reid Spencerf5626a32007-01-01 01:20:41 +00004472 size_t pos = deleteUselessCastName->find_first_of("%\"",0);
4473 if (pos != std::string::npos) {
4474 // remove the type portion before val
4475 deleteUselessCastName->erase(0, pos);
4476 }
4477 }
Reid Spencer30d0c582007-01-15 00:26:18 +00004478 delete (yyvsp[-3].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004479 delete (yyvsp[-1].String);
4480 ;}
4481 break;
4482
Reid Spencerc4d96252007-01-13 00:03:30 +00004483 case 282:
Reid Spencerb6673a92007-01-15 02:41:46 +00004484#line 2044 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004485 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004486 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Val)->val + ", " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val;
4487 (yyval.Val) = (yyvsp[-4].Val);
4488 delete (yyval.Val)->val;
4489 (yyval.Val)->val = (yyvsp[-5].String);
4490 (yyval.Val)->type = (yyvsp[-2].Val)->type;
4491 delete (yyvsp[-2].Val);
4492 delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004493 ;}
4494 break;
4495
Reid Spencerc4d96252007-01-13 00:03:30 +00004496 case 283:
Reid Spencerb6673a92007-01-15 02:41:46 +00004497#line 2053 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004498 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004499 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Val)->val + ", " + (yyvsp[0].Ty)->getNewTy();
4500 (yyval.Val) = (yyvsp[-2].Val);
4501 delete (yyval.Val)->val;
4502 (yyval.Val)->val = (yyvsp[-3].String);
4503 (yyval.Val)->type = (yyvsp[0].Ty);
Reid Spencer319a7302007-01-05 17:20:02 +00004504 ;}
4505 break;
4506
Reid Spencerc4d96252007-01-13 00:03:30 +00004507 case 284:
Reid Spencerb6673a92007-01-15 02:41:46 +00004508#line 2060 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004509 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004510 *(yyvsp[-3].String) += " " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val;
4511 (yyval.Val) = (yyvsp[-2].Val);
4512 delete (yyval.Val)->val;
4513 (yyval.Val)->val = (yyvsp[-3].String);
4514 (yyval.Val)->type = (yyval.Val)->type->resolve();
4515 (yyval.Val)->type = (yyval.Val)->type->getElementType();
4516 delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004517 ;}
4518 break;
4519
4520 case 285:
Reid Spencerb6673a92007-01-15 02:41:46 +00004521#line 2069 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004522 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004523 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Val)->val + ", " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val;
4524 (yyval.Val) = (yyvsp[-4].Val);
4525 delete (yyval.Val)->val;
4526 (yyval.Val)->val = (yyvsp[-5].String);
4527 delete (yyvsp[-2].Val); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004528 ;}
4529 break;
4530
4531 case 286:
Reid Spencerb6673a92007-01-15 02:41:46 +00004532#line 2076 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004533 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004534 *(yyvsp[-5].String) += " " + *(yyvsp[-4].Val)->val + ", " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val;
4535 (yyval.Val) = (yyvsp[-4].Val);
4536 delete (yyval.Val)->val;
4537 (yyval.Val)->val = (yyvsp[-5].String);
4538 delete (yyvsp[-2].Val); delete (yyvsp[0].Val);
Reid Spencerc4d96252007-01-13 00:03:30 +00004539 ;}
4540 break;
4541
4542 case 287:
Reid Spencerb6673a92007-01-15 02:41:46 +00004543#line 2083 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004544 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004545 *(yyvsp[-1].String) += " " + *(yyvsp[0].Val)->val;
4546 (yyval.Val) = (yyvsp[0].Val);
4547 delete (yyvsp[0].Val)->val;
4548 (yyval.Val)->val = (yyvsp[-1].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004549 ;}
4550 break;
4551
Reid Spencerc4d96252007-01-13 00:03:30 +00004552 case 288:
Reid Spencerb6673a92007-01-15 02:41:46 +00004553#line 2089 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004554 {
Reid Spencer12969882007-01-07 08:07:39 +00004555 // map llvm.isunordered to "fcmp uno"
Reid Spencerb6673a92007-01-15 02:41:46 +00004556 (yyval.Val) = new Value;
4557 if (*(yyvsp[-3].Val)->val == "%llvm.isunordered.f32" ||
4558 *(yyvsp[-3].Val)->val == "%llvm.isunordered.f64") {
4559 (yyval.Val)->val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0]->val + ", ");
Reid Spencer30d0c582007-01-15 00:26:18 +00004560 size_t pos = (*(yyvsp[-1].ValList))[1]->val->find(' ');
Reid Spencer12969882007-01-07 08:07:39 +00004561 assert(pos != std::string::npos && "no space?");
Reid Spencerb6673a92007-01-15 02:41:46 +00004562 *(yyval.Val)->val += (*(yyvsp[-1].ValList))[1]->val->substr(pos+1);
4563 (yyval.Val)->type = Type::get("i1", BoolTy);
Reid Spencer12969882007-01-07 08:07:39 +00004564 } else {
Reid Spencerc4d96252007-01-13 00:03:30 +00004565 static unsigned upgradeCount = 1;
Reid Spencerb6673a92007-01-15 02:41:46 +00004566 if (*(yyvsp[-3].Val)->val == "%llvm.va_start" || *(yyvsp[-3].Val)->val == "%llvm.va_end") {
Reid Spencerf6e54592007-01-13 00:23:06 +00004567 if (!(yyvsp[-1].ValList)->empty()) {
4568 std::string name("%va_upgrade");
4569 name += llvm::utostr(upgradeCount++);
Reid Spencer30d0c582007-01-15 00:26:18 +00004570 (yyvsp[-6].String)->insert(0, name + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n ");
4571 *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name;
Reid Spencerb6673a92007-01-15 02:41:46 +00004572 (*(yyvsp[-1].ValList))[0]->type = Type::get("i8", UByteTy)->getPointerType();
Reid Spencerf6e54592007-01-13 00:23:06 +00004573 }
Reid Spencerb6673a92007-01-15 02:41:46 +00004574 } else if (*(yyvsp[-3].Val)->val == "%llvm.va_copy") {
Reid Spencerc4d96252007-01-13 00:03:30 +00004575 std::string name0("%va_upgrade");
4576 name0 += llvm::utostr(upgradeCount++);
4577 std::string name1("%va_upgrade");
4578 name1 += llvm::utostr(upgradeCount++);
Reid Spencer30d0c582007-01-15 00:26:18 +00004579 (yyvsp[-6].String)->insert(0, name0 + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n " +
4580 name1 + " = bitcast " + *(*(yyvsp[-1].ValList))[1]->val + " to i8*\n ");
4581 *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name0;
Reid Spencerb6673a92007-01-15 02:41:46 +00004582 (*(yyvsp[-1].ValList))[0]->type = Type::get("i8", UByteTy)->getPointerType();
Reid Spencer30d0c582007-01-15 00:26:18 +00004583 *(*(yyvsp[-1].ValList))[1]->val = "i8* " + name1;
Reid Spencerb6673a92007-01-15 02:41:46 +00004584 (*(yyvsp[-1].ValList))[0]->type = Type::get("i8", UByteTy)->getPointerType();
Reid Spencerc4d96252007-01-13 00:03:30 +00004585 }
Reid Spencer12969882007-01-07 08:07:39 +00004586 if (!(yyvsp[-5].String)->empty())
4587 *(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
4588 if (!(yyvsp[-6].String)->empty())
4589 *(yyvsp[-6].String) += " ";
Reid Spencerb6673a92007-01-15 02:41:46 +00004590 *(yyvsp[-6].String) += (yyvsp[-4].Ty)->getNewTy() + " " + *(yyvsp[-3].Val)->val + "(";
Reid Spencer12969882007-01-07 08:07:39 +00004591 for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
Reid Spencerb6673a92007-01-15 02:41:46 +00004592 Value* V = (*(yyvsp[-1].ValList))[i];
4593 *(yyvsp[-6].String) += *V->val;
Reid Spencer12969882007-01-07 08:07:39 +00004594 if (i+1 < (yyvsp[-1].ValList)->size())
4595 *(yyvsp[-6].String) += ", ";
Reid Spencerb6673a92007-01-15 02:41:46 +00004596 delete V;
Reid Spencer12969882007-01-07 08:07:39 +00004597 }
4598 *(yyvsp[-6].String) += ")";
Reid Spencerb6673a92007-01-15 02:41:46 +00004599 (yyval.Val) = new Value;
4600 (yyval.Val)->val = (yyvsp[-6].String);
4601 (yyval.Val)->type = getFunctionReturnType((yyvsp[-4].Ty));
Reid Spencerf8483652006-12-02 15:16:01 +00004602 }
Reid Spencerb6673a92007-01-15 02:41:46 +00004603 delete (yyvsp[-5].String); delete (yyvsp[-3].Val); delete (yyvsp[-1].ValList);
Reid Spencer319a7302007-01-05 17:20:02 +00004604 ;}
4605 break;
4606
Reid Spencerc4d96252007-01-13 00:03:30 +00004607 case 290:
Reid Spencerb6673a92007-01-15 02:41:46 +00004608#line 2145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004609 { (yyval.ValList) = (yyvsp[0].ValList); ;}
4610 break;
4611
Reid Spencerc4d96252007-01-13 00:03:30 +00004612 case 291:
Reid Spencerb6673a92007-01-15 02:41:46 +00004613#line 2146 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004614 { (yyval.ValList) = new ValueList(); ;}
4615 break;
4616
Reid Spencerc4d96252007-01-13 00:03:30 +00004617 case 293:
Reid Spencerb6673a92007-01-15 02:41:46 +00004618#line 2151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004619 { (yyval.String) = new std::string(); ;}
4620 break;
4621
Reid Spencerc4d96252007-01-13 00:03:30 +00004622 case 294:
Reid Spencerb6673a92007-01-15 02:41:46 +00004623#line 2154 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004624 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004625 *(yyvsp[-2].String) += " " + (yyvsp[-1].Ty)->getNewTy();
Reid Spencer319a7302007-01-05 17:20:02 +00004626 if (!(yyvsp[0].String)->empty())
4627 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
Reid Spencerb6673a92007-01-15 02:41:46 +00004628 (yyval.Val) = new Value;
4629 (yyval.Val)->val = (yyvsp[-2].String);
4630 (yyval.Val)->type = (yyvsp[-1].Ty)->getPointerType();
Reid Spencer319a7302007-01-05 17:20:02 +00004631 delete (yyvsp[0].String);
4632 ;}
4633 break;
4634
4635 case 295:
Reid Spencerb6673a92007-01-15 02:41:46 +00004636#line 2163 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004637 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004638 std::string Name = getUniqueName((yyvsp[-1].Val)->val, (yyvsp[-2].Ty));
4639 *(yyvsp[-5].String) += " " + (yyvsp[-4].Ty)->getNewTy() + ", " + (yyvsp[-2].Ty)->getNewTy() + " " + Name;
Reid Spencer319a7302007-01-05 17:20:02 +00004640 if (!(yyvsp[0].String)->empty())
4641 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
Reid Spencerb6673a92007-01-15 02:41:46 +00004642 (yyval.Val) = new Value;
4643 (yyval.Val)->val = (yyvsp[-5].String);
4644 (yyval.Val)->type = (yyvsp[-4].Ty)->getPointerType();
4645 delete (yyvsp[-1].Val); delete (yyvsp[0].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004646 ;}
4647 break;
4648
Reid Spencerc4d96252007-01-13 00:03:30 +00004649 case 296:
Reid Spencerb6673a92007-01-15 02:41:46 +00004650#line 2173 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004651 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004652 *(yyvsp[-2].String) += " " + (yyvsp[-1].Ty)->getNewTy();
Reid Spencerc4d96252007-01-13 00:03:30 +00004653 if (!(yyvsp[0].String)->empty())
4654 *(yyvsp[-2].String) += " " + *(yyvsp[0].String);
Reid Spencerb6673a92007-01-15 02:41:46 +00004655 (yyval.Val) = new Value;
4656 (yyval.Val)->val = (yyvsp[-2].String);
4657 (yyval.Val)->type = (yyvsp[-1].Ty)->getPointerType();
Reid Spencerc4d96252007-01-13 00:03:30 +00004658 delete (yyvsp[0].String);
4659 ;}
4660 break;
4661
Reid Spencer609ca3e2007-01-12 20:10:51 +00004662 case 297:
Reid Spencerb6673a92007-01-15 02:41:46 +00004663#line 2182 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004664 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004665 std::string Name = getUniqueName((yyvsp[-1].Val)->val, (yyvsp[-2].Ty));
4666 *(yyvsp[-5].String) += " " + (yyvsp[-4].Ty)->getNewTy() + ", " + (yyvsp[-2].Ty)->getNewTy() + " " + Name;
Reid Spencerc4d96252007-01-13 00:03:30 +00004667 if (!(yyvsp[0].String)->empty())
4668 *(yyvsp[-5].String) += " " + *(yyvsp[0].String);
Reid Spencerb6673a92007-01-15 02:41:46 +00004669 (yyval.Val) = (yyvsp[-1].Val);
4670 delete (yyval.Val)->val;
4671 (yyval.Val)->val = (yyvsp[-5].String);
4672 (yyval.Val)->type = (yyvsp[-4].Ty)->getPointerType();
Reid Spencer30d0c582007-01-15 00:26:18 +00004673 delete (yyvsp[0].String);
Reid Spencerc4d96252007-01-13 00:03:30 +00004674 ;}
4675 break;
4676
4677 case 298:
Reid Spencerb6673a92007-01-15 02:41:46 +00004678#line 2193 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004679 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004680 *(yyvsp[-1].String) += " " + *(yyvsp[0].Val)->val;
4681 (yyval.Val) = (yyvsp[0].Val);
4682 delete (yyvsp[0].Val)->val;
4683 (yyval.Val)->val = (yyvsp[-1].String);
4684 (yyval.Val)->type = Type::get("void", VoidTy);
Reid Spencer319a7302007-01-05 17:20:02 +00004685 ;}
4686 break;
4687
Reid Spencerc4d96252007-01-13 00:03:30 +00004688 case 299:
Reid Spencerb6673a92007-01-15 02:41:46 +00004689#line 2200 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004690 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004691 std::string Name = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-1].Ty));
Reid Spencer319a7302007-01-05 17:20:02 +00004692 if (!(yyvsp[-3].String)->empty())
4693 *(yyvsp[-3].String) += " ";
Reid Spencerb6673a92007-01-15 02:41:46 +00004694 *(yyvsp[-3].String) += *(yyvsp[-2].String) + " " + (yyvsp[-1].Ty)->getNewTy() + " " + Name;
4695 (yyval.Val) = (yyvsp[0].Val);
4696 delete (yyval.Val)->val;
4697 (yyval.Val)->val = (yyvsp[-3].String);
4698 (yyval.Val)->type = (yyvsp[-1].Ty)->getElementType();
Reid Spencer30d0c582007-01-15 00:26:18 +00004699 delete (yyvsp[-2].String);
Reid Spencer319a7302007-01-05 17:20:02 +00004700 ;}
4701 break;
4702
Reid Spencerc4d96252007-01-13 00:03:30 +00004703 case 300:
Reid Spencerb6673a92007-01-15 02:41:46 +00004704#line 2211 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004705 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004706 std::string Name = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-1].Ty));
Reid Spencer319a7302007-01-05 17:20:02 +00004707 if (!(yyvsp[-5].String)->empty())
4708 *(yyvsp[-5].String) += " ";
Reid Spencerb6673a92007-01-15 02:41:46 +00004709 *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Val)->val + ", " + (yyvsp[-1].Ty)->getNewTy() + " " + Name;
4710 (yyval.Val) = (yyvsp[-3].Val);
4711 delete (yyval.Val)->val;
4712 (yyval.Val)->val = (yyvsp[-5].String);
4713 (yyval.Val)->type = Type::get("void", VoidTy);
4714 delete (yyvsp[-4].String); delete (yyvsp[0].Val);
Reid Spencer319a7302007-01-05 17:20:02 +00004715 ;}
4716 break;
4717
Reid Spencerc4d96252007-01-13 00:03:30 +00004718 case 301:
Reid Spencerb6673a92007-01-15 02:41:46 +00004719#line 2222 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004720 {
Reid Spencerb6673a92007-01-15 02:41:46 +00004721 std::string Name = getUniqueName((yyvsp[-1].Val)->val, (yyvsp[-2].Ty));
Reid Spencerf459d392006-12-02 16:19:52 +00004722 // Upgrade the indices
Reid Spencer319a7302007-01-05 17:20:02 +00004723 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
Reid Spencerb6673a92007-01-15 02:41:46 +00004724 Value* V = (*(yyvsp[0].ValList))[i];
4725 if (V->type->isUnsigned() && !V->isConstant() &&
4726 V->type->getBitWidth() < 64) {
4727 *O << " %gep_upgrade" << UniqueNameCounter << " = zext " << *V->val
Reid Spencer71d2ec92006-12-31 06:02:26 +00004728 << " to i64\n";
Reid Spencerb6673a92007-01-15 02:41:46 +00004729 *V->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++);
4730 V->type = Type::get("i64",ULongTy);
Reid Spencerf459d392006-12-02 16:19:52 +00004731 }
4732 }
Reid Spencerb6673a92007-01-15 02:41:46 +00004733 *(yyvsp[-3].String) += " " + (yyvsp[-2].Ty)->getNewTy() + " " + Name;
Reid Spencer319a7302007-01-05 17:20:02 +00004734 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
Reid Spencerb6673a92007-01-15 02:41:46 +00004735 Value* V = (*(yyvsp[0].ValList))[i];
4736 *(yyvsp[-3].String) += ", " + *V->val;
Reid Spencerf8483652006-12-02 15:16:01 +00004737 }
Reid Spencerb6673a92007-01-15 02:41:46 +00004738 (yyval.Val) = (yyvsp[-1].Val);
4739 delete (yyval.Val)->val;
4740 (yyval.Val)->val = (yyvsp[-3].String);
4741 (yyval.Val)->type = getGEPIndexedType((yyvsp[-2].Ty),(yyvsp[0].ValList));
Reid Spencer30d0c582007-01-15 00:26:18 +00004742 for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i)
4743 delete (*(yyvsp[0].ValList))[i];
4744 delete (yyvsp[0].ValList);
Reid Spencer319a7302007-01-05 17:20:02 +00004745 ;}
4746 break;
4747
4748
4749 default: break;
4750 }
4751
4752/* Line 1126 of yacc.c. */
Reid Spencerb6673a92007-01-15 02:41:46 +00004753#line 4754 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00004754
4755 yyvsp -= yylen;
4756 yyssp -= yylen;
4757
Reid Spencer319a7302007-01-05 17:20:02 +00004758
4759 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004760
4761 *++yyvsp = yyval;
4762
4763
Reid Spencer319a7302007-01-05 17:20:02 +00004764 /* Now `shift' the result of the reduction. Determine what state
4765 that goes to, based on the state we popped back to and the rule
4766 number reduced by. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004767
4768 yyn = yyr1[yyn];
4769
Reid Spencer319a7302007-01-05 17:20:02 +00004770 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4771 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00004772 yystate = yytable[yystate];
4773 else
Reid Spencer319a7302007-01-05 17:20:02 +00004774 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencere7c3c602006-11-30 06:36:44 +00004775
4776 goto yynewstate;
4777
4778
Reid Spencer319a7302007-01-05 17:20:02 +00004779/*------------------------------------.
4780| yyerrlab -- here on detecting error |
4781`------------------------------------*/
4782yyerrlab:
4783 /* If not already recovering from an error, report this error. */
4784 if (!yyerrstatus)
Reid Spencere7c3c602006-11-30 06:36:44 +00004785 {
4786 ++yynerrs;
Reid Spencer319a7302007-01-05 17:20:02 +00004787#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00004788 yyn = yypact[yystate];
4789
Reid Spencer319a7302007-01-05 17:20:02 +00004790 if (YYPACT_NINF < yyn && yyn < YYLAST)
Reid Spencere7c3c602006-11-30 06:36:44 +00004791 {
Reid Spencer319a7302007-01-05 17:20:02 +00004792 int yytype = YYTRANSLATE (yychar);
4793 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
4794 YYSIZE_T yysize = yysize0;
4795 YYSIZE_T yysize1;
4796 int yysize_overflow = 0;
4797 char *yymsg = 0;
4798# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
4799 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
4800 int yyx;
Reid Spencere7c3c602006-11-30 06:36:44 +00004801
Reid Spencer319a7302007-01-05 17:20:02 +00004802#if 0
4803 /* This is so xgettext sees the translatable formats that are
4804 constructed on the fly. */
4805 YY_("syntax error, unexpected %s");
4806 YY_("syntax error, unexpected %s, expecting %s");
4807 YY_("syntax error, unexpected %s, expecting %s or %s");
4808 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
4809 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
4810#endif
4811 char *yyfmt;
4812 char const *yyf;
4813 static char const yyunexpected[] = "syntax error, unexpected %s";
4814 static char const yyexpecting[] = ", expecting %s";
4815 static char const yyor[] = " or %s";
4816 char yyformat[sizeof yyunexpected
4817 + sizeof yyexpecting - 1
4818 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
4819 * (sizeof yyor - 1))];
4820 char const *yyprefix = yyexpecting;
4821
4822 /* Start YYX at -YYN if negative to avoid negative indexes in
4823 YYCHECK. */
4824 int yyxbegin = yyn < 0 ? -yyn : 0;
4825
4826 /* Stay within bounds of both yycheck and yytname. */
4827 int yychecklim = YYLAST - yyn;
4828 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4829 int yycount = 1;
4830
4831 yyarg[0] = yytname[yytype];
4832 yyfmt = yystpcpy (yyformat, yyunexpected);
4833
4834 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4835 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4836 {
4837 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
4838 {
4839 yycount = 1;
4840 yysize = yysize0;
4841 yyformat[sizeof yyunexpected - 1] = '\0';
4842 break;
4843 }
4844 yyarg[yycount++] = yytname[yyx];
4845 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
4846 yysize_overflow |= yysize1 < yysize;
4847 yysize = yysize1;
4848 yyfmt = yystpcpy (yyfmt, yyprefix);
4849 yyprefix = yyor;
4850 }
4851
4852 yyf = YY_(yyformat);
4853 yysize1 = yysize + yystrlen (yyf);
4854 yysize_overflow |= yysize1 < yysize;
4855 yysize = yysize1;
4856
4857 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
4858 yymsg = (char *) YYSTACK_ALLOC (yysize);
4859 if (yymsg)
Reid Spencere7c3c602006-11-30 06:36:44 +00004860 {
Reid Spencer319a7302007-01-05 17:20:02 +00004861 /* Avoid sprintf, as that infringes on the user's name space.
4862 Don't have undefined behavior even if the translation
4863 produced a string with the wrong number of "%s"s. */
4864 char *yyp = yymsg;
4865 int yyi = 0;
4866 while ((*yyp = *yyf))
Reid Spencere7c3c602006-11-30 06:36:44 +00004867 {
Reid Spencer319a7302007-01-05 17:20:02 +00004868 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
4869 {
4870 yyp += yytnamerr (yyp, yyarg[yyi++]);
4871 yyf += 2;
4872 }
4873 else
4874 {
4875 yyp++;
4876 yyf++;
4877 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004878 }
Reid Spencer319a7302007-01-05 17:20:02 +00004879 yyerror (yymsg);
4880 YYSTACK_FREE (yymsg);
Reid Spencere7c3c602006-11-30 06:36:44 +00004881 }
4882 else
Reid Spencer319a7302007-01-05 17:20:02 +00004883 {
4884 yyerror (YY_("syntax error"));
4885 goto yyexhaustedlab;
4886 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004887 }
4888 else
4889#endif /* YYERROR_VERBOSE */
Reid Spencer319a7302007-01-05 17:20:02 +00004890 yyerror (YY_("syntax error"));
Reid Spencere7c3c602006-11-30 06:36:44 +00004891 }
4892
Reid Spencer319a7302007-01-05 17:20:02 +00004893
Reid Spencere7c3c602006-11-30 06:36:44 +00004894
4895 if (yyerrstatus == 3)
4896 {
Reid Spencer319a7302007-01-05 17:20:02 +00004897 /* If just tried and failed to reuse look-ahead token after an
4898 error, discard it. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004899
Reid Spencer319a7302007-01-05 17:20:02 +00004900 if (yychar <= YYEOF)
4901 {
4902 /* Return failure if at end of input. */
4903 if (yychar == YYEOF)
4904 YYABORT;
4905 }
4906 else
4907 {
4908 yydestruct ("Error: discarding", yytoken, &yylval);
4909 yychar = YYEMPTY;
4910 }
4911 }
4912
4913 /* Else will try to reuse look-ahead token after shifting the error
4914 token. */
4915 goto yyerrlab1;
4916
4917
4918/*---------------------------------------------------.
4919| yyerrorlab -- error raised explicitly by YYERROR. |
4920`---------------------------------------------------*/
4921yyerrorlab:
4922
4923 /* Pacify compilers like GCC when the user code never invokes
4924 YYERROR and the label yyerrorlab therefore never appears in user
4925 code. */
4926 if (0)
4927 goto yyerrorlab;
4928
4929yyvsp -= yylen;
4930 yyssp -= yylen;
4931 yystate = *yyssp;
4932 goto yyerrlab1;
4933
4934
4935/*-------------------------------------------------------------.
4936| yyerrlab1 -- common code for both syntax error and YYERROR. |
4937`-------------------------------------------------------------*/
4938yyerrlab1:
4939 yyerrstatus = 3; /* Each real token shifted decrements this. */
4940
4941 for (;;)
4942 {
4943 yyn = yypact[yystate];
4944 if (yyn != YYPACT_NINF)
4945 {
4946 yyn += YYTERROR;
4947 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4948 {
4949 yyn = yytable[yyn];
4950 if (0 < yyn)
4951 break;
4952 }
4953 }
4954
4955 /* Pop the current state because it cannot handle the error token. */
4956 if (yyssp == yyss)
Reid Spencere7c3c602006-11-30 06:36:44 +00004957 YYABORT;
4958
4959
Reid Spencer319a7302007-01-05 17:20:02 +00004960 yydestruct ("Error: popping", yystos[yystate], yyvsp);
4961 YYPOPSTACK;
4962 yystate = *yyssp;
4963 YY_STACK_PRINT (yyss, yyssp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004964 }
4965
4966 if (yyn == YYFINAL)
4967 YYACCEPT;
4968
4969 *++yyvsp = yylval;
Reid Spencer319a7302007-01-05 17:20:02 +00004970
4971
4972 /* Shift the error token. */
4973 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencere7c3c602006-11-30 06:36:44 +00004974
4975 yystate = yyn;
4976 goto yynewstate;
4977
Chris Lattner37e01c52007-01-04 18:46:42 +00004978
Reid Spencer319a7302007-01-05 17:20:02 +00004979/*-------------------------------------.
4980| yyacceptlab -- YYACCEPT comes here. |
4981`-------------------------------------*/
4982yyacceptlab:
4983 yyresult = 0;
4984 goto yyreturn;
4985
4986/*-----------------------------------.
4987| yyabortlab -- YYABORT comes here. |
4988`-----------------------------------*/
4989yyabortlab:
4990 yyresult = 1;
4991 goto yyreturn;
4992
4993#ifndef yyoverflow
4994/*-------------------------------------------------.
4995| yyexhaustedlab -- memory exhaustion comes here. |
4996`-------------------------------------------------*/
4997yyexhaustedlab:
4998 yyerror (YY_("memory exhausted"));
4999 yyresult = 2;
5000 /* Fall through. */
Chris Lattner37e01c52007-01-04 18:46:42 +00005001#endif
Reid Spencer319a7302007-01-05 17:20:02 +00005002
5003yyreturn:
5004 if (yychar != YYEOF && yychar != YYEMPTY)
5005 yydestruct ("Cleanup: discarding lookahead",
5006 yytoken, &yylval);
5007 while (yyssp != yyss)
5008 {
5009 yydestruct ("Cleanup: popping",
5010 yystos[*yyssp], yyvsp);
5011 YYPOPSTACK;
Chris Lattner37e01c52007-01-04 18:46:42 +00005012 }
Reid Spencer319a7302007-01-05 17:20:02 +00005013#ifndef yyoverflow
5014 if (yyss != yyssa)
5015 YYSTACK_FREE (yyss);
5016#endif
5017 return yyresult;
Reid Spencere7c3c602006-11-30 06:36:44 +00005018}
Reid Spencer319a7302007-01-05 17:20:02 +00005019
5020
Reid Spencerb6673a92007-01-15 02:41:46 +00005021#line 2249 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencere7c3c602006-11-30 06:36:44 +00005022
5023
5024int yyerror(const char *ErrorMsg) {
5025 std::string where
5026 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5027 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
Reid Spencer319a7302007-01-05 17:20:02 +00005028 std::string errMsg = where + "error: " + std::string(ErrorMsg) +
5029 " while reading ";
Reid Spencere7c3c602006-11-30 06:36:44 +00005030 if (yychar == YYEMPTY || yychar == 0)
5031 errMsg += "end-of-file.";
5032 else
5033 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
Reid Spencer71d2ec92006-12-31 06:02:26 +00005034 std::cerr << "llvm-upgrade: " << errMsg << '\n';
Chris Lattner37e01c52007-01-04 18:46:42 +00005035 *O << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +00005036 exit(1);
5037}
Reid Spencer319a7302007-01-05 17:20:02 +00005038
Reid Spencer30d0c582007-01-15 00:26:18 +00005039void warning(const std::string& ErrorMsg) {
Reid Spencer319a7302007-01-05 17:20:02 +00005040 std::string where
5041 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5042 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
5043 std::string errMsg = where + "warning: " + std::string(ErrorMsg) +
5044 " while reading ";
5045 if (yychar == YYEMPTY || yychar == 0)
5046 errMsg += "end-of-file.";
5047 else
5048 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
5049 std::cerr << "llvm-upgrade: " << errMsg << '\n';
5050}
5051