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