Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 2.1. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 10 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ |
| 20 | |
| 21 | /* As a special exception, when this file is copied by Bison into a |
| 22 | Bison output file, you may use that output file without restriction. |
| 23 | This special exception was added by the Free Software Foundation |
| 24 | in version 1.24 of Bison. */ |
| 25 | |
| 26 | /* Written by Richard Stallman by simplifying the original so called |
| 27 | ``semantic'' parser. */ |
| 28 | |
| 29 | /* All symbols defined below should begin with yy or YY, to avoid |
| 30 | infringing on user name space. This should be done even for local |
| 31 | variables, as they might otherwise be expanded by user macros. |
| 32 | There are some unavoidable exceptions within include files to |
| 33 | define necessary library symbols; they are noted "INFRINGES ON |
| 34 | USER NAME SPACE" below. */ |
| 35 | |
| 36 | /* Identify Bison output. */ |
| 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Bison version. */ |
| 40 | #define YYBISON_VERSION "2.1" |
| 41 | |
| 42 | /* Skeleton name. */ |
| 43 | #define YYSKELETON_NAME "yacc.c" |
| 44 | |
| 45 | /* Pure parsers. */ |
| 46 | #define YYPURE 0 |
| 47 | |
| 48 | /* Using locations. */ |
| 49 | #define YYLSP_NEEDED 0 |
| 50 | |
| 51 | /* Substitute the variable and function names. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 52 | #define yyparse Upgradeparse |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 53 | #define yylex Upgradelex |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 54 | #define yyerror Upgradeerror |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 55 | #define yylval Upgradelval |
| 56 | #define yychar Upgradechar |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 57 | #define yydebug Upgradedebug |
| 58 | #define yynerrs Upgradenerrs |
| 59 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 60 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 61 | /* Tokens. */ |
| 62 | #ifndef YYTOKENTYPE |
| 63 | # define YYTOKENTYPE |
| 64 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 65 | know about them. */ |
| 66 | enum yytokentype { |
| 67 | VOID = 258, |
| 68 | BOOL = 259, |
| 69 | SBYTE = 260, |
| 70 | UBYTE = 261, |
| 71 | SHORT = 262, |
| 72 | USHORT = 263, |
| 73 | INT = 264, |
| 74 | UINT = 265, |
| 75 | LONG = 266, |
| 76 | ULONG = 267, |
| 77 | FLOAT = 268, |
| 78 | DOUBLE = 269, |
| 79 | LABEL = 270, |
| 80 | OPAQUE = 271, |
| 81 | ESINT64VAL = 272, |
| 82 | EUINT64VAL = 273, |
| 83 | SINTVAL = 274, |
| 84 | UINTVAL = 275, |
| 85 | FPVAL = 276, |
| 86 | NULL_TOK = 277, |
| 87 | UNDEF = 278, |
| 88 | ZEROINITIALIZER = 279, |
| 89 | TRUETOK = 280, |
| 90 | FALSETOK = 281, |
| 91 | TYPE = 282, |
| 92 | VAR_ID = 283, |
| 93 | LABELSTR = 284, |
| 94 | STRINGCONSTANT = 285, |
| 95 | IMPLEMENTATION = 286, |
| 96 | BEGINTOK = 287, |
| 97 | ENDTOK = 288, |
| 98 | DECLARE = 289, |
| 99 | GLOBAL = 290, |
| 100 | CONSTANT = 291, |
| 101 | SECTION = 292, |
| 102 | VOLATILE = 293, |
| 103 | TO = 294, |
| 104 | DOTDOTDOT = 295, |
| 105 | CONST = 296, |
| 106 | INTERNAL = 297, |
| 107 | LINKONCE = 298, |
| 108 | WEAK = 299, |
| 109 | DLLIMPORT = 300, |
| 110 | DLLEXPORT = 301, |
| 111 | EXTERN_WEAK = 302, |
| 112 | APPENDING = 303, |
| 113 | NOT = 304, |
| 114 | EXTERNAL = 305, |
| 115 | TARGET = 306, |
| 116 | TRIPLE = 307, |
| 117 | ENDIAN = 308, |
| 118 | POINTERSIZE = 309, |
| 119 | LITTLE = 310, |
| 120 | BIG = 311, |
| 121 | ALIGN = 312, |
| 122 | UNINITIALIZED = 313, |
| 123 | DEPLIBS = 314, |
| 124 | CALL = 315, |
| 125 | TAIL = 316, |
| 126 | ASM_TOK = 317, |
| 127 | MODULE = 318, |
| 128 | SIDEEFFECT = 319, |
| 129 | CC_TOK = 320, |
| 130 | CCC_TOK = 321, |
| 131 | CSRETCC_TOK = 322, |
| 132 | FASTCC_TOK = 323, |
| 133 | COLDCC_TOK = 324, |
| 134 | X86_STDCALLCC_TOK = 325, |
| 135 | X86_FASTCALLCC_TOK = 326, |
| 136 | DATALAYOUT = 327, |
| 137 | RET = 328, |
| 138 | BR = 329, |
| 139 | SWITCH = 330, |
| 140 | INVOKE = 331, |
| 141 | EXCEPT = 332, |
| 142 | UNWIND = 333, |
| 143 | UNREACHABLE = 334, |
| 144 | ADD = 335, |
| 145 | SUB = 336, |
| 146 | MUL = 337, |
| 147 | DIV = 338, |
| 148 | UDIV = 339, |
| 149 | SDIV = 340, |
| 150 | FDIV = 341, |
| 151 | REM = 342, |
| 152 | UREM = 343, |
| 153 | SREM = 344, |
| 154 | FREM = 345, |
| 155 | AND = 346, |
| 156 | OR = 347, |
| 157 | XOR = 348, |
| 158 | SETLE = 349, |
| 159 | SETGE = 350, |
| 160 | SETLT = 351, |
| 161 | SETGT = 352, |
| 162 | SETEQ = 353, |
| 163 | SETNE = 354, |
| 164 | ICMP = 355, |
| 165 | FCMP = 356, |
| 166 | EQ = 357, |
| 167 | NE = 358, |
| 168 | SLT = 359, |
| 169 | SGT = 360, |
| 170 | SLE = 361, |
| 171 | SGE = 362, |
| 172 | OEQ = 363, |
| 173 | ONE = 364, |
| 174 | OLT = 365, |
| 175 | OGT = 366, |
| 176 | OLE = 367, |
| 177 | OGE = 368, |
| 178 | ORD = 369, |
| 179 | UNO = 370, |
| 180 | UEQ = 371, |
| 181 | UNE = 372, |
| 182 | ULT = 373, |
| 183 | UGT = 374, |
| 184 | ULE = 375, |
| 185 | UGE = 376, |
| 186 | MALLOC = 377, |
| 187 | ALLOCA = 378, |
| 188 | FREE = 379, |
| 189 | LOAD = 380, |
| 190 | STORE = 381, |
| 191 | GETELEMENTPTR = 382, |
| 192 | PHI_TOK = 383, |
| 193 | SELECT = 384, |
| 194 | SHL = 385, |
| 195 | SHR = 386, |
| 196 | ASHR = 387, |
| 197 | LSHR = 388, |
| 198 | VAARG = 389, |
| 199 | EXTRACTELEMENT = 390, |
| 200 | INSERTELEMENT = 391, |
| 201 | SHUFFLEVECTOR = 392, |
| 202 | CAST = 393, |
| 203 | TRUNC = 394, |
| 204 | ZEXT = 395, |
| 205 | SEXT = 396, |
| 206 | FPTRUNC = 397, |
| 207 | FPEXT = 398, |
| 208 | FPTOUI = 399, |
| 209 | FPTOSI = 400, |
| 210 | UITOFP = 401, |
| 211 | SITOFP = 402, |
| 212 | PTRTOINT = 403, |
| 213 | INTTOPTR = 404, |
| 214 | BITCAST = 405 |
| 215 | }; |
| 216 | #endif |
| 217 | /* Tokens. */ |
| 218 | #define VOID 258 |
| 219 | #define BOOL 259 |
| 220 | #define SBYTE 260 |
| 221 | #define UBYTE 261 |
| 222 | #define SHORT 262 |
| 223 | #define USHORT 263 |
| 224 | #define INT 264 |
| 225 | #define UINT 265 |
| 226 | #define LONG 266 |
| 227 | #define ULONG 267 |
| 228 | #define FLOAT 268 |
| 229 | #define DOUBLE 269 |
| 230 | #define LABEL 270 |
| 231 | #define OPAQUE 271 |
| 232 | #define ESINT64VAL 272 |
| 233 | #define EUINT64VAL 273 |
| 234 | #define SINTVAL 274 |
| 235 | #define UINTVAL 275 |
| 236 | #define FPVAL 276 |
| 237 | #define NULL_TOK 277 |
| 238 | #define UNDEF 278 |
| 239 | #define ZEROINITIALIZER 279 |
| 240 | #define TRUETOK 280 |
| 241 | #define FALSETOK 281 |
| 242 | #define TYPE 282 |
| 243 | #define VAR_ID 283 |
| 244 | #define LABELSTR 284 |
| 245 | #define STRINGCONSTANT 285 |
| 246 | #define IMPLEMENTATION 286 |
| 247 | #define BEGINTOK 287 |
| 248 | #define ENDTOK 288 |
| 249 | #define DECLARE 289 |
| 250 | #define GLOBAL 290 |
| 251 | #define CONSTANT 291 |
| 252 | #define SECTION 292 |
| 253 | #define VOLATILE 293 |
| 254 | #define TO 294 |
| 255 | #define DOTDOTDOT 295 |
| 256 | #define CONST 296 |
| 257 | #define INTERNAL 297 |
| 258 | #define LINKONCE 298 |
| 259 | #define WEAK 299 |
| 260 | #define DLLIMPORT 300 |
| 261 | #define DLLEXPORT 301 |
| 262 | #define EXTERN_WEAK 302 |
| 263 | #define APPENDING 303 |
| 264 | #define NOT 304 |
| 265 | #define EXTERNAL 305 |
| 266 | #define TARGET 306 |
| 267 | #define TRIPLE 307 |
| 268 | #define ENDIAN 308 |
| 269 | #define POINTERSIZE 309 |
| 270 | #define LITTLE 310 |
| 271 | #define BIG 311 |
| 272 | #define ALIGN 312 |
| 273 | #define UNINITIALIZED 313 |
| 274 | #define DEPLIBS 314 |
| 275 | #define CALL 315 |
| 276 | #define TAIL 316 |
| 277 | #define ASM_TOK 317 |
| 278 | #define MODULE 318 |
| 279 | #define SIDEEFFECT 319 |
| 280 | #define CC_TOK 320 |
| 281 | #define CCC_TOK 321 |
| 282 | #define CSRETCC_TOK 322 |
| 283 | #define FASTCC_TOK 323 |
| 284 | #define COLDCC_TOK 324 |
| 285 | #define X86_STDCALLCC_TOK 325 |
| 286 | #define X86_FASTCALLCC_TOK 326 |
| 287 | #define DATALAYOUT 327 |
| 288 | #define RET 328 |
| 289 | #define BR 329 |
| 290 | #define SWITCH 330 |
| 291 | #define INVOKE 331 |
| 292 | #define EXCEPT 332 |
| 293 | #define UNWIND 333 |
| 294 | #define UNREACHABLE 334 |
| 295 | #define ADD 335 |
| 296 | #define SUB 336 |
| 297 | #define MUL 337 |
| 298 | #define DIV 338 |
| 299 | #define UDIV 339 |
| 300 | #define SDIV 340 |
| 301 | #define FDIV 341 |
| 302 | #define REM 342 |
| 303 | #define UREM 343 |
| 304 | #define SREM 344 |
| 305 | #define FREM 345 |
| 306 | #define AND 346 |
| 307 | #define OR 347 |
| 308 | #define XOR 348 |
| 309 | #define SETLE 349 |
| 310 | #define SETGE 350 |
| 311 | #define SETLT 351 |
| 312 | #define SETGT 352 |
| 313 | #define SETEQ 353 |
| 314 | #define SETNE 354 |
| 315 | #define ICMP 355 |
| 316 | #define FCMP 356 |
| 317 | #define EQ 357 |
| 318 | #define NE 358 |
| 319 | #define SLT 359 |
| 320 | #define SGT 360 |
| 321 | #define SLE 361 |
| 322 | #define SGE 362 |
| 323 | #define OEQ 363 |
| 324 | #define ONE 364 |
| 325 | #define OLT 365 |
| 326 | #define OGT 366 |
| 327 | #define OLE 367 |
| 328 | #define OGE 368 |
| 329 | #define ORD 369 |
| 330 | #define UNO 370 |
| 331 | #define UEQ 371 |
| 332 | #define UNE 372 |
| 333 | #define ULT 373 |
| 334 | #define UGT 374 |
| 335 | #define ULE 375 |
| 336 | #define UGE 376 |
| 337 | #define MALLOC 377 |
| 338 | #define ALLOCA 378 |
| 339 | #define FREE 379 |
| 340 | #define LOAD 380 |
| 341 | #define STORE 381 |
| 342 | #define GETELEMENTPTR 382 |
| 343 | #define PHI_TOK 383 |
| 344 | #define SELECT 384 |
| 345 | #define SHL 385 |
| 346 | #define SHR 386 |
| 347 | #define ASHR 387 |
| 348 | #define LSHR 388 |
| 349 | #define VAARG 389 |
| 350 | #define EXTRACTELEMENT 390 |
| 351 | #define INSERTELEMENT 391 |
| 352 | #define SHUFFLEVECTOR 392 |
| 353 | #define CAST 393 |
| 354 | #define TRUNC 394 |
| 355 | #define ZEXT 395 |
| 356 | #define SEXT 396 |
| 357 | #define FPTRUNC 397 |
| 358 | #define FPEXT 398 |
| 359 | #define FPTOUI 399 |
| 360 | #define FPTOSI 400 |
| 361 | #define UITOFP 401 |
| 362 | #define SITOFP 402 |
| 363 | #define PTRTOINT 403 |
| 364 | #define INTTOPTR 404 |
| 365 | #define BITCAST 405 |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | /* Copy the first part of user declarations. */ |
| 371 | #line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
| 372 | |
| 373 | #include "UpgradeInternals.h" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 374 | #include <algorithm> |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 375 | #include <map> |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 376 | #include <utility> |
| 377 | #include <iostream> |
| 378 | |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 379 | #define YYERROR_VERBOSE 1 |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 380 | #define YYINCLUDED_STDLIB_H |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 381 | #define YYDEBUG 1 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 382 | |
| 383 | int yylex(); // declaration" of xxx warnings. |
| 384 | int yyparse(); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 385 | extern int yydebug; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 386 | |
| 387 | static std::string CurFilename; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 388 | static std::ostream *O = 0; |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 389 | std::istream* LexInput = 0; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 390 | unsigned SizeOfPointer = 32; |
Reid Spencer | f459d39 | 2006-12-02 16:19:52 +0000 | [diff] [blame] | 391 | static uint64_t unique = 1; |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 392 | |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 393 | // This bool controls whether attributes are ever added to function declarations |
| 394 | // definitions and calls. |
| 395 | static bool AddAttributes = false; |
| 396 | |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 397 | // This bool is used to communicate between the InstVal and Inst rules about |
| 398 | // whether or not a cast should be deleted. When the flag is set, InstVal has |
| 399 | // determined that the cast is a candidate. However, it can only be deleted if |
| 400 | // the value being casted is the same value name as the instruction. The Inst |
| 401 | // rule makes that comparison if the flag is set and comments out the |
| 402 | // instruction if they match. |
| 403 | static bool deleteUselessCastFlag = false; |
| 404 | static std::string* deleteUselessCastName = 0; |
| 405 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 406 | typedef std::vector<const TypeInfo*> TypeVector; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 407 | static TypeVector EnumeratedTypes; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 408 | typedef std::map<std::string,const TypeInfo*> TypeMap; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 409 | static TypeMap NamedTypes; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 410 | typedef std::map<const TypeInfo*,std::string> TypePlaneMap; |
| 411 | typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap; |
| 412 | static GlobalsTypeMap Globals; |
| 413 | |
| 414 | static void warning(const std::string& msg); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 415 | |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 416 | void destroy(ValueList* VL) { |
| 417 | while (!VL->empty()) { |
| 418 | ValueInfo& VI = VL->back(); |
| 419 | VI.destroy(); |
| 420 | VL->pop_back(); |
| 421 | } |
| 422 | delete VL; |
| 423 | } |
| 424 | |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 425 | void UpgradeAssembly(const std::string &infile, std::istream& in, |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 426 | std::ostream &out, bool debug, bool addAttrs) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 427 | { |
| 428 | Upgradelineno = 1; |
| 429 | CurFilename = infile; |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 430 | LexInput = ∈ |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 431 | yydebug = debug; |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 432 | AddAttributes = addAttrs; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 433 | O = &out; |
| 434 | |
| 435 | if (yyparse()) { |
| 436 | std::cerr << "Parse failed.\n"; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 437 | out << "llvm-upgrade parse failed.\n"; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 438 | exit(1); |
| 439 | } |
| 440 | } |
| 441 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 442 | TypeInfo::TypeRegMap TypeInfo::registry; |
| 443 | |
| 444 | const TypeInfo* TypeInfo::get(const std::string &newType, Types oldType) { |
| 445 | TypeInfo* Ty = new TypeInfo(); |
| 446 | Ty->newTy = newType; |
| 447 | Ty->oldTy = oldType; |
| 448 | return add_new_type(Ty); |
| 449 | } |
| 450 | |
| 451 | const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType, |
| 452 | const TypeInfo* eTy, const TypeInfo* rTy) { |
| 453 | TypeInfo* Ty= new TypeInfo(); |
| 454 | Ty->newTy = newType; |
| 455 | Ty->oldTy = oldType; |
| 456 | Ty->elemTy = const_cast<TypeInfo*>(eTy); |
| 457 | Ty->resultTy = const_cast<TypeInfo*>(rTy); |
| 458 | return add_new_type(Ty); |
| 459 | } |
| 460 | |
| 461 | const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType, |
| 462 | const TypeInfo *eTy, uint64_t elems) { |
| 463 | TypeInfo* Ty = new TypeInfo(); |
| 464 | Ty->newTy = newType; |
| 465 | Ty->oldTy = oldType; |
| 466 | Ty->elemTy = const_cast<TypeInfo*>(eTy); |
| 467 | Ty->nelems = elems; |
| 468 | return add_new_type(Ty); |
| 469 | } |
| 470 | |
| 471 | const TypeInfo* TypeInfo::get(const std::string& newType, Types oldType, |
| 472 | TypeList* TL) { |
| 473 | TypeInfo* Ty = new TypeInfo(); |
| 474 | Ty->newTy = newType; |
| 475 | Ty->oldTy = oldType; |
| 476 | Ty->elements = TL; |
| 477 | return add_new_type(Ty); |
| 478 | } |
| 479 | |
| 480 | const TypeInfo* TypeInfo::get(const std::string& newType, const TypeInfo* resTy, |
| 481 | TypeList* TL) { |
| 482 | TypeInfo* Ty = new TypeInfo(); |
| 483 | Ty->newTy = newType; |
| 484 | Ty->oldTy = FunctionTy; |
| 485 | Ty->resultTy = const_cast<TypeInfo*>(resTy); |
| 486 | Ty->elements = TL; |
| 487 | return add_new_type(Ty); |
| 488 | } |
| 489 | |
| 490 | const TypeInfo* TypeInfo::resolve() const { |
| 491 | if (isUnresolved()) { |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 492 | if (getNewTy()[0] == '%' && isdigit(newTy[1])) { |
| 493 | unsigned ref = atoi(&((newTy.c_str())[1])); // skip the % |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 494 | if (ref < EnumeratedTypes.size()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 495 | return EnumeratedTypes[ref]; |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 496 | } else { |
| 497 | std::string msg("Can't resolve numbered type: "); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 498 | msg += getNewTy(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 499 | yyerror(msg.c_str()); |
| 500 | } |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 501 | } else { |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 502 | TypeMap::iterator I = NamedTypes.find(newTy); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 503 | if (I != NamedTypes.end()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 504 | return I->second; |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 505 | } else { |
| 506 | std::string msg("Cannot resolve type: "); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 507 | msg += getNewTy(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 508 | yyerror(msg.c_str()); |
| 509 | } |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 510 | } |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 511 | } |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 512 | // otherwise its already resolved. |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 513 | return this; |
| 514 | } |
| 515 | |
| 516 | bool TypeInfo::operator<(const TypeInfo& that) const { |
| 517 | if (this == &that) |
| 518 | return false; |
| 519 | if (oldTy != that.oldTy) |
| 520 | return oldTy < that.oldTy; |
| 521 | switch (oldTy) { |
| 522 | case UpRefTy: { |
| 523 | unsigned thisUp = this->getUpRefNum(); |
| 524 | unsigned thatUp = that.getUpRefNum(); |
| 525 | return thisUp < thatUp; |
| 526 | } |
| 527 | case PackedTy: |
| 528 | case ArrayTy: |
| 529 | if (this->nelems != that.nelems) |
| 530 | return nelems < that.nelems; |
| 531 | case PointerTy: { |
| 532 | const TypeInfo* thisTy = this->elemTy; |
| 533 | const TypeInfo* thatTy = that.elemTy; |
| 534 | return *thisTy < *thatTy; |
| 535 | } |
| 536 | case FunctionTy: { |
| 537 | const TypeInfo* thisTy = this->resultTy; |
| 538 | const TypeInfo* thatTy = that.resultTy; |
| 539 | if (!thisTy->sameOldTyAs(thatTy)) |
| 540 | return *thisTy < *thatTy; |
| 541 | /* FALL THROUGH */ |
| 542 | } |
| 543 | case StructTy: |
| 544 | case PackedStructTy: { |
| 545 | if (elements->size() != that.elements->size()) |
| 546 | return elements->size() < that.elements->size(); |
| 547 | for (unsigned i = 0; i < elements->size(); i++) { |
| 548 | const TypeInfo* thisTy = (*this->elements)[i]; |
| 549 | const TypeInfo* thatTy = (*that.elements)[i]; |
| 550 | if (!thisTy->sameOldTyAs(thatTy)) |
| 551 | return *thisTy < *thatTy; |
| 552 | } |
| 553 | break; |
| 554 | } |
| 555 | case UnresolvedTy: |
| 556 | return this->newTy < that.newTy; |
| 557 | default: |
| 558 | break; |
| 559 | } |
| 560 | return false; |
| 561 | } |
| 562 | |
| 563 | bool TypeInfo::sameOldTyAs(const TypeInfo* that) const { |
| 564 | if (that == 0) |
| 565 | return false; |
| 566 | if ( this == that ) |
| 567 | return true; |
| 568 | if (oldTy != that->oldTy) |
| 569 | return false; |
| 570 | switch (oldTy) { |
| 571 | case PackedTy: |
| 572 | case ArrayTy: |
| 573 | if (nelems != that->nelems) |
| 574 | return false; |
| 575 | /* FALL THROUGH */ |
| 576 | case PointerTy: { |
| 577 | const TypeInfo* thisTy = this->elemTy; |
| 578 | const TypeInfo* thatTy = that->elemTy; |
| 579 | return thisTy->sameOldTyAs(thatTy); |
| 580 | } |
| 581 | case FunctionTy: { |
| 582 | const TypeInfo* thisTy = this->resultTy; |
| 583 | const TypeInfo* thatTy = that->resultTy; |
| 584 | if (!thisTy->sameOldTyAs(thatTy)) |
| 585 | return false; |
| 586 | /* FALL THROUGH */ |
| 587 | } |
| 588 | case StructTy: |
| 589 | case PackedStructTy: { |
| 590 | if (elements->size() != that->elements->size()) |
| 591 | return false; |
| 592 | for (unsigned i = 0; i < elements->size(); i++) { |
| 593 | const TypeInfo* thisTy = (*this->elements)[i]; |
| 594 | const TypeInfo* thatTy = (*that->elements)[i]; |
| 595 | if (!thisTy->sameOldTyAs(thatTy)) |
| 596 | return false; |
| 597 | } |
| 598 | return true; |
| 599 | } |
| 600 | case UnresolvedTy: |
| 601 | return this->newTy == that->newTy; |
| 602 | default: |
| 603 | return true; // for all others oldTy == that->oldTy is sufficient |
| 604 | } |
| 605 | return true; |
| 606 | } |
| 607 | |
| 608 | bool TypeInfo::isUnresolvedDeep() const { |
| 609 | switch (oldTy) { |
| 610 | case UnresolvedTy: |
| 611 | return true; |
| 612 | case PackedTy: |
| 613 | case ArrayTy: |
| 614 | case PointerTy: |
| 615 | return elemTy->isUnresolvedDeep(); |
| 616 | case PackedStructTy: |
| 617 | case StructTy: |
| 618 | for (unsigned i = 0; i < elements->size(); i++) |
| 619 | if ((*elements)[i]->isUnresolvedDeep()) |
| 620 | return true; |
| 621 | return false; |
| 622 | default: |
| 623 | return false; |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | unsigned TypeInfo::getBitWidth() const { |
| 628 | switch (oldTy) { |
| 629 | default: |
| 630 | case LabelTy: |
| 631 | case VoidTy : return 0; |
| 632 | case BoolTy : return 1; |
| 633 | case SByteTy: case UByteTy : return 8; |
| 634 | case ShortTy: case UShortTy : return 16; |
| 635 | case IntTy: case UIntTy: case FloatTy: return 32; |
| 636 | case LongTy: case ULongTy: case DoubleTy : return 64; |
| 637 | case PointerTy: return SizeOfPointer; // global var |
| 638 | case PackedTy: |
| 639 | case ArrayTy: |
| 640 | return nelems * elemTy->getBitWidth(); |
| 641 | case StructTy: |
| 642 | case PackedStructTy: { |
| 643 | uint64_t size = 0; |
| 644 | for (unsigned i = 0; i < elements->size(); i++) { |
| 645 | size += (*elements)[i]->getBitWidth(); |
| 646 | } |
| 647 | return size; |
| 648 | } |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | const TypeInfo* TypeInfo::getIndexedType(const ValueInfo& VI) const { |
| 653 | if (isStruct()) { |
| 654 | if (VI.isConstant() && VI.type->isInteger()) { |
| 655 | size_t pos = VI.val->find(' ') + 1; |
| 656 | if (pos < VI.val->size()) { |
| 657 | uint64_t idx = atoi(VI.val->substr(pos).c_str()); |
| 658 | return (*elements)[idx]; |
| 659 | } else { |
| 660 | yyerror("Invalid value for constant integer"); |
| 661 | return 0; |
| 662 | } |
| 663 | } else { |
| 664 | yyerror("Structure requires constant index"); |
| 665 | return 0; |
| 666 | } |
| 667 | } |
| 668 | if (isArray() || isPacked() || isPointer()) |
| 669 | return elemTy; |
| 670 | yyerror("Invalid type for getIndexedType"); |
| 671 | return 0; |
| 672 | } |
| 673 | |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 674 | void TypeInfo::getSignedness(unsigned &sNum, unsigned &uNum, |
| 675 | UpRefStack& stack) const { |
| 676 | switch (oldTy) { |
| 677 | default: |
| 678 | case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: |
| 679 | case FloatTy : case DoubleTy: case UpRefTy: |
| 680 | return; |
| 681 | case SByteTy: case ShortTy: case LongTy: case IntTy: |
| 682 | sNum++; |
| 683 | return; |
| 684 | case UByteTy: case UShortTy: case UIntTy: case ULongTy: |
| 685 | uNum++; |
| 686 | return; |
| 687 | case PointerTy: |
| 688 | case PackedTy: |
| 689 | case ArrayTy: |
| 690 | stack.push_back(this); |
| 691 | elemTy->getSignedness(sNum, uNum, stack); |
| 692 | return; |
| 693 | case StructTy: |
| 694 | case PackedStructTy: { |
| 695 | stack.push_back(this); |
| 696 | for (unsigned i = 0; i < elements->size(); i++) { |
| 697 | (*elements)[i]->getSignedness(sNum, uNum, stack); |
| 698 | } |
| 699 | return; |
| 700 | } |
| 701 | case UnresolvedTy: { |
| 702 | const TypeInfo* Ty = this->resolve(); |
| 703 | // Let's not recurse. |
| 704 | UpRefStack::const_iterator I = stack.begin(), E = stack.end(); |
| 705 | for ( ; I != E && *I != Ty; ++I) |
| 706 | ; |
| 707 | if (I == E) |
| 708 | Ty->getSignedness(sNum, uNum, stack); |
| 709 | return; |
| 710 | } |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | std::string AddSuffix(const std::string& Name, const std::string& Suffix) { |
| 715 | if (Name[Name.size()-1] == '"') { |
| 716 | std::string Result = Name; |
| 717 | Result.insert(Result.size()-1, Suffix); |
| 718 | return Result; |
| 719 | } |
| 720 | return Name + Suffix; |
| 721 | } |
| 722 | |
| 723 | std::string TypeInfo::makeUniqueName(const std::string& BaseName) const { |
| 724 | if (BaseName == "\"alloca point\"") |
| 725 | return BaseName; |
| 726 | switch (oldTy) { |
| 727 | default: |
| 728 | break; |
| 729 | case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy: |
| 730 | case FloatTy : case DoubleTy: case UnresolvedTy: |
| 731 | return BaseName; |
| 732 | case SByteTy: case ShortTy: case LongTy: case IntTy: |
| 733 | return AddSuffix(BaseName, ".s"); |
| 734 | case UByteTy: case UShortTy: case UIntTy: case ULongTy: |
| 735 | return AddSuffix(BaseName, ".u"); |
| 736 | } |
| 737 | |
| 738 | unsigned uNum = 0, sNum = 0; |
| 739 | std::string Suffix; |
| 740 | switch (oldTy) { |
| 741 | case PointerTy: |
| 742 | case PackedTy: |
| 743 | case ArrayTy: { |
| 744 | TypeInfo::UpRefStack stack; |
| 745 | elemTy->resolve()->getSignedness(sNum, uNum, stack); |
| 746 | break; |
| 747 | } |
| 748 | case StructTy: |
| 749 | case PackedStructTy: { |
| 750 | for (unsigned i = 0; i < elements->size(); i++) { |
| 751 | TypeInfo::UpRefStack stack; |
| 752 | (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack); |
| 753 | } |
| 754 | break; |
| 755 | } |
| 756 | default: |
| 757 | assert(0 && "Invalid Type"); |
| 758 | break; |
| 759 | } |
| 760 | |
| 761 | if (sNum == 0 && uNum == 0) |
| 762 | return BaseName; |
| 763 | |
| 764 | switch (oldTy) { |
| 765 | default: Suffix += ".nada"; break; |
| 766 | case PointerTy: Suffix += ".pntr"; break; |
| 767 | case PackedTy: Suffix += ".pckd"; break; |
| 768 | case ArrayTy: Suffix += ".arry"; break; |
| 769 | case StructTy: Suffix += ".strc"; break; |
| 770 | case PackedStructTy: Suffix += ".pstr"; break; |
| 771 | } |
| 772 | |
| 773 | Suffix += ".s" + llvm::utostr(sNum); |
| 774 | Suffix += ".u" + llvm::utostr(uNum); |
| 775 | return AddSuffix(BaseName, Suffix); |
| 776 | } |
| 777 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 778 | TypeInfo& TypeInfo::operator=(const TypeInfo& that) { |
| 779 | oldTy = that.oldTy; |
| 780 | nelems = that.nelems; |
| 781 | newTy = that.newTy; |
| 782 | elemTy = that.elemTy; |
| 783 | resultTy = that.resultTy; |
| 784 | if (that.elements) { |
| 785 | elements = new TypeList(that.elements->size()); |
| 786 | *elements = *that.elements; |
| 787 | } else { |
| 788 | elements = 0; |
| 789 | } |
| 790 | return *this; |
| 791 | } |
| 792 | |
| 793 | const TypeInfo* TypeInfo::add_new_type(TypeInfo* newTy) { |
| 794 | TypeRegMap::iterator I = registry.find(newTy); |
| 795 | if (I != registry.end()) { |
| 796 | delete newTy; |
| 797 | return *I; |
| 798 | } |
| 799 | registry.insert(newTy); |
| 800 | return newTy; |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 801 | } |
| 802 | |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 803 | static const char* getCastOpcode( |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 804 | std::string& Source, const TypeInfo* SrcTy, const TypeInfo* DstTy) |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 805 | { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 806 | unsigned SrcBits = SrcTy->getBitWidth(); |
| 807 | unsigned DstBits = DstTy->getBitWidth(); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 808 | const char* opcode = "bitcast"; |
| 809 | // Run through the possibilities ... |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 810 | if (DstTy->isIntegral()) { // Casting to integral |
| 811 | if (SrcTy->isIntegral()) { // Casting from integral |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 812 | if (DstBits < SrcBits) |
| 813 | opcode = "trunc"; |
| 814 | else if (DstBits > SrcBits) { // its an extension |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 815 | if (SrcTy->isSigned()) |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 816 | opcode ="sext"; // signed -> SEXT |
| 817 | else |
| 818 | opcode = "zext"; // unsigned -> ZEXT |
| 819 | } else { |
| 820 | opcode = "bitcast"; // Same size, No-op cast |
| 821 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 822 | } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt |
| 823 | if (DstTy->isSigned()) |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 824 | opcode = "fptosi"; // FP -> sint |
| 825 | else |
| 826 | opcode = "fptoui"; // FP -> uint |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 827 | } else if (SrcTy->isPacked()) { |
| 828 | assert(DstBits == SrcTy->getBitWidth() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 829 | "Casting packed to integer of different width"); |
| 830 | opcode = "bitcast"; // same size, no-op cast |
| 831 | } else { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 832 | assert(SrcTy->isPointer() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 833 | "Casting from a value that is not first-class type"); |
| 834 | opcode = "ptrtoint"; // ptr -> int |
| 835 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 836 | } else if (DstTy->isFloatingPoint()) { // Casting to floating pt |
| 837 | if (SrcTy->isIntegral()) { // Casting from integral |
| 838 | if (SrcTy->isSigned()) |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 839 | opcode = "sitofp"; // sint -> FP |
| 840 | else |
| 841 | opcode = "uitofp"; // uint -> FP |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 842 | } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 843 | if (DstBits < SrcBits) { |
| 844 | opcode = "fptrunc"; // FP -> smaller FP |
| 845 | } else if (DstBits > SrcBits) { |
| 846 | opcode = "fpext"; // FP -> larger FP |
| 847 | } else { |
| 848 | opcode ="bitcast"; // same size, no-op cast |
| 849 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 850 | } else if (SrcTy->isPacked()) { |
| 851 | assert(DstBits == SrcTy->getBitWidth() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 852 | "Casting packed to floating point of different width"); |
| 853 | opcode = "bitcast"; // same size, no-op cast |
| 854 | } else { |
| 855 | assert(0 && "Casting pointer or non-first class to float"); |
| 856 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 857 | } else if (DstTy->isPacked()) { |
| 858 | if (SrcTy->isPacked()) { |
| 859 | assert(DstTy->getBitWidth() == SrcTy->getBitWidth() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 860 | "Casting packed to packed of different widths"); |
| 861 | opcode = "bitcast"; // packed -> packed |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 862 | } else if (DstTy->getBitWidth() == SrcBits) { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 863 | opcode = "bitcast"; // float/int -> packed |
| 864 | } else { |
| 865 | assert(!"Illegal cast to packed (wrong type or size)"); |
| 866 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 867 | } else if (DstTy->isPointer()) { |
| 868 | if (SrcTy->isPointer()) { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 869 | opcode = "bitcast"; // ptr -> ptr |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 870 | } else if (SrcTy->isIntegral()) { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 871 | opcode = "inttoptr"; // int -> ptr |
| 872 | } else { |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 873 | assert(!"Casting invalid type to pointer"); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 874 | } |
| 875 | } else { |
| 876 | assert(!"Casting to type that is not first-class"); |
| 877 | } |
| 878 | return opcode; |
| 879 | } |
| 880 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 881 | static std::string getCastUpgrade(const std::string& Src, const TypeInfo* SrcTy, |
| 882 | const TypeInfo* DstTy, bool isConst) |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 883 | { |
| 884 | std::string Result; |
| 885 | std::string Source = Src; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 886 | if (SrcTy->isFloatingPoint() && DstTy->isPointer()) { |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 887 | // fp -> ptr cast is no longer supported but we must upgrade this |
| 888 | // by doing a double cast: fp -> int -> ptr |
| 889 | if (isConst) |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 890 | Source = "i64 fptoui(" + Source + " to i64)"; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 891 | else { |
Reid Spencer | f459d39 | 2006-12-02 16:19:52 +0000 | [diff] [blame] | 892 | *O << " %cast_upgrade" << unique << " = fptoui " << Source |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 893 | << " to i64\n"; |
| 894 | Source = "i64 %cast_upgrade" + llvm::utostr(unique); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 895 | } |
| 896 | // Update the SrcTy for the getCastOpcode call below |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 897 | SrcTy = TypeInfo::get("i64", ULongTy); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 898 | } else if (DstTy->isBool()) { |
| 899 | // cast type %x to bool was previously defined as setne type %x, null |
| 900 | // The cast semantic is now to truncate, not compare so we must retain |
| 901 | // the original intent by replacing the cast with a setne |
| 902 | const char* comparator = SrcTy->isPointer() ? ", null" : |
| 903 | (SrcTy->isFloatingPoint() ? ", 0.0" : |
| 904 | (SrcTy->isBool() ? ", false" : ", 0")); |
| 905 | const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne "; |
Reid Spencer | 187ccf8 | 2006-12-09 16:57:22 +0000 | [diff] [blame] | 906 | if (isConst) { |
| 907 | Result = "(" + Source + comparator + ")"; |
| 908 | Result = compareOp + Result; |
| 909 | } else |
| 910 | Result = compareOp + Source + comparator; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 911 | return Result; // skip cast processing below |
| 912 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 913 | SrcTy = SrcTy->resolve(); |
| 914 | DstTy = DstTy->resolve(); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 915 | std::string Opcode(getCastOpcode(Source, SrcTy, DstTy)); |
| 916 | if (isConst) |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 917 | Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")"; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 918 | else |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 919 | Result += Opcode + " " + Source + " to " + DstTy->getNewTy(); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 920 | return Result; |
| 921 | } |
| 922 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 923 | const char* getDivRemOpcode(const std::string& opcode, const TypeInfo* TI) { |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 924 | const char* op = opcode.c_str(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 925 | const TypeInfo* Ty = TI->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 926 | if (Ty->isPacked()) |
| 927 | Ty = Ty->getElementType(); |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 928 | if (opcode == "div") |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 929 | if (Ty->isFloatingPoint()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 930 | op = "fdiv"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 931 | else if (Ty->isUnsigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 932 | op = "udiv"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 933 | else if (Ty->isSigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 934 | op = "sdiv"; |
| 935 | else |
| 936 | yyerror("Invalid type for div instruction"); |
| 937 | else if (opcode == "rem") |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 938 | if (Ty->isFloatingPoint()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 939 | op = "frem"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 940 | else if (Ty->isUnsigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 941 | op = "urem"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 942 | else if (Ty->isSigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 943 | op = "srem"; |
| 944 | else |
| 945 | yyerror("Invalid type for rem instruction"); |
| 946 | return op; |
| 947 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 948 | |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 949 | std::string |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 950 | getCompareOp(const std::string& setcc, const TypeInfo* TI) { |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 951 | assert(setcc.length() == 5); |
| 952 | char cc1 = setcc[3]; |
| 953 | char cc2 = setcc[4]; |
| 954 | assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g'); |
| 955 | assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't'); |
| 956 | std::string result("xcmp xxx"); |
| 957 | result[6] = cc1; |
| 958 | result[7] = cc2; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 959 | if (TI->isFloatingPoint()) { |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 960 | result[0] = 'f'; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 961 | result[5] = 'o'; |
Reid Spencer | f0cf132 | 2006-12-07 04:23:03 +0000 | [diff] [blame] | 962 | if (cc1 == 'n') |
| 963 | result[5] = 'u'; // NE maps to unordered |
| 964 | else |
| 965 | result[5] = 'o'; // everything else maps to ordered |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 966 | } else if (TI->isIntegral() || TI->isPointer()) { |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 967 | result[0] = 'i'; |
| 968 | if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e')) |
| 969 | result.erase(5,1); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 970 | else if (TI->isSigned()) |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 971 | result[5] = 's'; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 972 | else if (TI->isUnsigned() || TI->isPointer() || TI->isBool()) |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 973 | result[5] = 'u'; |
| 974 | else |
| 975 | yyerror("Invalid integral type for setcc"); |
| 976 | } |
| 977 | return result; |
| 978 | } |
| 979 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 980 | static const TypeInfo* getFunctionReturnType(const TypeInfo* PFTy) { |
| 981 | PFTy = PFTy->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 982 | if (PFTy->isPointer()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 983 | const TypeInfo* ElemTy = PFTy->getElementType(); |
| 984 | ElemTy = ElemTy->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 985 | if (ElemTy->isFunction()) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 986 | return ElemTy->getResultType(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 987 | } else if (PFTy->isFunction()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 988 | return PFTy->getResultType(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 989 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 990 | return PFTy; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 991 | } |
| 992 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 993 | static const TypeInfo* ResolveUpReference(const TypeInfo* Ty, |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 994 | TypeInfo::UpRefStack* stack) { |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 995 | assert(Ty->isUpReference() && "Can't resolve a non-upreference"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 996 | unsigned upref = Ty->getUpRefNum(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 997 | assert(upref < stack->size() && "Invalid up reference"); |
| 998 | return (*stack)[upref - stack->size() - 1]; |
| 999 | } |
| 1000 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1001 | static const TypeInfo* getGEPIndexedType(const TypeInfo* PTy, ValueList* idxs) { |
| 1002 | const TypeInfo* Result = PTy = PTy->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1003 | assert(PTy->isPointer() && "GEP Operand is not a pointer?"); |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1004 | TypeInfo::UpRefStack stack; |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1005 | for (unsigned i = 0; i < idxs->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1006 | if (Result->isComposite()) { |
| 1007 | Result = Result->getIndexedType((*idxs)[i]); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1008 | Result = Result->resolve(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1009 | stack.push_back(Result); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1010 | } else |
| 1011 | yyerror("Invalid type for index"); |
| 1012 | } |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1013 | // Resolve upreferences so we can return a more natural type |
| 1014 | if (Result->isPointer()) { |
| 1015 | if (Result->getElementType()->isUpReference()) { |
| 1016 | stack.push_back(Result); |
| 1017 | Result = ResolveUpReference(Result->getElementType(), &stack); |
| 1018 | } |
| 1019 | } else if (Result->isUpReference()) { |
| 1020 | Result = ResolveUpReference(Result->getElementType(), &stack); |
| 1021 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1022 | return Result->getPointerType(); |
| 1023 | } |
| 1024 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1025 | |
| 1026 | // This function handles appending .u or .s to integer value names that |
| 1027 | // were previously unsigned or signed, respectively. This avoids name |
| 1028 | // collisions since the unsigned and signed type planes have collapsed |
| 1029 | // into a single signless type plane. |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1030 | static std::string getUniqueName(const std::string *Name, const TypeInfo* Ty, |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1031 | bool isGlobal = false, bool isDef = false) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1032 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1033 | // If its not a symbolic name, don't modify it, probably a constant val. |
| 1034 | if ((*Name)[0] != '%' && (*Name)[0] != '"') |
| 1035 | return *Name; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1036 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1037 | // If its a numeric reference, just leave it alone. |
| 1038 | if (isdigit((*Name)[1])) |
| 1039 | return *Name; |
| 1040 | |
| 1041 | // Resolve the type |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1042 | Ty = Ty->resolve(); |
| 1043 | |
| 1044 | // If its a global name, get its uniquified name, if any |
| 1045 | GlobalsTypeMap::iterator GI = Globals.find(*Name); |
| 1046 | if (GI != Globals.end()) { |
| 1047 | TypePlaneMap::iterator TPI = GI->second.begin(); |
| 1048 | TypePlaneMap::iterator TPE = GI->second.end(); |
| 1049 | for ( ; TPI != TPE ; ++TPI) { |
| 1050 | if (TPI->first->sameNewTyAs(Ty)) |
| 1051 | return TPI->second; |
| 1052 | } |
| 1053 | } |
| 1054 | |
| 1055 | if (isGlobal) { |
| 1056 | // We didn't find a global name, but if its supposed to be global then all |
| 1057 | // we can do is return the name. This is probably a forward reference of a |
| 1058 | // global value that hasn't been defined yet. Since we have no definition |
| 1059 | // we don't know its linkage class. Just assume its an external and the name |
| 1060 | // shouldn't change. |
| 1061 | return *Name; |
| 1062 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1063 | |
| 1064 | // Default the result to the current name |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1065 | std::string Result = Ty->makeUniqueName(*Name); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1066 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1067 | return Result; |
| 1068 | } |
| 1069 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1070 | static unsigned UniqueNameCounter = 0; |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 1071 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1072 | std::string getGlobalName(const std::string* Name, const std::string Linkage, |
| 1073 | const TypeInfo* Ty, bool isConstant) { |
| 1074 | // Default to given name |
| 1075 | std::string Result = *Name; |
| 1076 | // Look up the name in the Globals Map |
| 1077 | GlobalsTypeMap::iterator GI = Globals.find(*Name); |
| 1078 | // Did we see this global name before? |
| 1079 | if (GI != Globals.end()) { |
| 1080 | if (Ty->isUnresolvedDeep()) { |
| 1081 | // The Gval's type is unresolved. Consequently, we can't disambiguate it |
| 1082 | // by type. We'll just change its name and emit a warning. |
| 1083 | warning("Cannot disambiguate global value '" + *Name + |
| 1084 | "' because type '" + Ty->getNewTy() + "'is unresolved.\n"); |
| 1085 | Result = *Name + ".unique"; |
| 1086 | UniqueNameCounter++; |
| 1087 | Result += llvm::utostr(UniqueNameCounter); |
| 1088 | return Result; |
| 1089 | } else { |
| 1090 | TypePlaneMap::iterator TPI = GI->second.find(Ty); |
| 1091 | if (TPI != GI->second.end()) { |
| 1092 | // We found an existing name of the same old type. This isn't allowed |
| 1093 | // in LLVM 2.0. Consequently, we must alter the name of the global so it |
| 1094 | // can at least compile. References to the global will yield the first |
| 1095 | // definition, which is okay. We also must warn about this. |
| 1096 | Result = *Name + ".unique"; |
| 1097 | UniqueNameCounter++; |
| 1098 | Result += llvm::utostr(UniqueNameCounter); |
| 1099 | warning(std::string("Global variable '") + *Name + "' was renamed to '"+ |
| 1100 | Result + "'"); |
| 1101 | } else { |
| 1102 | // There isn't an existing definition for this name according to the |
| 1103 | // old types. Now search the TypePlanMap for types with the same new |
| 1104 | // name. |
| 1105 | TypePlaneMap::iterator TPI = GI->second.begin(); |
| 1106 | TypePlaneMap::iterator TPE = GI->second.end(); |
| 1107 | for ( ; TPI != TPE; ++TPI) { |
| 1108 | if (TPI->first->sameNewTyAs(Ty)) { |
| 1109 | // The new types are the same but the old types are different so |
| 1110 | // this is a global name collision resulting from type planes |
| 1111 | // collapsing. |
| 1112 | if (Linkage == "external" || Linkage == "dllimport" || |
| 1113 | Linkage == "extern_weak" || Linkage == "") { |
| 1114 | // The linkage of this gval is external so we can't reliably |
| 1115 | // rename it because it could potentially create a linking |
| 1116 | // problem. However, we can't leave the name conflict in the |
| 1117 | // output either or it won't assemble with LLVM 2.0. So, all we |
| 1118 | // can do is rename this one to something unique and emit a |
| 1119 | // warning about the problem. |
| 1120 | Result = *Name + ".unique"; |
| 1121 | UniqueNameCounter++; |
| 1122 | Result += llvm::utostr(UniqueNameCounter); |
| 1123 | warning("Renaming global value '" + *Name + "' to '" + Result + |
| 1124 | "' may cause linkage errors."); |
| 1125 | return Result; |
| 1126 | } else { |
| 1127 | // Its linkage is internal and its type is known so we can |
| 1128 | // disambiguate the name collision successfully based on the type. |
| 1129 | Result = getUniqueName(Name, Ty); |
| 1130 | TPI->second = Result; |
| 1131 | return Result; |
| 1132 | } |
| 1133 | } |
| 1134 | } |
| 1135 | // We didn't find an entry in the type plane with the same new type and |
| 1136 | // the old types differ so this is a new type plane for this global |
| 1137 | // variable. We just fall through to the logic below which inserts |
| 1138 | // the global. |
| 1139 | } |
| 1140 | } |
| 1141 | } |
| 1142 | |
| 1143 | // Its a new global name, if it is external we can't change it |
| 1144 | if (isConstant || Linkage == "external" || Linkage == "dllimport" || |
| 1145 | Linkage == "extern_weak" || Linkage == "") { |
| 1146 | Globals[Result][Ty] = Result; |
| 1147 | return Result; |
| 1148 | } |
| 1149 | |
| 1150 | // Its a new global name, and it is internal, change the name to make it |
| 1151 | // unique for its type. |
| 1152 | // Result = getUniqueName(Name, Ty); |
| 1153 | Globals[*Name][Ty] = Result; |
| 1154 | return Result; |
| 1155 | } |
| 1156 | |
| 1157 | |
| 1158 | /* Enabling traces. */ |
| 1159 | #ifndef YYDEBUG |
| 1160 | # define YYDEBUG 0 |
| 1161 | #endif |
| 1162 | |
| 1163 | /* Enabling verbose error messages. */ |
| 1164 | #ifdef YYERROR_VERBOSE |
| 1165 | # undef YYERROR_VERBOSE |
| 1166 | # define YYERROR_VERBOSE 1 |
| 1167 | #else |
| 1168 | # define YYERROR_VERBOSE 0 |
| 1169 | #endif |
| 1170 | |
| 1171 | /* Enabling the token table. */ |
| 1172 | #ifndef YYTOKEN_TABLE |
| 1173 | # define YYTOKEN_TABLE 0 |
| 1174 | #endif |
| 1175 | |
| 1176 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1177 | #line 802 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1178 | typedef union YYSTYPE { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1179 | std::string* String; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1180 | const TypeInfo* Type; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1181 | ValueInfo Value; |
| 1182 | ConstInfo Const; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 1183 | ValueList* ValList; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1184 | TypeList* TypeVec; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1185 | } YYSTYPE; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1186 | /* Line 196 of yacc.c. */ |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1187 | #line 1188 "UpgradeParser.tab.c" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1188 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1189 | # define YYSTYPE_IS_DECLARED 1 |
| 1190 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1191 | #endif |
| 1192 | |
| 1193 | |
| 1194 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1195 | /* Copy the second part of user declarations. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1196 | |
| 1197 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1198 | /* Line 219 of yacc.c. */ |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1199 | #line 1200 "UpgradeParser.tab.c" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1200 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1201 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1202 | # define YYSIZE_T __SIZE_TYPE__ |
| 1203 | #endif |
| 1204 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1205 | # define YYSIZE_T size_t |
| 1206 | #endif |
| 1207 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1208 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1209 | # define YYSIZE_T size_t |
| 1210 | #endif |
| 1211 | #if ! defined (YYSIZE_T) |
| 1212 | # define YYSIZE_T unsigned int |
| 1213 | #endif |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1214 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1215 | #ifndef YY_ |
| 1216 | # if YYENABLE_NLS |
| 1217 | # if ENABLE_NLS |
| 1218 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1219 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1220 | # endif |
| 1221 | # endif |
| 1222 | # ifndef YY_ |
| 1223 | # define YY_(msgid) msgid |
| 1224 | # endif |
| 1225 | #endif |
| 1226 | |
| 1227 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1228 | |
| 1229 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1230 | |
| 1231 | # ifdef YYSTACK_USE_ALLOCA |
| 1232 | # if YYSTACK_USE_ALLOCA |
| 1233 | # ifdef __GNUC__ |
| 1234 | # define YYSTACK_ALLOC __builtin_alloca |
| 1235 | # else |
| 1236 | # define YYSTACK_ALLOC alloca |
| 1237 | # if defined (__STDC__) || defined (__cplusplus) |
| 1238 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1239 | # define YYINCLUDED_STDLIB_H |
| 1240 | # endif |
| 1241 | # endif |
| 1242 | # endif |
| 1243 | # endif |
| 1244 | |
| 1245 | # ifdef YYSTACK_ALLOC |
| 1246 | /* Pacify GCC's `empty if-body' warning. */ |
| 1247 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1248 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1249 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1250 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1251 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1252 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1253 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1254 | # endif |
| 1255 | # else |
| 1256 | # define YYSTACK_ALLOC YYMALLOC |
| 1257 | # define YYSTACK_FREE YYFREE |
| 1258 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1259 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1260 | # endif |
| 1261 | # ifdef __cplusplus |
| 1262 | extern "C" { |
| 1263 | # endif |
| 1264 | # ifndef YYMALLOC |
| 1265 | # define YYMALLOC malloc |
| 1266 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1267 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1268 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1269 | # endif |
| 1270 | # endif |
| 1271 | # ifndef YYFREE |
| 1272 | # define YYFREE free |
| 1273 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1274 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1275 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1276 | # endif |
| 1277 | # endif |
| 1278 | # ifdef __cplusplus |
| 1279 | } |
| 1280 | # endif |
| 1281 | # endif |
| 1282 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1283 | |
| 1284 | |
| 1285 | #if (! defined (yyoverflow) \ |
| 1286 | && (! defined (__cplusplus) \ |
| 1287 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1288 | |
| 1289 | /* A type that is properly aligned for any stack member. */ |
| 1290 | union yyalloc |
| 1291 | { |
| 1292 | short int yyss; |
| 1293 | YYSTYPE yyvs; |
| 1294 | }; |
| 1295 | |
| 1296 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1297 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1298 | |
| 1299 | /* The size of an array large to enough to hold all stacks, each with |
| 1300 | N elements. */ |
| 1301 | # define YYSTACK_BYTES(N) \ |
| 1302 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1303 | + YYSTACK_GAP_MAXIMUM) |
| 1304 | |
| 1305 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1306 | not overlap. */ |
| 1307 | # ifndef YYCOPY |
| 1308 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1309 | # define YYCOPY(To, From, Count) \ |
| 1310 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1311 | # else |
| 1312 | # define YYCOPY(To, From, Count) \ |
| 1313 | do \ |
| 1314 | { \ |
| 1315 | YYSIZE_T yyi; \ |
| 1316 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1317 | (To)[yyi] = (From)[yyi]; \ |
| 1318 | } \ |
| 1319 | while (0) |
| 1320 | # endif |
| 1321 | # endif |
| 1322 | |
| 1323 | /* Relocate STACK from its old location to the new one. The |
| 1324 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1325 | elements in the stack, and YYPTR gives the new location of the |
| 1326 | stack. Advance YYPTR to a properly aligned location for the next |
| 1327 | stack. */ |
| 1328 | # define YYSTACK_RELOCATE(Stack) \ |
| 1329 | do \ |
| 1330 | { \ |
| 1331 | YYSIZE_T yynewbytes; \ |
| 1332 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1333 | Stack = &yyptr->Stack; \ |
| 1334 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1335 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1336 | } \ |
| 1337 | while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1338 | |
| 1339 | #endif |
| 1340 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1341 | #if defined (__STDC__) || defined (__cplusplus) |
| 1342 | typedef signed char yysigned_char; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1343 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1344 | typedef short int yysigned_char; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1345 | #endif |
| 1346 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1347 | /* YYFINAL -- State number of the termination state. */ |
| 1348 | #define YYFINAL 4 |
| 1349 | /* YYLAST -- Last index in YYTABLE. */ |
| 1350 | #define YYLAST 1486 |
| 1351 | |
| 1352 | /* YYNTOKENS -- Number of terminals. */ |
| 1353 | #define YYNTOKENS 165 |
| 1354 | /* YYNNTS -- Number of nonterminals. */ |
| 1355 | #define YYNNTS 75 |
| 1356 | /* YYNRULES -- Number of rules. */ |
| 1357 | #define YYNRULES 301 |
| 1358 | /* YYNRULES -- Number of states. */ |
| 1359 | #define YYNSTATES 586 |
| 1360 | |
| 1361 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1362 | #define YYUNDEFTOK 2 |
| 1363 | #define YYMAXUTOK 405 |
| 1364 | |
| 1365 | #define YYTRANSLATE(YYX) \ |
| 1366 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1367 | |
| 1368 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1369 | static const unsigned char yytranslate[] = |
| 1370 | { |
| 1371 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1372 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1373 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1374 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1375 | 154, 155, 163, 2, 152, 2, 2, 2, 2, 2, |
| 1376 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1377 | 159, 151, 160, 2, 2, 2, 2, 2, 2, 2, |
| 1378 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1379 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1380 | 2, 156, 153, 158, 2, 2, 2, 2, 2, 164, |
| 1381 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1382 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1383 | 157, 2, 2, 161, 2, 162, 2, 2, 2, 2, |
| 1384 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1385 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1386 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1387 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1388 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1389 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1390 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1391 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1392 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1393 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1394 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1395 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1396 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1397 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1398 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1399 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1400 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1401 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1402 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1403 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1404 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1405 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1406 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1407 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1408 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1409 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1410 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
| 1411 | 145, 146, 147, 148, 149, 150 |
| 1412 | }; |
| 1413 | |
| 1414 | #if YYDEBUG |
| 1415 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1416 | YYRHS. */ |
| 1417 | static const unsigned short int yyprhs[] = |
| 1418 | { |
| 1419 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1420 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1421 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1422 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1423 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1424 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1425 | 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, |
| 1426 | 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, |
| 1427 | 159, 161, 164, 165, 167, 169, 171, 173, 175, 177, |
| 1428 | 179, 180, 182, 184, 186, 188, 190, 192, 195, 196, |
| 1429 | 197, 200, 201, 205, 208, 209, 211, 212, 216, 218, |
| 1430 | 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, |
| 1431 | 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, |
| 1432 | 261, 264, 269, 275, 281, 285, 288, 294, 299, 302, |
| 1433 | 304, 308, 310, 314, 316, 317, 322, 326, 330, 335, |
| 1434 | 340, 344, 347, 350, 353, 356, 359, 362, 365, 368, |
| 1435 | 371, 374, 381, 387, 396, 403, 410, 417, 425, 433, |
| 1436 | 440, 447, 456, 465, 469, 471, 473, 475, 477, 480, |
| 1437 | 483, 488, 491, 493, 495, 497, 502, 505, 510, 517, |
| 1438 | 524, 531, 538, 542, 547, 548, 550, 552, 554, 558, |
| 1439 | 562, 566, 570, 574, 578, 580, 581, 583, 585, 587, |
| 1440 | 588, 591, 595, 597, 599, 603, 605, 606, 615, 617, |
| 1441 | 619, 623, 625, 627, 631, 632, 634, 636, 640, 641, |
| 1442 | 643, 645, 647, 649, 651, 653, 655, 657, 659, 663, |
| 1443 | 665, 671, 673, 675, 677, 679, 682, 685, 687, 690, |
| 1444 | 693, 694, 696, 698, 700, 703, 706, 710, 720, 730, |
| 1445 | 739, 754, 756, 758, 765, 771, 774, 781, 789, 791, |
| 1446 | 795, 797, 798, 801, 803, 809, 815, 821, 828, 835, |
| 1447 | 838, 843, 848, 855, 860, 865, 872, 879, 882, 890, |
| 1448 | 892, 895, 896, 898, 899, 903, 910, 914, 921, 924, |
| 1449 | 929, 936 |
| 1450 | }; |
| 1451 | |
| 1452 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1453 | static const short int yyrhs[] = |
| 1454 | { |
| 1455 | 199, 0, -1, 19, -1, 20, -1, 17, -1, 18, |
| 1456 | -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, |
| 1457 | -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, |
| 1458 | -1, 90, -1, 91, -1, 92, -1, 93, -1, 94, |
| 1459 | -1, 95, -1, 96, -1, 97, -1, 98, -1, 99, |
| 1460 | -1, 102, -1, 103, -1, 104, -1, 105, -1, 106, |
| 1461 | -1, 107, -1, 118, -1, 119, -1, 120, -1, 121, |
| 1462 | -1, 108, -1, 109, -1, 110, -1, 111, -1, 112, |
| 1463 | -1, 113, -1, 114, -1, 115, -1, 116, -1, 117, |
| 1464 | -1, 118, -1, 119, -1, 120, -1, 121, -1, 25, |
| 1465 | -1, 26, -1, 130, -1, 131, -1, 132, -1, 133, |
| 1466 | -1, 139, -1, 140, -1, 141, -1, 142, -1, 143, |
| 1467 | -1, 144, -1, 145, -1, 146, -1, 147, -1, 148, |
| 1468 | -1, 149, -1, 150, -1, 138, -1, 11, -1, 9, |
| 1469 | -1, 7, -1, 5, -1, 12, -1, 10, -1, 8, |
| 1470 | -1, 6, -1, 175, -1, 176, -1, 13, -1, 14, |
| 1471 | -1, 208, 151, -1, -1, 42, -1, 43, -1, 44, |
| 1472 | -1, 48, -1, 45, -1, 46, -1, 47, -1, -1, |
| 1473 | 66, -1, 67, -1, 68, -1, 69, -1, 70, -1, |
| 1474 | 71, -1, 65, 18, -1, -1, -1, 57, 18, -1, |
| 1475 | -1, 152, 57, 18, -1, 37, 30, -1, -1, 184, |
| 1476 | -1, -1, 152, 187, 186, -1, 184, -1, 57, 18, |
| 1477 | -1, 190, -1, 3, -1, 192, -1, 3, -1, 192, |
| 1478 | -1, 4, -1, 5, -1, 6, -1, 7, -1, 8, |
| 1479 | -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, |
| 1480 | -1, 14, -1, 15, -1, 16, -1, 222, -1, 191, |
| 1481 | -1, 153, 18, -1, 189, 154, 194, 155, -1, 156, |
| 1482 | 18, 157, 192, 158, -1, 159, 18, 157, 192, 160, |
| 1483 | -1, 161, 193, 162, -1, 161, 162, -1, 159, 161, |
| 1484 | 193, 162, 160, -1, 159, 161, 162, 160, -1, 192, |
| 1485 | 163, -1, 192, -1, 193, 152, 192, -1, 193, -1, |
| 1486 | 193, 152, 40, -1, 40, -1, -1, 190, 156, 197, |
| 1487 | 158, -1, 190, 156, 158, -1, 190, 164, 30, -1, |
| 1488 | 190, 159, 197, 160, -1, 190, 161, 197, 162, -1, |
| 1489 | 190, 161, 162, -1, 190, 22, -1, 190, 23, -1, |
| 1490 | 190, 222, -1, 190, 196, -1, 190, 24, -1, 175, |
| 1491 | 167, -1, 176, 167, -1, 4, 25, -1, 4, 26, |
| 1492 | -1, 178, 21, -1, 174, 154, 195, 39, 190, 155, |
| 1493 | -1, 127, 154, 195, 237, 155, -1, 129, 154, 195, |
| 1494 | 152, 195, 152, 195, 155, -1, 168, 154, 195, 152, |
| 1495 | 195, 155, -1, 169, 154, 195, 152, 195, 155, -1, |
| 1496 | 170, 154, 195, 152, 195, 155, -1, 100, 171, 154, |
| 1497 | 195, 152, 195, 155, -1, 101, 172, 154, 195, 152, |
| 1498 | 195, 155, -1, 173, 154, 195, 152, 195, 155, -1, |
| 1499 | 135, 154, 195, 152, 195, 155, -1, 136, 154, 195, |
| 1500 | 152, 195, 152, 195, 155, -1, 137, 154, 195, 152, |
| 1501 | 195, 152, 195, 155, -1, 197, 152, 195, -1, 195, |
| 1502 | -1, 35, -1, 36, -1, 200, -1, 200, 217, -1, |
| 1503 | 200, 219, -1, 200, 63, 62, 203, -1, 200, 31, |
| 1504 | -1, 202, -1, 50, -1, 58, -1, 202, 179, 27, |
| 1505 | 188, -1, 202, 219, -1, 202, 63, 62, 203, -1, |
| 1506 | 202, 179, 180, 198, 195, 186, -1, 202, 179, 201, |
| 1507 | 198, 190, 186, -1, 202, 179, 45, 198, 190, 186, |
| 1508 | -1, 202, 179, 47, 198, 190, 186, -1, 202, 51, |
| 1509 | 205, -1, 202, 59, 151, 206, -1, -1, 30, -1, |
| 1510 | 56, -1, 55, -1, 53, 151, 204, -1, 54, 151, |
| 1511 | 18, -1, 52, 151, 30, -1, 72, 151, 30, -1, |
| 1512 | 156, 207, 158, -1, 207, 152, 30, -1, 30, -1, |
| 1513 | -1, 28, -1, 30, -1, 208, -1, -1, 190, 209, |
| 1514 | -1, 211, 152, 210, -1, 210, -1, 211, -1, 211, |
| 1515 | 152, 40, -1, 40, -1, -1, 181, 188, 208, 154, |
| 1516 | 212, 155, 185, 182, -1, 32, -1, 161, -1, 180, |
| 1517 | 213, 214, -1, 33, -1, 162, -1, 215, 225, 216, |
| 1518 | -1, -1, 45, -1, 47, -1, 34, 218, 213, -1, |
| 1519 | -1, 64, -1, 17, -1, 18, -1, 21, -1, 25, |
| 1520 | -1, 26, -1, 22, -1, 23, -1, 24, -1, 159, |
| 1521 | 197, 160, -1, 196, -1, 62, 220, 30, 152, 30, |
| 1522 | -1, 166, -1, 208, -1, 222, -1, 221, -1, 190, |
| 1523 | 223, -1, 225, 226, -1, 226, -1, 227, 229, -1, |
| 1524 | 227, 231, -1, -1, 29, -1, 78, -1, 77, -1, |
| 1525 | 73, 224, -1, 73, 3, -1, 74, 15, 223, -1, |
| 1526 | 74, 4, 223, 152, 15, 223, 152, 15, 223, -1, |
| 1527 | 75, 177, 223, 152, 15, 223, 156, 230, 158, -1, |
| 1528 | 75, 177, 223, 152, 15, 223, 156, 158, -1, 179, |
| 1529 | 76, 181, 188, 223, 154, 234, 155, 39, 15, 223, |
| 1530 | 228, 15, 223, -1, 228, -1, 79, -1, 230, 177, |
| 1531 | 221, 152, 15, 223, -1, 177, 221, 152, 15, 223, |
| 1532 | -1, 179, 236, -1, 190, 156, 223, 152, 223, 158, |
| 1533 | -1, 232, 152, 156, 223, 152, 223, 158, -1, 224, |
| 1534 | -1, 233, 152, 224, -1, 233, -1, -1, 61, 60, |
| 1535 | -1, 60, -1, 168, 190, 223, 152, 223, -1, 169, |
| 1536 | 190, 223, 152, 223, -1, 170, 190, 223, 152, 223, |
| 1537 | -1, 100, 171, 190, 223, 152, 223, -1, 101, 172, |
| 1538 | 190, 223, 152, 223, -1, 49, 224, -1, 173, 224, |
| 1539 | 152, 224, -1, 174, 224, 39, 190, -1, 129, 224, |
| 1540 | 152, 224, 152, 224, -1, 134, 224, 152, 190, -1, |
| 1541 | 135, 224, 152, 224, -1, 136, 224, 152, 224, 152, |
| 1542 | 224, -1, 137, 224, 152, 224, 152, 224, -1, 128, |
| 1543 | 232, -1, 235, 181, 188, 223, 154, 234, 155, -1, |
| 1544 | 239, -1, 152, 233, -1, -1, 38, -1, -1, 122, |
| 1545 | 190, 183, -1, 122, 190, 152, 10, 223, 183, -1, |
| 1546 | 123, 190, 183, -1, 123, 190, 152, 10, 223, 183, |
| 1547 | -1, 124, 224, -1, 238, 125, 190, 223, -1, 238, |
| 1548 | 126, 224, 152, 190, 223, -1, 127, 190, 223, 237, |
| 1549 | -1 |
| 1550 | }; |
| 1551 | |
| 1552 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1553 | static const unsigned short int yyrline[] = |
| 1554 | { |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1555 | 0, 867, 867, 867, 868, 868, 872, 872, 872, 872, |
| 1556 | 872, 872, 872, 873, 873, 873, 873, 874, 874, 874, |
| 1557 | 875, 875, 875, 875, 875, 875, 876, 876, 876, 876, |
| 1558 | 876, 876, 876, 876, 876, 876, 877, 877, 877, 877, |
| 1559 | 877, 877, 877, 877, 877, 877, 878, 878, 878, 878, |
| 1560 | 878, 878, 879, 879, 879, 879, 880, 880, 880, 880, |
| 1561 | 880, 880, 880, 881, 881, 881, 881, 881, 881, 886, |
| 1562 | 886, 886, 886, 887, 887, 887, 887, 888, 888, 889, |
| 1563 | 889, 892, 895, 900, 900, 900, 900, 900, 900, 901, |
| 1564 | 902, 905, 905, 905, 905, 905, 906, 907, 912, 917, |
| 1565 | 918, 921, 922, 930, 936, 937, 940, 941, 950, 951, |
| 1566 | 964, 964, 965, 965, 966, 970, 970, 970, 970, 970, |
| 1567 | 970, 970, 971, 971, 971, 971, 971, 973, 976, 979, |
| 1568 | 982, 986, 999, 1005, 1011, 1021, 1024, 1034, 1037, 1045, |
| 1569 | 1049, 1056, 1057, 1062, 1067, 1077, 1083, 1088, 1094, 1100, |
| 1570 | 1106, 1111, 1117, 1123, 1130, 1136, 1142, 1148, 1154, 1160, |
| 1571 | 1166, 1174, 1188, 1200, 1205, 1211, 1216, 1222, 1227, 1232, |
| 1572 | 1240, 1245, 1250, 1260, 1265, 1270, 1270, 1280, 1285, 1288, |
| 1573 | 1293, 1297, 1301, 1303, 1303, 1306, 1316, 1321, 1326, 1336, |
| 1574 | 1346, 1356, 1366, 1371, 1376, 1381, 1383, 1383, 1386, 1391, |
| 1575 | 1398, 1403, 1410, 1417, 1422, 1423, 1431, 1431, 1432, 1432, |
| 1576 | 1434, 1443, 1447, 1451, 1454, 1459, 1462, 1465, 1483, 1484, |
| 1577 | 1487, 1498, 1499, 1501, 1510, 1511, 1512, 1516, 1529, 1530, |
| 1578 | 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1534, 1535, 1540, |
| 1579 | 1541, 1550, 1550, 1554, 1559, 1569, 1578, 1581, 1589, 1593, |
| 1580 | 1598, 1601, 1607, 1607, 1609, 1614, 1619, 1624, 1632, 1640, |
| 1581 | 1647, 1669, 1674, 1680, 1686, 1694, 1712, 1720, 1729, 1733, |
| 1582 | 1740, 1741, 1745, 1750, 1753, 1762, 1770, 1779, 1787, 1795, |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 1583 | 1800, 1809, 1837, 1843, 1849, 1856, 1862, 1868, 1874, 1902, |
| 1584 | 1907, 1908, 1912, 1913, 1916, 1924, 1933, 1941, 1950, 1956, |
| 1585 | 1965, 1974 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1586 | }; |
| 1587 | #endif |
| 1588 | |
| 1589 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1590 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1591 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1592 | static const char *const yytname[] = |
| 1593 | { |
| 1594 | "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE", |
| 1595 | "SHORT", "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", |
| 1596 | "LABEL", "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL", |
| 1597 | "FPVAL", "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK", |
| 1598 | "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", |
| 1599 | "BEGINTOK", "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION", |
| 1600 | "VOLATILE", "TO", "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK", |
| 1601 | "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "NOT", "EXTERNAL", |
| 1602 | "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", |
| 1603 | "UNINITIALIZED", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", |
| 1604 | "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", |
| 1605 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1606 | "RET", "BR", "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE", |
| 1607 | "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM", |
| 1608 | "SREM", "FREM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", |
| 1609 | "SETEQ", "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", |
| 1610 | "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", |
| 1611 | "ULT", "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", |
| 1612 | "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR", |
| 1613 | "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST", |
| 1614 | "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI", |
| 1615 | "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','", |
| 1616 | "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", |
| 1617 | "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps", |
| 1618 | "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps", |
| 1619 | "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign", |
| 1620 | "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", |
| 1621 | "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", |
| 1622 | "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI", |
| 1623 | "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType", |
| 1624 | "Module", "DefinitionList", "External", "ConstPool", "AsmBlock", |
| 1625 | "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList", |
| 1626 | "Name", "OptName", "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", |
| 1627 | "BEGIN", "FunctionHeader", "END", "Function", "FnDeclareLinkage", |
| 1628 | "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", |
| 1629 | "ValueRef", "ResolvedVal", "BasicBlockList", "BasicBlock", |
| 1630 | "InstructionList", "Unwind", "BBTerminatorInst", "JumpTable", "Inst", |
| 1631 | "PHIList", "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", |
| 1632 | "IndexList", "OptVolatile", "MemoryInst", 0 |
| 1633 | }; |
| 1634 | #endif |
| 1635 | |
| 1636 | # ifdef YYPRINT |
| 1637 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1638 | token YYLEX-NUM. */ |
| 1639 | static const unsigned short int yytoknum[] = |
| 1640 | { |
| 1641 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1642 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1643 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1644 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1645 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1646 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1647 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1648 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1649 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1650 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1651 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1652 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1653 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1654 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1655 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
| 1656 | 405, 61, 44, 92, 40, 41, 91, 120, 93, 60, |
| 1657 | 62, 123, 125, 42, 99 |
| 1658 | }; |
| 1659 | # endif |
| 1660 | |
| 1661 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1662 | static const unsigned char yyr1[] = |
| 1663 | { |
| 1664 | 0, 165, 166, 166, 167, 167, 168, 168, 168, 168, |
| 1665 | 168, 168, 168, 168, 168, 168, 168, 169, 169, 169, |
| 1666 | 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, |
| 1667 | 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, |
| 1668 | 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, |
| 1669 | 172, 172, 173, 173, 173, 173, 174, 174, 174, 174, |
| 1670 | 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, |
| 1671 | 175, 175, 175, 176, 176, 176, 176, 177, 177, 178, |
| 1672 | 178, 179, 179, 180, 180, 180, 180, 180, 180, 180, |
| 1673 | 180, 181, 181, 181, 181, 181, 181, 181, 181, 182, |
| 1674 | 182, 183, 183, 184, 185, 185, 186, 186, 187, 187, |
| 1675 | 188, 188, 189, 189, 190, 191, 191, 191, 191, 191, |
| 1676 | 191, 191, 191, 191, 191, 191, 191, 192, 192, 192, |
| 1677 | 192, 192, 192, 192, 192, 192, 192, 192, 192, 193, |
| 1678 | 193, 194, 194, 194, 194, 195, 195, 195, 195, 195, |
| 1679 | 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, |
| 1680 | 195, 196, 196, 196, 196, 196, 196, 196, 196, 196, |
| 1681 | 196, 196, 196, 197, 197, 198, 198, 199, 200, 200, |
| 1682 | 200, 200, 200, 201, 201, 202, 202, 202, 202, 202, |
| 1683 | 202, 202, 202, 202, 202, 203, 204, 204, 205, 205, |
| 1684 | 205, 205, 206, 207, 207, 207, 208, 208, 209, 209, |
| 1685 | 210, 211, 211, 212, 212, 212, 212, 213, 214, 214, |
| 1686 | 215, 216, 216, 217, 218, 218, 218, 219, 220, 220, |
| 1687 | 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, |
| 1688 | 221, 222, 222, 223, 223, 224, 225, 225, 226, 227, |
| 1689 | 227, 227, 228, 228, 229, 229, 229, 229, 229, 229, |
| 1690 | 229, 229, 229, 230, 230, 231, 232, 232, 233, 233, |
| 1691 | 234, 234, 235, 235, 236, 236, 236, 236, 236, 236, |
| 1692 | 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, |
| 1693 | 237, 237, 238, 238, 239, 239, 239, 239, 239, 239, |
| 1694 | 239, 239 |
| 1695 | }; |
| 1696 | |
| 1697 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1698 | static const unsigned char yyr2[] = |
| 1699 | { |
| 1700 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1701 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1702 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1703 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1704 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1705 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1706 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1707 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1708 | 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, |
| 1709 | 0, 1, 1, 1, 1, 1, 1, 2, 0, 0, |
| 1710 | 2, 0, 3, 2, 0, 1, 0, 3, 1, 2, |
| 1711 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1712 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1713 | 2, 4, 5, 5, 3, 2, 5, 4, 2, 1, |
| 1714 | 3, 1, 3, 1, 0, 4, 3, 3, 4, 4, |
| 1715 | 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1716 | 2, 6, 5, 8, 6, 6, 6, 7, 7, 6, |
| 1717 | 6, 8, 8, 3, 1, 1, 1, 1, 2, 2, |
| 1718 | 4, 2, 1, 1, 1, 4, 2, 4, 6, 6, |
| 1719 | 6, 6, 3, 4, 0, 1, 1, 1, 3, 3, |
| 1720 | 3, 3, 3, 3, 1, 0, 1, 1, 1, 0, |
| 1721 | 2, 3, 1, 1, 3, 1, 0, 8, 1, 1, |
| 1722 | 3, 1, 1, 3, 0, 1, 1, 3, 0, 1, |
| 1723 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, |
| 1724 | 5, 1, 1, 1, 1, 2, 2, 1, 2, 2, |
| 1725 | 0, 1, 1, 1, 2, 2, 3, 9, 9, 8, |
| 1726 | 14, 1, 1, 6, 5, 2, 6, 7, 1, 3, |
| 1727 | 1, 0, 2, 1, 5, 5, 5, 6, 6, 2, |
| 1728 | 4, 4, 6, 4, 4, 6, 6, 2, 7, 1, |
| 1729 | 2, 0, 1, 0, 3, 6, 3, 6, 2, 4, |
| 1730 | 6, 4 |
| 1731 | }; |
| 1732 | |
| 1733 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1734 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1735 | means the default is an error. */ |
| 1736 | static const unsigned short int yydefact[] = |
| 1737 | { |
| 1738 | 194, 0, 90, 182, 1, 181, 224, 83, 84, 85, |
| 1739 | 87, 88, 89, 86, 0, 98, 250, 178, 179, 206, |
| 1740 | 207, 0, 0, 0, 90, 0, 186, 225, 226, 98, |
| 1741 | 0, 0, 91, 92, 93, 94, 95, 96, 0, 0, |
| 1742 | 251, 250, 247, 82, 0, 0, 0, 0, 192, 0, |
| 1743 | 0, 0, 0, 0, 183, 184, 0, 0, 81, 227, |
| 1744 | 195, 180, 97, 111, 115, 116, 117, 118, 119, 120, |
| 1745 | 121, 122, 123, 124, 125, 126, 127, 2, 3, 0, |
| 1746 | 0, 0, 0, 241, 0, 0, 110, 129, 114, 242, |
| 1747 | 128, 218, 219, 220, 221, 222, 223, 246, 0, 0, |
| 1748 | 0, 253, 252, 262, 293, 261, 248, 249, 0, 0, |
| 1749 | 0, 0, 205, 193, 187, 185, 175, 176, 0, 0, |
| 1750 | 0, 0, 130, 0, 0, 0, 113, 135, 139, 0, |
| 1751 | 0, 144, 138, 255, 0, 254, 0, 0, 72, 76, |
| 1752 | 71, 75, 70, 74, 69, 73, 77, 78, 0, 292, |
| 1753 | 0, 273, 0, 98, 6, 7, 8, 9, 10, 11, |
| 1754 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 1755 | 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, |
| 1756 | 0, 0, 52, 53, 54, 55, 0, 0, 0, 0, |
| 1757 | 68, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1758 | 65, 66, 67, 0, 0, 0, 0, 0, 98, 265, |
| 1759 | 0, 289, 200, 197, 196, 198, 199, 201, 204, 0, |
| 1760 | 106, 106, 115, 116, 117, 118, 119, 120, 121, 122, |
| 1761 | 123, 124, 125, 0, 0, 0, 0, 106, 106, 0, |
| 1762 | 0, 0, 0, 0, 134, 216, 143, 141, 0, 230, |
| 1763 | 231, 232, 235, 236, 237, 233, 234, 228, 0, 0, |
| 1764 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1765 | 0, 239, 244, 243, 245, 0, 256, 0, 279, 272, |
| 1766 | 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1767 | 35, 0, 50, 51, 36, 37, 38, 39, 40, 41, |
| 1768 | 42, 43, 44, 45, 46, 47, 48, 49, 0, 101, |
| 1769 | 101, 298, 0, 0, 287, 0, 0, 0, 0, 0, |
| 1770 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, |
| 1771 | 0, 190, 191, 158, 159, 4, 5, 156, 157, 160, |
| 1772 | 151, 152, 155, 0, 0, 0, 0, 154, 153, 188, |
| 1773 | 189, 112, 112, 137, 0, 140, 215, 209, 212, 213, |
| 1774 | 0, 0, 131, 229, 0, 0, 0, 0, 0, 0, |
| 1775 | 0, 0, 174, 0, 0, 0, 0, 0, 0, 0, |
| 1776 | 0, 0, 0, 0, 0, 294, 0, 296, 291, 0, |
| 1777 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1778 | 0, 0, 0, 0, 203, 0, 0, 108, 106, 146, |
| 1779 | 0, 0, 150, 0, 147, 132, 133, 136, 208, 210, |
| 1780 | 0, 104, 142, 0, 0, 0, 291, 0, 0, 0, |
| 1781 | 0, 0, 238, 0, 0, 0, 0, 0, 0, 0, |
| 1782 | 0, 0, 0, 0, 0, 0, 0, 301, 0, 0, |
| 1783 | 0, 283, 284, 0, 0, 0, 0, 0, 280, 281, |
| 1784 | 0, 299, 0, 103, 109, 107, 145, 148, 149, 214, |
| 1785 | 211, 105, 99, 0, 0, 0, 0, 0, 0, 0, |
| 1786 | 0, 173, 0, 0, 0, 0, 0, 0, 0, 271, |
| 1787 | 0, 0, 101, 102, 101, 268, 290, 0, 0, 0, |
| 1788 | 0, 0, 274, 275, 276, 271, 0, 0, 217, 240, |
| 1789 | 0, 0, 162, 0, 0, 0, 0, 0, 0, 0, |
| 1790 | 0, 0, 0, 0, 270, 0, 277, 278, 0, 295, |
| 1791 | 297, 0, 0, 0, 282, 285, 286, 0, 300, 100, |
| 1792 | 0, 0, 0, 170, 0, 0, 164, 165, 166, 169, |
| 1793 | 161, 0, 259, 0, 0, 0, 269, 266, 0, 288, |
| 1794 | 167, 168, 0, 0, 0, 257, 0, 258, 0, 0, |
| 1795 | 267, 163, 171, 172, 0, 0, 0, 0, 0, 0, |
| 1796 | 264, 0, 0, 263, 0, 260 |
| 1797 | }; |
| 1798 | |
| 1799 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1800 | static const short int yydefgoto[] = |
| 1801 | { |
| 1802 | -1, 83, 337, 266, 267, 268, 291, 308, 269, 270, |
| 1803 | 233, 234, 148, 235, 24, 15, 38, 508, 385, 407, |
| 1804 | 472, 331, 408, 84, 85, 236, 87, 88, 129, 248, |
| 1805 | 372, 271, 373, 118, 1, 2, 57, 3, 61, 215, |
| 1806 | 48, 113, 219, 89, 419, 358, 359, 360, 39, 93, |
| 1807 | 16, 96, 17, 29, 18, 364, 272, 90, 274, 495, |
| 1808 | 41, 42, 43, 105, 106, 554, 107, 314, 524, 525, |
| 1809 | 208, 209, 447, 210, 211 |
| 1810 | }; |
| 1811 | |
| 1812 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1813 | STATE-NUM. */ |
| 1814 | #define YYPACT_NINF -513 |
| 1815 | static const short int yypact[] = |
| 1816 | { |
| 1817 | -513, 46, 217, 541, -513, -513, 82, -513, -513, -513, |
| 1818 | -513, -513, -513, -513, 16, 111, 25, -513, -513, -513, |
| 1819 | -513, 34, -55, 61, 26, -23, -513, -513, -513, 111, |
| 1820 | 132, 146, -513, -513, -513, -513, -513, -513, 873, -26, |
| 1821 | -513, -18, -513, 47, 19, 23, 39, 67, -513, 77, |
| 1822 | 132, 873, 81, 81, -513, -513, 81, 81, -513, -513, |
| 1823 | -513, -513, -513, 89, -513, -513, -513, -513, -513, -513, |
| 1824 | -513, -513, -513, -513, -513, -513, -513, -513, -513, 227, |
| 1825 | 229, -9, 506, -513, 133, 95, -513, -513, -111, -513, |
| 1826 | -513, -513, -513, -513, -513, -513, -513, -513, 901, 36, |
| 1827 | 148, -513, -513, -513, 1336, -513, -513, -513, 222, 76, |
| 1828 | 250, 239, 241, -513, -513, -513, -513, -513, 933, 933, |
| 1829 | 963, 933, -513, 115, 116, 614, -513, -513, -111, -104, |
| 1830 | 120, 216, -513, 89, 1134, -513, 1134, 1134, -513, -513, |
| 1831 | -513, -513, -513, -513, -513, -513, -513, -513, 1134, -513, |
| 1832 | 933, -513, 218, 111, -513, -513, -513, -513, -513, -513, |
| 1833 | -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, |
| 1834 | -513, -513, -513, -513, 195, 84, 933, 933, 933, 933, |
| 1835 | 933, 933, -513, -513, -513, -513, 933, 933, 933, 933, |
| 1836 | -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, |
| 1837 | -513, -513, -513, 933, 933, 933, 933, 933, 111, -513, |
| 1838 | 11, -513, -513, -513, -513, -513, -513, -513, -513, -93, |
| 1839 | 129, 129, 121, 166, 169, 191, 193, 220, 223, 237, |
| 1840 | 240, 261, 263, 249, 249, 264, 1045, 129, 129, 933, |
| 1841 | 933, 126, -73, 933, -513, 701, -513, 138, 136, -513, |
| 1842 | -513, -513, -513, -513, -513, -513, -513, 228, 195, 84, |
| 1843 | 140, 150, 154, 156, 158, 963, 167, 168, 170, 171, |
| 1844 | 172, -513, -513, -513, -513, 175, -513, 176, -513, -513, |
| 1845 | 873, -513, -513, -513, -513, -513, -513, -513, -513, -513, |
| 1846 | -513, 933, -513, -513, -513, -513, -513, -513, -513, -513, |
| 1847 | -513, -513, -513, -513, -513, -513, -513, -513, 933, 177, |
| 1848 | 178, -513, 1134, 164, 179, 182, 183, 184, 186, 188, |
| 1849 | 1134, 1134, 1134, 189, 284, 873, 933, 933, 312, -513, |
| 1850 | -8, -513, -513, -513, -513, -513, -513, -513, -513, -513, |
| 1851 | -513, -513, -513, 741, 963, 673, 314, -513, -513, -513, |
| 1852 | -513, -113, -99, -513, 185, -111, -513, 133, -513, 194, |
| 1853 | 192, 774, -513, -513, 318, 198, 205, 963, 963, 963, |
| 1854 | 963, 963, -513, -58, 963, 963, 963, 963, 963, 345, |
| 1855 | 348, 1134, 1134, 1134, -2, -513, 9, -513, 212, 1134, |
| 1856 | 209, 933, 933, 933, 933, 933, 214, 215, 219, 933, |
| 1857 | 933, 1134, 1134, 221, -513, 338, 352, -513, 129, -513, |
| 1858 | -61, -57, -513, -70, -513, -513, -513, -513, -513, -513, |
| 1859 | 833, 337, -513, 224, 963, 963, 212, 231, 235, 236, |
| 1860 | 238, 963, -513, 242, 243, 244, 245, 342, 1134, 1134, |
| 1861 | 247, 251, 252, 1134, 371, 1134, 933, -513, 253, 1134, |
| 1862 | 254, -513, -513, 255, 257, 1134, 1134, 1134, -513, -513, |
| 1863 | 248, -513, 933, -513, -513, -513, -513, -513, -513, -513, |
| 1864 | -513, -513, 335, 363, 258, 262, 260, 963, 963, 963, |
| 1865 | 963, -513, 963, 963, 963, 963, 933, 265, 266, 933, |
| 1866 | 1134, 1134, 267, -513, 267, -513, 268, 1134, 269, 933, |
| 1867 | 933, 933, -513, -513, -513, 933, 1134, 398, -513, -513, |
| 1868 | 963, 963, -513, 271, 273, 277, 278, 276, 279, 282, |
| 1869 | 283, 286, 403, 15, 268, 289, -513, -513, 375, -513, |
| 1870 | -513, 933, 275, 1134, -513, -513, -513, 292, -513, -513, |
| 1871 | 294, 295, 963, -513, 963, 963, -513, -513, -513, -513, |
| 1872 | -513, 1134, -513, 1223, 27, 400, -513, -513, 297, -513, |
| 1873 | -513, -513, 303, 304, 305, -513, 313, -513, 1223, 449, |
| 1874 | -513, -513, -513, -513, 451, 316, 1134, 1134, 454, 135, |
| 1875 | -513, 1134, 457, -513, 1134, -513 |
| 1876 | }; |
| 1877 | |
| 1878 | /* YYPGOTO[NTERM-NUM]. */ |
| 1879 | static const short int yypgoto[] = |
| 1880 | { |
| 1881 | -513, -513, 246, 369, 370, 372, 225, 226, 373, 377, |
| 1882 | -98, -97, -507, -513, 436, 458, -141, -513, -303, 63, |
| 1883 | -513, -220, -513, -46, -513, -38, -513, -68, -20, -513, |
| 1884 | 130, 256, -230, 51, -513, -513, -513, -513, 439, -513, |
| 1885 | -513, -513, -513, 1, -513, 66, -513, -513, 461, -513, |
| 1886 | -513, -513, -513, -513, 488, -513, -512, -106, -3, -88, |
| 1887 | -513, 455, -513, -84, -513, -513, -513, -513, 56, 18, |
| 1888 | -513, -513, 98, -513, -513 |
| 1889 | }; |
| 1890 | |
| 1891 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 1892 | positive, shift that token. If negative, reduce the rule which |
| 1893 | number is the opposite. If zero, do what YYDEFACT says. |
| 1894 | If YYTABLE_NINF, syntax error. */ |
| 1895 | #define YYTABLE_NINF -178 |
| 1896 | static const short int yytable[] = |
| 1897 | { |
| 1898 | 86, 332, 146, 147, 25, 115, 91, 387, 443, 124, |
| 1899 | 135, 40, 280, 86, 128, 94, 553, 349, 350, 445, |
| 1900 | 138, 139, 140, 141, 142, 143, 144, 145, 273, 405, |
| 1901 | 273, 273, 138, 139, 140, 141, 142, 143, 144, 145, |
| 1902 | 136, 566, 273, -112, 25, 415, 4, 568, 243, 406, |
| 1903 | 132, 137, 132, 51, 40, 444, 575, 128, 244, 328, |
| 1904 | 134, 416, 278, 128, 132, 329, 444, 325, 7, 8, |
| 1905 | 9, 52, 11, 53, 13, 19, 54, 20, 30, 243, |
| 1906 | 220, 221, 431, 238, 55, 130, 44, 45, 46, 354, |
| 1907 | 311, 431, 468, 315, 431, 431, 49, 466, 316, 317, |
| 1908 | 318, 319, 432, 467, 119, 242, 47, 120, 121, 292, |
| 1909 | 293, 247, 134, 410, 411, 413, 116, 117, 323, 324, |
| 1910 | 98, 99, 100, 50, 101, 102, 103, 27, 58, 28, |
| 1911 | 348, 213, 214, 275, 276, 92, 326, 327, 309, 310, |
| 1912 | 134, 312, 313, 134, 95, 277, 333, 334, 134, 134, |
| 1913 | 134, 134, 125, 138, 139, 140, 141, 142, 143, 144, |
| 1914 | 145, 19, 60, 20, 62, 320, 321, 322, 134, 134, |
| 1915 | 108, 351, 352, 552, 109, 355, 31, 32, 33, 34, |
| 1916 | 35, 36, 37, -72, -72, 567, -76, -76, 465, 529, |
| 1917 | 110, 530, 294, 295, 296, 297, 298, 299, 300, 301, |
| 1918 | 302, 303, 304, 305, 306, 307, 273, 357, -71, -71, |
| 1919 | -75, -75, 101, 102, 273, 273, 273, -177, 111, 126, |
| 1920 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, |
| 1921 | 74, 75, 76, 112, 381, 77, 78, -70, -70, 403, |
| 1922 | -74, -74, 86, -113, 19, 122, 20, 123, 5, 131, |
| 1923 | 237, 6, 212, 382, -69, -69, 246, -73, -73, 7, |
| 1924 | 8, 9, 10, 11, 12, 13, 335, 336, 216, 217, |
| 1925 | 383, 218, 239, 240, 245, 273, 273, 273, 279, 401, |
| 1926 | 14, 330, -79, 273, -80, 339, 353, 86, 402, 134, |
| 1927 | 361, 362, 363, 355, 367, 273, 273, 281, 282, 283, |
| 1928 | 284, 285, 286, 450, 368, 452, 453, 454, 369, 388, |
| 1929 | 370, 458, 371, 287, 288, 289, 290, 396, 397, 398, |
| 1930 | 389, 374, 375, 400, 376, 377, 378, 379, 380, 384, |
| 1931 | 386, 390, 273, 273, 391, 392, 393, 273, 394, 273, |
| 1932 | 395, 399, 404, 273, 414, 417, 420, 421, 423, 273, |
| 1933 | 273, 273, 424, 134, 451, 134, 134, 134, 418, 425, |
| 1934 | 438, 134, 459, 439, 446, 449, 455, 456, 463, 79, |
| 1935 | 464, 457, 80, 462, 405, 81, 473, 82, 440, 441, |
| 1936 | 442, 486, 357, 477, 273, 273, 448, 478, 479, 493, |
| 1937 | 480, 273, 507, 509, 482, 483, 484, 485, 460, 461, |
| 1938 | 273, 489, 505, 490, 491, 497, 499, 500, 134, 501, |
| 1939 | 510, 534, 535, 536, 511, 512, 539, 522, 551, 528, |
| 1940 | 531, 533, 523, 542, 506, 146, 147, 273, 543, 544, |
| 1941 | 545, 546, 444, 557, 547, 487, 488, 548, 549, 569, |
| 1942 | 492, 550, 494, 556, 555, 273, 498, 559, 521, 560, |
| 1943 | 561, 134, 502, 503, 504, 570, 146, 147, 571, 572, |
| 1944 | 573, 134, 134, 134, 576, 574, 577, 134, 578, 581, |
| 1945 | 273, 273, 584, 203, 204, 273, 205, 206, 273, 104, |
| 1946 | 338, 207, 56, 365, 471, 366, 470, 526, 527, 114, |
| 1947 | 59, 26, 347, 134, 532, 582, 97, 426, 427, 428, |
| 1948 | 429, 430, 496, 538, 433, 434, 435, 436, 437, 126, |
| 1949 | 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, |
| 1950 | 74, 75, 76, 537, 476, 77, 78, 0, 0, 0, |
| 1951 | 558, 0, 0, 0, 19, 0, 20, 0, 0, 0, |
| 1952 | 0, 0, 0, 0, 0, 0, 0, 0, 565, 0, |
| 1953 | 0, 0, 0, 0, 474, 475, 0, 0, 0, 0, |
| 1954 | 0, 481, 0, 0, 0, 0, 0, 0, -82, 19, |
| 1955 | 0, 20, 0, 579, 580, 6, -82, -82, 583, 0, |
| 1956 | 0, 585, 0, -82, -82, -82, -82, -82, -82, -82, |
| 1957 | 0, -82, 21, 0, 0, 0, 0, 0, 0, -82, |
| 1958 | 22, 0, 0, 0, 23, 0, 0, 513, 514, 515, |
| 1959 | 516, 0, 517, 518, 519, 520, 0, 126, 64, 65, |
| 1960 | 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, |
| 1961 | 76, 0, 0, 77, 78, 0, 0, 0, 0, 0, |
| 1962 | 540, 541, 19, 0, 20, 0, 0, 0, 0, 0, |
| 1963 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, |
| 1964 | 0, 0, 80, 0, 0, 81, 0, 82, 127, 0, |
| 1965 | 0, 0, 562, 0, 563, 564, 126, 222, 223, 224, |
| 1966 | 225, 226, 227, 228, 229, 230, 231, 232, 75, 76, |
| 1967 | 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, |
| 1968 | 0, 19, 0, 20, 126, 64, 65, 66, 67, 68, |
| 1969 | 69, 70, 71, 72, 73, 74, 75, 76, 0, 0, |
| 1970 | 77, 78, 0, 0, 0, 0, 0, 0, 0, 19, |
| 1971 | 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1972 | 0, 356, 0, 0, 126, 222, 223, 224, 225, 226, |
| 1973 | 227, 228, 229, 230, 231, 232, 75, 76, 0, 0, |
| 1974 | 77, 78, 0, 0, 0, 0, 0, 79, 0, 19, |
| 1975 | 80, 20, 0, 81, 0, 82, 241, 126, 64, 65, |
| 1976 | 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, |
| 1977 | 76, 0, 0, 77, 78, 0, 0, 0, 0, 0, |
| 1978 | 0, 0, 19, 0, 20, 0, 0, 0, 0, 0, |
| 1979 | 0, 0, 0, 0, 422, 0, 0, 0, 0, 0, |
| 1980 | 0, 0, 0, 0, 0, 0, 79, 0, 0, 80, |
| 1981 | 0, 0, 81, 0, 82, 412, 126, 64, 65, 66, |
| 1982 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 1983 | 0, 0, 77, 78, 79, 0, 0, 80, 0, 0, |
| 1984 | 81, 19, 82, 20, 0, 0, 0, 0, 0, 0, |
| 1985 | 0, 0, 0, 469, 0, 0, 63, 64, 65, 66, |
| 1986 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 1987 | 0, 0, 77, 78, 79, 0, 0, 80, 0, 409, |
| 1988 | 81, 19, 82, 20, 133, 64, 65, 66, 67, 68, |
| 1989 | 69, 70, 71, 72, 73, 74, 75, 76, 0, 0, |
| 1990 | 77, 78, 0, 0, 0, 0, 0, 79, 0, 19, |
| 1991 | 80, 20, 0, 81, 0, 82, 126, 64, 65, 66, |
| 1992 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 1993 | 0, 0, 77, 78, 0, 0, 0, 0, 0, 0, |
| 1994 | 0, 19, 0, 20, 0, 0, 126, 222, 223, 224, |
| 1995 | 225, 226, 227, 228, 229, 230, 231, 232, 75, 76, |
| 1996 | 0, 0, 77, 78, 0, 0, 79, 0, 0, 80, |
| 1997 | 0, 19, 81, 20, 82, 0, 0, 0, 0, 0, |
| 1998 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1999 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2000 | 0, 0, 0, 0, 0, 0, 79, 0, 0, 80, |
| 2001 | 0, 0, 81, 0, 82, 0, 0, 0, 0, 0, |
| 2002 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2003 | 0, 0, 0, 0, 79, 0, 0, 80, 0, 0, |
| 2004 | 81, 0, 82, 0, 77, 78, 0, 340, 341, 342, |
| 2005 | 0, 0, 0, 19, 0, 20, 0, 0, 0, 0, |
| 2006 | 0, 0, 0, 0, 0, 0, 79, 0, 0, 80, |
| 2007 | 0, 0, 81, 0, 82, 0, 0, 0, 0, 0, |
| 2008 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2009 | 0, 0, 0, 0, 0, 0, 79, 0, 0, 80, |
| 2010 | 0, 0, 81, 0, 82, 154, 155, 156, 157, 158, |
| 2011 | 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, |
| 2012 | 169, 170, 171, 172, 173, 258, 259, 0, 0, 0, |
| 2013 | 0, 249, 250, 77, 78, 251, 252, 253, 254, 255, |
| 2014 | 256, 0, 19, 0, 20, 0, 0, 0, 0, 0, |
| 2015 | 0, 0, 260, 0, 261, 182, 183, 184, 185, 0, |
| 2016 | 262, 263, 264, 190, 191, 192, 193, 194, 195, 196, |
| 2017 | 197, 198, 199, 200, 201, 202, 257, 0, 0, 0, |
| 2018 | 0, 343, 0, 0, 344, 0, 345, 0, 0, 346, |
| 2019 | 0, 0, 0, 0, 154, 155, 156, 157, 158, 159, |
| 2020 | 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, |
| 2021 | 170, 171, 172, 173, 258, 259, 0, 0, 0, 0, |
| 2022 | 249, 250, 0, 0, 251, 252, 253, 254, 255, 256, |
| 2023 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2024 | 0, 260, 0, 261, 182, 183, 184, 185, 0, 262, |
| 2025 | 263, 264, 190, 191, 192, 193, 194, 195, 196, 197, |
| 2026 | 198, 199, 200, 201, 202, 257, 0, 0, 0, 0, |
| 2027 | 0, 0, 0, 265, 0, 0, 0, 0, 0, 0, |
| 2028 | 0, 0, 0, 154, 155, 156, 157, 158, 159, 160, |
| 2029 | 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, |
| 2030 | 171, 172, 173, 258, 259, 0, 0, 0, 0, 0, |
| 2031 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2032 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2033 | 260, 0, 261, 182, 183, 184, 185, 0, 262, 263, |
| 2034 | 264, 190, 191, 192, 193, 194, 195, 196, 197, 198, |
| 2035 | 199, 200, 201, 202, 149, 0, 0, 0, 0, 0, |
| 2036 | 0, 0, 265, 0, 0, 150, 0, 0, 0, 0, |
| 2037 | 0, 0, 0, 0, 0, 0, 151, 152, 0, 0, |
| 2038 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2039 | 0, 0, 153, 0, 0, 0, 154, 155, 156, 157, |
| 2040 | 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, |
| 2041 | 168, 169, 170, 171, 172, 173, 174, 175, 0, 0, |
| 2042 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2043 | 0, 0, 0, 0, 0, 0, 0, 0, 176, 177, |
| 2044 | 178, 0, 0, 179, 180, 181, 182, 183, 184, 185, |
| 2045 | 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, |
| 2046 | 196, 197, 198, 199, 200, 201, 202 |
| 2047 | }; |
| 2048 | |
| 2049 | static const short int yycheck[] = |
| 2050 | { |
| 2051 | 38, 221, 100, 100, 3, 51, 32, 310, 10, 18, |
| 2052 | 98, 29, 153, 51, 82, 33, 523, 237, 238, 10, |
| 2053 | 5, 6, 7, 8, 9, 10, 11, 12, 134, 37, |
| 2054 | 136, 137, 5, 6, 7, 8, 9, 10, 11, 12, |
| 2055 | 4, 553, 148, 154, 43, 158, 0, 554, 152, 57, |
| 2056 | 163, 15, 163, 27, 29, 57, 568, 125, 162, 152, |
| 2057 | 98, 160, 150, 131, 163, 158, 57, 208, 42, 43, |
| 2058 | 44, 45, 46, 47, 48, 28, 50, 30, 62, 152, |
| 2059 | 118, 119, 152, 121, 58, 84, 52, 53, 54, 162, |
| 2060 | 178, 152, 162, 181, 152, 152, 151, 158, 186, 187, |
| 2061 | 188, 189, 160, 160, 53, 125, 72, 56, 57, 25, |
| 2062 | 26, 131, 150, 343, 344, 345, 35, 36, 206, 207, |
| 2063 | 73, 74, 75, 62, 77, 78, 79, 45, 151, 47, |
| 2064 | 236, 55, 56, 136, 137, 161, 125, 126, 176, 177, |
| 2065 | 178, 179, 180, 181, 162, 148, 25, 26, 186, 187, |
| 2066 | 188, 189, 161, 5, 6, 7, 8, 9, 10, 11, |
| 2067 | 12, 28, 30, 30, 18, 203, 204, 205, 206, 207, |
| 2068 | 151, 239, 240, 158, 151, 243, 65, 66, 67, 68, |
| 2069 | 69, 70, 71, 17, 18, 158, 17, 18, 408, 492, |
| 2070 | 151, 494, 108, 109, 110, 111, 112, 113, 114, 115, |
| 2071 | 116, 117, 118, 119, 120, 121, 312, 245, 17, 18, |
| 2072 | 17, 18, 77, 78, 320, 321, 322, 0, 151, 3, |
| 2073 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, |
| 2074 | 14, 15, 16, 156, 280, 19, 20, 17, 18, 327, |
| 2075 | 17, 18, 280, 154, 28, 18, 30, 18, 31, 154, |
| 2076 | 120, 34, 30, 291, 17, 18, 40, 17, 18, 42, |
| 2077 | 43, 44, 45, 46, 47, 48, 17, 18, 18, 30, |
| 2078 | 308, 30, 157, 157, 154, 381, 382, 383, 60, 325, |
| 2079 | 63, 152, 21, 389, 21, 21, 160, 325, 326, 327, |
| 2080 | 152, 155, 64, 361, 154, 401, 402, 102, 103, 104, |
| 2081 | 105, 106, 107, 391, 154, 393, 394, 395, 154, 312, |
| 2082 | 154, 399, 154, 118, 119, 120, 121, 320, 321, 322, |
| 2083 | 156, 154, 154, 39, 154, 154, 154, 152, 152, 152, |
| 2084 | 152, 152, 438, 439, 152, 152, 152, 443, 152, 445, |
| 2085 | 152, 152, 30, 449, 30, 160, 152, 155, 30, 455, |
| 2086 | 456, 457, 154, 391, 392, 393, 394, 395, 357, 154, |
| 2087 | 15, 399, 400, 15, 152, 156, 152, 152, 30, 153, |
| 2088 | 18, 152, 156, 152, 37, 159, 152, 161, 381, 382, |
| 2089 | 383, 39, 420, 152, 490, 491, 389, 152, 152, 18, |
| 2090 | 152, 497, 57, 30, 152, 152, 152, 152, 401, 402, |
| 2091 | 506, 154, 154, 152, 152, 152, 152, 152, 446, 152, |
| 2092 | 152, 499, 500, 501, 152, 155, 18, 152, 15, 152, |
| 2093 | 152, 152, 156, 152, 462, 523, 523, 533, 155, 152, |
| 2094 | 152, 155, 57, 158, 155, 438, 439, 155, 155, 39, |
| 2095 | 443, 155, 445, 531, 155, 551, 449, 155, 486, 155, |
| 2096 | 155, 489, 455, 456, 457, 158, 554, 554, 155, 155, |
| 2097 | 155, 499, 500, 501, 15, 152, 15, 505, 152, 15, |
| 2098 | 576, 577, 15, 104, 104, 581, 104, 104, 584, 43, |
| 2099 | 234, 104, 24, 258, 421, 259, 420, 490, 491, 50, |
| 2100 | 29, 3, 236, 531, 497, 579, 41, 367, 368, 369, |
| 2101 | 370, 371, 446, 506, 374, 375, 376, 377, 378, 3, |
| 2102 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, |
| 2103 | 14, 15, 16, 505, 426, 19, 20, -1, -1, -1, |
| 2104 | 533, -1, -1, -1, 28, -1, 30, -1, -1, -1, |
| 2105 | -1, -1, -1, -1, -1, -1, -1, -1, 551, -1, |
| 2106 | -1, -1, -1, -1, 424, 425, -1, -1, -1, -1, |
| 2107 | -1, 431, -1, -1, -1, -1, -1, -1, 27, 28, |
| 2108 | -1, 30, -1, 576, 577, 34, 35, 36, 581, -1, |
| 2109 | -1, 584, -1, 42, 43, 44, 45, 46, 47, 48, |
| 2110 | -1, 50, 51, -1, -1, -1, -1, -1, -1, 58, |
| 2111 | 59, -1, -1, -1, 63, -1, -1, 477, 478, 479, |
| 2112 | 480, -1, 482, 483, 484, 485, -1, 3, 4, 5, |
| 2113 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 2114 | 16, -1, -1, 19, 20, -1, -1, -1, -1, -1, |
| 2115 | 510, 511, 28, -1, 30, -1, -1, -1, -1, -1, |
| 2116 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, |
| 2117 | -1, -1, 156, -1, -1, 159, -1, 161, 162, -1, |
| 2118 | -1, -1, 542, -1, 544, 545, 3, 4, 5, 6, |
| 2119 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2120 | -1, -1, 19, 20, -1, -1, -1, -1, -1, -1, |
| 2121 | -1, 28, -1, 30, 3, 4, 5, 6, 7, 8, |
| 2122 | 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, |
| 2123 | 19, 20, -1, -1, -1, -1, -1, -1, -1, 28, |
| 2124 | -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2125 | -1, 40, -1, -1, 3, 4, 5, 6, 7, 8, |
| 2126 | 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, |
| 2127 | 19, 20, -1, -1, -1, -1, -1, 153, -1, 28, |
| 2128 | 156, 30, -1, 159, -1, 161, 162, 3, 4, 5, |
| 2129 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 2130 | 16, -1, -1, 19, 20, -1, -1, -1, -1, -1, |
| 2131 | -1, -1, 28, -1, 30, -1, -1, -1, -1, -1, |
| 2132 | -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, |
| 2133 | -1, -1, -1, -1, -1, -1, 153, -1, -1, 156, |
| 2134 | -1, -1, 159, -1, 161, 162, 3, 4, 5, 6, |
| 2135 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2136 | -1, -1, 19, 20, 153, -1, -1, 156, -1, -1, |
| 2137 | 159, 28, 161, 30, -1, -1, -1, -1, -1, -1, |
| 2138 | -1, -1, -1, 40, -1, -1, 3, 4, 5, 6, |
| 2139 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2140 | -1, -1, 19, 20, 153, -1, -1, 156, -1, 158, |
| 2141 | 159, 28, 161, 30, 3, 4, 5, 6, 7, 8, |
| 2142 | 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, |
| 2143 | 19, 20, -1, -1, -1, -1, -1, 153, -1, 28, |
| 2144 | 156, 30, -1, 159, -1, 161, 3, 4, 5, 6, |
| 2145 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2146 | -1, -1, 19, 20, -1, -1, -1, -1, -1, -1, |
| 2147 | -1, 28, -1, 30, -1, -1, 3, 4, 5, 6, |
| 2148 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2149 | -1, -1, 19, 20, -1, -1, 153, -1, -1, 156, |
| 2150 | -1, 28, 159, 30, 161, -1, -1, -1, -1, -1, |
| 2151 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2152 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2153 | -1, -1, -1, -1, -1, -1, 153, -1, -1, 156, |
| 2154 | -1, -1, 159, -1, 161, -1, -1, -1, -1, -1, |
| 2155 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2156 | -1, -1, -1, -1, 153, -1, -1, 156, -1, -1, |
| 2157 | 159, -1, 161, -1, 19, 20, -1, 22, 23, 24, |
| 2158 | -1, -1, -1, 28, -1, 30, -1, -1, -1, -1, |
| 2159 | -1, -1, -1, -1, -1, -1, 153, -1, -1, 156, |
| 2160 | -1, -1, 159, -1, 161, -1, -1, -1, -1, -1, |
| 2161 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2162 | -1, -1, -1, -1, -1, -1, 153, -1, -1, 156, |
| 2163 | -1, -1, 159, -1, 161, 80, 81, 82, 83, 84, |
| 2164 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 2165 | 95, 96, 97, 98, 99, 100, 101, -1, -1, -1, |
| 2166 | -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
| 2167 | 26, -1, 28, -1, 30, -1, -1, -1, -1, -1, |
| 2168 | -1, -1, 127, -1, 129, 130, 131, 132, 133, -1, |
| 2169 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
| 2170 | 145, 146, 147, 148, 149, 150, 62, -1, -1, -1, |
| 2171 | -1, 156, -1, -1, 159, -1, 161, -1, -1, 164, |
| 2172 | -1, -1, -1, -1, 80, 81, 82, 83, 84, 85, |
| 2173 | 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, |
| 2174 | 96, 97, 98, 99, 100, 101, -1, -1, -1, -1, |
| 2175 | 17, 18, -1, -1, 21, 22, 23, 24, 25, 26, |
| 2176 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2177 | -1, 127, -1, 129, 130, 131, 132, 133, -1, 135, |
| 2178 | 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, |
| 2179 | 146, 147, 148, 149, 150, 62, -1, -1, -1, -1, |
| 2180 | -1, -1, -1, 159, -1, -1, -1, -1, -1, -1, |
| 2181 | -1, -1, -1, 80, 81, 82, 83, 84, 85, 86, |
| 2182 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 2183 | 97, 98, 99, 100, 101, -1, -1, -1, -1, -1, |
| 2184 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2185 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2186 | 127, -1, 129, 130, 131, 132, 133, -1, 135, 136, |
| 2187 | 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, |
| 2188 | 147, 148, 149, 150, 38, -1, -1, -1, -1, -1, |
| 2189 | -1, -1, 159, -1, -1, 49, -1, -1, -1, -1, |
| 2190 | -1, -1, -1, -1, -1, -1, 60, 61, -1, -1, |
| 2191 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2192 | -1, -1, 76, -1, -1, -1, 80, 81, 82, 83, |
| 2193 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2194 | 94, 95, 96, 97, 98, 99, 100, 101, -1, -1, |
| 2195 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2196 | -1, -1, -1, -1, -1, -1, -1, -1, 122, 123, |
| 2197 | 124, -1, -1, 127, 128, 129, 130, 131, 132, 133, |
| 2198 | 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, |
| 2199 | 144, 145, 146, 147, 148, 149, 150 |
| 2200 | }; |
| 2201 | |
| 2202 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2203 | symbol of state STATE-NUM. */ |
| 2204 | static const unsigned char yystos[] = |
| 2205 | { |
| 2206 | 0, 199, 200, 202, 0, 31, 34, 42, 43, 44, |
| 2207 | 45, 46, 47, 48, 63, 180, 215, 217, 219, 28, |
| 2208 | 30, 51, 59, 63, 179, 208, 219, 45, 47, 218, |
| 2209 | 62, 65, 66, 67, 68, 69, 70, 71, 181, 213, |
| 2210 | 29, 225, 226, 227, 52, 53, 54, 72, 205, 151, |
| 2211 | 62, 27, 45, 47, 50, 58, 180, 201, 151, 213, |
| 2212 | 30, 203, 18, 3, 4, 5, 6, 7, 8, 9, |
| 2213 | 10, 11, 12, 13, 14, 15, 16, 19, 20, 153, |
| 2214 | 156, 159, 161, 166, 188, 189, 190, 191, 192, 208, |
| 2215 | 222, 32, 161, 214, 33, 162, 216, 226, 73, 74, |
| 2216 | 75, 77, 78, 79, 179, 228, 229, 231, 151, 151, |
| 2217 | 151, 151, 156, 206, 203, 188, 35, 36, 198, 198, |
| 2218 | 198, 198, 18, 18, 18, 161, 3, 162, 192, 193, |
| 2219 | 208, 154, 163, 3, 190, 224, 4, 15, 5, 6, |
| 2220 | 7, 8, 9, 10, 11, 12, 175, 176, 177, 38, |
| 2221 | 49, 60, 61, 76, 80, 81, 82, 83, 84, 85, |
| 2222 | 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, |
| 2223 | 96, 97, 98, 99, 100, 101, 122, 123, 124, 127, |
| 2224 | 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, |
| 2225 | 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, |
| 2226 | 148, 149, 150, 168, 169, 170, 173, 174, 235, 236, |
| 2227 | 238, 239, 30, 55, 56, 204, 18, 30, 30, 207, |
| 2228 | 190, 190, 4, 5, 6, 7, 8, 9, 10, 11, |
| 2229 | 12, 13, 14, 175, 176, 178, 190, 195, 190, 157, |
| 2230 | 157, 162, 193, 152, 162, 154, 40, 193, 194, 17, |
| 2231 | 18, 21, 22, 23, 24, 25, 26, 62, 100, 101, |
| 2232 | 127, 129, 135, 136, 137, 159, 168, 169, 170, 173, |
| 2233 | 174, 196, 221, 222, 223, 223, 223, 223, 224, 60, |
| 2234 | 181, 102, 103, 104, 105, 106, 107, 118, 119, 120, |
| 2235 | 121, 171, 25, 26, 108, 109, 110, 111, 112, 113, |
| 2236 | 114, 115, 116, 117, 118, 119, 120, 121, 172, 190, |
| 2237 | 190, 224, 190, 190, 232, 224, 224, 224, 224, 224, |
| 2238 | 190, 190, 190, 224, 224, 181, 125, 126, 152, 158, |
| 2239 | 152, 186, 186, 25, 26, 17, 18, 167, 167, 21, |
| 2240 | 22, 23, 24, 156, 159, 161, 164, 196, 222, 186, |
| 2241 | 186, 192, 192, 160, 162, 192, 40, 190, 210, 211, |
| 2242 | 212, 152, 155, 64, 220, 171, 172, 154, 154, 154, |
| 2243 | 154, 154, 195, 197, 154, 154, 154, 154, 154, 152, |
| 2244 | 152, 188, 190, 190, 152, 183, 152, 183, 223, 156, |
| 2245 | 152, 152, 152, 152, 152, 152, 223, 223, 223, 152, |
| 2246 | 39, 188, 190, 224, 30, 37, 57, 184, 187, 158, |
| 2247 | 197, 197, 162, 197, 30, 158, 160, 160, 208, 209, |
| 2248 | 152, 155, 40, 30, 154, 154, 195, 195, 195, 195, |
| 2249 | 195, 152, 160, 195, 195, 195, 195, 195, 15, 15, |
| 2250 | 223, 223, 223, 10, 57, 10, 152, 237, 223, 156, |
| 2251 | 224, 190, 224, 224, 224, 152, 152, 152, 224, 190, |
| 2252 | 223, 223, 152, 30, 18, 186, 158, 160, 162, 40, |
| 2253 | 210, 184, 185, 152, 195, 195, 237, 152, 152, 152, |
| 2254 | 152, 195, 152, 152, 152, 152, 39, 223, 223, 154, |
| 2255 | 152, 152, 223, 18, 223, 224, 233, 152, 223, 152, |
| 2256 | 152, 152, 223, 223, 223, 154, 190, 57, 182, 30, |
| 2257 | 152, 152, 155, 195, 195, 195, 195, 195, 195, 195, |
| 2258 | 195, 190, 152, 156, 233, 234, 223, 223, 152, 183, |
| 2259 | 183, 152, 223, 152, 224, 224, 224, 234, 223, 18, |
| 2260 | 195, 195, 152, 155, 152, 152, 155, 155, 155, 155, |
| 2261 | 155, 15, 158, 177, 230, 155, 224, 158, 223, 155, |
| 2262 | 155, 155, 195, 195, 195, 223, 221, 158, 177, 39, |
| 2263 | 158, 155, 155, 155, 152, 221, 15, 15, 152, 223, |
| 2264 | 223, 15, 228, 223, 15, 223 |
| 2265 | }; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2266 | |
| 2267 | #define yyerrok (yyerrstatus = 0) |
| 2268 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2269 | #define YYEMPTY (-2) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2270 | #define YYEOF 0 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2271 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2272 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2273 | #define YYABORT goto yyabortlab |
| 2274 | #define YYERROR goto yyerrorlab |
| 2275 | |
| 2276 | |
| 2277 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2278 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2279 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2280 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2281 | #define YYFAIL goto yyerrlab |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2282 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2283 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2284 | |
| 2285 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2286 | do \ |
| 2287 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2288 | { \ |
| 2289 | yychar = (Token); \ |
| 2290 | yylval = (Value); \ |
| 2291 | yytoken = YYTRANSLATE (yychar); \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2292 | YYPOPSTACK; \ |
| 2293 | goto yybackup; \ |
| 2294 | } \ |
| 2295 | else \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2296 | { \ |
| 2297 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2298 | YYERROR; \ |
| 2299 | } \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2300 | while (0) |
| 2301 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2302 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2303 | #define YYTERROR 1 |
| 2304 | #define YYERRCODE 256 |
| 2305 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2306 | |
| 2307 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2308 | If N is 0, then set CURRENT to the empty location which ends |
| 2309 | the previous symbol: RHS[0] (always defined). */ |
| 2310 | |
| 2311 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2312 | #ifndef YYLLOC_DEFAULT |
| 2313 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2314 | do \ |
| 2315 | if (N) \ |
| 2316 | { \ |
| 2317 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2318 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2319 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2320 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2321 | } \ |
| 2322 | else \ |
| 2323 | { \ |
| 2324 | (Current).first_line = (Current).last_line = \ |
| 2325 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2326 | (Current).first_column = (Current).last_column = \ |
| 2327 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2328 | } \ |
| 2329 | while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2330 | #endif |
| 2331 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2332 | |
| 2333 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2334 | This macro was not mandated originally: define only if we know |
| 2335 | we won't break user code: when these are the locations we know. */ |
| 2336 | |
| 2337 | #ifndef YY_LOCATION_PRINT |
| 2338 | # if YYLTYPE_IS_TRIVIAL |
| 2339 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2340 | fprintf (File, "%d.%d-%d.%d", \ |
| 2341 | (Loc).first_line, (Loc).first_column, \ |
| 2342 | (Loc).last_line, (Loc).last_column) |
| 2343 | # else |
| 2344 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2345 | # endif |
| 2346 | #endif |
| 2347 | |
| 2348 | |
| 2349 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2350 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2351 | #ifdef YYLEX_PARAM |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2352 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2353 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2354 | # define YYLEX yylex () |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2355 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2356 | |
| 2357 | /* Enable debugging if requested. */ |
| 2358 | #if YYDEBUG |
| 2359 | |
| 2360 | # ifndef YYFPRINTF |
| 2361 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2362 | # define YYFPRINTF fprintf |
| 2363 | # endif |
| 2364 | |
| 2365 | # define YYDPRINTF(Args) \ |
| 2366 | do { \ |
| 2367 | if (yydebug) \ |
| 2368 | YYFPRINTF Args; \ |
| 2369 | } while (0) |
| 2370 | |
| 2371 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2372 | do { \ |
| 2373 | if (yydebug) \ |
| 2374 | { \ |
| 2375 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2376 | yysymprint (stderr, \ |
| 2377 | Type, Value); \ |
| 2378 | YYFPRINTF (stderr, "\n"); \ |
| 2379 | } \ |
| 2380 | } while (0) |
| 2381 | |
| 2382 | /*------------------------------------------------------------------. |
| 2383 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2384 | | TOP (included). | |
| 2385 | `------------------------------------------------------------------*/ |
| 2386 | |
| 2387 | #if defined (__STDC__) || defined (__cplusplus) |
| 2388 | static void |
| 2389 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2390 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2391 | static void |
| 2392 | yy_stack_print (bottom, top) |
| 2393 | short int *bottom; |
| 2394 | short int *top; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2395 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2396 | { |
| 2397 | YYFPRINTF (stderr, "Stack now"); |
| 2398 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2399 | YYFPRINTF (stderr, " %d", *bottom); |
| 2400 | YYFPRINTF (stderr, "\n"); |
| 2401 | } |
| 2402 | |
| 2403 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2404 | do { \ |
| 2405 | if (yydebug) \ |
| 2406 | yy_stack_print ((Bottom), (Top)); \ |
| 2407 | } while (0) |
| 2408 | |
| 2409 | |
| 2410 | /*------------------------------------------------. |
| 2411 | | Report that the YYRULE is going to be reduced. | |
| 2412 | `------------------------------------------------*/ |
| 2413 | |
| 2414 | #if defined (__STDC__) || defined (__cplusplus) |
| 2415 | static void |
| 2416 | yy_reduce_print (int yyrule) |
| 2417 | #else |
| 2418 | static void |
| 2419 | yy_reduce_print (yyrule) |
| 2420 | int yyrule; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2421 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2422 | { |
| 2423 | int yyi; |
| 2424 | unsigned long int yylno = yyrline[yyrule]; |
| 2425 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2426 | yyrule - 1, yylno); |
| 2427 | /* Print the symbols being reduced, and their result. */ |
| 2428 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2429 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2430 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2431 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2432 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2433 | # define YY_REDUCE_PRINT(Rule) \ |
| 2434 | do { \ |
| 2435 | if (yydebug) \ |
| 2436 | yy_reduce_print (Rule); \ |
| 2437 | } while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2438 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2439 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2440 | multiple parsers can coexist. */ |
| 2441 | int yydebug; |
| 2442 | #else /* !YYDEBUG */ |
| 2443 | # define YYDPRINTF(Args) |
| 2444 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2445 | # define YY_STACK_PRINT(Bottom, Top) |
| 2446 | # define YY_REDUCE_PRINT(Rule) |
| 2447 | #endif /* !YYDEBUG */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2448 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2449 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2450 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2451 | #ifndef YYINITDEPTH |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2452 | # define YYINITDEPTH 200 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2453 | #endif |
| 2454 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2455 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2456 | if the built-in stack extension method is used). |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2457 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2458 | Do not make this value too large; the results are undefined if |
| 2459 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2460 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2461 | |
| 2462 | #ifndef YYMAXDEPTH |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2463 | # define YYMAXDEPTH 10000 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2464 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2465 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2466 | |
| 2467 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2468 | #if YYERROR_VERBOSE |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2469 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2470 | # ifndef yystrlen |
| 2471 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2472 | # define yystrlen strlen |
| 2473 | # else |
| 2474 | /* Return the length of YYSTR. */ |
| 2475 | static YYSIZE_T |
| 2476 | # if defined (__STDC__) || defined (__cplusplus) |
| 2477 | yystrlen (const char *yystr) |
| 2478 | # else |
| 2479 | yystrlen (yystr) |
| 2480 | const char *yystr; |
| 2481 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2482 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2483 | const char *yys = yystr; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2484 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2485 | while (*yys++ != '\0') |
| 2486 | continue; |
| 2487 | |
| 2488 | return yys - yystr - 1; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2489 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2490 | # endif |
| 2491 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2492 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2493 | # ifndef yystpcpy |
| 2494 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2495 | # define yystpcpy stpcpy |
| 2496 | # else |
| 2497 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2498 | YYDEST. */ |
| 2499 | static char * |
| 2500 | # if defined (__STDC__) || defined (__cplusplus) |
| 2501 | yystpcpy (char *yydest, const char *yysrc) |
| 2502 | # else |
| 2503 | yystpcpy (yydest, yysrc) |
| 2504 | char *yydest; |
| 2505 | const char *yysrc; |
| 2506 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2507 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2508 | char *yyd = yydest; |
| 2509 | const char *yys = yysrc; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2510 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2511 | while ((*yyd++ = *yys++) != '\0') |
| 2512 | continue; |
| 2513 | |
| 2514 | return yyd - 1; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2515 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2516 | # endif |
| 2517 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2518 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2519 | # ifndef yytnamerr |
| 2520 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2521 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2522 | heuristic is that double-quoting is unnecessary unless the string |
| 2523 | contains an apostrophe, a comma, or backslash (other than |
| 2524 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2525 | null, do not copy; instead, return the length of what the result |
| 2526 | would have been. */ |
| 2527 | static YYSIZE_T |
| 2528 | yytnamerr (char *yyres, const char *yystr) |
| 2529 | { |
| 2530 | if (*yystr == '"') |
| 2531 | { |
| 2532 | size_t yyn = 0; |
| 2533 | char const *yyp = yystr; |
| 2534 | |
| 2535 | for (;;) |
| 2536 | switch (*++yyp) |
| 2537 | { |
| 2538 | case '\'': |
| 2539 | case ',': |
| 2540 | goto do_not_strip_quotes; |
| 2541 | |
| 2542 | case '\\': |
| 2543 | if (*++yyp != '\\') |
| 2544 | goto do_not_strip_quotes; |
| 2545 | /* Fall through. */ |
| 2546 | default: |
| 2547 | if (yyres) |
| 2548 | yyres[yyn] = *yyp; |
| 2549 | yyn++; |
| 2550 | break; |
| 2551 | |
| 2552 | case '"': |
| 2553 | if (yyres) |
| 2554 | yyres[yyn] = '\0'; |
| 2555 | return yyn; |
| 2556 | } |
| 2557 | do_not_strip_quotes: ; |
| 2558 | } |
| 2559 | |
| 2560 | if (! yyres) |
| 2561 | return yystrlen (yystr); |
| 2562 | |
| 2563 | return yystpcpy (yyres, yystr) - yyres; |
| 2564 | } |
| 2565 | # endif |
| 2566 | |
| 2567 | #endif /* YYERROR_VERBOSE */ |
| 2568 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2569 | |
| 2570 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2571 | #if YYDEBUG |
| 2572 | /*--------------------------------. |
| 2573 | | Print this symbol on YYOUTPUT. | |
| 2574 | `--------------------------------*/ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2575 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2576 | #if defined (__STDC__) || defined (__cplusplus) |
| 2577 | static void |
| 2578 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2579 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2580 | static void |
| 2581 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2582 | FILE *yyoutput; |
| 2583 | int yytype; |
| 2584 | YYSTYPE *yyvaluep; |
| 2585 | #endif |
| 2586 | { |
| 2587 | /* Pacify ``unused variable'' warnings. */ |
| 2588 | (void) yyvaluep; |
| 2589 | |
| 2590 | if (yytype < YYNTOKENS) |
| 2591 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2592 | else |
| 2593 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2594 | |
| 2595 | |
| 2596 | # ifdef YYPRINT |
| 2597 | if (yytype < YYNTOKENS) |
| 2598 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2599 | # endif |
| 2600 | switch (yytype) |
| 2601 | { |
| 2602 | default: |
| 2603 | break; |
| 2604 | } |
| 2605 | YYFPRINTF (yyoutput, ")"); |
| 2606 | } |
| 2607 | |
| 2608 | #endif /* ! YYDEBUG */ |
| 2609 | /*-----------------------------------------------. |
| 2610 | | Release the memory associated to this symbol. | |
| 2611 | `-----------------------------------------------*/ |
| 2612 | |
| 2613 | #if defined (__STDC__) || defined (__cplusplus) |
| 2614 | static void |
| 2615 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2616 | #else |
| 2617 | static void |
| 2618 | yydestruct (yymsg, yytype, yyvaluep) |
| 2619 | const char *yymsg; |
| 2620 | int yytype; |
| 2621 | YYSTYPE *yyvaluep; |
| 2622 | #endif |
| 2623 | { |
| 2624 | /* Pacify ``unused variable'' warnings. */ |
| 2625 | (void) yyvaluep; |
| 2626 | |
| 2627 | if (!yymsg) |
| 2628 | yymsg = "Deleting"; |
| 2629 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2630 | |
| 2631 | switch (yytype) |
| 2632 | { |
| 2633 | |
| 2634 | default: |
| 2635 | break; |
| 2636 | } |
| 2637 | } |
| 2638 | |
| 2639 | |
| 2640 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2641 | |
| 2642 | #ifdef YYPARSE_PARAM |
| 2643 | # if defined (__STDC__) || defined (__cplusplus) |
| 2644 | int yyparse (void *YYPARSE_PARAM); |
| 2645 | # else |
| 2646 | int yyparse (); |
| 2647 | # endif |
| 2648 | #else /* ! YYPARSE_PARAM */ |
| 2649 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2650 | int yyparse (void); |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2651 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2652 | int yyparse (); |
| 2653 | #endif |
| 2654 | #endif /* ! YYPARSE_PARAM */ |
| 2655 | |
| 2656 | |
| 2657 | |
| 2658 | /* The look-ahead symbol. */ |
| 2659 | int yychar; |
| 2660 | |
| 2661 | /* The semantic value of the look-ahead symbol. */ |
| 2662 | YYSTYPE yylval; |
| 2663 | |
| 2664 | /* Number of syntax errors so far. */ |
| 2665 | int yynerrs; |
| 2666 | |
| 2667 | |
| 2668 | |
| 2669 | /*----------. |
| 2670 | | yyparse. | |
| 2671 | `----------*/ |
| 2672 | |
| 2673 | #ifdef YYPARSE_PARAM |
| 2674 | # if defined (__STDC__) || defined (__cplusplus) |
| 2675 | int yyparse (void *YYPARSE_PARAM) |
| 2676 | # else |
| 2677 | int yyparse (YYPARSE_PARAM) |
| 2678 | void *YYPARSE_PARAM; |
| 2679 | # endif |
| 2680 | #else /* ! YYPARSE_PARAM */ |
| 2681 | #if defined (__STDC__) || defined (__cplusplus) |
| 2682 | int |
| 2683 | yyparse (void) |
| 2684 | #else |
| 2685 | int |
| 2686 | yyparse () |
| 2687 | |
| 2688 | #endif |
| 2689 | #endif |
| 2690 | { |
| 2691 | |
| 2692 | int yystate; |
| 2693 | int yyn; |
| 2694 | int yyresult; |
| 2695 | /* Number of tokens to shift before error messages enabled. */ |
| 2696 | int yyerrstatus; |
| 2697 | /* Look-ahead token as an internal (translated) token number. */ |
| 2698 | int yytoken = 0; |
| 2699 | |
| 2700 | /* Three stacks and their tools: |
| 2701 | `yyss': related to states, |
| 2702 | `yyvs': related to semantic values, |
| 2703 | `yyls': related to locations. |
| 2704 | |
| 2705 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2706 | to reallocate them elsewhere. */ |
| 2707 | |
| 2708 | /* The state stack. */ |
| 2709 | short int yyssa[YYINITDEPTH]; |
| 2710 | short int *yyss = yyssa; |
| 2711 | short int *yyssp; |
| 2712 | |
| 2713 | /* The semantic value stack. */ |
| 2714 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2715 | YYSTYPE *yyvs = yyvsa; |
| 2716 | YYSTYPE *yyvsp; |
| 2717 | |
| 2718 | |
| 2719 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2720 | #define YYPOPSTACK (yyvsp--, yyssp--) |
| 2721 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2722 | YYSIZE_T yystacksize = YYINITDEPTH; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2723 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2724 | /* The variables used to return semantic value and location from the |
| 2725 | action routines. */ |
| 2726 | YYSTYPE yyval; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2727 | |
| 2728 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2729 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2730 | rule. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2731 | int yylen; |
| 2732 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2733 | YYDPRINTF ((stderr, "Starting parse\n")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2734 | |
| 2735 | yystate = 0; |
| 2736 | yyerrstatus = 0; |
| 2737 | yynerrs = 0; |
| 2738 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2739 | |
| 2740 | /* Initialize stack pointers. |
| 2741 | Waste one element of value and location stack |
| 2742 | so that they stay on the same level as the state stack. |
| 2743 | The wasted elements are never initialized. */ |
| 2744 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2745 | yyssp = yyss; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2746 | yyvsp = yyvs; |
| 2747 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2748 | goto yysetstate; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2749 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2750 | /*------------------------------------------------------------. |
| 2751 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2752 | `------------------------------------------------------------*/ |
| 2753 | yynewstate: |
| 2754 | /* In all cases, when you get here, the value and location stacks |
| 2755 | have just been pushed. so pushing a state here evens the stacks. |
| 2756 | */ |
| 2757 | yyssp++; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2758 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2759 | yysetstate: |
| 2760 | *yyssp = yystate; |
| 2761 | |
| 2762 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2763 | { |
| 2764 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2765 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2766 | |
| 2767 | #ifdef yyoverflow |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2768 | { |
| 2769 | /* Give user a chance to reallocate the stack. Use copies of |
| 2770 | these so that the &'s don't force the real ones into |
| 2771 | memory. */ |
| 2772 | YYSTYPE *yyvs1 = yyvs; |
| 2773 | short int *yyss1 = yyss; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2774 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2775 | |
| 2776 | /* Each stack pointer address is followed by the size of the |
| 2777 | data in use in that stack, in bytes. This used to be a |
| 2778 | conditional around just the two extra args, but that might |
| 2779 | be undefined if yyoverflow is a macro. */ |
| 2780 | yyoverflow (YY_("memory exhausted"), |
| 2781 | &yyss1, yysize * sizeof (*yyssp), |
| 2782 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2783 | |
| 2784 | &yystacksize); |
| 2785 | |
| 2786 | yyss = yyss1; |
| 2787 | yyvs = yyvs1; |
| 2788 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2789 | #else /* no yyoverflow */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2790 | # ifndef YYSTACK_RELOCATE |
| 2791 | goto yyexhaustedlab; |
| 2792 | # else |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2793 | /* Extend the stack our own way. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2794 | if (YYMAXDEPTH <= yystacksize) |
| 2795 | goto yyexhaustedlab; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2796 | yystacksize *= 2; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2797 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2798 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2799 | |
| 2800 | { |
| 2801 | short int *yyss1 = yyss; |
| 2802 | union yyalloc *yyptr = |
| 2803 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2804 | if (! yyptr) |
| 2805 | goto yyexhaustedlab; |
| 2806 | YYSTACK_RELOCATE (yyss); |
| 2807 | YYSTACK_RELOCATE (yyvs); |
| 2808 | |
| 2809 | # undef YYSTACK_RELOCATE |
| 2810 | if (yyss1 != yyssa) |
| 2811 | YYSTACK_FREE (yyss1); |
| 2812 | } |
| 2813 | # endif |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2814 | #endif /* no yyoverflow */ |
| 2815 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2816 | yyssp = yyss + yysize - 1; |
| 2817 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2818 | |
| 2819 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2820 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2821 | (unsigned long int) yystacksize)); |
| 2822 | |
| 2823 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2824 | YYABORT; |
| 2825 | } |
| 2826 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2827 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2828 | |
| 2829 | goto yybackup; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2830 | |
| 2831 | /*-----------. |
| 2832 | | yybackup. | |
| 2833 | `-----------*/ |
| 2834 | yybackup: |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2835 | |
| 2836 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2837 | /* Read a look-ahead token if we need one and don't already have one. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2838 | /* yyresume: */ |
| 2839 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2840 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2841 | |
| 2842 | yyn = yypact[yystate]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2843 | if (yyn == YYPACT_NINF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2844 | goto yydefault; |
| 2845 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2846 | /* Not known => get a look-ahead token if don't already have one. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2847 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2848 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2849 | if (yychar == YYEMPTY) |
| 2850 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2851 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2852 | yychar = YYLEX; |
| 2853 | } |
| 2854 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2855 | if (yychar <= YYEOF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2856 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2857 | yychar = yytoken = YYEOF; |
| 2858 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2859 | } |
| 2860 | else |
| 2861 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2862 | yytoken = YYTRANSLATE (yychar); |
| 2863 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2864 | } |
| 2865 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2866 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 2867 | detect an error, take that action. */ |
| 2868 | yyn += yytoken; |
| 2869 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2870 | goto yydefault; |
| 2871 | yyn = yytable[yyn]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2872 | if (yyn <= 0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2873 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2874 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2875 | goto yyerrlab; |
| 2876 | yyn = -yyn; |
| 2877 | goto yyreduce; |
| 2878 | } |
| 2879 | |
| 2880 | if (yyn == YYFINAL) |
| 2881 | YYACCEPT; |
| 2882 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2883 | /* Shift the look-ahead token. */ |
| 2884 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2885 | |
| 2886 | /* Discard the token being shifted unless it is eof. */ |
| 2887 | if (yychar != YYEOF) |
| 2888 | yychar = YYEMPTY; |
| 2889 | |
| 2890 | *++yyvsp = yylval; |
| 2891 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2892 | |
| 2893 | /* Count tokens shifted since error; after three, turn off error |
| 2894 | status. */ |
| 2895 | if (yyerrstatus) |
| 2896 | yyerrstatus--; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2897 | |
| 2898 | yystate = yyn; |
| 2899 | goto yynewstate; |
| 2900 | |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2901 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2902 | /*-----------------------------------------------------------. |
| 2903 | | yydefault -- do the default action for the current state. | |
| 2904 | `-----------------------------------------------------------*/ |
| 2905 | yydefault: |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2906 | yyn = yydefact[yystate]; |
| 2907 | if (yyn == 0) |
| 2908 | goto yyerrlab; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2909 | goto yyreduce; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2910 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2911 | |
| 2912 | /*-----------------------------. |
| 2913 | | yyreduce -- Do a reduction. | |
| 2914 | `-----------------------------*/ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2915 | yyreduce: |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2916 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2917 | yylen = yyr2[yyn]; |
| 2918 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2919 | /* If YYLEN is nonzero, implement the default value of the action: |
| 2920 | `$$ = $1'. |
| 2921 | |
| 2922 | Otherwise, the following line sets YYVAL to garbage. |
| 2923 | This behavior is undocumented and Bison |
| 2924 | users should not rely upon it. Assigning to YYVAL |
| 2925 | unconditionally makes the parser a bit smaller, and it avoids a |
| 2926 | GCC warning that YYVAL may be used uninitialized. */ |
| 2927 | yyval = yyvsp[1-yylen]; |
| 2928 | |
| 2929 | |
| 2930 | YY_REDUCE_PRINT (yyn); |
| 2931 | switch (yyn) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2932 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2933 | case 81: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2934 | #line 892 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2935 | { |
| 2936 | (yyval.String) = (yyvsp[-1].String); |
| 2937 | ;} |
| 2938 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2939 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2940 | case 82: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2941 | #line 895 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2942 | { |
| 2943 | (yyval.String) = new std::string(""); |
| 2944 | ;} |
| 2945 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2946 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2947 | case 90: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2948 | #line 902 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2949 | { (yyval.String) = new std::string(""); ;} |
| 2950 | break; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 2951 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2952 | case 97: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2953 | #line 907 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2954 | { |
| 2955 | *(yyvsp[-1].String) += *(yyvsp[0].String); |
| 2956 | delete (yyvsp[0].String); |
| 2957 | (yyval.String) = (yyvsp[-1].String); |
| 2958 | ;} |
| 2959 | break; |
Reid Spencer | 16244f4 | 2006-12-01 21:10:07 +0000 | [diff] [blame] | 2960 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2961 | case 98: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2962 | #line 912 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2963 | { (yyval.String) = new std::string(""); ;} |
| 2964 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2965 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2966 | case 99: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2967 | #line 917 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2968 | { (yyval.String) = new std::string(); ;} |
| 2969 | break; |
| 2970 | |
| 2971 | case 100: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2972 | #line 918 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2973 | { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;} |
| 2974 | break; |
| 2975 | |
| 2976 | case 101: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2977 | #line 921 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2978 | { (yyval.String) = new std::string(); ;} |
| 2979 | break; |
| 2980 | |
| 2981 | case 102: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2982 | #line 922 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2983 | { |
| 2984 | (yyvsp[-1].String)->insert(0, ", "); |
| 2985 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 2986 | delete (yyvsp[0].String); |
| 2987 | (yyval.String) = (yyvsp[-1].String); |
| 2988 | ;} |
| 2989 | break; |
| 2990 | |
| 2991 | case 103: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 2992 | #line 930 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2993 | { |
| 2994 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 2995 | delete (yyvsp[0].String); |
| 2996 | (yyval.String) = (yyvsp[-1].String); |
| 2997 | ;} |
| 2998 | break; |
| 2999 | |
| 3000 | case 104: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3001 | #line 936 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3002 | { (yyval.String) = new std::string(); ;} |
| 3003 | break; |
| 3004 | |
| 3005 | case 106: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3006 | #line 940 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3007 | { (yyval.String) = new std::string(); ;} |
| 3008 | break; |
| 3009 | |
| 3010 | case 107: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3011 | #line 941 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3012 | { |
| 3013 | (yyvsp[-1].String)->insert(0, ", "); |
| 3014 | if (!(yyvsp[0].String)->empty()) |
| 3015 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 3016 | delete (yyvsp[0].String); |
| 3017 | (yyval.String) = (yyvsp[-1].String); |
| 3018 | ;} |
| 3019 | break; |
| 3020 | |
| 3021 | case 109: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3022 | #line 951 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3023 | { |
| 3024 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 3025 | delete (yyvsp[0].String); |
| 3026 | (yyval.String) = (yyvsp[-1].String); |
| 3027 | ;} |
| 3028 | break; |
| 3029 | |
| 3030 | case 127: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3031 | #line 973 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3032 | { |
| 3033 | (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), OpaqueTy); |
| 3034 | ;} |
| 3035 | break; |
| 3036 | |
| 3037 | case 128: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3038 | #line 976 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3039 | { |
| 3040 | (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UnresolvedTy); |
| 3041 | ;} |
| 3042 | break; |
| 3043 | |
| 3044 | case 129: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3045 | #line 979 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3046 | { |
| 3047 | (yyval.Type) = (yyvsp[0].Type); |
| 3048 | ;} |
| 3049 | break; |
| 3050 | |
| 3051 | case 130: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3052 | #line 982 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3053 | { // Type UpReference |
| 3054 | (yyvsp[0].String)->insert(0, "\\"); |
| 3055 | (yyval.Type) = TypeInfo::get(*(yyvsp[0].String), UpRefTy); |
| 3056 | ;} |
| 3057 | break; |
| 3058 | |
| 3059 | case 131: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3060 | #line 986 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3061 | { // Function derived type? |
| 3062 | std::string newTy( (yyvsp[-3].Type)->getNewTy() + "("); |
| 3063 | for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3064 | if (i != 0) |
| 3065 | newTy += ", "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3066 | if ((*(yyvsp[-1].TypeVec))[i]->isVoid()) |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3067 | newTy += "..."; |
| 3068 | else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3069 | newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3070 | } |
| 3071 | newTy += ")"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3072 | (yyval.Type) = TypeInfo::get(newTy, (yyvsp[-3].Type), (yyvsp[-1].TypeVec)); |
| 3073 | ;} |
| 3074 | break; |
| 3075 | |
| 3076 | case 132: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3077 | #line 999 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3078 | { // Sized array type? |
| 3079 | uint64_t elems = atoi((yyvsp[-3].String)->c_str()); |
| 3080 | (yyvsp[-3].String)->insert(0,"[ "); |
| 3081 | *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " ]"; |
| 3082 | (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Type), elems); |
| 3083 | ;} |
| 3084 | break; |
| 3085 | |
| 3086 | case 133: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3087 | #line 1005 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3088 | { // Packed array type? |
| 3089 | uint64_t elems = atoi((yyvsp[-3].String)->c_str()); |
| 3090 | (yyvsp[-3].String)->insert(0,"< "); |
| 3091 | *(yyvsp[-3].String) += " x " + (yyvsp[-1].Type)->getNewTy() + " >"; |
| 3092 | (yyval.Type) = TypeInfo::get(*(yyvsp[-3].String), PackedTy, (yyvsp[-1].Type), elems); |
| 3093 | ;} |
| 3094 | break; |
| 3095 | |
| 3096 | case 134: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3097 | #line 1011 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3098 | { // Structure type? |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3099 | std::string newTy("{"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3100 | for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3101 | if (i != 0) |
| 3102 | newTy += ", "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3103 | newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3104 | } |
| 3105 | newTy += "}"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3106 | (yyval.Type) = TypeInfo::get(newTy, StructTy, (yyvsp[-1].TypeVec)); |
| 3107 | ;} |
| 3108 | break; |
| 3109 | |
| 3110 | case 135: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3111 | #line 1021 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3112 | { // Empty structure type? |
| 3113 | (yyval.Type) = TypeInfo::get("{}", StructTy, new TypeList()); |
| 3114 | ;} |
| 3115 | break; |
| 3116 | |
| 3117 | case 136: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3118 | #line 1024 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3119 | { // Packed Structure type? |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3120 | std::string newTy("<{"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3121 | for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3122 | if (i != 0) |
| 3123 | newTy += ", "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3124 | newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3125 | } |
| 3126 | newTy += "}>"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3127 | (yyval.Type) = TypeInfo::get(newTy, PackedStructTy, (yyvsp[-2].TypeVec)); |
| 3128 | ;} |
| 3129 | break; |
| 3130 | |
| 3131 | case 137: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3132 | #line 1034 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3133 | { // Empty packed structure type? |
| 3134 | (yyval.Type) = TypeInfo::get("<{}>", PackedStructTy, new TypeList()); |
| 3135 | ;} |
| 3136 | break; |
| 3137 | |
| 3138 | case 138: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3139 | #line 1037 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3140 | { // Pointer type? |
| 3141 | (yyval.Type) = (yyvsp[-1].Type)->getPointerType(); |
| 3142 | ;} |
| 3143 | break; |
| 3144 | |
| 3145 | case 139: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3146 | #line 1045 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3147 | { |
| 3148 | (yyval.TypeVec) = new TypeList(); |
| 3149 | (yyval.TypeVec)->push_back((yyvsp[0].Type)); |
| 3150 | ;} |
| 3151 | break; |
| 3152 | |
| 3153 | case 140: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3154 | #line 1049 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3155 | { |
| 3156 | (yyval.TypeVec) = (yyvsp[-2].TypeVec); |
| 3157 | (yyval.TypeVec)->push_back((yyvsp[0].Type)); |
| 3158 | ;} |
| 3159 | break; |
| 3160 | |
| 3161 | case 142: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3162 | #line 1057 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3163 | { |
| 3164 | (yyval.TypeVec) = (yyvsp[-2].TypeVec); |
| 3165 | (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy)); |
| 3166 | delete (yyvsp[0].String); |
| 3167 | ;} |
| 3168 | break; |
| 3169 | |
| 3170 | case 143: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3171 | #line 1062 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3172 | { |
| 3173 | (yyval.TypeVec) = new TypeList(); |
| 3174 | (yyval.TypeVec)->push_back(TypeInfo::get("void",VoidTy)); |
| 3175 | delete (yyvsp[0].String); |
| 3176 | ;} |
| 3177 | break; |
| 3178 | |
| 3179 | case 144: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3180 | #line 1067 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3181 | { |
| 3182 | (yyval.TypeVec) = new TypeList(); |
| 3183 | ;} |
| 3184 | break; |
| 3185 | |
| 3186 | case 145: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3187 | #line 1077 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3188 | { // Nonempty unsized arr |
| 3189 | (yyval.Const).type = (yyvsp[-3].Type); |
| 3190 | (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy()); |
| 3191 | *(yyval.Const).cnst += " [ " + *(yyvsp[-1].String) + " ]"; |
| 3192 | delete (yyvsp[-1].String); |
| 3193 | ;} |
| 3194 | break; |
| 3195 | |
| 3196 | case 146: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3197 | #line 1083 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3198 | { |
| 3199 | (yyval.Const).type = (yyvsp[-2].Type); |
| 3200 | (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy()); |
| 3201 | *(yyval.Const).cnst += "[ ]"; |
| 3202 | ;} |
| 3203 | break; |
| 3204 | |
| 3205 | case 147: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3206 | #line 1088 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3207 | { |
| 3208 | (yyval.Const).type = (yyvsp[-2].Type); |
| 3209 | (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy()); |
| 3210 | *(yyval.Const).cnst += " c" + *(yyvsp[0].String); |
| 3211 | delete (yyvsp[0].String); |
| 3212 | ;} |
| 3213 | break; |
| 3214 | |
| 3215 | case 148: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3216 | #line 1094 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3217 | { // Nonempty unsized arr |
| 3218 | (yyval.Const).type = (yyvsp[-3].Type); |
| 3219 | (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy()); |
| 3220 | *(yyval.Const).cnst += " < " + *(yyvsp[-1].String) + " >"; |
| 3221 | delete (yyvsp[-1].String); |
| 3222 | ;} |
| 3223 | break; |
| 3224 | |
| 3225 | case 149: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3226 | #line 1100 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3227 | { |
| 3228 | (yyval.Const).type = (yyvsp[-3].Type); |
| 3229 | (yyval.Const).cnst = new std::string((yyvsp[-3].Type)->getNewTy()); |
| 3230 | *(yyval.Const).cnst += " { " + *(yyvsp[-1].String) + " }"; |
| 3231 | delete (yyvsp[-1].String); |
| 3232 | ;} |
| 3233 | break; |
| 3234 | |
| 3235 | case 150: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3236 | #line 1106 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3237 | { |
| 3238 | (yyval.Const).type = (yyvsp[-2].Type); |
| 3239 | (yyval.Const).cnst = new std::string((yyvsp[-2].Type)->getNewTy()); |
| 3240 | *(yyval.Const).cnst += " {}"; |
| 3241 | ;} |
| 3242 | break; |
| 3243 | |
| 3244 | case 151: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3245 | #line 1111 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3246 | { |
| 3247 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3248 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3249 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3250 | delete (yyvsp[0].String); |
| 3251 | ;} |
| 3252 | break; |
| 3253 | |
| 3254 | case 152: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3255 | #line 1117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3256 | { |
| 3257 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3258 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3259 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3260 | delete (yyvsp[0].String); |
| 3261 | ;} |
| 3262 | break; |
| 3263 | |
| 3264 | case 153: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3265 | #line 1123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3266 | { |
| 3267 | std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve(), true); |
| 3268 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3269 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3270 | *(yyval.Const).cnst += " " + Name; |
| 3271 | delete (yyvsp[0].String); |
| 3272 | ;} |
| 3273 | break; |
| 3274 | |
| 3275 | case 154: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3276 | #line 1130 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3277 | { |
| 3278 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3279 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3280 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3281 | delete (yyvsp[0].String); |
| 3282 | ;} |
| 3283 | break; |
| 3284 | |
| 3285 | case 155: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3286 | #line 1136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3287 | { |
| 3288 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3289 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3290 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3291 | delete (yyvsp[0].String); |
| 3292 | ;} |
| 3293 | break; |
| 3294 | |
| 3295 | case 156: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3296 | #line 1142 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3297 | { // integral constants |
| 3298 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3299 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3300 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3301 | delete (yyvsp[0].String); |
| 3302 | ;} |
| 3303 | break; |
| 3304 | |
| 3305 | case 157: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3306 | #line 1148 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3307 | { // integral constants |
| 3308 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3309 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3310 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3311 | delete (yyvsp[0].String); |
| 3312 | ;} |
| 3313 | break; |
| 3314 | |
| 3315 | case 158: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3316 | #line 1154 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3317 | { // Boolean constants |
| 3318 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3319 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3320 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3321 | delete (yyvsp[0].String); |
| 3322 | ;} |
| 3323 | break; |
| 3324 | |
| 3325 | case 159: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3326 | #line 1160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3327 | { // Boolean constants |
| 3328 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3329 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3330 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3331 | delete (yyvsp[0].String); |
| 3332 | ;} |
| 3333 | break; |
| 3334 | |
| 3335 | case 160: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3336 | #line 1166 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3337 | { // Float & Double constants |
| 3338 | (yyval.Const).type = (yyvsp[-1].Type); |
| 3339 | (yyval.Const).cnst = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3340 | *(yyval.Const).cnst += " " + *(yyvsp[0].String); |
| 3341 | delete (yyvsp[0].String); |
| 3342 | ;} |
| 3343 | break; |
| 3344 | |
| 3345 | case 161: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3346 | #line 1174 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3347 | { |
| 3348 | std::string source = *(yyvsp[-3].Const).cnst; |
| 3349 | const TypeInfo* SrcTy = (yyvsp[-3].Const).type->resolve(); |
| 3350 | const TypeInfo* DstTy = (yyvsp[-1].Type)->resolve(); |
| 3351 | if (*(yyvsp[-5].String) == "cast") { |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 3352 | // Call getCastUpgrade to upgrade the old cast |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3353 | (yyval.String) = new std::string(getCastUpgrade(source, SrcTy, DstTy, true)); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 3354 | } else { |
| 3355 | // Nothing to upgrade, just create the cast constant expr |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3356 | (yyval.String) = new std::string(*(yyvsp[-5].String)); |
| 3357 | *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Type)->getNewTy() + ")"; |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 3358 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3359 | delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); delete (yyvsp[-2].String); |
| 3360 | ;} |
| 3361 | break; |
| 3362 | |
| 3363 | case 162: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3364 | #line 1188 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3365 | { |
| 3366 | *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst; |
| 3367 | for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) { |
| 3368 | ValueInfo& VI = (*(yyvsp[-1].ValList))[i]; |
| 3369 | *(yyvsp[-4].String) += ", " + *VI.val; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 3370 | VI.destroy(); |
| 3371 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3372 | *(yyvsp[-4].String) += ")"; |
| 3373 | (yyval.String) = (yyvsp[-4].String); |
| 3374 | (yyvsp[-2].Const).destroy(); |
| 3375 | delete (yyvsp[-1].ValList); |
| 3376 | ;} |
| 3377 | break; |
| 3378 | |
| 3379 | case 163: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3380 | #line 1200 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3381 | { |
| 3382 | *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3383 | (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3384 | (yyval.String) = (yyvsp[-7].String); |
| 3385 | ;} |
| 3386 | break; |
| 3387 | |
| 3388 | case 164: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3389 | #line 1205 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3390 | { |
| 3391 | const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type); |
| 3392 | (yyval.String) = new std::string(op); |
| 3393 | *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3394 | delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3395 | ;} |
| 3396 | break; |
| 3397 | |
| 3398 | case 165: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3399 | #line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3400 | { |
| 3401 | *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3402 | (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3403 | (yyval.String) = (yyvsp[-5].String); |
| 3404 | ;} |
| 3405 | break; |
| 3406 | |
| 3407 | case 166: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3408 | #line 1216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3409 | { |
| 3410 | *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type); |
| 3411 | *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3412 | (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3413 | (yyval.String) = (yyvsp[-5].String); |
| 3414 | ;} |
| 3415 | break; |
| 3416 | |
| 3417 | case 167: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3418 | #line 1222 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3419 | { |
Reid Spencer | a7c46fa | 2007-01-06 00:23:53 +0000 | [diff] [blame] | 3420 | *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3421 | delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3422 | (yyval.String) = (yyvsp[-6].String); |
| 3423 | ;} |
| 3424 | break; |
| 3425 | |
| 3426 | case 168: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3427 | #line 1227 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3428 | { |
Reid Spencer | a7c46fa | 2007-01-06 00:23:53 +0000 | [diff] [blame] | 3429 | *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3430 | delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3431 | (yyval.String) = (yyvsp[-6].String); |
| 3432 | ;} |
| 3433 | break; |
| 3434 | |
| 3435 | case 169: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3436 | #line 1232 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3437 | { |
| 3438 | const char* shiftop = (yyvsp[-5].String)->c_str(); |
| 3439 | if (*(yyvsp[-5].String) == "shr") |
| 3440 | shiftop = ((yyvsp[-3].Const).type->isUnsigned()) ? "lshr" : "ashr"; |
| 3441 | (yyval.String) = new std::string(shiftop); |
| 3442 | *(yyval.String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3443 | delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3444 | ;} |
| 3445 | break; |
| 3446 | |
| 3447 | case 170: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3448 | #line 1240 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3449 | { |
| 3450 | *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3451 | (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3452 | (yyval.String) = (yyvsp[-5].String); |
| 3453 | ;} |
| 3454 | break; |
| 3455 | |
| 3456 | case 171: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3457 | #line 1245 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3458 | { |
| 3459 | *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3460 | (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3461 | (yyval.String) = (yyvsp[-7].String); |
| 3462 | ;} |
| 3463 | break; |
| 3464 | |
| 3465 | case 172: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3466 | #line 1250 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3467 | { |
| 3468 | *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")"; |
| 3469 | (yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy(); |
| 3470 | (yyval.String) = (yyvsp[-7].String); |
| 3471 | ;} |
| 3472 | break; |
| 3473 | |
| 3474 | case 173: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3475 | #line 1260 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3476 | { |
| 3477 | *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst; |
| 3478 | (yyvsp[0].Const).destroy(); |
| 3479 | (yyval.String) = (yyvsp[-2].String); |
| 3480 | ;} |
| 3481 | break; |
| 3482 | |
| 3483 | case 174: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3484 | #line 1265 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3485 | { (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;} |
| 3486 | break; |
| 3487 | |
| 3488 | case 177: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3489 | #line 1280 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3490 | { |
| 3491 | ;} |
| 3492 | break; |
| 3493 | |
| 3494 | case 178: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3495 | #line 1285 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3496 | { |
| 3497 | (yyval.String) = 0; |
| 3498 | ;} |
| 3499 | break; |
| 3500 | |
| 3501 | case 179: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3502 | #line 1288 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3503 | { |
| 3504 | *O << *(yyvsp[0].String) << '\n'; |
| 3505 | delete (yyvsp[0].String); |
| 3506 | (yyval.String) = 0; |
| 3507 | ;} |
| 3508 | break; |
| 3509 | |
| 3510 | case 180: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3511 | #line 1293 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3512 | { |
| 3513 | *O << "module asm " << ' ' << *(yyvsp[0].String) << '\n'; |
| 3514 | (yyval.String) = 0; |
| 3515 | ;} |
| 3516 | break; |
| 3517 | |
| 3518 | case 181: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3519 | #line 1297 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3520 | { |
Reid Spencer | d154b57 | 2006-12-01 20:36:40 +0000 | [diff] [blame] | 3521 | *O << "implementation\n"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3522 | (yyval.String) = 0; |
| 3523 | ;} |
| 3524 | break; |
| 3525 | |
| 3526 | case 182: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3527 | #line 1301 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3528 | { (yyval.String) = 0; ;} |
| 3529 | break; |
| 3530 | |
| 3531 | case 184: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3532 | #line 1303 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3533 | { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;} |
| 3534 | break; |
| 3535 | |
| 3536 | case 185: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3537 | #line 1306 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3538 | { |
| 3539 | EnumeratedTypes.push_back((yyvsp[0].Type)); |
| 3540 | if (!(yyvsp[-2].String)->empty()) { |
| 3541 | NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Type); |
| 3542 | *O << *(yyvsp[-2].String) << " = "; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 3543 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3544 | *O << "type " << (yyvsp[0].Type)->getNewTy() << '\n'; |
| 3545 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); |
| 3546 | (yyval.String) = 0; |
| 3547 | ;} |
| 3548 | break; |
| 3549 | |
| 3550 | case 186: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3551 | #line 1316 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3552 | { // Function prototypes can be in const pool |
| 3553 | *O << *(yyvsp[0].String) << '\n'; |
| 3554 | delete (yyvsp[0].String); |
| 3555 | (yyval.String) = 0; |
| 3556 | ;} |
| 3557 | break; |
| 3558 | |
| 3559 | case 187: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3560 | #line 1321 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3561 | { // Asm blocks can be in the const pool |
| 3562 | *O << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n'; |
| 3563 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 3564 | (yyval.String) = 0; |
| 3565 | ;} |
| 3566 | break; |
| 3567 | |
| 3568 | case 188: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3569 | #line 1326 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3570 | { |
| 3571 | if (!(yyvsp[-4].String)->empty()) { |
| 3572 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const).type->getPointerType(), |
| 3573 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3574 | *O << Name << " = "; |
Reid Spencer | f12ee42 | 2006-12-05 19:21:25 +0000 | [diff] [blame] | 3575 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3576 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const).cnst << ' ' << *(yyvsp[0].String) << '\n'; |
| 3577 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3578 | (yyval.String) = 0; |
| 3579 | ;} |
| 3580 | break; |
| 3581 | |
| 3582 | case 189: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3583 | #line 1336 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3584 | { |
| 3585 | if (!(yyvsp[-4].String)->empty()) { |
| 3586 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(), |
| 3587 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3588 | *O << Name << " = "; |
Reid Spencer | f12ee42 | 2006-12-05 19:21:25 +0000 | [diff] [blame] | 3589 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3590 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n'; |
| 3591 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3592 | (yyval.String) = 0; |
| 3593 | ;} |
| 3594 | break; |
| 3595 | |
| 3596 | case 190: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3597 | #line 1346 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3598 | { |
| 3599 | if (!(yyvsp[-4].String)->empty()) { |
| 3600 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(), |
| 3601 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3602 | *O << Name << " = "; |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3603 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3604 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n'; |
| 3605 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3606 | (yyval.String) = 0; |
| 3607 | ;} |
| 3608 | break; |
| 3609 | |
| 3610 | case 191: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3611 | #line 1356 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3612 | { |
| 3613 | if (!(yyvsp[-4].String)->empty()) { |
| 3614 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Type)->getPointerType(), |
| 3615 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3616 | *O << Name << " = "; |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 3617 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3618 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n'; |
| 3619 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3620 | (yyval.String) = 0; |
| 3621 | ;} |
| 3622 | break; |
| 3623 | |
| 3624 | case 192: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3625 | #line 1366 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3626 | { |
| 3627 | *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n'; |
| 3628 | delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 3629 | (yyval.String) = 0; |
| 3630 | ;} |
| 3631 | break; |
| 3632 | |
| 3633 | case 193: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3634 | #line 1371 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3635 | { |
| 3636 | *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n'; |
| 3637 | delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3638 | (yyval.String) = 0; |
| 3639 | ;} |
| 3640 | break; |
| 3641 | |
| 3642 | case 194: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3643 | #line 1376 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3644 | { |
| 3645 | (yyval.String) = 0; |
| 3646 | ;} |
| 3647 | break; |
| 3648 | |
| 3649 | case 198: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3650 | #line 1386 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3651 | { |
| 3652 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3653 | delete (yyvsp[0].String); |
| 3654 | (yyval.String) = (yyvsp[-2].String); |
| 3655 | ;} |
| 3656 | break; |
| 3657 | |
| 3658 | case 199: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3659 | #line 1391 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3660 | { |
| 3661 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3662 | if (*(yyvsp[0].String) == "64") |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3663 | SizeOfPointer = 64; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3664 | delete (yyvsp[0].String); |
| 3665 | (yyval.String) = (yyvsp[-2].String); |
| 3666 | ;} |
| 3667 | break; |
| 3668 | |
| 3669 | case 200: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3670 | #line 1398 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3671 | { |
| 3672 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3673 | delete (yyvsp[0].String); |
| 3674 | (yyval.String) = (yyvsp[-2].String); |
| 3675 | ;} |
| 3676 | break; |
| 3677 | |
| 3678 | case 201: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3679 | #line 1403 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3680 | { |
| 3681 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3682 | delete (yyvsp[0].String); |
| 3683 | (yyval.String) = (yyvsp[-2].String); |
| 3684 | ;} |
| 3685 | break; |
| 3686 | |
| 3687 | case 202: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3688 | #line 1410 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3689 | { |
| 3690 | (yyvsp[-1].String)->insert(0, "[ "); |
| 3691 | *(yyvsp[-1].String) += " ]"; |
| 3692 | (yyval.String) = (yyvsp[-1].String); |
| 3693 | ;} |
| 3694 | break; |
| 3695 | |
| 3696 | case 203: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3697 | #line 1417 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3698 | { |
| 3699 | *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); |
| 3700 | delete (yyvsp[0].String); |
| 3701 | (yyval.String) = (yyvsp[-2].String); |
| 3702 | ;} |
| 3703 | break; |
| 3704 | |
| 3705 | case 205: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3706 | #line 1423 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3707 | { |
| 3708 | (yyval.String) = new std::string(); |
| 3709 | ;} |
| 3710 | break; |
| 3711 | |
| 3712 | case 209: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3713 | #line 1432 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3714 | { (yyval.String) = new std::string(); ;} |
| 3715 | break; |
| 3716 | |
| 3717 | case 210: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3718 | #line 1434 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3719 | { |
| 3720 | (yyval.String) = new std::string((yyvsp[-1].Type)->getNewTy()); |
| 3721 | if (!(yyvsp[0].String)->empty()) { |
| 3722 | std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Type)->resolve()); |
| 3723 | *(yyval.String) += " " + Name; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3724 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3725 | delete (yyvsp[0].String); |
| 3726 | ;} |
| 3727 | break; |
| 3728 | |
| 3729 | case 211: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3730 | #line 1443 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3731 | { |
| 3732 | *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); |
| 3733 | delete (yyvsp[0].String); |
| 3734 | ;} |
| 3735 | break; |
| 3736 | |
| 3737 | case 212: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3738 | #line 1447 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3739 | { |
| 3740 | (yyval.String) = (yyvsp[0].String); |
| 3741 | ;} |
| 3742 | break; |
| 3743 | |
| 3744 | case 213: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3745 | #line 1451 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3746 | { |
| 3747 | (yyval.String) = (yyvsp[0].String); |
| 3748 | ;} |
| 3749 | break; |
| 3750 | |
| 3751 | case 214: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3752 | #line 1454 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3753 | { |
| 3754 | *(yyvsp[-2].String) += ", ..."; |
| 3755 | (yyval.String) = (yyvsp[-2].String); |
| 3756 | delete (yyvsp[0].String); |
| 3757 | ;} |
| 3758 | break; |
| 3759 | |
| 3760 | case 215: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3761 | #line 1459 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3762 | { |
| 3763 | (yyval.String) = (yyvsp[0].String); |
| 3764 | ;} |
| 3765 | break; |
| 3766 | |
| 3767 | case 216: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3768 | #line 1462 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3769 | { (yyval.String) = new std::string(); ;} |
| 3770 | break; |
| 3771 | |
| 3772 | case 217: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3773 | #line 1465 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3774 | { |
| 3775 | if (!(yyvsp[-7].String)->empty()) { |
| 3776 | *(yyvsp[-7].String) += " "; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3777 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3778 | *(yyvsp[-7].String) += (yyvsp[-6].Type)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")"; |
| 3779 | if (!(yyvsp[-1].String)->empty()) { |
| 3780 | *(yyvsp[-7].String) += " " + *(yyvsp[-1].String); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3781 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3782 | if (!(yyvsp[0].String)->empty()) { |
| 3783 | *(yyvsp[-7].String) += " " + *(yyvsp[0].String); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3784 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3785 | delete (yyvsp[-5].String); |
| 3786 | delete (yyvsp[-3].String); |
| 3787 | delete (yyvsp[-1].String); |
| 3788 | delete (yyvsp[0].String); |
| 3789 | (yyval.String) = (yyvsp[-7].String); |
| 3790 | ;} |
| 3791 | break; |
| 3792 | |
| 3793 | case 218: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3794 | #line 1483 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3795 | { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;} |
| 3796 | break; |
| 3797 | |
| 3798 | case 219: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3799 | #line 1484 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3800 | { (yyval.String) = new std::string ("{"); ;} |
| 3801 | break; |
| 3802 | |
| 3803 | case 220: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3804 | #line 1487 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3805 | { |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3806 | *O << "define "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3807 | if (!(yyvsp[-2].String)->empty()) { |
| 3808 | *O << *(yyvsp[-2].String) << ' '; |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3809 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3810 | *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n'; |
| 3811 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 3812 | (yyval.String) = 0; |
| 3813 | ;} |
| 3814 | break; |
| 3815 | |
| 3816 | case 221: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3817 | #line 1498 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3818 | { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;} |
| 3819 | break; |
| 3820 | |
| 3821 | case 222: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3822 | #line 1499 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3823 | { (yyval.String) = new std::string("}"); ;} |
| 3824 | break; |
| 3825 | |
| 3826 | case 223: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3827 | #line 1501 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3828 | { |
| 3829 | if ((yyvsp[-1].String)) |
| 3830 | *O << *(yyvsp[-1].String); |
| 3831 | *O << *(yyvsp[0].String) << "\n\n"; |
| 3832 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 3833 | (yyval.String) = 0; |
| 3834 | ;} |
| 3835 | break; |
| 3836 | |
| 3837 | case 224: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3838 | #line 1510 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3839 | { (yyval.String) = new std::string(); ;} |
| 3840 | break; |
| 3841 | |
| 3842 | case 227: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3843 | #line 1516 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3844 | { |
| 3845 | if (!(yyvsp[-1].String)->empty()) |
| 3846 | *(yyvsp[-2].String) += " " + *(yyvsp[-1].String); |
| 3847 | *(yyvsp[-2].String) += " " + *(yyvsp[0].String); |
| 3848 | delete (yyvsp[-1].String); |
| 3849 | delete (yyvsp[0].String); |
| 3850 | (yyval.String) = (yyvsp[-2].String); |
| 3851 | ;} |
| 3852 | break; |
| 3853 | |
| 3854 | case 228: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3855 | #line 1529 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3856 | { (yyval.String) = new std::string(); ;} |
| 3857 | break; |
| 3858 | |
| 3859 | case 238: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3860 | #line 1535 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3861 | { |
| 3862 | (yyvsp[-1].String)->insert(0, "<"); |
| 3863 | *(yyvsp[-1].String) += ">"; |
| 3864 | (yyval.String) = (yyvsp[-1].String); |
| 3865 | ;} |
| 3866 | break; |
| 3867 | |
| 3868 | case 240: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3869 | #line 1541 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3870 | { |
| 3871 | if (!(yyvsp[-3].String)->empty()) { |
| 3872 | *(yyvsp[-4].String) += " " + *(yyvsp[-3].String); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3873 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3874 | *(yyvsp[-4].String) += " " + *(yyvsp[-2].String) + ", " + *(yyvsp[0].String); |
| 3875 | delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3876 | (yyval.String) = (yyvsp[-4].String); |
| 3877 | ;} |
| 3878 | break; |
| 3879 | |
| 3880 | case 243: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3881 | #line 1554 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3882 | { |
| 3883 | (yyval.Value).val = (yyvsp[0].String); |
| 3884 | (yyval.Value).constant = false; |
| 3885 | (yyval.Value).type = 0; |
| 3886 | ;} |
| 3887 | break; |
| 3888 | |
| 3889 | case 244: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3890 | #line 1559 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3891 | { |
| 3892 | (yyval.Value).val = (yyvsp[0].String); |
| 3893 | (yyval.Value).constant = true; |
| 3894 | (yyval.Value).type = 0; |
| 3895 | ;} |
| 3896 | break; |
| 3897 | |
| 3898 | case 245: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3899 | #line 1569 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3900 | { |
| 3901 | (yyvsp[-1].Type) = (yyvsp[-1].Type)->resolve(); |
| 3902 | std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type)); |
| 3903 | (yyval.Value) = (yyvsp[0].Value); |
| 3904 | delete (yyval.Value).val; |
| 3905 | (yyval.Value).val = new std::string((yyvsp[-1].Type)->getNewTy() + " " + Name); |
| 3906 | (yyval.Value).type = (yyvsp[-1].Type); |
| 3907 | ;} |
| 3908 | break; |
| 3909 | |
| 3910 | case 246: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3911 | #line 1578 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3912 | { |
| 3913 | (yyval.String) = 0; |
| 3914 | ;} |
| 3915 | break; |
| 3916 | |
| 3917 | case 247: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3918 | #line 1581 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3919 | { // Do not allow functions with 0 basic blocks |
| 3920 | (yyval.String) = 0; |
| 3921 | ;} |
| 3922 | break; |
| 3923 | |
| 3924 | case 248: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3925 | #line 1589 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3926 | { |
| 3927 | (yyval.String) = 0; |
| 3928 | ;} |
| 3929 | break; |
| 3930 | |
| 3931 | case 249: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3932 | #line 1593 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3933 | { |
| 3934 | *O << " " << *(yyvsp[0].String) << '\n'; |
| 3935 | delete (yyvsp[0].String); |
| 3936 | (yyval.String) = 0; |
| 3937 | ;} |
| 3938 | break; |
| 3939 | |
| 3940 | case 250: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3941 | #line 1598 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3942 | { |
| 3943 | (yyval.String) = 0; |
| 3944 | ;} |
| 3945 | break; |
| 3946 | |
| 3947 | case 251: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3948 | #line 1601 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3949 | { |
| 3950 | *O << *(yyvsp[0].String) << '\n'; |
| 3951 | delete (yyvsp[0].String); |
| 3952 | (yyval.String) = 0; |
| 3953 | ;} |
| 3954 | break; |
| 3955 | |
| 3956 | case 253: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3957 | #line 1607 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3958 | { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;} |
| 3959 | break; |
| 3960 | |
| 3961 | case 254: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3962 | #line 1609 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3963 | { // Return with a result... |
| 3964 | *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Value).val << '\n'; |
| 3965 | delete (yyvsp[-1].String); (yyvsp[0].Value).destroy(); |
| 3966 | (yyval.String) = 0; |
| 3967 | ;} |
| 3968 | break; |
| 3969 | |
| 3970 | case 255: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3971 | #line 1614 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3972 | { // Return with no result... |
| 3973 | *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Type)->getNewTy() << '\n'; |
| 3974 | delete (yyvsp[-1].String); |
| 3975 | (yyval.String) = 0; |
| 3976 | ;} |
| 3977 | break; |
| 3978 | |
| 3979 | case 256: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3980 | #line 1619 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3981 | { // Unconditional Branch... |
| 3982 | *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n'; |
| 3983 | delete (yyvsp[-2].String); (yyvsp[0].Value).destroy(); |
| 3984 | (yyval.String) = 0; |
| 3985 | ;} |
| 3986 | break; |
| 3987 | |
| 3988 | case 257: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 3989 | #line 1624 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3990 | { |
| 3991 | std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type)); |
| 3992 | *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", " |
| 3993 | << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ", " << (yyvsp[-1].Type)->getNewTy() << ' ' |
| 3994 | << *(yyvsp[0].Value).val << '\n'; |
| 3995 | delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy(); |
| 3996 | (yyval.String) = 0; |
| 3997 | ;} |
| 3998 | break; |
| 3999 | |
| 4000 | case 258: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4001 | #line 1632 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4002 | { |
| 4003 | std::string Name = getUniqueName((yyvsp[-6].Value).val, (yyvsp[-7].Type)); |
| 4004 | *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Type)->getNewTy() << ' ' << Name << ", " |
| 4005 | << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n"; |
| 4006 | delete (yyvsp[-8].String); (yyvsp[-6].Value).destroy(); (yyvsp[-3].Value).destroy(); |
| 4007 | delete (yyvsp[-1].String); |
| 4008 | (yyval.String) = 0; |
| 4009 | ;} |
| 4010 | break; |
| 4011 | |
| 4012 | case 259: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4013 | #line 1640 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4014 | { |
| 4015 | std::string Name = getUniqueName((yyvsp[-5].Value).val, (yyvsp[-6].Type)); |
| 4016 | *O << " " << *(yyvsp[-7].String) << ' ' << (yyvsp[-6].Type)->getNewTy() << ' ' << Name << ", " |
| 4017 | << (yyvsp[-3].Type)->getNewTy() << ' ' << *(yyvsp[-2].Value).val << "[]\n"; |
| 4018 | delete (yyvsp[-7].String); (yyvsp[-5].Value).destroy(); (yyvsp[-2].Value).destroy(); |
| 4019 | (yyval.String) = 0; |
| 4020 | ;} |
| 4021 | break; |
| 4022 | |
| 4023 | case 260: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4024 | #line 1648 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4025 | { |
| 4026 | const TypeInfo* ResTy = getFunctionReturnType((yyvsp[-10].Type)); |
Reid Spencer | 16244f4 | 2006-12-01 21:10:07 +0000 | [diff] [blame] | 4027 | *O << " "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4028 | if (!(yyvsp[-13].String)->empty()) { |
| 4029 | std::string Name = getUniqueName((yyvsp[-13].String), ResTy); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 4030 | *O << Name << " = "; |
| 4031 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4032 | *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Type)->getNewTy() << ' ' << *(yyvsp[-9].Value).val << " ("; |
| 4033 | for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) { |
| 4034 | ValueInfo& VI = (*(yyvsp[-7].ValList))[i]; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4035 | *O << *VI.val; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4036 | if (i+1 < (yyvsp[-7].ValList)->size()) |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4037 | *O << ", "; |
| 4038 | VI.destroy(); |
| 4039 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4040 | *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Type)->getNewTy() << ' ' << *(yyvsp[-3].Value).val << ' ' |
| 4041 | << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Type)->getNewTy() << ' ' << *(yyvsp[0].Value).val << '\n'; |
| 4042 | delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); (yyvsp[-9].Value).destroy(); delete (yyvsp[-7].ValList); |
| 4043 | delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-2].String); (yyvsp[0].Value).destroy(); |
| 4044 | (yyval.String) = 0; |
| 4045 | ;} |
| 4046 | break; |
| 4047 | |
| 4048 | case 261: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4049 | #line 1669 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4050 | { |
| 4051 | *O << " " << *(yyvsp[0].String) << '\n'; |
| 4052 | delete (yyvsp[0].String); |
| 4053 | (yyval.String) = 0; |
| 4054 | ;} |
| 4055 | break; |
| 4056 | |
| 4057 | case 262: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4058 | #line 1674 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4059 | { |
| 4060 | *O << " " << *(yyvsp[0].String) << '\n'; |
| 4061 | delete (yyvsp[0].String); |
| 4062 | (yyval.String) = 0; |
| 4063 | ;} |
| 4064 | break; |
| 4065 | |
| 4066 | case 263: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4067 | #line 1680 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4068 | { |
| 4069 | *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Type)->getNewTy() + " " + |
| 4070 | *(yyvsp[0].Value).val; |
| 4071 | delete (yyvsp[-3].String); (yyvsp[0].Value).destroy(); |
| 4072 | (yyval.String) = (yyvsp[-5].String); |
| 4073 | ;} |
| 4074 | break; |
| 4075 | |
| 4076 | case 264: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4077 | #line 1686 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4078 | { |
| 4079 | (yyvsp[-3].String)->insert(0, (yyvsp[-4].Type)->getNewTy() + " " ); |
| 4080 | *(yyvsp[-3].String) += ", " + (yyvsp[-1].Type)->getNewTy() + " " + *(yyvsp[0].Value).val; |
| 4081 | (yyvsp[0].Value).destroy(); |
| 4082 | (yyval.String) = (yyvsp[-3].String); |
| 4083 | ;} |
| 4084 | break; |
| 4085 | |
| 4086 | case 265: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4087 | #line 1694 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4088 | { |
| 4089 | if (!(yyvsp[-1].String)->empty()) { |
| 4090 | // Get a unique name for this value, based on its type. |
| 4091 | std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Value).type); |
| 4092 | *(yyvsp[-1].String) = Name + " = "; |
| 4093 | if (deleteUselessCastFlag && *deleteUselessCastName == Name) { |
| 4094 | // don't actually delete it, just comment it out |
| 4095 | (yyvsp[-1].String)->insert(0, "; USELSS BITCAST: "); |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4096 | delete deleteUselessCastName; |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4097 | } |
| 4098 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4099 | *(yyvsp[-1].String) += *(yyvsp[0].Value).val; |
| 4100 | (yyvsp[0].Value).destroy(); |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4101 | deleteUselessCastFlag = false; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4102 | (yyval.String) = (yyvsp[-1].String); |
| 4103 | ;} |
| 4104 | break; |
| 4105 | |
| 4106 | case 266: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4107 | #line 1712 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4108 | { // Used for PHI nodes |
| 4109 | std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-5].Type)); |
| 4110 | Name.insert(0, (yyvsp[-5].Type)->getNewTy() + "["); |
| 4111 | Name += "," + *(yyvsp[-1].Value).val + "]"; |
| 4112 | (yyval.Value).val = new std::string(Name); |
| 4113 | (yyval.Value).type = (yyvsp[-5].Type); |
| 4114 | (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); |
| 4115 | ;} |
| 4116 | break; |
| 4117 | |
| 4118 | case 267: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4119 | #line 1720 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4120 | { |
| 4121 | std::string Name = getUniqueName((yyvsp[-3].Value).val, (yyvsp[-6].Value).type); |
| 4122 | *(yyvsp[-6].Value).val += ", [" + Name + "," + *(yyvsp[-1].Value).val + "]"; |
| 4123 | (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy(); |
| 4124 | (yyval.Value) = (yyvsp[-6].Value); |
| 4125 | ;} |
| 4126 | break; |
| 4127 | |
| 4128 | case 268: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4129 | #line 1729 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4130 | { |
| 4131 | (yyval.ValList) = new ValueList(); |
| 4132 | (yyval.ValList)->push_back((yyvsp[0].Value)); |
| 4133 | ;} |
| 4134 | break; |
| 4135 | |
| 4136 | case 269: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4137 | #line 1733 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4138 | { |
| 4139 | (yyval.ValList) = (yyvsp[-2].ValList); |
| 4140 | (yyval.ValList)->push_back((yyvsp[0].Value)); |
| 4141 | ;} |
| 4142 | break; |
| 4143 | |
| 4144 | case 270: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4145 | #line 1740 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4146 | { (yyval.ValList) = (yyvsp[0].ValList); ;} |
| 4147 | break; |
| 4148 | |
| 4149 | case 271: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4150 | #line 1741 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4151 | { (yyval.ValList) = new ValueList(); ;} |
| 4152 | break; |
| 4153 | |
| 4154 | case 272: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4155 | #line 1745 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4156 | { |
| 4157 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 4158 | delete (yyvsp[0].String); |
| 4159 | (yyval.String) = (yyvsp[-1].String); |
| 4160 | ;} |
| 4161 | break; |
| 4162 | |
| 4163 | case 274: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4164 | #line 1753 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4165 | { |
| 4166 | const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type)); |
| 4167 | std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type)); |
| 4168 | std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type)); |
| 4169 | (yyval.Value).val = new std::string(op); |
| 4170 | *(yyval.Value).val += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2; |
| 4171 | (yyval.Value).type = (yyvsp[-3].Type); |
| 4172 | delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
| 4173 | ;} |
| 4174 | break; |
| 4175 | |
| 4176 | case 275: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4177 | #line 1762 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4178 | { |
| 4179 | std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type)); |
| 4180 | std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type)); |
| 4181 | *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2; |
| 4182 | (yyval.Value).val = (yyvsp[-4].String); |
| 4183 | (yyval.Value).type = (yyvsp[-3].Type); |
| 4184 | (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
| 4185 | ;} |
| 4186 | break; |
| 4187 | |
| 4188 | case 276: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4189 | #line 1770 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4190 | { |
| 4191 | std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type)); |
| 4192 | std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type)); |
| 4193 | *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type)); |
| 4194 | *(yyvsp[-4].String) += " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + ", " + Name2; |
| 4195 | (yyval.Value).val = (yyvsp[-4].String); |
| 4196 | (yyval.Value).type = TypeInfo::get("bool",BoolTy); |
| 4197 | (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
| 4198 | ;} |
| 4199 | break; |
| 4200 | |
| 4201 | case 277: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4202 | #line 1779 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4203 | { |
| 4204 | std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type)); |
| 4205 | std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type)); |
| 4206 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2; |
| 4207 | (yyval.Value).val = (yyvsp[-5].String); |
| 4208 | (yyval.Value).type = TypeInfo::get("bool",BoolTy); |
| 4209 | delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
| 4210 | ;} |
| 4211 | break; |
| 4212 | |
| 4213 | case 278: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4214 | #line 1787 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4215 | { |
| 4216 | std::string Name1 = getUniqueName((yyvsp[-2].Value).val, (yyvsp[-3].Type)); |
| 4217 | std::string Name2 = getUniqueName((yyvsp[0].Value).val, (yyvsp[-3].Type)); |
| 4218 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Type)->getNewTy() + " " + Name1 + "," + Name2; |
| 4219 | (yyval.Value).val = (yyvsp[-5].String); |
| 4220 | (yyval.Value).type = TypeInfo::get("bool",BoolTy); |
| 4221 | delete (yyvsp[-4].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
| 4222 | ;} |
| 4223 | break; |
| 4224 | |
| 4225 | case 279: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4226 | #line 1795 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4227 | { |
| 4228 | (yyval.Value) = (yyvsp[0].Value); |
| 4229 | (yyval.Value).val->insert(0, *(yyvsp[-1].String) + " "); |
| 4230 | delete (yyvsp[-1].String); |
| 4231 | ;} |
| 4232 | break; |
| 4233 | |
| 4234 | case 280: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4235 | #line 1800 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4236 | { |
| 4237 | const char* shiftop = (yyvsp[-3].String)->c_str(); |
| 4238 | if (*(yyvsp[-3].String) == "shr") |
| 4239 | shiftop = ((yyvsp[-2].Value).type->isUnsigned()) ? "lshr" : "ashr"; |
| 4240 | (yyval.Value).val = new std::string(shiftop); |
| 4241 | *(yyval.Value).val += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; |
| 4242 | (yyval.Value).type = (yyvsp[-2].Value).type; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4243 | delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4244 | ;} |
| 4245 | break; |
| 4246 | |
| 4247 | case 281: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4248 | #line 1809 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4249 | { |
| 4250 | std::string source = *(yyvsp[-2].Value).val; |
| 4251 | const TypeInfo* SrcTy = (yyvsp[-2].Value).type->resolve(); |
| 4252 | const TypeInfo* DstTy = (yyvsp[0].Type)->resolve(); |
| 4253 | (yyval.Value).val = new std::string(); |
| 4254 | (yyval.Value).type = DstTy; |
| 4255 | if (*(yyvsp[-3].String) == "cast") { |
| 4256 | *(yyval.Value).val += getCastUpgrade(source, SrcTy, DstTy, false); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 4257 | } else { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4258 | *(yyval.Value).val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy(); |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 4259 | } |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4260 | // Check to see if this is a useless cast of a value to the same name |
| 4261 | // and the same type. Such casts will probably cause redefinition errors |
| 4262 | // when assembled and perform no code gen action so just remove them. |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4263 | if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast") |
| 4264 | if (SrcTy->isInteger() && DstTy->isInteger() && |
| 4265 | SrcTy->getBitWidth() == DstTy->getBitWidth()) { |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4266 | deleteUselessCastFlag = true; // Flag the "Inst" rule |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4267 | deleteUselessCastName = new std::string(*(yyvsp[-2].Value).val); // save the name |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4268 | size_t pos = deleteUselessCastName->find_first_of("%\"",0); |
| 4269 | if (pos != std::string::npos) { |
| 4270 | // remove the type portion before val |
| 4271 | deleteUselessCastName->erase(0, pos); |
| 4272 | } |
| 4273 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4274 | delete (yyvsp[-3].String); (yyvsp[-2].Value).destroy(); |
| 4275 | delete (yyvsp[-1].String); |
| 4276 | ;} |
| 4277 | break; |
| 4278 | |
| 4279 | case 282: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4280 | #line 1837 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4281 | { |
| 4282 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; |
| 4283 | (yyval.Value).val = (yyvsp[-5].String); |
| 4284 | (yyval.Value).type = (yyvsp[-2].Value).type; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4285 | (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4286 | ;} |
| 4287 | break; |
| 4288 | |
| 4289 | case 283: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4290 | #line 1843 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4291 | { |
| 4292 | *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + (yyvsp[0].Type)->getNewTy(); |
| 4293 | (yyval.Value).val = (yyvsp[-3].String); |
| 4294 | (yyval.Value).type = (yyvsp[0].Type); |
| 4295 | (yyvsp[-2].Value).destroy(); |
| 4296 | ;} |
| 4297 | break; |
| 4298 | |
| 4299 | case 284: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4300 | #line 1849 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4301 | { |
| 4302 | *(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; |
| 4303 | (yyval.Value).val = (yyvsp[-3].String); |
| 4304 | (yyvsp[-2].Value).type = (yyvsp[-2].Value).type->resolve();; |
| 4305 | (yyval.Value).type = (yyvsp[-2].Value).type->getElementType(); |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4306 | (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4307 | ;} |
| 4308 | break; |
| 4309 | |
| 4310 | case 285: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4311 | #line 1856 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4312 | { |
| 4313 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; |
| 4314 | (yyval.Value).val = (yyvsp[-5].String); |
| 4315 | (yyval.Value).type = (yyvsp[-4].Value).type; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4316 | (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4317 | ;} |
| 4318 | break; |
| 4319 | |
| 4320 | case 286: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4321 | #line 1862 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4322 | { |
| 4323 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val; |
| 4324 | (yyval.Value).val = (yyvsp[-5].String); |
| 4325 | (yyval.Value).type = (yyvsp[-4].Value).type; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4326 | (yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4327 | ;} |
| 4328 | break; |
| 4329 | |
| 4330 | case 287: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4331 | #line 1868 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4332 | { |
| 4333 | *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val; |
| 4334 | (yyval.Value).val = (yyvsp[-1].String); |
| 4335 | (yyval.Value).type = (yyvsp[0].Value).type; |
| 4336 | delete (yyvsp[0].Value).val; |
| 4337 | ;} |
| 4338 | break; |
| 4339 | |
| 4340 | case 288: |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4341 | #line 1874 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4342 | { |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4343 | // map llvm.isunordered to "fcmp uno" |
| 4344 | if (*(yyvsp[-3].Value).val == "%llvm.isunordered.f32" || |
| 4345 | *(yyvsp[-3].Value).val == "%llvm.isunordered.f64") { |
| 4346 | (yyval.Value).val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0].val + ", "); |
| 4347 | size_t pos = (*(yyvsp[-1].ValList))[1].val->find(' '); |
| 4348 | assert(pos != std::string::npos && "no space?"); |
| 4349 | *(yyval.Value).val += (*(yyvsp[-1].ValList))[1].val->substr(pos+1); |
| 4350 | (yyval.Value).type = TypeInfo::get("bool", BoolTy); |
| 4351 | } else { |
| 4352 | if (!(yyvsp[-5].String)->empty()) |
| 4353 | *(yyvsp[-6].String) += " " + *(yyvsp[-5].String); |
| 4354 | if (!(yyvsp[-6].String)->empty()) |
| 4355 | *(yyvsp[-6].String) += " "; |
| 4356 | *(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + *(yyvsp[-3].Value).val + "("; |
| 4357 | for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) { |
| 4358 | ValueInfo& VI = (*(yyvsp[-1].ValList))[i]; |
| 4359 | *(yyvsp[-6].String) += *VI.val; |
| 4360 | if (i+1 < (yyvsp[-1].ValList)->size()) |
| 4361 | *(yyvsp[-6].String) += ", "; |
| 4362 | VI.destroy(); |
| 4363 | } |
| 4364 | *(yyvsp[-6].String) += ")"; |
| 4365 | (yyval.Value).val = (yyvsp[-6].String); |
| 4366 | (yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type)); |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4367 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4368 | delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete (yyvsp[-1].ValList); |
| 4369 | ;} |
| 4370 | break; |
| 4371 | |
| 4372 | case 290: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4373 | #line 1907 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4374 | { (yyval.ValList) = (yyvsp[0].ValList); ;} |
| 4375 | break; |
| 4376 | |
| 4377 | case 291: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4378 | #line 1908 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4379 | { (yyval.ValList) = new ValueList(); ;} |
| 4380 | break; |
| 4381 | |
| 4382 | case 293: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4383 | #line 1913 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4384 | { (yyval.String) = new std::string(); ;} |
| 4385 | break; |
| 4386 | |
| 4387 | case 294: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4388 | #line 1916 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4389 | { |
| 4390 | *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy(); |
| 4391 | if (!(yyvsp[0].String)->empty()) |
| 4392 | *(yyvsp[-2].String) += " " + *(yyvsp[0].String); |
| 4393 | (yyval.Value).val = (yyvsp[-2].String); |
| 4394 | (yyval.Value).type = (yyvsp[-1].Type)->getPointerType(); |
| 4395 | delete (yyvsp[0].String); |
| 4396 | ;} |
| 4397 | break; |
| 4398 | |
| 4399 | case 295: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4400 | #line 1924 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4401 | { |
| 4402 | std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type)); |
| 4403 | *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name; |
| 4404 | if (!(yyvsp[0].String)->empty()) |
| 4405 | *(yyvsp[-5].String) += " " + *(yyvsp[0].String); |
| 4406 | (yyval.Value).val = (yyvsp[-5].String); |
| 4407 | (yyval.Value).type = (yyvsp[-4].Type)->getPointerType(); |
| 4408 | (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String); |
| 4409 | ;} |
| 4410 | break; |
| 4411 | |
| 4412 | case 296: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4413 | #line 1933 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4414 | { |
| 4415 | *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy(); |
| 4416 | if (!(yyvsp[0].String)->empty()) |
| 4417 | *(yyvsp[-2].String) += " " + *(yyvsp[0].String); |
| 4418 | (yyval.Value).val = (yyvsp[-2].String); |
| 4419 | (yyval.Value).type = (yyvsp[-1].Type)->getPointerType(); |
| 4420 | delete (yyvsp[0].String); |
| 4421 | ;} |
| 4422 | break; |
| 4423 | |
| 4424 | case 297: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4425 | #line 1941 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4426 | { |
| 4427 | std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type)); |
| 4428 | *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + (yyvsp[-2].Type)->getNewTy() + " " + Name; |
| 4429 | if (!(yyvsp[0].String)->empty()) |
| 4430 | *(yyvsp[-5].String) += " " + *(yyvsp[0].String); |
| 4431 | (yyval.Value).val = (yyvsp[-5].String); |
| 4432 | (yyval.Value).type = (yyvsp[-4].Type)->getPointerType(); |
| 4433 | (yyvsp[-1].Value).destroy(); delete (yyvsp[0].String); |
| 4434 | ;} |
| 4435 | break; |
| 4436 | |
| 4437 | case 298: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4438 | #line 1950 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4439 | { |
| 4440 | *(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val; |
| 4441 | (yyval.Value).val = (yyvsp[-1].String); |
| 4442 | (yyval.Value).type = TypeInfo::get("void", VoidTy); |
| 4443 | (yyvsp[0].Value).destroy(); |
| 4444 | ;} |
| 4445 | break; |
| 4446 | |
| 4447 | case 299: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4448 | #line 1956 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4449 | { |
| 4450 | std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type)); |
| 4451 | if (!(yyvsp[-3].String)->empty()) |
| 4452 | *(yyvsp[-3].String) += " "; |
| 4453 | *(yyvsp[-3].String) += *(yyvsp[-2].String) + " " + (yyvsp[-1].Type)->getNewTy() + " " + Name; |
| 4454 | (yyval.Value).val = (yyvsp[-3].String); |
| 4455 | (yyval.Value).type = (yyvsp[-1].Type)->getElementType(); |
| 4456 | delete (yyvsp[-2].String); (yyvsp[0].Value).destroy(); |
| 4457 | ;} |
| 4458 | break; |
| 4459 | |
| 4460 | case 300: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4461 | #line 1965 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4462 | { |
| 4463 | std::string Name = getUniqueName((yyvsp[0].Value).val, (yyvsp[-1].Type)); |
| 4464 | if (!(yyvsp[-5].String)->empty()) |
| 4465 | *(yyvsp[-5].String) += " "; |
| 4466 | *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Value).val + ", " + (yyvsp[-1].Type)->getNewTy() + " " + Name; |
| 4467 | (yyval.Value).val = (yyvsp[-5].String); |
| 4468 | (yyval.Value).type = TypeInfo::get("void", VoidTy); |
| 4469 | delete (yyvsp[-4].String); (yyvsp[-3].Value).destroy(); (yyvsp[0].Value).destroy(); |
| 4470 | ;} |
| 4471 | break; |
| 4472 | |
| 4473 | case 301: |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4474 | #line 1974 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4475 | { |
| 4476 | std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type)); |
Reid Spencer | f459d39 | 2006-12-02 16:19:52 +0000 | [diff] [blame] | 4477 | // Upgrade the indices |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4478 | for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) { |
| 4479 | ValueInfo& VI = (*(yyvsp[0].ValList))[i]; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 4480 | if (VI.type->isUnsigned() && !VI.isConstant() && |
| 4481 | VI.type->getBitWidth() < 64) { |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4482 | *O << " %gep_upgrade" << unique << " = zext " << *VI.val |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 4483 | << " to i64\n"; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 4484 | *VI.val = "i64 %gep_upgrade" + llvm::utostr(unique++); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4485 | VI.type = TypeInfo::get("i64",ULongTy); |
Reid Spencer | f459d39 | 2006-12-02 16:19:52 +0000 | [diff] [blame] | 4486 | } |
| 4487 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4488 | *(yyvsp[-3].String) += " " + (yyvsp[-2].Type)->getNewTy() + " " + Name; |
| 4489 | for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) { |
| 4490 | ValueInfo& VI = (*(yyvsp[0].ValList))[i]; |
| 4491 | *(yyvsp[-3].String) += ", " + *VI.val; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4492 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4493 | (yyval.Value).val = (yyvsp[-3].String); |
| 4494 | (yyval.Value).type = getGEPIndexedType((yyvsp[-2].Type),(yyvsp[0].ValList)); |
| 4495 | (yyvsp[-1].Value).destroy(); delete (yyvsp[0].ValList); |
| 4496 | ;} |
| 4497 | break; |
| 4498 | |
| 4499 | |
| 4500 | default: break; |
| 4501 | } |
| 4502 | |
| 4503 | /* Line 1126 of yacc.c. */ |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4504 | #line 4505 "UpgradeParser.tab.c" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4505 | |
| 4506 | yyvsp -= yylen; |
| 4507 | yyssp -= yylen; |
| 4508 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4509 | |
| 4510 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4511 | |
| 4512 | *++yyvsp = yyval; |
| 4513 | |
| 4514 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4515 | /* Now `shift' the result of the reduction. Determine what state |
| 4516 | that goes to, based on the state we popped back to and the rule |
| 4517 | number reduced by. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4518 | |
| 4519 | yyn = yyr1[yyn]; |
| 4520 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4521 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 4522 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4523 | yystate = yytable[yystate]; |
| 4524 | else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4525 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4526 | |
| 4527 | goto yynewstate; |
| 4528 | |
| 4529 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4530 | /*------------------------------------. |
| 4531 | | yyerrlab -- here on detecting error | |
| 4532 | `------------------------------------*/ |
| 4533 | yyerrlab: |
| 4534 | /* If not already recovering from an error, report this error. */ |
| 4535 | if (!yyerrstatus) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4536 | { |
| 4537 | ++yynerrs; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4538 | #if YYERROR_VERBOSE |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4539 | yyn = yypact[yystate]; |
| 4540 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4541 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4542 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4543 | int yytype = YYTRANSLATE (yychar); |
| 4544 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 4545 | YYSIZE_T yysize = yysize0; |
| 4546 | YYSIZE_T yysize1; |
| 4547 | int yysize_overflow = 0; |
| 4548 | char *yymsg = 0; |
| 4549 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 4550 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 4551 | int yyx; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4552 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4553 | #if 0 |
| 4554 | /* This is so xgettext sees the translatable formats that are |
| 4555 | constructed on the fly. */ |
| 4556 | YY_("syntax error, unexpected %s"); |
| 4557 | YY_("syntax error, unexpected %s, expecting %s"); |
| 4558 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 4559 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 4560 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 4561 | #endif |
| 4562 | char *yyfmt; |
| 4563 | char const *yyf; |
| 4564 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 4565 | static char const yyexpecting[] = ", expecting %s"; |
| 4566 | static char const yyor[] = " or %s"; |
| 4567 | char yyformat[sizeof yyunexpected |
| 4568 | + sizeof yyexpecting - 1 |
| 4569 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 4570 | * (sizeof yyor - 1))]; |
| 4571 | char const *yyprefix = yyexpecting; |
| 4572 | |
| 4573 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 4574 | YYCHECK. */ |
| 4575 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 4576 | |
| 4577 | /* Stay within bounds of both yycheck and yytname. */ |
| 4578 | int yychecklim = YYLAST - yyn; |
| 4579 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 4580 | int yycount = 1; |
| 4581 | |
| 4582 | yyarg[0] = yytname[yytype]; |
| 4583 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 4584 | |
| 4585 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 4586 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 4587 | { |
| 4588 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 4589 | { |
| 4590 | yycount = 1; |
| 4591 | yysize = yysize0; |
| 4592 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 4593 | break; |
| 4594 | } |
| 4595 | yyarg[yycount++] = yytname[yyx]; |
| 4596 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 4597 | yysize_overflow |= yysize1 < yysize; |
| 4598 | yysize = yysize1; |
| 4599 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 4600 | yyprefix = yyor; |
| 4601 | } |
| 4602 | |
| 4603 | yyf = YY_(yyformat); |
| 4604 | yysize1 = yysize + yystrlen (yyf); |
| 4605 | yysize_overflow |= yysize1 < yysize; |
| 4606 | yysize = yysize1; |
| 4607 | |
| 4608 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 4609 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 4610 | if (yymsg) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4611 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4612 | /* Avoid sprintf, as that infringes on the user's name space. |
| 4613 | Don't have undefined behavior even if the translation |
| 4614 | produced a string with the wrong number of "%s"s. */ |
| 4615 | char *yyp = yymsg; |
| 4616 | int yyi = 0; |
| 4617 | while ((*yyp = *yyf)) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4618 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4619 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 4620 | { |
| 4621 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 4622 | yyf += 2; |
| 4623 | } |
| 4624 | else |
| 4625 | { |
| 4626 | yyp++; |
| 4627 | yyf++; |
| 4628 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4629 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4630 | yyerror (yymsg); |
| 4631 | YYSTACK_FREE (yymsg); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4632 | } |
| 4633 | else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4634 | { |
| 4635 | yyerror (YY_("syntax error")); |
| 4636 | goto yyexhaustedlab; |
| 4637 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4638 | } |
| 4639 | else |
| 4640 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4641 | yyerror (YY_("syntax error")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4642 | } |
| 4643 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4644 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4645 | |
| 4646 | if (yyerrstatus == 3) |
| 4647 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4648 | /* If just tried and failed to reuse look-ahead token after an |
| 4649 | error, discard it. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4650 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4651 | if (yychar <= YYEOF) |
| 4652 | { |
| 4653 | /* Return failure if at end of input. */ |
| 4654 | if (yychar == YYEOF) |
| 4655 | YYABORT; |
| 4656 | } |
| 4657 | else |
| 4658 | { |
| 4659 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 4660 | yychar = YYEMPTY; |
| 4661 | } |
| 4662 | } |
| 4663 | |
| 4664 | /* Else will try to reuse look-ahead token after shifting the error |
| 4665 | token. */ |
| 4666 | goto yyerrlab1; |
| 4667 | |
| 4668 | |
| 4669 | /*---------------------------------------------------. |
| 4670 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 4671 | `---------------------------------------------------*/ |
| 4672 | yyerrorlab: |
| 4673 | |
| 4674 | /* Pacify compilers like GCC when the user code never invokes |
| 4675 | YYERROR and the label yyerrorlab therefore never appears in user |
| 4676 | code. */ |
| 4677 | if (0) |
| 4678 | goto yyerrorlab; |
| 4679 | |
| 4680 | yyvsp -= yylen; |
| 4681 | yyssp -= yylen; |
| 4682 | yystate = *yyssp; |
| 4683 | goto yyerrlab1; |
| 4684 | |
| 4685 | |
| 4686 | /*-------------------------------------------------------------. |
| 4687 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 4688 | `-------------------------------------------------------------*/ |
| 4689 | yyerrlab1: |
| 4690 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 4691 | |
| 4692 | for (;;) |
| 4693 | { |
| 4694 | yyn = yypact[yystate]; |
| 4695 | if (yyn != YYPACT_NINF) |
| 4696 | { |
| 4697 | yyn += YYTERROR; |
| 4698 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 4699 | { |
| 4700 | yyn = yytable[yyn]; |
| 4701 | if (0 < yyn) |
| 4702 | break; |
| 4703 | } |
| 4704 | } |
| 4705 | |
| 4706 | /* Pop the current state because it cannot handle the error token. */ |
| 4707 | if (yyssp == yyss) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4708 | YYABORT; |
| 4709 | |
| 4710 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4711 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 4712 | YYPOPSTACK; |
| 4713 | yystate = *yyssp; |
| 4714 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4715 | } |
| 4716 | |
| 4717 | if (yyn == YYFINAL) |
| 4718 | YYACCEPT; |
| 4719 | |
| 4720 | *++yyvsp = yylval; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4721 | |
| 4722 | |
| 4723 | /* Shift the error token. */ |
| 4724 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4725 | |
| 4726 | yystate = yyn; |
| 4727 | goto yynewstate; |
| 4728 | |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 4729 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4730 | /*-------------------------------------. |
| 4731 | | yyacceptlab -- YYACCEPT comes here. | |
| 4732 | `-------------------------------------*/ |
| 4733 | yyacceptlab: |
| 4734 | yyresult = 0; |
| 4735 | goto yyreturn; |
| 4736 | |
| 4737 | /*-----------------------------------. |
| 4738 | | yyabortlab -- YYABORT comes here. | |
| 4739 | `-----------------------------------*/ |
| 4740 | yyabortlab: |
| 4741 | yyresult = 1; |
| 4742 | goto yyreturn; |
| 4743 | |
| 4744 | #ifndef yyoverflow |
| 4745 | /*-------------------------------------------------. |
| 4746 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 4747 | `-------------------------------------------------*/ |
| 4748 | yyexhaustedlab: |
| 4749 | yyerror (YY_("memory exhausted")); |
| 4750 | yyresult = 2; |
| 4751 | /* Fall through. */ |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 4752 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4753 | |
| 4754 | yyreturn: |
| 4755 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 4756 | yydestruct ("Cleanup: discarding lookahead", |
| 4757 | yytoken, &yylval); |
| 4758 | while (yyssp != yyss) |
| 4759 | { |
| 4760 | yydestruct ("Cleanup: popping", |
| 4761 | yystos[*yyssp], yyvsp); |
| 4762 | YYPOPSTACK; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 4763 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4764 | #ifndef yyoverflow |
| 4765 | if (yyss != yyssa) |
| 4766 | YYSTACK_FREE (yyss); |
| 4767 | #endif |
| 4768 | return yyresult; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4769 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4770 | |
| 4771 | |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame^] | 4772 | #line 1997 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4773 | |
| 4774 | |
| 4775 | int yyerror(const char *ErrorMsg) { |
| 4776 | std::string where |
| 4777 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 4778 | + ":" + llvm::utostr((unsigned) Upgradelineno) + ": "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4779 | std::string errMsg = where + "error: " + std::string(ErrorMsg) + |
| 4780 | " while reading "; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4781 | if (yychar == YYEMPTY || yychar == 0) |
| 4782 | errMsg += "end-of-file."; |
| 4783 | else |
| 4784 | errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'"; |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 4785 | std::cerr << "llvm-upgrade: " << errMsg << '\n'; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 4786 | *O << "llvm-upgrade parse failed.\n"; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4787 | exit(1); |
| 4788 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4789 | |
| 4790 | static void warning(const std::string& ErrorMsg) { |
| 4791 | std::string where |
| 4792 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 4793 | + ":" + llvm::utostr((unsigned) Upgradelineno) + ": "; |
| 4794 | std::string errMsg = where + "warning: " + std::string(ErrorMsg) + |
| 4795 | " while reading "; |
| 4796 | if (yychar == YYEMPTY || yychar == 0) |
| 4797 | errMsg += "end-of-file."; |
| 4798 | else |
| 4799 | errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'"; |
| 4800 | std::cerr << "llvm-upgrade: " << errMsg << '\n'; |
| 4801 | } |
| 4802 | |