blob: b65ac101d2f8852eee7c63570f6ad9042ade7f20 [file] [log] [blame]
Jeff Cohenac2dca92007-01-21 19:30:52 +00001/* A Bison parser, made from /usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y, by GNU bison 1.75. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002
Reid Spencer319a7302007-01-05 17:20:02 +00003/* Skeleton parser for Yacc-like parsing with Bison,
Jeff Cohenac2dca92007-01-21 19:30:52 +00004 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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
Jeff Cohenac2dca92007-01-21 19:30:52 +000018 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
Reid Spencer319a7302007-01-05 17:20:02 +000020
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. */
Jeff Cohenac2dca92007-01-21 19:30:52 +000037#define YYBISON 1
Reid Spencer319a7302007-01-05 17:20:02 +000038
39/* Pure parsers. */
Jeff Cohenac2dca92007-01-21 19:30:52 +000040#define YYPURE 0
Reid Spencer319a7302007-01-05 17:20:02 +000041
42/* Using locations. */
43#define YYLSP_NEEDED 0
44
Jeff Cohenac2dca92007-01-21 19:30:52 +000045/* If NAME_PREFIX is specified substitute the variables and functions
46 names. */
Reid Spencere7c3c602006-11-30 06:36:44 +000047#define yyparse Upgradeparse
Reid Spencer319a7302007-01-05 17:20:02 +000048#define yylex Upgradelex
Reid Spencere7c3c602006-11-30 06:36:44 +000049#define yyerror Upgradeerror
Reid Spencer319a7302007-01-05 17:20:02 +000050#define yylval Upgradelval
51#define yychar Upgradechar
Reid Spencere7c3c602006-11-30 06:36:44 +000052#define yydebug Upgradedebug
53#define yynerrs Upgradenerrs
54
Reid Spencere7c3c602006-11-30 06:36:44 +000055
Reid Spencer319a7302007-01-05 17:20:02 +000056/* Tokens. */
57#ifndef YYTOKENTYPE
58# define YYTOKENTYPE
59 /* Put the tokens into the symbol table, so that GDB and other debuggers
60 know about them. */
61 enum yytokentype {
62 VOID = 258,
63 BOOL = 259,
64 SBYTE = 260,
65 UBYTE = 261,
66 SHORT = 262,
67 USHORT = 263,
68 INT = 264,
69 UINT = 265,
70 LONG = 266,
71 ULONG = 267,
72 FLOAT = 268,
73 DOUBLE = 269,
74 LABEL = 270,
75 OPAQUE = 271,
76 ESINT64VAL = 272,
77 EUINT64VAL = 273,
78 SINTVAL = 274,
79 UINTVAL = 275,
80 FPVAL = 276,
81 NULL_TOK = 277,
82 UNDEF = 278,
83 ZEROINITIALIZER = 279,
84 TRUETOK = 280,
85 FALSETOK = 281,
86 TYPE = 282,
87 VAR_ID = 283,
88 LABELSTR = 284,
89 STRINGCONSTANT = 285,
90 IMPLEMENTATION = 286,
91 BEGINTOK = 287,
92 ENDTOK = 288,
93 DECLARE = 289,
94 GLOBAL = 290,
95 CONSTANT = 291,
96 SECTION = 292,
97 VOLATILE = 293,
98 TO = 294,
99 DOTDOTDOT = 295,
100 CONST = 296,
101 INTERNAL = 297,
102 LINKONCE = 298,
103 WEAK = 299,
104 DLLIMPORT = 300,
105 DLLEXPORT = 301,
106 EXTERN_WEAK = 302,
107 APPENDING = 303,
Reid Spencerc4d96252007-01-13 00:03:30 +0000108 EXTERNAL = 304,
109 TARGET = 305,
110 TRIPLE = 306,
111 ENDIAN = 307,
112 POINTERSIZE = 308,
113 LITTLE = 309,
114 BIG = 310,
115 ALIGN = 311,
116 UNINITIALIZED = 312,
117 DEPLIBS = 313,
118 CALL = 314,
119 TAIL = 315,
120 ASM_TOK = 316,
121 MODULE = 317,
122 SIDEEFFECT = 318,
123 CC_TOK = 319,
124 CCC_TOK = 320,
125 CSRETCC_TOK = 321,
126 FASTCC_TOK = 322,
127 COLDCC_TOK = 323,
128 X86_STDCALLCC_TOK = 324,
129 X86_FASTCALLCC_TOK = 325,
130 DATALAYOUT = 326,
131 RET = 327,
132 BR = 328,
133 SWITCH = 329,
134 INVOKE = 330,
135 EXCEPT = 331,
136 UNWIND = 332,
137 UNREACHABLE = 333,
138 ADD = 334,
139 SUB = 335,
140 MUL = 336,
141 DIV = 337,
142 UDIV = 338,
143 SDIV = 339,
144 FDIV = 340,
145 REM = 341,
146 UREM = 342,
147 SREM = 343,
148 FREM = 344,
149 AND = 345,
150 OR = 346,
151 XOR = 347,
152 SETLE = 348,
153 SETGE = 349,
154 SETLT = 350,
155 SETGT = 351,
156 SETEQ = 352,
157 SETNE = 353,
158 ICMP = 354,
159 FCMP = 355,
160 EQ = 356,
161 NE = 357,
162 SLT = 358,
163 SGT = 359,
164 SLE = 360,
165 SGE = 361,
166 OEQ = 362,
167 ONE = 363,
168 OLT = 364,
169 OGT = 365,
170 OLE = 366,
171 OGE = 367,
172 ORD = 368,
173 UNO = 369,
174 UEQ = 370,
175 UNE = 371,
176 ULT = 372,
177 UGT = 373,
178 ULE = 374,
179 UGE = 375,
180 MALLOC = 376,
181 ALLOCA = 377,
182 FREE = 378,
183 LOAD = 379,
184 STORE = 380,
185 GETELEMENTPTR = 381,
186 PHI_TOK = 382,
187 SELECT = 383,
188 SHL = 384,
189 SHR = 385,
190 ASHR = 386,
191 LSHR = 387,
192 VAARG = 388,
193 EXTRACTELEMENT = 389,
194 INSERTELEMENT = 390,
195 SHUFFLEVECTOR = 391,
196 CAST = 392,
197 TRUNC = 393,
198 ZEXT = 394,
199 SEXT = 395,
200 FPTRUNC = 396,
201 FPEXT = 397,
202 FPTOUI = 398,
203 FPTOSI = 399,
204 UITOFP = 400,
205 SITOFP = 401,
206 PTRTOINT = 402,
207 INTTOPTR = 403,
208 BITCAST = 404
Reid Spencer319a7302007-01-05 17:20:02 +0000209 };
210#endif
Reid Spencer319a7302007-01-05 17:20:02 +0000211#define VOID 258
212#define BOOL 259
213#define SBYTE 260
214#define UBYTE 261
215#define SHORT 262
216#define USHORT 263
217#define INT 264
218#define UINT 265
219#define LONG 266
220#define ULONG 267
221#define FLOAT 268
222#define DOUBLE 269
223#define LABEL 270
224#define OPAQUE 271
225#define ESINT64VAL 272
226#define EUINT64VAL 273
227#define SINTVAL 274
228#define UINTVAL 275
229#define FPVAL 276
230#define NULL_TOK 277
231#define UNDEF 278
232#define ZEROINITIALIZER 279
233#define TRUETOK 280
234#define FALSETOK 281
235#define TYPE 282
236#define VAR_ID 283
237#define LABELSTR 284
238#define STRINGCONSTANT 285
239#define IMPLEMENTATION 286
240#define BEGINTOK 287
241#define ENDTOK 288
242#define DECLARE 289
243#define GLOBAL 290
244#define CONSTANT 291
245#define SECTION 292
246#define VOLATILE 293
247#define TO 294
248#define DOTDOTDOT 295
249#define CONST 296
250#define INTERNAL 297
251#define LINKONCE 298
252#define WEAK 299
253#define DLLIMPORT 300
254#define DLLEXPORT 301
255#define EXTERN_WEAK 302
256#define APPENDING 303
Reid Spencerc4d96252007-01-13 00:03:30 +0000257#define EXTERNAL 304
258#define TARGET 305
259#define TRIPLE 306
260#define ENDIAN 307
261#define POINTERSIZE 308
262#define LITTLE 309
263#define BIG 310
264#define ALIGN 311
265#define UNINITIALIZED 312
266#define DEPLIBS 313
267#define CALL 314
268#define TAIL 315
269#define ASM_TOK 316
270#define MODULE 317
271#define SIDEEFFECT 318
272#define CC_TOK 319
273#define CCC_TOK 320
274#define CSRETCC_TOK 321
275#define FASTCC_TOK 322
276#define COLDCC_TOK 323
277#define X86_STDCALLCC_TOK 324
278#define X86_FASTCALLCC_TOK 325
279#define DATALAYOUT 326
280#define RET 327
281#define BR 328
282#define SWITCH 329
283#define INVOKE 330
284#define EXCEPT 331
285#define UNWIND 332
286#define UNREACHABLE 333
287#define ADD 334
288#define SUB 335
289#define MUL 336
290#define DIV 337
291#define UDIV 338
292#define SDIV 339
293#define FDIV 340
294#define REM 341
295#define UREM 342
296#define SREM 343
297#define FREM 344
298#define AND 345
299#define OR 346
300#define XOR 347
301#define SETLE 348
302#define SETGE 349
303#define SETLT 350
304#define SETGT 351
305#define SETEQ 352
306#define SETNE 353
307#define ICMP 354
308#define FCMP 355
309#define EQ 356
310#define NE 357
311#define SLT 358
312#define SGT 359
313#define SLE 360
314#define SGE 361
315#define OEQ 362
316#define ONE 363
317#define OLT 364
318#define OGT 365
319#define OLE 366
320#define OGE 367
321#define ORD 368
322#define UNO 369
323#define UEQ 370
324#define UNE 371
325#define ULT 372
326#define UGT 373
327#define ULE 374
328#define UGE 375
329#define MALLOC 376
330#define ALLOCA 377
331#define FREE 378
332#define LOAD 379
333#define STORE 380
334#define GETELEMENTPTR 381
335#define PHI_TOK 382
336#define SELECT 383
337#define SHL 384
338#define SHR 385
339#define ASHR 386
340#define LSHR 387
341#define VAARG 388
342#define EXTRACTELEMENT 389
343#define INSERTELEMENT 390
344#define SHUFFLEVECTOR 391
345#define CAST 392
346#define TRUNC 393
347#define ZEXT 394
348#define SEXT 395
349#define FPTRUNC 396
350#define FPEXT 397
351#define FPTOUI 398
352#define FPTOSI 399
353#define UITOFP 400
354#define SITOFP 401
355#define PTRTOINT 402
356#define INTTOPTR 403
357#define BITCAST 404
Reid Spencer319a7302007-01-05 17:20:02 +0000358
359
360
361
362/* Copy the first part of user declarations. */
Jeff Cohenac2dca92007-01-21 19:30:52 +0000363#line 14 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +0000364
365#include "UpgradeInternals.h"
Reid Spencere7c3c602006-11-30 06:36:44 +0000366#include <algorithm>
Reid Spencera50d5962006-12-02 04:11:07 +0000367#include <map>
Reid Spencere7c3c602006-11-30 06:36:44 +0000368#include <utility>
369#include <iostream>
370
Reid Spencere77e35e2006-12-01 20:26:20 +0000371#define YYERROR_VERBOSE 1
Reid Spencer96839be2006-11-30 16:50:26 +0000372#define YYINCLUDED_STDLIB_H
Reid Spencere77e35e2006-12-01 20:26:20 +0000373#define YYDEBUG 1
Reid Spencere7c3c602006-11-30 06:36:44 +0000374
375int yylex(); // declaration" of xxx warnings.
376int yyparse();
Reid Spencere77e35e2006-12-01 20:26:20 +0000377extern int yydebug;
Reid Spencere7c3c602006-11-30 06:36:44 +0000378
379static std::string CurFilename;
Reid Spencere7c3c602006-11-30 06:36:44 +0000380static std::ostream *O = 0;
Reid Spencer96839be2006-11-30 16:50:26 +0000381std::istream* LexInput = 0;
Reid Spencere77e35e2006-12-01 20:26:20 +0000382unsigned SizeOfPointer = 32;
Reid Spencer30d0c582007-01-15 00:26:18 +0000383
Reid Spencer96839be2006-11-30 16:50:26 +0000384
Reid Spencer71d2ec92006-12-31 06:02:26 +0000385// This bool controls whether attributes are ever added to function declarations
386// definitions and calls.
387static bool AddAttributes = false;
388
Reid Spencer319a7302007-01-05 17:20:02 +0000389static void warning(const std::string& msg);
Reid Spencera50d5962006-12-02 04:11:07 +0000390
Reid Spencer96839be2006-11-30 16:50:26 +0000391void UpgradeAssembly(const std::string &infile, std::istream& in,
Reid Spencer71d2ec92006-12-31 06:02:26 +0000392 std::ostream &out, bool debug, bool addAttrs)
Reid Spencere7c3c602006-11-30 06:36:44 +0000393{
394 Upgradelineno = 1;
395 CurFilename = infile;
Reid Spencer96839be2006-11-30 16:50:26 +0000396 LexInput = &in;
Reid Spencere77e35e2006-12-01 20:26:20 +0000397 yydebug = debug;
Reid Spencer71d2ec92006-12-31 06:02:26 +0000398 AddAttributes = addAttrs;
Reid Spencere7c3c602006-11-30 06:36:44 +0000399 O = &out;
400
401 if (yyparse()) {
Reid Spencer30d0c582007-01-15 00:26:18 +0000402 std::cerr << "llvm-upgrade: parse failed.\n";
403 out << "llvm-upgrade: parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +0000404 exit(1);
405 }
406}
407
Reid Spencer30d0c582007-01-15 00:26:18 +0000408namespace { // Anonymous namespace to keep our implementation local
409
410
411/// This type is used to keep track of the signedness of values. Instead
Reid Spencerb6673a92007-01-15 02:41:46 +0000412/// of creating llvm::Value directly, the parser will create Value which
Reid Spencer30d0c582007-01-15 00:26:18 +0000413/// associates a Value* with a Signedness indication.
Reid Spencerb6673a92007-01-15 02:41:46 +0000414struct Value {
Reid Spencer30d0c582007-01-15 00:26:18 +0000415 std::string* val;
Reid Spencerb6673a92007-01-15 02:41:46 +0000416 const Type* type;
Reid Spencer30d0c582007-01-15 00:26:18 +0000417 bool constant;
418 bool isConstant() const { return constant; }
Reid Spencerb6673a92007-01-15 02:41:46 +0000419 ~Value() { delete val; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000420};
421
422
423/// This type is used to keep track of the signedness of the obsolete
424/// integer types. Instead of creating an llvm::Type directly, the Lexer will
Reid Spencerb6673a92007-01-15 02:41:46 +0000425/// create instances of Type which retains the signedness indication so
Reid Spencer30d0c582007-01-15 00:26:18 +0000426/// it can be used by the parser for upgrade decisions.
427/// For example if "uint" is encountered then the "first" field will be set
428/// to "int32" and the "second" field will be set to "isUnsigned". If the
429/// type is not obsolete then "second" will be set to "isSignless".
Reid Spencerb6673a92007-01-15 02:41:46 +0000430class Type {
Reid Spencer30d0c582007-01-15 00:26:18 +0000431public:
Reid Spencerb6673a92007-01-15 02:41:46 +0000432 static const Type* get(const std::string &newType, TypeIDs oldType);
433 static const Type* get(const std::string& newType, TypeIDs oldType,
434 const Type* eTy, const Type* rTy);
Reid Spencer30d0c582007-01-15 00:26:18 +0000435
Reid Spencerb6673a92007-01-15 02:41:46 +0000436 static const Type* get(const std::string& newType, TypeIDs oldType,
437 const Type *eTy, uint64_t elems);
Reid Spencer30d0c582007-01-15 00:26:18 +0000438
Reid Spencerb6673a92007-01-15 02:41:46 +0000439 static const Type* get(const std::string& newType, TypeIDs oldType,
Reid Spencer30d0c582007-01-15 00:26:18 +0000440 TypeList* TL);
441
Reid Spencerb6673a92007-01-15 02:41:46 +0000442 static const Type* get(const std::string& newType, const Type* resTy,
Reid Spencer30d0c582007-01-15 00:26:18 +0000443 TypeList* TL);
444
Reid Spencerb6673a92007-01-15 02:41:46 +0000445 const Type* resolve() const;
446 bool operator<(const Type& that) const;
Reid Spencer30d0c582007-01-15 00:26:18 +0000447
Reid Spencerb6673a92007-01-15 02:41:46 +0000448 bool sameNewTyAs(const Type* that) const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000449 return this->newTy == that->newTy;
450 }
451
Reid Spencerb6673a92007-01-15 02:41:46 +0000452 bool sameOldTyAs(const Type* that) const;
Reid Spencer30d0c582007-01-15 00:26:18 +0000453
Reid Spencerb6673a92007-01-15 02:41:46 +0000454 TypeIDs getElementTy() const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000455 if (elemTy) {
456 return elemTy->oldTy;
457 }
458 return UnresolvedTy;
459 }
460
461 unsigned getUpRefNum() const {
462 assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference");
463 return atoi(&((getNewTy().c_str())[1])); // skip the slash
464 }
465
Reid Spencerb6673a92007-01-15 02:41:46 +0000466 typedef std::vector<const Type*> UpRefStack;
Reid Spencer30d0c582007-01-15 00:26:18 +0000467 void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const;
468 std::string makeUniqueName(const std::string& BaseName) const;
469
470 const std::string& getNewTy() const { return newTy; }
Reid Spencerb6673a92007-01-15 02:41:46 +0000471 const Type* getResultType() const { return resultTy; }
472 const Type* getElementType() const { return elemTy; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000473
Reid Spencerb6673a92007-01-15 02:41:46 +0000474 const Type* getPointerType() const {
475 return get(newTy + "*", PointerTy, this, (Type*)0);
Reid Spencer30d0c582007-01-15 00:26:18 +0000476 }
477
478 bool isUnresolved() const { return oldTy == UnresolvedTy; }
479 bool isUpReference() const { return oldTy == UpRefTy; }
480 bool isVoid() const { return oldTy == VoidTy; }
481 bool isBool() const { return oldTy == BoolTy; }
482 bool isSigned() const {
483 return oldTy == SByteTy || oldTy == ShortTy ||
484 oldTy == IntTy || oldTy == LongTy;
485 }
486
487 bool isUnsigned() const {
488 return oldTy == UByteTy || oldTy == UShortTy ||
489 oldTy == UIntTy || oldTy == ULongTy;
490 }
491 bool isSignless() const { return !isSigned() && !isUnsigned(); }
492 bool isInteger() const { return isSigned() || isUnsigned(); }
493 bool isIntegral() const { return oldTy == BoolTy || isInteger(); }
494 bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; }
495 bool isPacked() const { return oldTy == PackedTy; }
496 bool isPointer() const { return oldTy == PointerTy; }
497 bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; }
498 bool isArray() const { return oldTy == ArrayTy; }
499 bool isOther() const {
500 return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); }
501 bool isFunction() const { return oldTy == FunctionTy; }
502 bool isComposite() const {
503 return isStruct() || isPointer() || isArray() || isPacked();
504 }
505
506 bool isAttributeCandidate() const {
507 return isIntegral() && getBitWidth() < 32;
508 }
509
510 bool isUnresolvedDeep() const;
511
512 unsigned getBitWidth() const;
513
Reid Spencerb6673a92007-01-15 02:41:46 +0000514 const Type* getIndexedType(const Value* V) const;
Reid Spencer30d0c582007-01-15 00:26:18 +0000515
516 unsigned getNumStructElements() const {
517 return (elements ? elements->size() : 0);
518 }
519
Reid Spencerb6673a92007-01-15 02:41:46 +0000520 const Type* getElement(unsigned idx) const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000521 if (elements)
522 if (idx < elements->size())
523 return (*elements)[idx];
524 return 0;
525 }
526
527private:
Reid Spencerb6673a92007-01-15 02:41:46 +0000528 Type()
Reid Spencer30d0c582007-01-15 00:26:18 +0000529 : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0),
530 nelems(0) {
531 }
532
Reid Spencerb6673a92007-01-15 02:41:46 +0000533 Type(const Type& that); // do not implement
534 Type& operator=(const Type& that); // do not implement
Reid Spencer30d0c582007-01-15 00:26:18 +0000535
Reid Spencerb6673a92007-01-15 02:41:46 +0000536 ~Type() { delete elements; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000537
538 struct ltfunctor
539 {
Reid Spencerb6673a92007-01-15 02:41:46 +0000540 bool operator()(const Type* X, const Type* Y) const {
Reid Spencer30d0c582007-01-15 00:26:18 +0000541 assert(X && "Can't compare null pointer");
542 assert(Y && "Can't compare null pointer");
543 return *X < *Y;
544 }
545 };
546
Reid Spencerb6673a92007-01-15 02:41:46 +0000547 typedef std::set<const Type*, ltfunctor> TypeRegMap;
Reid Spencer30d0c582007-01-15 00:26:18 +0000548
Reid Spencerb6673a92007-01-15 02:41:46 +0000549 static const Type* add_new_type(Type* existing);
Reid Spencer30d0c582007-01-15 00:26:18 +0000550
551 std::string newTy;
Reid Spencerb6673a92007-01-15 02:41:46 +0000552 TypeIDs oldTy;
553 Type *elemTy;
554 Type *resultTy;
Reid Spencer30d0c582007-01-15 00:26:18 +0000555 TypeList *elements;
556 uint64_t nelems;
557 static TypeRegMap registry;
558public:
Reid Spencerb6673a92007-01-15 02:41:46 +0000559 typedef std::vector<const Type*> TypeVector;
560 typedef std::map<std::string,const Type*> TypeMap;
561 typedef std::map<const Type*,std::string> TypePlaneMap;
Reid Spencer30d0c582007-01-15 00:26:18 +0000562 typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap;
563 static TypeVector EnumeratedTypes;
564 static TypeMap NamedTypes;
565 static GlobalsTypeMap Globals;
566};
567
Reid Spencerb6673a92007-01-15 02:41:46 +0000568Type::TypeRegMap Type::registry;
569Type::TypeVector Type::EnumeratedTypes;
570Type::TypeMap Type::NamedTypes;
571Type::GlobalsTypeMap Type::Globals;
Reid Spencer319a7302007-01-05 17:20:02 +0000572
Reid Spencerb6673a92007-01-15 02:41:46 +0000573const Type* Type::get(const std::string &newType, TypeIDs oldType) {
574 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000575 Ty->newTy = newType;
576 Ty->oldTy = oldType;
577 return add_new_type(Ty);
578}
579
Reid Spencerb6673a92007-01-15 02:41:46 +0000580const Type* Type::get(const std::string& newType, TypeIDs oldType,
581 const Type* eTy, const Type* rTy) {
582 Type* Ty= new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000583 Ty->newTy = newType;
584 Ty->oldTy = oldType;
Reid Spencerb6673a92007-01-15 02:41:46 +0000585 Ty->elemTy = const_cast<Type*>(eTy);
586 Ty->resultTy = const_cast<Type*>(rTy);
Reid Spencer319a7302007-01-05 17:20:02 +0000587 return add_new_type(Ty);
588}
589
Reid Spencerb6673a92007-01-15 02:41:46 +0000590const Type* Type::get(const std::string& newType, TypeIDs oldType,
591 const Type *eTy, uint64_t elems) {
592 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000593 Ty->newTy = newType;
594 Ty->oldTy = oldType;
Reid Spencerb6673a92007-01-15 02:41:46 +0000595 Ty->elemTy = const_cast<Type*>(eTy);
Reid Spencer319a7302007-01-05 17:20:02 +0000596 Ty->nelems = elems;
597 return add_new_type(Ty);
598}
599
Reid Spencerb6673a92007-01-15 02:41:46 +0000600const Type* Type::get(const std::string& newType, TypeIDs oldType,
Reid Spencer319a7302007-01-05 17:20:02 +0000601 TypeList* TL) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000602 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000603 Ty->newTy = newType;
604 Ty->oldTy = oldType;
605 Ty->elements = TL;
606 return add_new_type(Ty);
607}
608
Reid Spencerb6673a92007-01-15 02:41:46 +0000609const Type* Type::get(const std::string& newType, const Type* resTy,
Reid Spencer319a7302007-01-05 17:20:02 +0000610 TypeList* TL) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000611 Type* Ty = new Type();
Reid Spencer319a7302007-01-05 17:20:02 +0000612 Ty->newTy = newType;
613 Ty->oldTy = FunctionTy;
Reid Spencerb6673a92007-01-15 02:41:46 +0000614 Ty->resultTy = const_cast<Type*>(resTy);
Reid Spencer319a7302007-01-05 17:20:02 +0000615 Ty->elements = TL;
616 return add_new_type(Ty);
617}
618
Reid Spencerb6673a92007-01-15 02:41:46 +0000619const Type* Type::resolve() const {
Reid Spencer319a7302007-01-05 17:20:02 +0000620 if (isUnresolved()) {
Reid Spencerf8383de2007-01-06 06:04:32 +0000621 if (getNewTy()[0] == '%' && isdigit(newTy[1])) {
622 unsigned ref = atoi(&((newTy.c_str())[1])); // skip the %
Reid Spencereff838e2007-01-03 23:45:42 +0000623 if (ref < EnumeratedTypes.size()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000624 return EnumeratedTypes[ref];
Reid Spencereff838e2007-01-03 23:45:42 +0000625 } else {
626 std::string msg("Can't resolve numbered type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000627 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000628 yyerror(msg.c_str());
629 }
Reid Spencer78720742006-12-02 20:21:22 +0000630 } else {
Reid Spencerb6673a92007-01-15 02:41:46 +0000631 Type::TypeMap::iterator I = NamedTypes.find(newTy);
Reid Spencereff838e2007-01-03 23:45:42 +0000632 if (I != NamedTypes.end()) {
Reid Spencer319a7302007-01-05 17:20:02 +0000633 return I->second;
Reid Spencereff838e2007-01-03 23:45:42 +0000634 } else {
635 std::string msg("Cannot resolve type: ");
Reid Spencer319a7302007-01-05 17:20:02 +0000636 msg += getNewTy();
Reid Spencereff838e2007-01-03 23:45:42 +0000637 yyerror(msg.c_str());
638 }
Reid Spencera50d5962006-12-02 04:11:07 +0000639 }
Reid Spencer280d8012006-12-01 23:40:53 +0000640 }
Reid Spencera50d5962006-12-02 04:11:07 +0000641 // otherwise its already resolved.
Reid Spencer319a7302007-01-05 17:20:02 +0000642 return this;
643}
644
Reid Spencerb6673a92007-01-15 02:41:46 +0000645bool Type::operator<(const Type& that) const {
Reid Spencer319a7302007-01-05 17:20:02 +0000646 if (this == &that)
647 return false;
648 if (oldTy != that.oldTy)
649 return oldTy < that.oldTy;
650 switch (oldTy) {
651 case UpRefTy: {
652 unsigned thisUp = this->getUpRefNum();
653 unsigned thatUp = that.getUpRefNum();
654 return thisUp < thatUp;
655 }
656 case PackedTy:
657 case ArrayTy:
658 if (this->nelems != that.nelems)
659 return nelems < that.nelems;
660 case PointerTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000661 const Type* thisTy = this->elemTy;
662 const Type* thatTy = that.elemTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000663 return *thisTy < *thatTy;
664 }
665 case FunctionTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000666 const Type* thisTy = this->resultTy;
667 const Type* thatTy = that.resultTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000668 if (!thisTy->sameOldTyAs(thatTy))
669 return *thisTy < *thatTy;
670 /* FALL THROUGH */
671 }
672 case StructTy:
673 case PackedStructTy: {
674 if (elements->size() != that.elements->size())
675 return elements->size() < that.elements->size();
676 for (unsigned i = 0; i < elements->size(); i++) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000677 const Type* thisTy = (*this->elements)[i];
678 const Type* thatTy = (*that.elements)[i];
Reid Spencer319a7302007-01-05 17:20:02 +0000679 if (!thisTy->sameOldTyAs(thatTy))
680 return *thisTy < *thatTy;
681 }
682 break;
683 }
684 case UnresolvedTy:
685 return this->newTy < that.newTy;
686 default:
687 break;
688 }
689 return false;
690}
691
Reid Spencerb6673a92007-01-15 02:41:46 +0000692bool Type::sameOldTyAs(const Type* that) const {
Reid Spencer319a7302007-01-05 17:20:02 +0000693 if (that == 0)
694 return false;
695 if ( this == that )
696 return true;
697 if (oldTy != that->oldTy)
698 return false;
699 switch (oldTy) {
700 case PackedTy:
701 case ArrayTy:
702 if (nelems != that->nelems)
703 return false;
704 /* FALL THROUGH */
705 case PointerTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000706 const Type* thisTy = this->elemTy;
707 const Type* thatTy = that->elemTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000708 return thisTy->sameOldTyAs(thatTy);
709 }
710 case FunctionTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000711 const Type* thisTy = this->resultTy;
712 const Type* thatTy = that->resultTy;
Reid Spencer319a7302007-01-05 17:20:02 +0000713 if (!thisTy->sameOldTyAs(thatTy))
714 return false;
715 /* FALL THROUGH */
716 }
717 case StructTy:
718 case PackedStructTy: {
719 if (elements->size() != that->elements->size())
720 return false;
721 for (unsigned i = 0; i < elements->size(); i++) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000722 const Type* thisTy = (*this->elements)[i];
723 const Type* thatTy = (*that->elements)[i];
Reid Spencer319a7302007-01-05 17:20:02 +0000724 if (!thisTy->sameOldTyAs(thatTy))
725 return false;
726 }
727 return true;
728 }
729 case UnresolvedTy:
730 return this->newTy == that->newTy;
731 default:
732 return true; // for all others oldTy == that->oldTy is sufficient
733 }
734 return true;
735}
736
Reid Spencerb6673a92007-01-15 02:41:46 +0000737bool Type::isUnresolvedDeep() const {
Reid Spencer319a7302007-01-05 17:20:02 +0000738 switch (oldTy) {
739 case UnresolvedTy:
740 return true;
741 case PackedTy:
742 case ArrayTy:
743 case PointerTy:
744 return elemTy->isUnresolvedDeep();
745 case PackedStructTy:
746 case StructTy:
747 for (unsigned i = 0; i < elements->size(); i++)
748 if ((*elements)[i]->isUnresolvedDeep())
749 return true;
750 return false;
751 default:
752 return false;
753 }
754}
755
Reid Spencerb6673a92007-01-15 02:41:46 +0000756unsigned Type::getBitWidth() const {
Reid Spencer319a7302007-01-05 17:20:02 +0000757 switch (oldTy) {
758 default:
759 case LabelTy:
760 case VoidTy : return 0;
761 case BoolTy : return 1;
762 case SByteTy: case UByteTy : return 8;
763 case ShortTy: case UShortTy : return 16;
764 case IntTy: case UIntTy: case FloatTy: return 32;
765 case LongTy: case ULongTy: case DoubleTy : return 64;
766 case PointerTy: return SizeOfPointer; // global var
767 case PackedTy:
768 case ArrayTy:
769 return nelems * elemTy->getBitWidth();
770 case StructTy:
771 case PackedStructTy: {
772 uint64_t size = 0;
773 for (unsigned i = 0; i < elements->size(); i++) {
774 size += (*elements)[i]->getBitWidth();
775 }
776 return size;
777 }
778 }
779}
780
Reid Spencerb6673a92007-01-15 02:41:46 +0000781const Type* Type::getIndexedType(const Value* V) const {
Reid Spencer319a7302007-01-05 17:20:02 +0000782 if (isStruct()) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000783 if (V->isConstant() && V->type->isInteger()) {
784 size_t pos = V->val->find(' ') + 1;
785 if (pos < V->val->size()) {
786 uint64_t idx = atoi(V->val->substr(pos).c_str());
Reid Spencer319a7302007-01-05 17:20:02 +0000787 return (*elements)[idx];
788 } else {
789 yyerror("Invalid value for constant integer");
790 return 0;
791 }
792 } else {
793 yyerror("Structure requires constant index");
794 return 0;
795 }
796 }
797 if (isArray() || isPacked() || isPointer())
798 return elemTy;
799 yyerror("Invalid type for getIndexedType");
800 return 0;
801}
802
Reid Spencerb6673a92007-01-15 02:41:46 +0000803void Type::getSignedness(unsigned &sNum, unsigned &uNum,
Reid Spencerf8383de2007-01-06 06:04:32 +0000804 UpRefStack& stack) const {
805 switch (oldTy) {
806 default:
807 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy:
808 case FloatTy : case DoubleTy: case UpRefTy:
809 return;
810 case SByteTy: case ShortTy: case LongTy: case IntTy:
811 sNum++;
812 return;
813 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
814 uNum++;
815 return;
816 case PointerTy:
817 case PackedTy:
818 case ArrayTy:
819 stack.push_back(this);
820 elemTy->getSignedness(sNum, uNum, stack);
821 return;
822 case StructTy:
823 case PackedStructTy: {
824 stack.push_back(this);
825 for (unsigned i = 0; i < elements->size(); i++) {
826 (*elements)[i]->getSignedness(sNum, uNum, stack);
827 }
828 return;
829 }
830 case UnresolvedTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000831 const Type* Ty = this->resolve();
Reid Spencerf8383de2007-01-06 06:04:32 +0000832 // Let's not recurse.
833 UpRefStack::const_iterator I = stack.begin(), E = stack.end();
834 for ( ; I != E && *I != Ty; ++I)
835 ;
836 if (I == E)
837 Ty->getSignedness(sNum, uNum, stack);
838 return;
839 }
840 }
841}
842
843std::string AddSuffix(const std::string& Name, const std::string& Suffix) {
844 if (Name[Name.size()-1] == '"') {
845 std::string Result = Name;
846 Result.insert(Result.size()-1, Suffix);
847 return Result;
848 }
849 return Name + Suffix;
850}
851
Reid Spencerb6673a92007-01-15 02:41:46 +0000852std::string Type::makeUniqueName(const std::string& BaseName) const {
Reid Spencerf8383de2007-01-06 06:04:32 +0000853 if (BaseName == "\"alloca point\"")
854 return BaseName;
855 switch (oldTy) {
856 default:
857 break;
858 case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy:
859 case FloatTy : case DoubleTy: case UnresolvedTy:
860 return BaseName;
861 case SByteTy: case ShortTy: case LongTy: case IntTy:
862 return AddSuffix(BaseName, ".s");
863 case UByteTy: case UShortTy: case UIntTy: case ULongTy:
864 return AddSuffix(BaseName, ".u");
865 }
866
867 unsigned uNum = 0, sNum = 0;
868 std::string Suffix;
869 switch (oldTy) {
870 case PointerTy:
871 case PackedTy:
872 case ArrayTy: {
Reid Spencerb6673a92007-01-15 02:41:46 +0000873 Type::UpRefStack stack;
Reid Spencerf8383de2007-01-06 06:04:32 +0000874 elemTy->resolve()->getSignedness(sNum, uNum, stack);
875 break;
876 }
877 case StructTy:
878 case PackedStructTy: {
879 for (unsigned i = 0; i < elements->size(); i++) {
Reid Spencerb6673a92007-01-15 02:41:46 +0000880 Type::UpRefStack stack;
Reid Spencerf8383de2007-01-06 06:04:32 +0000881 (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack);
882 }
883 break;
884 }
885 default:
886 assert(0 && "Invalid Type");
887 break;
888 }
889
890 if (sNum == 0 && uNum == 0)
891 return BaseName;
892
893 switch (oldTy) {
894 default: Suffix += ".nada"; break;
895 case PointerTy: Suffix += ".pntr"; break;
896 case PackedTy: Suffix += ".pckd"; break;
897 case ArrayTy: Suffix += ".arry"; break;
898 case StructTy: Suffix += ".strc"; break;
899 case PackedStructTy: Suffix += ".pstr"; break;
900 }
901
902 Suffix += ".s" + llvm::utostr(sNum);
903 Suffix += ".u" + llvm::utostr(uNum);
904 return AddSuffix(BaseName, Suffix);
905}
906
Reid Spencerb6673a92007-01-15 02:41:46 +0000907Type& Type::operator=(const Type& that) {
Reid Spencer319a7302007-01-05 17:20:02 +0000908 oldTy = that.oldTy;
909 nelems = that.nelems;
910 newTy = that.newTy;
911 elemTy = that.elemTy;
912 resultTy = that.resultTy;
913 if (that.elements) {
914 elements = new TypeList(that.elements->size());
915 *elements = *that.elements;
916 } else {
917 elements = 0;
918 }
919 return *this;
920}
921
Reid Spencerb6673a92007-01-15 02:41:46 +0000922const Type* Type::add_new_type(Type* newTy) {
Reid Spencer319a7302007-01-05 17:20:02 +0000923 TypeRegMap::iterator I = registry.find(newTy);
924 if (I != registry.end()) {
925 delete newTy;
926 return *I;
927 }
928 registry.insert(newTy);
929 return newTy;
Reid Spencer280d8012006-12-01 23:40:53 +0000930}
931
Reid Spencerb6673a92007-01-15 02:41:46 +0000932class Instruction {
933};
934
Reid Spencer30d0c582007-01-15 00:26:18 +0000935/// This type is used to keep track of the signedness of constants.
Reid Spencerb6673a92007-01-15 02:41:46 +0000936struct Constant {
Reid Spencer30d0c582007-01-15 00:26:18 +0000937 std::string *cnst;
Reid Spencerb6673a92007-01-15 02:41:46 +0000938 const Type *type;
939 ~Constant() { delete cnst; }
Reid Spencer30d0c582007-01-15 00:26:18 +0000940};
941
942/// This variable provides a counter for unique names. It is used in various
943/// productions to ensure a unique name is generated.
944static uint64_t UniqueNameCounter = 1;
945
946// This is set when a DECLARE keyword is recognized so that subsequent parsing
947// of a function prototype can know if its a declaration or definition.
948static bool isDeclare = false;
949
950// This bool is used to communicate between the InstVal and Inst rules about
951// whether or not a cast should be deleted. When the flag is set, InstVal has
952// determined that the cast is a candidate. However, it can only be deleted if
953// the value being casted is the same value name as the instruction. The Inst
954// rule makes that comparison if the flag is set and comments out the
955// instruction if they match.
956static bool deleteUselessCastFlag = false;
957static std::string* deleteUselessCastName = 0;
958
959
960
Reid Spencerb6673a92007-01-15 02:41:46 +0000961const char* getCastOpcode(std::string& Source, const Type* SrcTy,
962 const Type* DstTy) {
Reid Spencer52402b02007-01-02 05:45:11 +0000963 unsigned SrcBits = SrcTy->getBitWidth();
964 unsigned DstBits = DstTy->getBitWidth();
Reid Spencere77e35e2006-12-01 20:26:20 +0000965 const char* opcode = "bitcast";
966 // Run through the possibilities ...
Reid Spencer52402b02007-01-02 05:45:11 +0000967 if (DstTy->isIntegral()) { // Casting to integral
968 if (SrcTy->isIntegral()) { // Casting from integral
Reid Spencere77e35e2006-12-01 20:26:20 +0000969 if (DstBits < SrcBits)
970 opcode = "trunc";
971 else if (DstBits > SrcBits) { // its an extension
Reid Spencer52402b02007-01-02 05:45:11 +0000972 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000973 opcode ="sext"; // signed -> SEXT
974 else
975 opcode = "zext"; // unsigned -> ZEXT
976 } else {
977 opcode = "bitcast"; // Same size, No-op cast
978 }
Reid Spencer52402b02007-01-02 05:45:11 +0000979 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
980 if (DstTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000981 opcode = "fptosi"; // FP -> sint
982 else
983 opcode = "fptoui"; // FP -> uint
Reid Spencer52402b02007-01-02 05:45:11 +0000984 } else if (SrcTy->isPacked()) {
985 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000986 "Casting packed to integer of different width");
987 opcode = "bitcast"; // same size, no-op cast
988 } else {
Reid Spencer52402b02007-01-02 05:45:11 +0000989 assert(SrcTy->isPointer() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000990 "Casting from a value that is not first-class type");
991 opcode = "ptrtoint"; // ptr -> int
992 }
Reid Spencer52402b02007-01-02 05:45:11 +0000993 } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
994 if (SrcTy->isIntegral()) { // Casting from integral
995 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000996 opcode = "sitofp"; // sint -> FP
997 else
998 opcode = "uitofp"; // uint -> FP
Reid Spencer52402b02007-01-02 05:45:11 +0000999 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
Reid Spencere77e35e2006-12-01 20:26:20 +00001000 if (DstBits < SrcBits) {
1001 opcode = "fptrunc"; // FP -> smaller FP
1002 } else if (DstBits > SrcBits) {
1003 opcode = "fpext"; // FP -> larger FP
1004 } else {
1005 opcode ="bitcast"; // same size, no-op cast
1006 }
Reid Spencer52402b02007-01-02 05:45:11 +00001007 } else if (SrcTy->isPacked()) {
1008 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +00001009 "Casting packed to floating point of different width");
1010 opcode = "bitcast"; // same size, no-op cast
1011 } else {
1012 assert(0 && "Casting pointer or non-first class to float");
1013 }
Reid Spencer52402b02007-01-02 05:45:11 +00001014 } else if (DstTy->isPacked()) {
1015 if (SrcTy->isPacked()) {
1016 assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +00001017 "Casting packed to packed of different widths");
1018 opcode = "bitcast"; // packed -> packed
Reid Spencer52402b02007-01-02 05:45:11 +00001019 } else if (DstTy->getBitWidth() == SrcBits) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001020 opcode = "bitcast"; // float/int -> packed
1021 } else {
1022 assert(!"Illegal cast to packed (wrong type or size)");
1023 }
Reid Spencer52402b02007-01-02 05:45:11 +00001024 } else if (DstTy->isPointer()) {
1025 if (SrcTy->isPointer()) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001026 opcode = "bitcast"; // ptr -> ptr
Reid Spencer52402b02007-01-02 05:45:11 +00001027 } else if (SrcTy->isIntegral()) {
Reid Spencere77e35e2006-12-01 20:26:20 +00001028 opcode = "inttoptr"; // int -> ptr
1029 } else {
Reid Spencera50d5962006-12-02 04:11:07 +00001030 assert(!"Casting invalid type to pointer");
Reid Spencere77e35e2006-12-01 20:26:20 +00001031 }
1032 } else {
1033 assert(!"Casting to type that is not first-class");
1034 }
1035 return opcode;
1036}
1037
Reid Spencerb6673a92007-01-15 02:41:46 +00001038std::string getCastUpgrade(const std::string& Src, const Type* SrcTy,
1039 const Type* DstTy, bool isConst) {
Reid Spencera50d5962006-12-02 04:11:07 +00001040 std::string Result;
1041 std::string Source = Src;
Reid Spencer52402b02007-01-02 05:45:11 +00001042 if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
Reid Spencera50d5962006-12-02 04:11:07 +00001043 // fp -> ptr cast is no longer supported but we must upgrade this
1044 // by doing a double cast: fp -> int -> ptr
1045 if (isConst)
Reid Spencer71d2ec92006-12-31 06:02:26 +00001046 Source = "i64 fptoui(" + Source + " to i64)";
Reid Spencera50d5962006-12-02 04:11:07 +00001047 else {
Reid Spencerb6673a92007-01-15 02:41:46 +00001048 *O << " %cast_upgrade" << UniqueNameCounter << " = fptoui "
Reid Spencer30d0c582007-01-15 00:26:18 +00001049 << Source << " to i64\n";
Reid Spencerb6673a92007-01-15 02:41:46 +00001050 Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter++);
Reid Spencera50d5962006-12-02 04:11:07 +00001051 }
1052 // Update the SrcTy for the getCastOpcode call below
Reid Spencerb6673a92007-01-15 02:41:46 +00001053 SrcTy = Type::get("i64", ULongTy);
Reid Spencer52402b02007-01-02 05:45:11 +00001054 } else if (DstTy->isBool()) {
1055 // cast type %x to bool was previously defined as setne type %x, null
1056 // The cast semantic is now to truncate, not compare so we must retain
1057 // the original intent by replacing the cast with a setne
1058 const char* comparator = SrcTy->isPointer() ? ", null" :
1059 (SrcTy->isFloatingPoint() ? ", 0.0" :
1060 (SrcTy->isBool() ? ", false" : ", 0"));
1061 const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
Reid Spencer187ccf82006-12-09 16:57:22 +00001062 if (isConst) {
1063 Result = "(" + Source + comparator + ")";
1064 Result = compareOp + Result;
1065 } else
1066 Result = compareOp + Source + comparator;
Reid Spencera50d5962006-12-02 04:11:07 +00001067 return Result; // skip cast processing below
1068 }
Reid Spencer319a7302007-01-05 17:20:02 +00001069 SrcTy = SrcTy->resolve();
1070 DstTy = DstTy->resolve();
Reid Spencera50d5962006-12-02 04:11:07 +00001071 std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
1072 if (isConst)
Reid Spencer52402b02007-01-02 05:45:11 +00001073 Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
Reid Spencera50d5962006-12-02 04:11:07 +00001074 else
Reid Spencer52402b02007-01-02 05:45:11 +00001075 Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
Reid Spencera50d5962006-12-02 04:11:07 +00001076 return Result;
1077}
1078
Reid Spencerb6673a92007-01-15 02:41:46 +00001079const char* getDivRemOpcode(const std::string& opcode, const Type* TI) {
Reid Spencer78720742006-12-02 20:21:22 +00001080 const char* op = opcode.c_str();
Reid Spencerb6673a92007-01-15 02:41:46 +00001081 const Type* Ty = TI->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001082 if (Ty->isPacked())
1083 Ty = Ty->getElementType();
Reid Spencer78720742006-12-02 20:21:22 +00001084 if (opcode == "div")
Reid Spencer52402b02007-01-02 05:45:11 +00001085 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +00001086 op = "fdiv";
Reid Spencer52402b02007-01-02 05:45:11 +00001087 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +00001088 op = "udiv";
Reid Spencer52402b02007-01-02 05:45:11 +00001089 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +00001090 op = "sdiv";
1091 else
1092 yyerror("Invalid type for div instruction");
1093 else if (opcode == "rem")
Reid Spencer52402b02007-01-02 05:45:11 +00001094 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +00001095 op = "frem";
Reid Spencer52402b02007-01-02 05:45:11 +00001096 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +00001097 op = "urem";
Reid Spencer52402b02007-01-02 05:45:11 +00001098 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +00001099 op = "srem";
1100 else
1101 yyerror("Invalid type for rem instruction");
1102 return op;
1103}
Reid Spencere7c3c602006-11-30 06:36:44 +00001104
Reid Spencerb6673a92007-01-15 02:41:46 +00001105std::string getCompareOp(const std::string& setcc, const Type* TI) {
Reid Spencer229e9362006-12-02 22:14:11 +00001106 assert(setcc.length() == 5);
1107 char cc1 = setcc[3];
1108 char cc2 = setcc[4];
1109 assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
1110 assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
1111 std::string result("xcmp xxx");
1112 result[6] = cc1;
1113 result[7] = cc2;
Reid Spencer52402b02007-01-02 05:45:11 +00001114 if (TI->isFloatingPoint()) {
Reid Spencer229e9362006-12-02 22:14:11 +00001115 result[0] = 'f';
Reid Spencere4d87aa2006-12-23 06:05:41 +00001116 result[5] = 'o';
Reid Spencerf0cf1322006-12-07 04:23:03 +00001117 if (cc1 == 'n')
1118 result[5] = 'u'; // NE maps to unordered
1119 else
1120 result[5] = 'o'; // everything else maps to ordered
Reid Spencer52402b02007-01-02 05:45:11 +00001121 } else if (TI->isIntegral() || TI->isPointer()) {
Reid Spencer229e9362006-12-02 22:14:11 +00001122 result[0] = 'i';
1123 if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
1124 result.erase(5,1);
Reid Spencer52402b02007-01-02 05:45:11 +00001125 else if (TI->isSigned())
Reid Spencer229e9362006-12-02 22:14:11 +00001126 result[5] = 's';
Reid Spencer52402b02007-01-02 05:45:11 +00001127 else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
Reid Spencer229e9362006-12-02 22:14:11 +00001128 result[5] = 'u';
1129 else
1130 yyerror("Invalid integral type for setcc");
1131 }
1132 return result;
1133}
1134
Reid Spencerb6673a92007-01-15 02:41:46 +00001135const Type* getFunctionReturnType(const Type* PFTy) {
Reid Spencer319a7302007-01-05 17:20:02 +00001136 PFTy = PFTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001137 if (PFTy->isPointer()) {
Reid Spencerb6673a92007-01-15 02:41:46 +00001138 const Type* ElemTy = PFTy->getElementType();
Reid Spencer319a7302007-01-05 17:20:02 +00001139 ElemTy = ElemTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001140 if (ElemTy->isFunction())
Reid Spencer319a7302007-01-05 17:20:02 +00001141 return ElemTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +00001142 } else if (PFTy->isFunction()) {
Reid Spencer319a7302007-01-05 17:20:02 +00001143 return PFTy->getResultType();
Reid Spencer52402b02007-01-02 05:45:11 +00001144 }
Reid Spencer319a7302007-01-05 17:20:02 +00001145 return PFTy;
Reid Spencer52402b02007-01-02 05:45:11 +00001146}
1147
Reid Spencerb6673a92007-01-15 02:41:46 +00001148const Type* ResolveUpReference(const Type* Ty,
1149 Type::UpRefStack* stack) {
Reid Spencereff838e2007-01-03 23:45:42 +00001150 assert(Ty->isUpReference() && "Can't resolve a non-upreference");
Reid Spencer319a7302007-01-05 17:20:02 +00001151 unsigned upref = Ty->getUpRefNum();
Reid Spencereff838e2007-01-03 23:45:42 +00001152 assert(upref < stack->size() && "Invalid up reference");
1153 return (*stack)[upref - stack->size() - 1];
1154}
1155
Reid Spencerb6673a92007-01-15 02:41:46 +00001156const Type* getGEPIndexedType(const Type* PTy, ValueList* idxs) {
1157 const Type* Result = PTy = PTy->resolve();
Reid Spencer52402b02007-01-02 05:45:11 +00001158 assert(PTy->isPointer() && "GEP Operand is not a pointer?");
Reid Spencerb6673a92007-01-15 02:41:46 +00001159 Type::UpRefStack stack;
Reid Spencereff838e2007-01-03 23:45:42 +00001160 for (unsigned i = 0; i < idxs->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00001161 if (Result->isComposite()) {
1162 Result = Result->getIndexedType((*idxs)[i]);
Reid Spencer319a7302007-01-05 17:20:02 +00001163 Result = Result->resolve();
Reid Spencereff838e2007-01-03 23:45:42 +00001164 stack.push_back(Result);
Reid Spencer52402b02007-01-02 05:45:11 +00001165 } else
1166 yyerror("Invalid type for index");
1167 }
Reid Spencereff838e2007-01-03 23:45:42 +00001168 // Resolve upreferences so we can return a more natural type
1169 if (Result->isPointer()) {
1170 if (Result->getElementType()->isUpReference()) {
1171 stack.push_back(Result);
1172 Result = ResolveUpReference(Result->getElementType(), &stack);
1173 }
1174 } else if (Result->isUpReference()) {
1175 Result = ResolveUpReference(Result->getElementType(), &stack);
1176 }
Reid Spencer52402b02007-01-02 05:45:11 +00001177 return Result->getPointerType();
1178}
1179
Reid Spencer52402b02007-01-02 05:45:11 +00001180// This function handles appending .u or .s to integer value names that
1181// were previously unsigned or signed, respectively. This avoids name
1182// collisions since the unsigned and signed type planes have collapsed
1183// into a single signless type plane.
Reid Spencerb6673a92007-01-15 02:41:46 +00001184std::string getUniqueName(const std::string *Name, const Type* Ty,
Reid Spencer30d0c582007-01-15 00:26:18 +00001185 bool isGlobal = false, bool isDef = false) {
Reid Spencer319a7302007-01-05 17:20:02 +00001186
Reid Spencer52402b02007-01-02 05:45:11 +00001187 // If its not a symbolic name, don't modify it, probably a constant val.
1188 if ((*Name)[0] != '%' && (*Name)[0] != '"')
1189 return *Name;
Reid Spencer319a7302007-01-05 17:20:02 +00001190
Reid Spencer52402b02007-01-02 05:45:11 +00001191 // If its a numeric reference, just leave it alone.
1192 if (isdigit((*Name)[1]))
1193 return *Name;
1194
1195 // Resolve the type
Reid Spencer319a7302007-01-05 17:20:02 +00001196 Ty = Ty->resolve();
1197
1198 // If its a global name, get its uniquified name, if any
Reid Spencerb6673a92007-01-15 02:41:46 +00001199 Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
1200 if (GI != Type::Globals.end()) {
1201 Type::TypePlaneMap::iterator TPI = GI->second.begin();
1202 Type::TypePlaneMap::iterator TPE = GI->second.end();
Reid Spencer319a7302007-01-05 17:20:02 +00001203 for ( ; TPI != TPE ; ++TPI) {
1204 if (TPI->first->sameNewTyAs(Ty))
1205 return TPI->second;
1206 }
1207 }
1208
1209 if (isGlobal) {
1210 // We didn't find a global name, but if its supposed to be global then all
1211 // we can do is return the name. This is probably a forward reference of a
1212 // global value that hasn't been defined yet. Since we have no definition
1213 // we don't know its linkage class. Just assume its an external and the name
1214 // shouldn't change.
1215 return *Name;
1216 }
Reid Spencer52402b02007-01-02 05:45:11 +00001217
1218 // Default the result to the current name
Reid Spencerf8383de2007-01-06 06:04:32 +00001219 std::string Result = Ty->makeUniqueName(*Name);
Reid Spencer52402b02007-01-02 05:45:11 +00001220
Reid Spencer52402b02007-01-02 05:45:11 +00001221 return Result;
1222}
1223
Reid Spencer319a7302007-01-05 17:20:02 +00001224std::string getGlobalName(const std::string* Name, const std::string Linkage,
Reid Spencerb6673a92007-01-15 02:41:46 +00001225 const Type* Ty, bool isConstant) {
Reid Spencer319a7302007-01-05 17:20:02 +00001226 // Default to given name
1227 std::string Result = *Name;
1228 // Look up the name in the Globals Map
Reid Spencerb6673a92007-01-15 02:41:46 +00001229 Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name);
Reid Spencer319a7302007-01-05 17:20:02 +00001230 // Did we see this global name before?
Reid Spencerb6673a92007-01-15 02:41:46 +00001231 if (GI != Type::Globals.end()) {
Reid Spencer319a7302007-01-05 17:20:02 +00001232 if (Ty->isUnresolvedDeep()) {
1233 // The Gval's type is unresolved. Consequently, we can't disambiguate it
1234 // by type. We'll just change its name and emit a warning.
1235 warning("Cannot disambiguate global value '" + *Name +
1236 "' because type '" + Ty->getNewTy() + "'is unresolved.\n");
1237 Result = *Name + ".unique";
1238 UniqueNameCounter++;
1239 Result += llvm::utostr(UniqueNameCounter);
1240 return Result;
1241 } else {
Reid Spencerb6673a92007-01-15 02:41:46 +00001242 Type::TypePlaneMap::iterator TPI = GI->second.find(Ty);
Reid Spencer319a7302007-01-05 17:20:02 +00001243 if (TPI != GI->second.end()) {
1244 // We found an existing name of the same old type. This isn't allowed
1245 // in LLVM 2.0. Consequently, we must alter the name of the global so it
1246 // can at least compile. References to the global will yield the first
1247 // definition, which is okay. We also must warn about this.
1248 Result = *Name + ".unique";
1249 UniqueNameCounter++;
1250 Result += llvm::utostr(UniqueNameCounter);
1251 warning(std::string("Global variable '") + *Name + "' was renamed to '"+
1252 Result + "'");
1253 } else {
1254 // There isn't an existing definition for this name according to the
1255 // old types. Now search the TypePlanMap for types with the same new
1256 // name.
Reid Spencerb6673a92007-01-15 02:41:46 +00001257 Type::TypePlaneMap::iterator TPI = GI->second.begin();
1258 Type::TypePlaneMap::iterator TPE = GI->second.end();
Reid Spencer319a7302007-01-05 17:20:02 +00001259 for ( ; TPI != TPE; ++TPI) {
1260 if (TPI->first->sameNewTyAs(Ty)) {
1261 // The new types are the same but the old types are different so
1262 // this is a global name collision resulting from type planes
1263 // collapsing.
1264 if (Linkage == "external" || Linkage == "dllimport" ||
1265 Linkage == "extern_weak" || Linkage == "") {
1266 // The linkage of this gval is external so we can't reliably
1267 // rename it because it could potentially create a linking
1268 // problem. However, we can't leave the name conflict in the
1269 // output either or it won't assemble with LLVM 2.0. So, all we
1270 // can do is rename this one to something unique and emit a
1271 // warning about the problem.
1272 Result = *Name + ".unique";
1273 UniqueNameCounter++;
1274 Result += llvm::utostr(UniqueNameCounter);
1275 warning("Renaming global value '" + *Name + "' to '" + Result +
1276 "' may cause linkage errors.");
1277 return Result;
1278 } else {
1279 // Its linkage is internal and its type is known so we can
1280 // disambiguate the name collision successfully based on the type.
1281 Result = getUniqueName(Name, Ty);
1282 TPI->second = Result;
1283 return Result;
1284 }
1285 }
1286 }
1287 // We didn't find an entry in the type plane with the same new type and
1288 // the old types differ so this is a new type plane for this global
1289 // variable. We just fall through to the logic below which inserts
1290 // the global.
1291 }
1292 }
1293 }
1294
1295 // Its a new global name, if it is external we can't change it
1296 if (isConstant || Linkage == "external" || Linkage == "dllimport" ||
1297 Linkage == "extern_weak" || Linkage == "") {
Reid Spencerb6673a92007-01-15 02:41:46 +00001298 Type::Globals[Result][Ty] = Result;
Reid Spencer319a7302007-01-05 17:20:02 +00001299 return Result;
1300 }
1301
1302 // Its a new global name, and it is internal, change the name to make it
1303 // unique for its type.
1304 // Result = getUniqueName(Name, Ty);
Reid Spencerb6673a92007-01-15 02:41:46 +00001305 Type::Globals[*Name][Ty] = Result;
Reid Spencer319a7302007-01-05 17:20:02 +00001306 return Result;
1307}
1308
Reid Spencer30d0c582007-01-15 00:26:18 +00001309} // End anonymous namespace
1310
Reid Spencerb6673a92007-01-15 02:41:46 +00001311// This function is used by the Lexer to create a Type. It can't be
Reid Spencer30d0c582007-01-15 00:26:18 +00001312// in the anonymous namespace.
Reid Spencerb6673a92007-01-15 02:41:46 +00001313const Type* getType(const std::string& newTy, TypeIDs oldTy) {
1314 return Type::get(newTy, oldTy);
Reid Spencer30d0c582007-01-15 00:26:18 +00001315}
1316
1317
Reid Spencer319a7302007-01-05 17:20:02 +00001318
1319/* Enabling traces. */
1320#ifndef YYDEBUG
1321# define YYDEBUG 0
1322#endif
1323
1324/* Enabling verbose error messages. */
1325#ifdef YYERROR_VERBOSE
1326# undef YYERROR_VERBOSE
1327# define YYERROR_VERBOSE 1
1328#else
1329# define YYERROR_VERBOSE 0
1330#endif
1331
Jeff Cohenac2dca92007-01-21 19:30:52 +00001332#ifndef YYSTYPE
1333#line 971 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
1334typedef union {
Reid Spencere77e35e2006-12-01 20:26:20 +00001335 std::string* String;
Reid Spencerb6673a92007-01-15 02:41:46 +00001336 const Type* Ty;
1337 Value* Val;
1338 Constant* Const;
Reid Spencerf8483652006-12-02 15:16:01 +00001339 ValueList* ValList;
Reid Spencer52402b02007-01-02 05:45:11 +00001340 TypeList* TypeVec;
Jeff Cohenac2dca92007-01-21 19:30:52 +00001341} yystype;
1342/* Line 188 of /usr/local/share/bison/yacc.c. */
1343#line 1344 "UpgradeParser.tab.c"
1344# define YYSTYPE yystype
Reid Spencer319a7302007-01-05 17:20:02 +00001345# define YYSTYPE_IS_TRIVIAL 1
Reid Spencere7c3c602006-11-30 06:36:44 +00001346#endif
1347
Jeff Cohenac2dca92007-01-21 19:30:52 +00001348#ifndef YYLTYPE
1349typedef struct yyltype
1350{
1351 int first_line;
1352 int first_column;
1353 int last_line;
1354 int last_column;
1355} yyltype;
1356# define YYLTYPE yyltype
1357# define YYLTYPE_IS_TRIVIAL 1
1358#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001359
Reid Spencer319a7302007-01-05 17:20:02 +00001360/* Copy the second part of user declarations. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001361
1362
Jeff Cohenac2dca92007-01-21 19:30:52 +00001363/* Line 213 of /usr/local/share/bison/yacc.c. */
1364#line 1365 "UpgradeParser.tab.c"
Reid Spencer319a7302007-01-05 17:20:02 +00001365
1366#if ! defined (yyoverflow) || YYERROR_VERBOSE
1367
1368/* The parser invokes alloca or malloc; define the necessary symbols. */
1369
Jeff Cohenac2dca92007-01-21 19:30:52 +00001370# if YYSTACK_USE_ALLOCA
1371# define YYSTACK_ALLOC alloca
1372# else
1373# ifndef YYSTACK_USE_ALLOCA
1374# if defined (alloca) || defined (_ALLOCA_H)
Reid Spencer319a7302007-01-05 17:20:02 +00001375# define YYSTACK_ALLOC alloca
Jeff Cohenac2dca92007-01-21 19:30:52 +00001376# else
1377# ifdef __GNUC__
1378# define YYSTACK_ALLOC __builtin_alloca
Reid Spencer319a7302007-01-05 17:20:02 +00001379# endif
1380# endif
1381# endif
1382# endif
1383
1384# ifdef YYSTACK_ALLOC
1385 /* Pacify GCC's `empty if-body' warning. */
1386# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
Reid Spencer319a7302007-01-05 17:20:02 +00001387# else
Jeff Cohenac2dca92007-01-21 19:30:52 +00001388# if defined (__STDC__) || defined (__cplusplus)
1389# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1390# define YYSIZE_T size_t
Reid Spencer319a7302007-01-05 17:20:02 +00001391# endif
Jeff Cohenac2dca92007-01-21 19:30:52 +00001392# define YYSTACK_ALLOC malloc
1393# define YYSTACK_FREE free
Reid Spencer319a7302007-01-05 17:20:02 +00001394# endif
1395#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1396
1397
1398#if (! defined (yyoverflow) \
1399 && (! defined (__cplusplus) \
Jeff Cohenac2dca92007-01-21 19:30:52 +00001400 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
Reid Spencer319a7302007-01-05 17:20:02 +00001401
1402/* A type that is properly aligned for any stack member. */
1403union yyalloc
1404{
Jeff Cohenac2dca92007-01-21 19:30:52 +00001405 short yyss;
Reid Spencer319a7302007-01-05 17:20:02 +00001406 YYSTYPE yyvs;
1407 };
1408
1409/* The size of the maximum gap between one aligned stack and the next. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001410# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
Reid Spencer319a7302007-01-05 17:20:02 +00001411
1412/* The size of an array large to enough to hold all stacks, each with
1413 N elements. */
1414# define YYSTACK_BYTES(N) \
Jeff Cohenac2dca92007-01-21 19:30:52 +00001415 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
1416 + YYSTACK_GAP_MAX)
Reid Spencer319a7302007-01-05 17:20:02 +00001417
1418/* Copy COUNT objects from FROM to TO. The source and destination do
1419 not overlap. */
1420# ifndef YYCOPY
Jeff Cohenac2dca92007-01-21 19:30:52 +00001421# if 1 < __GNUC__
Reid Spencer319a7302007-01-05 17:20:02 +00001422# define YYCOPY(To, From, Count) \
1423 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1424# else
1425# define YYCOPY(To, From, Count) \
1426 do \
1427 { \
Jeff Cohenac2dca92007-01-21 19:30:52 +00001428 register YYSIZE_T yyi; \
Reid Spencer319a7302007-01-05 17:20:02 +00001429 for (yyi = 0; yyi < (Count); yyi++) \
Jeff Cohenac2dca92007-01-21 19:30:52 +00001430 (To)[yyi] = (From)[yyi]; \
Reid Spencer319a7302007-01-05 17:20:02 +00001431 } \
1432 while (0)
1433# endif
1434# endif
1435
1436/* Relocate STACK from its old location to the new one. The
1437 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1438 elements in the stack, and YYPTR gives the new location of the
1439 stack. Advance YYPTR to a properly aligned location for the next
1440 stack. */
1441# define YYSTACK_RELOCATE(Stack) \
1442 do \
1443 { \
1444 YYSIZE_T yynewbytes; \
1445 YYCOPY (&yyptr->Stack, Stack, yysize); \
1446 Stack = &yyptr->Stack; \
Jeff Cohenac2dca92007-01-21 19:30:52 +00001447 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
Reid Spencer319a7302007-01-05 17:20:02 +00001448 yyptr += yynewbytes / sizeof (*yyptr); \
1449 } \
1450 while (0)
Reid Spencere7c3c602006-11-30 06:36:44 +00001451
1452#endif
1453
Reid Spencer319a7302007-01-05 17:20:02 +00001454#if defined (__STDC__) || defined (__cplusplus)
1455 typedef signed char yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001456#else
Jeff Cohenac2dca92007-01-21 19:30:52 +00001457 typedef short yysigned_char;
Reid Spencere7c3c602006-11-30 06:36:44 +00001458#endif
1459
Reid Spencer319a7302007-01-05 17:20:02 +00001460/* YYFINAL -- State number of the termination state. */
1461#define YYFINAL 4
Reid Spencerc4d96252007-01-13 00:03:30 +00001462#define YYLAST 1473
Reid Spencer319a7302007-01-05 17:20:02 +00001463
1464/* YYNTOKENS -- Number of terminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001465#define YYNTOKENS 164
Reid Spencer319a7302007-01-05 17:20:02 +00001466/* YYNNTS -- Number of nonterminals. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001467#define YYNNTS 76
Reid Spencer319a7302007-01-05 17:20:02 +00001468/* YYNRULES -- Number of rules. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001469#define YYNRULES 301
Reid Spencer319a7302007-01-05 17:20:02 +00001470/* YYNRULES -- Number of states. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001471#define YYNSTATES 585
Reid Spencer319a7302007-01-05 17:20:02 +00001472
1473/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1474#define YYUNDEFTOK 2
Reid Spencerc4d96252007-01-13 00:03:30 +00001475#define YYMAXUTOK 404
Reid Spencer319a7302007-01-05 17:20:02 +00001476
Jeff Cohenac2dca92007-01-21 19:30:52 +00001477#define YYTRANSLATE(X) \
1478 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
Reid Spencer319a7302007-01-05 17:20:02 +00001479
1480/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1481static const unsigned char yytranslate[] =
1482{
1483 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001487 153, 154, 162, 2, 151, 2, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001489 158, 150, 159, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001492 2, 155, 152, 157, 2, 2, 2, 2, 2, 163,
Reid Spencer319a7302007-01-05 17:20:02 +00001493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerc4d96252007-01-13 00:03:30 +00001495 156, 2, 2, 160, 2, 161, 2, 2, 2, 2,
Reid Spencer319a7302007-01-05 17:20:02 +00001496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1508 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1509 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1510 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1511 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1512 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1513 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1514 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1515 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1516 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1517 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1518 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1519 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1520 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1521 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1522 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Reid Spencerc4d96252007-01-13 00:03:30 +00001523 145, 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00001524};
1525
1526#if YYDEBUG
1527/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1528 YYRHS. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001529static const unsigned short yyprhs[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001530{
1531 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1532 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1533 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1534 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1535 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1536 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1537 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
1538 139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1539 159, 161, 164, 165, 167, 169, 171, 173, 175, 177,
1540 179, 180, 182, 184, 186, 188, 190, 192, 195, 196,
1541 197, 200, 201, 205, 208, 209, 211, 212, 216, 218,
1542 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
1543 241, 243, 245, 247, 249, 251, 253, 255, 257, 259,
1544 261, 264, 269, 275, 281, 285, 288, 294, 299, 302,
1545 304, 308, 310, 314, 316, 317, 322, 326, 330, 335,
1546 340, 344, 347, 350, 353, 356, 359, 362, 365, 368,
1547 371, 374, 381, 387, 396, 403, 410, 417, 425, 433,
1548 440, 447, 456, 465, 469, 471, 473, 475, 477, 480,
1549 483, 488, 491, 493, 495, 497, 502, 505, 510, 517,
1550 524, 531, 538, 542, 547, 548, 550, 552, 554, 558,
1551 562, 566, 570, 574, 578, 580, 581, 583, 585, 587,
1552 588, 591, 595, 597, 599, 603, 605, 606, 615, 617,
Reid Spencerc4d96252007-01-13 00:03:30 +00001553 619, 623, 625, 627, 631, 632, 634, 636, 637, 642,
1554 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
1555 665, 667, 673, 675, 677, 679, 681, 684, 687, 689,
1556 692, 695, 696, 698, 700, 702, 705, 708, 712, 722,
1557 732, 741, 756, 758, 760, 767, 773, 776, 783, 791,
1558 793, 797, 799, 800, 803, 805, 811, 817, 823, 830,
1559 837, 842, 847, 854, 859, 864, 871, 878, 881, 889,
1560 891, 894, 895, 897, 898, 902, 909, 913, 920, 923,
1561 928, 935
Reid Spencer319a7302007-01-05 17:20:02 +00001562};
1563
1564/* YYRHS -- A `-1'-separated list of the rules' RHS. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001565static const short yyrhs[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001566{
Reid Spencerc4d96252007-01-13 00:03:30 +00001567 198, 0, -1, 19, -1, 20, -1, 17, -1, 18,
1568 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1569 -1, 84, -1, 85, -1, 86, -1, 87, -1, 88,
1570 -1, 89, -1, 90, -1, 91, -1, 92, -1, 93,
1571 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1572 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1573 -1, 106, -1, 117, -1, 118, -1, 119, -1, 120,
1574 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1575 -1, 112, -1, 113, -1, 114, -1, 115, -1, 116,
1576 -1, 117, -1, 118, -1, 119, -1, 120, -1, 25,
1577 -1, 26, -1, 129, -1, 130, -1, 131, -1, 132,
1578 -1, 138, -1, 139, -1, 140, -1, 141, -1, 142,
1579 -1, 143, -1, 144, -1, 145, -1, 146, -1, 147,
1580 -1, 148, -1, 149, -1, 137, -1, 11, -1, 9,
Reid Spencer319a7302007-01-05 17:20:02 +00001581 -1, 7, -1, 5, -1, 12, -1, 10, -1, 8,
Reid Spencerc4d96252007-01-13 00:03:30 +00001582 -1, 6, -1, 174, -1, 175, -1, 13, -1, 14,
1583 -1, 207, 150, -1, -1, 42, -1, 43, -1, 44,
Reid Spencer319a7302007-01-05 17:20:02 +00001584 -1, 48, -1, 45, -1, 46, -1, 47, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001585 65, -1, 66, -1, 67, -1, 68, -1, 69, -1,
1586 70, -1, 64, 18, -1, -1, -1, 56, 18, -1,
1587 -1, 151, 56, 18, -1, 37, 30, -1, -1, 183,
1588 -1, -1, 151, 186, 185, -1, 183, -1, 56, 18,
1589 -1, 189, -1, 3, -1, 191, -1, 3, -1, 191,
Reid Spencer319a7302007-01-05 17:20:02 +00001590 -1, 4, -1, 5, -1, 6, -1, 7, -1, 8,
1591 -1, 9, -1, 10, -1, 11, -1, 12, -1, 13,
Reid Spencerc4d96252007-01-13 00:03:30 +00001592 -1, 14, -1, 15, -1, 16, -1, 222, -1, 190,
1593 -1, 152, 18, -1, 188, 153, 193, 154, -1, 155,
1594 18, 156, 191, 157, -1, 158, 18, 156, 191, 159,
1595 -1, 160, 192, 161, -1, 160, 161, -1, 158, 160,
1596 192, 161, 159, -1, 158, 160, 161, 159, -1, 191,
1597 162, -1, 191, -1, 192, 151, 191, -1, 192, -1,
1598 192, 151, 40, -1, 40, -1, -1, 189, 155, 196,
1599 157, -1, 189, 155, 157, -1, 189, 163, 30, -1,
1600 189, 158, 196, 159, -1, 189, 160, 196, 161, -1,
1601 189, 160, 161, -1, 189, 22, -1, 189, 23, -1,
1602 189, 222, -1, 189, 195, -1, 189, 24, -1, 174,
1603 166, -1, 175, 166, -1, 4, 25, -1, 4, 26,
1604 -1, 177, 21, -1, 173, 153, 194, 39, 189, 154,
1605 -1, 126, 153, 194, 237, 154, -1, 128, 153, 194,
1606 151, 194, 151, 194, 154, -1, 167, 153, 194, 151,
1607 194, 154, -1, 168, 153, 194, 151, 194, 154, -1,
1608 169, 153, 194, 151, 194, 154, -1, 99, 170, 153,
1609 194, 151, 194, 154, -1, 100, 171, 153, 194, 151,
1610 194, 154, -1, 172, 153, 194, 151, 194, 154, -1,
1611 134, 153, 194, 151, 194, 154, -1, 135, 153, 194,
1612 151, 194, 151, 194, 154, -1, 136, 153, 194, 151,
1613 194, 151, 194, 154, -1, 196, 151, 194, -1, 194,
1614 -1, 35, -1, 36, -1, 199, -1, 199, 216, -1,
1615 199, 218, -1, 199, 62, 61, 202, -1, 199, 31,
1616 -1, 201, -1, 49, -1, 57, -1, 201, 178, 27,
1617 187, -1, 201, 218, -1, 201, 62, 61, 202, -1,
1618 201, 178, 179, 197, 194, 185, -1, 201, 178, 200,
1619 197, 189, 185, -1, 201, 178, 45, 197, 189, 185,
1620 -1, 201, 178, 47, 197, 189, 185, -1, 201, 50,
1621 204, -1, 201, 58, 150, 205, -1, -1, 30, -1,
1622 55, -1, 54, -1, 52, 150, 203, -1, 53, 150,
1623 18, -1, 51, 150, 30, -1, 71, 150, 30, -1,
1624 155, 206, 157, -1, 206, 151, 30, -1, 30, -1,
1625 -1, 28, -1, 30, -1, 207, -1, -1, 189, 208,
1626 -1, 210, 151, 209, -1, 209, -1, 210, -1, 210,
1627 151, 40, -1, 40, -1, -1, 180, 187, 207, 153,
1628 211, 154, 184, 181, -1, 32, -1, 160, -1, 179,
1629 212, 213, -1, 33, -1, 161, -1, 214, 225, 215,
1630 -1, -1, 45, -1, 47, -1, -1, 34, 219, 217,
1631 212, -1, -1, 63, -1, 17, -1, 18, -1, 21,
1632 -1, 25, -1, 26, -1, 22, -1, 23, -1, 24,
1633 -1, 158, 196, 159, -1, 195, -1, 61, 220, 30,
1634 151, 30, -1, 165, -1, 207, -1, 222, -1, 221,
1635 -1, 189, 223, -1, 225, 226, -1, 226, -1, 227,
1636 229, -1, 227, 231, -1, -1, 29, -1, 77, -1,
1637 76, -1, 72, 224, -1, 72, 3, -1, 73, 15,
1638 223, -1, 73, 4, 223, 151, 15, 223, 151, 15,
1639 223, -1, 74, 176, 223, 151, 15, 223, 155, 230,
1640 157, -1, 74, 176, 223, 151, 15, 223, 155, 157,
1641 -1, 178, 75, 180, 187, 223, 153, 234, 154, 39,
1642 15, 223, 228, 15, 223, -1, 228, -1, 78, -1,
1643 230, 176, 221, 151, 15, 223, -1, 176, 221, 151,
1644 15, 223, -1, 178, 236, -1, 189, 155, 223, 151,
1645 223, 157, -1, 232, 151, 155, 223, 151, 223, 157,
1646 -1, 224, -1, 233, 151, 224, -1, 233, -1, -1,
1647 60, 59, -1, 59, -1, 167, 189, 223, 151, 223,
1648 -1, 168, 189, 223, 151, 223, -1, 169, 189, 223,
1649 151, 223, -1, 99, 170, 189, 223, 151, 223, -1,
1650 100, 171, 189, 223, 151, 223, -1, 172, 224, 151,
1651 224, -1, 173, 224, 39, 189, -1, 128, 224, 151,
1652 224, 151, 224, -1, 133, 224, 151, 189, -1, 134,
1653 224, 151, 224, -1, 135, 224, 151, 224, 151, 224,
1654 -1, 136, 224, 151, 224, 151, 224, -1, 127, 232,
1655 -1, 235, 180, 187, 223, 153, 234, 154, -1, 239,
1656 -1, 151, 233, -1, -1, 38, -1, -1, 121, 189,
1657 182, -1, 121, 189, 151, 10, 223, 182, -1, 122,
1658 189, 182, -1, 122, 189, 151, 10, 223, 182, -1,
1659 123, 224, -1, 238, 124, 189, 223, -1, 238, 125,
1660 224, 151, 189, 223, -1, 126, 189, 223, 237, -1
Reid Spencer319a7302007-01-05 17:20:02 +00001661};
1662
1663/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001664static const unsigned short yyrline[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001665{
Reid Spencerb6673a92007-01-15 02:41:46 +00001666 0, 1036, 1036, 1036, 1037, 1037, 1041, 1041, 1041, 1041,
1667 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1043, 1043, 1043,
1668 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045,
1669 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046,
1670 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047,
1671 1047, 1047, 1048, 1048, 1048, 1048, 1049, 1049, 1049, 1049,
Jeff Cohenac2dca92007-01-21 19:30:52 +00001672 1049, 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1055,
Reid Spencerb6673a92007-01-15 02:41:46 +00001673 1055, 1055, 1055, 1056, 1056, 1056, 1056, 1057, 1057, 1058,
1674 1058, 1061, 1064, 1069, 1069, 1069, 1069, 1069, 1069, 1070,
1675 1071, 1074, 1074, 1074, 1074, 1074, 1075, 1076, 1081, 1086,
1676 1087, 1090, 1091, 1099, 1105, 1106, 1109, 1110, 1119, 1120,
1677 1133, 1133, 1134, 1134, 1135, 1139, 1139, 1139, 1139, 1139,
1678 1139, 1139, 1140, 1140, 1140, 1140, 1140, 1142, 1145, 1148,
1679 1151, 1155, 1168, 1174, 1180, 1190, 1193, 1203, 1206, 1214,
1680 1218, 1225, 1226, 1231, 1236, 1246, 1253, 1259, 1266, 1273,
1681 1280, 1286, 1293, 1300, 1308, 1315, 1322, 1329, 1336, 1343,
1682 1350, 1358, 1372, 1384, 1389, 1395, 1400, 1406, 1411, 1416,
1683 1424, 1429, 1434, 1444, 1449, 1454, 1454, 1464, 1469, 1472,
Jeff Cohenac2dca92007-01-21 19:30:52 +00001684 1477, 1481, 1485, 1488, 1488, 1491, 1501, 1506, 1511, 1521,
1685 1531, 1541, 1551, 1556, 1561, 1566, 1568, 1568, 1571, 1576,
1686 1583, 1588, 1595, 1602, 1607, 1608, 1616, 1616, 1617, 1617,
1687 1619, 1628, 1632, 1636, 1639, 1644, 1647, 1650, 1673, 1674,
1688 1678, 1689, 1690, 1692, 1701, 1702, 1703, 1707, 1707, 1721,
1689 1722, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1726, 1727,
1690 1732, 1733, 1742, 1742, 1746, 1752, 1763, 1772, 1775, 1783,
1691 1787, 1792, 1795, 1801, 1801, 1803, 1808, 1813, 1818, 1826,
1692 1836, 1845, 1867, 1872, 1878, 1884, 1892, 1910, 1919, 1929,
1693 1933, 1940, 1941, 1945, 1950, 1953, 1964, 1974, 1985, 1995,
1694 2005, 2016, 2046, 2055, 2062, 2071, 2078, 2085, 2091, 2142,
1695 2147, 2148, 2152, 2153, 2156, 2165, 2175, 2184, 2195, 2202,
1696 2213, 2224
Reid Spencer319a7302007-01-05 17:20:02 +00001697};
1698#endif
1699
Jeff Cohenac2dca92007-01-21 19:30:52 +00001700#if YYDEBUG || YYERROR_VERBOSE
1701/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
Reid Spencer319a7302007-01-05 17:20:02 +00001702 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1703static const char *const yytname[] =
1704{
Jeff Cohenac2dca92007-01-21 19:30:52 +00001705 "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT",
1706 "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "LABEL",
1707 "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL", "FPVAL",
1708 "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "TYPE",
1709 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", "BEGINTOK",
1710 "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1711 "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK", "DLLIMPORT",
1712 "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "EXTERNAL", "TARGET", "TRIPLE",
1713 "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "UNINITIALIZED",
1714 "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK",
1715 "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK",
1716 "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR",
1717 "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1718 "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM", "SREM", "FREM",
1719 "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ",
1720 "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "OEQ",
1721 "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "ULT",
1722 "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1723 "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR",
1724 "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST",
1725 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI",
1726 "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','",
1727 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1728 "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps",
1729 "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps",
1730 "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1731 "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign",
1732 "SectionString", "OptSection", "GlobalVarAttributes",
1733 "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType",
1734 "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr",
1735 "ConstVector", "GlobalType", "Module", "DefinitionList", "External",
1736 "ConstPool", "AsmBlock", "BigOrLittle", "TargetDefinition",
1737 "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal",
1738 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1739 "END", "Function", "FnDeclareLinkage", "FunctionProto", "@1",
1740 "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1741 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1742 "Unwind", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1743 "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList",
1744 "OptVolatile", "MemoryInst", 0
Reid Spencer319a7302007-01-05 17:20:02 +00001745};
1746#endif
1747
1748# ifdef YYPRINT
1749/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1750 token YYLEX-NUM. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001751static const unsigned short yytoknum[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001752{
1753 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1754 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1755 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1756 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1757 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1758 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1759 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1760 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1761 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1762 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1763 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1764 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1765 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1766 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1767 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Reid Spencerc4d96252007-01-13 00:03:30 +00001768 61, 44, 92, 40, 41, 91, 120, 93, 60, 62,
1769 123, 125, 42, 99
Reid Spencer319a7302007-01-05 17:20:02 +00001770};
1771# endif
1772
1773/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1774static const unsigned char yyr1[] =
1775{
Reid Spencerc4d96252007-01-13 00:03:30 +00001776 0, 164, 165, 165, 166, 166, 167, 167, 167, 167,
1777 167, 167, 167, 167, 167, 167, 167, 168, 168, 168,
1778 169, 169, 169, 169, 169, 169, 170, 170, 170, 170,
Reid Spencer319a7302007-01-05 17:20:02 +00001779 170, 170, 170, 170, 170, 170, 171, 171, 171, 171,
Reid Spencerc4d96252007-01-13 00:03:30 +00001780 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1781 171, 171, 172, 172, 172, 172, 173, 173, 173, 173,
1782 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1783 174, 174, 174, 175, 175, 175, 175, 176, 176, 177,
1784 177, 178, 178, 179, 179, 179, 179, 179, 179, 179,
1785 179, 180, 180, 180, 180, 180, 180, 180, 180, 181,
1786 181, 182, 182, 183, 184, 184, 185, 185, 186, 186,
1787 187, 187, 188, 188, 189, 190, 190, 190, 190, 190,
1788 190, 190, 190, 190, 190, 190, 190, 191, 191, 191,
1789 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1790 192, 193, 193, 193, 193, 194, 194, 194, 194, 194,
1791 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
1792 194, 195, 195, 195, 195, 195, 195, 195, 195, 195,
1793 195, 195, 195, 196, 196, 197, 197, 198, 199, 199,
1794 199, 199, 199, 200, 200, 201, 201, 201, 201, 201,
1795 201, 201, 201, 201, 201, 202, 203, 203, 204, 204,
1796 204, 204, 205, 206, 206, 206, 207, 207, 208, 208,
1797 209, 210, 210, 211, 211, 211, 211, 212, 213, 213,
1798 214, 215, 215, 216, 217, 217, 217, 219, 218, 220,
1799 220, 221, 221, 221, 221, 221, 221, 221, 221, 221,
1800 221, 221, 222, 222, 223, 223, 224, 225, 225, 226,
1801 227, 227, 227, 228, 228, 229, 229, 229, 229, 229,
1802 229, 229, 229, 229, 230, 230, 231, 232, 232, 233,
1803 233, 234, 234, 235, 235, 236, 236, 236, 236, 236,
1804 236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1805 237, 237, 238, 238, 239, 239, 239, 239, 239, 239,
1806 239, 239
Reid Spencer319a7302007-01-05 17:20:02 +00001807};
1808
1809/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1810static const unsigned char yyr2[] =
1811{
1812 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1813 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1814 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1815 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1816 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1817 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1818 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1819 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1820 1, 2, 0, 1, 1, 1, 1, 1, 1, 1,
1821 0, 1, 1, 1, 1, 1, 1, 2, 0, 0,
1822 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
1823 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1824 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1825 2, 4, 5, 5, 3, 2, 5, 4, 2, 1,
1826 3, 1, 3, 1, 0, 4, 3, 3, 4, 4,
1827 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1828 2, 6, 5, 8, 6, 6, 6, 7, 7, 6,
1829 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
1830 4, 2, 1, 1, 1, 4, 2, 4, 6, 6,
1831 6, 6, 3, 4, 0, 1, 1, 1, 3, 3,
1832 3, 3, 3, 3, 1, 0, 1, 1, 1, 0,
1833 2, 3, 1, 1, 3, 1, 0, 8, 1, 1,
Reid Spencerc4d96252007-01-13 00:03:30 +00001834 3, 1, 1, 3, 0, 1, 1, 0, 4, 0,
1835 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1836 1, 5, 1, 1, 1, 1, 2, 2, 1, 2,
1837 2, 0, 1, 1, 1, 2, 2, 3, 9, 9,
1838 8, 14, 1, 1, 6, 5, 2, 6, 7, 1,
1839 3, 1, 0, 2, 1, 5, 5, 5, 6, 6,
1840 4, 4, 6, 4, 4, 6, 6, 2, 7, 1,
1841 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
1842 6, 4
Reid Spencer319a7302007-01-05 17:20:02 +00001843};
1844
1845/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1846 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1847 means the default is an error. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001848static const unsigned short yydefact[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001849{
Reid Spencerc4d96252007-01-13 00:03:30 +00001850 194, 0, 90, 182, 1, 181, 227, 83, 84, 85,
1851 87, 88, 89, 86, 0, 98, 251, 178, 179, 206,
1852 207, 0, 0, 0, 90, 0, 186, 224, 0, 0,
1853 91, 92, 93, 94, 95, 96, 0, 0, 252, 251,
1854 248, 82, 0, 0, 0, 0, 192, 0, 0, 0,
1855 0, 0, 183, 184, 0, 0, 81, 225, 226, 98,
Reid Spencer319a7302007-01-05 17:20:02 +00001856 195, 180, 97, 111, 115, 116, 117, 118, 119, 120,
1857 121, 122, 123, 124, 125, 126, 127, 2, 3, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001858 0, 0, 0, 242, 0, 0, 110, 129, 114, 243,
1859 128, 218, 219, 220, 221, 222, 223, 247, 0, 0,
1860 0, 254, 253, 263, 293, 262, 249, 250, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001861 0, 0, 205, 193, 187, 185, 175, 176, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001862 0, 0, 228, 130, 0, 0, 0, 113, 135, 139,
1863 0, 0, 144, 138, 256, 0, 255, 0, 0, 72,
1864 76, 71, 75, 70, 74, 69, 73, 77, 78, 0,
1865 292, 274, 0, 98, 6, 7, 8, 9, 10, 11,
1866 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1867 22, 23, 24, 25, 0, 0, 0, 0, 0, 0,
1868 0, 0, 52, 53, 54, 55, 0, 0, 0, 0,
1869 68, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1870 65, 66, 67, 0, 0, 0, 0, 0, 98, 266,
1871 0, 289, 200, 197, 196, 198, 199, 201, 204, 0,
1872 106, 106, 115, 116, 117, 118, 119, 120, 121, 122,
1873 123, 124, 125, 0, 0, 0, 0, 106, 106, 0,
1874 0, 0, 0, 0, 134, 216, 143, 141, 0, 231,
1875 232, 233, 236, 237, 238, 234, 235, 229, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001876 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001877 0, 240, 245, 244, 246, 0, 257, 0, 273, 0,
1878 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1879 0, 50, 51, 36, 37, 38, 39, 40, 41, 42,
1880 43, 44, 45, 46, 47, 48, 49, 0, 101, 101,
1881 298, 0, 0, 287, 0, 0, 0, 0, 0, 0,
1882 0, 0, 0, 0, 0, 0, 0, 0, 202, 0,
1883 190, 191, 158, 159, 4, 5, 156, 157, 160, 151,
1884 152, 155, 0, 0, 0, 0, 154, 153, 188, 189,
1885 112, 112, 137, 0, 140, 215, 209, 212, 213, 0,
1886 0, 131, 230, 0, 0, 0, 0, 0, 0, 0,
1887 0, 174, 0, 0, 0, 0, 0, 0, 0, 0,
1888 0, 0, 0, 0, 294, 0, 296, 291, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00001889 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00001890 0, 0, 0, 203, 0, 0, 108, 106, 146, 0,
1891 0, 150, 0, 147, 132, 133, 136, 208, 210, 0,
1892 104, 142, 0, 0, 0, 291, 0, 0, 0, 0,
1893 0, 239, 0, 0, 0, 0, 0, 0, 0, 0,
1894 0, 0, 0, 0, 0, 0, 301, 0, 0, 0,
1895 283, 284, 0, 0, 0, 0, 0, 280, 281, 0,
1896 299, 0, 103, 109, 107, 145, 148, 149, 214, 211,
1897 105, 99, 0, 0, 0, 0, 0, 0, 0, 0,
1898 173, 0, 0, 0, 0, 0, 0, 0, 272, 0,
1899 0, 101, 102, 101, 269, 290, 0, 0, 0, 0,
1900 0, 275, 276, 277, 272, 0, 0, 217, 241, 0,
1901 0, 162, 0, 0, 0, 0, 0, 0, 0, 0,
1902 0, 0, 0, 271, 0, 278, 279, 0, 295, 297,
1903 0, 0, 0, 282, 285, 286, 0, 300, 100, 0,
1904 0, 0, 170, 0, 0, 164, 165, 166, 169, 161,
1905 0, 260, 0, 0, 0, 270, 267, 0, 288, 167,
1906 168, 0, 0, 0, 258, 0, 259, 0, 0, 268,
1907 163, 171, 172, 0, 0, 0, 0, 0, 0, 265,
1908 0, 0, 264, 0, 261
Reid Spencer319a7302007-01-05 17:20:02 +00001909};
1910
1911/* YYDEFGOTO[NTERM-NUM]. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001912static const short yydefgoto[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001913{
Reid Spencerc4d96252007-01-13 00:03:30 +00001914 -1, 83, 336, 266, 267, 268, 290, 307, 269, 270,
1915 233, 234, 149, 235, 24, 15, 36, 507, 384, 406,
1916 471, 330, 407, 84, 85, 236, 87, 88, 130, 248,
1917 371, 271, 372, 118, 1, 2, 55, 3, 61, 215,
1918 46, 113, 219, 89, 418, 357, 358, 359, 37, 93,
1919 16, 96, 17, 59, 18, 27, 363, 272, 90, 274,
1920 494, 39, 40, 41, 105, 106, 553, 107, 313, 523,
1921 524, 208, 209, 446, 210, 211
Reid Spencer319a7302007-01-05 17:20:02 +00001922};
1923
1924/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1925 STATE-NUM. */
Reid Spencerc4d96252007-01-13 00:03:30 +00001926#define YYPACT_NINF -537
Jeff Cohenac2dca92007-01-21 19:30:52 +00001927static const short yypact[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001928{
Reid Spencerc4d96252007-01-13 00:03:30 +00001929 -537, 75, 61, 1145, -537, -537, -537, -537, -537, -537,
1930 -537, -537, -537, -537, 18, 180, 55, -537, -537, -537,
1931 -537, -28, -61, 33, 130, -40, -537, 102, 87, 117,
1932 -537, -537, -537, -537, -537, -537, 838, -24, -537, -15,
1933 -537, 48, -11, -2, 6, 12, -537, 11, 87, 838,
1934 -9, -9, -537, -537, -9, -9, -537, -537, -537, 180,
1935 -537, -537, -537, 32, -537, -537, -537, -537, -537, -537,
1936 -537, -537, -537, -537, -537, -537, -537, -537, -537, 164,
1937 171, -6, 512, -537, 135, 41, -537, -537, -103, -537,
1938 -537, -537, -537, -537, -537, -537, -537, -537, 883, 45,
1939 192, -537, -537, -537, 1324, -537, -537, -537, 175, 126,
1940 190, 188, 203, -537, -537, -537, -537, -537, 911, 911,
1941 957, 911, -537, -537, 81, 97, 561, -537, -537, -103,
1942 -109, 121, 641, -537, 32, 1140, -537, 1140, 1140, -537,
1943 -537, -537, -537, -537, -537, -537, -537, -537, -537, 1140,
1944 -537, -537, 219, 180, -537, -537, -537, -537, -537, -537,
1945 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1946 -537, -537, -537, -537, 10, 112, 911, 911, 911, 911,
1947 911, 911, -537, -537, -537, -537, 911, 911, 911, 911,
1948 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1949 -537, -537, -537, 911, 911, 911, 911, 911, 180, -537,
1950 59, -537, -537, -537, -537, -537, -537, -537, -537, -71,
1951 129, 129, 167, 193, 195, 218, 222, 224, 234, 243,
1952 250, 261, 263, 252, 252, 264, 993, 129, 129, 911,
1953 911, 127, -97, 911, -537, 680, -537, 136, 137, -537,
1954 -537, -537, -537, -537, -537, -537, -537, 229, 10, 112,
1955 140, 141, 144, 145, 146, 957, 147, 148, 150, 154,
1956 155, -537, -537, -537, -537, 158, -537, 160, -537, 838,
1957 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1958 911, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1959 -537, -537, -537, -537, -537, -537, -537, 911, 163, 165,
1960 -537, 1140, 162, 169, 170, 172, 173, 174, 176, 1140,
1961 1140, 1140, 177, 276, 838, 911, 911, 288, -537, -8,
1962 -537, -537, -537, -537, -537, -537, -537, -537, -537, -537,
1963 -537, -537, 724, 957, 590, 292, -537, -537, -537, -537,
1964 -106, -104, -537, 179, -103, -537, 135, -537, 178, 181,
1965 752, -537, -537, 296, 183, 187, 957, 957, 957, 957,
1966 957, -537, -131, 957, 957, 957, 957, 957, 315, 316,
1967 1140, 1140, 1140, 1, -537, 7, -537, 191, 1140, 186,
1968 911, 911, 911, 911, 911, 194, 197, 201, 911, 911,
1969 1140, 1140, 202, -537, 304, 326, -537, 129, -537, -60,
1970 -78, -537, -74, -537, -537, -537, -537, -537, -537, 799,
1971 309, -537, 208, 957, 957, 191, 210, 213, 223, 225,
1972 957, -537, 230, 231, 235, 236, 308, 1140, 1140, 227,
1973 237, 238, 1140, 357, 1140, 911, -537, 239, 1140, 241,
1974 -537, -537, 242, 244, 1140, 1140, 1140, -537, -537, 248,
1975 -537, 911, -537, -537, -537, -537, -537, -537, -537, -537,
1976 -537, 338, 366, 246, 251, 249, 957, 957, 957, 957,
1977 -537, 957, 957, 957, 957, 911, 253, 258, 911, 1140,
1978 1140, 254, -537, 254, -537, 255, 1140, 256, 911, 911,
1979 911, -537, -537, -537, 911, 1140, 390, -537, -537, 957,
1980 957, -537, 265, 260, 266, 267, 268, 272, 274, 275,
1981 277, 400, 29, 255, 280, -537, -537, 363, -537, -537,
1982 911, 278, 1140, -537, -537, -537, 282, -537, -537, 283,
1983 287, 957, -537, 957, 957, -537, -537, -537, -537, -537,
1984 1140, -537, 1229, 60, 381, -537, -537, 286, -537, -537,
1985 -537, 290, 293, 294, -537, 270, -537, 1229, 435, -537,
1986 -537, -537, -537, 436, 302, 1140, 1140, 441, 196, -537,
1987 1140, 442, -537, 1140, -537
Reid Spencer319a7302007-01-05 17:20:02 +00001988};
1989
1990/* YYPGOTO[NTERM-NUM]. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00001991static const short yypgoto[] =
Reid Spencer319a7302007-01-05 17:20:02 +00001992{
Reid Spencerc4d96252007-01-13 00:03:30 +00001993 -537, -537, 226, 361, 362, 365, 209, 214, 368, 370,
1994 -99, -98, -507, -537, 420, 452, -134, -537, -303, 57,
1995 -537, -216, -537, -45, -537, -36, -537, -79, -30, -537,
1996 -111, 245, -210, 104, -537, -537, -537, -537, 431, -537,
1997 -537, -537, -537, 4, -537, 63, -537, -537, 421, -537,
1998 -537, -537, -537, -537, 480, -537, -537, -536, -105, 58,
1999 -88, -537, 445, -537, -93, -537, -537, -537, -537, 42,
2000 -18, -537, -537, 64, -537, -537
Reid Spencer319a7302007-01-05 17:20:02 +00002001};
2002
2003/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2004 positive, shift that token. If negative, reduce the rule which
2005 number is the opposite. If zero, do what YYDEFACT says.
Jeff Cohenac2dca92007-01-21 19:30:52 +00002006 If YYTABLE_NINF, parse error. */
Reid Spencer319a7302007-01-05 17:20:02 +00002007#define YYTABLE_NINF -178
Jeff Cohenac2dca92007-01-21 19:30:52 +00002008static const short yytable[] =
Reid Spencer319a7302007-01-05 17:20:02 +00002009{
Reid Spencerc4d96252007-01-13 00:03:30 +00002010 86, 147, 148, 129, 115, 331, 386, 25, 91, 237,
2011 136, 442, 125, 86, 38, 552, 565, 444, 94, 279,
2012 430, 348, 349, 42, 43, 44, 116, 117, 431, 404,
2013 273, 574, 273, 273, 139, 140, 141, 142, 143, 144,
2014 145, 146, 243, 45, 273, 25, 567, 129, 405, 137,
2015 -112, 414, 244, 129, 243, 415, 133, 443, 133, 133,
2016 138, -177, 135, 443, 353, 139, 140, 141, 142, 143,
2017 144, 145, 146, 430, 324, 4, 19, 430, 20, 28,
2018 327, 466, 220, 221, 38, 238, 328, 467, 131, 47,
2019 310, 430, 5, 314, 48, 6, 242, 465, 315, 316,
2020 317, 318, 247, 7, 8, 9, 10, 11, 12, 13,
2021 56, 280, 281, 282, 283, 284, 285, 60, 322, 323,
2022 98, 99, 100, 14, 101, 102, 103, 286, 287, 288,
2023 289, 347, 409, 410, 412, 62, 92, 291, 292, 108,
2024 308, 309, 135, 311, 312, 135, 95, 57, 109, 58,
2025 135, 135, 135, 135, 126, 119, 110, 49, 120, 121,
2026 350, 351, 111, 19, 354, 20, 112, 319, 320, 321,
2027 135, 135, 7, 8, 9, 50, 11, 51, 13, 52,
2028 213, 214, 123, 325, 326, -113, 551, 53, 528, 124,
2029 529, 464, 332, 333, 132, 275, 276, 139, 140, 141,
2030 142, 143, 144, 145, 146, 212, 273, 277, 216, 356,
2031 -72, -72, -76, -76, 273, 273, 273, 566, 217, 293,
2032 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
2033 304, 305, 306, 218, 380, -71, -71, 239, 402, -75,
2034 -75, -70, -70, 86, 29, 30, 31, 32, 33, 34,
2035 35, -74, -74, 240, 381, 425, 426, 427, 428, 429,
2036 -69, -69, 432, 433, 434, 435, 436, -73, -73, 334,
2037 335, 382, 101, 102, 245, 273, 273, 273, 278, 400,
2038 329, 354, -79, 273, -80, 338, 352, 360, 86, 401,
2039 135, 361, 362, 366, 367, 273, 273, 368, 369, 370,
2040 373, 374, 449, 375, 451, 452, 453, 376, 377, 378,
2041 457, 379, 473, 474, 383, 399, 385, 388, 403, 480,
2042 389, 390, 413, 391, 392, 393, 422, 394, 398, 419,
2043 437, 438, 273, 273, 462, 420, 423, 273, 416, 273,
2044 424, 448, 445, 273, 463, 454, 404, 485, 455, 273,
2045 273, 273, 456, 461, 135, 450, 135, 135, 135, 472,
2046 417, 476, 135, 458, 477, 512, 513, 514, 515, 387,
2047 516, 517, 518, 519, 478, 492, 479, 395, 396, 397,
2048 488, 481, 482, 356, 273, 273, 483, 484, 489, 490,
2049 496, 273, 498, 499, 506, 500, 508, 509, 539, 540,
2050 273, 504, 510, 511, 521, 527, 530, 532, 538, 135,
2051 533, 534, 535, 522, 542, 550, 541, 543, 544, 443,
2052 568, 573, 545, 147, 148, 505, 546, 273, 547, 548,
2053 561, 549, 562, 563, 554, 556, 558, 559, 439, 440,
2054 441, 560, 555, 569, 570, 273, 447, 571, 572, 520,
2055 575, 576, 135, 577, 147, 148, 580, 583, 459, 460,
2056 337, 104, 135, 135, 135, 203, 204, 364, 135, 205,
2057 273, 273, 206, 365, 207, 273, 54, 470, 273, 114,
2058 122, 346, 469, 26, 97, 581, 536, 495, 0, 475,
2059 0, 0, 0, 0, 135, 486, 487, 0, 0, 0,
2060 491, 0, 493, 0, 0, 0, 497, 0, 0, 0,
2061 0, 0, 501, 502, 503, 127, 64, 65, 66, 67,
2062 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2063 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2064 19, 0, 20, 0, 0, 0, 0, 525, 526, 0,
2065 0, 0, 0, 0, 531, 0, 0, 0, 0, 0,
2066 0, 0, 0, 537, 127, 64, 65, 66, 67, 68,
2067 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2068 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2069 557, 20, 0, 127, 222, 223, 224, 225, 226, 227,
2070 228, 229, 230, 231, 232, 75, 76, 0, 564, 77,
2071 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2072 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2073 0, 0, 0, 578, 579, 0, 0, 0, 582, 0,
2074 0, 584, 0, 0, 127, 64, 65, 66, 67, 68,
2075 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2076 77, 78, 0, 0, 79, 0, 0, 80, 0, 19,
2077 81, 20, 82, 128, 0, 0, 0, 0, 0, 0,
2078 0, 246, 0, 127, 64, 65, 66, 67, 68, 69,
2079 70, 71, 72, 73, 74, 75, 76, 0, 0, 77,
2080 78, 0, 0, 0, 0, 0, 0, 0, 19, 0,
2081 20, 0, 0, 79, 0, 0, 80, 0, 0, 81,
2082 355, 82, 241, 0, 0, 0, 0, 127, 222, 223,
2083 224, 225, 226, 227, 228, 229, 230, 231, 232, 75,
2084 76, 0, 79, 77, 78, 80, 0, 0, 81, 0,
2085 82, 411, 19, 0, 20, 127, 64, 65, 66, 67,
2086 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
2087 0, 77, 78, 0, 0, 0, 0, 0, 0, 0,
2088 19, 0, 20, 0, 0, 0, 0, 0, 0, 0,
2089 0, 0, 421, 79, 0, 0, 80, 0, 0, 81,
2090 0, 82, 127, 64, 65, 66, 67, 68, 69, 70,
2091 71, 72, 73, 74, 75, 76, 0, 0, 77, 78,
2092 0, 0, 0, 0, 0, 0, 0, 19, 0, 20,
2093 0, 0, 79, 0, 0, 80, 0, 0, 81, 468,
2094 82, 63, 64, 65, 66, 67, 68, 69, 70, 71,
2095 72, 73, 74, 75, 76, 0, 0, 77, 78, 0,
2096 0, 0, 0, 0, 0, 0, 19, 0, 20, 0,
2097 0, 0, 0, 0, 0, 0, 79, 0, 0, 80,
2098 0, 408, 81, 0, 82, 0, 134, 64, 65, 66,
2099 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2100 0, 0, 77, 78, 79, 0, 0, 80, 0, 0,
2101 81, 19, 82, 20, 127, 64, 65, 66, 67, 68,
Reid Spencer319a7302007-01-05 17:20:02 +00002102 69, 70, 71, 72, 73, 74, 75, 76, 0, 0,
2103 77, 78, 0, 0, 0, 0, 0, 0, 0, 19,
2104 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002105 0, 79, 0, 0, 80, 0, 0, 81, 0, 82,
2106 127, 222, 223, 224, 225, 226, 227, 228, 229, 230,
2107 231, 232, 75, 76, 0, 0, 77, 78, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002108 0, 0, 0, 0, 0, 19, 0, 20, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002109 79, 0, 0, 80, 0, 0, 81, 0, 82, 0,
2110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2111 0, 0, 77, 78, 0, 339, 340, 341, 0, 0,
2112 0, 19, 0, 20, 0, 0, 0, 0, 0, 0,
2113 0, 0, 0, 0, 0, 79, 0, 0, 80, 0,
2114 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002116 0, 0, 0, 79, 0, 0, 80, 0, 0, 81,
Reid Spencerc4d96252007-01-13 00:03:30 +00002117 0, 82, 154, 155, 156, 157, 158, 159, 160, 161,
2118 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
2119 172, 173, 258, 259, 0, 0, 0, 0, 0, 0,
2120 0, 0, 0, 0, 0, 0, 0, 0, 0, 79,
2121 0, 0, 80, 0, 0, 81, 0, 82, 0, 260,
2122 0, 261, 182, 183, 184, 185, 0, 262, 263, 264,
2123 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
2124 200, 201, 202, 0, 0, 0, 0, 0, 342, 0,
2125 0, 343, 0, 344, 0, 0, 345, 249, 250, 77,
2126 78, 251, 252, 253, 254, 255, 256, 0, 19, 0,
2127 20, 0, -82, 19, 0, 20, 0, 0, 0, 6,
2128 -82, -82, 0, 0, 0, 0, 0, -82, -82, -82,
2129 -82, -82, -82, -82, -82, 21, 0, 0, 0, 0,
2130 0, 257, -82, 22, 0, 0, 0, 23, 0, 0,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 154,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002132 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
Reid Spencerc4d96252007-01-13 00:03:30 +00002133 165, 166, 167, 168, 169, 170, 171, 172, 173, 258,
2134 259, 0, 0, 0, 0, 0, 249, 250, 0, 0,
2135 251, 252, 253, 254, 255, 256, 0, 0, 0, 0,
2136 0, 0, 0, 0, 0, 0, 260, 0, 261, 182,
2137 183, 184, 185, 0, 262, 263, 264, 190, 191, 192,
2138 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
2139 257, 0, 0, 0, 0, 0, 0, 0, 265, 0,
2140 0, 0, 0, 0, 0, 0, 0, 0, 154, 155,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002141 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
Reid Spencerc4d96252007-01-13 00:03:30 +00002142 166, 167, 168, 169, 170, 171, 172, 173, 258, 259,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002145 0, 0, 0, 0, 0, 260, 0, 261, 182, 183,
2146 184, 185, 150, 262, 263, 264, 190, 191, 192, 193,
2147 194, 195, 196, 197, 198, 199, 200, 201, 202, 0,
2148 0, 0, 0, 151, 152, 0, 0, 265, 0, 0,
2149 0, 0, 0, 0, 0, 0, 0, 0, 0, 153,
2150 0, 0, 0, 154, 155, 156, 157, 158, 159, 160,
2151 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
2152 171, 172, 173, 174, 175, 0, 0, 0, 0, 0,
Reid Spencer319a7302007-01-05 17:20:02 +00002153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerc4d96252007-01-13 00:03:30 +00002154 0, 0, 0, 0, 0, 176, 177, 178, 0, 0,
2155 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2156 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2157 199, 200, 201, 202
Reid Spencer319a7302007-01-05 17:20:02 +00002158};
2159
Jeff Cohenac2dca92007-01-21 19:30:52 +00002160static const short yycheck[] =
Reid Spencer319a7302007-01-05 17:20:02 +00002161{
Reid Spencerc4d96252007-01-13 00:03:30 +00002162 36, 100, 100, 82, 49, 221, 309, 3, 32, 120,
2163 98, 10, 18, 49, 29, 522, 552, 10, 33, 153,
2164 151, 237, 238, 51, 52, 53, 35, 36, 159, 37,
2165 135, 567, 137, 138, 5, 6, 7, 8, 9, 10,
2166 11, 12, 151, 71, 149, 41, 553, 126, 56, 4,
2167 153, 157, 161, 132, 151, 159, 162, 56, 162, 162,
2168 15, 0, 98, 56, 161, 5, 6, 7, 8, 9,
2169 10, 11, 12, 151, 208, 0, 28, 151, 30, 61,
2170 151, 159, 118, 119, 29, 121, 157, 161, 84, 150,
2171 178, 151, 31, 181, 61, 34, 126, 157, 186, 187,
2172 188, 189, 132, 42, 43, 44, 45, 46, 47, 48,
2173 150, 101, 102, 103, 104, 105, 106, 30, 206, 207,
2174 72, 73, 74, 62, 76, 77, 78, 117, 118, 119,
2175 120, 236, 342, 343, 344, 18, 160, 25, 26, 150,
2176 176, 177, 178, 179, 180, 181, 161, 45, 150, 47,
2177 186, 187, 188, 189, 160, 51, 150, 27, 54, 55,
2178 239, 240, 150, 28, 243, 30, 155, 203, 204, 205,
2179 206, 207, 42, 43, 44, 45, 46, 47, 48, 49,
2180 54, 55, 18, 124, 125, 153, 157, 57, 491, 18,
2181 493, 407, 25, 26, 153, 137, 138, 5, 6, 7,
2182 8, 9, 10, 11, 12, 30, 311, 149, 18, 245,
2183 17, 18, 17, 18, 319, 320, 321, 157, 30, 107,
2184 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2185 118, 119, 120, 30, 279, 17, 18, 156, 326, 17,
2186 18, 17, 18, 279, 64, 65, 66, 67, 68, 69,
2187 70, 17, 18, 156, 290, 366, 367, 368, 369, 370,
2188 17, 18, 373, 374, 375, 376, 377, 17, 18, 17,
2189 18, 307, 76, 77, 153, 380, 381, 382, 59, 324,
2190 151, 360, 21, 388, 21, 21, 159, 151, 324, 325,
2191 326, 154, 63, 153, 153, 400, 401, 153, 153, 153,
2192 153, 153, 390, 153, 392, 393, 394, 153, 153, 151,
2193 398, 151, 423, 424, 151, 39, 151, 155, 30, 430,
2194 151, 151, 30, 151, 151, 151, 30, 151, 151, 151,
2195 15, 15, 437, 438, 30, 154, 153, 442, 159, 444,
2196 153, 155, 151, 448, 18, 151, 37, 39, 151, 454,
2197 455, 456, 151, 151, 390, 391, 392, 393, 394, 151,
2198 356, 151, 398, 399, 151, 476, 477, 478, 479, 311,
2199 481, 482, 483, 484, 151, 18, 151, 319, 320, 321,
2200 153, 151, 151, 419, 489, 490, 151, 151, 151, 151,
2201 151, 496, 151, 151, 56, 151, 30, 151, 509, 510,
2202 505, 153, 151, 154, 151, 151, 151, 151, 18, 445,
2203 498, 499, 500, 155, 154, 15, 151, 151, 151, 56,
2204 39, 151, 154, 522, 522, 461, 154, 532, 154, 154,
2205 541, 154, 543, 544, 154, 157, 154, 154, 380, 381,
2206 382, 154, 530, 157, 154, 550, 388, 154, 154, 485,
2207 15, 15, 488, 151, 553, 553, 15, 15, 400, 401,
2208 234, 41, 498, 499, 500, 104, 104, 258, 504, 104,
2209 575, 576, 104, 259, 104, 580, 24, 420, 583, 48,
2210 59, 236, 419, 3, 39, 578, 504, 445, -1, 425,
2211 -1, -1, -1, -1, 530, 437, 438, -1, -1, -1,
2212 442, -1, 444, -1, -1, -1, 448, -1, -1, -1,
2213 -1, -1, 454, 455, 456, 3, 4, 5, 6, 7,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002214 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002215 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2216 28, -1, 30, -1, -1, -1, -1, 489, 490, -1,
2217 -1, -1, -1, -1, 496, -1, -1, -1, -1, -1,
2218 -1, -1, -1, 505, 3, 4, 5, 6, 7, 8,
2219 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2220 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2221 532, 30, -1, 3, 4, 5, 6, 7, 8, 9,
2222 10, 11, 12, 13, 14, 15, 16, -1, 550, 19,
2223 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2224 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2225 -1, -1, -1, 575, 576, -1, -1, -1, 580, -1,
2226 -1, 583, -1, -1, 3, 4, 5, 6, 7, 8,
2227 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2228 19, 20, -1, -1, 152, -1, -1, 155, -1, 28,
2229 158, 30, 160, 161, -1, -1, -1, -1, -1, -1,
2230 -1, 40, -1, 3, 4, 5, 6, 7, 8, 9,
2231 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
2232 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
2233 30, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2234 40, 160, 161, -1, -1, -1, -1, 3, 4, 5,
2235 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
2236 16, -1, 152, 19, 20, 155, -1, -1, 158, -1,
2237 160, 161, 28, -1, 30, 3, 4, 5, 6, 7,
2238 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2239 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
2240 28, -1, 30, -1, -1, -1, -1, -1, -1, -1,
2241 -1, -1, 40, 152, -1, -1, 155, -1, -1, 158,
2242 -1, 160, 3, 4, 5, 6, 7, 8, 9, 10,
2243 11, 12, 13, 14, 15, 16, -1, -1, 19, 20,
2244 -1, -1, -1, -1, -1, -1, -1, 28, -1, 30,
2245 -1, -1, 152, -1, -1, 155, -1, -1, 158, 40,
2246 160, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2247 12, 13, 14, 15, 16, -1, -1, 19, 20, -1,
2248 -1, -1, -1, -1, -1, -1, 28, -1, 30, -1,
2249 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2250 -1, 157, 158, -1, 160, -1, 3, 4, 5, 6,
2251 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2252 -1, -1, 19, 20, 152, -1, -1, 155, -1, -1,
2253 158, 28, 160, 30, 3, 4, 5, 6, 7, 8,
Reid Spencer319a7302007-01-05 17:20:02 +00002254 9, 10, 11, 12, 13, 14, 15, 16, -1, -1,
2255 19, 20, -1, -1, -1, -1, -1, -1, -1, 28,
2256 -1, 30, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002257 -1, 152, -1, -1, 155, -1, -1, 158, -1, 160,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002258 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2259 13, 14, 15, 16, -1, -1, 19, 20, -1, -1,
2260 -1, -1, -1, -1, -1, 28, -1, 30, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002261 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002262 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002263 -1, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2264 -1, 28, -1, 30, -1, -1, -1, -1, -1, -1,
2265 -1, -1, -1, -1, -1, 152, -1, -1, 155, -1,
2266 -1, 158, -1, 160, -1, -1, -1, -1, -1, -1,
Reid Spencer319a7302007-01-05 17:20:02 +00002267 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002268 -1, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2269 -1, 160, 79, 80, 81, 82, 83, 84, 85, 86,
2270 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
2271 97, 98, 99, 100, -1, -1, -1, -1, -1, -1,
2272 -1, -1, -1, -1, -1, -1, -1, -1, -1, 152,
2273 -1, -1, 155, -1, -1, 158, -1, 160, -1, 126,
2274 -1, 128, 129, 130, 131, 132, -1, 134, 135, 136,
2275 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2276 147, 148, 149, -1, -1, -1, -1, -1, 155, -1,
2277 -1, 158, -1, 160, -1, -1, 163, 17, 18, 19,
2278 20, 21, 22, 23, 24, 25, 26, -1, 28, -1,
2279 30, -1, 27, 28, -1, 30, -1, -1, -1, 34,
2280 35, 36, -1, -1, -1, -1, -1, 42, 43, 44,
2281 45, 46, 47, 48, 49, 50, -1, -1, -1, -1,
2282 -1, 61, 57, 58, -1, -1, -1, 62, -1, -1,
2283 -1, -1, -1, -1, -1, -1, -1, -1, -1, 79,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002284 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2285 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
Reid Spencerc4d96252007-01-13 00:03:30 +00002286 100, -1, -1, -1, -1, -1, 17, 18, -1, -1,
2287 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
2288 -1, -1, -1, -1, -1, -1, 126, -1, 128, 129,
2289 130, 131, 132, -1, 134, 135, 136, 137, 138, 139,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002290 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
Reid Spencerc4d96252007-01-13 00:03:30 +00002291 61, -1, -1, -1, -1, -1, -1, -1, 158, -1,
2292 -1, -1, -1, -1, -1, -1, -1, -1, 79, 80,
2293 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2294 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2296 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002297 -1, -1, -1, -1, -1, 126, -1, 128, 129, 130,
2298 131, 132, 38, 134, 135, 136, 137, 138, 139, 140,
2299 141, 142, 143, 144, 145, 146, 147, 148, 149, -1,
2300 -1, -1, -1, 59, 60, -1, -1, 158, -1, -1,
2301 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2302 -1, -1, -1, 79, 80, 81, 82, 83, 84, 85,
2303 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2304 96, 97, 98, 99, 100, -1, -1, -1, -1, -1,
Reid Spencer609ca3e2007-01-12 20:10:51 +00002305 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencerc4d96252007-01-13 00:03:30 +00002306 -1, -1, -1, -1, -1, 121, 122, 123, -1, -1,
2307 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2308 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
2309 146, 147, 148, 149
Reid Spencer319a7302007-01-05 17:20:02 +00002310};
2311
2312/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2313 symbol of state STATE-NUM. */
2314static const unsigned char yystos[] =
2315{
Reid Spencerc4d96252007-01-13 00:03:30 +00002316 0, 198, 199, 201, 0, 31, 34, 42, 43, 44,
2317 45, 46, 47, 48, 62, 179, 214, 216, 218, 28,
2318 30, 50, 58, 62, 178, 207, 218, 219, 61, 64,
2319 65, 66, 67, 68, 69, 70, 180, 212, 29, 225,
2320 226, 227, 51, 52, 53, 71, 204, 150, 61, 27,
2321 45, 47, 49, 57, 179, 200, 150, 45, 47, 217,
2322 30, 202, 18, 3, 4, 5, 6, 7, 8, 9,
2323 10, 11, 12, 13, 14, 15, 16, 19, 20, 152,
2324 155, 158, 160, 165, 187, 188, 189, 190, 191, 207,
2325 222, 32, 160, 213, 33, 161, 215, 226, 72, 73,
2326 74, 76, 77, 78, 178, 228, 229, 231, 150, 150,
2327 150, 150, 155, 205, 202, 187, 35, 36, 197, 197,
2328 197, 197, 212, 18, 18, 18, 160, 3, 161, 191,
2329 192, 207, 153, 162, 3, 189, 224, 4, 15, 5,
2330 6, 7, 8, 9, 10, 11, 12, 174, 175, 176,
2331 38, 59, 60, 75, 79, 80, 81, 82, 83, 84,
2332 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2333 95, 96, 97, 98, 99, 100, 121, 122, 123, 126,
2334 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2335 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
2336 147, 148, 149, 167, 168, 169, 172, 173, 235, 236,
2337 238, 239, 30, 54, 55, 203, 18, 30, 30, 206,
2338 189, 189, 4, 5, 6, 7, 8, 9, 10, 11,
2339 12, 13, 14, 174, 175, 177, 189, 194, 189, 156,
2340 156, 161, 192, 151, 161, 153, 40, 192, 193, 17,
2341 18, 21, 22, 23, 24, 25, 26, 61, 99, 100,
2342 126, 128, 134, 135, 136, 158, 167, 168, 169, 172,
2343 173, 195, 221, 222, 223, 223, 223, 223, 59, 180,
2344 101, 102, 103, 104, 105, 106, 117, 118, 119, 120,
2345 170, 25, 26, 107, 108, 109, 110, 111, 112, 113,
2346 114, 115, 116, 117, 118, 119, 120, 171, 189, 189,
2347 224, 189, 189, 232, 224, 224, 224, 224, 224, 189,
2348 189, 189, 224, 224, 180, 124, 125, 151, 157, 151,
2349 185, 185, 25, 26, 17, 18, 166, 166, 21, 22,
2350 23, 24, 155, 158, 160, 163, 195, 222, 185, 185,
2351 191, 191, 159, 161, 191, 40, 189, 209, 210, 211,
2352 151, 154, 63, 220, 170, 171, 153, 153, 153, 153,
2353 153, 194, 196, 153, 153, 153, 153, 153, 151, 151,
2354 187, 189, 189, 151, 182, 151, 182, 223, 155, 151,
2355 151, 151, 151, 151, 151, 223, 223, 223, 151, 39,
2356 187, 189, 224, 30, 37, 56, 183, 186, 157, 196,
2357 196, 161, 196, 30, 157, 159, 159, 207, 208, 151,
2358 154, 40, 30, 153, 153, 194, 194, 194, 194, 194,
2359 151, 159, 194, 194, 194, 194, 194, 15, 15, 223,
2360 223, 223, 10, 56, 10, 151, 237, 223, 155, 224,
2361 189, 224, 224, 224, 151, 151, 151, 224, 189, 223,
2362 223, 151, 30, 18, 185, 157, 159, 161, 40, 209,
2363 183, 184, 151, 194, 194, 237, 151, 151, 151, 151,
2364 194, 151, 151, 151, 151, 39, 223, 223, 153, 151,
2365 151, 223, 18, 223, 224, 233, 151, 223, 151, 151,
2366 151, 223, 223, 223, 153, 189, 56, 181, 30, 151,
2367 151, 154, 194, 194, 194, 194, 194, 194, 194, 194,
2368 189, 151, 155, 233, 234, 223, 223, 151, 182, 182,
2369 151, 223, 151, 224, 224, 224, 234, 223, 18, 194,
2370 194, 151, 154, 151, 151, 154, 154, 154, 154, 154,
2371 15, 157, 176, 230, 154, 224, 157, 223, 154, 154,
2372 154, 194, 194, 194, 223, 221, 157, 176, 39, 157,
2373 154, 154, 154, 151, 221, 15, 15, 151, 223, 223,
2374 15, 228, 223, 15, 223
Reid Spencer319a7302007-01-05 17:20:02 +00002375};
Reid Spencere7c3c602006-11-30 06:36:44 +00002376
Jeff Cohenac2dca92007-01-21 19:30:52 +00002377#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2378# define YYSIZE_T __SIZE_TYPE__
2379#endif
2380#if ! defined (YYSIZE_T) && defined (size_t)
2381# define YYSIZE_T size_t
2382#endif
2383#if ! defined (YYSIZE_T)
2384# if defined (__STDC__) || defined (__cplusplus)
2385# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2386# define YYSIZE_T size_t
2387# endif
2388#endif
2389#if ! defined (YYSIZE_T)
2390# define YYSIZE_T unsigned int
2391#endif
2392
Reid Spencere7c3c602006-11-30 06:36:44 +00002393#define yyerrok (yyerrstatus = 0)
2394#define yyclearin (yychar = YYEMPTY)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002395#define YYEMPTY -2
Reid Spencere7c3c602006-11-30 06:36:44 +00002396#define YYEOF 0
Reid Spencer319a7302007-01-05 17:20:02 +00002397
Reid Spencere7c3c602006-11-30 06:36:44 +00002398#define YYACCEPT goto yyacceptlab
Reid Spencer319a7302007-01-05 17:20:02 +00002399#define YYABORT goto yyabortlab
Jeff Cohenac2dca92007-01-21 19:30:52 +00002400#define YYERROR goto yyerrlab1
Reid Spencer319a7302007-01-05 17:20:02 +00002401
2402/* Like YYERROR except do call yyerror. This remains here temporarily
2403 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencere7c3c602006-11-30 06:36:44 +00002404 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer319a7302007-01-05 17:20:02 +00002405
Reid Spencere7c3c602006-11-30 06:36:44 +00002406#define YYFAIL goto yyerrlab
Reid Spencer319a7302007-01-05 17:20:02 +00002407
Reid Spencere7c3c602006-11-30 06:36:44 +00002408#define YYRECOVERING() (!!yyerrstatus)
Reid Spencer319a7302007-01-05 17:20:02 +00002409
2410#define YYBACKUP(Token, Value) \
Reid Spencere7c3c602006-11-30 06:36:44 +00002411do \
2412 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencer319a7302007-01-05 17:20:02 +00002413 { \
2414 yychar = (Token); \
2415 yylval = (Value); \
Jeff Cohenac2dca92007-01-21 19:30:52 +00002416 yychar1 = YYTRANSLATE (yychar); \
Reid Spencere7c3c602006-11-30 06:36:44 +00002417 YYPOPSTACK; \
2418 goto yybackup; \
2419 } \
2420 else \
Jeff Cohenac2dca92007-01-21 19:30:52 +00002421 { \
2422 yyerror ("syntax error: cannot back up"); \
Reid Spencer319a7302007-01-05 17:20:02 +00002423 YYERROR; \
2424 } \
Reid Spencere7c3c602006-11-30 06:36:44 +00002425while (0)
2426
Reid Spencere7c3c602006-11-30 06:36:44 +00002427#define YYTERROR 1
2428#define YYERRCODE 256
2429
Jeff Cohenac2dca92007-01-21 19:30:52 +00002430/* YYLLOC_DEFAULT -- Compute the default location (before the actions
2431 are run). */
Reid Spencer319a7302007-01-05 17:20:02 +00002432
Reid Spencer319a7302007-01-05 17:20:02 +00002433#ifndef YYLLOC_DEFAULT
Jeff Cohenac2dca92007-01-21 19:30:52 +00002434# define YYLLOC_DEFAULT(Current, Rhs, N) \
2435 Current.first_line = Rhs[1].first_line; \
2436 Current.first_column = Rhs[1].first_column; \
2437 Current.last_line = Rhs[N].last_line; \
2438 Current.last_column = Rhs[N].last_column;
Reid Spencere7c3c602006-11-30 06:36:44 +00002439#endif
2440
Reid Spencer319a7302007-01-05 17:20:02 +00002441/* YYLEX -- calling `yylex' with the right arguments. */
2442
Jeff Cohenac2dca92007-01-21 19:30:52 +00002443#define YYLEX yylex ()
Reid Spencer319a7302007-01-05 17:20:02 +00002444
2445/* Enable debugging if requested. */
2446#if YYDEBUG
2447
2448# ifndef YYFPRINTF
2449# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2450# define YYFPRINTF fprintf
2451# endif
2452
2453# define YYDPRINTF(Args) \
2454do { \
2455 if (yydebug) \
2456 YYFPRINTF Args; \
2457} while (0)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002458# define YYDSYMPRINT(Args) \
2459do { \
2460 if (yydebug) \
2461 yysymprint Args; \
Reid Spencer319a7302007-01-05 17:20:02 +00002462} while (0)
Reid Spencer319a7302007-01-05 17:20:02 +00002463/* Nonzero means print parse trace. It is left uninitialized so that
2464 multiple parsers can coexist. */
2465int yydebug;
2466#else /* !YYDEBUG */
2467# define YYDPRINTF(Args)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002468# define YYDSYMPRINT(Args)
Reid Spencer319a7302007-01-05 17:20:02 +00002469#endif /* !YYDEBUG */
Reid Spencere7c3c602006-11-30 06:36:44 +00002470
Reid Spencer319a7302007-01-05 17:20:02 +00002471/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002472#ifndef YYINITDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002473# define YYINITDEPTH 200
Reid Spencere7c3c602006-11-30 06:36:44 +00002474#endif
2475
Reid Spencer319a7302007-01-05 17:20:02 +00002476/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2477 if the built-in stack extension method is used).
Reid Spencere7c3c602006-11-30 06:36:44 +00002478
Reid Spencer319a7302007-01-05 17:20:02 +00002479 Do not make this value too large; the results are undefined if
Jeff Cohenac2dca92007-01-21 19:30:52 +00002480 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
Reid Spencer319a7302007-01-05 17:20:02 +00002481 evaluated with infinite-precision integer arithmetic. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002482
Jeff Cohenac2dca92007-01-21 19:30:52 +00002483#if YYMAXDEPTH == 0
2484# undef YYMAXDEPTH
2485#endif
2486
Reid Spencere7c3c602006-11-30 06:36:44 +00002487#ifndef YYMAXDEPTH
Reid Spencer319a7302007-01-05 17:20:02 +00002488# define YYMAXDEPTH 10000
Reid Spencere7c3c602006-11-30 06:36:44 +00002489#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002490
Reid Spencere7c3c602006-11-30 06:36:44 +00002491
2492
Reid Spencer319a7302007-01-05 17:20:02 +00002493#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00002494
Reid Spencer319a7302007-01-05 17:20:02 +00002495# ifndef yystrlen
2496# if defined (__GLIBC__) && defined (_STRING_H)
2497# define yystrlen strlen
2498# else
2499/* Return the length of YYSTR. */
2500static YYSIZE_T
2501# if defined (__STDC__) || defined (__cplusplus)
2502yystrlen (const char *yystr)
2503# else
2504yystrlen (yystr)
2505 const char *yystr;
2506# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002507{
Jeff Cohenac2dca92007-01-21 19:30:52 +00002508 register const char *yys = yystr;
Chris Lattner37e01c52007-01-04 18:46:42 +00002509
Reid Spencer319a7302007-01-05 17:20:02 +00002510 while (*yys++ != '\0')
2511 continue;
2512
2513 return yys - yystr - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002514}
Reid Spencer319a7302007-01-05 17:20:02 +00002515# endif
2516# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002517
Reid Spencer319a7302007-01-05 17:20:02 +00002518# ifndef yystpcpy
2519# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2520# define yystpcpy stpcpy
2521# else
2522/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2523 YYDEST. */
2524static char *
2525# if defined (__STDC__) || defined (__cplusplus)
2526yystpcpy (char *yydest, const char *yysrc)
2527# else
2528yystpcpy (yydest, yysrc)
2529 char *yydest;
2530 const char *yysrc;
2531# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002532{
Jeff Cohenac2dca92007-01-21 19:30:52 +00002533 register char *yyd = yydest;
2534 register const char *yys = yysrc;
Chris Lattner37e01c52007-01-04 18:46:42 +00002535
Reid Spencer319a7302007-01-05 17:20:02 +00002536 while ((*yyd++ = *yys++) != '\0')
2537 continue;
2538
2539 return yyd - 1;
Chris Lattner37e01c52007-01-04 18:46:42 +00002540}
Reid Spencer319a7302007-01-05 17:20:02 +00002541# endif
2542# endif
Chris Lattner37e01c52007-01-04 18:46:42 +00002543
Jeff Cohenac2dca92007-01-21 19:30:52 +00002544#endif /* !YYERROR_VERBOSE */
Reid Spencer319a7302007-01-05 17:20:02 +00002545
Reid Spencere7c3c602006-11-30 06:36:44 +00002546
2547
Reid Spencer319a7302007-01-05 17:20:02 +00002548#if YYDEBUG
Jeff Cohenac2dca92007-01-21 19:30:52 +00002549/*-----------------------------.
2550| Print this symbol on YYOUT. |
2551`-----------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002552
Jeff Cohenac2dca92007-01-21 19:30:52 +00002553static void
Reid Spencer319a7302007-01-05 17:20:02 +00002554#if defined (__STDC__) || defined (__cplusplus)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002555yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
Chris Lattner37e01c52007-01-04 18:46:42 +00002556#else
Jeff Cohenac2dca92007-01-21 19:30:52 +00002557yysymprint (yyout, yytype, yyvalue)
2558 FILE* yyout;
Reid Spencer319a7302007-01-05 17:20:02 +00002559 int yytype;
Jeff Cohenac2dca92007-01-21 19:30:52 +00002560 YYSTYPE yyvalue;
Reid Spencer319a7302007-01-05 17:20:02 +00002561#endif
2562{
2563 /* Pacify ``unused variable'' warnings. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00002564 (void) yyvalue;
Reid Spencer319a7302007-01-05 17:20:02 +00002565
2566 if (yytype < YYNTOKENS)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002567 {
2568 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
Reid Spencer319a7302007-01-05 17:20:02 +00002569# ifdef YYPRINT
Jeff Cohenac2dca92007-01-21 19:30:52 +00002570 YYPRINT (yyout, yytoknum[yytype], yyvalue);
Reid Spencer319a7302007-01-05 17:20:02 +00002571# endif
Jeff Cohenac2dca92007-01-21 19:30:52 +00002572 }
2573 else
2574 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
2575
Reid Spencer319a7302007-01-05 17:20:02 +00002576 switch (yytype)
2577 {
2578 default:
2579 break;
2580 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00002581 YYFPRINTF (yyout, ")");
Reid Spencer319a7302007-01-05 17:20:02 +00002582}
Jeff Cohenac2dca92007-01-21 19:30:52 +00002583#endif /* YYDEBUG. */
Reid Spencer319a7302007-01-05 17:20:02 +00002584
Jeff Cohenac2dca92007-01-21 19:30:52 +00002585
Reid Spencer319a7302007-01-05 17:20:02 +00002586/*-----------------------------------------------.
2587| Release the memory associated to this symbol. |
2588`-----------------------------------------------*/
2589
Jeff Cohenac2dca92007-01-21 19:30:52 +00002590static void
Reid Spencer319a7302007-01-05 17:20:02 +00002591#if defined (__STDC__) || defined (__cplusplus)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002592yydestruct (int yytype, YYSTYPE yyvalue)
Reid Spencer319a7302007-01-05 17:20:02 +00002593#else
Jeff Cohenac2dca92007-01-21 19:30:52 +00002594yydestruct (yytype, yyvalue)
Reid Spencer319a7302007-01-05 17:20:02 +00002595 int yytype;
Jeff Cohenac2dca92007-01-21 19:30:52 +00002596 YYSTYPE yyvalue;
Reid Spencer319a7302007-01-05 17:20:02 +00002597#endif
2598{
2599 /* Pacify ``unused variable'' warnings. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00002600 (void) yyvalue;
Reid Spencer319a7302007-01-05 17:20:02 +00002601
2602 switch (yytype)
2603 {
Reid Spencer319a7302007-01-05 17:20:02 +00002604 default:
2605 break;
2606 }
2607}
Jeff Cohenac2dca92007-01-21 19:30:52 +00002608
Reid Spencer319a7302007-01-05 17:20:02 +00002609
2610
Jeff Cohenac2dca92007-01-21 19:30:52 +00002611/* The user can define YYPARSE_PARAM as the name of an argument to be passed
2612 into yyparse. The argument should have type void *.
2613 It should actually point to an object.
2614 Grammar actions can access the variable by casting it
2615 to the proper pointer type. */
Reid Spencer319a7302007-01-05 17:20:02 +00002616
2617#ifdef YYPARSE_PARAM
2618# if defined (__STDC__) || defined (__cplusplus)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002619# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2620# define YYPARSE_PARAM_DECL
Reid Spencer319a7302007-01-05 17:20:02 +00002621# else
Jeff Cohenac2dca92007-01-21 19:30:52 +00002622# define YYPARSE_PARAM_ARG YYPARSE_PARAM
2623# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
Reid Spencer319a7302007-01-05 17:20:02 +00002624# endif
Jeff Cohenac2dca92007-01-21 19:30:52 +00002625#else /* !YYPARSE_PARAM */
2626# define YYPARSE_PARAM_ARG
2627# define YYPARSE_PARAM_DECL
2628#endif /* !YYPARSE_PARAM */
2629
2630/* Prevent warning if -Wstrict-prototypes. */
2631#ifdef __GNUC__
2632# ifdef YYPARSE_PARAM
2633int yyparse (void *);
2634# else
Reid Spencere7c3c602006-11-30 06:36:44 +00002635int yyparse (void);
Jeff Cohenac2dca92007-01-21 19:30:52 +00002636# endif
Reid Spencer319a7302007-01-05 17:20:02 +00002637#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002638
2639
Jeff Cohenac2dca92007-01-21 19:30:52 +00002640/* The lookahead symbol. */
Reid Spencer319a7302007-01-05 17:20:02 +00002641int yychar;
2642
Jeff Cohenac2dca92007-01-21 19:30:52 +00002643/* The semantic value of the lookahead symbol. */
Reid Spencer319a7302007-01-05 17:20:02 +00002644YYSTYPE yylval;
2645
Jeff Cohenac2dca92007-01-21 19:30:52 +00002646/* Number of parse errors so far. */
Reid Spencer319a7302007-01-05 17:20:02 +00002647int yynerrs;
2648
2649
Reid Spencer319a7302007-01-05 17:20:02 +00002650int
Jeff Cohenac2dca92007-01-21 19:30:52 +00002651yyparse (YYPARSE_PARAM_ARG)
2652 YYPARSE_PARAM_DECL
Reid Spencer319a7302007-01-05 17:20:02 +00002653{
2654
Jeff Cohenac2dca92007-01-21 19:30:52 +00002655 register int yystate;
2656 register int yyn;
Reid Spencer319a7302007-01-05 17:20:02 +00002657 int yyresult;
2658 /* Number of tokens to shift before error messages enabled. */
2659 int yyerrstatus;
Jeff Cohenac2dca92007-01-21 19:30:52 +00002660 /* Lookahead token as an internal (translated) token number. */
2661 int yychar1 = 0;
Reid Spencer319a7302007-01-05 17:20:02 +00002662
2663 /* Three stacks and their tools:
2664 `yyss': related to states,
2665 `yyvs': related to semantic values,
2666 `yyls': related to locations.
2667
2668 Refer to the stacks thru separate pointers, to allow yyoverflow
2669 to reallocate them elsewhere. */
2670
2671 /* The state stack. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00002672 short yyssa[YYINITDEPTH];
2673 short *yyss = yyssa;
2674 register short *yyssp;
Reid Spencer319a7302007-01-05 17:20:02 +00002675
2676 /* The semantic value stack. */
2677 YYSTYPE yyvsa[YYINITDEPTH];
2678 YYSTYPE *yyvs = yyvsa;
Jeff Cohenac2dca92007-01-21 19:30:52 +00002679 register YYSTYPE *yyvsp;
Reid Spencer319a7302007-01-05 17:20:02 +00002680
2681
2682
Reid Spencere7c3c602006-11-30 06:36:44 +00002683#define YYPOPSTACK (yyvsp--, yyssp--)
2684
Reid Spencer319a7302007-01-05 17:20:02 +00002685 YYSIZE_T yystacksize = YYINITDEPTH;
Reid Spencere7c3c602006-11-30 06:36:44 +00002686
Reid Spencer319a7302007-01-05 17:20:02 +00002687 /* The variables used to return semantic value and location from the
2688 action routines. */
2689 YYSTYPE yyval;
Reid Spencere7c3c602006-11-30 06:36:44 +00002690
2691
Reid Spencer319a7302007-01-05 17:20:02 +00002692 /* When reducing, the number of symbols on the RHS of the reduced
2693 rule. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002694 int yylen;
2695
Reid Spencer319a7302007-01-05 17:20:02 +00002696 YYDPRINTF ((stderr, "Starting parse\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002697
2698 yystate = 0;
2699 yyerrstatus = 0;
2700 yynerrs = 0;
2701 yychar = YYEMPTY; /* Cause a token to be read. */
2702
2703 /* Initialize stack pointers.
2704 Waste one element of value and location stack
2705 so that they stay on the same level as the state stack.
2706 The wasted elements are never initialized. */
2707
Reid Spencer319a7302007-01-05 17:20:02 +00002708 yyssp = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002709 yyvsp = yyvs;
2710
Reid Spencer319a7302007-01-05 17:20:02 +00002711 goto yysetstate;
Reid Spencere7c3c602006-11-30 06:36:44 +00002712
Reid Spencer319a7302007-01-05 17:20:02 +00002713/*------------------------------------------------------------.
2714| yynewstate -- Push a new state, which is found in yystate. |
2715`------------------------------------------------------------*/
2716 yynewstate:
2717 /* In all cases, when you get here, the value and location stacks
2718 have just been pushed. so pushing a state here evens the stacks.
2719 */
2720 yyssp++;
Reid Spencere7c3c602006-11-30 06:36:44 +00002721
Reid Spencer319a7302007-01-05 17:20:02 +00002722 yysetstate:
2723 *yyssp = yystate;
2724
Jeff Cohenac2dca92007-01-21 19:30:52 +00002725 if (yyssp >= yyss + yystacksize - 1)
Reid Spencere7c3c602006-11-30 06:36:44 +00002726 {
2727 /* Get the current used size of the three stacks, in elements. */
Reid Spencer319a7302007-01-05 17:20:02 +00002728 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002729
2730#ifdef yyoverflow
Reid Spencer319a7302007-01-05 17:20:02 +00002731 {
2732 /* Give user a chance to reallocate the stack. Use copies of
2733 these so that the &'s don't force the real ones into
2734 memory. */
2735 YYSTYPE *yyvs1 = yyvs;
Jeff Cohenac2dca92007-01-21 19:30:52 +00002736 short *yyss1 = yyss;
Reid Spencere7c3c602006-11-30 06:36:44 +00002737
Reid Spencer319a7302007-01-05 17:20:02 +00002738
2739 /* Each stack pointer address is followed by the size of the
2740 data in use in that stack, in bytes. This used to be a
2741 conditional around just the two extra args, but that might
2742 be undefined if yyoverflow is a macro. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00002743 yyoverflow ("parser stack overflow",
Reid Spencer319a7302007-01-05 17:20:02 +00002744 &yyss1, yysize * sizeof (*yyssp),
2745 &yyvs1, yysize * sizeof (*yyvsp),
2746
2747 &yystacksize);
2748
2749 yyss = yyss1;
2750 yyvs = yyvs1;
2751 }
Reid Spencere7c3c602006-11-30 06:36:44 +00002752#else /* no yyoverflow */
Reid Spencer319a7302007-01-05 17:20:02 +00002753# ifndef YYSTACK_RELOCATE
Jeff Cohenac2dca92007-01-21 19:30:52 +00002754 goto yyoverflowlab;
Reid Spencer319a7302007-01-05 17:20:02 +00002755# else
Reid Spencere7c3c602006-11-30 06:36:44 +00002756 /* Extend the stack our own way. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00002757 if (yystacksize >= YYMAXDEPTH)
2758 goto yyoverflowlab;
Reid Spencere7c3c602006-11-30 06:36:44 +00002759 yystacksize *= 2;
Jeff Cohenac2dca92007-01-21 19:30:52 +00002760 if (yystacksize > YYMAXDEPTH)
Reid Spencere7c3c602006-11-30 06:36:44 +00002761 yystacksize = YYMAXDEPTH;
Reid Spencer319a7302007-01-05 17:20:02 +00002762
2763 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002764 short *yyss1 = yyss;
Reid Spencer319a7302007-01-05 17:20:02 +00002765 union yyalloc *yyptr =
2766 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2767 if (! yyptr)
Jeff Cohenac2dca92007-01-21 19:30:52 +00002768 goto yyoverflowlab;
Reid Spencer319a7302007-01-05 17:20:02 +00002769 YYSTACK_RELOCATE (yyss);
2770 YYSTACK_RELOCATE (yyvs);
2771
2772# undef YYSTACK_RELOCATE
2773 if (yyss1 != yyssa)
2774 YYSTACK_FREE (yyss1);
2775 }
2776# endif
Reid Spencere7c3c602006-11-30 06:36:44 +00002777#endif /* no yyoverflow */
2778
Reid Spencer319a7302007-01-05 17:20:02 +00002779 yyssp = yyss + yysize - 1;
2780 yyvsp = yyvs + yysize - 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00002781
2782
Reid Spencer319a7302007-01-05 17:20:02 +00002783 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2784 (unsigned long int) yystacksize));
2785
Jeff Cohenac2dca92007-01-21 19:30:52 +00002786 if (yyssp >= yyss + yystacksize - 1)
Reid Spencere7c3c602006-11-30 06:36:44 +00002787 YYABORT;
2788 }
2789
Reid Spencer319a7302007-01-05 17:20:02 +00002790 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencere7c3c602006-11-30 06:36:44 +00002791
2792 goto yybackup;
Reid Spencer319a7302007-01-05 17:20:02 +00002793
2794/*-----------.
2795| yybackup. |
2796`-----------*/
2797yybackup:
Reid Spencere7c3c602006-11-30 06:36:44 +00002798
2799/* Do appropriate processing given the current state. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00002800/* Read a lookahead token if we need one and don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002801/* yyresume: */
2802
Jeff Cohenac2dca92007-01-21 19:30:52 +00002803 /* First try to decide what to do without reference to lookahead token. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002804
2805 yyn = yypact[yystate];
Reid Spencer319a7302007-01-05 17:20:02 +00002806 if (yyn == YYPACT_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002807 goto yydefault;
2808
Jeff Cohenac2dca92007-01-21 19:30:52 +00002809 /* Not known => get a lookahead token if don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002810
Jeff Cohenac2dca92007-01-21 19:30:52 +00002811 /* yychar is either YYEMPTY or YYEOF
2812 or a valid token in external form. */
2813
Reid Spencere7c3c602006-11-30 06:36:44 +00002814 if (yychar == YYEMPTY)
2815 {
Reid Spencer319a7302007-01-05 17:20:02 +00002816 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencere7c3c602006-11-30 06:36:44 +00002817 yychar = YYLEX;
2818 }
2819
Jeff Cohenac2dca92007-01-21 19:30:52 +00002820 /* Convert token to internal form (in yychar1) for indexing tables with. */
2821
2822 if (yychar <= 0) /* This means end of input. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002823 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002824 yychar1 = 0;
2825 yychar = YYEOF; /* Don't call YYLEX any more. */
2826
Reid Spencer319a7302007-01-05 17:20:02 +00002827 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002828 }
2829 else
2830 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002831 yychar1 = YYTRANSLATE (yychar);
2832
2833 /* We have to keep this `#if YYDEBUG', since we use variables
2834 which are defined only if `YYDEBUG' is set. */
2835 YYDPRINTF ((stderr, "Next token is "));
2836 YYDSYMPRINT ((stderr, yychar1, yylval));
2837 YYDPRINTF ((stderr, "\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00002838 }
2839
Jeff Cohenac2dca92007-01-21 19:30:52 +00002840 /* If the proper action on seeing token YYCHAR1 is to reduce or to
Reid Spencer319a7302007-01-05 17:20:02 +00002841 detect an error, take that action. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00002842 yyn += yychar1;
2843 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
Reid Spencere7c3c602006-11-30 06:36:44 +00002844 goto yydefault;
2845 yyn = yytable[yyn];
Reid Spencer319a7302007-01-05 17:20:02 +00002846 if (yyn <= 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00002847 {
Reid Spencer319a7302007-01-05 17:20:02 +00002848 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencere7c3c602006-11-30 06:36:44 +00002849 goto yyerrlab;
2850 yyn = -yyn;
2851 goto yyreduce;
2852 }
2853
2854 if (yyn == YYFINAL)
2855 YYACCEPT;
2856
Jeff Cohenac2dca92007-01-21 19:30:52 +00002857 /* Shift the lookahead token. */
2858 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
2859 yychar, yytname[yychar1]));
Reid Spencere7c3c602006-11-30 06:36:44 +00002860
2861 /* Discard the token being shifted unless it is eof. */
2862 if (yychar != YYEOF)
2863 yychar = YYEMPTY;
2864
2865 *++yyvsp = yylval;
2866
Reid Spencer319a7302007-01-05 17:20:02 +00002867
2868 /* Count tokens shifted since error; after three, turn off error
2869 status. */
2870 if (yyerrstatus)
2871 yyerrstatus--;
Reid Spencere7c3c602006-11-30 06:36:44 +00002872
2873 yystate = yyn;
2874 goto yynewstate;
2875
Chris Lattner37e01c52007-01-04 18:46:42 +00002876
Reid Spencer319a7302007-01-05 17:20:02 +00002877/*-----------------------------------------------------------.
2878| yydefault -- do the default action for the current state. |
2879`-----------------------------------------------------------*/
2880yydefault:
Reid Spencere7c3c602006-11-30 06:36:44 +00002881 yyn = yydefact[yystate];
2882 if (yyn == 0)
2883 goto yyerrlab;
Reid Spencer319a7302007-01-05 17:20:02 +00002884 goto yyreduce;
Reid Spencere7c3c602006-11-30 06:36:44 +00002885
Reid Spencer319a7302007-01-05 17:20:02 +00002886
2887/*-----------------------------.
2888| yyreduce -- Do a reduction. |
2889`-----------------------------*/
Reid Spencere7c3c602006-11-30 06:36:44 +00002890yyreduce:
Reid Spencer319a7302007-01-05 17:20:02 +00002891 /* yyn is the number of a rule to reduce with. */
Reid Spencere7c3c602006-11-30 06:36:44 +00002892 yylen = yyr2[yyn];
2893
Reid Spencer319a7302007-01-05 17:20:02 +00002894 /* If YYLEN is nonzero, implement the default value of the action:
2895 `$$ = $1'.
2896
2897 Otherwise, the following line sets YYVAL to garbage.
2898 This behavior is undocumented and Bison
2899 users should not rely upon it. Assigning to YYVAL
2900 unconditionally makes the parser a bit smaller, and it avoids a
2901 GCC warning that YYVAL may be used uninitialized. */
2902 yyval = yyvsp[1-yylen];
2903
2904
Jeff Cohenac2dca92007-01-21 19:30:52 +00002905
2906#if YYDEBUG
2907 /* We have to keep this `#if YYDEBUG', since we use variables which
2908 are defined only if `YYDEBUG' is set. */
2909 if (yydebug)
2910 {
2911 int yyi;
2912
2913 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
2914 yyn - 1, yyrline[yyn]);
2915
2916 /* Print the symbols being reduced, and their result. */
2917 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
2918 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2919 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2920 }
2921#endif
Reid Spencer319a7302007-01-05 17:20:02 +00002922 switch (yyn)
Reid Spencere7c3c602006-11-30 06:36:44 +00002923 {
Reid Spencer319a7302007-01-05 17:20:02 +00002924 case 81:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002925#line 1061 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002926 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002927 yyval.String = yyvsp[-1].String;
2928 }
Reid Spencer319a7302007-01-05 17:20:02 +00002929 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002930
Reid Spencer319a7302007-01-05 17:20:02 +00002931 case 82:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002932#line 1064 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002933 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002934 yyval.String = new std::string("");
2935 }
Reid Spencer319a7302007-01-05 17:20:02 +00002936 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002937
Reid Spencer319a7302007-01-05 17:20:02 +00002938 case 90:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002939#line 1071 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2940 { yyval.String = new std::string(""); }
Reid Spencer319a7302007-01-05 17:20:02 +00002941 break;
Reid Spencere77e35e2006-12-01 20:26:20 +00002942
Reid Spencer319a7302007-01-05 17:20:02 +00002943 case 97:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002944#line 1076 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002945 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002946 *yyvsp[-1].String += *yyvsp[0].String;
2947 delete yyvsp[0].String;
2948 yyval.String = yyvsp[-1].String;
2949 }
Reid Spencer319a7302007-01-05 17:20:02 +00002950 break;
Reid Spencer16244f42006-12-01 21:10:07 +00002951
Reid Spencer319a7302007-01-05 17:20:02 +00002952 case 98:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002953#line 1081 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2954 { yyval.String = new std::string(""); }
Reid Spencer319a7302007-01-05 17:20:02 +00002955 break;
Reid Spencere7c3c602006-11-30 06:36:44 +00002956
Reid Spencer319a7302007-01-05 17:20:02 +00002957 case 99:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002958#line 1086 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2959 { yyval.String = new std::string(); }
Reid Spencer319a7302007-01-05 17:20:02 +00002960 break;
2961
Reid Spencerc4d96252007-01-13 00:03:30 +00002962 case 100:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002963#line 1087 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2964 { *yyvsp[-1].String += " " + *yyvsp[0].String; delete yyvsp[0].String; yyval.String = yyvsp[-1].String; }
Reid Spencerc4d96252007-01-13 00:03:30 +00002965 break;
2966
2967 case 101:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002968#line 1090 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2969 { yyval.String = new std::string(); }
Reid Spencerc4d96252007-01-13 00:03:30 +00002970 break;
2971
2972 case 102:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002973#line 1091 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002974 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002975 yyvsp[-1].String->insert(0, ", ");
2976 *yyvsp[-1].String += " " + *yyvsp[0].String;
2977 delete yyvsp[0].String;
2978 yyval.String = yyvsp[-1].String;
2979 }
Reid Spencer319a7302007-01-05 17:20:02 +00002980 break;
2981
2982 case 103:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002983#line 1099 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00002984 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00002985 *yyvsp[-1].String += " " + *yyvsp[0].String;
2986 delete yyvsp[0].String;
2987 yyval.String = yyvsp[-1].String;
2988 }
Reid Spencer319a7302007-01-05 17:20:02 +00002989 break;
2990
2991 case 104:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002992#line 1105 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2993 { yyval.String = new std::string(); }
Reid Spencer319a7302007-01-05 17:20:02 +00002994 break;
2995
Reid Spencerc4d96252007-01-13 00:03:30 +00002996 case 106:
Jeff Cohenac2dca92007-01-21 19:30:52 +00002997#line 1109 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
2998 { yyval.String = new std::string(); }
Reid Spencerc4d96252007-01-13 00:03:30 +00002999 break;
3000
Reid Spencer319a7302007-01-05 17:20:02 +00003001 case 107:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003002#line 1110 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003003 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003004 yyvsp[-1].String->insert(0, ", ");
3005 if (!yyvsp[0].String->empty())
3006 *yyvsp[-1].String += " " + *yyvsp[0].String;
3007 delete yyvsp[0].String;
3008 yyval.String = yyvsp[-1].String;
3009 }
Reid Spencer319a7302007-01-05 17:20:02 +00003010 break;
3011
3012 case 109:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003013#line 1120 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003014 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003015 *yyvsp[-1].String += " " + *yyvsp[0].String;
3016 delete yyvsp[0].String;
3017 yyval.String = yyvsp[-1].String;
3018 }
Reid Spencer319a7302007-01-05 17:20:02 +00003019 break;
3020
3021 case 127:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003022#line 1142 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003023 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003024 yyval.Ty = Type::get(*yyvsp[0].String, OpaqueTy);
3025 }
Reid Spencer319a7302007-01-05 17:20:02 +00003026 break;
3027
3028 case 128:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003029#line 1145 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003030 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003031 yyval.Ty = Type::get(*yyvsp[0].String, UnresolvedTy);
3032 }
Reid Spencer319a7302007-01-05 17:20:02 +00003033 break;
3034
3035 case 129:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003036#line 1148 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003037 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003038 yyval.Ty = yyvsp[0].Ty;
3039 }
Reid Spencer319a7302007-01-05 17:20:02 +00003040 break;
3041
3042 case 130:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003043#line 1151 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003044 { // Type UpReference
Jeff Cohenac2dca92007-01-21 19:30:52 +00003045 yyvsp[0].String->insert(0, "\\");
3046 yyval.Ty = Type::get(*yyvsp[0].String, UpRefTy);
3047 }
Reid Spencer319a7302007-01-05 17:20:02 +00003048 break;
3049
3050 case 131:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003051#line 1155 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003052 { // Function derived type?
Jeff Cohenac2dca92007-01-21 19:30:52 +00003053 std::string newTy( yyvsp[-3].Ty->getNewTy() + "(");
3054 for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003055 if (i != 0)
3056 newTy += ", ";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003057 if ((*yyvsp[-1].TypeVec)[i]->isVoid())
Reid Spencer52402b02007-01-02 05:45:11 +00003058 newTy += "...";
3059 else
Jeff Cohenac2dca92007-01-21 19:30:52 +00003060 newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003061 }
3062 newTy += ")";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003063 yyval.Ty = Type::get(newTy, yyvsp[-3].Ty, yyvsp[-1].TypeVec);
3064 }
Reid Spencer319a7302007-01-05 17:20:02 +00003065 break;
3066
3067 case 132:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003068#line 1168 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003069 { // Sized array type?
Jeff Cohenac2dca92007-01-21 19:30:52 +00003070 uint64_t elems = atoi(yyvsp[-3].String->c_str());
3071 yyvsp[-3].String->insert(0,"[ ");
3072 *yyvsp[-3].String += " x " + yyvsp[-1].Ty->getNewTy() + " ]";
3073 yyval.Ty = Type::get(*yyvsp[-3].String, ArrayTy, yyvsp[-1].Ty, elems);
3074 }
Reid Spencer319a7302007-01-05 17:20:02 +00003075 break;
3076
3077 case 133:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003078#line 1174 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003079 { // Packed array type?
Jeff Cohenac2dca92007-01-21 19:30:52 +00003080 uint64_t elems = atoi(yyvsp[-3].String->c_str());
3081 yyvsp[-3].String->insert(0,"< ");
3082 *yyvsp[-3].String += " x " + yyvsp[-1].Ty->getNewTy() + " >";
3083 yyval.Ty = Type::get(*yyvsp[-3].String, PackedTy, yyvsp[-1].Ty, elems);
3084 }
Reid Spencer319a7302007-01-05 17:20:02 +00003085 break;
3086
3087 case 134:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003088#line 1180 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003089 { // Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003090 std::string newTy("{");
Jeff Cohenac2dca92007-01-21 19:30:52 +00003091 for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003092 if (i != 0)
3093 newTy += ", ";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003094 newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003095 }
3096 newTy += "}";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003097 yyval.Ty = Type::get(newTy, StructTy, yyvsp[-1].TypeVec);
3098 }
Reid Spencer319a7302007-01-05 17:20:02 +00003099 break;
3100
3101 case 135:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003102#line 1190 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003103 { // Empty structure type?
Jeff Cohenac2dca92007-01-21 19:30:52 +00003104 yyval.Ty = Type::get("{}", StructTy, new TypeList());
3105 }
Reid Spencer319a7302007-01-05 17:20:02 +00003106 break;
3107
3108 case 136:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003109#line 1193 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003110 { // Packed Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00003111 std::string newTy("<{");
Jeff Cohenac2dca92007-01-21 19:30:52 +00003112 for (unsigned i = 0; i < yyvsp[-2].TypeVec->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00003113 if (i != 0)
3114 newTy += ", ";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003115 newTy += (*yyvsp[-2].TypeVec)[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00003116 }
3117 newTy += "}>";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003118 yyval.Ty = Type::get(newTy, PackedStructTy, yyvsp[-2].TypeVec);
3119 }
Reid Spencer319a7302007-01-05 17:20:02 +00003120 break;
3121
3122 case 137:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003123#line 1203 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003124 { // Empty packed structure type?
Jeff Cohenac2dca92007-01-21 19:30:52 +00003125 yyval.Ty = Type::get("<{}>", PackedStructTy, new TypeList());
3126 }
Reid Spencer319a7302007-01-05 17:20:02 +00003127 break;
3128
3129 case 138:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003130#line 1206 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003131 { // Pointer type?
Jeff Cohenac2dca92007-01-21 19:30:52 +00003132 yyval.Ty = yyvsp[-1].Ty->getPointerType();
3133 }
Reid Spencer319a7302007-01-05 17:20:02 +00003134 break;
3135
3136 case 139:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003137#line 1214 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003138 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003139 yyval.TypeVec = new TypeList();
3140 yyval.TypeVec->push_back(yyvsp[0].Ty);
3141 }
Reid Spencer319a7302007-01-05 17:20:02 +00003142 break;
3143
3144 case 140:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003145#line 1218 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003146 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003147 yyval.TypeVec = yyvsp[-2].TypeVec;
3148 yyval.TypeVec->push_back(yyvsp[0].Ty);
3149 }
Reid Spencer319a7302007-01-05 17:20:02 +00003150 break;
3151
3152 case 142:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003153#line 1226 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003154 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003155 yyval.TypeVec = yyvsp[-2].TypeVec;
3156 yyval.TypeVec->push_back(Type::get("void",VoidTy));
3157 delete yyvsp[0].String;
3158 }
Reid Spencer319a7302007-01-05 17:20:02 +00003159 break;
3160
3161 case 143:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003162#line 1231 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003163 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003164 yyval.TypeVec = new TypeList();
3165 yyval.TypeVec->push_back(Type::get("void",VoidTy));
3166 delete yyvsp[0].String;
3167 }
Reid Spencer319a7302007-01-05 17:20:02 +00003168 break;
3169
3170 case 144:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003171#line 1236 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003172 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003173 yyval.TypeVec = new TypeList();
3174 }
Reid Spencer319a7302007-01-05 17:20:02 +00003175 break;
3176
3177 case 145:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003178#line 1246 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003179 { // Nonempty unsized arr
Jeff Cohenac2dca92007-01-21 19:30:52 +00003180 yyval.Const = new Constant;
3181 yyval.Const->type = yyvsp[-3].Ty;
3182 yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3183 *yyval.Const->cnst += " [ " + *yyvsp[-1].String + " ]";
3184 delete yyvsp[-1].String;
3185 }
Reid Spencer319a7302007-01-05 17:20:02 +00003186 break;
3187
3188 case 146:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003189#line 1253 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003190 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003191 yyval.Const = new Constant;
3192 yyval.Const->type = yyvsp[-2].Ty;
3193 yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3194 *yyval.Const->cnst += "[ ]";
3195 }
Reid Spencer319a7302007-01-05 17:20:02 +00003196 break;
3197
3198 case 147:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003199#line 1259 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003200 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003201 yyval.Const = new Constant;
3202 yyval.Const->type = yyvsp[-2].Ty;
3203 yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3204 *yyval.Const->cnst += " c" + *yyvsp[0].String;
3205 delete yyvsp[0].String;
3206 }
Reid Spencer319a7302007-01-05 17:20:02 +00003207 break;
3208
3209 case 148:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003210#line 1266 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003211 { // Nonempty unsized arr
Jeff Cohenac2dca92007-01-21 19:30:52 +00003212 yyval.Const = new Constant;
3213 yyval.Const->type = yyvsp[-3].Ty;
3214 yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3215 *yyval.Const->cnst += " < " + *yyvsp[-1].String + " >";
3216 delete yyvsp[-1].String;
3217 }
Reid Spencer319a7302007-01-05 17:20:02 +00003218 break;
3219
3220 case 149:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003221#line 1273 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003222 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003223 yyval.Const = new Constant;
3224 yyval.Const->type = yyvsp[-3].Ty;
3225 yyval.Const->cnst = new std::string(yyvsp[-3].Ty->getNewTy());
3226 *yyval.Const->cnst += " { " + *yyvsp[-1].String + " }";
3227 delete yyvsp[-1].String;
3228 }
Reid Spencer319a7302007-01-05 17:20:02 +00003229 break;
3230
3231 case 150:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003232#line 1280 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003233 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003234 yyval.Const = new Constant;
3235 yyval.Const->type = yyvsp[-2].Ty;
3236 yyval.Const->cnst = new std::string(yyvsp[-2].Ty->getNewTy());
3237 *yyval.Const->cnst += " {}";
3238 }
Reid Spencer319a7302007-01-05 17:20:02 +00003239 break;
3240
3241 case 151:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003242#line 1286 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003243 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003244 yyval.Const = new Constant;
3245 yyval.Const->type = yyvsp[-1].Ty;
3246 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3247 *yyval.Const->cnst += " " + *yyvsp[0].String;
3248 delete yyvsp[0].String;
3249 }
Reid Spencer319a7302007-01-05 17:20:02 +00003250 break;
3251
3252 case 152:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003253#line 1293 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003254 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003255 yyval.Const = new Constant;
3256 yyval.Const->type = yyvsp[-1].Ty;
3257 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3258 *yyval.Const->cnst += " " + *yyvsp[0].String;
3259 delete yyvsp[0].String;
3260 }
Reid Spencer319a7302007-01-05 17:20:02 +00003261 break;
3262
3263 case 153:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003264#line 1300 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003265 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003266 yyval.Const = new Constant;
3267 std::string Name = getUniqueName(yyvsp[0].String, yyvsp[-1].Ty->resolve(), true);
3268 yyval.Const->type = yyvsp[-1].Ty;
3269 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3270 *yyval.Const->cnst += " " + Name;
3271 delete yyvsp[0].String;
3272 }
Reid Spencer319a7302007-01-05 17:20:02 +00003273 break;
3274
3275 case 154:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003276#line 1308 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003277 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003278 yyval.Const = new Constant;
3279 yyval.Const->type = yyvsp[-1].Ty;
3280 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3281 *yyval.Const->cnst += " " + *yyvsp[0].String;
3282 delete yyvsp[0].String;
3283 }
Reid Spencer319a7302007-01-05 17:20:02 +00003284 break;
3285
3286 case 155:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003287#line 1315 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003288 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003289 yyval.Const = new Constant;
3290 yyval.Const->type = yyvsp[-1].Ty;
3291 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3292 *yyval.Const->cnst += " " + *yyvsp[0].String;
3293 delete yyvsp[0].String;
3294 }
Reid Spencer319a7302007-01-05 17:20:02 +00003295 break;
3296
3297 case 156:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003298#line 1322 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003299 { // integral constants
Jeff Cohenac2dca92007-01-21 19:30:52 +00003300 yyval.Const = new Constant;
3301 yyval.Const->type = yyvsp[-1].Ty;
3302 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3303 *yyval.Const->cnst += " " + *yyvsp[0].String;
3304 delete yyvsp[0].String;
3305 }
Reid Spencer319a7302007-01-05 17:20:02 +00003306 break;
3307
3308 case 157:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003309#line 1329 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003310 { // integral constants
Jeff Cohenac2dca92007-01-21 19:30:52 +00003311 yyval.Const = new Constant;
3312 yyval.Const->type = yyvsp[-1].Ty;
3313 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3314 *yyval.Const->cnst += " " + *yyvsp[0].String;
3315 delete yyvsp[0].String;
3316 }
Reid Spencer319a7302007-01-05 17:20:02 +00003317 break;
3318
3319 case 158:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003320#line 1336 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003321 { // Boolean constants
Jeff Cohenac2dca92007-01-21 19:30:52 +00003322 yyval.Const = new Constant;
3323 yyval.Const->type = yyvsp[-1].Ty;
3324 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3325 *yyval.Const->cnst += " " + *yyvsp[0].String;
3326 delete yyvsp[0].String;
3327 }
Reid Spencer319a7302007-01-05 17:20:02 +00003328 break;
3329
3330 case 159:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003331#line 1343 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003332 { // Boolean constants
Jeff Cohenac2dca92007-01-21 19:30:52 +00003333 yyval.Const = new Constant;
3334 yyval.Const->type = yyvsp[-1].Ty;
3335 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3336 *yyval.Const->cnst += " " + *yyvsp[0].String;
3337 delete yyvsp[0].String;
3338 }
Reid Spencer319a7302007-01-05 17:20:02 +00003339 break;
3340
3341 case 160:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003342#line 1350 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003343 { // Float & Double constants
Jeff Cohenac2dca92007-01-21 19:30:52 +00003344 yyval.Const = new Constant;
3345 yyval.Const->type = yyvsp[-1].Ty;
3346 yyval.Const->cnst = new std::string(yyvsp[-1].Ty->getNewTy());
3347 *yyval.Const->cnst += " " + *yyvsp[0].String;
3348 delete yyvsp[0].String;
3349 }
Reid Spencer319a7302007-01-05 17:20:02 +00003350 break;
3351
3352 case 161:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003353#line 1358 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003354 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003355 std::string source = *yyvsp[-3].Const->cnst;
3356 const Type* SrcTy = yyvsp[-3].Const->type->resolve();
3357 const Type* DstTy = yyvsp[-1].Ty->resolve();
3358 if (*yyvsp[-5].String == "cast") {
Reid Spencera50d5962006-12-02 04:11:07 +00003359 // Call getCastUpgrade to upgrade the old cast
Jeff Cohenac2dca92007-01-21 19:30:52 +00003360 yyval.String = new std::string(getCastUpgrade(source, SrcTy, DstTy, true));
Reid Spencera50d5962006-12-02 04:11:07 +00003361 } else {
3362 // Nothing to upgrade, just create the cast constant expr
Jeff Cohenac2dca92007-01-21 19:30:52 +00003363 yyval.String = new std::string(*yyvsp[-5].String);
3364 *yyval.String += "( " + source + " to " + yyvsp[-1].Ty->getNewTy() + ")";
Reid Spencer280d8012006-12-01 23:40:53 +00003365 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003366 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-2].String;
3367 }
Reid Spencer319a7302007-01-05 17:20:02 +00003368 break;
3369
3370 case 162:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003371#line 1372 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003372 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003373 *yyvsp[-4].String += "(" + *yyvsp[-2].Const->cnst;
3374 for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
3375 Value* V = (*yyvsp[-1].ValList)[i];
3376 *yyvsp[-4].String += ", " + *V->val;
Reid Spencerb6673a92007-01-15 02:41:46 +00003377 delete V;
Reid Spencerf8483652006-12-02 15:16:01 +00003378 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003379 *yyvsp[-4].String += ")";
3380 yyval.String = yyvsp[-4].String;
3381 delete yyvsp[-2].Const;
3382 delete yyvsp[-1].ValList;
3383 }
Reid Spencer319a7302007-01-05 17:20:02 +00003384 break;
3385
3386 case 163:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003387#line 1384 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003388 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003389 *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3390 delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3391 yyval.String = yyvsp[-7].String;
3392 }
Reid Spencer319a7302007-01-05 17:20:02 +00003393 break;
3394
3395 case 164:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003396#line 1389 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003397 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003398 const char* op = getDivRemOpcode(*yyvsp[-5].String, yyvsp[-3].Const->type);
3399 yyval.String = new std::string(op);
3400 *yyval.String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3401 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3402 }
Reid Spencer319a7302007-01-05 17:20:02 +00003403 break;
3404
3405 case 165:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003406#line 1395 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003407 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003408 *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3409 delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3410 yyval.String = yyvsp[-5].String;
3411 }
Reid Spencer319a7302007-01-05 17:20:02 +00003412 break;
3413
3414 case 166:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003415#line 1400 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003416 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003417 *yyvsp[-5].String = getCompareOp(*yyvsp[-5].String, yyvsp[-3].Const->type);
3418 *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3419 delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3420 yyval.String = yyvsp[-5].String;
3421 }
Reid Spencer319a7302007-01-05 17:20:02 +00003422 break;
3423
3424 case 167:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003425#line 1406 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003426 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003427 *yyvsp[-6].String += " " + *yyvsp[-5].String + " (" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3428 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3429 yyval.String = yyvsp[-6].String;
3430 }
Reid Spencer319a7302007-01-05 17:20:02 +00003431 break;
3432
3433 case 168:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003434#line 1411 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003435 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003436 *yyvsp[-6].String += " " + *yyvsp[-5].String + " (" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3437 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3438 yyval.String = yyvsp[-6].String;
3439 }
Reid Spencer319a7302007-01-05 17:20:02 +00003440 break;
3441
3442 case 169:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003443#line 1416 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003444 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003445 const char* shiftop = yyvsp[-5].String->c_str();
3446 if (*yyvsp[-5].String == "shr")
3447 shiftop = (yyvsp[-3].Const->type->isUnsigned()) ? "lshr" : "ashr";
3448 yyval.String = new std::string(shiftop);
3449 *yyval.String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3450 delete yyvsp[-5].String; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3451 }
Reid Spencer319a7302007-01-05 17:20:02 +00003452 break;
3453
3454 case 170:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003455#line 1424 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003456 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003457 *yyvsp[-5].String += "(" + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3458 delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3459 yyval.String = yyvsp[-5].String;
3460 }
Reid Spencer319a7302007-01-05 17:20:02 +00003461 break;
3462
3463 case 171:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003464#line 1429 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003465 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003466 *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3467 delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3468 yyval.String = yyvsp[-7].String;
3469 }
Reid Spencer319a7302007-01-05 17:20:02 +00003470 break;
3471
3472 case 172:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003473#line 1434 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003474 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003475 *yyvsp[-7].String += "(" + *yyvsp[-5].Const->cnst + "," + *yyvsp[-3].Const->cnst + "," + *yyvsp[-1].Const->cnst + ")";
3476 delete yyvsp[-5].Const; delete yyvsp[-3].Const; delete yyvsp[-1].Const;
3477 yyval.String = yyvsp[-7].String;
3478 }
Reid Spencer319a7302007-01-05 17:20:02 +00003479 break;
3480
3481 case 173:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003482#line 1444 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003483 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003484 *yyvsp[-2].String += ", " + *yyvsp[0].Const->cnst;
3485 delete yyvsp[0].Const;
3486 yyval.String = yyvsp[-2].String;
3487 }
Reid Spencer319a7302007-01-05 17:20:02 +00003488 break;
3489
3490 case 174:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003491#line 1449 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3492 { yyval.String = new std::string(*yyvsp[0].Const->cnst); delete yyvsp[0].Const; }
Reid Spencer319a7302007-01-05 17:20:02 +00003493 break;
3494
3495 case 177:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003496#line 1464 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003497 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003498}
Reid Spencer319a7302007-01-05 17:20:02 +00003499 break;
3500
3501 case 178:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003502#line 1469 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003503 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003504 yyval.String = 0;
3505 }
Reid Spencer319a7302007-01-05 17:20:02 +00003506 break;
3507
3508 case 179:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003509#line 1472 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003510 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003511 *O << *yyvsp[0].String << '\n';
3512 delete yyvsp[0].String;
3513 yyval.String = 0;
3514 }
Reid Spencer319a7302007-01-05 17:20:02 +00003515 break;
3516
3517 case 180:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003518#line 1477 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003519 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003520 *O << "module asm " << ' ' << *yyvsp[0].String << '\n';
3521 yyval.String = 0;
3522 }
Reid Spencer319a7302007-01-05 17:20:02 +00003523 break;
3524
3525 case 181:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003526#line 1481 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003527 {
Reid Spencerd154b572006-12-01 20:36:40 +00003528 *O << "implementation\n";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003529 yyval.String = 0;
3530 }
Reid Spencer319a7302007-01-05 17:20:02 +00003531 break;
3532
3533 case 182:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003534#line 1485 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3535 { yyval.String = 0; }
Reid Spencer319a7302007-01-05 17:20:02 +00003536 break;
3537
3538 case 184:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003539#line 1488 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3540 { yyval.String = yyvsp[0].String; *yyval.String = "external"; }
Reid Spencer319a7302007-01-05 17:20:02 +00003541 break;
3542
3543 case 185:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003544#line 1491 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003545 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003546 Type::EnumeratedTypes.push_back(yyvsp[0].Ty);
3547 if (!yyvsp[-2].String->empty()) {
3548 Type::NamedTypes[*yyvsp[-2].String] = yyvsp[0].Ty;
3549 *O << *yyvsp[-2].String << " = ";
Reid Spencera50d5962006-12-02 04:11:07 +00003550 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003551 *O << "type " << yyvsp[0].Ty->getNewTy() << '\n';
3552 delete yyvsp[-2].String; delete yyvsp[-1].String;
3553 yyval.String = 0;
3554 }
Reid Spencer319a7302007-01-05 17:20:02 +00003555 break;
3556
3557 case 186:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003558#line 1501 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003559 { // Function prototypes can be in const pool
Jeff Cohenac2dca92007-01-21 19:30:52 +00003560 *O << *yyvsp[0].String << '\n';
3561 delete yyvsp[0].String;
3562 yyval.String = 0;
3563 }
Reid Spencer319a7302007-01-05 17:20:02 +00003564 break;
3565
3566 case 187:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003567#line 1506 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003568 { // Asm blocks can be in the const pool
Jeff Cohenac2dca92007-01-21 19:30:52 +00003569 *O << *yyvsp[-2].String << ' ' << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3570 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3571 yyval.String = 0;
3572 }
Reid Spencer319a7302007-01-05 17:20:02 +00003573 break;
3574
3575 case 188:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003576#line 1511 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003577 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003578 if (!yyvsp[-4].String->empty()) {
3579 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String, yyvsp[-1].Const->type->getPointerType(),
3580 *yyvsp[-2].String == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003581 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003582 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003583 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << *yyvsp[-1].Const->cnst << ' ' << *yyvsp[0].String << '\n';
3584 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3585 yyval.String = 0;
3586 }
Reid Spencer319a7302007-01-05 17:20:02 +00003587 break;
3588
3589 case 189:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003590#line 1521 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003591 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003592 if (!yyvsp[-4].String->empty()) {
3593 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3594 *yyvsp[-2].String == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003595 *O << Name << " = ";
Reid Spencerf12ee422006-12-05 19:21:25 +00003596 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003597 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3598 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3599 yyval.String = 0;
3600 }
Reid Spencer319a7302007-01-05 17:20:02 +00003601 break;
3602
3603 case 190:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003604#line 1531 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003605 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003606 if (!yyvsp[-4].String->empty()) {
3607 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3608 *yyvsp[-2].String == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003609 *O << Name << " = ";
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003610 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003611 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3612 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3613 yyval.String = 0;
3614 }
Reid Spencer319a7302007-01-05 17:20:02 +00003615 break;
3616
3617 case 191:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003618#line 1541 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003619 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003620 if (!yyvsp[-4].String->empty()) {
3621 std::string Name = getGlobalName(yyvsp[-4].String,*yyvsp[-3].String,yyvsp[-1].Ty->getPointerType(),
3622 *yyvsp[-2].String == "constant");
Reid Spencer52402b02007-01-02 05:45:11 +00003623 *O << Name << " = ";
Reid Spencerf5626a32007-01-01 01:20:41 +00003624 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003625 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].String << '\n';
3626 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3627 yyval.String = 0;
3628 }
Reid Spencer319a7302007-01-05 17:20:02 +00003629 break;
3630
3631 case 192:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003632#line 1551 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003633 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003634 *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3635 delete yyvsp[-1].String; delete yyvsp[0].String;
3636 yyval.String = 0;
3637 }
Reid Spencer319a7302007-01-05 17:20:02 +00003638 break;
3639
3640 case 193:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003641#line 1556 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003642 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003643 *O << *yyvsp[-2].String << " = " << *yyvsp[0].String << '\n';
3644 delete yyvsp[-2].String; delete yyvsp[0].String;
3645 yyval.String = 0;
3646 }
Reid Spencer319a7302007-01-05 17:20:02 +00003647 break;
3648
3649 case 194:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003650#line 1561 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003651 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003652 yyval.String = 0;
3653 }
Reid Spencer319a7302007-01-05 17:20:02 +00003654 break;
3655
3656 case 198:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003657#line 1571 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003658 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003659 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3660 delete yyvsp[0].String;
3661 yyval.String = yyvsp[-2].String;
3662 }
Reid Spencer319a7302007-01-05 17:20:02 +00003663 break;
3664
3665 case 199:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003666#line 1576 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003667 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003668 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3669 if (*yyvsp[0].String == "64")
Reid Spencere77e35e2006-12-01 20:26:20 +00003670 SizeOfPointer = 64;
Jeff Cohenac2dca92007-01-21 19:30:52 +00003671 delete yyvsp[0].String;
3672 yyval.String = yyvsp[-2].String;
3673 }
Reid Spencer319a7302007-01-05 17:20:02 +00003674 break;
3675
3676 case 200:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003677#line 1583 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003678 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003679 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3680 delete yyvsp[0].String;
3681 yyval.String = yyvsp[-2].String;
3682 }
Reid Spencer319a7302007-01-05 17:20:02 +00003683 break;
3684
3685 case 201:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003686#line 1588 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003687 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003688 *yyvsp[-2].String += " = " + *yyvsp[0].String;
3689 delete yyvsp[0].String;
3690 yyval.String = yyvsp[-2].String;
3691 }
Reid Spencer319a7302007-01-05 17:20:02 +00003692 break;
3693
3694 case 202:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003695#line 1595 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003696 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003697 yyvsp[-1].String->insert(0, "[ ");
3698 *yyvsp[-1].String += " ]";
3699 yyval.String = yyvsp[-1].String;
3700 }
Reid Spencer319a7302007-01-05 17:20:02 +00003701 break;
3702
3703 case 203:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003704#line 1602 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003705 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003706 *yyvsp[-2].String += ", " + *yyvsp[0].String;
3707 delete yyvsp[0].String;
3708 yyval.String = yyvsp[-2].String;
3709 }
Reid Spencer319a7302007-01-05 17:20:02 +00003710 break;
3711
3712 case 205:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003713#line 1608 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003714 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003715 yyval.String = new std::string();
3716 }
Reid Spencer319a7302007-01-05 17:20:02 +00003717 break;
3718
3719 case 209:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003720#line 1617 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3721 { yyval.String = new std::string(); }
Reid Spencer319a7302007-01-05 17:20:02 +00003722 break;
3723
3724 case 210:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003725#line 1619 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003726 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003727 yyval.String = new std::string(yyvsp[-1].Ty->getNewTy());
3728 if (!yyvsp[0].String->empty()) {
3729 std::string Name = getUniqueName(yyvsp[0].String, yyvsp[-1].Ty->resolve());
3730 *yyval.String += " " + Name;
Reid Spencer52402b02007-01-02 05:45:11 +00003731 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003732 delete yyvsp[0].String;
3733}
Reid Spencer319a7302007-01-05 17:20:02 +00003734 break;
3735
3736 case 211:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003737#line 1628 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003738 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003739 *yyvsp[-2].String += ", " + *yyvsp[0].String;
3740 delete yyvsp[0].String;
3741 }
Reid Spencer319a7302007-01-05 17:20:02 +00003742 break;
3743
3744 case 212:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003745#line 1632 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003746 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003747 yyval.String = yyvsp[0].String;
3748 }
Reid Spencer319a7302007-01-05 17:20:02 +00003749 break;
3750
Reid Spencerc4d96252007-01-13 00:03:30 +00003751 case 213:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003752#line 1636 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003753 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003754 yyval.String = yyvsp[0].String;
3755 }
Reid Spencerc4d96252007-01-13 00:03:30 +00003756 break;
3757
Reid Spencer319a7302007-01-05 17:20:02 +00003758 case 214:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003759#line 1639 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003760 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003761 *yyvsp[-2].String += ", ...";
3762 yyval.String = yyvsp[-2].String;
3763 delete yyvsp[0].String;
3764 }
Reid Spencer319a7302007-01-05 17:20:02 +00003765 break;
3766
3767 case 215:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003768#line 1644 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003769 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003770 yyval.String = yyvsp[0].String;
3771 }
Reid Spencer319a7302007-01-05 17:20:02 +00003772 break;
3773
3774 case 216:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003775#line 1647 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3776 { yyval.String = new std::string(); }
Reid Spencer319a7302007-01-05 17:20:02 +00003777 break;
3778
3779 case 217:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003780#line 1650 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003781 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003782 if (*yyvsp[-5].String == "%llvm.va_start" || *yyvsp[-5].String == "%llvm.va_end") {
3783 *yyvsp[-3].String = "i8*";
3784 } else if (*yyvsp[-5].String == "%llvm.va_copy") {
3785 *yyvsp[-3].String = "i8*, i8*";
Reid Spencerc4d96252007-01-13 00:03:30 +00003786 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003787 if (!yyvsp[-7].String->empty()) {
3788 *yyvsp[-7].String += " ";
Reid Spencere77e35e2006-12-01 20:26:20 +00003789 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003790 *yyvsp[-7].String += yyvsp[-6].Ty->getNewTy() + " " + *yyvsp[-5].String + "(" + *yyvsp[-3].String + ")";
3791 if (!yyvsp[-1].String->empty()) {
3792 *yyvsp[-7].String += " " + *yyvsp[-1].String;
Reid Spencere77e35e2006-12-01 20:26:20 +00003793 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003794 if (!yyvsp[0].String->empty()) {
3795 *yyvsp[-7].String += " " + *yyvsp[0].String;
Reid Spencere77e35e2006-12-01 20:26:20 +00003796 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003797 delete yyvsp[-5].String;
3798 delete yyvsp[-3].String;
3799 delete yyvsp[-1].String;
3800 delete yyvsp[0].String;
3801 yyval.String = yyvsp[-7].String;
3802 }
Reid Spencer319a7302007-01-05 17:20:02 +00003803 break;
3804
3805 case 218:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003806#line 1673 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3807 { yyval.String = new std::string("{"); delete yyvsp[0].String; }
Reid Spencer319a7302007-01-05 17:20:02 +00003808 break;
3809
3810 case 219:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003811#line 1674 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3812 { yyval.String = new std::string ("{"); }
Reid Spencer319a7302007-01-05 17:20:02 +00003813 break;
3814
3815 case 220:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003816#line 1678 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003817 {
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003818 *O << "define ";
Jeff Cohenac2dca92007-01-21 19:30:52 +00003819 if (!yyvsp[-2].String->empty()) {
3820 *O << *yyvsp[-2].String << ' ';
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003821 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003822 *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
3823 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3824 yyval.String = 0;
3825 }
Reid Spencer319a7302007-01-05 17:20:02 +00003826 break;
3827
3828 case 221:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003829#line 1689 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3830 { yyval.String = new std::string("}"); delete yyvsp[0].String; }
Reid Spencer319a7302007-01-05 17:20:02 +00003831 break;
3832
3833 case 222:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003834#line 1690 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3835 { yyval.String = new std::string("}"); }
Reid Spencer319a7302007-01-05 17:20:02 +00003836 break;
3837
3838 case 223:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003839#line 1692 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003840 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003841 if (yyvsp[-1].String)
3842 *O << *yyvsp[-1].String;
3843 *O << *yyvsp[0].String << "\n\n";
3844 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
3845 yyval.String = 0;
3846}
Reid Spencer319a7302007-01-05 17:20:02 +00003847 break;
3848
3849 case 224:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003850#line 1701 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3851 { yyval.String = new std::string(); }
Reid Spencer319a7302007-01-05 17:20:02 +00003852 break;
3853
3854 case 227:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003855#line 1707 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3856 { isDeclare = true; }
Reid Spencer319a7302007-01-05 17:20:02 +00003857 break;
3858
3859 case 228:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003860#line 1707 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003861 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003862 if (!yyvsp[-1].String->empty())
3863 *yyvsp[-3].String += " " + *yyvsp[-1].String;
3864 *yyvsp[-3].String += " " + *yyvsp[0].String;
3865 delete yyvsp[-1].String;
3866 delete yyvsp[0].String;
3867 yyval.String = yyvsp[-3].String;
Reid Spencerc4d96252007-01-13 00:03:30 +00003868 isDeclare = false;
Jeff Cohenac2dca92007-01-21 19:30:52 +00003869 }
Reid Spencerc4d96252007-01-13 00:03:30 +00003870 break;
3871
3872 case 229:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003873#line 1721 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3874 { yyval.String = new std::string(); }
Reid Spencer319a7302007-01-05 17:20:02 +00003875 break;
3876
Reid Spencerc4d96252007-01-13 00:03:30 +00003877 case 239:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003878#line 1727 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003879 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003880 yyvsp[-1].String->insert(0, "<");
3881 *yyvsp[-1].String += ">";
3882 yyval.String = yyvsp[-1].String;
3883 }
Reid Spencer319a7302007-01-05 17:20:02 +00003884 break;
3885
Reid Spencerc4d96252007-01-13 00:03:30 +00003886 case 241:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003887#line 1733 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003888 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003889 if (!yyvsp[-3].String->empty()) {
3890 *yyvsp[-4].String += " " + *yyvsp[-3].String;
Reid Spencere77e35e2006-12-01 20:26:20 +00003891 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00003892 *yyvsp[-4].String += " " + *yyvsp[-2].String + ", " + *yyvsp[0].String;
3893 delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
3894 yyval.String = yyvsp[-4].String;
3895 }
Reid Spencer319a7302007-01-05 17:20:02 +00003896 break;
3897
Reid Spencerc4d96252007-01-13 00:03:30 +00003898 case 244:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003899#line 1746 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003900 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003901 yyval.Val = new Value;
3902 yyval.Val->val = yyvsp[0].String;
3903 yyval.Val->constant = false;
3904 yyval.Val->type = 0;
3905 }
Reid Spencer319a7302007-01-05 17:20:02 +00003906 break;
3907
Reid Spencerc4d96252007-01-13 00:03:30 +00003908 case 245:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003909#line 1752 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003910 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003911 yyval.Val = new Value;
3912 yyval.Val->val = yyvsp[0].String;
3913 yyval.Val->constant = true;
3914 yyval.Val->type = 0;
3915 }
Reid Spencer319a7302007-01-05 17:20:02 +00003916 break;
3917
Reid Spencerc4d96252007-01-13 00:03:30 +00003918 case 246:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003919#line 1763 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003920 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003921 yyvsp[-1].Ty = yyvsp[-1].Ty->resolve();
3922 std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
3923 yyval.Val = yyvsp[0].Val;
3924 delete yyval.Val->val;
3925 yyval.Val->val = new std::string(yyvsp[-1].Ty->getNewTy() + " " + Name);
3926 yyval.Val->type = yyvsp[-1].Ty;
3927 }
Reid Spencer319a7302007-01-05 17:20:02 +00003928 break;
3929
Reid Spencer319a7302007-01-05 17:20:02 +00003930 case 247:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003931#line 1772 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003932 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003933 yyval.String = 0;
3934 }
Reid Spencer319a7302007-01-05 17:20:02 +00003935 break;
3936
3937 case 248:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003938#line 1775 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003939 { // Do not allow functions with 0 basic blocks
Jeff Cohenac2dca92007-01-21 19:30:52 +00003940 yyval.String = 0;
3941 }
Reid Spencer319a7302007-01-05 17:20:02 +00003942 break;
3943
3944 case 249:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003945#line 1783 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00003946 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003947 yyval.String = 0;
3948 }
Reid Spencerc4d96252007-01-13 00:03:30 +00003949 break;
3950
3951 case 250:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003952#line 1787 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003953 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003954 *O << " " << *yyvsp[0].String << '\n';
3955 delete yyvsp[0].String;
3956 yyval.String = 0;
3957 }
Reid Spencer319a7302007-01-05 17:20:02 +00003958 break;
3959
Reid Spencerc4d96252007-01-13 00:03:30 +00003960 case 251:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003961#line 1792 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003962 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003963 yyval.String = 0;
3964 }
Reid Spencer319a7302007-01-05 17:20:02 +00003965 break;
3966
Reid Spencerc4d96252007-01-13 00:03:30 +00003967 case 252:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003968#line 1795 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003969 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00003970 *O << *yyvsp[0].String << '\n';
3971 delete yyvsp[0].String;
3972 yyval.String = 0;
3973 }
Reid Spencer319a7302007-01-05 17:20:02 +00003974 break;
3975
Reid Spencerc4d96252007-01-13 00:03:30 +00003976 case 254:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003977#line 1801 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
3978 { yyval.String = yyvsp[0].String; *yyval.String = "unwind"; }
Reid Spencer319a7302007-01-05 17:20:02 +00003979 break;
3980
Reid Spencerc4d96252007-01-13 00:03:30 +00003981 case 255:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003982#line 1803 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003983 { // Return with a result...
Jeff Cohenac2dca92007-01-21 19:30:52 +00003984 *O << " " << *yyvsp[-1].String << ' ' << *yyvsp[0].Val->val << '\n';
3985 delete yyvsp[-1].String; delete yyvsp[0].Val;
3986 yyval.String = 0;
3987 }
Reid Spencer319a7302007-01-05 17:20:02 +00003988 break;
3989
Reid Spencerc4d96252007-01-13 00:03:30 +00003990 case 256:
Jeff Cohenac2dca92007-01-21 19:30:52 +00003991#line 1808 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00003992 { // Return with no result...
Jeff Cohenac2dca92007-01-21 19:30:52 +00003993 *O << " " << *yyvsp[-1].String << ' ' << yyvsp[0].Ty->getNewTy() << '\n';
3994 delete yyvsp[-1].String;
3995 yyval.String = 0;
3996 }
Reid Spencer319a7302007-01-05 17:20:02 +00003997 break;
3998
Reid Spencerc4d96252007-01-13 00:03:30 +00003999 case 257:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004000#line 1813 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004001 { // Unconditional Branch...
Jeff Cohenac2dca92007-01-21 19:30:52 +00004002 *O << " " << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].Val->val << '\n';
4003 delete yyvsp[-2].String; delete yyvsp[0].Val;
4004 yyval.String = 0;
4005 }
Reid Spencer319a7302007-01-05 17:20:02 +00004006 break;
4007
Reid Spencerc4d96252007-01-13 00:03:30 +00004008 case 258:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004009#line 1818 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004010 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004011 std::string Name = getUniqueName(yyvsp[-6].Val->val, yyvsp[-7].Ty);
4012 *O << " " << *yyvsp[-8].String << ' ' << yyvsp[-7].Ty->getNewTy() << ' ' << Name << ", "
4013 << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << ", " << yyvsp[-1].Ty->getNewTy() << ' '
4014 << *yyvsp[0].Val->val << '\n';
4015 delete yyvsp[-8].String; delete yyvsp[-6].Val; delete yyvsp[-3].Val; delete yyvsp[0].Val;
4016 yyval.String = 0;
4017 }
Reid Spencer319a7302007-01-05 17:20:02 +00004018 break;
4019
Reid Spencerc4d96252007-01-13 00:03:30 +00004020 case 259:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004021#line 1826 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004022 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004023 std::string Name = getUniqueName(yyvsp[-6].Val->val, yyvsp[-7].Ty);
4024 *O << " " << *yyvsp[-8].String << ' ' << yyvsp[-7].Ty->getNewTy() << ' ' << Name << ", "
4025 << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << " [" << *yyvsp[-1].String << " ]\n";
4026 delete yyvsp[-8].String;
4027 delete yyvsp[-6].Val;
4028 delete yyvsp[-3].Val;
4029 delete yyvsp[-1].String;
4030 yyval.String = 0;
4031 }
Reid Spencer319a7302007-01-05 17:20:02 +00004032 break;
4033
Reid Spencerc4d96252007-01-13 00:03:30 +00004034 case 260:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004035#line 1836 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004036 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004037 std::string Name = getUniqueName(yyvsp[-5].Val->val, yyvsp[-6].Ty);
4038 *O << " " << *yyvsp[-7].String << ' ' << yyvsp[-6].Ty->getNewTy() << ' ' << Name << ", "
4039 << yyvsp[-3].Ty->getNewTy() << ' ' << *yyvsp[-2].Val->val << "[]\n";
4040 delete yyvsp[-7].String;
4041 delete yyvsp[-5].Val;
4042 delete yyvsp[-2].Val;
4043 yyval.String = 0;
4044 }
Reid Spencer319a7302007-01-05 17:20:02 +00004045 break;
4046
Reid Spencerc4d96252007-01-13 00:03:30 +00004047 case 261:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004048#line 1846 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004049 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004050 const Type* ResTy = getFunctionReturnType(yyvsp[-10].Ty);
Reid Spencer16244f42006-12-01 21:10:07 +00004051 *O << " ";
Jeff Cohenac2dca92007-01-21 19:30:52 +00004052 if (!yyvsp[-13].String->empty()) {
4053 std::string Name = getUniqueName(yyvsp[-13].String, ResTy);
Reid Spencer52402b02007-01-02 05:45:11 +00004054 *O << Name << " = ";
4055 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004056 *O << *yyvsp[-12].String << ' ' << *yyvsp[-11].String << ' ' << yyvsp[-10].Ty->getNewTy() << ' ' << *yyvsp[-9].Val->val << " (";
4057 for (unsigned i = 0; i < yyvsp[-7].ValList->size(); ++i) {
4058 Value* V = (*yyvsp[-7].ValList)[i];
Reid Spencerb6673a92007-01-15 02:41:46 +00004059 *O << *V->val;
Jeff Cohenac2dca92007-01-21 19:30:52 +00004060 if (i+1 < yyvsp[-7].ValList->size())
Reid Spencerf8483652006-12-02 15:16:01 +00004061 *O << ", ";
Reid Spencerb6673a92007-01-15 02:41:46 +00004062 delete V;
Reid Spencerf8483652006-12-02 15:16:01 +00004063 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004064 *O << ") " << *yyvsp[-5].String << ' ' << yyvsp[-4].Ty->getNewTy() << ' ' << *yyvsp[-3].Val->val << ' '
4065 << *yyvsp[-2].String << ' ' << yyvsp[-1].Ty->getNewTy() << ' ' << *yyvsp[0].Val->val << '\n';
4066 delete yyvsp[-13].String; delete yyvsp[-12].String; delete yyvsp[-11].String; delete yyvsp[-9].Val; delete yyvsp[-7].ValList;
4067 delete yyvsp[-5].String; delete yyvsp[-3].Val; delete yyvsp[-2].String; delete yyvsp[0].Val;
4068 yyval.String = 0;
4069 }
Reid Spencer319a7302007-01-05 17:20:02 +00004070 break;
4071
Reid Spencer319a7302007-01-05 17:20:02 +00004072 case 262:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004073#line 1867 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004074 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004075 *O << " " << *yyvsp[0].String << '\n';
4076 delete yyvsp[0].String;
4077 yyval.String = 0;
4078 }
Reid Spencer319a7302007-01-05 17:20:02 +00004079 break;
4080
4081 case 263:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004082#line 1872 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004083 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004084 *O << " " << *yyvsp[0].String << '\n';
4085 delete yyvsp[0].String;
4086 yyval.String = 0;
4087 }
Reid Spencerc4d96252007-01-13 00:03:30 +00004088 break;
4089
4090 case 264:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004091#line 1878 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004092 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004093 *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + " " + *yyvsp[-3].String + ", " + yyvsp[-1].Ty->getNewTy() + " " +
4094 *yyvsp[0].Val->val;
4095 delete yyvsp[-3].String; delete yyvsp[0].Val;
4096 yyval.String = yyvsp[-5].String;
4097 }
Reid Spencer319a7302007-01-05 17:20:02 +00004098 break;
4099
Reid Spencerc4d96252007-01-13 00:03:30 +00004100 case 265:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004101#line 1884 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004102 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004103 yyvsp[-3].String->insert(0, yyvsp[-4].Ty->getNewTy() + " " );
4104 *yyvsp[-3].String += ", " + yyvsp[-1].Ty->getNewTy() + " " + *yyvsp[0].Val->val;
4105 delete yyvsp[0].Val;
4106 yyval.String = yyvsp[-3].String;
4107 }
Reid Spencer319a7302007-01-05 17:20:02 +00004108 break;
4109
Reid Spencerc4d96252007-01-13 00:03:30 +00004110 case 266:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004111#line 1892 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004112 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004113 if (!yyvsp[-1].String->empty()) {
Reid Spencer319a7302007-01-05 17:20:02 +00004114 // Get a unique name for this value, based on its type.
Jeff Cohenac2dca92007-01-21 19:30:52 +00004115 std::string Name = getUniqueName(yyvsp[-1].String, yyvsp[0].Val->type);
4116 *yyvsp[-1].String = Name + " = ";
Reid Spencer319a7302007-01-05 17:20:02 +00004117 if (deleteUselessCastFlag && *deleteUselessCastName == Name) {
4118 // don't actually delete it, just comment it out
Jeff Cohenac2dca92007-01-21 19:30:52 +00004119 yyvsp[-1].String->insert(0, "; USELSS BITCAST: ");
Reid Spencerf5626a32007-01-01 01:20:41 +00004120 delete deleteUselessCastName;
Reid Spencerf5626a32007-01-01 01:20:41 +00004121 }
4122 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004123 *yyvsp[-1].String += *yyvsp[0].Val->val;
4124 delete yyvsp[0].Val;
Reid Spencerf5626a32007-01-01 01:20:41 +00004125 deleteUselessCastFlag = false;
Jeff Cohenac2dca92007-01-21 19:30:52 +00004126 yyval.String = yyvsp[-1].String;
4127 }
Reid Spencer319a7302007-01-05 17:20:02 +00004128 break;
4129
Reid Spencerc4d96252007-01-13 00:03:30 +00004130 case 267:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004131#line 1910 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004132 { // Used for PHI nodes
Jeff Cohenac2dca92007-01-21 19:30:52 +00004133 std::string Name = getUniqueName(yyvsp[-3].Val->val, yyvsp[-5].Ty);
4134 Name.insert(0, yyvsp[-5].Ty->getNewTy() + "[");
4135 Name += "," + *yyvsp[-1].Val->val + "]";
4136 yyval.Val = new Value;
4137 yyval.Val->val = new std::string(Name);
4138 yyval.Val->type = yyvsp[-5].Ty;
4139 delete yyvsp[-3].Val; delete yyvsp[-1].Val;
4140 }
Reid Spencer319a7302007-01-05 17:20:02 +00004141 break;
4142
Reid Spencerc4d96252007-01-13 00:03:30 +00004143 case 268:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004144#line 1919 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004145 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004146 std::string Name = getUniqueName(yyvsp[-3].Val->val, yyvsp[-6].Val->type);
4147 *yyvsp[-6].Val->val += ", [" + Name + "," + *yyvsp[-1].Val->val + "]";
4148 delete yyvsp[-3].Val;
4149 delete yyvsp[-1].Val;
4150 yyval.Val = yyvsp[-6].Val;
4151 }
Reid Spencer319a7302007-01-05 17:20:02 +00004152 break;
4153
Reid Spencerc4d96252007-01-13 00:03:30 +00004154 case 269:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004155#line 1929 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004156 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004157 yyval.ValList = new ValueList();
4158 yyval.ValList->push_back(yyvsp[0].Val);
4159 }
Reid Spencer319a7302007-01-05 17:20:02 +00004160 break;
4161
Reid Spencerc4d96252007-01-13 00:03:30 +00004162 case 270:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004163#line 1933 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004164 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004165 yyval.ValList = yyvsp[-2].ValList;
4166 yyval.ValList->push_back(yyvsp[0].Val);
4167 }
Reid Spencer319a7302007-01-05 17:20:02 +00004168 break;
4169
Reid Spencerc4d96252007-01-13 00:03:30 +00004170 case 271:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004171#line 1940 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4172 { yyval.ValList = yyvsp[0].ValList; }
Reid Spencer319a7302007-01-05 17:20:02 +00004173 break;
4174
Reid Spencerc4d96252007-01-13 00:03:30 +00004175 case 272:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004176#line 1941 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4177 { yyval.ValList = new ValueList(); }
Reid Spencer319a7302007-01-05 17:20:02 +00004178 break;
4179
Reid Spencerc4d96252007-01-13 00:03:30 +00004180 case 273:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004181#line 1945 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004182 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004183 *yyvsp[-1].String += " " + *yyvsp[0].String;
4184 delete yyvsp[0].String;
4185 yyval.String = yyvsp[-1].String;
4186 }
Reid Spencer319a7302007-01-05 17:20:02 +00004187 break;
4188
Reid Spencerc4d96252007-01-13 00:03:30 +00004189 case 275:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004190#line 1953 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004191 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004192 const char* op = getDivRemOpcode(*yyvsp[-4].String, yyvsp[-3].Ty);
4193 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4194 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4195 yyval.Val = yyvsp[-2].Val;
4196 delete yyval.Val->val;
4197 yyval.Val->val = new std::string(op);
4198 *yyval.Val->val += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4199 yyval.Val->type = yyvsp[-3].Ty;
4200 delete yyvsp[-4].String; delete yyvsp[0].Val;
4201 }
Reid Spencer319a7302007-01-05 17:20:02 +00004202 break;
4203
Reid Spencerc4d96252007-01-13 00:03:30 +00004204 case 276:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004205#line 1964 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004206 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004207 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4208 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4209 *yyvsp[-4].String += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4210 yyval.Val = yyvsp[-2].Val;
4211 delete yyval.Val->val;
4212 yyval.Val->val = yyvsp[-4].String;
4213 yyval.Val->type = yyvsp[-3].Ty;
4214 delete yyvsp[0].Val;
4215 }
Reid Spencer319a7302007-01-05 17:20:02 +00004216 break;
4217
Reid Spencerc4d96252007-01-13 00:03:30 +00004218 case 277:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004219#line 1974 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004220 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004221 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4222 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4223 *yyvsp[-4].String = getCompareOp(*yyvsp[-4].String, yyvsp[-3].Ty);
4224 *yyvsp[-4].String += " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + ", " + Name2;
4225 yyval.Val = yyvsp[-2].Val;
4226 delete yyval.Val->val;
4227 yyval.Val->val = yyvsp[-4].String;
4228 yyval.Val->type = Type::get("i1",BoolTy);
4229 delete yyvsp[0].Val;
4230 }
Reid Spencer319a7302007-01-05 17:20:02 +00004231 break;
4232
Reid Spencer319a7302007-01-05 17:20:02 +00004233 case 278:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004234#line 1985 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004235 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004236 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4237 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4238 *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + "," + Name2;
4239 yyval.Val = yyvsp[-2].Val;
4240 delete yyval.Val->val;
4241 yyval.Val->val = yyvsp[-5].String;
4242 yyval.Val->type = Type::get("i1",BoolTy);
4243 delete yyvsp[-4].String; delete yyvsp[0].Val;
4244 }
Reid Spencer319a7302007-01-05 17:20:02 +00004245 break;
4246
4247 case 279:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004248#line 1995 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004249 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004250 std::string Name1 = getUniqueName(yyvsp[-2].Val->val, yyvsp[-3].Ty);
4251 std::string Name2 = getUniqueName(yyvsp[0].Val->val, yyvsp[-3].Ty);
4252 *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Ty->getNewTy() + " " + Name1 + "," + Name2;
4253 yyval.Val = yyvsp[-2].Val;
4254 delete yyval.Val->val;
4255 yyval.Val->val = yyvsp[-5].String;
4256 yyval.Val->type = Type::get("i1",BoolTy);
4257 delete yyvsp[-4].String; delete yyvsp[0].Val;
4258 }
Reid Spencerc4d96252007-01-13 00:03:30 +00004259 break;
4260
4261 case 280:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004262#line 2005 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004263 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004264 const char* shiftop = yyvsp[-3].String->c_str();
4265 if (*yyvsp[-3].String == "shr")
4266 shiftop = (yyvsp[-2].Val->type->isUnsigned()) ? "lshr" : "ashr";
Reid Spencer30d0c582007-01-15 00:26:18 +00004267 std::string *val = new std::string(shiftop);
Jeff Cohenac2dca92007-01-21 19:30:52 +00004268 *val += " " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4269 yyval.Val = yyvsp[-2].Val;
4270 delete yyval.Val->val;
4271 yyval.Val->val = val;
4272 delete yyvsp[-3].String; delete yyvsp[0].Val;
4273 }
Reid Spencer319a7302007-01-05 17:20:02 +00004274 break;
4275
Reid Spencerc4d96252007-01-13 00:03:30 +00004276 case 281:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004277#line 2016 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004278 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004279 std::string source = *yyvsp[-2].Val->val;
4280 const Type* SrcTy = yyvsp[-2].Val->type->resolve();
4281 const Type* DstTy = yyvsp[0].Ty->resolve();
4282 yyval.Val = yyvsp[-2].Val;
4283 delete yyval.Val->val;
4284 yyval.Val->val = new std::string();
4285 yyval.Val->type = DstTy;
4286 if (*yyvsp[-3].String == "cast") {
4287 *yyval.Val->val += getCastUpgrade(source, SrcTy, DstTy, false);
Reid Spencera50d5962006-12-02 04:11:07 +00004288 } else {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004289 *yyval.Val->val += *yyvsp[-3].String + " " + source + " to " + DstTy->getNewTy();
Reid Spencer280d8012006-12-01 23:40:53 +00004290 }
Reid Spencerf5626a32007-01-01 01:20:41 +00004291 // Check to see if this is a useless cast of a value to the same name
4292 // and the same type. Such casts will probably cause redefinition errors
4293 // when assembled and perform no code gen action so just remove them.
Jeff Cohenac2dca92007-01-21 19:30:52 +00004294 if (*yyvsp[-3].String == "cast" || *yyvsp[-3].String == "bitcast")
Reid Spencer319a7302007-01-05 17:20:02 +00004295 if (SrcTy->isInteger() && DstTy->isInteger() &&
4296 SrcTy->getBitWidth() == DstTy->getBitWidth()) {
Reid Spencerf5626a32007-01-01 01:20:41 +00004297 deleteUselessCastFlag = true; // Flag the "Inst" rule
Jeff Cohenac2dca92007-01-21 19:30:52 +00004298 deleteUselessCastName = new std::string(*yyvsp[-2].Val->val); // save the name
Reid Spencerf5626a32007-01-01 01:20:41 +00004299 size_t pos = deleteUselessCastName->find_first_of("%\"",0);
4300 if (pos != std::string::npos) {
4301 // remove the type portion before val
4302 deleteUselessCastName->erase(0, pos);
4303 }
4304 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004305 delete yyvsp[-3].String;
4306 delete yyvsp[-1].String;
4307 }
Reid Spencer319a7302007-01-05 17:20:02 +00004308 break;
4309
Reid Spencerc4d96252007-01-13 00:03:30 +00004310 case 282:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004311#line 2046 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004312 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004313 *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4314 yyval.Val = yyvsp[-4].Val;
4315 delete yyval.Val->val;
4316 yyval.Val->val = yyvsp[-5].String;
4317 yyval.Val->type = yyvsp[-2].Val->type;
4318 delete yyvsp[-2].Val;
4319 delete yyvsp[0].Val;
4320 }
Reid Spencer319a7302007-01-05 17:20:02 +00004321 break;
4322
Reid Spencerc4d96252007-01-13 00:03:30 +00004323 case 283:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004324#line 2055 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004325 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004326 *yyvsp[-3].String += " " + *yyvsp[-2].Val->val + ", " + yyvsp[0].Ty->getNewTy();
4327 yyval.Val = yyvsp[-2].Val;
4328 delete yyval.Val->val;
4329 yyval.Val->val = yyvsp[-3].String;
4330 yyval.Val->type = yyvsp[0].Ty;
4331 }
Reid Spencer319a7302007-01-05 17:20:02 +00004332 break;
4333
Reid Spencerc4d96252007-01-13 00:03:30 +00004334 case 284:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004335#line 2062 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004336 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004337 *yyvsp[-3].String += " " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4338 yyval.Val = yyvsp[-2].Val;
4339 delete yyval.Val->val;
4340 yyval.Val->val = yyvsp[-3].String;
4341 yyval.Val->type = yyval.Val->type->resolve();
4342 yyval.Val->type = yyval.Val->type->getElementType();
4343 delete yyvsp[0].Val;
4344 }
Reid Spencer319a7302007-01-05 17:20:02 +00004345 break;
4346
4347 case 285:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004348#line 2071 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004349 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004350 *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4351 yyval.Val = yyvsp[-4].Val;
4352 delete yyval.Val->val;
4353 yyval.Val->val = yyvsp[-5].String;
4354 delete yyvsp[-2].Val; delete yyvsp[0].Val;
4355 }
Reid Spencer319a7302007-01-05 17:20:02 +00004356 break;
4357
4358 case 286:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004359#line 2078 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004360 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004361 *yyvsp[-5].String += " " + *yyvsp[-4].Val->val + ", " + *yyvsp[-2].Val->val + ", " + *yyvsp[0].Val->val;
4362 yyval.Val = yyvsp[-4].Val;
4363 delete yyval.Val->val;
4364 yyval.Val->val = yyvsp[-5].String;
4365 delete yyvsp[-2].Val; delete yyvsp[0].Val;
4366 }
Reid Spencerc4d96252007-01-13 00:03:30 +00004367 break;
4368
4369 case 287:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004370#line 2085 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004371 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004372 *yyvsp[-1].String += " " + *yyvsp[0].Val->val;
4373 yyval.Val = yyvsp[0].Val;
4374 delete yyvsp[0].Val->val;
4375 yyval.Val->val = yyvsp[-1].String;
4376 }
Reid Spencer319a7302007-01-05 17:20:02 +00004377 break;
4378
Reid Spencerc4d96252007-01-13 00:03:30 +00004379 case 288:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004380#line 2091 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004381 {
Reid Spencer12969882007-01-07 08:07:39 +00004382 // map llvm.isunordered to "fcmp uno"
Jeff Cohenac2dca92007-01-21 19:30:52 +00004383 yyval.Val = new Value;
4384 if (*yyvsp[-3].Val->val == "%llvm.isunordered.f32" ||
4385 *yyvsp[-3].Val->val == "%llvm.isunordered.f64") {
4386 yyval.Val->val = new std::string( "fcmp uno " + *(*yyvsp[-1].ValList)[0]->val + ", ");
4387 size_t pos = (*yyvsp[-1].ValList)[1]->val->find(' ');
Reid Spencer12969882007-01-07 08:07:39 +00004388 assert(pos != std::string::npos && "no space?");
Jeff Cohenac2dca92007-01-21 19:30:52 +00004389 *yyval.Val->val += (*yyvsp[-1].ValList)[1]->val->substr(pos+1);
4390 yyval.Val->type = Type::get("i1", BoolTy);
Reid Spencer12969882007-01-07 08:07:39 +00004391 } else {
Reid Spencerc4d96252007-01-13 00:03:30 +00004392 static unsigned upgradeCount = 1;
Jeff Cohenac2dca92007-01-21 19:30:52 +00004393 if (*yyvsp[-3].Val->val == "%llvm.va_start" || *yyvsp[-3].Val->val == "%llvm.va_end") {
4394 if (!yyvsp[-1].ValList->empty()) {
Reid Spencerf6e54592007-01-13 00:23:06 +00004395 std::string name("%va_upgrade");
4396 name += llvm::utostr(upgradeCount++);
Jeff Cohenac2dca92007-01-21 19:30:52 +00004397 yyvsp[-6].String->insert(0, name + " = bitcast " + *(*yyvsp[-1].ValList)[0]->val + " to i8*\n ");
4398 *(*yyvsp[-1].ValList)[0]->val = "i8* " + name;
4399 (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
Reid Spencerf6e54592007-01-13 00:23:06 +00004400 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004401 } else if (*yyvsp[-3].Val->val == "%llvm.va_copy") {
Reid Spencerc4d96252007-01-13 00:03:30 +00004402 std::string name0("%va_upgrade");
4403 name0 += llvm::utostr(upgradeCount++);
4404 std::string name1("%va_upgrade");
4405 name1 += llvm::utostr(upgradeCount++);
Jeff Cohenac2dca92007-01-21 19:30:52 +00004406 yyvsp[-6].String->insert(0, name0 + " = bitcast " + *(*yyvsp[-1].ValList)[0]->val + " to i8*\n " +
4407 name1 + " = bitcast " + *(*yyvsp[-1].ValList)[1]->val + " to i8*\n ");
4408 *(*yyvsp[-1].ValList)[0]->val = "i8* " + name0;
4409 (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
4410 *(*yyvsp[-1].ValList)[1]->val = "i8* " + name1;
4411 (*yyvsp[-1].ValList)[0]->type = Type::get("i8", UByteTy)->getPointerType();
Reid Spencerc4d96252007-01-13 00:03:30 +00004412 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004413 if (!yyvsp[-5].String->empty())
4414 *yyvsp[-6].String += " " + *yyvsp[-5].String;
4415 if (!yyvsp[-6].String->empty())
4416 *yyvsp[-6].String += " ";
4417 *yyvsp[-6].String += yyvsp[-4].Ty->getNewTy() + " " + *yyvsp[-3].Val->val + "(";
4418 for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
4419 Value* V = (*yyvsp[-1].ValList)[i];
4420 *yyvsp[-6].String += *V->val;
4421 if (i+1 < yyvsp[-1].ValList->size())
4422 *yyvsp[-6].String += ", ";
Reid Spencerb6673a92007-01-15 02:41:46 +00004423 delete V;
Reid Spencer12969882007-01-07 08:07:39 +00004424 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004425 *yyvsp[-6].String += ")";
4426 yyval.Val = new Value;
4427 yyval.Val->val = yyvsp[-6].String;
4428 yyval.Val->type = getFunctionReturnType(yyvsp[-4].Ty);
Reid Spencerf8483652006-12-02 15:16:01 +00004429 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004430 delete yyvsp[-5].String; delete yyvsp[-3].Val; delete yyvsp[-1].ValList;
4431 }
Reid Spencer319a7302007-01-05 17:20:02 +00004432 break;
4433
Reid Spencerc4d96252007-01-13 00:03:30 +00004434 case 290:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004435#line 2147 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4436 { yyval.ValList = yyvsp[0].ValList; }
Reid Spencer319a7302007-01-05 17:20:02 +00004437 break;
4438
Reid Spencerc4d96252007-01-13 00:03:30 +00004439 case 291:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004440#line 2148 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4441 { yyval.ValList = new ValueList(); }
Reid Spencer319a7302007-01-05 17:20:02 +00004442 break;
4443
Reid Spencerc4d96252007-01-13 00:03:30 +00004444 case 293:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004445#line 2153 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
4446 { yyval.String = new std::string(); }
Reid Spencer319a7302007-01-05 17:20:02 +00004447 break;
4448
Reid Spencerc4d96252007-01-13 00:03:30 +00004449 case 294:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004450#line 2156 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004451 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004452 *yyvsp[-2].String += " " + yyvsp[-1].Ty->getNewTy();
4453 if (!yyvsp[0].String->empty())
4454 *yyvsp[-2].String += " " + *yyvsp[0].String;
4455 yyval.Val = new Value;
4456 yyval.Val->val = yyvsp[-2].String;
4457 yyval.Val->type = yyvsp[-1].Ty->getPointerType();
4458 delete yyvsp[0].String;
4459 }
Reid Spencer319a7302007-01-05 17:20:02 +00004460 break;
4461
4462 case 295:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004463#line 2165 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004464 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004465 std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4466 *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + ", " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4467 if (!yyvsp[0].String->empty())
4468 *yyvsp[-5].String += " " + *yyvsp[0].String;
4469 yyval.Val = new Value;
4470 yyval.Val->val = yyvsp[-5].String;
4471 yyval.Val->type = yyvsp[-4].Ty->getPointerType();
4472 delete yyvsp[-1].Val; delete yyvsp[0].String;
4473 }
Reid Spencer319a7302007-01-05 17:20:02 +00004474 break;
4475
Reid Spencerc4d96252007-01-13 00:03:30 +00004476 case 296:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004477#line 2175 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004478 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004479 *yyvsp[-2].String += " " + yyvsp[-1].Ty->getNewTy();
4480 if (!yyvsp[0].String->empty())
4481 *yyvsp[-2].String += " " + *yyvsp[0].String;
4482 yyval.Val = new Value;
4483 yyval.Val->val = yyvsp[-2].String;
4484 yyval.Val->type = yyvsp[-1].Ty->getPointerType();
4485 delete yyvsp[0].String;
4486 }
Reid Spencerc4d96252007-01-13 00:03:30 +00004487 break;
4488
Reid Spencer609ca3e2007-01-12 20:10:51 +00004489 case 297:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004490#line 2184 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencerc4d96252007-01-13 00:03:30 +00004491 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004492 std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
4493 *yyvsp[-5].String += " " + yyvsp[-4].Ty->getNewTy() + ", " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4494 if (!yyvsp[0].String->empty())
4495 *yyvsp[-5].String += " " + *yyvsp[0].String;
4496 yyval.Val = yyvsp[-1].Val;
4497 delete yyval.Val->val;
4498 yyval.Val->val = yyvsp[-5].String;
4499 yyval.Val->type = yyvsp[-4].Ty->getPointerType();
4500 delete yyvsp[0].String;
4501 }
Reid Spencerc4d96252007-01-13 00:03:30 +00004502 break;
4503
4504 case 298:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004505#line 2195 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004506 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004507 *yyvsp[-1].String += " " + *yyvsp[0].Val->val;
4508 yyval.Val = yyvsp[0].Val;
4509 delete yyvsp[0].Val->val;
4510 yyval.Val->val = yyvsp[-1].String;
4511 yyval.Val->type = Type::get("void", VoidTy);
4512 }
Reid Spencer319a7302007-01-05 17:20:02 +00004513 break;
4514
Reid Spencerc4d96252007-01-13 00:03:30 +00004515 case 299:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004516#line 2202 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004517 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004518 std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
4519 if (!yyvsp[-3].String->empty())
4520 *yyvsp[-3].String += " ";
4521 *yyvsp[-3].String += *yyvsp[-2].String + " " + yyvsp[-1].Ty->getNewTy() + " " + Name;
4522 yyval.Val = yyvsp[0].Val;
4523 delete yyval.Val->val;
4524 yyval.Val->val = yyvsp[-3].String;
4525 yyval.Val->type = yyvsp[-1].Ty->getElementType();
4526 delete yyvsp[-2].String;
4527 }
Reid Spencer319a7302007-01-05 17:20:02 +00004528 break;
4529
Reid Spencerc4d96252007-01-13 00:03:30 +00004530 case 300:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004531#line 2213 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004532 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004533 std::string Name = getUniqueName(yyvsp[0].Val->val, yyvsp[-1].Ty);
4534 if (!yyvsp[-5].String->empty())
4535 *yyvsp[-5].String += " ";
4536 *yyvsp[-5].String += *yyvsp[-4].String + " " + *yyvsp[-3].Val->val + ", " + yyvsp[-1].Ty->getNewTy() + " " + Name;
4537 yyval.Val = yyvsp[-3].Val;
4538 delete yyval.Val->val;
4539 yyval.Val->val = yyvsp[-5].String;
4540 yyval.Val->type = Type::get("void", VoidTy);
4541 delete yyvsp[-4].String; delete yyvsp[0].Val;
4542 }
Reid Spencer319a7302007-01-05 17:20:02 +00004543 break;
4544
Reid Spencerc4d96252007-01-13 00:03:30 +00004545 case 301:
Jeff Cohenac2dca92007-01-21 19:30:52 +00004546#line 2224 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencer319a7302007-01-05 17:20:02 +00004547 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004548 std::string Name = getUniqueName(yyvsp[-1].Val->val, yyvsp[-2].Ty);
Reid Spencerf459d392006-12-02 16:19:52 +00004549 // Upgrade the indices
Jeff Cohenac2dca92007-01-21 19:30:52 +00004550 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
4551 Value* V = (*yyvsp[0].ValList)[i];
Reid Spencerb6673a92007-01-15 02:41:46 +00004552 if (V->type->isUnsigned() && !V->isConstant() &&
4553 V->type->getBitWidth() < 64) {
4554 *O << " %gep_upgrade" << UniqueNameCounter << " = zext " << *V->val
Reid Spencer71d2ec92006-12-31 06:02:26 +00004555 << " to i64\n";
Reid Spencerb6673a92007-01-15 02:41:46 +00004556 *V->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++);
4557 V->type = Type::get("i64",ULongTy);
Reid Spencerf459d392006-12-02 16:19:52 +00004558 }
4559 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004560 *yyvsp[-3].String += " " + yyvsp[-2].Ty->getNewTy() + " " + Name;
4561 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
4562 Value* V = (*yyvsp[0].ValList)[i];
4563 *yyvsp[-3].String += ", " + *V->val;
Reid Spencerf8483652006-12-02 15:16:01 +00004564 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004565 yyval.Val = yyvsp[-1].Val;
4566 delete yyval.Val->val;
4567 yyval.Val->val = yyvsp[-3].String;
4568 yyval.Val->type = getGEPIndexedType(yyvsp[-2].Ty,yyvsp[0].ValList);
4569 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i)
4570 delete (*yyvsp[0].ValList)[i];
4571 delete yyvsp[0].ValList;
4572 }
Reid Spencer319a7302007-01-05 17:20:02 +00004573 break;
4574
4575
Reid Spencer319a7302007-01-05 17:20:02 +00004576 }
4577
Jeff Cohenac2dca92007-01-21 19:30:52 +00004578/* Line 1016 of /usr/local/share/bison/yacc.c. */
4579#line 4580 "UpgradeParser.tab.c"
Reid Spencere7c3c602006-11-30 06:36:44 +00004580
4581 yyvsp -= yylen;
4582 yyssp -= yylen;
4583
Reid Spencer319a7302007-01-05 17:20:02 +00004584
Jeff Cohenac2dca92007-01-21 19:30:52 +00004585#if YYDEBUG
4586 if (yydebug)
4587 {
4588 short *yyssp1 = yyss - 1;
4589 YYFPRINTF (stderr, "state stack now");
4590 while (yyssp1 != yyssp)
4591 YYFPRINTF (stderr, " %d", *++yyssp1);
4592 YYFPRINTF (stderr, "\n");
4593 }
4594#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00004595
4596 *++yyvsp = yyval;
4597
4598
Reid Spencer319a7302007-01-05 17:20:02 +00004599 /* Now `shift' the result of the reduction. Determine what state
4600 that goes to, based on the state we popped back to and the rule
4601 number reduced by. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004602
4603 yyn = yyr1[yyn];
4604
Reid Spencer319a7302007-01-05 17:20:02 +00004605 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
4606 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00004607 yystate = yytable[yystate];
4608 else
Reid Spencer319a7302007-01-05 17:20:02 +00004609 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencere7c3c602006-11-30 06:36:44 +00004610
4611 goto yynewstate;
4612
4613
Reid Spencer319a7302007-01-05 17:20:02 +00004614/*------------------------------------.
4615| yyerrlab -- here on detecting error |
4616`------------------------------------*/
4617yyerrlab:
4618 /* If not already recovering from an error, report this error. */
4619 if (!yyerrstatus)
Reid Spencere7c3c602006-11-30 06:36:44 +00004620 {
4621 ++yynerrs;
Reid Spencer319a7302007-01-05 17:20:02 +00004622#if YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00004623 yyn = yypact[yystate];
4624
Reid Spencer319a7302007-01-05 17:20:02 +00004625 if (YYPACT_NINF < yyn && yyn < YYLAST)
Reid Spencere7c3c602006-11-30 06:36:44 +00004626 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004627 YYSIZE_T yysize = 0;
Reid Spencer319a7302007-01-05 17:20:02 +00004628 int yytype = YYTRANSLATE (yychar);
Jeff Cohenac2dca92007-01-21 19:30:52 +00004629 char *yymsg;
4630 int yyx, yycount;
Reid Spencere7c3c602006-11-30 06:36:44 +00004631
Jeff Cohenac2dca92007-01-21 19:30:52 +00004632 yycount = 0;
Reid Spencer319a7302007-01-05 17:20:02 +00004633 /* Start YYX at -YYN if negative to avoid negative indexes in
4634 YYCHECK. */
Jeff Cohenac2dca92007-01-21 19:30:52 +00004635 for (yyx = yyn < 0 ? -yyn : 0;
4636 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
Reid Spencer319a7302007-01-05 17:20:02 +00004637 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
Jeff Cohenac2dca92007-01-21 19:30:52 +00004638 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
4639 yysize += yystrlen ("parse error, unexpected ") + 1;
4640 yysize += yystrlen (yytname[yytype]);
4641 yymsg = (char *) YYSTACK_ALLOC (yysize);
4642 if (yymsg != 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00004643 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004644 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
4645 yyp = yystpcpy (yyp, yytname[yytype]);
4646
4647 if (yycount < 5)
Reid Spencere7c3c602006-11-30 06:36:44 +00004648 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004649 yycount = 0;
4650 for (yyx = yyn < 0 ? -yyn : 0;
4651 yyx < (int) (sizeof (yytname) / sizeof (char *));
4652 yyx++)
4653 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
4654 {
4655 const char *yyq = ! yycount ? ", expecting " : " or ";
4656 yyp = yystpcpy (yyp, yyq);
4657 yyp = yystpcpy (yyp, yytname[yyx]);
4658 yycount++;
4659 }
Reid Spencere7c3c602006-11-30 06:36:44 +00004660 }
Reid Spencer319a7302007-01-05 17:20:02 +00004661 yyerror (yymsg);
4662 YYSTACK_FREE (yymsg);
Reid Spencere7c3c602006-11-30 06:36:44 +00004663 }
4664 else
Jeff Cohenac2dca92007-01-21 19:30:52 +00004665 yyerror ("parse error; also virtual memory exhausted");
Reid Spencere7c3c602006-11-30 06:36:44 +00004666 }
4667 else
4668#endif /* YYERROR_VERBOSE */
Jeff Cohenac2dca92007-01-21 19:30:52 +00004669 yyerror ("parse error");
Reid Spencere7c3c602006-11-30 06:36:44 +00004670 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004671 goto yyerrlab1;
Reid Spencere7c3c602006-11-30 06:36:44 +00004672
Reid Spencer319a7302007-01-05 17:20:02 +00004673
Jeff Cohenac2dca92007-01-21 19:30:52 +00004674/*----------------------------------------------------.
4675| yyerrlab1 -- error raised explicitly by an action. |
4676`----------------------------------------------------*/
4677yyerrlab1:
Reid Spencere7c3c602006-11-30 06:36:44 +00004678 if (yyerrstatus == 3)
4679 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004680 /* If just tried and failed to reuse lookahead token after an
Reid Spencer319a7302007-01-05 17:20:02 +00004681 error, discard it. */
Reid Spencere7c3c602006-11-30 06:36:44 +00004682
Jeff Cohenac2dca92007-01-21 19:30:52 +00004683 /* Return failure if at end of input. */
4684 if (yychar == YYEOF)
Reid Spencer319a7302007-01-05 17:20:02 +00004685 {
Jeff Cohenac2dca92007-01-21 19:30:52 +00004686 /* Pop the error token. */
4687 YYPOPSTACK;
4688 /* Pop the rest of the stack. */
4689 while (yyssp > yyss)
4690 {
4691 YYDPRINTF ((stderr, "Error: popping "));
4692 YYDSYMPRINT ((stderr,
4693 yystos[*yyssp],
4694 *yyvsp));
4695 YYDPRINTF ((stderr, "\n"));
4696 yydestruct (yystos[*yyssp], *yyvsp);
4697 YYPOPSTACK;
4698 }
4699 YYABORT;
Reid Spencer319a7302007-01-05 17:20:02 +00004700 }
Jeff Cohenac2dca92007-01-21 19:30:52 +00004701
4702 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
4703 yychar, yytname[yychar1]));
4704 yydestruct (yychar1, yylval);
4705 yychar = YYEMPTY;
Reid Spencer319a7302007-01-05 17:20:02 +00004706 }
4707
Jeff Cohenac2dca92007-01-21 19:30:52 +00004708 /* Else will try to reuse lookahead token after shifting the error
Reid Spencer319a7302007-01-05 17:20:02 +00004709 token. */
Reid Spencer319a7302007-01-05 17:20:02 +00004710
Reid Spencer319a7302007-01-05 17:20:02 +00004711 yyerrstatus = 3; /* Each real token shifted decrements this. */
4712
4713 for (;;)
4714 {
4715 yyn = yypact[yystate];
4716 if (yyn != YYPACT_NINF)
4717 {
4718 yyn += YYTERROR;
4719 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4720 {
4721 yyn = yytable[yyn];
4722 if (0 < yyn)
4723 break;
4724 }
4725 }
4726
4727 /* Pop the current state because it cannot handle the error token. */
4728 if (yyssp == yyss)
Reid Spencere7c3c602006-11-30 06:36:44 +00004729 YYABORT;
4730
Jeff Cohenac2dca92007-01-21 19:30:52 +00004731 YYDPRINTF ((stderr, "Error: popping "));
4732 YYDSYMPRINT ((stderr,
4733 yystos[*yyssp], *yyvsp));
4734 YYDPRINTF ((stderr, "\n"));
Reid Spencere7c3c602006-11-30 06:36:44 +00004735
Jeff Cohenac2dca92007-01-21 19:30:52 +00004736 yydestruct (yystos[yystate], *yyvsp);
4737 yyvsp--;
4738 yystate = *--yyssp;
4739
4740
4741#if YYDEBUG
4742 if (yydebug)
4743 {
4744 short *yyssp1 = yyss - 1;
4745 YYFPRINTF (stderr, "Error: state stack now");
4746 while (yyssp1 != yyssp)
4747 YYFPRINTF (stderr, " %d", *++yyssp1);
4748 YYFPRINTF (stderr, "\n");
4749 }
4750#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00004751 }
4752
4753 if (yyn == YYFINAL)
4754 YYACCEPT;
4755
Jeff Cohenac2dca92007-01-21 19:30:52 +00004756 YYDPRINTF ((stderr, "Shifting error token, "));
4757
Reid Spencere7c3c602006-11-30 06:36:44 +00004758 *++yyvsp = yylval;
Reid Spencer319a7302007-01-05 17:20:02 +00004759
4760
Reid Spencere7c3c602006-11-30 06:36:44 +00004761 yystate = yyn;
4762 goto yynewstate;
4763
Chris Lattner37e01c52007-01-04 18:46:42 +00004764
Reid Spencer319a7302007-01-05 17:20:02 +00004765/*-------------------------------------.
4766| yyacceptlab -- YYACCEPT comes here. |
4767`-------------------------------------*/
4768yyacceptlab:
4769 yyresult = 0;
4770 goto yyreturn;
4771
4772/*-----------------------------------.
4773| yyabortlab -- YYABORT comes here. |
4774`-----------------------------------*/
4775yyabortlab:
4776 yyresult = 1;
4777 goto yyreturn;
4778
4779#ifndef yyoverflow
Jeff Cohenac2dca92007-01-21 19:30:52 +00004780/*----------------------------------------------.
4781| yyoverflowlab -- parser overflow comes here. |
4782`----------------------------------------------*/
4783yyoverflowlab:
4784 yyerror ("parser stack overflow");
Reid Spencer319a7302007-01-05 17:20:02 +00004785 yyresult = 2;
4786 /* Fall through. */
Chris Lattner37e01c52007-01-04 18:46:42 +00004787#endif
Reid Spencer319a7302007-01-05 17:20:02 +00004788
4789yyreturn:
Reid Spencer319a7302007-01-05 17:20:02 +00004790#ifndef yyoverflow
4791 if (yyss != yyssa)
4792 YYSTACK_FREE (yyss);
4793#endif
4794 return yyresult;
Reid Spencere7c3c602006-11-30 06:36:44 +00004795}
Reid Spencer319a7302007-01-05 17:20:02 +00004796
4797
Jeff Cohenac2dca92007-01-21 19:30:52 +00004798#line 2251 "/usr/home/jeffc/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencere7c3c602006-11-30 06:36:44 +00004799
4800
4801int yyerror(const char *ErrorMsg) {
4802 std::string where
4803 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4804 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
Reid Spencer319a7302007-01-05 17:20:02 +00004805 std::string errMsg = where + "error: " + std::string(ErrorMsg) +
4806 " while reading ";
Reid Spencere7c3c602006-11-30 06:36:44 +00004807 if (yychar == YYEMPTY || yychar == 0)
4808 errMsg += "end-of-file.";
4809 else
4810 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
Reid Spencer71d2ec92006-12-31 06:02:26 +00004811 std::cerr << "llvm-upgrade: " << errMsg << '\n';
Chris Lattner37e01c52007-01-04 18:46:42 +00004812 *O << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +00004813 exit(1);
4814}
Reid Spencer319a7302007-01-05 17:20:02 +00004815
Reid Spencer30d0c582007-01-15 00:26:18 +00004816void warning(const std::string& ErrorMsg) {
Reid Spencer319a7302007-01-05 17:20:02 +00004817 std::string where
4818 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
4819 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
4820 std::string errMsg = where + "warning: " + std::string(ErrorMsg) +
4821 " while reading ";
4822 if (yychar == YYEMPTY || yychar == 0)
4823 errMsg += "end-of-file.";
4824 else
4825 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
4826 std::cerr << "llvm-upgrade: " << errMsg << '\n';
4827}
4828