blob: 0e4e5c8945049adf3d0cd42de9b83e72ba7ee8fd [file] [log] [blame]
Reid Spencere7c3c602006-11-30 06:36:44 +00001
Chris Lattner37e01c52007-01-04 18:46:42 +00002/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y
3 by GNU Bison version 1.28 */
Reid Spencere7c3c602006-11-30 06:36:44 +00004
Chris Lattner37e01c52007-01-04 18:46:42 +00005#define YYBISON 1 /* Identify Bison output. */
Reid Spencere7c3c602006-11-30 06:36:44 +00006
Reid Spencere7c3c602006-11-30 06:36:44 +00007#define yyparse Upgradeparse
Chris Lattner37e01c52007-01-04 18:46:42 +00008#define yylex Upgradelex
Reid Spencere7c3c602006-11-30 06:36:44 +00009#define yyerror Upgradeerror
Chris Lattner37e01c52007-01-04 18:46:42 +000010#define yylval Upgradelval
11#define yychar Upgradechar
Reid Spencere7c3c602006-11-30 06:36:44 +000012#define yydebug Upgradedebug
13#define yynerrs Upgradenerrs
Chris Lattner37e01c52007-01-04 18:46:42 +000014#define VOID 257
15#define BOOL 258
16#define SBYTE 259
17#define UBYTE 260
18#define SHORT 261
19#define USHORT 262
20#define INT 263
21#define UINT 264
22#define LONG 265
23#define ULONG 266
24#define FLOAT 267
25#define DOUBLE 268
26#define LABEL 269
27#define OPAQUE 270
28#define ESINT64VAL 271
29#define EUINT64VAL 272
30#define SINTVAL 273
31#define UINTVAL 274
32#define FPVAL 275
33#define NULL_TOK 276
34#define UNDEF 277
35#define ZEROINITIALIZER 278
36#define TRUETOK 279
37#define FALSETOK 280
38#define TYPE 281
39#define VAR_ID 282
40#define LABELSTR 283
41#define STRINGCONSTANT 284
42#define IMPLEMENTATION 285
43#define BEGINTOK 286
44#define ENDTOK 287
45#define DECLARE 288
46#define GLOBAL 289
47#define CONSTANT 290
48#define SECTION 291
49#define VOLATILE 292
50#define TO 293
51#define DOTDOTDOT 294
52#define CONST 295
53#define INTERNAL 296
54#define LINKONCE 297
55#define WEAK 298
56#define DLLIMPORT 299
57#define DLLEXPORT 300
58#define EXTERN_WEAK 301
59#define APPENDING 302
60#define NOT 303
61#define EXTERNAL 304
62#define TARGET 305
63#define TRIPLE 306
64#define ENDIAN 307
65#define POINTERSIZE 308
66#define LITTLE 309
67#define BIG 310
68#define ALIGN 311
69#define UNINITIALIZED 312
70#define DEPLIBS 313
71#define CALL 314
72#define TAIL 315
73#define ASM_TOK 316
74#define MODULE 317
75#define SIDEEFFECT 318
76#define CC_TOK 319
77#define CCC_TOK 320
78#define CSRETCC_TOK 321
79#define FASTCC_TOK 322
80#define COLDCC_TOK 323
81#define X86_STDCALLCC_TOK 324
82#define X86_FASTCALLCC_TOK 325
83#define DATALAYOUT 326
84#define RET 327
85#define BR 328
86#define SWITCH 329
87#define INVOKE 330
88#define EXCEPT 331
89#define UNWIND 332
90#define UNREACHABLE 333
91#define ADD 334
92#define SUB 335
93#define MUL 336
94#define DIV 337
95#define UDIV 338
96#define SDIV 339
97#define FDIV 340
98#define REM 341
99#define UREM 342
100#define SREM 343
101#define FREM 344
102#define AND 345
103#define OR 346
104#define XOR 347
105#define SETLE 348
106#define SETGE 349
107#define SETLT 350
108#define SETGT 351
109#define SETEQ 352
110#define SETNE 353
111#define ICMP 354
112#define FCMP 355
113#define EQ 356
114#define NE 357
115#define SLT 358
116#define SGT 359
117#define SLE 360
118#define SGE 361
119#define OEQ 362
120#define ONE 363
121#define OLT 364
122#define OGT 365
123#define OLE 366
124#define OGE 367
125#define ORD 368
126#define UNO 369
127#define UEQ 370
128#define UNE 371
129#define ULT 372
130#define UGT 373
131#define ULE 374
132#define UGE 375
133#define MALLOC 376
134#define ALLOCA 377
135#define FREE 378
136#define LOAD 379
137#define STORE 380
138#define GETELEMENTPTR 381
139#define PHI_TOK 382
140#define SELECT 383
141#define SHL 384
142#define SHR 385
143#define ASHR 386
144#define LSHR 387
145#define VAARG 388
146#define EXTRACTELEMENT 389
147#define INSERTELEMENT 390
148#define SHUFFLEVECTOR 391
149#define CAST 392
150#define TRUNC 393
151#define ZEXT 394
152#define SEXT 395
153#define FPTRUNC 396
154#define FPEXT 397
155#define FPTOUI 398
156#define FPTOSI 399
157#define UITOFP 400
158#define SITOFP 401
159#define PTRTOINT 402
160#define INTTOPTR 403
161#define BITCAST 404
Reid Spencere7c3c602006-11-30 06:36:44 +0000162
Chris Lattner37e01c52007-01-04 18:46:42 +0000163#line 14 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencere7c3c602006-11-30 06:36:44 +0000164
Reid Spencere7c3c602006-11-30 06:36:44 +0000165#include "ParserInternals.h"
Reid Spencere7c3c602006-11-30 06:36:44 +0000166#include <algorithm>
Reid Spencera50d5962006-12-02 04:11:07 +0000167#include <map>
Reid Spencere7c3c602006-11-30 06:36:44 +0000168#include <utility>
169#include <iostream>
170
Reid Spencere77e35e2006-12-01 20:26:20 +0000171#define YYERROR_VERBOSE 1
Reid Spencer96839be2006-11-30 16:50:26 +0000172#define YYINCLUDED_STDLIB_H
Reid Spencere77e35e2006-12-01 20:26:20 +0000173#define YYDEBUG 1
Reid Spencere7c3c602006-11-30 06:36:44 +0000174
175int yylex(); // declaration" of xxx warnings.
176int yyparse();
Reid Spencere77e35e2006-12-01 20:26:20 +0000177extern int yydebug;
Reid Spencere7c3c602006-11-30 06:36:44 +0000178
179static std::string CurFilename;
Reid Spencere7c3c602006-11-30 06:36:44 +0000180static std::ostream *O = 0;
Reid Spencer96839be2006-11-30 16:50:26 +0000181std::istream* LexInput = 0;
Reid Spencere77e35e2006-12-01 20:26:20 +0000182unsigned SizeOfPointer = 32;
Reid Spencerf459d392006-12-02 16:19:52 +0000183static uint64_t unique = 1;
Reid Spencer96839be2006-11-30 16:50:26 +0000184
Reid Spencer71d2ec92006-12-31 06:02:26 +0000185// This bool controls whether attributes are ever added to function declarations
186// definitions and calls.
187static bool AddAttributes = false;
188
Reid Spencerf5626a32007-01-01 01:20:41 +0000189// This bool is used to communicate between the InstVal and Inst rules about
190// whether or not a cast should be deleted. When the flag is set, InstVal has
191// determined that the cast is a candidate. However, it can only be deleted if
192// the value being casted is the same value name as the instruction. The Inst
193// rule makes that comparison if the flag is set and comments out the
194// instruction if they match.
195static bool deleteUselessCastFlag = false;
196static std::string* deleteUselessCastName = 0;
197
Reid Spencera50d5962006-12-02 04:11:07 +0000198typedef std::vector<TypeInfo> TypeVector;
199static TypeVector EnumeratedTypes;
200typedef std::map<std::string,TypeInfo> TypeMap;
201static TypeMap NamedTypes;
Reid Spencerf12ee422006-12-05 19:21:25 +0000202static TypeMap Globals;
Reid Spencera50d5962006-12-02 04:11:07 +0000203
Reid Spencerf8483652006-12-02 15:16:01 +0000204void destroy(ValueList* VL) {
205 while (!VL->empty()) {
206 ValueInfo& VI = VL->back();
207 VI.destroy();
208 VL->pop_back();
209 }
210 delete VL;
211}
212
Reid Spencer96839be2006-11-30 16:50:26 +0000213void UpgradeAssembly(const std::string &infile, std::istream& in,
Reid Spencer71d2ec92006-12-31 06:02:26 +0000214 std::ostream &out, bool debug, bool addAttrs)
Reid Spencere7c3c602006-11-30 06:36:44 +0000215{
216 Upgradelineno = 1;
217 CurFilename = infile;
Reid Spencer96839be2006-11-30 16:50:26 +0000218 LexInput = &in;
Reid Spencere77e35e2006-12-01 20:26:20 +0000219 yydebug = debug;
Reid Spencer71d2ec92006-12-31 06:02:26 +0000220 AddAttributes = addAttrs;
Reid Spencere7c3c602006-11-30 06:36:44 +0000221 O = &out;
222
223 if (yyparse()) {
224 std::cerr << "Parse failed.\n";
Chris Lattner37e01c52007-01-04 18:46:42 +0000225 out << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +0000226 exit(1);
227 }
228}
229
Reid Spencer52402b02007-01-02 05:45:11 +0000230TypeInfo* ResolveType(TypeInfo*& Ty) {
231 if (Ty->isUnresolved()) {
Reid Spencereff838e2007-01-03 23:45:42 +0000232 if (Ty->getNewTy()[0] == '%' && isdigit(Ty->getNewTy()[1])) {
233 unsigned ref = atoi(&((Ty->getNewTy().c_str())[1])); // skip the %
234 if (ref < EnumeratedTypes.size()) {
235 Ty = &EnumeratedTypes[ref];
236 return Ty;
237 } else {
238 std::string msg("Can't resolve numbered type: ");
239 msg += Ty->getNewTy();
240 yyerror(msg.c_str());
241 }
Reid Spencer78720742006-12-02 20:21:22 +0000242 } else {
Reid Spencereff838e2007-01-03 23:45:42 +0000243 TypeMap::iterator I = NamedTypes.find(Ty->getNewTy());
244 if (I != NamedTypes.end()) {
245 Ty = &I->second;
246 return Ty;
247 } else {
248 std::string msg("Cannot resolve type: ");
249 msg += Ty->getNewTy();
250 yyerror(msg.c_str());
251 }
Reid Spencera50d5962006-12-02 04:11:07 +0000252 }
Reid Spencer280d8012006-12-01 23:40:53 +0000253 }
Reid Spencera50d5962006-12-02 04:11:07 +0000254 // otherwise its already resolved.
Reid Spencer52402b02007-01-02 05:45:11 +0000255 return Ty;
Reid Spencer280d8012006-12-01 23:40:53 +0000256}
257
Reid Spencera50d5962006-12-02 04:11:07 +0000258static const char* getCastOpcode(
Reid Spencer52402b02007-01-02 05:45:11 +0000259 std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy)
Reid Spencera50d5962006-12-02 04:11:07 +0000260{
Reid Spencer52402b02007-01-02 05:45:11 +0000261 unsigned SrcBits = SrcTy->getBitWidth();
262 unsigned DstBits = DstTy->getBitWidth();
Reid Spencere77e35e2006-12-01 20:26:20 +0000263 const char* opcode = "bitcast";
264 // Run through the possibilities ...
Reid Spencer52402b02007-01-02 05:45:11 +0000265 if (DstTy->isIntegral()) { // Casting to integral
266 if (SrcTy->isIntegral()) { // Casting from integral
Reid Spencere77e35e2006-12-01 20:26:20 +0000267 if (DstBits < SrcBits)
268 opcode = "trunc";
269 else if (DstBits > SrcBits) { // its an extension
Reid Spencer52402b02007-01-02 05:45:11 +0000270 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000271 opcode ="sext"; // signed -> SEXT
272 else
273 opcode = "zext"; // unsigned -> ZEXT
274 } else {
275 opcode = "bitcast"; // Same size, No-op cast
276 }
Reid Spencer52402b02007-01-02 05:45:11 +0000277 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
278 if (DstTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000279 opcode = "fptosi"; // FP -> sint
280 else
281 opcode = "fptoui"; // FP -> uint
Reid Spencer52402b02007-01-02 05:45:11 +0000282 } else if (SrcTy->isPacked()) {
283 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000284 "Casting packed to integer of different width");
285 opcode = "bitcast"; // same size, no-op cast
286 } else {
Reid Spencer52402b02007-01-02 05:45:11 +0000287 assert(SrcTy->isPointer() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000288 "Casting from a value that is not first-class type");
289 opcode = "ptrtoint"; // ptr -> int
290 }
Reid Spencer52402b02007-01-02 05:45:11 +0000291 } else if (DstTy->isFloatingPoint()) { // Casting to floating pt
292 if (SrcTy->isIntegral()) { // Casting from integral
293 if (SrcTy->isSigned())
Reid Spencere77e35e2006-12-01 20:26:20 +0000294 opcode = "sitofp"; // sint -> FP
295 else
296 opcode = "uitofp"; // uint -> FP
Reid Spencer52402b02007-01-02 05:45:11 +0000297 } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt
Reid Spencere77e35e2006-12-01 20:26:20 +0000298 if (DstBits < SrcBits) {
299 opcode = "fptrunc"; // FP -> smaller FP
300 } else if (DstBits > SrcBits) {
301 opcode = "fpext"; // FP -> larger FP
302 } else {
303 opcode ="bitcast"; // same size, no-op cast
304 }
Reid Spencer52402b02007-01-02 05:45:11 +0000305 } else if (SrcTy->isPacked()) {
306 assert(DstBits == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000307 "Casting packed to floating point of different width");
308 opcode = "bitcast"; // same size, no-op cast
309 } else {
310 assert(0 && "Casting pointer or non-first class to float");
311 }
Reid Spencer52402b02007-01-02 05:45:11 +0000312 } else if (DstTy->isPacked()) {
313 if (SrcTy->isPacked()) {
314 assert(DstTy->getBitWidth() == SrcTy->getBitWidth() &&
Reid Spencere77e35e2006-12-01 20:26:20 +0000315 "Casting packed to packed of different widths");
316 opcode = "bitcast"; // packed -> packed
Reid Spencer52402b02007-01-02 05:45:11 +0000317 } else if (DstTy->getBitWidth() == SrcBits) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000318 opcode = "bitcast"; // float/int -> packed
319 } else {
320 assert(!"Illegal cast to packed (wrong type or size)");
321 }
Reid Spencer52402b02007-01-02 05:45:11 +0000322 } else if (DstTy->isPointer()) {
323 if (SrcTy->isPointer()) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000324 opcode = "bitcast"; // ptr -> ptr
Reid Spencer52402b02007-01-02 05:45:11 +0000325 } else if (SrcTy->isIntegral()) {
Reid Spencere77e35e2006-12-01 20:26:20 +0000326 opcode = "inttoptr"; // int -> ptr
327 } else {
Reid Spencera50d5962006-12-02 04:11:07 +0000328 assert(!"Casting invalid type to pointer");
Reid Spencere77e35e2006-12-01 20:26:20 +0000329 }
330 } else {
331 assert(!"Casting to type that is not first-class");
332 }
333 return opcode;
334}
335
Reid Spencer52402b02007-01-02 05:45:11 +0000336static std::string getCastUpgrade(const std::string& Src, TypeInfo* SrcTy,
337 TypeInfo* DstTy, bool isConst)
Reid Spencera50d5962006-12-02 04:11:07 +0000338{
339 std::string Result;
340 std::string Source = Src;
Reid Spencer52402b02007-01-02 05:45:11 +0000341 if (SrcTy->isFloatingPoint() && DstTy->isPointer()) {
Reid Spencera50d5962006-12-02 04:11:07 +0000342 // fp -> ptr cast is no longer supported but we must upgrade this
343 // by doing a double cast: fp -> int -> ptr
344 if (isConst)
Reid Spencer71d2ec92006-12-31 06:02:26 +0000345 Source = "i64 fptoui(" + Source + " to i64)";
Reid Spencera50d5962006-12-02 04:11:07 +0000346 else {
Reid Spencerf459d392006-12-02 16:19:52 +0000347 *O << " %cast_upgrade" << unique << " = fptoui " << Source
Reid Spencer71d2ec92006-12-31 06:02:26 +0000348 << " to i64\n";
349 Source = "i64 %cast_upgrade" + llvm::utostr(unique);
Reid Spencera50d5962006-12-02 04:11:07 +0000350 }
351 // Update the SrcTy for the getCastOpcode call below
Reid Spencer52402b02007-01-02 05:45:11 +0000352 delete SrcTy;
353 SrcTy = new TypeInfo("i64", ULongTy);
354 } else if (DstTy->isBool()) {
355 // cast type %x to bool was previously defined as setne type %x, null
356 // The cast semantic is now to truncate, not compare so we must retain
357 // the original intent by replacing the cast with a setne
358 const char* comparator = SrcTy->isPointer() ? ", null" :
359 (SrcTy->isFloatingPoint() ? ", 0.0" :
360 (SrcTy->isBool() ? ", false" : ", 0"));
361 const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne ";
Reid Spencer187ccf82006-12-09 16:57:22 +0000362 if (isConst) {
363 Result = "(" + Source + comparator + ")";
364 Result = compareOp + Result;
365 } else
366 Result = compareOp + Source + comparator;
Reid Spencera50d5962006-12-02 04:11:07 +0000367 return Result; // skip cast processing below
368 }
369 ResolveType(SrcTy);
370 ResolveType(DstTy);
371 std::string Opcode(getCastOpcode(Source, SrcTy, DstTy));
372 if (isConst)
Reid Spencer52402b02007-01-02 05:45:11 +0000373 Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")";
Reid Spencera50d5962006-12-02 04:11:07 +0000374 else
Reid Spencer52402b02007-01-02 05:45:11 +0000375 Result += Opcode + " " + Source + " to " + DstTy->getNewTy();
Reid Spencera50d5962006-12-02 04:11:07 +0000376 return Result;
377}
378
Reid Spencer52402b02007-01-02 05:45:11 +0000379const char* getDivRemOpcode(const std::string& opcode, TypeInfo* TI) {
Reid Spencer78720742006-12-02 20:21:22 +0000380 const char* op = opcode.c_str();
Reid Spencer52402b02007-01-02 05:45:11 +0000381 const TypeInfo* Ty = ResolveType(TI);
382 if (Ty->isPacked())
383 Ty = Ty->getElementType();
Reid Spencer78720742006-12-02 20:21:22 +0000384 if (opcode == "div")
Reid Spencer52402b02007-01-02 05:45:11 +0000385 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +0000386 op = "fdiv";
Reid Spencer52402b02007-01-02 05:45:11 +0000387 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +0000388 op = "udiv";
Reid Spencer52402b02007-01-02 05:45:11 +0000389 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +0000390 op = "sdiv";
391 else
392 yyerror("Invalid type for div instruction");
393 else if (opcode == "rem")
Reid Spencer52402b02007-01-02 05:45:11 +0000394 if (Ty->isFloatingPoint())
Reid Spencer78720742006-12-02 20:21:22 +0000395 op = "frem";
Reid Spencer52402b02007-01-02 05:45:11 +0000396 else if (Ty->isUnsigned())
Reid Spencer78720742006-12-02 20:21:22 +0000397 op = "urem";
Reid Spencer52402b02007-01-02 05:45:11 +0000398 else if (Ty->isSigned())
Reid Spencer78720742006-12-02 20:21:22 +0000399 op = "srem";
400 else
401 yyerror("Invalid type for rem instruction");
402 return op;
403}
Reid Spencere7c3c602006-11-30 06:36:44 +0000404
Reid Spencer229e9362006-12-02 22:14:11 +0000405std::string
Reid Spencer52402b02007-01-02 05:45:11 +0000406getCompareOp(const std::string& setcc, const TypeInfo* TI) {
Reid Spencer229e9362006-12-02 22:14:11 +0000407 assert(setcc.length() == 5);
408 char cc1 = setcc[3];
409 char cc2 = setcc[4];
410 assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g');
411 assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't');
412 std::string result("xcmp xxx");
413 result[6] = cc1;
414 result[7] = cc2;
Reid Spencer52402b02007-01-02 05:45:11 +0000415 if (TI->isFloatingPoint()) {
Reid Spencer229e9362006-12-02 22:14:11 +0000416 result[0] = 'f';
Reid Spencere4d87aa2006-12-23 06:05:41 +0000417 result[5] = 'o';
Reid Spencerf0cf1322006-12-07 04:23:03 +0000418 if (cc1 == 'n')
419 result[5] = 'u'; // NE maps to unordered
420 else
421 result[5] = 'o'; // everything else maps to ordered
Reid Spencer52402b02007-01-02 05:45:11 +0000422 } else if (TI->isIntegral() || TI->isPointer()) {
Reid Spencer229e9362006-12-02 22:14:11 +0000423 result[0] = 'i';
424 if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
425 result.erase(5,1);
Reid Spencer52402b02007-01-02 05:45:11 +0000426 else if (TI->isSigned())
Reid Spencer229e9362006-12-02 22:14:11 +0000427 result[5] = 's';
Reid Spencer52402b02007-01-02 05:45:11 +0000428 else if (TI->isUnsigned() || TI->isPointer() || TI->isBool())
Reid Spencer229e9362006-12-02 22:14:11 +0000429 result[5] = 'u';
430 else
431 yyerror("Invalid integral type for setcc");
432 }
433 return result;
434}
435
Reid Spencer52402b02007-01-02 05:45:11 +0000436static TypeInfo* getFunctionReturnType(TypeInfo* PFTy) {
437 ResolveType(PFTy);
438 if (PFTy->isPointer()) {
439 TypeInfo* ElemTy = PFTy->getElementType();
440 ResolveType(ElemTy);
441 if (ElemTy->isFunction())
442 return ElemTy->getResultType()->clone();
443 } else if (PFTy->isFunction()) {
444 return PFTy->getResultType()->clone();
445 }
446 return PFTy->clone();
447}
448
Reid Spencereff838e2007-01-03 23:45:42 +0000449typedef std::vector<TypeInfo*> UpRefStack;
450static TypeInfo* ResolveUpReference(TypeInfo* Ty, UpRefStack* stack) {
451 assert(Ty->isUpReference() && "Can't resolve a non-upreference");
452 unsigned upref = atoi(&((Ty->getNewTy().c_str())[1])); // skip the slash
453 assert(upref < stack->size() && "Invalid up reference");
454 return (*stack)[upref - stack->size() - 1];
455}
456
Reid Spencer52402b02007-01-02 05:45:11 +0000457static TypeInfo* getGEPIndexedType(TypeInfo* PTy, ValueList* idxs) {
Reid Spencereff838e2007-01-03 23:45:42 +0000458 TypeInfo* Result = ResolveType(PTy);
Reid Spencer52402b02007-01-02 05:45:11 +0000459 assert(PTy->isPointer() && "GEP Operand is not a pointer?");
Reid Spencereff838e2007-01-03 23:45:42 +0000460 UpRefStack stack;
461 for (unsigned i = 0; i < idxs->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +0000462 if (Result->isComposite()) {
463 Result = Result->getIndexedType((*idxs)[i]);
464 ResolveType(Result);
Reid Spencereff838e2007-01-03 23:45:42 +0000465 stack.push_back(Result);
Reid Spencer52402b02007-01-02 05:45:11 +0000466 } else
467 yyerror("Invalid type for index");
468 }
Reid Spencereff838e2007-01-03 23:45:42 +0000469 // Resolve upreferences so we can return a more natural type
470 if (Result->isPointer()) {
471 if (Result->getElementType()->isUpReference()) {
472 stack.push_back(Result);
473 Result = ResolveUpReference(Result->getElementType(), &stack);
474 }
475 } else if (Result->isUpReference()) {
476 Result = ResolveUpReference(Result->getElementType(), &stack);
477 }
Reid Spencer52402b02007-01-02 05:45:11 +0000478 return Result->getPointerType();
479}
480
481static std::string makeUniqueName(const std::string *Name, bool isSigned) {
482 const char *suffix = ".u";
483 if (isSigned)
484 suffix = ".s";
485 if ((*Name)[Name->size()-1] == '"') {
486 std::string Result(*Name);
487 Result.insert(Name->size()-1, suffix);
488 return Result;
489 }
490 return *Name + suffix;
491}
492
493// This function handles appending .u or .s to integer value names that
494// were previously unsigned or signed, respectively. This avoids name
495// collisions since the unsigned and signed type planes have collapsed
496// into a single signless type plane.
497static std::string getUniqueName(const std::string *Name, TypeInfo* Ty) {
498 // If its not a symbolic name, don't modify it, probably a constant val.
499 if ((*Name)[0] != '%' && (*Name)[0] != '"')
500 return *Name;
501 // If its a numeric reference, just leave it alone.
502 if (isdigit((*Name)[1]))
503 return *Name;
504
505 // Resolve the type
506 ResolveType(Ty);
507
Reid Spencereff838e2007-01-03 23:45:42 +0000508 // Remove as many levels of pointer nesting that we have.
509 if (Ty->isPointer()) {
510 // Avoid infinite loops in recursive types
511 TypeInfo* Last = 0;
512 while (Ty->isPointer() && Last != Ty) {
513 Last = Ty;
514 Ty = Ty->getElementType();
515 ResolveType(Ty);
516 }
517 }
518
Reid Spencer52402b02007-01-02 05:45:11 +0000519 // Default the result to the current name
520 std::string Result = *Name;
521
Reid Spencereff838e2007-01-03 23:45:42 +0000522 // Now deal with the underlying type
Reid Spencer52402b02007-01-02 05:45:11 +0000523 if (Ty->isInteger()) {
524 // If its an integer type, make the name unique
525 Result = makeUniqueName(Name, Ty->isSigned());
Reid Spencereff838e2007-01-03 23:45:42 +0000526 } else if (Ty->isArray() || Ty->isPacked()) {
527 Ty = Ty->getElementType();
Reid Spencer52402b02007-01-02 05:45:11 +0000528 if (Ty->isInteger())
529 Result = makeUniqueName(Name, Ty->isSigned());
Reid Spencereff838e2007-01-03 23:45:42 +0000530 } else if (Ty->isStruct()) {
531 // Scan the fields and count the signed and unsigned fields
532 int isSigned = 0;
533 for (unsigned i = 0; i < Ty->getNumStructElements(); ++i) {
534 TypeInfo* Tmp = Ty->getElement(i);
535 if (Tmp->isInteger())
536 if (Tmp->isSigned())
537 isSigned++;
538 else
539 isSigned--;
540 }
541 if (isSigned != 0)
542 Result = makeUniqueName(Name, isSigned > 0);
Reid Spencer52402b02007-01-02 05:45:11 +0000543 }
544 return Result;
545}
546
Reid Spencer229e9362006-12-02 22:14:11 +0000547
Chris Lattner37e01c52007-01-04 18:46:42 +0000548#line 401 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
549typedef union {
Reid Spencere77e35e2006-12-01 20:26:20 +0000550 std::string* String;
Reid Spencer52402b02007-01-02 05:45:11 +0000551 TypeInfo* Type;
Reid Spencere77e35e2006-12-01 20:26:20 +0000552 ValueInfo Value;
553 ConstInfo Const;
Reid Spencerf8483652006-12-02 15:16:01 +0000554 ValueList* ValList;
Reid Spencer52402b02007-01-02 05:45:11 +0000555 TypeList* TypeVec;
Reid Spencere77e35e2006-12-01 20:26:20 +0000556} YYSTYPE;
Chris Lattner37e01c52007-01-04 18:46:42 +0000557#include <stdio.h>
558
559#ifndef __cplusplus
560#ifndef __STDC__
561#define const
562#endif
Reid Spencere7c3c602006-11-30 06:36:44 +0000563#endif
564
565
566
Chris Lattner37e01c52007-01-04 18:46:42 +0000567#define YYFINAL 586
568#define YYFLAG -32768
569#define YYNTBASE 165
Reid Spencere7c3c602006-11-30 06:36:44 +0000570
Chris Lattner37e01c52007-01-04 18:46:42 +0000571#define YYTRANSLATE(x) ((unsigned)(x) <= 404 ? yytranslate[x] : 239)
Reid Spencere7c3c602006-11-30 06:36:44 +0000572
Chris Lattner37e01c52007-01-04 18:46:42 +0000573static const short yytranslate[] = { 0,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 154,
578 155, 163, 2, 152, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 159,
580 151, 160, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 156, 153, 158, 2, 2, 2, 2, 2, 164, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 157,
586 2, 2, 161, 2, 162, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
600 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
601 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
602 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
603 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
604 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
605 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
606 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
607 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
608 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
609 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
610 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
611 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
612 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
613 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
614 147, 148, 149, 150
615};
Reid Spencere7c3c602006-11-30 06:36:44 +0000616
Chris Lattner37e01c52007-01-04 18:46:42 +0000617#if YYDEBUG != 0
618static const short yyprhs[] = { 0,
619 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
620 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
621 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
622 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
623 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
624 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
625 120, 122, 124, 126, 128, 130, 132, 134, 136, 138,
626 140, 142, 144, 146, 148, 150, 152, 154, 156, 158,
627 161, 162, 164, 166, 168, 170, 172, 174, 176, 177,
628 179, 181, 183, 185, 187, 189, 192, 193, 194, 197,
629 198, 202, 205, 206, 208, 209, 213, 215, 218, 220,
630 222, 224, 226, 228, 230, 232, 234, 236, 238, 240,
631 242, 244, 246, 248, 250, 252, 254, 256, 258, 261,
632 266, 272, 278, 282, 285, 291, 296, 299, 301, 305,
633 307, 311, 313, 314, 319, 323, 327, 332, 337, 341,
634 344, 347, 350, 353, 356, 359, 362, 365, 368, 371,
635 378, 384, 393, 400, 407, 414, 422, 430, 437, 444,
636 453, 462, 466, 468, 470, 472, 474, 477, 480, 485,
637 488, 490, 492, 494, 499, 502, 507, 514, 521, 528,
638 535, 539, 544, 545, 547, 549, 551, 555, 559, 563,
639 567, 571, 575, 577, 578, 580, 582, 584, 585, 588,
640 592, 594, 596, 600, 602, 603, 612, 614, 616, 620,
641 622, 624, 628, 629, 631, 633, 637, 638, 640, 642,
642 644, 646, 648, 650, 652, 654, 656, 660, 662, 668,
643 670, 672, 674, 676, 679, 682, 684, 687, 690, 691,
644 693, 695, 697, 700, 703, 707, 717, 727, 736, 751,
645 753, 755, 762, 768, 771, 778, 786, 788, 792, 794,
646 795, 798, 800, 806, 812, 818, 825, 832, 835, 840,
647 845, 852, 857, 862, 869, 876, 879, 887, 889, 892,
648 893, 895, 896, 900, 907, 911, 918, 921, 926, 933
649};
Reid Spencere7c3c602006-11-30 06:36:44 +0000650
Chris Lattner37e01c52007-01-04 18:46:42 +0000651static const short yyrhs[] = { 19,
652 0, 20, 0, 17, 0, 18, 0, 80, 0, 81,
653 0, 82, 0, 83, 0, 84, 0, 85, 0, 86,
654 0, 87, 0, 88, 0, 89, 0, 90, 0, 91,
655 0, 92, 0, 93, 0, 94, 0, 95, 0, 96,
656 0, 97, 0, 98, 0, 99, 0, 102, 0, 103,
657 0, 104, 0, 105, 0, 106, 0, 107, 0, 118,
658 0, 119, 0, 120, 0, 121, 0, 108, 0, 109,
659 0, 110, 0, 111, 0, 112, 0, 113, 0, 114,
660 0, 115, 0, 116, 0, 117, 0, 118, 0, 119,
661 0, 120, 0, 121, 0, 25, 0, 26, 0, 130,
662 0, 131, 0, 132, 0, 133, 0, 139, 0, 140,
663 0, 141, 0, 142, 0, 143, 0, 144, 0, 145,
664 0, 146, 0, 147, 0, 148, 0, 149, 0, 150,
665 0, 138, 0, 11, 0, 9, 0, 7, 0, 5,
666 0, 12, 0, 10, 0, 8, 0, 6, 0, 174,
667 0, 175, 0, 13, 0, 14, 0, 207, 151, 0,
668 0, 42, 0, 43, 0, 44, 0, 48, 0, 45,
669 0, 46, 0, 47, 0, 0, 66, 0, 67, 0,
670 68, 0, 69, 0, 70, 0, 71, 0, 65, 18,
671 0, 0, 0, 57, 18, 0, 0, 152, 57, 18,
672 0, 37, 30, 0, 0, 183, 0, 0, 152, 186,
673 185, 0, 183, 0, 57, 18, 0, 189, 0, 3,
674 0, 191, 0, 3, 0, 191, 0, 4, 0, 5,
675 0, 6, 0, 7, 0, 8, 0, 9, 0, 10,
676 0, 11, 0, 12, 0, 13, 0, 14, 0, 15,
677 0, 16, 0, 221, 0, 190, 0, 153, 18, 0,
678 188, 154, 193, 155, 0, 156, 18, 157, 191, 158,
679 0, 159, 18, 157, 191, 160, 0, 161, 192, 162,
680 0, 161, 162, 0, 159, 161, 192, 162, 160, 0,
681 159, 161, 162, 160, 0, 191, 163, 0, 191, 0,
682 192, 152, 191, 0, 192, 0, 192, 152, 40, 0,
683 40, 0, 0, 189, 156, 196, 158, 0, 189, 156,
684 158, 0, 189, 164, 30, 0, 189, 159, 196, 160,
685 0, 189, 161, 196, 162, 0, 189, 161, 162, 0,
686 189, 22, 0, 189, 23, 0, 189, 221, 0, 189,
687 195, 0, 189, 24, 0, 174, 166, 0, 175, 166,
688 0, 4, 25, 0, 4, 26, 0, 177, 21, 0,
689 173, 154, 194, 39, 189, 155, 0, 127, 154, 194,
690 236, 155, 0, 129, 154, 194, 152, 194, 152, 194,
691 155, 0, 167, 154, 194, 152, 194, 155, 0, 168,
692 154, 194, 152, 194, 155, 0, 169, 154, 194, 152,
693 194, 155, 0, 100, 170, 154, 194, 152, 194, 155,
694 0, 101, 171, 154, 194, 152, 194, 155, 0, 172,
695 154, 194, 152, 194, 155, 0, 135, 154, 194, 152,
696 194, 155, 0, 136, 154, 194, 152, 194, 152, 194,
697 155, 0, 137, 154, 194, 152, 194, 152, 194, 155,
698 0, 196, 152, 194, 0, 194, 0, 35, 0, 36,
699 0, 199, 0, 199, 216, 0, 199, 218, 0, 199,
700 63, 62, 202, 0, 199, 31, 0, 201, 0, 50,
701 0, 58, 0, 201, 178, 27, 187, 0, 201, 218,
702 0, 201, 63, 62, 202, 0, 201, 178, 179, 197,
703 194, 185, 0, 201, 178, 200, 197, 189, 185, 0,
704 201, 178, 45, 197, 189, 185, 0, 201, 178, 47,
705 197, 189, 185, 0, 201, 51, 204, 0, 201, 59,
706 151, 205, 0, 0, 30, 0, 56, 0, 55, 0,
707 53, 151, 203, 0, 54, 151, 18, 0, 52, 151,
708 30, 0, 72, 151, 30, 0, 156, 206, 158, 0,
709 206, 152, 30, 0, 30, 0, 0, 28, 0, 30,
710 0, 207, 0, 0, 189, 208, 0, 210, 152, 209,
711 0, 209, 0, 210, 0, 210, 152, 40, 0, 40,
712 0, 0, 180, 187, 207, 154, 211, 155, 184, 181,
713 0, 32, 0, 161, 0, 179, 212, 213, 0, 33,
714 0, 162, 0, 214, 224, 215, 0, 0, 45, 0,
715 47, 0, 34, 217, 212, 0, 0, 64, 0, 17,
716 0, 18, 0, 21, 0, 25, 0, 26, 0, 22,
717 0, 23, 0, 24, 0, 159, 196, 160, 0, 195,
718 0, 62, 219, 30, 152, 30, 0, 165, 0, 207,
719 0, 221, 0, 220, 0, 189, 222, 0, 224, 225,
720 0, 225, 0, 226, 228, 0, 226, 230, 0, 0,
721 29, 0, 78, 0, 77, 0, 73, 223, 0, 73,
722 3, 0, 74, 15, 222, 0, 74, 4, 222, 152,
723 15, 222, 152, 15, 222, 0, 75, 176, 222, 152,
724 15, 222, 156, 229, 158, 0, 75, 176, 222, 152,
725 15, 222, 156, 158, 0, 178, 76, 180, 187, 222,
726 154, 233, 155, 39, 15, 222, 227, 15, 222, 0,
727 227, 0, 79, 0, 229, 176, 220, 152, 15, 222,
728 0, 176, 220, 152, 15, 222, 0, 178, 235, 0,
729 189, 156, 222, 152, 222, 158, 0, 231, 152, 156,
730 222, 152, 222, 158, 0, 223, 0, 232, 152, 223,
731 0, 232, 0, 0, 61, 60, 0, 60, 0, 167,
732 189, 222, 152, 222, 0, 168, 189, 222, 152, 222,
733 0, 169, 189, 222, 152, 222, 0, 100, 170, 189,
734 222, 152, 222, 0, 101, 171, 189, 222, 152, 222,
735 0, 49, 223, 0, 172, 223, 152, 223, 0, 173,
736 223, 39, 189, 0, 129, 223, 152, 223, 152, 223,
737 0, 134, 223, 152, 189, 0, 135, 223, 152, 223,
738 0, 136, 223, 152, 223, 152, 223, 0, 137, 223,
739 152, 223, 152, 223, 0, 128, 231, 0, 234, 180,
740 187, 222, 154, 233, 155, 0, 238, 0, 152, 232,
741 0, 0, 38, 0, 0, 122, 189, 182, 0, 122,
742 189, 152, 10, 222, 182, 0, 123, 189, 182, 0,
743 123, 189, 152, 10, 222, 182, 0, 124, 223, 0,
744 237, 125, 189, 222, 0, 237, 126, 223, 152, 189,
745 222, 0, 127, 189, 222, 236, 0
746};
Reid Spencere7c3c602006-11-30 06:36:44 +0000747
748#endif
749
Chris Lattner37e01c52007-01-04 18:46:42 +0000750#if YYDEBUG != 0
751static const short yyrline[] = { 0,
752 466, 466, 467, 467, 471, 471, 471, 471, 471, 471,
753 471, 472, 472, 472, 472, 473, 473, 473, 474, 474,
754 474, 474, 474, 474, 475, 475, 475, 475, 475, 475,
755 475, 475, 475, 475, 476, 476, 476, 476, 476, 476,
756 476, 476, 476, 476, 477, 477, 477, 477, 477, 477,
757 478, 478, 478, 478, 479, 479, 479, 479, 479, 479,
758 479, 479, 480, 480, 480, 480, 480, 485, 485, 485,
759 485, 486, 486, 486, 486, 487, 487, 488, 488, 491,
760 494, 499, 499, 499, 499, 499, 499, 500, 501, 504,
761 504, 504, 504, 504, 505, 506, 511, 516, 517, 520,
762 521, 529, 535, 536, 539, 540, 549, 550, 563, 563,
763 564, 564, 565, 569, 569, 569, 569, 569, 569, 569,
764 570, 570, 570, 570, 570, 572, 575, 578, 581, 585,
765 598, 604, 610, 620, 623, 633, 636, 644, 648, 655,
766 656, 661, 666, 676, 682, 687, 693, 699, 705, 710,
767 716, 722, 729, 735, 741, 747, 753, 759, 765, 773,
768 786, 798, 803, 809, 814, 820, 825, 830, 838, 843,
769 848, 858, 863, 868, 868, 878, 883, 886, 891, 895,
770 899, 901, 901, 904, 914, 919, 924, 934, 944, 954,
771 964, 969, 974, 979, 981, 981, 984, 989, 996, 1001,
772 1008, 1015, 1020, 1021, 1029, 1029, 1030, 1030, 1032, 1041,
773 1045, 1049, 1052, 1057, 1060, 1063, 1081, 1082, 1085, 1096,
774 1097, 1099, 1108, 1109, 1110, 1114, 1127, 1128, 1131, 1131,
775 1131, 1131, 1131, 1131, 1131, 1132, 1133, 1138, 1139, 1148,
776 1148, 1152, 1157, 1167, 1177, 1180, 1188, 1192, 1197, 1200,
777 1206, 1206, 1208, 1213, 1218, 1223, 1232, 1240, 1247, 1270,
778 1275, 1281, 1287, 1295, 1313, 1321, 1330, 1334, 1341, 1342,
779 1346, 1351, 1354, 1363, 1371, 1380, 1388, 1396, 1401, 1410,
780 1438, 1444, 1450, 1457, 1463, 1469, 1475, 1493, 1498, 1499,
781 1503, 1504, 1507, 1515, 1524, 1532, 1541, 1547, 1556, 1565
782};
783#endif
784
785
786#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
787
788static const char * const yytname[] = { "$","error","$undefined.","VOID","BOOL",
789"SBYTE","UBYTE","SHORT","USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE",
790"LABEL","OPAQUE","ESINT64VAL","EUINT64VAL","SINTVAL","UINTVAL","FPVAL","NULL_TOK",
791"UNDEF","ZEROINITIALIZER","TRUETOK","FALSETOK","TYPE","VAR_ID","LABELSTR","STRINGCONSTANT",
792"IMPLEMENTATION","BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION",
793"VOLATILE","TO","DOTDOTDOT","CONST","INTERNAL","LINKONCE","WEAK","DLLIMPORT",
794"DLLEXPORT","EXTERN_WEAK","APPENDING","NOT","EXTERNAL","TARGET","TRIPLE","ENDIAN",
795"POINTERSIZE","LITTLE","BIG","ALIGN","UNINITIALIZED","DEPLIBS","CALL","TAIL",
796"ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK",
797"COLDCC_TOK","X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR",
798"SWITCH","INVOKE","EXCEPT","UNWIND","UNREACHABLE","ADD","SUB","MUL","DIV","UDIV",
799"SDIV","FDIV","REM","UREM","SREM","FREM","AND","OR","XOR","SETLE","SETGE","SETLT",
800"SETGT","SETEQ","SETNE","ICMP","FCMP","EQ","NE","SLT","SGT","SLE","SGE","OEQ",
801"ONE","OLT","OGT","OLE","OGE","ORD","UNO","UEQ","UNE","ULT","UGT","ULE","UGE",
802"MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","PHI_TOK","SELECT","SHL",
803"SHR","ASHR","LSHR","VAARG","EXTRACTELEMENT","INSERTELEMENT","SHUFFLEVECTOR",
804"CAST","TRUNC","ZEXT","SEXT","FPTRUNC","FPEXT","FPTOUI","FPTOSI","UITOFP","SITOFP",
805"PTRTOINT","INTTOPTR","BITCAST","'='","','","'\\\\'","'('","')'","'['","'x'",
806"']'","'<'","'>'","'{'","'}'","'*'","'c'","IntVal","EInt64Val","ArithmeticOps",
807"LogicalOps","SetCondOps","IPredicates","FPredicates","ShiftOps","CastOps","SIntType",
808"UIntType","IntType","FPType","OptAssign","OptLinkage","OptCallingConv","OptAlign",
809"OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
810"TypesV","UpRTypesV","Types","PrimType","UpRTypes","TypeListI","ArgTypeListI",
811"ConstVal","ConstExpr","ConstVector","GlobalType","Module","DefinitionList",
812"External","ConstPool","AsmBlock","BigOrLittle","TargetDefinition","LibrariesDefinition",
813"LibList","Name","OptName","ArgVal","ArgListH","ArgList","FunctionHeaderH","BEGIN",
814"FunctionHeader","END","Function","FnDeclareLinkage","FunctionProto","OptSideEffect",
815"ConstValueRef","SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList",
816"BasicBlock","InstructionList","Unwind","BBTerminatorInst","JumpTable","Inst",
817"PHIList","ValueRefList","ValueRefListE","OptTailCall","InstVal","IndexList",
818"OptVolatile","MemoryInst", NULL
819};
820#endif
821
822static const short yyr1[] = { 0,
823 165, 165, 166, 166, 167, 167, 167, 167, 167, 167,
824 167, 167, 167, 167, 167, 168, 168, 168, 169, 169,
825 169, 169, 169, 169, 170, 170, 170, 170, 170, 170,
826 170, 170, 170, 170, 171, 171, 171, 171, 171, 171,
827 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
828 172, 172, 172, 172, 173, 173, 173, 173, 173, 173,
829 173, 173, 173, 173, 173, 173, 173, 174, 174, 174,
830 174, 175, 175, 175, 175, 176, 176, 177, 177, 178,
831 178, 179, 179, 179, 179, 179, 179, 179, 179, 180,
832 180, 180, 180, 180, 180, 180, 180, 181, 181, 182,
833 182, 183, 184, 184, 185, 185, 186, 186, 187, 187,
834 188, 188, 189, 190, 190, 190, 190, 190, 190, 190,
835 190, 190, 190, 190, 190, 191, 191, 191, 191, 191,
836 191, 191, 191, 191, 191, 191, 191, 192, 192, 193,
837 193, 193, 193, 194, 194, 194, 194, 194, 194, 194,
838 194, 194, 194, 194, 194, 194, 194, 194, 194, 195,
839 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
840 195, 196, 196, 197, 197, 198, 199, 199, 199, 199,
841 199, 200, 200, 201, 201, 201, 201, 201, 201, 201,
842 201, 201, 201, 202, 203, 203, 204, 204, 204, 204,
843 205, 206, 206, 206, 207, 207, 208, 208, 209, 210,
844 210, 211, 211, 211, 211, 212, 213, 213, 214, 215,
845 215, 216, 217, 217, 217, 218, 219, 219, 220, 220,
846 220, 220, 220, 220, 220, 220, 220, 220, 220, 221,
847 221, 222, 222, 223, 224, 224, 225, 226, 226, 226,
848 227, 227, 228, 228, 228, 228, 228, 228, 228, 228,
849 228, 229, 229, 230, 231, 231, 232, 232, 233, 233,
850 234, 234, 235, 235, 235, 235, 235, 235, 235, 235,
851 235, 235, 235, 235, 235, 235, 235, 235, 236, 236,
852 237, 237, 238, 238, 238, 238, 238, 238, 238, 238
853};
854
855static const short yyr2[] = { 0,
856 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
857 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
858 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
859 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
860 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
861 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
862 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
863 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
864 0, 1, 1, 1, 1, 1, 1, 1, 0, 1,
865 1, 1, 1, 1, 1, 2, 0, 0, 2, 0,
866 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
867 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
868 1, 1, 1, 1, 1, 1, 1, 1, 2, 4,
869 5, 5, 3, 2, 5, 4, 2, 1, 3, 1,
870 3, 1, 0, 4, 3, 3, 4, 4, 3, 2,
871 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
872 5, 8, 6, 6, 6, 7, 7, 6, 6, 8,
873 8, 3, 1, 1, 1, 1, 2, 2, 4, 2,
874 1, 1, 1, 4, 2, 4, 6, 6, 6, 6,
875 3, 4, 0, 1, 1, 1, 3, 3, 3, 3,
876 3, 3, 1, 0, 1, 1, 1, 0, 2, 3,
877 1, 1, 3, 1, 0, 8, 1, 1, 3, 1,
878 1, 3, 0, 1, 1, 3, 0, 1, 1, 1,
879 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
880 1, 1, 1, 2, 2, 1, 2, 2, 0, 1,
881 1, 1, 2, 2, 3, 9, 9, 8, 14, 1,
882 1, 6, 5, 2, 6, 7, 1, 3, 1, 0,
883 2, 1, 5, 5, 5, 6, 6, 2, 4, 4,
884 6, 4, 4, 6, 6, 2, 7, 1, 2, 0,
885 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
886};
887
888static const short yydefact[] = { 193,
889 89, 181, 180, 223, 82, 83, 84, 86, 87, 88,
890 85, 0, 97, 249, 177, 178, 205, 206, 0, 0,
891 0, 89, 0, 185, 224, 225, 97, 0, 0, 90,
892 91, 92, 93, 94, 95, 0, 0, 250, 249, 246,
893 81, 0, 0, 0, 0, 191, 0, 0, 0, 0,
894 0, 182, 183, 0, 0, 80, 226, 194, 179, 96,
895 110, 114, 115, 116, 117, 118, 119, 120, 121, 122,
896 123, 124, 125, 126, 1, 2, 0, 0, 0, 0,
897 240, 0, 0, 109, 128, 113, 241, 127, 217, 218,
898 219, 220, 221, 222, 245, 0, 0, 0, 252, 251,
899 261, 292, 260, 247, 248, 0, 0, 0, 0, 204,
900 192, 186, 184, 174, 175, 0, 0, 0, 0, 129,
901 0, 0, 0, 112, 134, 138, 0, 0, 143, 137,
902 254, 0, 253, 0, 0, 71, 75, 70, 74, 69,
903 73, 68, 72, 76, 77, 0, 291, 0, 272, 0,
904 97, 5, 6, 7, 8, 9, 10, 11, 12, 13,
905 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
906 24, 0, 0, 0, 0, 0, 0, 0, 0, 51,
907 52, 53, 54, 0, 0, 0, 0, 67, 55, 56,
908 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
909 0, 0, 0, 0, 0, 97, 264, 0, 288, 199,
910 196, 195, 197, 198, 200, 203, 0, 105, 105, 114,
911 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
912 0, 0, 0, 0, 105, 105, 0, 0, 0, 0,
913 0, 133, 215, 142, 140, 0, 229, 230, 231, 234,
914 235, 236, 232, 233, 227, 0, 0, 0, 0, 0,
915 0, 0, 0, 0, 0, 0, 0, 0, 238, 243,
916 242, 244, 0, 255, 0, 278, 271, 0, 25, 26,
917 27, 28, 29, 30, 31, 32, 33, 34, 0, 49,
918 50, 35, 36, 37, 38, 39, 40, 41, 42, 43,
919 44, 45, 46, 47, 48, 0, 100, 100, 297, 0,
920 0, 286, 0, 0, 0, 0, 0, 0, 0, 0,
921 0, 0, 0, 0, 0, 0, 201, 0, 189, 190,
922 157, 158, 3, 4, 155, 156, 159, 150, 151, 154,
923 0, 0, 0, 0, 153, 152, 187, 188, 111, 111,
924 136, 0, 139, 214, 208, 211, 212, 0, 0, 130,
925 228, 0, 0, 0, 0, 0, 0, 0, 0, 173,
926 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
927 0, 0, 293, 0, 295, 290, 0, 0, 0, 0,
928 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
929 0, 202, 0, 0, 107, 105, 145, 0, 0, 149,
930 0, 146, 131, 132, 135, 207, 209, 0, 103, 141,
931 0, 0, 0, 290, 0, 0, 0, 0, 0, 237,
932 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
933 0, 0, 0, 0, 300, 0, 0, 0, 282, 283,
934 0, 0, 0, 0, 0, 279, 280, 0, 298, 0,
935 102, 108, 106, 144, 147, 148, 213, 210, 104, 98,
936 0, 0, 0, 0, 0, 0, 0, 0, 172, 0,
937 0, 0, 0, 0, 0, 0, 270, 0, 0, 100,
938 101, 100, 267, 289, 0, 0, 0, 0, 0, 273,
939 274, 275, 270, 0, 0, 216, 239, 0, 0, 161,
940 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
941 0, 269, 0, 276, 277, 0, 294, 296, 0, 0,
942 0, 281, 284, 285, 0, 299, 99, 0, 0, 0,
943 169, 0, 0, 163, 164, 165, 168, 160, 0, 258,
944 0, 0, 0, 268, 265, 0, 287, 166, 167, 0,
945 0, 0, 256, 0, 257, 0, 0, 266, 162, 170,
946 171, 0, 0, 0, 0, 0, 0, 263, 0, 0,
947 262, 0, 259, 0, 0, 0
948};
949
950static const short yydefgoto[] = { 81,
951 335, 264, 265, 266, 289, 306, 267, 268, 231, 232,
952 146, 233, 22, 13, 36, 506, 383, 405, 470, 329,
953 406, 82, 83, 234, 85, 86, 127, 246, 370, 269,
954 371, 116, 584, 1, 55, 2, 59, 213, 46, 111,
955 217, 87, 417, 356, 357, 358, 37, 91, 14, 94,
956 15, 27, 16, 362, 270, 88, 272, 493, 39, 40,
957 41, 103, 104, 552, 105, 312, 522, 523, 206, 207,
958 445, 208, 209
959};
960
961static const short yypact[] = {-32768,
962 217, 541,-32768, 116,-32768,-32768,-32768,-32768,-32768,-32768,
963-32768, 16, 111, 17,-32768,-32768,-32768,-32768, 34, -90,
964 61, 26, 19,-32768,-32768,-32768, 111, 144, 172,-32768,
965-32768,-32768,-32768,-32768,-32768, 871, -26,-32768, -18,-32768,
966 47, 81, 87, 93, 98,-32768, 96, 144, 871, 69,
967 69,-32768,-32768, 69, 69,-32768,-32768,-32768,-32768,-32768,
968 100,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
969-32768,-32768,-32768,-32768,-32768,-32768, 237, 238, -9, 215,
970-32768, 134, 103,-32768,-32768, -111,-32768,-32768,-32768,-32768,
971-32768,-32768,-32768,-32768,-32768, 909, 36, 148,-32768,-32768,
972-32768, 1343,-32768,-32768,-32768, 228, 40, 248, 239, 241,
973-32768,-32768,-32768,-32768,-32768, 937, 937, 965, 937,-32768,
974 110, 115, 506,-32768,-32768, -111, -98, 114, 673,-32768,
975 100, 1141,-32768, 1141, 1141,-32768,-32768,-32768,-32768,-32768,
976-32768,-32768,-32768,-32768,-32768, 1141,-32768, 937,-32768, 213,
977 111,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
978-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
979-32768, 195, 84, 937, 937, 937, 937, 937, 937,-32768,
980-32768,-32768,-32768, 937, 937, 937, 937,-32768,-32768,-32768,
981-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
982 937, 937, 937, 937, 937, 111,-32768, 6,-32768,-32768,
983-32768,-32768,-32768,-32768,-32768,-32768, -93, 122, 122, 91,
984 119, 129, 166, 169, 191, 193, 219, 223, 258, 260,
985 229, 229, 261, 1052, 122, 122, 937, 937, 124, -73,
986 937,-32768, 711,-32768, 133, 131,-32768,-32768,-32768,-32768,
987-32768,-32768,-32768,-32768, 226, 195, 84, 137, 138, 140,
988 150, 154, 965, 156, 158, 167, 168, 170,-32768,-32768,
989-32768,-32768, 171,-32768, 173,-32768,-32768, 871,-32768,-32768,
990-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 937,-32768,
991-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
992-32768,-32768,-32768,-32768,-32768, 937, 174, 175,-32768, 1141,
993 164, 176, 177, 178, 179, 182, 183, 1141, 1141, 1141,
994 184, 299, 871, 937, 937, 310,-32768, -8,-32768,-32768,
995-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
996 749, 965, 614, 311,-32768,-32768,-32768,-32768, -55, -115,
997-32768, 185, -111,-32768, 134,-32768, 190, 189, 777,-32768,
998-32768, 316, 194, 198, 965, 965, 965, 965, 965,-32768,
999 -102, 965, 965, 965, 965, 965, 332, 344, 1141, 1141,
1000 1141, -2,-32768, 9,-32768, 208, 1141, 207, 937, 937,
1001 937, 937, 937, 212, 214, 218, 937, 937, 1141, 1141,
1002 220,-32768, 335, 349,-32768, 122,-32768, -61, -58,-32768,
1003 -70,-32768,-32768,-32768,-32768,-32768,-32768, 833, 336,-32768,
1004 231, 965, 965, 208, 235, 236, 240, 242, 965,-32768,
1005 243, 244, 245, 249, 330, 1141, 1141, 221, 250, 251,
1006 1141, 363, 1141, 937,-32768, 252, 1141, 253,-32768,-32768,
1007 254, 255, 1141, 1141, 1141,-32768,-32768, 256,-32768, 937,
1008-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 333,
1009 359, 257, 262, 263, 965, 965, 965, 965,-32768, 965,
1010 965, 965, 965, 937, 264, 259, 937, 1141, 1141, 265,
1011-32768, 265,-32768, 267, 1141, 268, 937, 937, 937,-32768,
1012-32768,-32768, 937, 1141, 375,-32768,-32768, 965, 965,-32768,
1013 269, 273, 270, 271, 274, 275, 276, 277, 278, 419,
1014 15, 267, 282,-32768,-32768, 381,-32768,-32768, 937, 281,
1015 1141,-32768,-32768,-32768, 286,-32768,-32768, 289, 292, 965,
1016-32768, 965, 965,-32768,-32768,-32768,-32768,-32768, 1141,-32768,
1017 1230, 27, 410,-32768,-32768, 297,-32768,-32768,-32768, 295,
1018 303, 304,-32768, 308,-32768, 1230, 449,-32768,-32768,-32768,
1019-32768, 450, 314, 1141, 1141, 453, 135,-32768, 1141, 454,
1020-32768, 1141,-32768, 472, 473,-32768
1021};
1022
1023static const short yypgoto[] = {-32768,
1024 247, 372, 374, 378, 225, 227, 380, 383, -96, -95,
1025 -505,-32768, 436, 461, -139,-32768, -301, 67,-32768, -218,
1026-32768, -45,-32768, -36,-32768, -66, -16,-32768, 132, 290,
1027 -214, 60,-32768,-32768,-32768,-32768, 441,-32768,-32768,-32768,
1028-32768, 3,-32768, 72,-32768,-32768, 464,-32768,-32768,-32768,
1029-32768,-32768, 490,-32768, -510, -104, -1, -86,-32768, 456,
1030-32768, -81,-32768,-32768,-32768,-32768, 58, 20,-32768,-32768,
1031 104,-32768,-32768
1032};
1033
1034
1035#define YYLAST 1493
1036
1037
1038static const short yytable[] = { 84,
1039 330, 144, 145, 113, 23, 89, 385, 441, 122, 133,
1040 38, 278, 84, 126, 92, 551, 347, 348, 443, 136,
1041 137, 138, 139, 140, 141, 142, 143, 271, 403, 271,
1042 271, 136, 137, 138, 139, 140, 141, 142, 143, 134,
1043 564, 271, -111, 23, 414, 38, 566, 130, 404, 429,
1044 135, 130, 49, 241, 442, 573, 126, 430, 326, 132,
1045 47, 276, 126, 242, 327, 442, 323, 5, 6, 7,
1046 50, 9, 51, 11, 17, 52, 18, 28, 241, 218,
1047 219, 429, 236, 53, 128, 42, 43, 44, 352, 309,
1048 429, 466, 313, 429, 211, 212, 464, 314, 315, 316,
1049 317, 465, 413, 114, 115, 45, 240, 130, 290, 291,
1050 117, 132, 245, 118, 119, 331, 332, 321, 322, 96,
1051 97, 98, 48, 99, 100, 101, 408, 409, 411, 346,
1052 324, 325, 273, 274, 90, -71, -71, 307, 308, 132,
1053 310, 311, 132, 93, 275, -75, -75, 132, 132, 132,
1054 132, 123, 136, 137, 138, 139, 140, 141, 142, 143,
1055 25, 17, 26, 18, 318, 319, 320, 132, 132, 56,
1056 349, 350, 550, 58, 353, 29, 30, 31, 32, 33,
1057 34, 35, -70, -70, 565, -74, -74, 463, 527, 60,
1058 528, 292, 293, 294, 295, 296, 297, 298, 299, 300,
1059 301, 302, 303, 304, 305, 271, 355, -69, -69, -73,
1060 -73, 99, 100, 271, 271, 271, -176, 124, 62, 63,
1061 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
1062 74, 106, 379, 75, 76, -68, -68, 107, 401, -72,
1063 -72, 84, 17, 108, 18, 333, 334, 3, 109, 235,
1064 4, 110, 380, -112, 120, 121, 129, 210, 5, 6,
1065 7, 8, 9, 10, 11, 214, 237, 243, 215, 381,
1066 216, 238, 277, 328, 271, 271, 271, 399, -78, 12,
1067 -79, 337, 271, 351, 359, 360, 84, 400, 132, 361,
1068 365, 366, 353, 367, 271, 271, 279, 280, 281, 282,
1069 283, 284, 448, 368, 450, 451, 452, 369, 386, 372,
1070 456, 373, 285, 286, 287, 288, 394, 395, 396, 387,
1071 374, 375, 377, 376, 378, 382, 384, 388, 389, 390,
1072 391, 271, 271, 392, 393, 397, 271, 398, 271, 402,
1073 412, 418, 271, 419, 415, 421, 436, 422, 271, 271,
1074 271, 423, 132, 449, 132, 132, 132, 416, 437, 444,
1075 132, 457, 447, 453, 461, 454, 462, 77, 484, 455,
1076 78, 460, 403, 79, 487, 80, 125, 438, 439, 440,
1077 491, 355, 471, 271, 271, 446, 475, 476, 507, 505,
1078 271, 477, 537, 478, 480, 481, 482, 458, 459, 271,
1079 483, 488, 489, 495, 497, 498, 499, 132, 508, 503,
1080 532, 533, 534, 509, 521, 520, 526, 510, 529, 531,
1081 540, 542, 543, 504, 144, 145, 271, 541, 544, 545,
1082 546, 547, 548, 549, 485, 486, 553, 442, 555, 490,
1083 557, 492, 554, 558, 271, 496, 559, 519, 567, 569,
1084 132, 500, 501, 502, 568, 144, 145, 570, 571, 572,
1085 132, 132, 132, 574, 575, 576, 132, 579, 582, 271,
1086 271, 585, 586, 201, 271, 202, 102, 271, 336, 203,
1087 363, 204, 54, 364, 205, 469, 524, 525, 112, 468,
1088 57, 24, 132, 530, 95, 580, 424, 425, 426, 427,
1089 428, 494, 536, 431, 432, 433, 434, 435, 124, 62,
1090 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1091 73, 74, 535, 345, 75, 76, 0, 474, 0, 556,
1092 0, 0, 0, 17, 0, 18, 0, 0, 0, 0,
1093 0, 0, 0, 0, 0, 0, 0, 563, 0, 0,
1094 0, 0, 0, 472, 473, 0, 0, 0, 0, 0,
1095 479, 0, 0, 0, 0, 0, 0, -81, 17, 0,
1096 18, 0, 577, 578, 4, -81, -81, 581, 0, 0,
1097 583, 0, -81, -81, -81, -81, -81, -81, -81, 0,
1098 -81, 19, 0, 0, 0, 0, 0, 0, -81, 20,
1099 0, 0, 0, 21, 0, 0, 511, 512, 513, 514,
1100 0, 515, 516, 517, 518, 0, 124, 220, 221, 222,
1101 223, 224, 225, 226, 227, 228, 229, 230, 73, 74,
1102 0, 0, 75, 76, 0, 0, 0, 0, 0, 538,
1103 539, 17, 0, 18, 0, 0, 0, 0, 0, 0,
1104 0, 0, 0, 0, 0, 0, 0, 0, 77, 0,
1105 0, 78, 0, 0, 79, 0, 80, 239, 0, 0,
1106 0, 560, 0, 561, 562, 124, 62, 63, 64, 65,
1107 66, 67, 68, 69, 70, 71, 72, 73, 74, 0,
1108 0, 75, 76, 0, 0, 0, 0, 0, 0, 0,
1109 17, 0, 18, 0, 0, 0, 0, 0, 0, 0,
1110 0, 0, 244, 124, 62, 63, 64, 65, 66, 67,
1111 68, 69, 70, 71, 72, 73, 74, 0, 0, 75,
1112 76, 0, 0, 0, 0, 0, 0, 0, 17, 0,
1113 18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1114 354, 124, 220, 221, 222, 223, 224, 225, 226, 227,
1115 228, 229, 230, 73, 74, 0, 77, 75, 76, 78,
1116 0, 0, 79, 0, 80, 410, 17, 0, 18, 124,
1117 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1118 72, 73, 74, 0, 0, 75, 76, 0, 0, 0,
1119 0, 0, 0, 0, 17, 0, 18, 0, 0, 0,
1120 0, 0, 0, 0, 0, 0, 420, 0, 0, 0,
1121 0, 0, 0, 0, 0, 77, 0, 0, 78, 0,
1122 0, 79, 0, 80, 0, 124, 62, 63, 64, 65,
1123 66, 67, 68, 69, 70, 71, 72, 73, 74, 0,
1124 0, 75, 76, 0, 0, 0, 0, 0, 0, 0,
1125 17, 0, 18, 77, 0, 0, 78, 0, 0, 79,
1126 0, 80, 467, 61, 62, 63, 64, 65, 66, 67,
1127 68, 69, 70, 71, 72, 73, 74, 0, 0, 75,
1128 76, 0, 0, 0, 0, 0, 0, 0, 17, 0,
1129 18, 77, 0, 0, 78, 0, 407, 79, 0, 80,
1130 0, 131, 62, 63, 64, 65, 66, 67, 68, 69,
1131 70, 71, 72, 73, 74, 0, 0, 75, 76, 77,
1132 0, 0, 78, 0, 0, 79, 17, 80, 18, 124,
1133 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1134 72, 73, 74, 0, 0, 75, 76, 0, 0, 0,
1135 0, 0, 0, 0, 17, 0, 18, 124, 220, 221,
1136 222, 223, 224, 225, 226, 227, 228, 229, 230, 73,
1137 74, 0, 0, 75, 76, 77, 0, 0, 78, 0,
1138 0, 79, 17, 80, 18, 0, 0, 0, 0, 0,
1139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1141 0, 0, 0, 77, 0, 0, 78, 0, 0, 79,
1142 0, 80, 0, 0, 0, 0, 0, 0, 0, 0,
1143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1145 0, 77, 0, 0, 78, 0, 0, 79, 0, 80,
1146 75, 76, 0, 338, 339, 340, 0, 0, 0, 17,
1147 0, 18, 0, 0, 0, 0, 0, 0, 0, 77,
1148 0, 0, 78, 0, 0, 79, 0, 80, 0, 0,
1149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1150 0, 0, 0, 0, 0, 0, 0, 77, 0, 0,
1151 78, 0, 0, 79, 0, 80, 0, 0, 0, 0,
1152 0, 152, 153, 154, 155, 156, 157, 158, 159, 160,
1153 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
1154 171, 256, 257, 0, 0, 0, 0, 247, 248, 75,
1155 76, 249, 250, 251, 252, 253, 254, 0, 17, 0,
1156 18, 0, 0, 0, 0, 0, 0, 0, 258, 0,
1157 259, 180, 181, 182, 183, 0, 260, 261, 262, 188,
1158 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
1159 199, 200, 255, 0, 0, 0, 0, 341, 0, 0,
1160 342, 0, 343, 0, 0, 344, 0, 0, 0, 0,
1161 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
1162 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
1163 256, 257, 0, 0, 0, 0, 247, 248, 0, 0,
1164 249, 250, 251, 252, 253, 254, 0, 0, 0, 0,
1165 0, 0, 0, 0, 0, 0, 0, 258, 0, 259,
1166 180, 181, 182, 183, 0, 260, 261, 262, 188, 189,
1167 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
1168 200, 255, 0, 0, 0, 0, 0, 0, 0, 263,
1169 0, 0, 0, 0, 0, 0, 0, 0, 0, 152,
1170 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
1171 163, 164, 165, 166, 167, 168, 169, 170, 171, 256,
1172 257, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1173 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1174 0, 0, 0, 0, 0, 0, 258, 0, 259, 180,
1175 181, 182, 183, 0, 260, 261, 262, 188, 189, 190,
1176 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
1177 147, 0, 0, 0, 0, 0, 0, 0, 263, 0,
1178 0, 148, 0, 0, 0, 0, 0, 0, 0, 0,
1179 0, 0, 149, 150, 0, 0, 0, 0, 0, 0,
1180 0, 0, 0, 0, 0, 0, 0, 0, 151, 0,
1181 0, 0, 152, 153, 154, 155, 156, 157, 158, 159,
1182 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
1183 170, 171, 172, 173, 0, 0, 0, 0, 0, 0,
1184 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1185 0, 0, 0, 0, 174, 175, 176, 0, 0, 177,
1186 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1187 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
1188 198, 199, 200
1189};
1190
1191static const short yycheck[] = { 36,
1192 219, 98, 98, 49, 2, 32, 308, 10, 18, 96,
1193 29, 151, 49, 80, 33, 521, 235, 236, 10, 5,
1194 6, 7, 8, 9, 10, 11, 12, 132, 37, 134,
1195 135, 5, 6, 7, 8, 9, 10, 11, 12, 4,
1196 551, 146, 154, 41, 160, 29, 552, 163, 57, 152,
1197 15, 163, 27, 152, 57, 566, 123, 160, 152, 96,
1198 151, 148, 129, 162, 158, 57, 206, 42, 43, 44,
1199 45, 46, 47, 48, 28, 50, 30, 62, 152, 116,
1200 117, 152, 119, 58, 82, 52, 53, 54, 162, 176,
1201 152, 162, 179, 152, 55, 56, 158, 184, 185, 186,
1202 187, 160, 158, 35, 36, 72, 123, 163, 25, 26,
1203 51, 148, 129, 54, 55, 25, 26, 204, 205, 73,
1204 74, 75, 62, 77, 78, 79, 341, 342, 343, 234,
1205 125, 126, 134, 135, 161, 17, 18, 174, 175, 176,
1206 177, 178, 179, 162, 146, 17, 18, 184, 185, 186,
1207 187, 161, 5, 6, 7, 8, 9, 10, 11, 12,
1208 45, 28, 47, 30, 201, 202, 203, 204, 205, 151,
1209 237, 238, 158, 30, 241, 65, 66, 67, 68, 69,
1210 70, 71, 17, 18, 158, 17, 18, 406, 490, 18,
1211 492, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1212 117, 118, 119, 120, 121, 310, 243, 17, 18, 17,
1213 18, 77, 78, 318, 319, 320, 0, 3, 4, 5,
1214 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1215 16, 151, 278, 19, 20, 17, 18, 151, 325, 17,
1216 18, 278, 28, 151, 30, 17, 18, 31, 151, 118,
1217 34, 156, 289, 154, 18, 18, 154, 30, 42, 43,
1218 44, 45, 46, 47, 48, 18, 157, 154, 30, 306,
1219 30, 157, 60, 152, 379, 380, 381, 323, 21, 63,
1220 21, 21, 387, 160, 152, 155, 323, 324, 325, 64,
1221 154, 154, 359, 154, 399, 400, 102, 103, 104, 105,
1222 106, 107, 389, 154, 391, 392, 393, 154, 310, 154,
1223 397, 154, 118, 119, 120, 121, 318, 319, 320, 156,
1224 154, 154, 152, 154, 152, 152, 152, 152, 152, 152,
1225 152, 436, 437, 152, 152, 152, 441, 39, 443, 30,
1226 30, 152, 447, 155, 160, 30, 15, 154, 453, 454,
1227 455, 154, 389, 390, 391, 392, 393, 355, 15, 152,
1228 397, 398, 156, 152, 30, 152, 18, 153, 39, 152,
1229 156, 152, 37, 159, 154, 161, 162, 379, 380, 381,
1230 18, 418, 152, 488, 489, 387, 152, 152, 30, 57,
1231 495, 152, 18, 152, 152, 152, 152, 399, 400, 504,
1232 152, 152, 152, 152, 152, 152, 152, 444, 152, 154,
1233 497, 498, 499, 152, 156, 152, 152, 155, 152, 152,
1234 152, 152, 152, 460, 521, 521, 531, 155, 155, 155,
1235 155, 155, 155, 15, 436, 437, 155, 57, 158, 441,
1236 155, 443, 529, 155, 549, 447, 155, 484, 39, 155,
1237 487, 453, 454, 455, 158, 552, 552, 155, 155, 152,
1238 497, 498, 499, 15, 15, 152, 503, 15, 15, 574,
1239 575, 0, 0, 102, 579, 102, 41, 582, 232, 102,
1240 256, 102, 22, 257, 102, 419, 488, 489, 48, 418,
1241 27, 2, 529, 495, 39, 577, 365, 366, 367, 368,
1242 369, 444, 504, 372, 373, 374, 375, 376, 3, 4,
1243 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1244 15, 16, 503, 234, 19, 20, -1, 424, -1, 531,
1245 -1, -1, -1, 28, -1, 30, -1, -1, -1, -1,
1246 -1, -1, -1, -1, -1, -1, -1, 549, -1, -1,
1247 -1, -1, -1, 422, 423, -1, -1, -1, -1, -1,
1248 429, -1, -1, -1, -1, -1, -1, 27, 28, -1,
1249 30, -1, 574, 575, 34, 35, 36, 579, -1, -1,
1250 582, -1, 42, 43, 44, 45, 46, 47, 48, -1,
1251 50, 51, -1, -1, -1, -1, -1, -1, 58, 59,
1252 -1, -1, -1, 63, -1, -1, 475, 476, 477, 478,
1253 -1, 480, 481, 482, 483, -1, 3, 4, 5, 6,
1254 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1255 -1, -1, 19, 20, -1, -1, -1, -1, -1, 508,
1256 509, 28, -1, 30, -1, -1, -1, -1, -1, -1,
1257 -1, -1, -1, -1, -1, -1, -1, -1, 153, -1,
1258 -1, 156, -1, -1, 159, -1, 161, 162, -1, -1,
1259 -1, 540, -1, 542, 543, 3, 4, 5, 6, 7,
1260 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
1261 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
1262 28, -1, 30, -1, -1, -1, -1, -1, -1, -1,
1263 -1, -1, 40, 3, 4, 5, 6, 7, 8, 9,
1264 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
1265 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
1266 30, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1267 40, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1268 12, 13, 14, 15, 16, -1, 153, 19, 20, 156,
1269 -1, -1, 159, -1, 161, 162, 28, -1, 30, 3,
1270 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1271 14, 15, 16, -1, -1, 19, 20, -1, -1, -1,
1272 -1, -1, -1, -1, 28, -1, 30, -1, -1, -1,
1273 -1, -1, -1, -1, -1, -1, 40, -1, -1, -1,
1274 -1, -1, -1, -1, -1, 153, -1, -1, 156, -1,
1275 -1, 159, -1, 161, -1, 3, 4, 5, 6, 7,
1276 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
1277 -1, 19, 20, -1, -1, -1, -1, -1, -1, -1,
1278 28, -1, 30, 153, -1, -1, 156, -1, -1, 159,
1279 -1, 161, 40, 3, 4, 5, 6, 7, 8, 9,
1280 10, 11, 12, 13, 14, 15, 16, -1, -1, 19,
1281 20, -1, -1, -1, -1, -1, -1, -1, 28, -1,
1282 30, 153, -1, -1, 156, -1, 158, 159, -1, 161,
1283 -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1284 12, 13, 14, 15, 16, -1, -1, 19, 20, 153,
1285 -1, -1, 156, -1, -1, 159, 28, 161, 30, 3,
1286 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1287 14, 15, 16, -1, -1, 19, 20, -1, -1, -1,
1288 -1, -1, -1, -1, 28, -1, 30, 3, 4, 5,
1289 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1290 16, -1, -1, 19, 20, 153, -1, -1, 156, -1,
1291 -1, 159, 28, 161, 30, -1, -1, -1, -1, -1,
1292 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1293 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1294 -1, -1, -1, 153, -1, -1, 156, -1, -1, 159,
1295 -1, 161, -1, -1, -1, -1, -1, -1, -1, -1,
1296 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1297 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1298 -1, 153, -1, -1, 156, -1, -1, 159, -1, 161,
1299 19, 20, -1, 22, 23, 24, -1, -1, -1, 28,
1300 -1, 30, -1, -1, -1, -1, -1, -1, -1, 153,
1301 -1, -1, 156, -1, -1, 159, -1, 161, -1, -1,
1302 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1303 -1, -1, -1, -1, -1, -1, -1, 153, -1, -1,
1304 156, -1, -1, 159, -1, 161, -1, -1, -1, -1,
1305 -1, 80, 81, 82, 83, 84, 85, 86, 87, 88,
1306 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
1307 99, 100, 101, -1, -1, -1, -1, 17, 18, 19,
1308 20, 21, 22, 23, 24, 25, 26, -1, 28, -1,
1309 30, -1, -1, -1, -1, -1, -1, -1, 127, -1,
1310 129, 130, 131, 132, 133, -1, 135, 136, 137, 138,
1311 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
1312 149, 150, 62, -1, -1, -1, -1, 156, -1, -1,
1313 159, -1, 161, -1, -1, 164, -1, -1, -1, -1,
1314 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
1315 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
1316 100, 101, -1, -1, -1, -1, 17, 18, -1, -1,
1317 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
1318 -1, -1, -1, -1, -1, -1, -1, 127, -1, 129,
1319 130, 131, 132, 133, -1, 135, 136, 137, 138, 139,
1320 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
1321 150, 62, -1, -1, -1, -1, -1, -1, -1, 159,
1322 -1, -1, -1, -1, -1, -1, -1, -1, -1, 80,
1323 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
1324 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
1325 101, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1326 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1327 -1, -1, -1, -1, -1, -1, 127, -1, 129, 130,
1328 131, 132, 133, -1, 135, 136, 137, 138, 139, 140,
1329 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
1330 38, -1, -1, -1, -1, -1, -1, -1, 159, -1,
1331 -1, 49, -1, -1, -1, -1, -1, -1, -1, -1,
1332 -1, -1, 60, 61, -1, -1, -1, -1, -1, -1,
1333 -1, -1, -1, -1, -1, -1, -1, -1, 76, -1,
1334 -1, -1, 80, 81, 82, 83, 84, 85, 86, 87,
1335 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
1336 98, 99, 100, 101, -1, -1, -1, -1, -1, -1,
1337 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1338 -1, -1, -1, -1, 122, 123, 124, -1, -1, 127,
1339 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
1340 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
1341 148, 149, 150
1342};
1343/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
1344#line 3 "/usr/share/bison.simple"
1345/* This file comes from bison-1.28. */
1346
1347/* Skeleton output parser for bison,
1348 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
1349
1350 This program is free software; you can redistribute it and/or modify
1351 it under the terms of the GNU General Public License as published by
1352 the Free Software Foundation; either version 2, or (at your option)
1353 any later version.
1354
1355 This program is distributed in the hope that it will be useful,
1356 but WITHOUT ANY WARRANTY; without even the implied warranty of
1357 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1358 GNU General Public License for more details.
1359
1360 You should have received a copy of the GNU General Public License
1361 along with this program; if not, write to the Free Software
1362 Foundation, Inc., 59 Temple Place - Suite 330,
1363 Boston, MA 02111-1307, USA. */
1364
1365/* As a special exception, when this file is copied by Bison into a
1366 Bison output file, you may use that output file without restriction.
1367 This special exception was added by the Free Software Foundation
1368 in version 1.24 of Bison. */
1369
1370/* This is the parser code that is written into each bison parser
1371 when the %semantic_parser declaration is not specified in the grammar.
1372 It was written by Richard Stallman by simplifying the hairy parser
1373 used when %semantic_parser is specified. */
1374
1375#ifndef YYSTACK_USE_ALLOCA
1376#ifdef alloca
1377#define YYSTACK_USE_ALLOCA
1378#else /* alloca not defined */
1379#ifdef __GNUC__
1380#define YYSTACK_USE_ALLOCA
1381#define alloca __builtin_alloca
1382#else /* not GNU C. */
1383#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
1384#define YYSTACK_USE_ALLOCA
1385#include <alloca.h>
1386#else /* not sparc */
1387/* We think this test detects Watcom and Microsoft C. */
1388/* This used to test MSDOS, but that is a bad idea
1389 since that symbol is in the user namespace. */
1390#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
1391#if 0 /* No need for malloc.h, which pollutes the namespace;
1392 instead, just don't use alloca. */
1393#include <malloc.h>
1394#endif
1395#else /* not MSDOS, or __TURBOC__ */
1396#if defined(_AIX)
1397/* I don't know what this was needed for, but it pollutes the namespace.
1398 So I turned it off. rms, 2 May 1997. */
1399/* #include <malloc.h> */
1400 #pragma alloca
1401#define YYSTACK_USE_ALLOCA
1402#else /* not MSDOS, or __TURBOC__, or _AIX */
1403#if 0
1404#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
1405 and on HPUX 10. Eventually we can turn this on. */
1406#define YYSTACK_USE_ALLOCA
1407#define alloca __builtin_alloca
1408#endif /* __hpux */
1409#endif
1410#endif /* not _AIX */
1411#endif /* not MSDOS, or __TURBOC__ */
1412#endif /* not sparc */
1413#endif /* not GNU C */
1414#endif /* alloca not defined */
1415#endif /* YYSTACK_USE_ALLOCA not defined */
1416
1417#ifdef YYSTACK_USE_ALLOCA
1418#define YYSTACK_ALLOC alloca
Reid Spencere7c3c602006-11-30 06:36:44 +00001419#else
Chris Lattner37e01c52007-01-04 18:46:42 +00001420#define YYSTACK_ALLOC malloc
Reid Spencere7c3c602006-11-30 06:36:44 +00001421#endif
1422
Chris Lattner37e01c52007-01-04 18:46:42 +00001423/* Note: there must be only one dollar sign in this file.
1424 It is replaced by the list of actions, each action
1425 as one case of the switch. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001426
1427#define yyerrok (yyerrstatus = 0)
1428#define yyclearin (yychar = YYEMPTY)
Chris Lattner37e01c52007-01-04 18:46:42 +00001429#define YYEMPTY -2
Reid Spencere7c3c602006-11-30 06:36:44 +00001430#define YYEOF 0
Reid Spencere7c3c602006-11-30 06:36:44 +00001431#define YYACCEPT goto yyacceptlab
Chris Lattner37e01c52007-01-04 18:46:42 +00001432#define YYABORT goto yyabortlab
1433#define YYERROR goto yyerrlab1
1434/* Like YYERROR except do call yyerror.
1435 This remains here temporarily to ease the
1436 transition to the new meaning of YYERROR, for GCC.
Reid Spencere7c3c602006-11-30 06:36:44 +00001437 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001438#define YYFAIL goto yyerrlab
Reid Spencere7c3c602006-11-30 06:36:44 +00001439#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner37e01c52007-01-04 18:46:42 +00001440#define YYBACKUP(token, value) \
Reid Spencere7c3c602006-11-30 06:36:44 +00001441do \
1442 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner37e01c52007-01-04 18:46:42 +00001443 { yychar = (token), yylval = (value); \
1444 yychar1 = YYTRANSLATE (yychar); \
Reid Spencere7c3c602006-11-30 06:36:44 +00001445 YYPOPSTACK; \
1446 goto yybackup; \
1447 } \
1448 else \
Chris Lattner37e01c52007-01-04 18:46:42 +00001449 { yyerror ("syntax error: cannot back up"); YYERROR; } \
Reid Spencere7c3c602006-11-30 06:36:44 +00001450while (0)
1451
Reid Spencere7c3c602006-11-30 06:36:44 +00001452#define YYTERROR 1
1453#define YYERRCODE 256
1454
Chris Lattner37e01c52007-01-04 18:46:42 +00001455#ifndef YYPURE
1456#define YYLEX yylex()
Reid Spencere7c3c602006-11-30 06:36:44 +00001457#endif
1458
Chris Lattner37e01c52007-01-04 18:46:42 +00001459#ifdef YYPURE
1460#ifdef YYLSP_NEEDED
Reid Spencere7c3c602006-11-30 06:36:44 +00001461#ifdef YYLEX_PARAM
Chris Lattner37e01c52007-01-04 18:46:42 +00001462#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
Reid Spencere7c3c602006-11-30 06:36:44 +00001463#else
Chris Lattner37e01c52007-01-04 18:46:42 +00001464#define YYLEX yylex(&yylval, &yylloc)
1465#endif
1466#else /* not YYLSP_NEEDED */
1467#ifdef YYLEX_PARAM
1468#define YYLEX yylex(&yylval, YYLEX_PARAM)
1469#else
1470#define YYLEX yylex(&yylval)
1471#endif
1472#endif /* not YYLSP_NEEDED */
Reid Spencere7c3c602006-11-30 06:36:44 +00001473#endif
1474
Chris Lattner37e01c52007-01-04 18:46:42 +00001475/* If nonreentrant, generate the variables here */
Reid Spencere7c3c602006-11-30 06:36:44 +00001476
Chris Lattner37e01c52007-01-04 18:46:42 +00001477#ifndef YYPURE
Reid Spencere7c3c602006-11-30 06:36:44 +00001478
Chris Lattner37e01c52007-01-04 18:46:42 +00001479int yychar; /* the lookahead symbol */
1480YYSTYPE yylval; /* the semantic value of the */
1481 /* lookahead symbol */
Reid Spencere7c3c602006-11-30 06:36:44 +00001482
Chris Lattner37e01c52007-01-04 18:46:42 +00001483#ifdef YYLSP_NEEDED
1484YYLTYPE yylloc; /* location data for the lookahead */
1485 /* symbol */
Reid Spencere7c3c602006-11-30 06:36:44 +00001486#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001487
Chris Lattner37e01c52007-01-04 18:46:42 +00001488int yynerrs; /* number of parse errors so far */
1489#endif /* not YYPURE */
Reid Spencere7c3c602006-11-30 06:36:44 +00001490
Chris Lattner37e01c52007-01-04 18:46:42 +00001491#if YYDEBUG != 0
1492int yydebug; /* nonzero means print parse trace */
1493/* Since this is uninitialized, it does not stop multiple parsers
1494 from coexisting. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001495#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001496
Chris Lattner37e01c52007-01-04 18:46:42 +00001497/* YYINITDEPTH indicates the initial size of the parser's stacks */
Reid Spencere7c3c602006-11-30 06:36:44 +00001498
Reid Spencere7c3c602006-11-30 06:36:44 +00001499#ifndef YYINITDEPTH
Chris Lattner37e01c52007-01-04 18:46:42 +00001500#define YYINITDEPTH 200
Reid Spencere7c3c602006-11-30 06:36:44 +00001501#endif
1502
Chris Lattner37e01c52007-01-04 18:46:42 +00001503/* YYMAXDEPTH is the maximum size the stacks can grow to
1504 (effective only if the built-in stack extension method is used). */
Reid Spencere7c3c602006-11-30 06:36:44 +00001505
Chris Lattner37e01c52007-01-04 18:46:42 +00001506#if YYMAXDEPTH == 0
1507#undef YYMAXDEPTH
1508#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001509
1510#ifndef YYMAXDEPTH
Chris Lattner37e01c52007-01-04 18:46:42 +00001511#define YYMAXDEPTH 10000
Reid Spencere7c3c602006-11-30 06:36:44 +00001512#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001513
Chris Lattner37e01c52007-01-04 18:46:42 +00001514/* Define __yy_memcpy. Note that the size argument
1515 should be passed with type unsigned int, because that is what the non-GCC
1516 definitions require. With GCC, __builtin_memcpy takes an arg
1517 of type size_t, but it can handle unsigned int. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001518
Chris Lattner37e01c52007-01-04 18:46:42 +00001519#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
1520#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
1521#else /* not GNU C or C++ */
1522#ifndef __cplusplus
Reid Spencere7c3c602006-11-30 06:36:44 +00001523
Chris Lattner37e01c52007-01-04 18:46:42 +00001524/* This is the most reliable way to avoid incompatibilities
1525 in available built-in functions on various systems. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001526static void
Chris Lattner37e01c52007-01-04 18:46:42 +00001527__yy_memcpy (to, from, count)
1528 char *to;
1529 char *from;
1530 unsigned int count;
1531{
1532 register char *f = from;
1533 register char *t = to;
1534 register int i = count;
1535
1536 while (i-- > 0)
1537 *t++ = *f++;
1538}
1539
1540#else /* __cplusplus */
1541
1542/* This is the most reliable way to avoid incompatibilities
1543 in available built-in functions on various systems. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001544static void
Chris Lattner37e01c52007-01-04 18:46:42 +00001545__yy_memcpy (char *to, char *from, unsigned int count)
1546{
1547 register char *t = to;
1548 register char *f = from;
1549 register int i = count;
1550
1551 while (i-- > 0)
1552 *t++ = *f++;
1553}
1554
Reid Spencere7c3c602006-11-30 06:36:44 +00001555#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001556#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001557
Chris Lattner37e01c52007-01-04 18:46:42 +00001558#line 217 "/usr/share/bison.simple"
Reid Spencere7c3c602006-11-30 06:36:44 +00001559
Chris Lattner37e01c52007-01-04 18:46:42 +00001560/* The user can define YYPARSE_PARAM as the name of an argument to be passed
1561 into yyparse. The argument should have type void *.
1562 It should actually point to an object.
1563 Grammar actions can access the variable by casting it
1564 to the proper pointer type. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001565
1566#ifdef YYPARSE_PARAM
Chris Lattner37e01c52007-01-04 18:46:42 +00001567#ifdef __cplusplus
1568#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1569#define YYPARSE_PARAM_DECL
1570#else /* not __cplusplus */
1571#define YYPARSE_PARAM_ARG YYPARSE_PARAM
1572#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1573#endif /* not __cplusplus */
1574#else /* not YYPARSE_PARAM */
1575#define YYPARSE_PARAM_ARG
1576#define YYPARSE_PARAM_DECL
1577#endif /* not YYPARSE_PARAM */
1578
1579/* Prevent warning if -Wstrict-prototypes. */
1580#ifdef __GNUC__
1581#ifdef YYPARSE_PARAM
1582int yyparse (void *);
1583#else
Reid Spencere7c3c602006-11-30 06:36:44 +00001584int yyparse (void);
Reid Spencere7c3c602006-11-30 06:36:44 +00001585#endif
Chris Lattner37e01c52007-01-04 18:46:42 +00001586#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001587
Reid Spencere7c3c602006-11-30 06:36:44 +00001588int
Chris Lattner37e01c52007-01-04 18:46:42 +00001589yyparse(YYPARSE_PARAM_ARG)
1590 YYPARSE_PARAM_DECL
Reid Spencere7c3c602006-11-30 06:36:44 +00001591{
Chris Lattner37e01c52007-01-04 18:46:42 +00001592 register int yystate;
1593 register int yyn;
1594 register short *yyssp;
1595 register YYSTYPE *yyvsp;
1596 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1597 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
Reid Spencere7c3c602006-11-30 06:36:44 +00001598
Chris Lattner37e01c52007-01-04 18:46:42 +00001599 short yyssa[YYINITDEPTH]; /* the state stack */
1600 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
Reid Spencere7c3c602006-11-30 06:36:44 +00001601
Chris Lattner37e01c52007-01-04 18:46:42 +00001602 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1603 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
Reid Spencere7c3c602006-11-30 06:36:44 +00001604
Chris Lattner37e01c52007-01-04 18:46:42 +00001605#ifdef YYLSP_NEEDED
1606 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1607 YYLTYPE *yyls = yylsa;
1608 YYLTYPE *yylsp;
Reid Spencere7c3c602006-11-30 06:36:44 +00001609
Chris Lattner37e01c52007-01-04 18:46:42 +00001610#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1611#else
Reid Spencere7c3c602006-11-30 06:36:44 +00001612#define YYPOPSTACK (yyvsp--, yyssp--)
Chris Lattner37e01c52007-01-04 18:46:42 +00001613#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001614
Chris Lattner37e01c52007-01-04 18:46:42 +00001615 int yystacksize = YYINITDEPTH;
1616 int yyfree_stacks = 0;
Reid Spencere7c3c602006-11-30 06:36:44 +00001617
Chris Lattner37e01c52007-01-04 18:46:42 +00001618#ifdef YYPURE
1619 int yychar;
1620 YYSTYPE yylval;
1621 int yynerrs;
1622#ifdef YYLSP_NEEDED
1623 YYLTYPE yylloc;
1624#endif
1625#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001626
Chris Lattner37e01c52007-01-04 18:46:42 +00001627 YYSTYPE yyval; /* the variable used to return */
1628 /* semantic values from the action */
1629 /* routines */
Reid Spencere7c3c602006-11-30 06:36:44 +00001630
Reid Spencere7c3c602006-11-30 06:36:44 +00001631 int yylen;
1632
Chris Lattner37e01c52007-01-04 18:46:42 +00001633#if YYDEBUG != 0
1634 if (yydebug)
1635 fprintf(stderr, "Starting parse\n");
1636#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001637
1638 yystate = 0;
1639 yyerrstatus = 0;
1640 yynerrs = 0;
1641 yychar = YYEMPTY; /* Cause a token to be read. */
1642
1643 /* Initialize stack pointers.
1644 Waste one element of value and location stack
1645 so that they stay on the same level as the state stack.
1646 The wasted elements are never initialized. */
1647
Chris Lattner37e01c52007-01-04 18:46:42 +00001648 yyssp = yyss - 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00001649 yyvsp = yyvs;
Chris Lattner37e01c52007-01-04 18:46:42 +00001650#ifdef YYLSP_NEEDED
1651 yylsp = yyls;
1652#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001653
Chris Lattner37e01c52007-01-04 18:46:42 +00001654/* Push a new state, which is found in yystate . */
1655/* In all cases, when you get here, the value and location stacks
1656 have just been pushed. so pushing a state here evens the stacks. */
1657yynewstate:
Reid Spencere7c3c602006-11-30 06:36:44 +00001658
Chris Lattner37e01c52007-01-04 18:46:42 +00001659 *++yyssp = yystate;
Reid Spencere7c3c602006-11-30 06:36:44 +00001660
Chris Lattner37e01c52007-01-04 18:46:42 +00001661 if (yyssp >= yyss + yystacksize - 1)
Reid Spencere7c3c602006-11-30 06:36:44 +00001662 {
Chris Lattner37e01c52007-01-04 18:46:42 +00001663 /* Give user a chance to reallocate the stack */
1664 /* Use copies of these so that the &'s don't force the real ones into memory. */
1665 YYSTYPE *yyvs1 = yyvs;
1666 short *yyss1 = yyss;
1667#ifdef YYLSP_NEEDED
1668 YYLTYPE *yyls1 = yyls;
1669#endif
1670
Reid Spencere7c3c602006-11-30 06:36:44 +00001671 /* Get the current used size of the three stacks, in elements. */
Chris Lattner37e01c52007-01-04 18:46:42 +00001672 int size = yyssp - yyss + 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00001673
1674#ifdef yyoverflow
Chris Lattner37e01c52007-01-04 18:46:42 +00001675 /* Each stack pointer address is followed by the size of
1676 the data in use in that stack, in bytes. */
1677#ifdef YYLSP_NEEDED
1678 /* This used to be a conditional around just the two extra args,
1679 but that might be undefined if yyoverflow is a macro. */
1680 yyoverflow("parser stack overflow",
1681 &yyss1, size * sizeof (*yyssp),
1682 &yyvs1, size * sizeof (*yyvsp),
1683 &yyls1, size * sizeof (*yylsp),
1684 &yystacksize);
1685#else
1686 yyoverflow("parser stack overflow",
1687 &yyss1, size * sizeof (*yyssp),
1688 &yyvs1, size * sizeof (*yyvsp),
1689 &yystacksize);
1690#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001691
Chris Lattner37e01c52007-01-04 18:46:42 +00001692 yyss = yyss1; yyvs = yyvs1;
1693#ifdef YYLSP_NEEDED
1694 yyls = yyls1;
1695#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001696#else /* no yyoverflow */
Reid Spencere7c3c602006-11-30 06:36:44 +00001697 /* Extend the stack our own way. */
Chris Lattner37e01c52007-01-04 18:46:42 +00001698 if (yystacksize >= YYMAXDEPTH)
1699 {
1700 yyerror("parser stack overflow");
1701 if (yyfree_stacks)
1702 {
1703 free (yyss);
1704 free (yyvs);
1705#ifdef YYLSP_NEEDED
1706 free (yyls);
1707#endif
1708 }
1709 return 2;
1710 }
Reid Spencere7c3c602006-11-30 06:36:44 +00001711 yystacksize *= 2;
Chris Lattner37e01c52007-01-04 18:46:42 +00001712 if (yystacksize > YYMAXDEPTH)
Reid Spencere7c3c602006-11-30 06:36:44 +00001713 yystacksize = YYMAXDEPTH;
Chris Lattner37e01c52007-01-04 18:46:42 +00001714#ifndef YYSTACK_USE_ALLOCA
1715 yyfree_stacks = 1;
1716#endif
1717 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1718 __yy_memcpy ((char *)yyss, (char *)yyss1,
1719 size * (unsigned int) sizeof (*yyssp));
1720 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1721 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1722 size * (unsigned int) sizeof (*yyvsp));
1723#ifdef YYLSP_NEEDED
1724 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1725 __yy_memcpy ((char *)yyls, (char *)yyls1,
1726 size * (unsigned int) sizeof (*yylsp));
1727#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001728#endif /* no yyoverflow */
1729
Chris Lattner37e01c52007-01-04 18:46:42 +00001730 yyssp = yyss + size - 1;
1731 yyvsp = yyvs + size - 1;
1732#ifdef YYLSP_NEEDED
1733 yylsp = yyls + size - 1;
1734#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001735
Chris Lattner37e01c52007-01-04 18:46:42 +00001736#if YYDEBUG != 0
1737 if (yydebug)
1738 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1739#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001740
Chris Lattner37e01c52007-01-04 18:46:42 +00001741 if (yyssp >= yyss + yystacksize - 1)
Reid Spencere7c3c602006-11-30 06:36:44 +00001742 YYABORT;
1743 }
1744
Chris Lattner37e01c52007-01-04 18:46:42 +00001745#if YYDEBUG != 0
1746 if (yydebug)
1747 fprintf(stderr, "Entering state %d\n", yystate);
1748#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001749
1750 goto yybackup;
Chris Lattner37e01c52007-01-04 18:46:42 +00001751 yybackup:
Reid Spencere7c3c602006-11-30 06:36:44 +00001752
1753/* Do appropriate processing given the current state. */
Chris Lattner37e01c52007-01-04 18:46:42 +00001754/* Read a lookahead token if we need one and don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001755/* yyresume: */
1756
Chris Lattner37e01c52007-01-04 18:46:42 +00001757 /* First try to decide what to do without reference to lookahead token. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001758
1759 yyn = yypact[yystate];
Chris Lattner37e01c52007-01-04 18:46:42 +00001760 if (yyn == YYFLAG)
Reid Spencere7c3c602006-11-30 06:36:44 +00001761 goto yydefault;
1762
Chris Lattner37e01c52007-01-04 18:46:42 +00001763 /* Not known => get a lookahead token if don't already have one. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001764
Chris Lattner37e01c52007-01-04 18:46:42 +00001765 /* yychar is either YYEMPTY or YYEOF
1766 or a valid token in external form. */
1767
Reid Spencere7c3c602006-11-30 06:36:44 +00001768 if (yychar == YYEMPTY)
1769 {
Chris Lattner37e01c52007-01-04 18:46:42 +00001770#if YYDEBUG != 0
1771 if (yydebug)
1772 fprintf(stderr, "Reading a token: ");
1773#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001774 yychar = YYLEX;
1775 }
1776
Chris Lattner37e01c52007-01-04 18:46:42 +00001777 /* Convert token to internal form (in yychar1) for indexing tables with */
1778
1779 if (yychar <= 0) /* This means end of input. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001780 {
Chris Lattner37e01c52007-01-04 18:46:42 +00001781 yychar1 = 0;
1782 yychar = YYEOF; /* Don't call YYLEX any more */
1783
1784#if YYDEBUG != 0
1785 if (yydebug)
1786 fprintf(stderr, "Now at end of input.\n");
1787#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001788 }
1789 else
1790 {
Chris Lattner37e01c52007-01-04 18:46:42 +00001791 yychar1 = YYTRANSLATE(yychar);
1792
1793#if YYDEBUG != 0
1794 if (yydebug)
1795 {
1796 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1797 /* Give the individual parser a way to print the precise meaning
1798 of a token, for further debugging info. */
1799#ifdef YYPRINT
1800 YYPRINT (stderr, yychar, yylval);
1801#endif
1802 fprintf (stderr, ")\n");
1803 }
1804#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001805 }
1806
Chris Lattner37e01c52007-01-04 18:46:42 +00001807 yyn += yychar1;
1808 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
Reid Spencere7c3c602006-11-30 06:36:44 +00001809 goto yydefault;
Chris Lattner37e01c52007-01-04 18:46:42 +00001810
Reid Spencere7c3c602006-11-30 06:36:44 +00001811 yyn = yytable[yyn];
Chris Lattner37e01c52007-01-04 18:46:42 +00001812
1813 /* yyn is what to do for this token type in this state.
1814 Negative => reduce, -yyn is rule number.
1815 Positive => shift, yyn is new state.
1816 New state is final state => don't bother to shift,
1817 just return success.
1818 0, or most negative number => error. */
1819
1820 if (yyn < 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00001821 {
Chris Lattner37e01c52007-01-04 18:46:42 +00001822 if (yyn == YYFLAG)
Reid Spencere7c3c602006-11-30 06:36:44 +00001823 goto yyerrlab;
1824 yyn = -yyn;
1825 goto yyreduce;
1826 }
Chris Lattner37e01c52007-01-04 18:46:42 +00001827 else if (yyn == 0)
1828 goto yyerrlab;
Reid Spencere7c3c602006-11-30 06:36:44 +00001829
1830 if (yyn == YYFINAL)
1831 YYACCEPT;
1832
Chris Lattner37e01c52007-01-04 18:46:42 +00001833 /* Shift the lookahead token. */
1834
1835#if YYDEBUG != 0
1836 if (yydebug)
1837 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1838#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001839
1840 /* Discard the token being shifted unless it is eof. */
1841 if (yychar != YYEOF)
1842 yychar = YYEMPTY;
1843
1844 *++yyvsp = yylval;
Chris Lattner37e01c52007-01-04 18:46:42 +00001845#ifdef YYLSP_NEEDED
1846 *++yylsp = yylloc;
1847#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00001848
Chris Lattner37e01c52007-01-04 18:46:42 +00001849 /* count tokens shifted since error; after three, turn off error status. */
1850 if (yyerrstatus) yyerrstatus--;
Reid Spencere7c3c602006-11-30 06:36:44 +00001851
1852 yystate = yyn;
1853 goto yynewstate;
1854
Chris Lattner37e01c52007-01-04 18:46:42 +00001855/* Do the default action for the current state. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001856yydefault:
Chris Lattner37e01c52007-01-04 18:46:42 +00001857
Reid Spencere7c3c602006-11-30 06:36:44 +00001858 yyn = yydefact[yystate];
1859 if (yyn == 0)
1860 goto yyerrlab;
Reid Spencere7c3c602006-11-30 06:36:44 +00001861
Chris Lattner37e01c52007-01-04 18:46:42 +00001862/* Do a reduction. yyn is the number of a rule to reduce with. */
Reid Spencere7c3c602006-11-30 06:36:44 +00001863yyreduce:
Reid Spencere7c3c602006-11-30 06:36:44 +00001864 yylen = yyr2[yyn];
Chris Lattner37e01c52007-01-04 18:46:42 +00001865 if (yylen > 0)
1866 yyval = yyvsp[1-yylen]; /* implement default value of the action */
Reid Spencere7c3c602006-11-30 06:36:44 +00001867
Chris Lattner37e01c52007-01-04 18:46:42 +00001868#if YYDEBUG != 0
1869 if (yydebug)
Reid Spencere7c3c602006-11-30 06:36:44 +00001870 {
Chris Lattner37e01c52007-01-04 18:46:42 +00001871 int i;
Reid Spencere7c3c602006-11-30 06:36:44 +00001872
Chris Lattner37e01c52007-01-04 18:46:42 +00001873 fprintf (stderr, "Reducing via rule %d (line %d), ",
1874 yyn, yyrline[yyn]);
Reid Spencere7c3c602006-11-30 06:36:44 +00001875
Chris Lattner37e01c52007-01-04 18:46:42 +00001876 /* Print the symbols being reduced, and their result. */
1877 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1878 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1879 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1880 }
1881#endif
Reid Spencere77e35e2006-12-01 20:26:20 +00001882
Reid Spencer16244f42006-12-01 21:10:07 +00001883
Chris Lattner37e01c52007-01-04 18:46:42 +00001884 switch (yyn) {
Reid Spencere7c3c602006-11-30 06:36:44 +00001885
Chris Lattner37e01c52007-01-04 18:46:42 +00001886case 80:
1887#line 491 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1888{
1889 yyval.String = yyvsp[-1].String;
1890 ;
1891 break;}
1892case 81:
1893#line 494 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1894{
1895 yyval.String = new std::string("");
1896 ;
1897 break;}
1898case 89:
1899#line 501 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1900{ yyval.String = new std::string(""); ;
1901 break;}
1902case 96:
1903#line 506 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1904{
1905 *yyvsp[-1].String += *yyvsp[0].String;
1906 delete yyvsp[0].String;
1907 yyval.String = yyvsp[-1].String;
1908 ;
1909 break;}
1910case 97:
1911#line 511 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1912{ yyval.String = new std::string(""); ;
1913 break;}
1914case 98:
1915#line 516 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1916{ yyval.String = new std::string(); ;
1917 break;}
1918case 99:
1919#line 517 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1920{ *yyvsp[-1].String += " " + *yyvsp[0].String; delete yyvsp[0].String; yyval.String = yyvsp[-1].String; ;
1921 break;}
1922case 100:
1923#line 520 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1924{ yyval.String = new std::string(); ;
1925 break;}
1926case 101:
1927#line 521 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1928{
1929 yyvsp[-1].String->insert(0, ", ");
1930 *yyvsp[-1].String += " " + *yyvsp[0].String;
1931 delete yyvsp[0].String;
1932 yyval.String = yyvsp[-1].String;
1933 ;
1934 break;}
1935case 102:
1936#line 529 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1937{
1938 *yyvsp[-1].String += " " + *yyvsp[0].String;
1939 delete yyvsp[0].String;
1940 yyval.String = yyvsp[-1].String;
1941 ;
1942 break;}
1943case 103:
1944#line 535 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1945{ yyval.String = new std::string(); ;
1946 break;}
1947case 105:
1948#line 539 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1949{ yyval.String = new std::string(); ;
1950 break;}
1951case 106:
1952#line 540 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1953{
1954 yyvsp[-1].String->insert(0, ", ");
1955 if (!yyvsp[0].String->empty())
1956 *yyvsp[-1].String += " " + *yyvsp[0].String;
1957 delete yyvsp[0].String;
1958 yyval.String = yyvsp[-1].String;
1959 ;
1960 break;}
1961case 108:
1962#line 550 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1963{
1964 *yyvsp[-1].String += " " + *yyvsp[0].String;
1965 delete yyvsp[0].String;
1966 yyval.String = yyvsp[-1].String;
1967 ;
1968 break;}
1969case 126:
1970#line 572 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1971{
1972 yyval.Type = new TypeInfo(yyvsp[0].String, OpaqueTy);
1973 ;
1974 break;}
1975case 127:
1976#line 575 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1977{
1978 yyval.Type = new TypeInfo(yyvsp[0].String, UnresolvedTy);
1979 ;
1980 break;}
1981case 128:
1982#line 578 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1983{
1984 yyval.Type = yyvsp[0].Type;
1985 ;
1986 break;}
1987case 129:
1988#line 581 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1989{ // Type UpReference
1990 yyvsp[0].String->insert(0, "\\");
1991 yyval.Type = new TypeInfo(yyvsp[0].String, UpRefTy);
1992 ;
1993 break;}
1994case 130:
1995#line 585 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
1996{ // Function derived type?
1997 std::string newTy( yyvsp[-3].Type->getNewTy() + "(");
1998 for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00001999 if (i != 0)
2000 newTy += ", ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002001 if ((*yyvsp[-1].TypeVec)[i]->isVoid())
Reid Spencer52402b02007-01-02 05:45:11 +00002002 newTy += "...";
2003 else
Chris Lattner37e01c52007-01-04 18:46:42 +00002004 newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00002005 }
2006 newTy += ")";
Chris Lattner37e01c52007-01-04 18:46:42 +00002007 yyval.Type = new TypeInfo(new std::string(newTy), yyvsp[-3].Type, yyvsp[-1].TypeVec);
2008 ;
2009 break;}
2010case 131:
2011#line 598 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2012{ // Sized array type?
2013 yyvsp[-3].String->insert(0,"[ ");
2014 *yyvsp[-3].String += " x " + yyvsp[-1].Type->getNewTy() + " ]";
2015 uint64_t elems = atoi(yyvsp[-3].String->c_str());
2016 yyval.Type = new TypeInfo(yyvsp[-3].String, ArrayTy, yyvsp[-1].Type, elems);
2017 ;
2018 break;}
2019case 132:
2020#line 604 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2021{ // Packed array type?
2022 yyvsp[-3].String->insert(0,"< ");
2023 *yyvsp[-3].String += " x " + yyvsp[-1].Type->getNewTy() + " >";
2024 uint64_t elems = atoi(yyvsp[-3].String->c_str());
2025 yyval.Type = new TypeInfo(yyvsp[-3].String, PackedTy, yyvsp[-1].Type, elems);
2026 ;
2027 break;}
2028case 133:
2029#line 610 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2030{ // Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00002031 std::string newTy("{");
Chris Lattner37e01c52007-01-04 18:46:42 +00002032 for (unsigned i = 0; i < yyvsp[-1].TypeVec->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00002033 if (i != 0)
2034 newTy += ", ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002035 newTy += (*yyvsp[-1].TypeVec)[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00002036 }
2037 newTy += "}";
Chris Lattner37e01c52007-01-04 18:46:42 +00002038 yyval.Type = new TypeInfo(new std::string(newTy), StructTy, yyvsp[-1].TypeVec);
2039 ;
2040 break;}
2041case 134:
2042#line 620 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2043{ // Empty structure type?
2044 yyval.Type = new TypeInfo(new std::string("{}"), StructTy, new TypeList());
2045 ;
2046 break;}
2047case 135:
2048#line 623 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2049{ // Packed Structure type?
Reid Spencer52402b02007-01-02 05:45:11 +00002050 std::string newTy("<{");
Chris Lattner37e01c52007-01-04 18:46:42 +00002051 for (unsigned i = 0; i < yyvsp[-2].TypeVec->size(); ++i) {
Reid Spencer52402b02007-01-02 05:45:11 +00002052 if (i != 0)
2053 newTy += ", ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002054 newTy += (*yyvsp[-2].TypeVec)[i]->getNewTy();
Reid Spencer52402b02007-01-02 05:45:11 +00002055 }
2056 newTy += "}>";
Chris Lattner37e01c52007-01-04 18:46:42 +00002057 yyval.Type = new TypeInfo(new std::string(newTy), PackedStructTy, yyvsp[-2].TypeVec);
2058 ;
2059 break;}
2060case 136:
2061#line 633 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2062{ // Empty packed structure type?
2063 yyval.Type = new TypeInfo(new std::string("<{}>"), PackedStructTy, new TypeList());
2064 ;
2065 break;}
2066case 137:
2067#line 636 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2068{ // Pointer type?
2069 yyval.Type = yyvsp[-1].Type->getPointerType();
2070 ;
2071 break;}
2072case 138:
2073#line 644 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2074{
2075 yyval.TypeVec = new TypeList();
2076 yyval.TypeVec->push_back(yyvsp[0].Type);
2077 ;
2078 break;}
2079case 139:
2080#line 648 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2081{
2082 yyval.TypeVec = yyvsp[-2].TypeVec;
2083 yyval.TypeVec->push_back(yyvsp[0].Type);
2084 ;
2085 break;}
2086case 141:
2087#line 656 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2088{
2089 yyval.TypeVec = yyvsp[-2].TypeVec;
2090 yyval.TypeVec->push_back(new TypeInfo("void",VoidTy));
2091 delete yyvsp[0].String;
2092 ;
2093 break;}
2094case 142:
2095#line 661 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2096{
2097 yyval.TypeVec = new TypeList();
2098 yyval.TypeVec->push_back(new TypeInfo("void",VoidTy));
2099 delete yyvsp[0].String;
2100 ;
2101 break;}
2102case 143:
2103#line 666 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2104{
2105 yyval.TypeVec = new TypeList();
2106 ;
2107 break;}
2108case 144:
2109#line 676 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2110{ // Nonempty unsized arr
2111 yyval.Const.type = yyvsp[-3].Type;
2112 yyval.Const.cnst = new std::string(yyvsp[-3].Type->getNewTy());
2113 *yyval.Const.cnst += " [ " + *yyvsp[-1].String + " ]";
2114 delete yyvsp[-1].String;
2115 ;
2116 break;}
2117case 145:
2118#line 682 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2119{
2120 yyval.Const.type = yyvsp[-2].Type;
2121 yyval.Const.cnst = new std::string(yyvsp[-2].Type->getNewTy());
2122 *yyval.Const.cnst += "[ ]";
2123 ;
2124 break;}
2125case 146:
2126#line 687 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2127{
2128 yyval.Const.type = yyvsp[-2].Type;
2129 yyval.Const.cnst = new std::string(yyvsp[-2].Type->getNewTy());
2130 *yyval.Const.cnst += " c" + *yyvsp[0].String;
2131 delete yyvsp[0].String;
2132 ;
2133 break;}
2134case 147:
2135#line 693 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2136{ // Nonempty unsized arr
2137 yyval.Const.type = yyvsp[-3].Type;
2138 yyval.Const.cnst = new std::string(yyvsp[-3].Type->getNewTy());
2139 *yyval.Const.cnst += " < " + *yyvsp[-1].String + " >";
2140 delete yyvsp[-1].String;
2141 ;
2142 break;}
2143case 148:
2144#line 699 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2145{
2146 yyval.Const.type = yyvsp[-3].Type;
2147 yyval.Const.cnst = new std::string(yyvsp[-3].Type->getNewTy());
2148 *yyval.Const.cnst += " { " + *yyvsp[-1].String + " }";
2149 delete yyvsp[-1].String;
2150 ;
2151 break;}
2152case 149:
2153#line 705 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2154{
2155 yyval.Const.type = yyvsp[-2].Type;
2156 yyval.Const.cnst = new std::string(yyvsp[-2].Type->getNewTy());
2157 *yyval.Const.cnst += " {}";
2158 ;
2159 break;}
2160case 150:
2161#line 710 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2162{
2163 yyval.Const.type = yyvsp[-1].Type;
2164 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2165 *yyval.Const.cnst += " " + *yyvsp[0].String;
2166 delete yyvsp[0].String;
2167 ;
2168 break;}
2169case 151:
2170#line 716 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2171{
2172 yyval.Const.type = yyvsp[-1].Type;
2173 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2174 *yyval.Const.cnst += " " + *yyvsp[0].String;
2175 delete yyvsp[0].String;
2176 ;
2177 break;}
2178case 152:
2179#line 722 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2180{
2181 std::string Name = getUniqueName(yyvsp[0].String,yyvsp[-1].Type);
2182 yyval.Const.type = yyvsp[-1].Type;
2183 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2184 *yyval.Const.cnst += " " + Name;
2185 delete yyvsp[0].String;
2186 ;
2187 break;}
2188case 153:
2189#line 729 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2190{
2191 yyval.Const.type = yyvsp[-1].Type;
2192 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2193 *yyval.Const.cnst += " " + *yyvsp[0].String;
2194 delete yyvsp[0].String;
2195 ;
2196 break;}
2197case 154:
2198#line 735 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2199{
2200 yyval.Const.type = yyvsp[-1].Type;
2201 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2202 *yyval.Const.cnst += " " + *yyvsp[0].String;
2203 delete yyvsp[0].String;
2204 ;
2205 break;}
2206case 155:
2207#line 741 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2208{ // integral constants
2209 yyval.Const.type = yyvsp[-1].Type;
2210 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2211 *yyval.Const.cnst += " " + *yyvsp[0].String;
2212 delete yyvsp[0].String;
2213 ;
2214 break;}
2215case 156:
2216#line 747 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2217{ // integral constants
2218 yyval.Const.type = yyvsp[-1].Type;
2219 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2220 *yyval.Const.cnst += " " + *yyvsp[0].String;
2221 delete yyvsp[0].String;
2222 ;
2223 break;}
2224case 157:
2225#line 753 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2226{ // Boolean constants
2227 yyval.Const.type = yyvsp[-1].Type;
2228 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2229 *yyval.Const.cnst += " " + *yyvsp[0].String;
2230 delete yyvsp[0].String;
2231 ;
2232 break;}
2233case 158:
2234#line 759 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2235{ // Boolean constants
2236 yyval.Const.type = yyvsp[-1].Type;
2237 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2238 *yyval.Const.cnst += " " + *yyvsp[0].String;
2239 delete yyvsp[0].String;
2240 ;
2241 break;}
2242case 159:
2243#line 765 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2244{ // Float & Double constants
2245 yyval.Const.type = yyvsp[-1].Type;
2246 yyval.Const.cnst = new std::string(yyvsp[-1].Type->getNewTy());
2247 *yyval.Const.cnst += " " + *yyvsp[0].String;
2248 delete yyvsp[0].String;
2249 ;
2250 break;}
2251case 160:
2252#line 773 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2253{
2254 std::string source = *yyvsp[-3].Const.cnst;
2255 TypeInfo* DstTy = ResolveType(yyvsp[-1].Type);
2256 if (*yyvsp[-5].String == "cast") {
Reid Spencera50d5962006-12-02 04:11:07 +00002257 // Call getCastUpgrade to upgrade the old cast
Chris Lattner37e01c52007-01-04 18:46:42 +00002258 yyval.String = new std::string(getCastUpgrade(source, yyvsp[-3].Const.type, DstTy, true));
Reid Spencera50d5962006-12-02 04:11:07 +00002259 } else {
2260 // Nothing to upgrade, just create the cast constant expr
Chris Lattner37e01c52007-01-04 18:46:42 +00002261 yyval.String = new std::string(*yyvsp[-5].String);
2262 *yyval.String += "( " + source + " to " + yyvsp[-1].Type->getNewTy() + ")";
Reid Spencer280d8012006-12-01 23:40:53 +00002263 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002264 delete yyvsp[-5].String; yyvsp[-3].Const.destroy(); delete yyvsp[-2].String;
2265 ;
2266 break;}
2267case 161:
2268#line 786 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2269{
2270 *yyvsp[-4].String += "(" + *yyvsp[-2].Const.cnst;
2271 for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
2272 ValueInfo& VI = (*yyvsp[-1].ValList)[i];
2273 *yyvsp[-4].String += ", " + *VI.val;
Reid Spencerf8483652006-12-02 15:16:01 +00002274 VI.destroy();
2275 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002276 *yyvsp[-4].String += ")";
2277 yyval.String = yyvsp[-4].String;
2278 yyvsp[-2].Const.destroy();
2279 delete yyvsp[-1].ValList;
2280 ;
2281 break;}
2282case 162:
2283#line 798 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2284{
2285 *yyvsp[-7].String += "(" + *yyvsp[-5].Const.cnst + "," + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2286 yyvsp[-5].Const.destroy(); yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2287 yyval.String = yyvsp[-7].String;
2288 ;
2289 break;}
2290case 163:
2291#line 803 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2292{
2293 const char* op = getDivRemOpcode(*yyvsp[-5].String, yyvsp[-3].Const.type);
2294 yyval.String = new std::string(op);
2295 *yyval.String += "(" + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2296 delete yyvsp[-5].String; yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2297 ;
2298 break;}
2299case 164:
2300#line 809 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2301{
2302 *yyvsp[-5].String += "(" + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2303 yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2304 yyval.String = yyvsp[-5].String;
2305 ;
2306 break;}
2307case 165:
2308#line 814 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2309{
2310 *yyvsp[-5].String = getCompareOp(*yyvsp[-5].String, yyvsp[-3].Const.type);
2311 *yyvsp[-5].String += "(" + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2312 yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2313 yyval.String = yyvsp[-5].String;
2314 ;
2315 break;}
2316case 166:
2317#line 820 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2318{
2319 *yyvsp[-6].String += "(" + *yyvsp[-5].String + "," + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2320 delete yyvsp[-5].String; yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2321 yyval.String = yyvsp[-6].String;
2322 ;
2323 break;}
2324case 167:
2325#line 825 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2326{
2327 *yyvsp[-6].String += "(" + *yyvsp[-5].String + "," + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2328 delete yyvsp[-5].String; yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2329 yyval.String = yyvsp[-6].String;
2330 ;
2331 break;}
2332case 168:
2333#line 830 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2334{
2335 const char* shiftop = yyvsp[-5].String->c_str();
2336 if (*yyvsp[-5].String == "shr")
2337 shiftop = (yyvsp[-3].Const.type->isUnsigned()) ? "lshr" : "ashr";
2338 yyval.String = new std::string(shiftop);
2339 *yyval.String += "(" + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2340 delete yyvsp[-5].String; yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2341 ;
2342 break;}
2343case 169:
2344#line 838 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2345{
2346 *yyvsp[-5].String += "(" + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2347 yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2348 yyval.String = yyvsp[-5].String;
2349 ;
2350 break;}
2351case 170:
2352#line 843 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2353{
2354 *yyvsp[-7].String += "(" + *yyvsp[-5].Const.cnst + "," + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2355 yyvsp[-5].Const.destroy(); yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2356 yyval.String = yyvsp[-7].String;
2357 ;
2358 break;}
2359case 171:
2360#line 848 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2361{
2362 *yyvsp[-7].String += "(" + *yyvsp[-5].Const.cnst + "," + *yyvsp[-3].Const.cnst + "," + *yyvsp[-1].Const.cnst + ")";
2363 yyvsp[-5].Const.destroy(); yyvsp[-3].Const.destroy(); yyvsp[-1].Const.destroy();
2364 yyval.String = yyvsp[-7].String;
2365 ;
2366 break;}
2367case 172:
2368#line 858 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2369{
2370 *yyvsp[-2].String += ", " + *yyvsp[0].Const.cnst;
2371 yyvsp[0].Const.destroy();
2372 yyval.String = yyvsp[-2].String;
2373 ;
2374 break;}
2375case 173:
2376#line 863 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2377{ yyval.String = new std::string(*yyvsp[0].Const.cnst); yyvsp[0].Const.destroy(); ;
2378 break;}
2379case 176:
2380#line 878 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2381{
2382;
2383 break;}
2384case 177:
2385#line 883 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2386{
2387 yyval.String = 0;
2388 ;
2389 break;}
2390case 178:
2391#line 886 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2392{
2393 *O << *yyvsp[0].String << '\n';
2394 delete yyvsp[0].String;
2395 yyval.String = 0;
2396 ;
2397 break;}
2398case 179:
2399#line 891 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2400{
2401 *O << "module asm " << ' ' << *yyvsp[0].String << '\n';
2402 yyval.String = 0;
2403 ;
2404 break;}
2405case 180:
2406#line 895 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2407{
Reid Spencerd154b572006-12-01 20:36:40 +00002408 *O << "implementation\n";
Chris Lattner37e01c52007-01-04 18:46:42 +00002409 yyval.String = 0;
2410 ;
2411 break;}
2412case 181:
2413#line 899 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2414{ yyval.String = 0; ;
2415 break;}
2416case 183:
2417#line 901 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2418{ yyval.String = yyvsp[0].String; *yyval.String = "external"; ;
2419 break;}
2420case 184:
2421#line 904 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2422{
2423 EnumeratedTypes.push_back(*yyvsp[0].Type);
2424 if (!yyvsp[-2].String->empty()) {
2425 NamedTypes[*yyvsp[-2].String] = *yyvsp[0].Type;
2426 *O << *yyvsp[-2].String << " = ";
Reid Spencera50d5962006-12-02 04:11:07 +00002427 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002428 *O << "type " << yyvsp[0].Type->getNewTy() << '\n';
2429 delete yyvsp[-2].String; delete yyvsp[-1].String;
2430 yyval.String = 0;
2431 ;
2432 break;}
2433case 185:
2434#line 914 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2435{ // Function prototypes can be in const pool
2436 *O << *yyvsp[0].String << '\n';
2437 delete yyvsp[0].String;
2438 yyval.String = 0;
2439 ;
2440 break;}
2441case 186:
2442#line 919 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2443{ // Asm blocks can be in the const pool
2444 *O << *yyvsp[-2].String << ' ' << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
2445 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
2446 yyval.String = 0;
2447 ;
2448 break;}
2449case 187:
2450#line 924 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2451{
2452 if (!yyvsp[-4].String->empty()) {
2453 std::string Name = getUniqueName(yyvsp[-4].String,yyvsp[-1].Const.type);
Reid Spencer52402b02007-01-02 05:45:11 +00002454 *O << Name << " = ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002455 Globals[Name] = *yyvsp[-1].Const.type;
Reid Spencerf12ee422006-12-05 19:21:25 +00002456 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002457 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << *yyvsp[-1].Const.cnst << ' ' << *yyvsp[0].String << '\n';
2458 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
2459 yyval.String = 0;
2460 ;
2461 break;}
2462case 188:
2463#line 934 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2464{
2465 if (!yyvsp[-4].String->empty()) {
2466 std::string Name = getUniqueName(yyvsp[-4].String,yyvsp[-1].Type);
Reid Spencer52402b02007-01-02 05:45:11 +00002467 *O << Name << " = ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002468 Globals[Name] = *yyvsp[-1].Type;
Reid Spencerf12ee422006-12-05 19:21:25 +00002469 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002470 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Type->getNewTy() << ' ' << *yyvsp[0].String << '\n';
2471 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
2472 yyval.String = 0;
2473 ;
2474 break;}
2475case 189:
2476#line 944 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2477{
2478 if (!yyvsp[-4].String->empty()) {
2479 std::string Name = getUniqueName(yyvsp[-4].String,yyvsp[-1].Type);
Reid Spencer52402b02007-01-02 05:45:11 +00002480 *O << Name << " = ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002481 Globals[Name] = *yyvsp[-1].Type;
Reid Spencer6fd36ab2006-12-29 20:35:03 +00002482 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002483 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Type->getNewTy() << ' ' << *yyvsp[0].String << '\n';
2484 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
2485 yyval.String = 0;
2486 ;
2487 break;}
2488case 190:
2489#line 954 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2490{
2491 if (!yyvsp[-4].String->empty()) {
2492 std::string Name = getUniqueName(yyvsp[-4].String,yyvsp[-1].Type);
Reid Spencer52402b02007-01-02 05:45:11 +00002493 *O << Name << " = ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002494 Globals[Name] = *yyvsp[-1].Type;
Reid Spencerf5626a32007-01-01 01:20:41 +00002495 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002496 *O << *yyvsp[-3].String << ' ' << *yyvsp[-2].String << ' ' << yyvsp[-1].Type->getNewTy() << ' ' << *yyvsp[0].String << '\n';
2497 delete yyvsp[-4].String; delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
2498 yyval.String = 0;
2499 ;
2500 break;}
2501case 191:
2502#line 964 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2503{
2504 *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
2505 delete yyvsp[-1].String; delete yyvsp[0].String;
2506 yyval.String = 0;
2507 ;
2508 break;}
2509case 192:
2510#line 969 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2511{
2512 *O << *yyvsp[-2].String << " = " << *yyvsp[0].String << '\n';
2513 delete yyvsp[-2].String; delete yyvsp[0].String;
2514 yyval.String = 0;
2515 ;
2516 break;}
2517case 193:
2518#line 974 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2519{
2520 yyval.String = 0;
2521 ;
2522 break;}
2523case 197:
2524#line 984 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2525{
2526 *yyvsp[-2].String += " = " + *yyvsp[0].String;
2527 delete yyvsp[0].String;
2528 yyval.String = yyvsp[-2].String;
2529 ;
2530 break;}
2531case 198:
2532#line 989 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2533{
2534 *yyvsp[-2].String += " = " + *yyvsp[0].String;
2535 if (*yyvsp[0].String == "64")
Reid Spencere77e35e2006-12-01 20:26:20 +00002536 SizeOfPointer = 64;
Chris Lattner37e01c52007-01-04 18:46:42 +00002537 delete yyvsp[0].String;
2538 yyval.String = yyvsp[-2].String;
2539 ;
2540 break;}
2541case 199:
2542#line 996 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2543{
2544 *yyvsp[-2].String += " = " + *yyvsp[0].String;
2545 delete yyvsp[0].String;
2546 yyval.String = yyvsp[-2].String;
2547 ;
2548 break;}
2549case 200:
2550#line 1001 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2551{
2552 *yyvsp[-2].String += " = " + *yyvsp[0].String;
2553 delete yyvsp[0].String;
2554 yyval.String = yyvsp[-2].String;
2555 ;
2556 break;}
2557case 201:
2558#line 1008 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2559{
2560 yyvsp[-1].String->insert(0, "[ ");
2561 *yyvsp[-1].String += " ]";
2562 yyval.String = yyvsp[-1].String;
2563 ;
2564 break;}
2565case 202:
2566#line 1015 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2567{
2568 *yyvsp[-2].String += ", " + *yyvsp[0].String;
2569 delete yyvsp[0].String;
2570 yyval.String = yyvsp[-2].String;
2571 ;
2572 break;}
2573case 204:
2574#line 1021 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2575{
2576 yyval.String = new std::string();
2577 ;
2578 break;}
2579case 208:
2580#line 1030 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2581{ yyval.String = new std::string(); ;
2582 break;}
2583case 209:
2584#line 1032 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2585{
2586 yyval.String = new std::string(yyvsp[-1].Type->getNewTy());
2587 if (!yyvsp[0].String->empty()) {
2588 std::string Name = getUniqueName(yyvsp[0].String, yyvsp[-1].Type);
2589 *yyval.String += " " + Name;
Reid Spencer52402b02007-01-02 05:45:11 +00002590 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002591 delete yyvsp[0].String;
2592;
2593 break;}
2594case 210:
2595#line 1041 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2596{
2597 *yyvsp[-2].String += ", " + *yyvsp[0].String;
2598 delete yyvsp[0].String;
2599 ;
2600 break;}
2601case 211:
2602#line 1045 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2603{
2604 yyval.String = yyvsp[0].String;
2605 ;
2606 break;}
2607case 212:
2608#line 1049 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2609{
2610 yyval.String = yyvsp[0].String;
2611 ;
2612 break;}
2613case 213:
2614#line 1052 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2615{
2616 *yyvsp[-2].String += ", ...";
2617 yyval.String = yyvsp[-2].String;
2618 delete yyvsp[0].String;
2619 ;
2620 break;}
2621case 214:
2622#line 1057 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2623{
2624 yyval.String = yyvsp[0].String;
2625 ;
2626 break;}
2627case 215:
2628#line 1060 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2629{ yyval.String = new std::string(); ;
2630 break;}
2631case 216:
2632#line 1063 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2633{
2634 if (!yyvsp[-7].String->empty()) {
2635 *yyvsp[-7].String += " ";
Reid Spencere77e35e2006-12-01 20:26:20 +00002636 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002637 *yyvsp[-7].String += yyvsp[-6].Type->getNewTy() + " " + *yyvsp[-5].String + "(" + *yyvsp[-3].String + ")";
2638 if (!yyvsp[-1].String->empty()) {
2639 *yyvsp[-7].String += " " + *yyvsp[-1].String;
Reid Spencere77e35e2006-12-01 20:26:20 +00002640 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002641 if (!yyvsp[0].String->empty()) {
2642 *yyvsp[-7].String += " " + *yyvsp[0].String;
Reid Spencere77e35e2006-12-01 20:26:20 +00002643 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002644 delete yyvsp[-5].String;
2645 delete yyvsp[-3].String;
2646 delete yyvsp[-1].String;
2647 delete yyvsp[0].String;
2648 yyval.String = yyvsp[-7].String;
2649 ;
2650 break;}
2651case 217:
2652#line 1081 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2653{ yyval.String = new std::string("{"); delete yyvsp[0].String; ;
2654 break;}
2655case 218:
2656#line 1082 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2657{ yyval.String = new std::string ("{"); ;
2658 break;}
2659case 219:
2660#line 1085 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2661{
Reid Spencer6fd36ab2006-12-29 20:35:03 +00002662 *O << "define ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002663 if (!yyvsp[-2].String->empty()) {
2664 *O << *yyvsp[-2].String << ' ';
Reid Spencer6fd36ab2006-12-29 20:35:03 +00002665 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002666 *O << *yyvsp[-1].String << ' ' << *yyvsp[0].String << '\n';
2667 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
2668 yyval.String = 0;
2669 ;
2670 break;}
2671case 220:
2672#line 1096 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2673{ yyval.String = new std::string("}"); delete yyvsp[0].String; ;
2674 break;}
2675case 221:
2676#line 1097 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2677{ yyval.String = new std::string("}"); ;
2678 break;}
2679case 222:
2680#line 1099 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2681{
2682 if (yyvsp[-1].String)
2683 *O << *yyvsp[-1].String;
2684 *O << *yyvsp[0].String << "\n\n";
2685 delete yyvsp[-2].String; delete yyvsp[-1].String; delete yyvsp[0].String;
2686 yyval.String = 0;
2687;
2688 break;}
2689case 223:
2690#line 1108 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2691{ yyval.String = new std::string(); ;
2692 break;}
2693case 226:
2694#line 1114 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2695{
2696 if (!yyvsp[-1].String->empty())
2697 *yyvsp[-2].String += " " + *yyvsp[-1].String;
2698 *yyvsp[-2].String += " " + *yyvsp[0].String;
2699 delete yyvsp[-1].String;
2700 delete yyvsp[0].String;
2701 yyval.String = yyvsp[-2].String;
2702 ;
2703 break;}
2704case 227:
2705#line 1127 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2706{ yyval.String = new std::string(); ;
2707 break;}
2708case 237:
2709#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2710{
2711 yyvsp[-1].String->insert(0, "<");
2712 *yyvsp[-1].String += ">";
2713 yyval.String = yyvsp[-1].String;
2714 ;
2715 break;}
2716case 239:
2717#line 1139 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2718{
2719 if (!yyvsp[-3].String->empty()) {
2720 *yyvsp[-4].String += " " + *yyvsp[-3].String;
Reid Spencere77e35e2006-12-01 20:26:20 +00002721 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002722 *yyvsp[-4].String += " " + *yyvsp[-2].String + ", " + *yyvsp[0].String;
2723 delete yyvsp[-3].String; delete yyvsp[-2].String; delete yyvsp[0].String;
2724 yyval.String = yyvsp[-4].String;
2725 ;
2726 break;}
2727case 242:
2728#line 1152 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2729{
2730 yyval.Value.val = yyvsp[0].String;
2731 yyval.Value.constant = false;
2732 yyval.Value.type = new TypeInfo();
2733 ;
2734 break;}
2735case 243:
2736#line 1157 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2737{
2738 yyval.Value.val = yyvsp[0].String;
2739 yyval.Value.constant = true;
2740 yyval.Value.type = new TypeInfo();
2741 ;
2742 break;}
2743case 244:
2744#line 1167 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2745{
2746 ResolveType(yyvsp[-1].Type);
2747 std::string Name = getUniqueName(yyvsp[0].Value.val, yyvsp[-1].Type);
2748 yyval.Value = yyvsp[0].Value;
2749 delete yyval.Value.val;
2750 delete yyval.Value.type;
2751 yyval.Value.val = new std::string(yyvsp[-1].Type->getNewTy() + " " + Name);
2752 yyval.Value.type = yyvsp[-1].Type;
2753 ;
2754 break;}
2755case 245:
2756#line 1177 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2757{
2758 yyval.String = 0;
2759 ;
2760 break;}
2761case 246:
2762#line 1180 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2763{ // Do not allow functions with 0 basic blocks
2764 yyval.String = 0;
2765 ;
2766 break;}
2767case 247:
2768#line 1188 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2769{
2770 yyval.String = 0;
2771 ;
2772 break;}
2773case 248:
2774#line 1192 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2775{
2776 *O << " " << *yyvsp[0].String << '\n';
2777 delete yyvsp[0].String;
2778 yyval.String = 0;
2779 ;
2780 break;}
2781case 249:
2782#line 1197 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2783{
2784 yyval.String = 0;
2785 ;
2786 break;}
2787case 250:
2788#line 1200 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2789{
2790 *O << *yyvsp[0].String << '\n';
2791 delete yyvsp[0].String;
2792 yyval.String = 0;
2793 ;
2794 break;}
2795case 252:
2796#line 1206 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2797{ yyval.String = yyvsp[0].String; *yyval.String = "unwind"; ;
2798 break;}
2799case 253:
2800#line 1208 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2801{ // Return with a result...
2802 *O << " " << *yyvsp[-1].String << ' ' << *yyvsp[0].Value.val << '\n';
2803 delete yyvsp[-1].String; yyvsp[0].Value.destroy();
2804 yyval.String = 0;
2805 ;
2806 break;}
2807case 254:
2808#line 1213 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2809{ // Return with no result...
2810 *O << " " << *yyvsp[-1].String << ' ' << yyvsp[0].Type->getNewTy() << '\n';
2811 delete yyvsp[-1].String; delete yyvsp[0].Type;
2812 yyval.String = 0;
2813 ;
2814 break;}
2815case 255:
2816#line 1218 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2817{ // Unconditional Branch...
2818 *O << " " << *yyvsp[-2].String << ' ' << yyvsp[-1].Type->getNewTy() << ' ' << *yyvsp[0].Value.val << '\n';
2819 delete yyvsp[-2].String; delete yyvsp[-1].Type; yyvsp[0].Value.destroy();
2820 yyval.String = 0;
2821 ;
2822 break;}
2823case 256:
2824#line 1223 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2825{
2826 std::string Name = getUniqueName(yyvsp[-6].Value.val, yyvsp[-7].Type);
2827 *O << " " << *yyvsp[-8].String << ' ' << yyvsp[-7].Type->getNewTy() << ' ' << Name << ", "
2828 << yyvsp[-4].Type->getNewTy() << ' ' << *yyvsp[-3].Value.val << ", " << yyvsp[-1].Type->getNewTy() << ' '
2829 << *yyvsp[0].Value.val << '\n';
2830 delete yyvsp[-8].String; delete yyvsp[-7].Type; yyvsp[-6].Value.destroy(); delete yyvsp[-4].Type; yyvsp[-3].Value.destroy();
2831 delete yyvsp[-1].Type; yyvsp[0].Value.destroy();
2832 yyval.String = 0;
2833 ;
2834 break;}
2835case 257:
2836#line 1232 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2837{
2838 std::string Name = getUniqueName(yyvsp[-6].Value.val, yyvsp[-7].Type);
2839 *O << " " << *yyvsp[-8].String << ' ' << yyvsp[-7].Type->getNewTy() << ' ' << Name << ", "
2840 << yyvsp[-4].Type->getNewTy() << ' ' << *yyvsp[-3].Value.val << " [" << *yyvsp[-1].String << " ]\n";
2841 delete yyvsp[-8].String; delete yyvsp[-7].Type; yyvsp[-6].Value.destroy(); delete yyvsp[-4].Type; yyvsp[-3].Value.destroy();
2842 delete yyvsp[-1].String;
2843 yyval.String = 0;
2844 ;
2845 break;}
2846case 258:
2847#line 1240 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2848{
2849 std::string Name = getUniqueName(yyvsp[-5].Value.val, yyvsp[-6].Type);
2850 *O << " " << *yyvsp[-7].String << ' ' << yyvsp[-6].Type->getNewTy() << ' ' << Name << ", "
2851 << yyvsp[-3].Type->getNewTy() << ' ' << *yyvsp[-2].Value.val << "[]\n";
2852 delete yyvsp[-7].String; delete yyvsp[-6].Type; yyvsp[-5].Value.destroy(); delete yyvsp[-3].Type; yyvsp[-2].Value.destroy();
2853 yyval.String = 0;
2854 ;
2855 break;}
2856case 259:
2857#line 1248 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2858{
2859 TypeInfo* ResTy = getFunctionReturnType(yyvsp[-10].Type);
Reid Spencer16244f42006-12-01 21:10:07 +00002860 *O << " ";
Chris Lattner37e01c52007-01-04 18:46:42 +00002861 if (!yyvsp[-13].String->empty()) {
2862 std::string Name = getUniqueName(yyvsp[-13].String, ResTy);
Reid Spencer52402b02007-01-02 05:45:11 +00002863 *O << Name << " = ";
2864 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002865 *O << *yyvsp[-12].String << ' ' << *yyvsp[-11].String << ' ' << yyvsp[-10].Type->getNewTy() << ' ' << *yyvsp[-9].Value.val << " (";
2866 for (unsigned i = 0; i < yyvsp[-7].ValList->size(); ++i) {
2867 ValueInfo& VI = (*yyvsp[-7].ValList)[i];
Reid Spencerf8483652006-12-02 15:16:01 +00002868 *O << *VI.val;
Chris Lattner37e01c52007-01-04 18:46:42 +00002869 if (i+1 < yyvsp[-7].ValList->size())
Reid Spencerf8483652006-12-02 15:16:01 +00002870 *O << ", ";
2871 VI.destroy();
2872 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002873 *O << ") " << *yyvsp[-5].String << ' ' << yyvsp[-4].Type->getNewTy() << ' ' << *yyvsp[-3].Value.val << ' '
2874 << *yyvsp[-2].String << ' ' << yyvsp[-1].Type->getNewTy() << ' ' << *yyvsp[0].Value.val << '\n';
2875 delete yyvsp[-13].String; delete yyvsp[-12].String; delete yyvsp[-11].String; delete yyvsp[-10].Type; yyvsp[-9].Value.destroy(); delete yyvsp[-7].ValList;
2876 delete yyvsp[-5].String; delete yyvsp[-4].Type; yyvsp[-3].Value.destroy(); delete yyvsp[-2].String; delete yyvsp[-1].Type;
2877 yyvsp[0].Value.destroy();
2878 yyval.String = 0;
2879 ;
2880 break;}
2881case 260:
2882#line 1270 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2883{
2884 *O << " " << *yyvsp[0].String << '\n';
2885 delete yyvsp[0].String;
2886 yyval.String = 0;
2887 ;
2888 break;}
2889case 261:
2890#line 1275 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2891{
2892 *O << " " << *yyvsp[0].String << '\n';
2893 delete yyvsp[0].String;
2894 yyval.String = 0;
2895 ;
2896 break;}
2897case 262:
2898#line 1281 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2899{
2900 *yyvsp[-5].String += " " + yyvsp[-4].Type->getNewTy() + " " + *yyvsp[-3].String + ", " + yyvsp[-1].Type->getNewTy() + " " +
2901 *yyvsp[0].Value.val;
2902 delete yyvsp[-4].Type; delete yyvsp[-3].String; delete yyvsp[-1].Type; yyvsp[0].Value.destroy();
2903 yyval.String = yyvsp[-5].String;
2904 ;
2905 break;}
2906case 263:
2907#line 1287 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2908{
2909 yyvsp[-3].String->insert(0, yyvsp[-4].Type->getNewTy() + " " );
2910 *yyvsp[-3].String += ", " + yyvsp[-1].Type->getNewTy() + " " + *yyvsp[0].Value.val;
2911 delete yyvsp[-4].Type; delete yyvsp[-1].Type; yyvsp[0].Value.destroy();
2912 yyval.String = yyvsp[-3].String;
2913 ;
2914 break;}
2915case 264:
2916#line 1295 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2917{
2918 if (!yyvsp[-1].String->empty()) {
2919 if (deleteUselessCastFlag && *deleteUselessCastName == *yyvsp[-1].String) {
2920 *yyvsp[-1].String += " = ";
2921 yyvsp[-1].String->insert(0, "; "); // don't actually delete it, just comment it out
Reid Spencerf5626a32007-01-01 01:20:41 +00002922 delete deleteUselessCastName;
2923 } else {
Reid Spencer52402b02007-01-02 05:45:11 +00002924 // Get a unique name for the name of this value, based on its type.
Chris Lattner37e01c52007-01-04 18:46:42 +00002925 *yyvsp[-1].String = getUniqueName(yyvsp[-1].String, yyvsp[0].Value.type) + " = ";
Reid Spencerf5626a32007-01-01 01:20:41 +00002926 }
2927 }
Chris Lattner37e01c52007-01-04 18:46:42 +00002928 *yyvsp[-1].String += *yyvsp[0].Value.val;
2929 yyvsp[0].Value.destroy();
Reid Spencerf5626a32007-01-01 01:20:41 +00002930 deleteUselessCastFlag = false;
Chris Lattner37e01c52007-01-04 18:46:42 +00002931 yyval.String = yyvsp[-1].String;
2932 ;
2933 break;}
2934case 265:
2935#line 1313 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2936{ // Used for PHI nodes
2937 std::string Name = getUniqueName(yyvsp[-3].Value.val, yyvsp[-5].Type);
2938 Name.insert(0, yyvsp[-5].Type->getNewTy() + "[");
2939 Name += "," + *yyvsp[-1].Value.val + "]";
2940 yyval.Value.val = new std::string(Name);
2941 yyval.Value.type = yyvsp[-5].Type;
2942 yyvsp[-3].Value.destroy(); yyvsp[-1].Value.destroy();
2943 ;
2944 break;}
2945case 266:
2946#line 1321 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2947{
2948 std::string Name = getUniqueName(yyvsp[-3].Value.val, yyvsp[-6].Value.type);
2949 *yyvsp[-6].Value.val += ", [" + Name + "," + *yyvsp[-1].Value.val + "]";
2950 yyvsp[-3].Value.destroy(); yyvsp[-1].Value.destroy();
2951 yyval.Value = yyvsp[-6].Value;
2952 ;
2953 break;}
2954case 267:
2955#line 1330 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2956{
2957 yyval.ValList = new ValueList();
2958 yyval.ValList->push_back(yyvsp[0].Value);
2959 ;
2960 break;}
2961case 268:
2962#line 1334 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2963{
2964 yyval.ValList = yyvsp[-2].ValList;
2965 yyval.ValList->push_back(yyvsp[0].Value);
2966 ;
2967 break;}
2968case 269:
2969#line 1341 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2970{ yyval.ValList = yyvsp[0].ValList; ;
2971 break;}
2972case 270:
2973#line 1342 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2974{ yyval.ValList = new ValueList(); ;
2975 break;}
2976case 271:
2977#line 1346 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2978{
2979 *yyvsp[-1].String += " " + *yyvsp[0].String;
2980 delete yyvsp[0].String;
2981 yyval.String = yyvsp[-1].String;
2982 ;
2983 break;}
2984case 273:
2985#line 1354 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2986{
2987 const char* op = getDivRemOpcode(*yyvsp[-4].String, yyvsp[-3].Type);
2988 std::string Name1 = getUniqueName(yyvsp[-2].Value.val, yyvsp[-3].Type);
2989 std::string Name2 = getUniqueName(yyvsp[0].Value.val, yyvsp[-3].Type);
2990 yyval.Value.val = new std::string(op);
2991 *yyval.Value.val += " " + yyvsp[-3].Type->getNewTy() + " " + Name1 + ", " + Name2;
2992 yyval.Value.type = yyvsp[-3].Type;
2993 delete yyvsp[-4].String; yyvsp[-2].Value.destroy(); yyvsp[0].Value.destroy();
2994 ;
2995 break;}
2996case 274:
2997#line 1363 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
2998{
2999 std::string Name1 = getUniqueName(yyvsp[-2].Value.val, yyvsp[-3].Type);
3000 std::string Name2 = getUniqueName(yyvsp[0].Value.val, yyvsp[-3].Type);
3001 *yyvsp[-4].String += " " + yyvsp[-3].Type->getNewTy() + " " + Name1 + ", " + Name2;
3002 yyval.Value.val = yyvsp[-4].String;
3003 yyval.Value.type = yyvsp[-3].Type;
3004 yyvsp[-2].Value.destroy(); yyvsp[0].Value.destroy();
3005 ;
3006 break;}
3007case 275:
3008#line 1371 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3009{
3010 std::string Name1 = getUniqueName(yyvsp[-2].Value.val, yyvsp[-3].Type);
3011 std::string Name2 = getUniqueName(yyvsp[0].Value.val, yyvsp[-3].Type);
3012 *yyvsp[-4].String = getCompareOp(*yyvsp[-4].String, yyvsp[-3].Type);
3013 *yyvsp[-4].String += " " + yyvsp[-3].Type->getNewTy() + " " + Name1 + ", " + Name2;
3014 yyval.Value.val = yyvsp[-4].String;
3015 yyval.Value.type = new TypeInfo("bool",BoolTy);
3016 yyvsp[-2].Value.destroy(); yyvsp[0].Value.destroy();
3017 ;
3018 break;}
3019case 276:
3020#line 1380 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3021{
3022 std::string Name1 = getUniqueName(yyvsp[-2].Value.val, yyvsp[-3].Type);
3023 std::string Name2 = getUniqueName(yyvsp[0].Value.val, yyvsp[-3].Type);
3024 *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Type->getNewTy() + " " + Name1 + "," + Name2;
3025 yyval.Value.val = yyvsp[-5].String;
3026 yyval.Value.type = new TypeInfo("bool",BoolTy);
3027 delete yyvsp[-4].String; yyvsp[-2].Value.destroy(); yyvsp[0].Value.destroy();
3028 ;
3029 break;}
3030case 277:
3031#line 1388 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3032{
3033 std::string Name1 = getUniqueName(yyvsp[-2].Value.val, yyvsp[-3].Type);
3034 std::string Name2 = getUniqueName(yyvsp[0].Value.val, yyvsp[-3].Type);
3035 *yyvsp[-5].String += " " + *yyvsp[-4].String + " " + yyvsp[-3].Type->getNewTy() + " " + Name1 + "," + Name2;
3036 yyval.Value.val = yyvsp[-5].String;
3037 yyval.Value.type = new TypeInfo("bool",BoolTy);
3038 delete yyvsp[-4].String; yyvsp[-2].Value.destroy(); yyvsp[0].Value.destroy();
3039 ;
3040 break;}
3041case 278:
3042#line 1396 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3043{
3044 yyval.Value = yyvsp[0].Value;
3045 yyval.Value.val->insert(0, *yyvsp[-1].String + " ");
3046 delete yyvsp[-1].String;
3047 ;
3048 break;}
3049case 279:
3050#line 1401 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3051{
3052 const char* shiftop = yyvsp[-3].String->c_str();
3053 if (*yyvsp[-3].String == "shr")
3054 shiftop = (yyvsp[-2].Value.type->isUnsigned()) ? "lshr" : "ashr";
3055 yyval.Value.val = new std::string(shiftop);
3056 *yyval.Value.val += " " + *yyvsp[-2].Value.val + ", " + *yyvsp[0].Value.val;
3057 yyval.Value.type = yyvsp[-2].Value.type;
3058 delete yyvsp[-3].String; delete yyvsp[-2].Value.val; yyvsp[0].Value.destroy();
3059 ;
3060 break;}
3061case 280:
3062#line 1410 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3063{
3064 std::string source = *yyvsp[-2].Value.val;
3065 TypeInfo* SrcTy = yyvsp[-2].Value.type;
3066 TypeInfo* DstTy = ResolveType(yyvsp[0].Type);
3067 yyval.Value.val = new std::string();
3068 if (*yyvsp[-3].String == "cast") {
3069 *yyval.Value.val += getCastUpgrade(source, SrcTy, DstTy, false);
Reid Spencera50d5962006-12-02 04:11:07 +00003070 } else {
Chris Lattner37e01c52007-01-04 18:46:42 +00003071 *yyval.Value.val += *yyvsp[-3].String + " " + source + " to " + DstTy->getNewTy();
Reid Spencer280d8012006-12-01 23:40:53 +00003072 }
Chris Lattner37e01c52007-01-04 18:46:42 +00003073 yyval.Value.type = yyvsp[0].Type;
Reid Spencerf5626a32007-01-01 01:20:41 +00003074 // Check to see if this is a useless cast of a value to the same name
3075 // and the same type. Such casts will probably cause redefinition errors
3076 // when assembled and perform no code gen action so just remove them.
Chris Lattner37e01c52007-01-04 18:46:42 +00003077 if (*yyvsp[-3].String == "cast" || *yyvsp[-3].String == "bitcast")
3078 if (yyvsp[-2].Value.type->isInteger() && DstTy->isInteger() &&
3079 yyvsp[-2].Value.type->getBitWidth() == DstTy->getBitWidth()) {
Reid Spencerf5626a32007-01-01 01:20:41 +00003080 deleteUselessCastFlag = true; // Flag the "Inst" rule
Chris Lattner37e01c52007-01-04 18:46:42 +00003081 deleteUselessCastName = new std::string(*yyvsp[-2].Value.val); // save the name
Reid Spencerf5626a32007-01-01 01:20:41 +00003082 size_t pos = deleteUselessCastName->find_first_of("%\"",0);
3083 if (pos != std::string::npos) {
3084 // remove the type portion before val
3085 deleteUselessCastName->erase(0, pos);
3086 }
3087 }
Chris Lattner37e01c52007-01-04 18:46:42 +00003088 delete yyvsp[-3].String; yyvsp[-2].Value.destroy();
3089 delete yyvsp[-1].String;
3090 ;
3091 break;}
3092case 281:
3093#line 1438 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3094{
3095 *yyvsp[-5].String += " " + *yyvsp[-4].Value.val + ", " + *yyvsp[-2].Value.val + ", " + *yyvsp[0].Value.val;
3096 yyval.Value.val = yyvsp[-5].String;
3097 yyval.Value.type = yyvsp[-2].Value.type;
3098 yyvsp[-4].Value.destroy(); delete yyvsp[-2].Value.val; yyvsp[0].Value.destroy();
3099 ;
3100 break;}
3101case 282:
3102#line 1444 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3103{
3104 *yyvsp[-3].String += " " + *yyvsp[-2].Value.val + ", " + yyvsp[0].Type->getNewTy();
3105 yyval.Value.val = yyvsp[-3].String;
3106 yyval.Value.type = yyvsp[0].Type;
3107 yyvsp[-2].Value.destroy();
3108 ;
3109 break;}
3110case 283:
3111#line 1450 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3112{
3113 *yyvsp[-3].String += " " + *yyvsp[-2].Value.val + ", " + *yyvsp[0].Value.val;
3114 yyval.Value.val = yyvsp[-3].String;
3115 ResolveType(yyvsp[-2].Value.type);
3116 yyval.Value.type = yyvsp[-2].Value.type->getElementType();
3117 delete yyvsp[-2].Value.val; yyvsp[0].Value.destroy();
3118 ;
3119 break;}
3120case 284:
3121#line 1457 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3122{
3123 *yyvsp[-5].String += " " + *yyvsp[-4].Value.val + ", " + *yyvsp[-2].Value.val + ", " + *yyvsp[0].Value.val;
3124 yyval.Value.val = yyvsp[-5].String;
3125 yyval.Value.type = yyvsp[-4].Value.type;
3126 delete yyvsp[-4].Value.val; yyvsp[-2].Value.destroy(); yyvsp[0].Value.destroy();
3127 ;
3128 break;}
3129case 285:
3130#line 1463 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3131{
3132 *yyvsp[-5].String += " " + *yyvsp[-4].Value.val + ", " + *yyvsp[-2].Value.val + ", " + *yyvsp[0].Value.val;
3133 yyval.Value.val = yyvsp[-5].String;
3134 yyval.Value.type = yyvsp[-4].Value.type;
3135 delete yyvsp[-4].Value.val; yyvsp[-2].Value.destroy(); yyvsp[0].Value.destroy();
3136 ;
3137 break;}
3138case 286:
3139#line 1469 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3140{
3141 *yyvsp[-1].String += " " + *yyvsp[0].Value.val;
3142 yyval.Value.val = yyvsp[-1].String;
3143 yyval.Value.type = yyvsp[0].Value.type;
3144 delete yyvsp[0].Value.val;
3145 ;
3146 break;}
3147case 287:
3148#line 1475 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3149{
3150 if (!yyvsp[-5].String->empty())
3151 *yyvsp[-6].String += " " + *yyvsp[-5].String;
3152 if (!yyvsp[-6].String->empty())
3153 *yyvsp[-6].String += " ";
3154 *yyvsp[-6].String += yyvsp[-4].Type->getNewTy() + " " + *yyvsp[-3].Value.val + "(";
3155 for (unsigned i = 0; i < yyvsp[-1].ValList->size(); ++i) {
3156 ValueInfo& VI = (*yyvsp[-1].ValList)[i];
3157 *yyvsp[-6].String += *VI.val;
3158 if (i+1 < yyvsp[-1].ValList->size())
3159 *yyvsp[-6].String += ", ";
Reid Spencerf8483652006-12-02 15:16:01 +00003160 VI.destroy();
3161 }
Chris Lattner37e01c52007-01-04 18:46:42 +00003162 *yyvsp[-6].String += ")";
3163 yyval.Value.val = yyvsp[-6].String;
3164 yyval.Value.type = getFunctionReturnType(yyvsp[-4].Type);
3165 delete yyvsp[-5].String; delete yyvsp[-4].Type; yyvsp[-3].Value.destroy(); delete yyvsp[-1].ValList;
3166 ;
3167 break;}
3168case 289:
3169#line 1498 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3170{ yyval.ValList = yyvsp[0].ValList; ;
3171 break;}
3172case 290:
3173#line 1499 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3174{ yyval.ValList = new ValueList(); ;
3175 break;}
3176case 292:
3177#line 1504 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3178{ yyval.String = new std::string(); ;
3179 break;}
3180case 293:
3181#line 1507 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3182{
3183 *yyvsp[-2].String += " " + yyvsp[-1].Type->getNewTy();
3184 if (!yyvsp[0].String->empty())
3185 *yyvsp[-2].String += " " + *yyvsp[0].String;
3186 yyval.Value.val = yyvsp[-2].String;
3187 yyval.Value.type = yyvsp[-1].Type->getPointerType();
3188 delete yyvsp[-1].Type; delete yyvsp[0].String;
3189 ;
3190 break;}
3191case 294:
3192#line 1515 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3193{
3194 std::string Name = getUniqueName(yyvsp[-1].Value.val, yyvsp[-2].Type);
3195 *yyvsp[-5].String += " " + yyvsp[-4].Type->getNewTy() + ", " + yyvsp[-2].Type->getNewTy() + " " + Name;
3196 if (!yyvsp[0].String->empty())
3197 *yyvsp[-5].String += " " + *yyvsp[0].String;
3198 yyval.Value.val = yyvsp[-5].String;
3199 yyval.Value.type = yyvsp[-4].Type->getPointerType();
3200 delete yyvsp[-4].Type; delete yyvsp[-2].Type; yyvsp[-1].Value.destroy(); delete yyvsp[0].String;
3201 ;
3202 break;}
3203case 295:
3204#line 1524 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3205{
3206 *yyvsp[-2].String += " " + yyvsp[-1].Type->getNewTy();
3207 if (!yyvsp[0].String->empty())
3208 *yyvsp[-2].String += " " + *yyvsp[0].String;
3209 yyval.Value.val = yyvsp[-2].String;
3210 yyval.Value.type = yyvsp[-1].Type->getPointerType();
3211 delete yyvsp[-1].Type; delete yyvsp[0].String;
3212 ;
3213 break;}
3214case 296:
3215#line 1532 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3216{
3217 std::string Name = getUniqueName(yyvsp[-1].Value.val, yyvsp[-2].Type);
3218 *yyvsp[-5].String += " " + yyvsp[-4].Type->getNewTy() + ", " + yyvsp[-2].Type->getNewTy() + " " + Name;
3219 if (!yyvsp[0].String->empty())
3220 *yyvsp[-5].String += " " + *yyvsp[0].String;
3221 yyval.Value.val = yyvsp[-5].String;
3222 yyval.Value.type = yyvsp[-4].Type->getPointerType();
3223 delete yyvsp[-4].Type; delete yyvsp[-2].Type; yyvsp[-1].Value.destroy(); delete yyvsp[0].String;
3224 ;
3225 break;}
3226case 297:
3227#line 1541 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3228{
3229 *yyvsp[-1].String += " " + *yyvsp[0].Value.val;
3230 yyval.Value.val = yyvsp[-1].String;
3231 yyval.Value.type = new TypeInfo("void", VoidTy);
3232 yyvsp[0].Value.destroy();
3233 ;
3234 break;}
3235case 298:
3236#line 1547 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3237{
3238 std::string Name = getUniqueName(yyvsp[0].Value.val, yyvsp[-1].Type);
3239 if (!yyvsp[-3].String->empty())
3240 *yyvsp[-3].String += " ";
3241 *yyvsp[-3].String += *yyvsp[-2].String + " " + yyvsp[-1].Type->getNewTy() + " " + Name;
3242 yyval.Value.val = yyvsp[-3].String;
3243 yyval.Value.type = yyvsp[-1].Type->getElementType()->clone();
3244 delete yyvsp[-2].String; delete yyvsp[-1].Type; yyvsp[0].Value.destroy();
3245 ;
3246 break;}
3247case 299:
3248#line 1556 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3249{
3250 std::string Name = getUniqueName(yyvsp[0].Value.val, yyvsp[-1].Type);
3251 if (!yyvsp[-5].String->empty())
3252 *yyvsp[-5].String += " ";
3253 *yyvsp[-5].String += *yyvsp[-4].String + " " + *yyvsp[-3].Value.val + ", " + yyvsp[-1].Type->getNewTy() + " " + Name;
3254 yyval.Value.val = yyvsp[-5].String;
3255 yyval.Value.type = new TypeInfo("void", VoidTy);
3256 delete yyvsp[-4].String; yyvsp[-3].Value.destroy(); delete yyvsp[-1].Type; yyvsp[0].Value.destroy();
3257 ;
3258 break;}
3259case 300:
3260#line 1565 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
3261{
3262 std::string Name = getUniqueName(yyvsp[-1].Value.val, yyvsp[-2].Type);
Reid Spencerf459d392006-12-02 16:19:52 +00003263 // Upgrade the indices
Chris Lattner37e01c52007-01-04 18:46:42 +00003264 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
3265 ValueInfo& VI = (*yyvsp[0].ValList)[i];
Reid Spencer52402b02007-01-02 05:45:11 +00003266 if (VI.type->isUnsigned() && !VI.isConstant() &&
3267 VI.type->getBitWidth() < 64) {
Reid Spencerf459d392006-12-02 16:19:52 +00003268 std::string* old = VI.val;
3269 *O << " %gep_upgrade" << unique << " = zext " << *old
Reid Spencer71d2ec92006-12-31 06:02:26 +00003270 << " to i64\n";
3271 VI.val = new std::string("i64 %gep_upgrade" + llvm::utostr(unique++));
Reid Spencer52402b02007-01-02 05:45:11 +00003272 VI.type->setOldTy(ULongTy);
Reid Spencerf459d392006-12-02 16:19:52 +00003273 }
3274 }
Chris Lattner37e01c52007-01-04 18:46:42 +00003275 *yyvsp[-3].String += " " + yyvsp[-2].Type->getNewTy() + " " + Name;
3276 for (unsigned i = 0; i < yyvsp[0].ValList->size(); ++i) {
3277 ValueInfo& VI = (*yyvsp[0].ValList)[i];
3278 *yyvsp[-3].String += ", " + *VI.val;
Reid Spencerf8483652006-12-02 15:16:01 +00003279 }
Chris Lattner37e01c52007-01-04 18:46:42 +00003280 yyval.Value.val = yyvsp[-3].String;
3281 yyval.Value.type = getGEPIndexedType(yyvsp[-2].Type,yyvsp[0].ValList);
3282 yyvsp[-1].Value.destroy(); delete yyvsp[0].ValList;
3283 ;
3284 break;}
3285}
3286 /* the action file gets copied in in place of this dollarsign */
3287#line 543 "/usr/share/bison.simple"
Reid Spencere7c3c602006-11-30 06:36:44 +00003288
3289 yyvsp -= yylen;
3290 yyssp -= yylen;
Chris Lattner37e01c52007-01-04 18:46:42 +00003291#ifdef YYLSP_NEEDED
3292 yylsp -= yylen;
3293#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00003294
Chris Lattner37e01c52007-01-04 18:46:42 +00003295#if YYDEBUG != 0
3296 if (yydebug)
3297 {
3298 short *ssp1 = yyss - 1;
3299 fprintf (stderr, "state stack now");
3300 while (ssp1 != yyssp)
3301 fprintf (stderr, " %d", *++ssp1);
3302 fprintf (stderr, "\n");
3303 }
3304#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00003305
3306 *++yyvsp = yyval;
3307
Chris Lattner37e01c52007-01-04 18:46:42 +00003308#ifdef YYLSP_NEEDED
3309 yylsp++;
3310 if (yylen == 0)
3311 {
3312 yylsp->first_line = yylloc.first_line;
3313 yylsp->first_column = yylloc.first_column;
3314 yylsp->last_line = (yylsp-1)->last_line;
3315 yylsp->last_column = (yylsp-1)->last_column;
3316 yylsp->text = 0;
3317 }
3318 else
3319 {
3320 yylsp->last_line = (yylsp+yylen-1)->last_line;
3321 yylsp->last_column = (yylsp+yylen-1)->last_column;
3322 }
3323#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00003324
Chris Lattner37e01c52007-01-04 18:46:42 +00003325 /* Now "shift" the result of the reduction.
3326 Determine what state that goes to,
3327 based on the state we popped back to
3328 and the rule number reduced by. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003329
3330 yyn = yyr1[yyn];
3331
Chris Lattner37e01c52007-01-04 18:46:42 +00003332 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
3333 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencere7c3c602006-11-30 06:36:44 +00003334 yystate = yytable[yystate];
3335 else
Chris Lattner37e01c52007-01-04 18:46:42 +00003336 yystate = yydefgoto[yyn - YYNTBASE];
Reid Spencere7c3c602006-11-30 06:36:44 +00003337
3338 goto yynewstate;
3339
Chris Lattner37e01c52007-01-04 18:46:42 +00003340yyerrlab: /* here on detecting error */
Reid Spencere7c3c602006-11-30 06:36:44 +00003341
Chris Lattner37e01c52007-01-04 18:46:42 +00003342 if (! yyerrstatus)
3343 /* If not already recovering from an error, report this error. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003344 {
3345 ++yynerrs;
Chris Lattner37e01c52007-01-04 18:46:42 +00003346
3347#ifdef YYERROR_VERBOSE
Reid Spencere7c3c602006-11-30 06:36:44 +00003348 yyn = yypact[yystate];
3349
Chris Lattner37e01c52007-01-04 18:46:42 +00003350 if (yyn > YYFLAG && yyn < YYLAST)
Reid Spencere7c3c602006-11-30 06:36:44 +00003351 {
Chris Lattner37e01c52007-01-04 18:46:42 +00003352 int size = 0;
3353 char *msg;
3354 int x, count;
Reid Spencere7c3c602006-11-30 06:36:44 +00003355
Chris Lattner37e01c52007-01-04 18:46:42 +00003356 count = 0;
3357 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
3358 for (x = (yyn < 0 ? -yyn : 0);
3359 x < (sizeof(yytname) / sizeof(char *)); x++)
3360 if (yycheck[x + yyn] == x)
3361 size += strlen(yytname[x]) + 15, count++;
3362 msg = (char *) malloc(size + 15);
3363 if (msg != 0)
Reid Spencere7c3c602006-11-30 06:36:44 +00003364 {
Chris Lattner37e01c52007-01-04 18:46:42 +00003365 strcpy(msg, "parse error");
3366
3367 if (count < 5)
Reid Spencere7c3c602006-11-30 06:36:44 +00003368 {
Chris Lattner37e01c52007-01-04 18:46:42 +00003369 count = 0;
3370 for (x = (yyn < 0 ? -yyn : 0);
3371 x < (sizeof(yytname) / sizeof(char *)); x++)
3372 if (yycheck[x + yyn] == x)
3373 {
3374 strcat(msg, count == 0 ? ", expecting `" : " or `");
3375 strcat(msg, yytname[x]);
3376 strcat(msg, "'");
3377 count++;
3378 }
Reid Spencere7c3c602006-11-30 06:36:44 +00003379 }
Chris Lattner37e01c52007-01-04 18:46:42 +00003380 yyerror(msg);
3381 free(msg);
Reid Spencere7c3c602006-11-30 06:36:44 +00003382 }
3383 else
Chris Lattner37e01c52007-01-04 18:46:42 +00003384 yyerror ("parse error; also virtual memory exceeded");
Reid Spencere7c3c602006-11-30 06:36:44 +00003385 }
3386 else
3387#endif /* YYERROR_VERBOSE */
Chris Lattner37e01c52007-01-04 18:46:42 +00003388 yyerror("parse error");
Reid Spencere7c3c602006-11-30 06:36:44 +00003389 }
3390
Chris Lattner37e01c52007-01-04 18:46:42 +00003391 goto yyerrlab1;
3392yyerrlab1: /* here on error raised explicitly by an action */
Reid Spencere7c3c602006-11-30 06:36:44 +00003393
3394 if (yyerrstatus == 3)
3395 {
Chris Lattner37e01c52007-01-04 18:46:42 +00003396 /* if just tried and failed to reuse lookahead token after an error, discard it. */
Reid Spencere7c3c602006-11-30 06:36:44 +00003397
Chris Lattner37e01c52007-01-04 18:46:42 +00003398 /* return failure if at end of input */
3399 if (yychar == YYEOF)
Reid Spencere7c3c602006-11-30 06:36:44 +00003400 YYABORT;
3401
Chris Lattner37e01c52007-01-04 18:46:42 +00003402#if YYDEBUG != 0
3403 if (yydebug)
3404 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
3405#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00003406
Chris Lattner37e01c52007-01-04 18:46:42 +00003407 yychar = YYEMPTY;
Reid Spencere7c3c602006-11-30 06:36:44 +00003408 }
3409
Chris Lattner37e01c52007-01-04 18:46:42 +00003410 /* Else will try to reuse lookahead token
3411 after shifting the error token. */
3412
3413 yyerrstatus = 3; /* Each real token shifted decrements this */
3414
3415 goto yyerrhandle;
3416
3417yyerrdefault: /* current state does not do anything special for the error token. */
3418
3419#if 0
3420 /* This is wrong; only states that explicitly want error tokens
3421 should shift them. */
3422 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
3423 if (yyn) goto yydefault;
3424#endif
3425
3426yyerrpop: /* pop the current state because it cannot handle the error token */
3427
3428 if (yyssp == yyss) YYABORT;
3429 yyvsp--;
3430 yystate = *--yyssp;
3431#ifdef YYLSP_NEEDED
3432 yylsp--;
3433#endif
3434
3435#if YYDEBUG != 0
3436 if (yydebug)
3437 {
3438 short *ssp1 = yyss - 1;
3439 fprintf (stderr, "Error: state stack now");
3440 while (ssp1 != yyssp)
3441 fprintf (stderr, " %d", *++ssp1);
3442 fprintf (stderr, "\n");
3443 }
3444#endif
3445
3446yyerrhandle:
3447
3448 yyn = yypact[yystate];
3449 if (yyn == YYFLAG)
3450 goto yyerrdefault;
3451
3452 yyn += YYTERROR;
3453 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
3454 goto yyerrdefault;
3455
3456 yyn = yytable[yyn];
3457 if (yyn < 0)
3458 {
3459 if (yyn == YYFLAG)
3460 goto yyerrpop;
3461 yyn = -yyn;
3462 goto yyreduce;
3463 }
3464 else if (yyn == 0)
3465 goto yyerrpop;
3466
Reid Spencere7c3c602006-11-30 06:36:44 +00003467 if (yyn == YYFINAL)
3468 YYACCEPT;
3469
Chris Lattner37e01c52007-01-04 18:46:42 +00003470#if YYDEBUG != 0
3471 if (yydebug)
3472 fprintf(stderr, "Shifting error token, ");
3473#endif
3474
Reid Spencere7c3c602006-11-30 06:36:44 +00003475 *++yyvsp = yylval;
Chris Lattner37e01c52007-01-04 18:46:42 +00003476#ifdef YYLSP_NEEDED
3477 *++yylsp = yylloc;
3478#endif
Reid Spencere7c3c602006-11-30 06:36:44 +00003479
3480 yystate = yyn;
3481 goto yynewstate;
3482
Chris Lattner37e01c52007-01-04 18:46:42 +00003483 yyacceptlab:
3484 /* YYACCEPT comes here. */
3485 if (yyfree_stacks)
Reid Spencere7c3c602006-11-30 06:36:44 +00003486 {
Chris Lattner37e01c52007-01-04 18:46:42 +00003487 free (yyss);
3488 free (yyvs);
3489#ifdef YYLSP_NEEDED
3490 free (yyls);
Reid Spencere7c3c602006-11-30 06:36:44 +00003491#endif
Chris Lattner37e01c52007-01-04 18:46:42 +00003492 }
3493 return 0;
3494
3495 yyabortlab:
3496 /* YYABORT comes here. */
3497 if (yyfree_stacks)
3498 {
3499 free (yyss);
3500 free (yyvs);
3501#ifdef YYLSP_NEEDED
3502 free (yyls);
3503#endif
3504 }
3505 return 1;
Reid Spencere7c3c602006-11-30 06:36:44 +00003506}
Chris Lattner37e01c52007-01-04 18:46:42 +00003507#line 1589 "/Volumes/ProjectsDisk/cvs/llvm/tools/llvm-upgrade/UpgradeParser.y"
Reid Spencere7c3c602006-11-30 06:36:44 +00003508
3509
3510int yyerror(const char *ErrorMsg) {
3511 std::string where
3512 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
3513 + ":" + llvm::utostr((unsigned) Upgradelineno) + ": ";
3514 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
3515 if (yychar == YYEMPTY || yychar == 0)
3516 errMsg += "end-of-file.";
3517 else
3518 errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'";
Reid Spencer71d2ec92006-12-31 06:02:26 +00003519 std::cerr << "llvm-upgrade: " << errMsg << '\n';
Chris Lattner37e01c52007-01-04 18:46:42 +00003520 *O << "llvm-upgrade parse failed.\n";
Reid Spencere7c3c602006-11-30 06:36:44 +00003521 exit(1);
3522}