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, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 113 | EXTERNAL = 304, |
| 114 | TARGET = 305, |
| 115 | TRIPLE = 306, |
| 116 | ENDIAN = 307, |
| 117 | POINTERSIZE = 308, |
| 118 | LITTLE = 309, |
| 119 | BIG = 310, |
| 120 | ALIGN = 311, |
| 121 | UNINITIALIZED = 312, |
| 122 | DEPLIBS = 313, |
| 123 | CALL = 314, |
| 124 | TAIL = 315, |
| 125 | ASM_TOK = 316, |
| 126 | MODULE = 317, |
| 127 | SIDEEFFECT = 318, |
| 128 | CC_TOK = 319, |
| 129 | CCC_TOK = 320, |
| 130 | CSRETCC_TOK = 321, |
| 131 | FASTCC_TOK = 322, |
| 132 | COLDCC_TOK = 323, |
| 133 | X86_STDCALLCC_TOK = 324, |
| 134 | X86_FASTCALLCC_TOK = 325, |
| 135 | DATALAYOUT = 326, |
| 136 | RET = 327, |
| 137 | BR = 328, |
| 138 | SWITCH = 329, |
| 139 | INVOKE = 330, |
| 140 | EXCEPT = 331, |
| 141 | UNWIND = 332, |
| 142 | UNREACHABLE = 333, |
| 143 | ADD = 334, |
| 144 | SUB = 335, |
| 145 | MUL = 336, |
| 146 | DIV = 337, |
| 147 | UDIV = 338, |
| 148 | SDIV = 339, |
| 149 | FDIV = 340, |
| 150 | REM = 341, |
| 151 | UREM = 342, |
| 152 | SREM = 343, |
| 153 | FREM = 344, |
| 154 | AND = 345, |
| 155 | OR = 346, |
| 156 | XOR = 347, |
| 157 | SETLE = 348, |
| 158 | SETGE = 349, |
| 159 | SETLT = 350, |
| 160 | SETGT = 351, |
| 161 | SETEQ = 352, |
| 162 | SETNE = 353, |
| 163 | ICMP = 354, |
| 164 | FCMP = 355, |
| 165 | EQ = 356, |
| 166 | NE = 357, |
| 167 | SLT = 358, |
| 168 | SGT = 359, |
| 169 | SLE = 360, |
| 170 | SGE = 361, |
| 171 | OEQ = 362, |
| 172 | ONE = 363, |
| 173 | OLT = 364, |
| 174 | OGT = 365, |
| 175 | OLE = 366, |
| 176 | OGE = 367, |
| 177 | ORD = 368, |
| 178 | UNO = 369, |
| 179 | UEQ = 370, |
| 180 | UNE = 371, |
| 181 | ULT = 372, |
| 182 | UGT = 373, |
| 183 | ULE = 374, |
| 184 | UGE = 375, |
| 185 | MALLOC = 376, |
| 186 | ALLOCA = 377, |
| 187 | FREE = 378, |
| 188 | LOAD = 379, |
| 189 | STORE = 380, |
| 190 | GETELEMENTPTR = 381, |
| 191 | PHI_TOK = 382, |
| 192 | SELECT = 383, |
| 193 | SHL = 384, |
| 194 | SHR = 385, |
| 195 | ASHR = 386, |
| 196 | LSHR = 387, |
| 197 | VAARG = 388, |
| 198 | EXTRACTELEMENT = 389, |
| 199 | INSERTELEMENT = 390, |
| 200 | SHUFFLEVECTOR = 391, |
| 201 | CAST = 392, |
| 202 | TRUNC = 393, |
| 203 | ZEXT = 394, |
| 204 | SEXT = 395, |
| 205 | FPTRUNC = 396, |
| 206 | FPEXT = 397, |
| 207 | FPTOUI = 398, |
| 208 | FPTOSI = 399, |
| 209 | UITOFP = 400, |
| 210 | SITOFP = 401, |
| 211 | PTRTOINT = 402, |
| 212 | INTTOPTR = 403, |
| 213 | BITCAST = 404 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 214 | }; |
| 215 | #endif |
| 216 | /* Tokens. */ |
| 217 | #define VOID 258 |
| 218 | #define BOOL 259 |
| 219 | #define SBYTE 260 |
| 220 | #define UBYTE 261 |
| 221 | #define SHORT 262 |
| 222 | #define USHORT 263 |
| 223 | #define INT 264 |
| 224 | #define UINT 265 |
| 225 | #define LONG 266 |
| 226 | #define ULONG 267 |
| 227 | #define FLOAT 268 |
| 228 | #define DOUBLE 269 |
| 229 | #define LABEL 270 |
| 230 | #define OPAQUE 271 |
| 231 | #define ESINT64VAL 272 |
| 232 | #define EUINT64VAL 273 |
| 233 | #define SINTVAL 274 |
| 234 | #define UINTVAL 275 |
| 235 | #define FPVAL 276 |
| 236 | #define NULL_TOK 277 |
| 237 | #define UNDEF 278 |
| 238 | #define ZEROINITIALIZER 279 |
| 239 | #define TRUETOK 280 |
| 240 | #define FALSETOK 281 |
| 241 | #define TYPE 282 |
| 242 | #define VAR_ID 283 |
| 243 | #define LABELSTR 284 |
| 244 | #define STRINGCONSTANT 285 |
| 245 | #define IMPLEMENTATION 286 |
| 246 | #define BEGINTOK 287 |
| 247 | #define ENDTOK 288 |
| 248 | #define DECLARE 289 |
| 249 | #define GLOBAL 290 |
| 250 | #define CONSTANT 291 |
| 251 | #define SECTION 292 |
| 252 | #define VOLATILE 293 |
| 253 | #define TO 294 |
| 254 | #define DOTDOTDOT 295 |
| 255 | #define CONST 296 |
| 256 | #define INTERNAL 297 |
| 257 | #define LINKONCE 298 |
| 258 | #define WEAK 299 |
| 259 | #define DLLIMPORT 300 |
| 260 | #define DLLEXPORT 301 |
| 261 | #define EXTERN_WEAK 302 |
| 262 | #define APPENDING 303 |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 263 | #define EXTERNAL 304 |
| 264 | #define TARGET 305 |
| 265 | #define TRIPLE 306 |
| 266 | #define ENDIAN 307 |
| 267 | #define POINTERSIZE 308 |
| 268 | #define LITTLE 309 |
| 269 | #define BIG 310 |
| 270 | #define ALIGN 311 |
| 271 | #define UNINITIALIZED 312 |
| 272 | #define DEPLIBS 313 |
| 273 | #define CALL 314 |
| 274 | #define TAIL 315 |
| 275 | #define ASM_TOK 316 |
| 276 | #define MODULE 317 |
| 277 | #define SIDEEFFECT 318 |
| 278 | #define CC_TOK 319 |
| 279 | #define CCC_TOK 320 |
| 280 | #define CSRETCC_TOK 321 |
| 281 | #define FASTCC_TOK 322 |
| 282 | #define COLDCC_TOK 323 |
| 283 | #define X86_STDCALLCC_TOK 324 |
| 284 | #define X86_FASTCALLCC_TOK 325 |
| 285 | #define DATALAYOUT 326 |
| 286 | #define RET 327 |
| 287 | #define BR 328 |
| 288 | #define SWITCH 329 |
| 289 | #define INVOKE 330 |
| 290 | #define EXCEPT 331 |
| 291 | #define UNWIND 332 |
| 292 | #define UNREACHABLE 333 |
| 293 | #define ADD 334 |
| 294 | #define SUB 335 |
| 295 | #define MUL 336 |
| 296 | #define DIV 337 |
| 297 | #define UDIV 338 |
| 298 | #define SDIV 339 |
| 299 | #define FDIV 340 |
| 300 | #define REM 341 |
| 301 | #define UREM 342 |
| 302 | #define SREM 343 |
| 303 | #define FREM 344 |
| 304 | #define AND 345 |
| 305 | #define OR 346 |
| 306 | #define XOR 347 |
| 307 | #define SETLE 348 |
| 308 | #define SETGE 349 |
| 309 | #define SETLT 350 |
| 310 | #define SETGT 351 |
| 311 | #define SETEQ 352 |
| 312 | #define SETNE 353 |
| 313 | #define ICMP 354 |
| 314 | #define FCMP 355 |
| 315 | #define EQ 356 |
| 316 | #define NE 357 |
| 317 | #define SLT 358 |
| 318 | #define SGT 359 |
| 319 | #define SLE 360 |
| 320 | #define SGE 361 |
| 321 | #define OEQ 362 |
| 322 | #define ONE 363 |
| 323 | #define OLT 364 |
| 324 | #define OGT 365 |
| 325 | #define OLE 366 |
| 326 | #define OGE 367 |
| 327 | #define ORD 368 |
| 328 | #define UNO 369 |
| 329 | #define UEQ 370 |
| 330 | #define UNE 371 |
| 331 | #define ULT 372 |
| 332 | #define UGT 373 |
| 333 | #define ULE 374 |
| 334 | #define UGE 375 |
| 335 | #define MALLOC 376 |
| 336 | #define ALLOCA 377 |
| 337 | #define FREE 378 |
| 338 | #define LOAD 379 |
| 339 | #define STORE 380 |
| 340 | #define GETELEMENTPTR 381 |
| 341 | #define PHI_TOK 382 |
| 342 | #define SELECT 383 |
| 343 | #define SHL 384 |
| 344 | #define SHR 385 |
| 345 | #define ASHR 386 |
| 346 | #define LSHR 387 |
| 347 | #define VAARG 388 |
| 348 | #define EXTRACTELEMENT 389 |
| 349 | #define INSERTELEMENT 390 |
| 350 | #define SHUFFLEVECTOR 391 |
| 351 | #define CAST 392 |
| 352 | #define TRUNC 393 |
| 353 | #define ZEXT 394 |
| 354 | #define SEXT 395 |
| 355 | #define FPTRUNC 396 |
| 356 | #define FPEXT 397 |
| 357 | #define FPTOUI 398 |
| 358 | #define FPTOSI 399 |
| 359 | #define UITOFP 400 |
| 360 | #define SITOFP 401 |
| 361 | #define PTRTOINT 402 |
| 362 | #define INTTOPTR 403 |
| 363 | #define BITCAST 404 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | /* Copy the first part of user declarations. */ |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 369 | #line 14 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 370 | |
| 371 | #include "UpgradeInternals.h" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 372 | #include <algorithm> |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 373 | #include <map> |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 374 | #include <utility> |
| 375 | #include <iostream> |
| 376 | |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 377 | #define YYERROR_VERBOSE 1 |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 378 | #define YYINCLUDED_STDLIB_H |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 379 | #define YYDEBUG 1 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 380 | |
| 381 | int yylex(); // declaration" of xxx warnings. |
| 382 | int yyparse(); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 383 | extern int yydebug; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 384 | |
| 385 | static std::string CurFilename; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 386 | static std::ostream *O = 0; |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 387 | std::istream* LexInput = 0; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 388 | unsigned SizeOfPointer = 32; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 389 | |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 390 | |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 391 | // This bool controls whether attributes are ever added to function declarations |
| 392 | // definitions and calls. |
| 393 | static bool AddAttributes = false; |
| 394 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 395 | static void warning(const std::string& msg); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 396 | |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 397 | void UpgradeAssembly(const std::string &infile, std::istream& in, |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 398 | std::ostream &out, bool debug, bool addAttrs) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 399 | { |
| 400 | Upgradelineno = 1; |
| 401 | CurFilename = infile; |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 402 | LexInput = ∈ |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 403 | yydebug = debug; |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 404 | AddAttributes = addAttrs; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 405 | O = &out; |
| 406 | |
| 407 | if (yyparse()) { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 408 | std::cerr << "llvm-upgrade: parse failed.\n"; |
| 409 | out << "llvm-upgrade: parse failed.\n"; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 410 | exit(1); |
| 411 | } |
| 412 | } |
| 413 | |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 414 | namespace { // Anonymous namespace to keep our implementation local |
| 415 | |
| 416 | |
| 417 | /// This type is used to keep track of the signedness of values. Instead |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 418 | /// of creating llvm::Value directly, the parser will create Value which |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 419 | /// associates a Value* with a Signedness indication. |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 420 | struct Value { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 421 | std::string* val; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 422 | const Type* type; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 423 | bool constant; |
| 424 | bool isConstant() const { return constant; } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 425 | ~Value() { delete val; } |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 426 | }; |
| 427 | |
| 428 | |
| 429 | /// This type is used to keep track of the signedness of the obsolete |
| 430 | /// integer types. Instead of creating an llvm::Type directly, the Lexer will |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 431 | /// create instances of Type which retains the signedness indication so |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 432 | /// it can be used by the parser for upgrade decisions. |
| 433 | /// For example if "uint" is encountered then the "first" field will be set |
| 434 | /// to "int32" and the "second" field will be set to "isUnsigned". If the |
| 435 | /// type is not obsolete then "second" will be set to "isSignless". |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 436 | class Type { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 437 | public: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 438 | static const Type* get(const std::string &newType, TypeIDs oldType); |
| 439 | static const Type* get(const std::string& newType, TypeIDs oldType, |
| 440 | const Type* eTy, const Type* rTy); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 441 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 442 | static const Type* get(const std::string& newType, TypeIDs oldType, |
| 443 | const Type *eTy, uint64_t elems); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 444 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 445 | static const Type* get(const std::string& newType, TypeIDs oldType, |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 446 | TypeList* TL); |
| 447 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 448 | static const Type* get(const std::string& newType, const Type* resTy, |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 449 | TypeList* TL); |
| 450 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 451 | const Type* resolve() const; |
| 452 | bool operator<(const Type& that) const; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 453 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 454 | bool sameNewTyAs(const Type* that) const { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 455 | return this->newTy == that->newTy; |
| 456 | } |
| 457 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 458 | bool sameOldTyAs(const Type* that) const; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 459 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 460 | TypeIDs getElementTy() const { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 461 | if (elemTy) { |
| 462 | return elemTy->oldTy; |
| 463 | } |
| 464 | return UnresolvedTy; |
| 465 | } |
| 466 | |
| 467 | unsigned getUpRefNum() const { |
| 468 | assert(oldTy == UpRefTy && "Can't getUpRefNum on non upreference"); |
| 469 | return atoi(&((getNewTy().c_str())[1])); // skip the slash |
| 470 | } |
| 471 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 472 | typedef std::vector<const Type*> UpRefStack; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 473 | void getSignedness(unsigned &sNum, unsigned &uNum, UpRefStack& stk) const; |
| 474 | std::string makeUniqueName(const std::string& BaseName) const; |
| 475 | |
| 476 | const std::string& getNewTy() const { return newTy; } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 477 | const Type* getResultType() const { return resultTy; } |
| 478 | const Type* getElementType() const { return elemTy; } |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 479 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 480 | const Type* getPointerType() const { |
| 481 | return get(newTy + "*", PointerTy, this, (Type*)0); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | bool isUnresolved() const { return oldTy == UnresolvedTy; } |
| 485 | bool isUpReference() const { return oldTy == UpRefTy; } |
| 486 | bool isVoid() const { return oldTy == VoidTy; } |
| 487 | bool isBool() const { return oldTy == BoolTy; } |
| 488 | bool isSigned() const { |
| 489 | return oldTy == SByteTy || oldTy == ShortTy || |
| 490 | oldTy == IntTy || oldTy == LongTy; |
| 491 | } |
| 492 | |
| 493 | bool isUnsigned() const { |
| 494 | return oldTy == UByteTy || oldTy == UShortTy || |
| 495 | oldTy == UIntTy || oldTy == ULongTy; |
| 496 | } |
| 497 | bool isSignless() const { return !isSigned() && !isUnsigned(); } |
| 498 | bool isInteger() const { return isSigned() || isUnsigned(); } |
| 499 | bool isIntegral() const { return oldTy == BoolTy || isInteger(); } |
| 500 | bool isFloatingPoint() const { return oldTy == DoubleTy || oldTy == FloatTy; } |
| 501 | bool isPacked() const { return oldTy == PackedTy; } |
| 502 | bool isPointer() const { return oldTy == PointerTy; } |
| 503 | bool isStruct() const { return oldTy == StructTy || oldTy == PackedStructTy; } |
| 504 | bool isArray() const { return oldTy == ArrayTy; } |
| 505 | bool isOther() const { |
| 506 | return !isPacked() && !isPointer() && !isFloatingPoint() && !isIntegral(); } |
| 507 | bool isFunction() const { return oldTy == FunctionTy; } |
| 508 | bool isComposite() const { |
| 509 | return isStruct() || isPointer() || isArray() || isPacked(); |
| 510 | } |
| 511 | |
| 512 | bool isAttributeCandidate() const { |
| 513 | return isIntegral() && getBitWidth() < 32; |
| 514 | } |
| 515 | |
| 516 | bool isUnresolvedDeep() const; |
| 517 | |
| 518 | unsigned getBitWidth() const; |
| 519 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 520 | const Type* getIndexedType(const Value* V) const; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 521 | |
| 522 | unsigned getNumStructElements() const { |
| 523 | return (elements ? elements->size() : 0); |
| 524 | } |
| 525 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 526 | const Type* getElement(unsigned idx) const { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 527 | if (elements) |
| 528 | if (idx < elements->size()) |
| 529 | return (*elements)[idx]; |
| 530 | return 0; |
| 531 | } |
| 532 | |
| 533 | private: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 534 | Type() |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 535 | : newTy(), oldTy(UnresolvedTy), elemTy(0), resultTy(0), elements(0), |
| 536 | nelems(0) { |
| 537 | } |
| 538 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 539 | Type(const Type& that); // do not implement |
| 540 | Type& operator=(const Type& that); // do not implement |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 541 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 542 | ~Type() { delete elements; } |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 543 | |
| 544 | struct ltfunctor |
| 545 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 546 | bool operator()(const Type* X, const Type* Y) const { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 547 | assert(X && "Can't compare null pointer"); |
| 548 | assert(Y && "Can't compare null pointer"); |
| 549 | return *X < *Y; |
| 550 | } |
| 551 | }; |
| 552 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 553 | typedef std::set<const Type*, ltfunctor> TypeRegMap; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 554 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 555 | static const Type* add_new_type(Type* existing); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 556 | |
| 557 | std::string newTy; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 558 | TypeIDs oldTy; |
| 559 | Type *elemTy; |
| 560 | Type *resultTy; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 561 | TypeList *elements; |
| 562 | uint64_t nelems; |
| 563 | static TypeRegMap registry; |
| 564 | public: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 565 | typedef std::vector<const Type*> TypeVector; |
| 566 | typedef std::map<std::string,const Type*> TypeMap; |
| 567 | typedef std::map<const Type*,std::string> TypePlaneMap; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 568 | typedef std::map<std::string,TypePlaneMap> GlobalsTypeMap; |
| 569 | static TypeVector EnumeratedTypes; |
| 570 | static TypeMap NamedTypes; |
| 571 | static GlobalsTypeMap Globals; |
| 572 | }; |
| 573 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 574 | Type::TypeRegMap Type::registry; |
| 575 | Type::TypeVector Type::EnumeratedTypes; |
| 576 | Type::TypeMap Type::NamedTypes; |
| 577 | Type::GlobalsTypeMap Type::Globals; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 578 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 579 | const Type* Type::get(const std::string &newType, TypeIDs oldType) { |
| 580 | Type* Ty = new Type(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 581 | Ty->newTy = newType; |
| 582 | Ty->oldTy = oldType; |
| 583 | return add_new_type(Ty); |
| 584 | } |
| 585 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 586 | const Type* Type::get(const std::string& newType, TypeIDs oldType, |
| 587 | const Type* eTy, const Type* rTy) { |
| 588 | Type* Ty= new Type(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 589 | Ty->newTy = newType; |
| 590 | Ty->oldTy = oldType; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 591 | Ty->elemTy = const_cast<Type*>(eTy); |
| 592 | Ty->resultTy = const_cast<Type*>(rTy); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 593 | return add_new_type(Ty); |
| 594 | } |
| 595 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 596 | const Type* Type::get(const std::string& newType, TypeIDs oldType, |
| 597 | const Type *eTy, uint64_t elems) { |
| 598 | Type* Ty = new Type(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 599 | Ty->newTy = newType; |
| 600 | Ty->oldTy = oldType; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 601 | Ty->elemTy = const_cast<Type*>(eTy); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 602 | Ty->nelems = elems; |
| 603 | return add_new_type(Ty); |
| 604 | } |
| 605 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 606 | const Type* Type::get(const std::string& newType, TypeIDs oldType, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 607 | TypeList* TL) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 608 | Type* Ty = new Type(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 609 | Ty->newTy = newType; |
| 610 | Ty->oldTy = oldType; |
| 611 | Ty->elements = TL; |
| 612 | return add_new_type(Ty); |
| 613 | } |
| 614 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 615 | const Type* Type::get(const std::string& newType, const Type* resTy, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 616 | TypeList* TL) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 617 | Type* Ty = new Type(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 618 | Ty->newTy = newType; |
| 619 | Ty->oldTy = FunctionTy; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 620 | Ty->resultTy = const_cast<Type*>(resTy); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 621 | Ty->elements = TL; |
| 622 | return add_new_type(Ty); |
| 623 | } |
| 624 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 625 | const Type* Type::resolve() const { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 626 | if (isUnresolved()) { |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 627 | if (getNewTy()[0] == '%' && isdigit(newTy[1])) { |
| 628 | unsigned ref = atoi(&((newTy.c_str())[1])); // skip the % |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 629 | if (ref < EnumeratedTypes.size()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 630 | return EnumeratedTypes[ref]; |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 631 | } else { |
| 632 | std::string msg("Can't resolve numbered type: "); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 633 | msg += getNewTy(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 634 | yyerror(msg.c_str()); |
| 635 | } |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 636 | } else { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 637 | Type::TypeMap::iterator I = NamedTypes.find(newTy); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 638 | if (I != NamedTypes.end()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 639 | return I->second; |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 640 | } else { |
| 641 | std::string msg("Cannot resolve type: "); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 642 | msg += getNewTy(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 643 | yyerror(msg.c_str()); |
| 644 | } |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 645 | } |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 646 | } |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 647 | // otherwise its already resolved. |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 648 | return this; |
| 649 | } |
| 650 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 651 | bool Type::operator<(const Type& that) const { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 652 | if (this == &that) |
| 653 | return false; |
| 654 | if (oldTy != that.oldTy) |
| 655 | return oldTy < that.oldTy; |
| 656 | switch (oldTy) { |
| 657 | case UpRefTy: { |
| 658 | unsigned thisUp = this->getUpRefNum(); |
| 659 | unsigned thatUp = that.getUpRefNum(); |
| 660 | return thisUp < thatUp; |
| 661 | } |
| 662 | case PackedTy: |
| 663 | case ArrayTy: |
| 664 | if (this->nelems != that.nelems) |
| 665 | return nelems < that.nelems; |
| 666 | case PointerTy: { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 667 | const Type* thisTy = this->elemTy; |
| 668 | const Type* thatTy = that.elemTy; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 669 | return *thisTy < *thatTy; |
| 670 | } |
| 671 | case FunctionTy: { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 672 | const Type* thisTy = this->resultTy; |
| 673 | const Type* thatTy = that.resultTy; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 674 | if (!thisTy->sameOldTyAs(thatTy)) |
| 675 | return *thisTy < *thatTy; |
| 676 | /* FALL THROUGH */ |
| 677 | } |
| 678 | case StructTy: |
| 679 | case PackedStructTy: { |
| 680 | if (elements->size() != that.elements->size()) |
| 681 | return elements->size() < that.elements->size(); |
| 682 | for (unsigned i = 0; i < elements->size(); i++) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 683 | const Type* thisTy = (*this->elements)[i]; |
| 684 | const Type* thatTy = (*that.elements)[i]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 685 | if (!thisTy->sameOldTyAs(thatTy)) |
| 686 | return *thisTy < *thatTy; |
| 687 | } |
| 688 | break; |
| 689 | } |
| 690 | case UnresolvedTy: |
| 691 | return this->newTy < that.newTy; |
| 692 | default: |
| 693 | break; |
| 694 | } |
| 695 | return false; |
| 696 | } |
| 697 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 698 | bool Type::sameOldTyAs(const Type* that) const { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 699 | if (that == 0) |
| 700 | return false; |
| 701 | if ( this == that ) |
| 702 | return true; |
| 703 | if (oldTy != that->oldTy) |
| 704 | return false; |
| 705 | switch (oldTy) { |
| 706 | case PackedTy: |
| 707 | case ArrayTy: |
| 708 | if (nelems != that->nelems) |
| 709 | return false; |
| 710 | /* FALL THROUGH */ |
| 711 | case PointerTy: { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 712 | const Type* thisTy = this->elemTy; |
| 713 | const Type* thatTy = that->elemTy; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 714 | return thisTy->sameOldTyAs(thatTy); |
| 715 | } |
| 716 | case FunctionTy: { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 717 | const Type* thisTy = this->resultTy; |
| 718 | const Type* thatTy = that->resultTy; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 719 | if (!thisTy->sameOldTyAs(thatTy)) |
| 720 | return false; |
| 721 | /* FALL THROUGH */ |
| 722 | } |
| 723 | case StructTy: |
| 724 | case PackedStructTy: { |
| 725 | if (elements->size() != that->elements->size()) |
| 726 | return false; |
| 727 | for (unsigned i = 0; i < elements->size(); i++) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 728 | const Type* thisTy = (*this->elements)[i]; |
| 729 | const Type* thatTy = (*that->elements)[i]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 730 | if (!thisTy->sameOldTyAs(thatTy)) |
| 731 | return false; |
| 732 | } |
| 733 | return true; |
| 734 | } |
| 735 | case UnresolvedTy: |
| 736 | return this->newTy == that->newTy; |
| 737 | default: |
| 738 | return true; // for all others oldTy == that->oldTy is sufficient |
| 739 | } |
| 740 | return true; |
| 741 | } |
| 742 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 743 | bool Type::isUnresolvedDeep() const { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 744 | switch (oldTy) { |
| 745 | case UnresolvedTy: |
| 746 | return true; |
| 747 | case PackedTy: |
| 748 | case ArrayTy: |
| 749 | case PointerTy: |
| 750 | return elemTy->isUnresolvedDeep(); |
| 751 | case PackedStructTy: |
| 752 | case StructTy: |
| 753 | for (unsigned i = 0; i < elements->size(); i++) |
| 754 | if ((*elements)[i]->isUnresolvedDeep()) |
| 755 | return true; |
| 756 | return false; |
| 757 | default: |
| 758 | return false; |
| 759 | } |
| 760 | } |
| 761 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 762 | unsigned Type::getBitWidth() const { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 763 | switch (oldTy) { |
| 764 | default: |
| 765 | case LabelTy: |
| 766 | case VoidTy : return 0; |
| 767 | case BoolTy : return 1; |
| 768 | case SByteTy: case UByteTy : return 8; |
| 769 | case ShortTy: case UShortTy : return 16; |
| 770 | case IntTy: case UIntTy: case FloatTy: return 32; |
| 771 | case LongTy: case ULongTy: case DoubleTy : return 64; |
| 772 | case PointerTy: return SizeOfPointer; // global var |
| 773 | case PackedTy: |
| 774 | case ArrayTy: |
| 775 | return nelems * elemTy->getBitWidth(); |
| 776 | case StructTy: |
| 777 | case PackedStructTy: { |
| 778 | uint64_t size = 0; |
| 779 | for (unsigned i = 0; i < elements->size(); i++) { |
| 780 | size += (*elements)[i]->getBitWidth(); |
| 781 | } |
| 782 | return size; |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 787 | const Type* Type::getIndexedType(const Value* V) const { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 788 | if (isStruct()) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 789 | if (V->isConstant() && V->type->isInteger()) { |
| 790 | size_t pos = V->val->find(' ') + 1; |
| 791 | if (pos < V->val->size()) { |
| 792 | uint64_t idx = atoi(V->val->substr(pos).c_str()); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 793 | return (*elements)[idx]; |
| 794 | } else { |
| 795 | yyerror("Invalid value for constant integer"); |
| 796 | return 0; |
| 797 | } |
| 798 | } else { |
| 799 | yyerror("Structure requires constant index"); |
| 800 | return 0; |
| 801 | } |
| 802 | } |
| 803 | if (isArray() || isPacked() || isPointer()) |
| 804 | return elemTy; |
| 805 | yyerror("Invalid type for getIndexedType"); |
| 806 | return 0; |
| 807 | } |
| 808 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 809 | void Type::getSignedness(unsigned &sNum, unsigned &uNum, |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 810 | UpRefStack& stack) const { |
| 811 | switch (oldTy) { |
| 812 | default: |
| 813 | case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: |
| 814 | case FloatTy : case DoubleTy: case UpRefTy: |
| 815 | return; |
| 816 | case SByteTy: case ShortTy: case LongTy: case IntTy: |
| 817 | sNum++; |
| 818 | return; |
| 819 | case UByteTy: case UShortTy: case UIntTy: case ULongTy: |
| 820 | uNum++; |
| 821 | return; |
| 822 | case PointerTy: |
| 823 | case PackedTy: |
| 824 | case ArrayTy: |
| 825 | stack.push_back(this); |
| 826 | elemTy->getSignedness(sNum, uNum, stack); |
| 827 | return; |
| 828 | case StructTy: |
| 829 | case PackedStructTy: { |
| 830 | stack.push_back(this); |
| 831 | for (unsigned i = 0; i < elements->size(); i++) { |
| 832 | (*elements)[i]->getSignedness(sNum, uNum, stack); |
| 833 | } |
| 834 | return; |
| 835 | } |
| 836 | case UnresolvedTy: { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 837 | const Type* Ty = this->resolve(); |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 838 | // Let's not recurse. |
| 839 | UpRefStack::const_iterator I = stack.begin(), E = stack.end(); |
| 840 | for ( ; I != E && *I != Ty; ++I) |
| 841 | ; |
| 842 | if (I == E) |
| 843 | Ty->getSignedness(sNum, uNum, stack); |
| 844 | return; |
| 845 | } |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | std::string AddSuffix(const std::string& Name, const std::string& Suffix) { |
| 850 | if (Name[Name.size()-1] == '"') { |
| 851 | std::string Result = Name; |
| 852 | Result.insert(Result.size()-1, Suffix); |
| 853 | return Result; |
| 854 | } |
| 855 | return Name + Suffix; |
| 856 | } |
| 857 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 858 | std::string Type::makeUniqueName(const std::string& BaseName) const { |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 859 | if (BaseName == "\"alloca point\"") |
| 860 | return BaseName; |
| 861 | switch (oldTy) { |
| 862 | default: |
| 863 | break; |
| 864 | case OpaqueTy: case LabelTy: case VoidTy: case BoolTy: case UpRefTy: |
| 865 | case FloatTy : case DoubleTy: case UnresolvedTy: |
| 866 | return BaseName; |
| 867 | case SByteTy: case ShortTy: case LongTy: case IntTy: |
| 868 | return AddSuffix(BaseName, ".s"); |
| 869 | case UByteTy: case UShortTy: case UIntTy: case ULongTy: |
| 870 | return AddSuffix(BaseName, ".u"); |
| 871 | } |
| 872 | |
| 873 | unsigned uNum = 0, sNum = 0; |
| 874 | std::string Suffix; |
| 875 | switch (oldTy) { |
| 876 | case PointerTy: |
| 877 | case PackedTy: |
| 878 | case ArrayTy: { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 879 | Type::UpRefStack stack; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 880 | elemTy->resolve()->getSignedness(sNum, uNum, stack); |
| 881 | break; |
| 882 | } |
| 883 | case StructTy: |
| 884 | case PackedStructTy: { |
| 885 | for (unsigned i = 0; i < elements->size(); i++) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 886 | Type::UpRefStack stack; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 887 | (*elements)[i]->resolve()->getSignedness(sNum, uNum, stack); |
| 888 | } |
| 889 | break; |
| 890 | } |
| 891 | default: |
| 892 | assert(0 && "Invalid Type"); |
| 893 | break; |
| 894 | } |
| 895 | |
| 896 | if (sNum == 0 && uNum == 0) |
| 897 | return BaseName; |
| 898 | |
| 899 | switch (oldTy) { |
| 900 | default: Suffix += ".nada"; break; |
| 901 | case PointerTy: Suffix += ".pntr"; break; |
| 902 | case PackedTy: Suffix += ".pckd"; break; |
| 903 | case ArrayTy: Suffix += ".arry"; break; |
| 904 | case StructTy: Suffix += ".strc"; break; |
| 905 | case PackedStructTy: Suffix += ".pstr"; break; |
| 906 | } |
| 907 | |
| 908 | Suffix += ".s" + llvm::utostr(sNum); |
| 909 | Suffix += ".u" + llvm::utostr(uNum); |
| 910 | return AddSuffix(BaseName, Suffix); |
| 911 | } |
| 912 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 913 | Type& Type::operator=(const Type& that) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 914 | oldTy = that.oldTy; |
| 915 | nelems = that.nelems; |
| 916 | newTy = that.newTy; |
| 917 | elemTy = that.elemTy; |
| 918 | resultTy = that.resultTy; |
| 919 | if (that.elements) { |
| 920 | elements = new TypeList(that.elements->size()); |
| 921 | *elements = *that.elements; |
| 922 | } else { |
| 923 | elements = 0; |
| 924 | } |
| 925 | return *this; |
| 926 | } |
| 927 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 928 | const Type* Type::add_new_type(Type* newTy) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 929 | TypeRegMap::iterator I = registry.find(newTy); |
| 930 | if (I != registry.end()) { |
| 931 | delete newTy; |
| 932 | return *I; |
| 933 | } |
| 934 | registry.insert(newTy); |
| 935 | return newTy; |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 936 | } |
| 937 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 938 | class Instruction { |
| 939 | }; |
| 940 | |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 941 | /// This type is used to keep track of the signedness of constants. |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 942 | struct Constant { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 943 | std::string *cnst; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 944 | const Type *type; |
| 945 | ~Constant() { delete cnst; } |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 946 | }; |
| 947 | |
| 948 | /// This variable provides a counter for unique names. It is used in various |
| 949 | /// productions to ensure a unique name is generated. |
| 950 | static uint64_t UniqueNameCounter = 1; |
| 951 | |
| 952 | // This is set when a DECLARE keyword is recognized so that subsequent parsing |
| 953 | // of a function prototype can know if its a declaration or definition. |
| 954 | static bool isDeclare = false; |
| 955 | |
| 956 | // This bool is used to communicate between the InstVal and Inst rules about |
| 957 | // whether or not a cast should be deleted. When the flag is set, InstVal has |
| 958 | // determined that the cast is a candidate. However, it can only be deleted if |
| 959 | // the value being casted is the same value name as the instruction. The Inst |
| 960 | // rule makes that comparison if the flag is set and comments out the |
| 961 | // instruction if they match. |
| 962 | static bool deleteUselessCastFlag = false; |
| 963 | static std::string* deleteUselessCastName = 0; |
| 964 | |
| 965 | |
| 966 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 967 | const char* getCastOpcode(std::string& Source, const Type* SrcTy, |
| 968 | const Type* DstTy) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 969 | unsigned SrcBits = SrcTy->getBitWidth(); |
| 970 | unsigned DstBits = DstTy->getBitWidth(); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 971 | const char* opcode = "bitcast"; |
| 972 | // Run through the possibilities ... |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 973 | if (DstTy->isIntegral()) { // Casting to integral |
| 974 | if (SrcTy->isIntegral()) { // Casting from integral |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 975 | if (DstBits < SrcBits) |
| 976 | opcode = "trunc"; |
| 977 | else if (DstBits > SrcBits) { // its an extension |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 978 | if (SrcTy->isSigned()) |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 979 | opcode ="sext"; // signed -> SEXT |
| 980 | else |
| 981 | opcode = "zext"; // unsigned -> ZEXT |
| 982 | } else { |
| 983 | opcode = "bitcast"; // Same size, No-op cast |
| 984 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 985 | } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt |
| 986 | if (DstTy->isSigned()) |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 987 | opcode = "fptosi"; // FP -> sint |
| 988 | else |
| 989 | opcode = "fptoui"; // FP -> uint |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 990 | } else if (SrcTy->isPacked()) { |
| 991 | assert(DstBits == SrcTy->getBitWidth() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 992 | "Casting packed to integer of different width"); |
| 993 | opcode = "bitcast"; // same size, no-op cast |
| 994 | } else { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 995 | assert(SrcTy->isPointer() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 996 | "Casting from a value that is not first-class type"); |
| 997 | opcode = "ptrtoint"; // ptr -> int |
| 998 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 999 | } else if (DstTy->isFloatingPoint()) { // Casting to floating pt |
| 1000 | if (SrcTy->isIntegral()) { // Casting from integral |
| 1001 | if (SrcTy->isSigned()) |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1002 | opcode = "sitofp"; // sint -> FP |
| 1003 | else |
| 1004 | opcode = "uitofp"; // uint -> FP |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1005 | } else if (SrcTy->isFloatingPoint()) { // Casting from floating pt |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1006 | if (DstBits < SrcBits) { |
| 1007 | opcode = "fptrunc"; // FP -> smaller FP |
| 1008 | } else if (DstBits > SrcBits) { |
| 1009 | opcode = "fpext"; // FP -> larger FP |
| 1010 | } else { |
| 1011 | opcode ="bitcast"; // same size, no-op cast |
| 1012 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1013 | } else if (SrcTy->isPacked()) { |
| 1014 | assert(DstBits == SrcTy->getBitWidth() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1015 | "Casting packed to floating point of different width"); |
| 1016 | opcode = "bitcast"; // same size, no-op cast |
| 1017 | } else { |
| 1018 | assert(0 && "Casting pointer or non-first class to float"); |
| 1019 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1020 | } else if (DstTy->isPacked()) { |
| 1021 | if (SrcTy->isPacked()) { |
| 1022 | assert(DstTy->getBitWidth() == SrcTy->getBitWidth() && |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1023 | "Casting packed to packed of different widths"); |
| 1024 | opcode = "bitcast"; // packed -> packed |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1025 | } else if (DstTy->getBitWidth() == SrcBits) { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1026 | opcode = "bitcast"; // float/int -> packed |
| 1027 | } else { |
| 1028 | assert(!"Illegal cast to packed (wrong type or size)"); |
| 1029 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1030 | } else if (DstTy->isPointer()) { |
| 1031 | if (SrcTy->isPointer()) { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1032 | opcode = "bitcast"; // ptr -> ptr |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1033 | } else if (SrcTy->isIntegral()) { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1034 | opcode = "inttoptr"; // int -> ptr |
| 1035 | } else { |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1036 | assert(!"Casting invalid type to pointer"); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1037 | } |
| 1038 | } else { |
| 1039 | assert(!"Casting to type that is not first-class"); |
| 1040 | } |
| 1041 | return opcode; |
| 1042 | } |
| 1043 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1044 | std::string getCastUpgrade(const std::string& Src, const Type* SrcTy, |
| 1045 | const Type* DstTy, bool isConst) { |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1046 | std::string Result; |
| 1047 | std::string Source = Src; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1048 | if (SrcTy->isFloatingPoint() && DstTy->isPointer()) { |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1049 | // fp -> ptr cast is no longer supported but we must upgrade this |
| 1050 | // by doing a double cast: fp -> int -> ptr |
| 1051 | if (isConst) |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 1052 | Source = "i64 fptoui(" + Source + " to i64)"; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1053 | else { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1054 | *O << " %cast_upgrade" << UniqueNameCounter << " = fptoui " |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1055 | << Source << " to i64\n"; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1056 | Source = "i64 %cast_upgrade" + llvm::utostr(UniqueNameCounter++); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1057 | } |
| 1058 | // Update the SrcTy for the getCastOpcode call below |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1059 | SrcTy = Type::get("i64", ULongTy); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1060 | } else if (DstTy->isBool()) { |
| 1061 | // cast type %x to bool was previously defined as setne type %x, null |
| 1062 | // The cast semantic is now to truncate, not compare so we must retain |
| 1063 | // the original intent by replacing the cast with a setne |
| 1064 | const char* comparator = SrcTy->isPointer() ? ", null" : |
| 1065 | (SrcTy->isFloatingPoint() ? ", 0.0" : |
| 1066 | (SrcTy->isBool() ? ", false" : ", 0")); |
| 1067 | const char* compareOp = SrcTy->isFloatingPoint() ? "fcmp one " : "icmp ne "; |
Reid Spencer | 187ccf8 | 2006-12-09 16:57:22 +0000 | [diff] [blame] | 1068 | if (isConst) { |
| 1069 | Result = "(" + Source + comparator + ")"; |
| 1070 | Result = compareOp + Result; |
| 1071 | } else |
| 1072 | Result = compareOp + Source + comparator; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1073 | return Result; // skip cast processing below |
| 1074 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1075 | SrcTy = SrcTy->resolve(); |
| 1076 | DstTy = DstTy->resolve(); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1077 | std::string Opcode(getCastOpcode(Source, SrcTy, DstTy)); |
| 1078 | if (isConst) |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1079 | Result += Opcode + "( " + Source + " to " + DstTy->getNewTy() + ")"; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1080 | else |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1081 | Result += Opcode + " " + Source + " to " + DstTy->getNewTy(); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 1082 | return Result; |
| 1083 | } |
| 1084 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1085 | const char* getDivRemOpcode(const std::string& opcode, const Type* TI) { |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1086 | const char* op = opcode.c_str(); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1087 | const Type* Ty = TI->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1088 | if (Ty->isPacked()) |
| 1089 | Ty = Ty->getElementType(); |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1090 | if (opcode == "div") |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1091 | if (Ty->isFloatingPoint()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1092 | op = "fdiv"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1093 | else if (Ty->isUnsigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1094 | op = "udiv"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1095 | else if (Ty->isSigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1096 | op = "sdiv"; |
| 1097 | else |
| 1098 | yyerror("Invalid type for div instruction"); |
| 1099 | else if (opcode == "rem") |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1100 | if (Ty->isFloatingPoint()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1101 | op = "frem"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1102 | else if (Ty->isUnsigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1103 | op = "urem"; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1104 | else if (Ty->isSigned()) |
Reid Spencer | 7872074 | 2006-12-02 20:21:22 +0000 | [diff] [blame] | 1105 | op = "srem"; |
| 1106 | else |
| 1107 | yyerror("Invalid type for rem instruction"); |
| 1108 | return op; |
| 1109 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1110 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1111 | std::string getCompareOp(const std::string& setcc, const Type* TI) { |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 1112 | assert(setcc.length() == 5); |
| 1113 | char cc1 = setcc[3]; |
| 1114 | char cc2 = setcc[4]; |
| 1115 | assert(cc1 == 'e' || cc1 == 'n' || cc1 == 'l' || cc1 == 'g'); |
| 1116 | assert(cc2 == 'q' || cc2 == 'e' || cc2 == 'e' || cc2 == 't'); |
| 1117 | std::string result("xcmp xxx"); |
| 1118 | result[6] = cc1; |
| 1119 | result[7] = cc2; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1120 | if (TI->isFloatingPoint()) { |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 1121 | result[0] = 'f'; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 1122 | result[5] = 'o'; |
Reid Spencer | f0cf132 | 2006-12-07 04:23:03 +0000 | [diff] [blame] | 1123 | if (cc1 == 'n') |
| 1124 | result[5] = 'u'; // NE maps to unordered |
| 1125 | else |
| 1126 | result[5] = 'o'; // everything else maps to ordered |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1127 | } else if (TI->isIntegral() || TI->isPointer()) { |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 1128 | result[0] = 'i'; |
| 1129 | if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e')) |
| 1130 | result.erase(5,1); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1131 | else if (TI->isSigned()) |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 1132 | result[5] = 's'; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1133 | else if (TI->isUnsigned() || TI->isPointer() || TI->isBool()) |
Reid Spencer | 229e936 | 2006-12-02 22:14:11 +0000 | [diff] [blame] | 1134 | result[5] = 'u'; |
| 1135 | else |
| 1136 | yyerror("Invalid integral type for setcc"); |
| 1137 | } |
| 1138 | return result; |
| 1139 | } |
| 1140 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1141 | const Type* getFunctionReturnType(const Type* PFTy) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1142 | PFTy = PFTy->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1143 | if (PFTy->isPointer()) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1144 | const Type* ElemTy = PFTy->getElementType(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1145 | ElemTy = ElemTy->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1146 | if (ElemTy->isFunction()) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1147 | return ElemTy->getResultType(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1148 | } else if (PFTy->isFunction()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1149 | return PFTy->getResultType(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1150 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1151 | return PFTy; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1152 | } |
| 1153 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1154 | const Type* ResolveUpReference(const Type* Ty, |
| 1155 | Type::UpRefStack* stack) { |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1156 | assert(Ty->isUpReference() && "Can't resolve a non-upreference"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1157 | unsigned upref = Ty->getUpRefNum(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1158 | assert(upref < stack->size() && "Invalid up reference"); |
| 1159 | return (*stack)[upref - stack->size() - 1]; |
| 1160 | } |
| 1161 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1162 | const Type* getGEPIndexedType(const Type* PTy, ValueList* idxs) { |
| 1163 | const Type* Result = PTy = PTy->resolve(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1164 | assert(PTy->isPointer() && "GEP Operand is not a pointer?"); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1165 | Type::UpRefStack stack; |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1166 | for (unsigned i = 0; i < idxs->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1167 | if (Result->isComposite()) { |
| 1168 | Result = Result->getIndexedType((*idxs)[i]); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1169 | Result = Result->resolve(); |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1170 | stack.push_back(Result); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1171 | } else |
| 1172 | yyerror("Invalid type for index"); |
| 1173 | } |
Reid Spencer | eff838e | 2007-01-03 23:45:42 +0000 | [diff] [blame] | 1174 | // Resolve upreferences so we can return a more natural type |
| 1175 | if (Result->isPointer()) { |
| 1176 | if (Result->getElementType()->isUpReference()) { |
| 1177 | stack.push_back(Result); |
| 1178 | Result = ResolveUpReference(Result->getElementType(), &stack); |
| 1179 | } |
| 1180 | } else if (Result->isUpReference()) { |
| 1181 | Result = ResolveUpReference(Result->getElementType(), &stack); |
| 1182 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1183 | return Result->getPointerType(); |
| 1184 | } |
| 1185 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1186 | // This function handles appending .u or .s to integer value names that |
| 1187 | // were previously unsigned or signed, respectively. This avoids name |
| 1188 | // collisions since the unsigned and signed type planes have collapsed |
| 1189 | // into a single signless type plane. |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1190 | std::string getUniqueName(const std::string *Name, const Type* Ty, |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1191 | bool isGlobal = false, bool isDef = false) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1192 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1193 | // If its not a symbolic name, don't modify it, probably a constant val. |
| 1194 | if ((*Name)[0] != '%' && (*Name)[0] != '"') |
| 1195 | return *Name; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1196 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1197 | // If its a numeric reference, just leave it alone. |
| 1198 | if (isdigit((*Name)[1])) |
| 1199 | return *Name; |
| 1200 | |
| 1201 | // Resolve the type |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1202 | Ty = Ty->resolve(); |
| 1203 | |
| 1204 | // If its a global name, get its uniquified name, if any |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1205 | Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name); |
| 1206 | if (GI != Type::Globals.end()) { |
| 1207 | Type::TypePlaneMap::iterator TPI = GI->second.begin(); |
| 1208 | Type::TypePlaneMap::iterator TPE = GI->second.end(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1209 | for ( ; TPI != TPE ; ++TPI) { |
| 1210 | if (TPI->first->sameNewTyAs(Ty)) |
| 1211 | return TPI->second; |
| 1212 | } |
| 1213 | } |
| 1214 | |
| 1215 | if (isGlobal) { |
| 1216 | // We didn't find a global name, but if its supposed to be global then all |
| 1217 | // we can do is return the name. This is probably a forward reference of a |
| 1218 | // global value that hasn't been defined yet. Since we have no definition |
| 1219 | // we don't know its linkage class. Just assume its an external and the name |
| 1220 | // shouldn't change. |
| 1221 | return *Name; |
| 1222 | } |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1223 | |
| 1224 | // Default the result to the current name |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1225 | std::string Result = Ty->makeUniqueName(*Name); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1226 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1227 | return Result; |
| 1228 | } |
| 1229 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1230 | std::string getGlobalName(const std::string* Name, const std::string Linkage, |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1231 | const Type* Ty, bool isConstant) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1232 | // Default to given name |
| 1233 | std::string Result = *Name; |
| 1234 | // Look up the name in the Globals Map |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1235 | Type::GlobalsTypeMap::iterator GI = Type::Globals.find(*Name); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1236 | // Did we see this global name before? |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1237 | if (GI != Type::Globals.end()) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1238 | if (Ty->isUnresolvedDeep()) { |
| 1239 | // The Gval's type is unresolved. Consequently, we can't disambiguate it |
| 1240 | // by type. We'll just change its name and emit a warning. |
| 1241 | warning("Cannot disambiguate global value '" + *Name + |
| 1242 | "' because type '" + Ty->getNewTy() + "'is unresolved.\n"); |
| 1243 | Result = *Name + ".unique"; |
| 1244 | UniqueNameCounter++; |
| 1245 | Result += llvm::utostr(UniqueNameCounter); |
| 1246 | return Result; |
| 1247 | } else { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1248 | Type::TypePlaneMap::iterator TPI = GI->second.find(Ty); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1249 | if (TPI != GI->second.end()) { |
| 1250 | // We found an existing name of the same old type. This isn't allowed |
| 1251 | // in LLVM 2.0. Consequently, we must alter the name of the global so it |
| 1252 | // can at least compile. References to the global will yield the first |
| 1253 | // definition, which is okay. We also must warn about this. |
| 1254 | Result = *Name + ".unique"; |
| 1255 | UniqueNameCounter++; |
| 1256 | Result += llvm::utostr(UniqueNameCounter); |
| 1257 | warning(std::string("Global variable '") + *Name + "' was renamed to '"+ |
| 1258 | Result + "'"); |
| 1259 | } else { |
| 1260 | // There isn't an existing definition for this name according to the |
| 1261 | // old types. Now search the TypePlanMap for types with the same new |
| 1262 | // name. |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1263 | Type::TypePlaneMap::iterator TPI = GI->second.begin(); |
| 1264 | Type::TypePlaneMap::iterator TPE = GI->second.end(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1265 | for ( ; TPI != TPE; ++TPI) { |
| 1266 | if (TPI->first->sameNewTyAs(Ty)) { |
| 1267 | // The new types are the same but the old types are different so |
| 1268 | // this is a global name collision resulting from type planes |
| 1269 | // collapsing. |
| 1270 | if (Linkage == "external" || Linkage == "dllimport" || |
| 1271 | Linkage == "extern_weak" || Linkage == "") { |
| 1272 | // The linkage of this gval is external so we can't reliably |
| 1273 | // rename it because it could potentially create a linking |
| 1274 | // problem. However, we can't leave the name conflict in the |
| 1275 | // output either or it won't assemble with LLVM 2.0. So, all we |
| 1276 | // can do is rename this one to something unique and emit a |
| 1277 | // warning about the problem. |
| 1278 | Result = *Name + ".unique"; |
| 1279 | UniqueNameCounter++; |
| 1280 | Result += llvm::utostr(UniqueNameCounter); |
| 1281 | warning("Renaming global value '" + *Name + "' to '" + Result + |
| 1282 | "' may cause linkage errors."); |
| 1283 | return Result; |
| 1284 | } else { |
| 1285 | // Its linkage is internal and its type is known so we can |
| 1286 | // disambiguate the name collision successfully based on the type. |
| 1287 | Result = getUniqueName(Name, Ty); |
| 1288 | TPI->second = Result; |
| 1289 | return Result; |
| 1290 | } |
| 1291 | } |
| 1292 | } |
| 1293 | // We didn't find an entry in the type plane with the same new type and |
| 1294 | // the old types differ so this is a new type plane for this global |
| 1295 | // variable. We just fall through to the logic below which inserts |
| 1296 | // the global. |
| 1297 | } |
| 1298 | } |
| 1299 | } |
| 1300 | |
| 1301 | // Its a new global name, if it is external we can't change it |
| 1302 | if (isConstant || Linkage == "external" || Linkage == "dllimport" || |
| 1303 | Linkage == "extern_weak" || Linkage == "") { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1304 | Type::Globals[Result][Ty] = Result; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1305 | return Result; |
| 1306 | } |
| 1307 | |
| 1308 | // Its a new global name, and it is internal, change the name to make it |
| 1309 | // unique for its type. |
| 1310 | // Result = getUniqueName(Name, Ty); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1311 | Type::Globals[*Name][Ty] = Result; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1312 | return Result; |
| 1313 | } |
| 1314 | |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1315 | } // End anonymous namespace |
| 1316 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1317 | // This function is used by the Lexer to create a Type. It can't be |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1318 | // in the anonymous namespace. |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1319 | const Type* getType(const std::string& newTy, TypeIDs oldTy) { |
| 1320 | return Type::get(newTy, oldTy); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1321 | } |
| 1322 | |
| 1323 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1324 | |
| 1325 | /* Enabling traces. */ |
| 1326 | #ifndef YYDEBUG |
| 1327 | # define YYDEBUG 0 |
| 1328 | #endif |
| 1329 | |
| 1330 | /* Enabling verbose error messages. */ |
| 1331 | #ifdef YYERROR_VERBOSE |
| 1332 | # undef YYERROR_VERBOSE |
| 1333 | # define YYERROR_VERBOSE 1 |
| 1334 | #else |
| 1335 | # define YYERROR_VERBOSE 0 |
| 1336 | #endif |
| 1337 | |
| 1338 | /* Enabling the token table. */ |
| 1339 | #ifndef YYTOKEN_TABLE |
| 1340 | # define YYTOKEN_TABLE 0 |
| 1341 | #endif |
| 1342 | |
| 1343 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1344 | #line 971 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1345 | typedef union YYSTYPE { |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1346 | std::string* String; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1347 | const Type* Ty; |
| 1348 | Value* Val; |
| 1349 | Constant* Const; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 1350 | ValueList* ValList; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1351 | TypeList* TypeVec; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1352 | } YYSTYPE; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1353 | /* Line 196 of yacc.c. */ |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1354 | #line 1355 "UpgradeParser.tab.c" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1355 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1356 | # define YYSTYPE_IS_DECLARED 1 |
| 1357 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1358 | #endif |
| 1359 | |
| 1360 | |
| 1361 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1362 | /* Copy the second part of user declarations. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1363 | |
| 1364 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1365 | /* Line 219 of yacc.c. */ |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1366 | #line 1367 "UpgradeParser.tab.c" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1367 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1368 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1369 | # define YYSIZE_T __SIZE_TYPE__ |
| 1370 | #endif |
| 1371 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1372 | # define YYSIZE_T size_t |
| 1373 | #endif |
| 1374 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1375 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1376 | # define YYSIZE_T size_t |
| 1377 | #endif |
| 1378 | #if ! defined (YYSIZE_T) |
| 1379 | # define YYSIZE_T unsigned int |
| 1380 | #endif |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1381 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1382 | #ifndef YY_ |
| 1383 | # if YYENABLE_NLS |
| 1384 | # if ENABLE_NLS |
| 1385 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1386 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1387 | # endif |
| 1388 | # endif |
| 1389 | # ifndef YY_ |
| 1390 | # define YY_(msgid) msgid |
| 1391 | # endif |
| 1392 | #endif |
| 1393 | |
| 1394 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1395 | |
| 1396 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1397 | |
| 1398 | # ifdef YYSTACK_USE_ALLOCA |
| 1399 | # if YYSTACK_USE_ALLOCA |
| 1400 | # ifdef __GNUC__ |
| 1401 | # define YYSTACK_ALLOC __builtin_alloca |
| 1402 | # else |
| 1403 | # define YYSTACK_ALLOC alloca |
| 1404 | # if defined (__STDC__) || defined (__cplusplus) |
| 1405 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1406 | # define YYINCLUDED_STDLIB_H |
| 1407 | # endif |
| 1408 | # endif |
| 1409 | # endif |
| 1410 | # endif |
| 1411 | |
| 1412 | # ifdef YYSTACK_ALLOC |
| 1413 | /* Pacify GCC's `empty if-body' warning. */ |
| 1414 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1415 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1416 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1417 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1418 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1419 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1420 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1421 | # endif |
| 1422 | # else |
| 1423 | # define YYSTACK_ALLOC YYMALLOC |
| 1424 | # define YYSTACK_FREE YYFREE |
| 1425 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1426 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1427 | # endif |
| 1428 | # ifdef __cplusplus |
| 1429 | extern "C" { |
| 1430 | # endif |
| 1431 | # ifndef YYMALLOC |
| 1432 | # define YYMALLOC malloc |
| 1433 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1434 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1435 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1436 | # endif |
| 1437 | # endif |
| 1438 | # ifndef YYFREE |
| 1439 | # define YYFREE free |
| 1440 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1441 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1442 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1443 | # endif |
| 1444 | # endif |
| 1445 | # ifdef __cplusplus |
| 1446 | } |
| 1447 | # endif |
| 1448 | # endif |
| 1449 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1450 | |
| 1451 | |
| 1452 | #if (! defined (yyoverflow) \ |
| 1453 | && (! defined (__cplusplus) \ |
| 1454 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1455 | |
| 1456 | /* A type that is properly aligned for any stack member. */ |
| 1457 | union yyalloc |
| 1458 | { |
| 1459 | short int yyss; |
| 1460 | YYSTYPE yyvs; |
| 1461 | }; |
| 1462 | |
| 1463 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1464 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1465 | |
| 1466 | /* The size of an array large to enough to hold all stacks, each with |
| 1467 | N elements. */ |
| 1468 | # define YYSTACK_BYTES(N) \ |
| 1469 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1470 | + YYSTACK_GAP_MAXIMUM) |
| 1471 | |
| 1472 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1473 | not overlap. */ |
| 1474 | # ifndef YYCOPY |
| 1475 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1476 | # define YYCOPY(To, From, Count) \ |
| 1477 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1478 | # else |
| 1479 | # define YYCOPY(To, From, Count) \ |
| 1480 | do \ |
| 1481 | { \ |
| 1482 | YYSIZE_T yyi; \ |
| 1483 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1484 | (To)[yyi] = (From)[yyi]; \ |
| 1485 | } \ |
| 1486 | while (0) |
| 1487 | # endif |
| 1488 | # endif |
| 1489 | |
| 1490 | /* Relocate STACK from its old location to the new one. The |
| 1491 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1492 | elements in the stack, and YYPTR gives the new location of the |
| 1493 | stack. Advance YYPTR to a properly aligned location for the next |
| 1494 | stack. */ |
| 1495 | # define YYSTACK_RELOCATE(Stack) \ |
| 1496 | do \ |
| 1497 | { \ |
| 1498 | YYSIZE_T yynewbytes; \ |
| 1499 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1500 | Stack = &yyptr->Stack; \ |
| 1501 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1502 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1503 | } \ |
| 1504 | while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1505 | |
| 1506 | #endif |
| 1507 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1508 | #if defined (__STDC__) || defined (__cplusplus) |
| 1509 | typedef signed char yysigned_char; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1510 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1511 | typedef short int yysigned_char; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1512 | #endif |
| 1513 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1514 | /* YYFINAL -- State number of the termination state. */ |
| 1515 | #define YYFINAL 4 |
| 1516 | /* YYLAST -- Last index in YYTABLE. */ |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1517 | #define YYLAST 1473 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1518 | |
| 1519 | /* YYNTOKENS -- Number of terminals. */ |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1520 | #define YYNTOKENS 164 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1521 | /* YYNNTS -- Number of nonterminals. */ |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1522 | #define YYNNTS 76 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1523 | /* YYNRULES -- Number of rules. */ |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1524 | #define YYNRULES 301 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1525 | /* YYNRULES -- Number of states. */ |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1526 | #define YYNSTATES 585 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1527 | |
| 1528 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1529 | #define YYUNDEFTOK 2 |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1530 | #define YYMAXUTOK 404 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1531 | |
| 1532 | #define YYTRANSLATE(YYX) \ |
| 1533 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1534 | |
| 1535 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1536 | static const unsigned char yytranslate[] = |
| 1537 | { |
| 1538 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1539 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1540 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1541 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1542 | 153, 154, 162, 2, 151, 2, 2, 2, 2, 2, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1543 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1544 | 158, 150, 159, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1545 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1546 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1547 | 2, 155, 152, 157, 2, 2, 2, 2, 2, 163, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1548 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1549 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1550 | 156, 2, 2, 160, 2, 161, 2, 2, 2, 2, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1551 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1552 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1553 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1554 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1555 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1556 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1557 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1558 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1559 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1560 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1561 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1562 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1563 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1564 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1565 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1566 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1567 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1568 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1569 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1570 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1571 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1572 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1573 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1574 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1575 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1576 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1577 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1578 | 145, 146, 147, 148, 149 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1579 | }; |
| 1580 | |
| 1581 | #if YYDEBUG |
| 1582 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1583 | YYRHS. */ |
| 1584 | static const unsigned short int yyprhs[] = |
| 1585 | { |
| 1586 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1587 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1588 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1589 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1590 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1591 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1592 | 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, |
| 1593 | 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, |
| 1594 | 159, 161, 164, 165, 167, 169, 171, 173, 175, 177, |
| 1595 | 179, 180, 182, 184, 186, 188, 190, 192, 195, 196, |
| 1596 | 197, 200, 201, 205, 208, 209, 211, 212, 216, 218, |
| 1597 | 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, |
| 1598 | 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, |
| 1599 | 261, 264, 269, 275, 281, 285, 288, 294, 299, 302, |
| 1600 | 304, 308, 310, 314, 316, 317, 322, 326, 330, 335, |
| 1601 | 340, 344, 347, 350, 353, 356, 359, 362, 365, 368, |
| 1602 | 371, 374, 381, 387, 396, 403, 410, 417, 425, 433, |
| 1603 | 440, 447, 456, 465, 469, 471, 473, 475, 477, 480, |
| 1604 | 483, 488, 491, 493, 495, 497, 502, 505, 510, 517, |
| 1605 | 524, 531, 538, 542, 547, 548, 550, 552, 554, 558, |
| 1606 | 562, 566, 570, 574, 578, 580, 581, 583, 585, 587, |
| 1607 | 588, 591, 595, 597, 599, 603, 605, 606, 615, 617, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1608 | 619, 623, 625, 627, 631, 632, 634, 636, 637, 642, |
| 1609 | 643, 645, 647, 649, 651, 653, 655, 657, 659, 661, |
| 1610 | 665, 667, 673, 675, 677, 679, 681, 684, 687, 689, |
| 1611 | 692, 695, 696, 698, 700, 702, 705, 708, 712, 722, |
| 1612 | 732, 741, 756, 758, 760, 767, 773, 776, 783, 791, |
| 1613 | 793, 797, 799, 800, 803, 805, 811, 817, 823, 830, |
| 1614 | 837, 842, 847, 854, 859, 864, 871, 878, 881, 889, |
| 1615 | 891, 894, 895, 897, 898, 902, 909, 913, 920, 923, |
| 1616 | 928, 935 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1617 | }; |
| 1618 | |
| 1619 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1620 | static const short int yyrhs[] = |
| 1621 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1622 | 198, 0, -1, 19, -1, 20, -1, 17, -1, 18, |
| 1623 | -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, |
| 1624 | -1, 84, -1, 85, -1, 86, -1, 87, -1, 88, |
| 1625 | -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, |
| 1626 | -1, 94, -1, 95, -1, 96, -1, 97, -1, 98, |
| 1627 | -1, 101, -1, 102, -1, 103, -1, 104, -1, 105, |
| 1628 | -1, 106, -1, 117, -1, 118, -1, 119, -1, 120, |
| 1629 | -1, 107, -1, 108, -1, 109, -1, 110, -1, 111, |
| 1630 | -1, 112, -1, 113, -1, 114, -1, 115, -1, 116, |
| 1631 | -1, 117, -1, 118, -1, 119, -1, 120, -1, 25, |
| 1632 | -1, 26, -1, 129, -1, 130, -1, 131, -1, 132, |
| 1633 | -1, 138, -1, 139, -1, 140, -1, 141, -1, 142, |
| 1634 | -1, 143, -1, 144, -1, 145, -1, 146, -1, 147, |
| 1635 | -1, 148, -1, 149, -1, 137, -1, 11, -1, 9, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1636 | -1, 7, -1, 5, -1, 12, -1, 10, -1, 8, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1637 | -1, 6, -1, 174, -1, 175, -1, 13, -1, 14, |
| 1638 | -1, 207, 150, -1, -1, 42, -1, 43, -1, 44, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1639 | -1, 48, -1, 45, -1, 46, -1, 47, -1, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1640 | 65, -1, 66, -1, 67, -1, 68, -1, 69, -1, |
| 1641 | 70, -1, 64, 18, -1, -1, -1, 56, 18, -1, |
| 1642 | -1, 151, 56, 18, -1, 37, 30, -1, -1, 183, |
| 1643 | -1, -1, 151, 186, 185, -1, 183, -1, 56, 18, |
| 1644 | -1, 189, -1, 3, -1, 191, -1, 3, -1, 191, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1645 | -1, 4, -1, 5, -1, 6, -1, 7, -1, 8, |
| 1646 | -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1647 | -1, 14, -1, 15, -1, 16, -1, 222, -1, 190, |
| 1648 | -1, 152, 18, -1, 188, 153, 193, 154, -1, 155, |
| 1649 | 18, 156, 191, 157, -1, 158, 18, 156, 191, 159, |
| 1650 | -1, 160, 192, 161, -1, 160, 161, -1, 158, 160, |
| 1651 | 192, 161, 159, -1, 158, 160, 161, 159, -1, 191, |
| 1652 | 162, -1, 191, -1, 192, 151, 191, -1, 192, -1, |
| 1653 | 192, 151, 40, -1, 40, -1, -1, 189, 155, 196, |
| 1654 | 157, -1, 189, 155, 157, -1, 189, 163, 30, -1, |
| 1655 | 189, 158, 196, 159, -1, 189, 160, 196, 161, -1, |
| 1656 | 189, 160, 161, -1, 189, 22, -1, 189, 23, -1, |
| 1657 | 189, 222, -1, 189, 195, -1, 189, 24, -1, 174, |
| 1658 | 166, -1, 175, 166, -1, 4, 25, -1, 4, 26, |
| 1659 | -1, 177, 21, -1, 173, 153, 194, 39, 189, 154, |
| 1660 | -1, 126, 153, 194, 237, 154, -1, 128, 153, 194, |
| 1661 | 151, 194, 151, 194, 154, -1, 167, 153, 194, 151, |
| 1662 | 194, 154, -1, 168, 153, 194, 151, 194, 154, -1, |
| 1663 | 169, 153, 194, 151, 194, 154, -1, 99, 170, 153, |
| 1664 | 194, 151, 194, 154, -1, 100, 171, 153, 194, 151, |
| 1665 | 194, 154, -1, 172, 153, 194, 151, 194, 154, -1, |
| 1666 | 134, 153, 194, 151, 194, 154, -1, 135, 153, 194, |
| 1667 | 151, 194, 151, 194, 154, -1, 136, 153, 194, 151, |
| 1668 | 194, 151, 194, 154, -1, 196, 151, 194, -1, 194, |
| 1669 | -1, 35, -1, 36, -1, 199, -1, 199, 216, -1, |
| 1670 | 199, 218, -1, 199, 62, 61, 202, -1, 199, 31, |
| 1671 | -1, 201, -1, 49, -1, 57, -1, 201, 178, 27, |
| 1672 | 187, -1, 201, 218, -1, 201, 62, 61, 202, -1, |
| 1673 | 201, 178, 179, 197, 194, 185, -1, 201, 178, 200, |
| 1674 | 197, 189, 185, -1, 201, 178, 45, 197, 189, 185, |
| 1675 | -1, 201, 178, 47, 197, 189, 185, -1, 201, 50, |
| 1676 | 204, -1, 201, 58, 150, 205, -1, -1, 30, -1, |
| 1677 | 55, -1, 54, -1, 52, 150, 203, -1, 53, 150, |
| 1678 | 18, -1, 51, 150, 30, -1, 71, 150, 30, -1, |
| 1679 | 155, 206, 157, -1, 206, 151, 30, -1, 30, -1, |
| 1680 | -1, 28, -1, 30, -1, 207, -1, -1, 189, 208, |
| 1681 | -1, 210, 151, 209, -1, 209, -1, 210, -1, 210, |
| 1682 | 151, 40, -1, 40, -1, -1, 180, 187, 207, 153, |
| 1683 | 211, 154, 184, 181, -1, 32, -1, 160, -1, 179, |
| 1684 | 212, 213, -1, 33, -1, 161, -1, 214, 225, 215, |
| 1685 | -1, -1, 45, -1, 47, -1, -1, 34, 219, 217, |
| 1686 | 212, -1, -1, 63, -1, 17, -1, 18, -1, 21, |
| 1687 | -1, 25, -1, 26, -1, 22, -1, 23, -1, 24, |
| 1688 | -1, 158, 196, 159, -1, 195, -1, 61, 220, 30, |
| 1689 | 151, 30, -1, 165, -1, 207, -1, 222, -1, 221, |
| 1690 | -1, 189, 223, -1, 225, 226, -1, 226, -1, 227, |
| 1691 | 229, -1, 227, 231, -1, -1, 29, -1, 77, -1, |
| 1692 | 76, -1, 72, 224, -1, 72, 3, -1, 73, 15, |
| 1693 | 223, -1, 73, 4, 223, 151, 15, 223, 151, 15, |
| 1694 | 223, -1, 74, 176, 223, 151, 15, 223, 155, 230, |
| 1695 | 157, -1, 74, 176, 223, 151, 15, 223, 155, 157, |
| 1696 | -1, 178, 75, 180, 187, 223, 153, 234, 154, 39, |
| 1697 | 15, 223, 228, 15, 223, -1, 228, -1, 78, -1, |
| 1698 | 230, 176, 221, 151, 15, 223, -1, 176, 221, 151, |
| 1699 | 15, 223, -1, 178, 236, -1, 189, 155, 223, 151, |
| 1700 | 223, 157, -1, 232, 151, 155, 223, 151, 223, 157, |
| 1701 | -1, 224, -1, 233, 151, 224, -1, 233, -1, -1, |
| 1702 | 60, 59, -1, 59, -1, 167, 189, 223, 151, 223, |
| 1703 | -1, 168, 189, 223, 151, 223, -1, 169, 189, 223, |
| 1704 | 151, 223, -1, 99, 170, 189, 223, 151, 223, -1, |
| 1705 | 100, 171, 189, 223, 151, 223, -1, 172, 224, 151, |
| 1706 | 224, -1, 173, 224, 39, 189, -1, 128, 224, 151, |
| 1707 | 224, 151, 224, -1, 133, 224, 151, 189, -1, 134, |
| 1708 | 224, 151, 224, -1, 135, 224, 151, 224, 151, 224, |
| 1709 | -1, 136, 224, 151, 224, 151, 224, -1, 127, 232, |
| 1710 | -1, 235, 180, 187, 223, 153, 234, 154, -1, 239, |
| 1711 | -1, 151, 233, -1, -1, 38, -1, -1, 121, 189, |
| 1712 | 182, -1, 121, 189, 151, 10, 223, 182, -1, 122, |
| 1713 | 189, 182, -1, 122, 189, 151, 10, 223, 182, -1, |
| 1714 | 123, 224, -1, 238, 124, 189, 223, -1, 238, 125, |
| 1715 | 224, 151, 189, 223, -1, 126, 189, 223, 237, -1 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1716 | }; |
| 1717 | |
| 1718 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1719 | static const unsigned short int yyrline[] = |
| 1720 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 1721 | 0, 1036, 1036, 1036, 1037, 1037, 1041, 1041, 1041, 1041, |
| 1722 | 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1043, 1043, 1043, |
| 1723 | 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045, |
| 1724 | 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046, |
| 1725 | 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047, |
| 1726 | 1047, 1047, 1048, 1048, 1048, 1048, 1049, 1049, 1049, 1049, |
| 1727 | 1049, 1049, 1049, 1050, 1050, 1050, 1050, 1050, 1050, 1055, |
| 1728 | 1055, 1055, 1055, 1056, 1056, 1056, 1056, 1057, 1057, 1058, |
| 1729 | 1058, 1061, 1064, 1069, 1069, 1069, 1069, 1069, 1069, 1070, |
| 1730 | 1071, 1074, 1074, 1074, 1074, 1074, 1075, 1076, 1081, 1086, |
| 1731 | 1087, 1090, 1091, 1099, 1105, 1106, 1109, 1110, 1119, 1120, |
| 1732 | 1133, 1133, 1134, 1134, 1135, 1139, 1139, 1139, 1139, 1139, |
| 1733 | 1139, 1139, 1140, 1140, 1140, 1140, 1140, 1142, 1145, 1148, |
| 1734 | 1151, 1155, 1168, 1174, 1180, 1190, 1193, 1203, 1206, 1214, |
| 1735 | 1218, 1225, 1226, 1231, 1236, 1246, 1253, 1259, 1266, 1273, |
| 1736 | 1280, 1286, 1293, 1300, 1308, 1315, 1322, 1329, 1336, 1343, |
| 1737 | 1350, 1358, 1372, 1384, 1389, 1395, 1400, 1406, 1411, 1416, |
| 1738 | 1424, 1429, 1434, 1444, 1449, 1454, 1454, 1464, 1469, 1472, |
| 1739 | 1477, 1481, 1485, 1487, 1487, 1490, 1500, 1505, 1510, 1520, |
| 1740 | 1530, 1540, 1550, 1555, 1560, 1565, 1567, 1567, 1570, 1575, |
| 1741 | 1582, 1587, 1594, 1601, 1606, 1607, 1615, 1615, 1616, 1616, |
| 1742 | 1618, 1627, 1631, 1635, 1638, 1643, 1646, 1649, 1672, 1673, |
| 1743 | 1676, 1687, 1688, 1690, 1699, 1700, 1701, 1705, 1705, 1719, |
| 1744 | 1720, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1724, 1725, |
| 1745 | 1730, 1731, 1740, 1740, 1744, 1750, 1761, 1770, 1773, 1781, |
| 1746 | 1785, 1790, 1793, 1799, 1799, 1801, 1806, 1811, 1816, 1824, |
| 1747 | 1834, 1843, 1865, 1870, 1876, 1882, 1890, 1908, 1917, 1927, |
| 1748 | 1931, 1938, 1939, 1943, 1948, 1951, 1962, 1972, 1983, 1993, |
| 1749 | 2003, 2014, 2044, 2053, 2060, 2069, 2076, 2083, 2089, 2140, |
| 1750 | 2145, 2146, 2150, 2151, 2154, 2163, 2173, 2182, 2193, 2200, |
| 1751 | 2211, 2222 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1752 | }; |
| 1753 | #endif |
| 1754 | |
| 1755 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1756 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1757 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1758 | static const char *const yytname[] = |
| 1759 | { |
| 1760 | "$end", "error", "$undefined", "VOID", "BOOL", "SBYTE", "UBYTE", |
| 1761 | "SHORT", "USHORT", "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", |
| 1762 | "LABEL", "OPAQUE", "ESINT64VAL", "EUINT64VAL", "SINTVAL", "UINTVAL", |
| 1763 | "FPVAL", "NULL_TOK", "UNDEF", "ZEROINITIALIZER", "TRUETOK", "FALSETOK", |
| 1764 | "TYPE", "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", |
| 1765 | "BEGINTOK", "ENDTOK", "DECLARE", "GLOBAL", "CONSTANT", "SECTION", |
| 1766 | "VOLATILE", "TO", "DOTDOTDOT", "CONST", "INTERNAL", "LINKONCE", "WEAK", |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1767 | "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "APPENDING", "EXTERNAL", |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1768 | "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", |
| 1769 | "UNINITIALIZED", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", |
| 1770 | "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", |
| 1771 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1772 | "RET", "BR", "SWITCH", "INVOKE", "EXCEPT", "UNWIND", "UNREACHABLE", |
| 1773 | "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM", |
| 1774 | "SREM", "FREM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", |
| 1775 | "SETEQ", "SETNE", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", |
| 1776 | "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", |
| 1777 | "ULT", "UGT", "ULE", "UGE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", |
| 1778 | "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", "LSHR", |
| 1779 | "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "CAST", |
| 1780 | "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "FPTOUI", "FPTOSI", |
| 1781 | "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", "BITCAST", "'='", "','", |
| 1782 | "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", |
| 1783 | "'*'", "'c'", "$accept", "IntVal", "EInt64Val", "ArithmeticOps", |
| 1784 | "LogicalOps", "SetCondOps", "IPredicates", "FPredicates", "ShiftOps", |
| 1785 | "CastOps", "SIntType", "UIntType", "IntType", "FPType", "OptAssign", |
| 1786 | "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", |
| 1787 | "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", |
| 1788 | "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI", |
| 1789 | "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType", |
| 1790 | "Module", "DefinitionList", "External", "ConstPool", "AsmBlock", |
| 1791 | "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList", |
| 1792 | "Name", "OptName", "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", |
| 1793 | "BEGIN", "FunctionHeader", "END", "Function", "FnDeclareLinkage", |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1794 | "FunctionProto", "@1", "OptSideEffect", "ConstValueRef", |
| 1795 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList", |
| 1796 | "BasicBlock", "InstructionList", "Unwind", "BBTerminatorInst", |
| 1797 | "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE", |
| 1798 | "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1799 | }; |
| 1800 | #endif |
| 1801 | |
| 1802 | # ifdef YYPRINT |
| 1803 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1804 | token YYLEX-NUM. */ |
| 1805 | static const unsigned short int yytoknum[] = |
| 1806 | { |
| 1807 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1808 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1809 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1810 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1811 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1812 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1813 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1814 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1815 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1816 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1817 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1818 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1819 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1820 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1821 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1822 | 61, 44, 92, 40, 41, 91, 120, 93, 60, 62, |
| 1823 | 123, 125, 42, 99 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1824 | }; |
| 1825 | # endif |
| 1826 | |
| 1827 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1828 | static const unsigned char yyr1[] = |
| 1829 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1830 | 0, 164, 165, 165, 166, 166, 167, 167, 167, 167, |
| 1831 | 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, |
| 1832 | 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1833 | 170, 170, 170, 170, 170, 170, 171, 171, 171, 171, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1834 | 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, |
| 1835 | 171, 171, 172, 172, 172, 172, 173, 173, 173, 173, |
| 1836 | 173, 173, 173, 173, 173, 173, 173, 173, 173, 174, |
| 1837 | 174, 174, 174, 175, 175, 175, 175, 176, 176, 177, |
| 1838 | 177, 178, 178, 179, 179, 179, 179, 179, 179, 179, |
| 1839 | 179, 180, 180, 180, 180, 180, 180, 180, 180, 181, |
| 1840 | 181, 182, 182, 183, 184, 184, 185, 185, 186, 186, |
| 1841 | 187, 187, 188, 188, 189, 190, 190, 190, 190, 190, |
| 1842 | 190, 190, 190, 190, 190, 190, 190, 191, 191, 191, |
| 1843 | 191, 191, 191, 191, 191, 191, 191, 191, 191, 192, |
| 1844 | 192, 193, 193, 193, 193, 194, 194, 194, 194, 194, |
| 1845 | 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, |
| 1846 | 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, |
| 1847 | 195, 195, 195, 196, 196, 197, 197, 198, 199, 199, |
| 1848 | 199, 199, 199, 200, 200, 201, 201, 201, 201, 201, |
| 1849 | 201, 201, 201, 201, 201, 202, 203, 203, 204, 204, |
| 1850 | 204, 204, 205, 206, 206, 206, 207, 207, 208, 208, |
| 1851 | 209, 210, 210, 211, 211, 211, 211, 212, 213, 213, |
| 1852 | 214, 215, 215, 216, 217, 217, 217, 219, 218, 220, |
| 1853 | 220, 221, 221, 221, 221, 221, 221, 221, 221, 221, |
| 1854 | 221, 221, 222, 222, 223, 223, 224, 225, 225, 226, |
| 1855 | 227, 227, 227, 228, 228, 229, 229, 229, 229, 229, |
| 1856 | 229, 229, 229, 229, 230, 230, 231, 232, 232, 233, |
| 1857 | 233, 234, 234, 235, 235, 236, 236, 236, 236, 236, |
| 1858 | 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, |
| 1859 | 237, 237, 238, 238, 239, 239, 239, 239, 239, 239, |
| 1860 | 239, 239 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1861 | }; |
| 1862 | |
| 1863 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1864 | static const unsigned char yyr2[] = |
| 1865 | { |
| 1866 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1867 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1868 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1869 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1870 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1871 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1872 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1873 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1874 | 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, |
| 1875 | 0, 1, 1, 1, 1, 1, 1, 2, 0, 0, |
| 1876 | 2, 0, 3, 2, 0, 1, 0, 3, 1, 2, |
| 1877 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1878 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1879 | 2, 4, 5, 5, 3, 2, 5, 4, 2, 1, |
| 1880 | 3, 1, 3, 1, 0, 4, 3, 3, 4, 4, |
| 1881 | 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1882 | 2, 6, 5, 8, 6, 6, 6, 7, 7, 6, |
| 1883 | 6, 8, 8, 3, 1, 1, 1, 1, 2, 2, |
| 1884 | 4, 2, 1, 1, 1, 4, 2, 4, 6, 6, |
| 1885 | 6, 6, 3, 4, 0, 1, 1, 1, 3, 3, |
| 1886 | 3, 3, 3, 3, 1, 0, 1, 1, 1, 0, |
| 1887 | 2, 3, 1, 1, 3, 1, 0, 8, 1, 1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1888 | 3, 1, 1, 3, 0, 1, 1, 0, 4, 0, |
| 1889 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, |
| 1890 | 1, 5, 1, 1, 1, 1, 2, 2, 1, 2, |
| 1891 | 2, 0, 1, 1, 1, 2, 2, 3, 9, 9, |
| 1892 | 8, 14, 1, 1, 6, 5, 2, 6, 7, 1, |
| 1893 | 3, 1, 0, 2, 1, 5, 5, 5, 6, 6, |
| 1894 | 4, 4, 6, 4, 4, 6, 6, 2, 7, 1, |
| 1895 | 2, 0, 1, 0, 3, 6, 3, 6, 2, 4, |
| 1896 | 6, 4 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1897 | }; |
| 1898 | |
| 1899 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1900 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1901 | means the default is an error. */ |
| 1902 | static const unsigned short int yydefact[] = |
| 1903 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1904 | 194, 0, 90, 182, 1, 181, 227, 83, 84, 85, |
| 1905 | 87, 88, 89, 86, 0, 98, 251, 178, 179, 206, |
| 1906 | 207, 0, 0, 0, 90, 0, 186, 224, 0, 0, |
| 1907 | 91, 92, 93, 94, 95, 96, 0, 0, 252, 251, |
| 1908 | 248, 82, 0, 0, 0, 0, 192, 0, 0, 0, |
| 1909 | 0, 0, 183, 184, 0, 0, 81, 225, 226, 98, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1910 | 195, 180, 97, 111, 115, 116, 117, 118, 119, 120, |
| 1911 | 121, 122, 123, 124, 125, 126, 127, 2, 3, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1912 | 0, 0, 0, 242, 0, 0, 110, 129, 114, 243, |
| 1913 | 128, 218, 219, 220, 221, 222, 223, 247, 0, 0, |
| 1914 | 0, 254, 253, 263, 293, 262, 249, 250, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1915 | 0, 0, 205, 193, 187, 185, 175, 176, 0, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1916 | 0, 0, 228, 130, 0, 0, 0, 113, 135, 139, |
| 1917 | 0, 0, 144, 138, 256, 0, 255, 0, 0, 72, |
| 1918 | 76, 71, 75, 70, 74, 69, 73, 77, 78, 0, |
| 1919 | 292, 274, 0, 98, 6, 7, 8, 9, 10, 11, |
| 1920 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 1921 | 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, |
| 1922 | 0, 0, 52, 53, 54, 55, 0, 0, 0, 0, |
| 1923 | 68, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1924 | 65, 66, 67, 0, 0, 0, 0, 0, 98, 266, |
| 1925 | 0, 289, 200, 197, 196, 198, 199, 201, 204, 0, |
| 1926 | 106, 106, 115, 116, 117, 118, 119, 120, 121, 122, |
| 1927 | 123, 124, 125, 0, 0, 0, 0, 106, 106, 0, |
| 1928 | 0, 0, 0, 0, 134, 216, 143, 141, 0, 231, |
| 1929 | 232, 233, 236, 237, 238, 234, 235, 229, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1930 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1931 | 0, 240, 245, 244, 246, 0, 257, 0, 273, 0, |
| 1932 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 1933 | 0, 50, 51, 36, 37, 38, 39, 40, 41, 42, |
| 1934 | 43, 44, 45, 46, 47, 48, 49, 0, 101, 101, |
| 1935 | 298, 0, 0, 287, 0, 0, 0, 0, 0, 0, |
| 1936 | 0, 0, 0, 0, 0, 0, 0, 0, 202, 0, |
| 1937 | 190, 191, 158, 159, 4, 5, 156, 157, 160, 151, |
| 1938 | 152, 155, 0, 0, 0, 0, 154, 153, 188, 189, |
| 1939 | 112, 112, 137, 0, 140, 215, 209, 212, 213, 0, |
| 1940 | 0, 131, 230, 0, 0, 0, 0, 0, 0, 0, |
| 1941 | 0, 174, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1942 | 0, 0, 0, 0, 294, 0, 296, 291, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1943 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1944 | 0, 0, 0, 203, 0, 0, 108, 106, 146, 0, |
| 1945 | 0, 150, 0, 147, 132, 133, 136, 208, 210, 0, |
| 1946 | 104, 142, 0, 0, 0, 291, 0, 0, 0, 0, |
| 1947 | 0, 239, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1948 | 0, 0, 0, 0, 0, 0, 301, 0, 0, 0, |
| 1949 | 283, 284, 0, 0, 0, 0, 0, 280, 281, 0, |
| 1950 | 299, 0, 103, 109, 107, 145, 148, 149, 214, 211, |
| 1951 | 105, 99, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1952 | 173, 0, 0, 0, 0, 0, 0, 0, 272, 0, |
| 1953 | 0, 101, 102, 101, 269, 290, 0, 0, 0, 0, |
| 1954 | 0, 275, 276, 277, 272, 0, 0, 217, 241, 0, |
| 1955 | 0, 162, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1956 | 0, 0, 0, 271, 0, 278, 279, 0, 295, 297, |
| 1957 | 0, 0, 0, 282, 285, 286, 0, 300, 100, 0, |
| 1958 | 0, 0, 170, 0, 0, 164, 165, 166, 169, 161, |
| 1959 | 0, 260, 0, 0, 0, 270, 267, 0, 288, 167, |
| 1960 | 168, 0, 0, 0, 258, 0, 259, 0, 0, 268, |
| 1961 | 163, 171, 172, 0, 0, 0, 0, 0, 0, 265, |
| 1962 | 0, 0, 264, 0, 261 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1963 | }; |
| 1964 | |
| 1965 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1966 | static const short int yydefgoto[] = |
| 1967 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1968 | -1, 83, 336, 266, 267, 268, 290, 307, 269, 270, |
| 1969 | 233, 234, 149, 235, 24, 15, 36, 507, 384, 406, |
| 1970 | 471, 330, 407, 84, 85, 236, 87, 88, 130, 248, |
| 1971 | 371, 271, 372, 118, 1, 2, 55, 3, 61, 215, |
| 1972 | 46, 113, 219, 89, 418, 357, 358, 359, 37, 93, |
| 1973 | 16, 96, 17, 59, 18, 27, 363, 272, 90, 274, |
| 1974 | 494, 39, 40, 41, 105, 106, 553, 107, 313, 523, |
| 1975 | 524, 208, 209, 446, 210, 211 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1976 | }; |
| 1977 | |
| 1978 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1979 | STATE-NUM. */ |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1980 | #define YYPACT_NINF -537 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1981 | static const short int yypact[] = |
| 1982 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 1983 | -537, 75, 61, 1145, -537, -537, -537, -537, -537, -537, |
| 1984 | -537, -537, -537, -537, 18, 180, 55, -537, -537, -537, |
| 1985 | -537, -28, -61, 33, 130, -40, -537, 102, 87, 117, |
| 1986 | -537, -537, -537, -537, -537, -537, 838, -24, -537, -15, |
| 1987 | -537, 48, -11, -2, 6, 12, -537, 11, 87, 838, |
| 1988 | -9, -9, -537, -537, -9, -9, -537, -537, -537, 180, |
| 1989 | -537, -537, -537, 32, -537, -537, -537, -537, -537, -537, |
| 1990 | -537, -537, -537, -537, -537, -537, -537, -537, -537, 164, |
| 1991 | 171, -6, 512, -537, 135, 41, -537, -537, -103, -537, |
| 1992 | -537, -537, -537, -537, -537, -537, -537, -537, 883, 45, |
| 1993 | 192, -537, -537, -537, 1324, -537, -537, -537, 175, 126, |
| 1994 | 190, 188, 203, -537, -537, -537, -537, -537, 911, 911, |
| 1995 | 957, 911, -537, -537, 81, 97, 561, -537, -537, -103, |
| 1996 | -109, 121, 641, -537, 32, 1140, -537, 1140, 1140, -537, |
| 1997 | -537, -537, -537, -537, -537, -537, -537, -537, -537, 1140, |
| 1998 | -537, -537, 219, 180, -537, -537, -537, -537, -537, -537, |
| 1999 | -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, |
| 2000 | -537, -537, -537, -537, 10, 112, 911, 911, 911, 911, |
| 2001 | 911, 911, -537, -537, -537, -537, 911, 911, 911, 911, |
| 2002 | -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, |
| 2003 | -537, -537, -537, 911, 911, 911, 911, 911, 180, -537, |
| 2004 | 59, -537, -537, -537, -537, -537, -537, -537, -537, -71, |
| 2005 | 129, 129, 167, 193, 195, 218, 222, 224, 234, 243, |
| 2006 | 250, 261, 263, 252, 252, 264, 993, 129, 129, 911, |
| 2007 | 911, 127, -97, 911, -537, 680, -537, 136, 137, -537, |
| 2008 | -537, -537, -537, -537, -537, -537, -537, 229, 10, 112, |
| 2009 | 140, 141, 144, 145, 146, 957, 147, 148, 150, 154, |
| 2010 | 155, -537, -537, -537, -537, 158, -537, 160, -537, 838, |
| 2011 | -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, |
| 2012 | 911, -537, -537, -537, -537, -537, -537, -537, -537, -537, |
| 2013 | -537, -537, -537, -537, -537, -537, -537, 911, 163, 165, |
| 2014 | -537, 1140, 162, 169, 170, 172, 173, 174, 176, 1140, |
| 2015 | 1140, 1140, 177, 276, 838, 911, 911, 288, -537, -8, |
| 2016 | -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, |
| 2017 | -537, -537, 724, 957, 590, 292, -537, -537, -537, -537, |
| 2018 | -106, -104, -537, 179, -103, -537, 135, -537, 178, 181, |
| 2019 | 752, -537, -537, 296, 183, 187, 957, 957, 957, 957, |
| 2020 | 957, -537, -131, 957, 957, 957, 957, 957, 315, 316, |
| 2021 | 1140, 1140, 1140, 1, -537, 7, -537, 191, 1140, 186, |
| 2022 | 911, 911, 911, 911, 911, 194, 197, 201, 911, 911, |
| 2023 | 1140, 1140, 202, -537, 304, 326, -537, 129, -537, -60, |
| 2024 | -78, -537, -74, -537, -537, -537, -537, -537, -537, 799, |
| 2025 | 309, -537, 208, 957, 957, 191, 210, 213, 223, 225, |
| 2026 | 957, -537, 230, 231, 235, 236, 308, 1140, 1140, 227, |
| 2027 | 237, 238, 1140, 357, 1140, 911, -537, 239, 1140, 241, |
| 2028 | -537, -537, 242, 244, 1140, 1140, 1140, -537, -537, 248, |
| 2029 | -537, 911, -537, -537, -537, -537, -537, -537, -537, -537, |
| 2030 | -537, 338, 366, 246, 251, 249, 957, 957, 957, 957, |
| 2031 | -537, 957, 957, 957, 957, 911, 253, 258, 911, 1140, |
| 2032 | 1140, 254, -537, 254, -537, 255, 1140, 256, 911, 911, |
| 2033 | 911, -537, -537, -537, 911, 1140, 390, -537, -537, 957, |
| 2034 | 957, -537, 265, 260, 266, 267, 268, 272, 274, 275, |
| 2035 | 277, 400, 29, 255, 280, -537, -537, 363, -537, -537, |
| 2036 | 911, 278, 1140, -537, -537, -537, 282, -537, -537, 283, |
| 2037 | 287, 957, -537, 957, 957, -537, -537, -537, -537, -537, |
| 2038 | 1140, -537, 1229, 60, 381, -537, -537, 286, -537, -537, |
| 2039 | -537, 290, 293, 294, -537, 270, -537, 1229, 435, -537, |
| 2040 | -537, -537, -537, 436, 302, 1140, 1140, 441, 196, -537, |
| 2041 | 1140, 442, -537, 1140, -537 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2042 | }; |
| 2043 | |
| 2044 | /* YYPGOTO[NTERM-NUM]. */ |
| 2045 | static const short int yypgoto[] = |
| 2046 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2047 | -537, -537, 226, 361, 362, 365, 209, 214, 368, 370, |
| 2048 | -99, -98, -507, -537, 420, 452, -134, -537, -303, 57, |
| 2049 | -537, -216, -537, -45, -537, -36, -537, -79, -30, -537, |
| 2050 | -111, 245, -210, 104, -537, -537, -537, -537, 431, -537, |
| 2051 | -537, -537, -537, 4, -537, 63, -537, -537, 421, -537, |
| 2052 | -537, -537, -537, -537, 480, -537, -537, -536, -105, 58, |
| 2053 | -88, -537, 445, -537, -93, -537, -537, -537, -537, 42, |
| 2054 | -18, -537, -537, 64, -537, -537 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2055 | }; |
| 2056 | |
| 2057 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2058 | positive, shift that token. If negative, reduce the rule which |
| 2059 | number is the opposite. If zero, do what YYDEFACT says. |
| 2060 | If YYTABLE_NINF, syntax error. */ |
| 2061 | #define YYTABLE_NINF -178 |
| 2062 | static const short int yytable[] = |
| 2063 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2064 | 86, 147, 148, 129, 115, 331, 386, 25, 91, 237, |
| 2065 | 136, 442, 125, 86, 38, 552, 565, 444, 94, 279, |
| 2066 | 430, 348, 349, 42, 43, 44, 116, 117, 431, 404, |
| 2067 | 273, 574, 273, 273, 139, 140, 141, 142, 143, 144, |
| 2068 | 145, 146, 243, 45, 273, 25, 567, 129, 405, 137, |
| 2069 | -112, 414, 244, 129, 243, 415, 133, 443, 133, 133, |
| 2070 | 138, -177, 135, 443, 353, 139, 140, 141, 142, 143, |
| 2071 | 144, 145, 146, 430, 324, 4, 19, 430, 20, 28, |
| 2072 | 327, 466, 220, 221, 38, 238, 328, 467, 131, 47, |
| 2073 | 310, 430, 5, 314, 48, 6, 242, 465, 315, 316, |
| 2074 | 317, 318, 247, 7, 8, 9, 10, 11, 12, 13, |
| 2075 | 56, 280, 281, 282, 283, 284, 285, 60, 322, 323, |
| 2076 | 98, 99, 100, 14, 101, 102, 103, 286, 287, 288, |
| 2077 | 289, 347, 409, 410, 412, 62, 92, 291, 292, 108, |
| 2078 | 308, 309, 135, 311, 312, 135, 95, 57, 109, 58, |
| 2079 | 135, 135, 135, 135, 126, 119, 110, 49, 120, 121, |
| 2080 | 350, 351, 111, 19, 354, 20, 112, 319, 320, 321, |
| 2081 | 135, 135, 7, 8, 9, 50, 11, 51, 13, 52, |
| 2082 | 213, 214, 123, 325, 326, -113, 551, 53, 528, 124, |
| 2083 | 529, 464, 332, 333, 132, 275, 276, 139, 140, 141, |
| 2084 | 142, 143, 144, 145, 146, 212, 273, 277, 216, 356, |
| 2085 | -72, -72, -76, -76, 273, 273, 273, 566, 217, 293, |
| 2086 | 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, |
| 2087 | 304, 305, 306, 218, 380, -71, -71, 239, 402, -75, |
| 2088 | -75, -70, -70, 86, 29, 30, 31, 32, 33, 34, |
| 2089 | 35, -74, -74, 240, 381, 425, 426, 427, 428, 429, |
| 2090 | -69, -69, 432, 433, 434, 435, 436, -73, -73, 334, |
| 2091 | 335, 382, 101, 102, 245, 273, 273, 273, 278, 400, |
| 2092 | 329, 354, -79, 273, -80, 338, 352, 360, 86, 401, |
| 2093 | 135, 361, 362, 366, 367, 273, 273, 368, 369, 370, |
| 2094 | 373, 374, 449, 375, 451, 452, 453, 376, 377, 378, |
| 2095 | 457, 379, 473, 474, 383, 399, 385, 388, 403, 480, |
| 2096 | 389, 390, 413, 391, 392, 393, 422, 394, 398, 419, |
| 2097 | 437, 438, 273, 273, 462, 420, 423, 273, 416, 273, |
| 2098 | 424, 448, 445, 273, 463, 454, 404, 485, 455, 273, |
| 2099 | 273, 273, 456, 461, 135, 450, 135, 135, 135, 472, |
| 2100 | 417, 476, 135, 458, 477, 512, 513, 514, 515, 387, |
| 2101 | 516, 517, 518, 519, 478, 492, 479, 395, 396, 397, |
| 2102 | 488, 481, 482, 356, 273, 273, 483, 484, 489, 490, |
| 2103 | 496, 273, 498, 499, 506, 500, 508, 509, 539, 540, |
| 2104 | 273, 504, 510, 511, 521, 527, 530, 532, 538, 135, |
| 2105 | 533, 534, 535, 522, 542, 550, 541, 543, 544, 443, |
| 2106 | 568, 573, 545, 147, 148, 505, 546, 273, 547, 548, |
| 2107 | 561, 549, 562, 563, 554, 556, 558, 559, 439, 440, |
| 2108 | 441, 560, 555, 569, 570, 273, 447, 571, 572, 520, |
| 2109 | 575, 576, 135, 577, 147, 148, 580, 583, 459, 460, |
| 2110 | 337, 104, 135, 135, 135, 203, 204, 364, 135, 205, |
| 2111 | 273, 273, 206, 365, 207, 273, 54, 470, 273, 114, |
| 2112 | 122, 346, 469, 26, 97, 581, 536, 495, 0, 475, |
| 2113 | 0, 0, 0, 0, 135, 486, 487, 0, 0, 0, |
| 2114 | 491, 0, 493, 0, 0, 0, 497, 0, 0, 0, |
| 2115 | 0, 0, 501, 502, 503, 127, 64, 65, 66, 67, |
| 2116 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 0, |
| 2117 | 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, |
| 2118 | 19, 0, 20, 0, 0, 0, 0, 525, 526, 0, |
| 2119 | 0, 0, 0, 0, 531, 0, 0, 0, 0, 0, |
| 2120 | 0, 0, 0, 537, 127, 64, 65, 66, 67, 68, |
| 2121 | 69, 70, 71, 72, 73, 74, 75, 76, 0, 0, |
| 2122 | 77, 78, 0, 0, 0, 0, 0, 0, 0, 19, |
| 2123 | 557, 20, 0, 127, 222, 223, 224, 225, 226, 227, |
| 2124 | 228, 229, 230, 231, 232, 75, 76, 0, 564, 77, |
| 2125 | 78, 0, 0, 0, 0, 0, 0, 0, 19, 0, |
| 2126 | 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2127 | 0, 0, 0, 578, 579, 0, 0, 0, 582, 0, |
| 2128 | 0, 584, 0, 0, 127, 64, 65, 66, 67, 68, |
| 2129 | 69, 70, 71, 72, 73, 74, 75, 76, 0, 0, |
| 2130 | 77, 78, 0, 0, 79, 0, 0, 80, 0, 19, |
| 2131 | 81, 20, 82, 128, 0, 0, 0, 0, 0, 0, |
| 2132 | 0, 246, 0, 127, 64, 65, 66, 67, 68, 69, |
| 2133 | 70, 71, 72, 73, 74, 75, 76, 0, 0, 77, |
| 2134 | 78, 0, 0, 0, 0, 0, 0, 0, 19, 0, |
| 2135 | 20, 0, 0, 79, 0, 0, 80, 0, 0, 81, |
| 2136 | 355, 82, 241, 0, 0, 0, 0, 127, 222, 223, |
| 2137 | 224, 225, 226, 227, 228, 229, 230, 231, 232, 75, |
| 2138 | 76, 0, 79, 77, 78, 80, 0, 0, 81, 0, |
| 2139 | 82, 411, 19, 0, 20, 127, 64, 65, 66, 67, |
| 2140 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 0, |
| 2141 | 0, 77, 78, 0, 0, 0, 0, 0, 0, 0, |
| 2142 | 19, 0, 20, 0, 0, 0, 0, 0, 0, 0, |
| 2143 | 0, 0, 421, 79, 0, 0, 80, 0, 0, 81, |
| 2144 | 0, 82, 127, 64, 65, 66, 67, 68, 69, 70, |
| 2145 | 71, 72, 73, 74, 75, 76, 0, 0, 77, 78, |
| 2146 | 0, 0, 0, 0, 0, 0, 0, 19, 0, 20, |
| 2147 | 0, 0, 79, 0, 0, 80, 0, 0, 81, 468, |
| 2148 | 82, 63, 64, 65, 66, 67, 68, 69, 70, 71, |
| 2149 | 72, 73, 74, 75, 76, 0, 0, 77, 78, 0, |
| 2150 | 0, 0, 0, 0, 0, 0, 19, 0, 20, 0, |
| 2151 | 0, 0, 0, 0, 0, 0, 79, 0, 0, 80, |
| 2152 | 0, 408, 81, 0, 82, 0, 134, 64, 65, 66, |
| 2153 | 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2154 | 0, 0, 77, 78, 79, 0, 0, 80, 0, 0, |
| 2155 | 81, 19, 82, 20, 127, 64, 65, 66, 67, 68, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2156 | 69, 70, 71, 72, 73, 74, 75, 76, 0, 0, |
| 2157 | 77, 78, 0, 0, 0, 0, 0, 0, 0, 19, |
| 2158 | 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2159 | 0, 79, 0, 0, 80, 0, 0, 81, 0, 82, |
| 2160 | 127, 222, 223, 224, 225, 226, 227, 228, 229, 230, |
| 2161 | 231, 232, 75, 76, 0, 0, 77, 78, 0, 0, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2162 | 0, 0, 0, 0, 0, 19, 0, 20, 0, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2163 | 79, 0, 0, 80, 0, 0, 81, 0, 82, 0, |
| 2164 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2165 | 0, 0, 77, 78, 0, 339, 340, 341, 0, 0, |
| 2166 | 0, 19, 0, 20, 0, 0, 0, 0, 0, 0, |
| 2167 | 0, 0, 0, 0, 0, 79, 0, 0, 80, 0, |
| 2168 | 0, 81, 0, 82, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2169 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2170 | 0, 0, 0, 79, 0, 0, 80, 0, 0, 81, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2171 | 0, 82, 154, 155, 156, 157, 158, 159, 160, 161, |
| 2172 | 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, |
| 2173 | 172, 173, 258, 259, 0, 0, 0, 0, 0, 0, |
| 2174 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, |
| 2175 | 0, 0, 80, 0, 0, 81, 0, 82, 0, 260, |
| 2176 | 0, 261, 182, 183, 184, 185, 0, 262, 263, 264, |
| 2177 | 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, |
| 2178 | 200, 201, 202, 0, 0, 0, 0, 0, 342, 0, |
| 2179 | 0, 343, 0, 344, 0, 0, 345, 249, 250, 77, |
| 2180 | 78, 251, 252, 253, 254, 255, 256, 0, 19, 0, |
| 2181 | 20, 0, -82, 19, 0, 20, 0, 0, 0, 6, |
| 2182 | -82, -82, 0, 0, 0, 0, 0, -82, -82, -82, |
| 2183 | -82, -82, -82, -82, -82, 21, 0, 0, 0, 0, |
| 2184 | 0, 257, -82, 22, 0, 0, 0, 23, 0, 0, |
| 2185 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 154, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2186 | 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2187 | 165, 166, 167, 168, 169, 170, 171, 172, 173, 258, |
| 2188 | 259, 0, 0, 0, 0, 0, 249, 250, 0, 0, |
| 2189 | 251, 252, 253, 254, 255, 256, 0, 0, 0, 0, |
| 2190 | 0, 0, 0, 0, 0, 0, 260, 0, 261, 182, |
| 2191 | 183, 184, 185, 0, 262, 263, 264, 190, 191, 192, |
| 2192 | 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, |
| 2193 | 257, 0, 0, 0, 0, 0, 0, 0, 265, 0, |
| 2194 | 0, 0, 0, 0, 0, 0, 0, 0, 154, 155, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2195 | 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2196 | 166, 167, 168, 169, 170, 171, 172, 173, 258, 259, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2197 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2198 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2199 | 0, 0, 0, 0, 0, 260, 0, 261, 182, 183, |
| 2200 | 184, 185, 150, 262, 263, 264, 190, 191, 192, 193, |
| 2201 | 194, 195, 196, 197, 198, 199, 200, 201, 202, 0, |
| 2202 | 0, 0, 0, 151, 152, 0, 0, 265, 0, 0, |
| 2203 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, |
| 2204 | 0, 0, 0, 154, 155, 156, 157, 158, 159, 160, |
| 2205 | 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, |
| 2206 | 171, 172, 173, 174, 175, 0, 0, 0, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2207 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2208 | 0, 0, 0, 0, 0, 176, 177, 178, 0, 0, |
| 2209 | 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, |
| 2210 | 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, |
| 2211 | 199, 200, 201, 202 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2212 | }; |
| 2213 | |
| 2214 | static const short int yycheck[] = |
| 2215 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2216 | 36, 100, 100, 82, 49, 221, 309, 3, 32, 120, |
| 2217 | 98, 10, 18, 49, 29, 522, 552, 10, 33, 153, |
| 2218 | 151, 237, 238, 51, 52, 53, 35, 36, 159, 37, |
| 2219 | 135, 567, 137, 138, 5, 6, 7, 8, 9, 10, |
| 2220 | 11, 12, 151, 71, 149, 41, 553, 126, 56, 4, |
| 2221 | 153, 157, 161, 132, 151, 159, 162, 56, 162, 162, |
| 2222 | 15, 0, 98, 56, 161, 5, 6, 7, 8, 9, |
| 2223 | 10, 11, 12, 151, 208, 0, 28, 151, 30, 61, |
| 2224 | 151, 159, 118, 119, 29, 121, 157, 161, 84, 150, |
| 2225 | 178, 151, 31, 181, 61, 34, 126, 157, 186, 187, |
| 2226 | 188, 189, 132, 42, 43, 44, 45, 46, 47, 48, |
| 2227 | 150, 101, 102, 103, 104, 105, 106, 30, 206, 207, |
| 2228 | 72, 73, 74, 62, 76, 77, 78, 117, 118, 119, |
| 2229 | 120, 236, 342, 343, 344, 18, 160, 25, 26, 150, |
| 2230 | 176, 177, 178, 179, 180, 181, 161, 45, 150, 47, |
| 2231 | 186, 187, 188, 189, 160, 51, 150, 27, 54, 55, |
| 2232 | 239, 240, 150, 28, 243, 30, 155, 203, 204, 205, |
| 2233 | 206, 207, 42, 43, 44, 45, 46, 47, 48, 49, |
| 2234 | 54, 55, 18, 124, 125, 153, 157, 57, 491, 18, |
| 2235 | 493, 407, 25, 26, 153, 137, 138, 5, 6, 7, |
| 2236 | 8, 9, 10, 11, 12, 30, 311, 149, 18, 245, |
| 2237 | 17, 18, 17, 18, 319, 320, 321, 157, 30, 107, |
| 2238 | 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, |
| 2239 | 118, 119, 120, 30, 279, 17, 18, 156, 326, 17, |
| 2240 | 18, 17, 18, 279, 64, 65, 66, 67, 68, 69, |
| 2241 | 70, 17, 18, 156, 290, 366, 367, 368, 369, 370, |
| 2242 | 17, 18, 373, 374, 375, 376, 377, 17, 18, 17, |
| 2243 | 18, 307, 76, 77, 153, 380, 381, 382, 59, 324, |
| 2244 | 151, 360, 21, 388, 21, 21, 159, 151, 324, 325, |
| 2245 | 326, 154, 63, 153, 153, 400, 401, 153, 153, 153, |
| 2246 | 153, 153, 390, 153, 392, 393, 394, 153, 153, 151, |
| 2247 | 398, 151, 423, 424, 151, 39, 151, 155, 30, 430, |
| 2248 | 151, 151, 30, 151, 151, 151, 30, 151, 151, 151, |
| 2249 | 15, 15, 437, 438, 30, 154, 153, 442, 159, 444, |
| 2250 | 153, 155, 151, 448, 18, 151, 37, 39, 151, 454, |
| 2251 | 455, 456, 151, 151, 390, 391, 392, 393, 394, 151, |
| 2252 | 356, 151, 398, 399, 151, 476, 477, 478, 479, 311, |
| 2253 | 481, 482, 483, 484, 151, 18, 151, 319, 320, 321, |
| 2254 | 153, 151, 151, 419, 489, 490, 151, 151, 151, 151, |
| 2255 | 151, 496, 151, 151, 56, 151, 30, 151, 509, 510, |
| 2256 | 505, 153, 151, 154, 151, 151, 151, 151, 18, 445, |
| 2257 | 498, 499, 500, 155, 154, 15, 151, 151, 151, 56, |
| 2258 | 39, 151, 154, 522, 522, 461, 154, 532, 154, 154, |
| 2259 | 541, 154, 543, 544, 154, 157, 154, 154, 380, 381, |
| 2260 | 382, 154, 530, 157, 154, 550, 388, 154, 154, 485, |
| 2261 | 15, 15, 488, 151, 553, 553, 15, 15, 400, 401, |
| 2262 | 234, 41, 498, 499, 500, 104, 104, 258, 504, 104, |
| 2263 | 575, 576, 104, 259, 104, 580, 24, 420, 583, 48, |
| 2264 | 59, 236, 419, 3, 39, 578, 504, 445, -1, 425, |
| 2265 | -1, -1, -1, -1, 530, 437, 438, -1, -1, -1, |
| 2266 | 442, -1, 444, -1, -1, -1, 448, -1, -1, -1, |
| 2267 | -1, -1, 454, 455, 456, 3, 4, 5, 6, 7, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2268 | 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2269 | -1, 19, 20, -1, -1, -1, -1, -1, -1, -1, |
| 2270 | 28, -1, 30, -1, -1, -1, -1, 489, 490, -1, |
| 2271 | -1, -1, -1, -1, 496, -1, -1, -1, -1, -1, |
| 2272 | -1, -1, -1, 505, 3, 4, 5, 6, 7, 8, |
| 2273 | 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, |
| 2274 | 19, 20, -1, -1, -1, -1, -1, -1, -1, 28, |
| 2275 | 532, 30, -1, 3, 4, 5, 6, 7, 8, 9, |
| 2276 | 10, 11, 12, 13, 14, 15, 16, -1, 550, 19, |
| 2277 | 20, -1, -1, -1, -1, -1, -1, -1, 28, -1, |
| 2278 | 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2279 | -1, -1, -1, 575, 576, -1, -1, -1, 580, -1, |
| 2280 | -1, 583, -1, -1, 3, 4, 5, 6, 7, 8, |
| 2281 | 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, |
| 2282 | 19, 20, -1, -1, 152, -1, -1, 155, -1, 28, |
| 2283 | 158, 30, 160, 161, -1, -1, -1, -1, -1, -1, |
| 2284 | -1, 40, -1, 3, 4, 5, 6, 7, 8, 9, |
| 2285 | 10, 11, 12, 13, 14, 15, 16, -1, -1, 19, |
| 2286 | 20, -1, -1, -1, -1, -1, -1, -1, 28, -1, |
| 2287 | 30, -1, -1, 152, -1, -1, 155, -1, -1, 158, |
| 2288 | 40, 160, 161, -1, -1, -1, -1, 3, 4, 5, |
| 2289 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 2290 | 16, -1, 152, 19, 20, 155, -1, -1, 158, -1, |
| 2291 | 160, 161, 28, -1, 30, 3, 4, 5, 6, 7, |
| 2292 | 8, 9, 10, 11, 12, 13, 14, 15, 16, -1, |
| 2293 | -1, 19, 20, -1, -1, -1, -1, -1, -1, -1, |
| 2294 | 28, -1, 30, -1, -1, -1, -1, -1, -1, -1, |
| 2295 | -1, -1, 40, 152, -1, -1, 155, -1, -1, 158, |
| 2296 | -1, 160, 3, 4, 5, 6, 7, 8, 9, 10, |
| 2297 | 11, 12, 13, 14, 15, 16, -1, -1, 19, 20, |
| 2298 | -1, -1, -1, -1, -1, -1, -1, 28, -1, 30, |
| 2299 | -1, -1, 152, -1, -1, 155, -1, -1, 158, 40, |
| 2300 | 160, 3, 4, 5, 6, 7, 8, 9, 10, 11, |
| 2301 | 12, 13, 14, 15, 16, -1, -1, 19, 20, -1, |
| 2302 | -1, -1, -1, -1, -1, -1, 28, -1, 30, -1, |
| 2303 | -1, -1, -1, -1, -1, -1, 152, -1, -1, 155, |
| 2304 | -1, 157, 158, -1, 160, -1, 3, 4, 5, 6, |
| 2305 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2306 | -1, -1, 19, 20, 152, -1, -1, 155, -1, -1, |
| 2307 | 158, 28, 160, 30, 3, 4, 5, 6, 7, 8, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2308 | 9, 10, 11, 12, 13, 14, 15, 16, -1, -1, |
| 2309 | 19, 20, -1, -1, -1, -1, -1, -1, -1, 28, |
| 2310 | -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2311 | -1, 152, -1, -1, 155, -1, -1, 158, -1, 160, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2312 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, |
| 2313 | 13, 14, 15, 16, -1, -1, 19, 20, -1, -1, |
| 2314 | -1, -1, -1, -1, -1, 28, -1, 30, -1, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2315 | 152, -1, -1, 155, -1, -1, 158, -1, 160, -1, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2316 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2317 | -1, -1, 19, 20, -1, 22, 23, 24, -1, -1, |
| 2318 | -1, 28, -1, 30, -1, -1, -1, -1, -1, -1, |
| 2319 | -1, -1, -1, -1, -1, 152, -1, -1, 155, -1, |
| 2320 | -1, 158, -1, 160, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2321 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2322 | -1, -1, -1, 152, -1, -1, 155, -1, -1, 158, |
| 2323 | -1, 160, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2324 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 2325 | 97, 98, 99, 100, -1, -1, -1, -1, -1, -1, |
| 2326 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, |
| 2327 | -1, -1, 155, -1, -1, 158, -1, 160, -1, 126, |
| 2328 | -1, 128, 129, 130, 131, 132, -1, 134, 135, 136, |
| 2329 | 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, |
| 2330 | 147, 148, 149, -1, -1, -1, -1, -1, 155, -1, |
| 2331 | -1, 158, -1, 160, -1, -1, 163, 17, 18, 19, |
| 2332 | 20, 21, 22, 23, 24, 25, 26, -1, 28, -1, |
| 2333 | 30, -1, 27, 28, -1, 30, -1, -1, -1, 34, |
| 2334 | 35, 36, -1, -1, -1, -1, -1, 42, 43, 44, |
| 2335 | 45, 46, 47, 48, 49, 50, -1, -1, -1, -1, |
| 2336 | -1, 61, 57, 58, -1, -1, -1, 62, -1, -1, |
| 2337 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2338 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2339 | 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2340 | 100, -1, -1, -1, -1, -1, 17, 18, -1, -1, |
| 2341 | 21, 22, 23, 24, 25, 26, -1, -1, -1, -1, |
| 2342 | -1, -1, -1, -1, -1, -1, 126, -1, 128, 129, |
| 2343 | 130, 131, 132, -1, 134, 135, 136, 137, 138, 139, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2344 | 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2345 | 61, -1, -1, -1, -1, -1, -1, -1, 158, -1, |
| 2346 | -1, -1, -1, -1, -1, -1, -1, -1, 79, 80, |
| 2347 | 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
| 2348 | 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2349 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2350 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2351 | -1, -1, -1, -1, -1, 126, -1, 128, 129, 130, |
| 2352 | 131, 132, 38, 134, 135, 136, 137, 138, 139, 140, |
| 2353 | 141, 142, 143, 144, 145, 146, 147, 148, 149, -1, |
| 2354 | -1, -1, -1, 59, 60, -1, -1, 158, -1, -1, |
| 2355 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, |
| 2356 | -1, -1, -1, 79, 80, 81, 82, 83, 84, 85, |
| 2357 | 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, |
| 2358 | 96, 97, 98, 99, 100, -1, -1, -1, -1, -1, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2359 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2360 | -1, -1, -1, -1, -1, 121, 122, 123, -1, -1, |
| 2361 | 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, |
| 2362 | 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, |
| 2363 | 146, 147, 148, 149 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2364 | }; |
| 2365 | |
| 2366 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2367 | symbol of state STATE-NUM. */ |
| 2368 | static const unsigned char yystos[] = |
| 2369 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2370 | 0, 198, 199, 201, 0, 31, 34, 42, 43, 44, |
| 2371 | 45, 46, 47, 48, 62, 179, 214, 216, 218, 28, |
| 2372 | 30, 50, 58, 62, 178, 207, 218, 219, 61, 64, |
| 2373 | 65, 66, 67, 68, 69, 70, 180, 212, 29, 225, |
| 2374 | 226, 227, 51, 52, 53, 71, 204, 150, 61, 27, |
| 2375 | 45, 47, 49, 57, 179, 200, 150, 45, 47, 217, |
| 2376 | 30, 202, 18, 3, 4, 5, 6, 7, 8, 9, |
| 2377 | 10, 11, 12, 13, 14, 15, 16, 19, 20, 152, |
| 2378 | 155, 158, 160, 165, 187, 188, 189, 190, 191, 207, |
| 2379 | 222, 32, 160, 213, 33, 161, 215, 226, 72, 73, |
| 2380 | 74, 76, 77, 78, 178, 228, 229, 231, 150, 150, |
| 2381 | 150, 150, 155, 205, 202, 187, 35, 36, 197, 197, |
| 2382 | 197, 197, 212, 18, 18, 18, 160, 3, 161, 191, |
| 2383 | 192, 207, 153, 162, 3, 189, 224, 4, 15, 5, |
| 2384 | 6, 7, 8, 9, 10, 11, 12, 174, 175, 176, |
| 2385 | 38, 59, 60, 75, 79, 80, 81, 82, 83, 84, |
| 2386 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 2387 | 95, 96, 97, 98, 99, 100, 121, 122, 123, 126, |
| 2388 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
| 2389 | 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, |
| 2390 | 147, 148, 149, 167, 168, 169, 172, 173, 235, 236, |
| 2391 | 238, 239, 30, 54, 55, 203, 18, 30, 30, 206, |
| 2392 | 189, 189, 4, 5, 6, 7, 8, 9, 10, 11, |
| 2393 | 12, 13, 14, 174, 175, 177, 189, 194, 189, 156, |
| 2394 | 156, 161, 192, 151, 161, 153, 40, 192, 193, 17, |
| 2395 | 18, 21, 22, 23, 24, 25, 26, 61, 99, 100, |
| 2396 | 126, 128, 134, 135, 136, 158, 167, 168, 169, 172, |
| 2397 | 173, 195, 221, 222, 223, 223, 223, 223, 59, 180, |
| 2398 | 101, 102, 103, 104, 105, 106, 117, 118, 119, 120, |
| 2399 | 170, 25, 26, 107, 108, 109, 110, 111, 112, 113, |
| 2400 | 114, 115, 116, 117, 118, 119, 120, 171, 189, 189, |
| 2401 | 224, 189, 189, 232, 224, 224, 224, 224, 224, 189, |
| 2402 | 189, 189, 224, 224, 180, 124, 125, 151, 157, 151, |
| 2403 | 185, 185, 25, 26, 17, 18, 166, 166, 21, 22, |
| 2404 | 23, 24, 155, 158, 160, 163, 195, 222, 185, 185, |
| 2405 | 191, 191, 159, 161, 191, 40, 189, 209, 210, 211, |
| 2406 | 151, 154, 63, 220, 170, 171, 153, 153, 153, 153, |
| 2407 | 153, 194, 196, 153, 153, 153, 153, 153, 151, 151, |
| 2408 | 187, 189, 189, 151, 182, 151, 182, 223, 155, 151, |
| 2409 | 151, 151, 151, 151, 151, 223, 223, 223, 151, 39, |
| 2410 | 187, 189, 224, 30, 37, 56, 183, 186, 157, 196, |
| 2411 | 196, 161, 196, 30, 157, 159, 159, 207, 208, 151, |
| 2412 | 154, 40, 30, 153, 153, 194, 194, 194, 194, 194, |
| 2413 | 151, 159, 194, 194, 194, 194, 194, 15, 15, 223, |
| 2414 | 223, 223, 10, 56, 10, 151, 237, 223, 155, 224, |
| 2415 | 189, 224, 224, 224, 151, 151, 151, 224, 189, 223, |
| 2416 | 223, 151, 30, 18, 185, 157, 159, 161, 40, 209, |
| 2417 | 183, 184, 151, 194, 194, 237, 151, 151, 151, 151, |
| 2418 | 194, 151, 151, 151, 151, 39, 223, 223, 153, 151, |
| 2419 | 151, 223, 18, 223, 224, 233, 151, 223, 151, 151, |
| 2420 | 151, 223, 223, 223, 153, 189, 56, 181, 30, 151, |
| 2421 | 151, 154, 194, 194, 194, 194, 194, 194, 194, 194, |
| 2422 | 189, 151, 155, 233, 234, 223, 223, 151, 182, 182, |
| 2423 | 151, 223, 151, 224, 224, 224, 234, 223, 18, 194, |
| 2424 | 194, 151, 154, 151, 151, 154, 154, 154, 154, 154, |
| 2425 | 15, 157, 176, 230, 154, 224, 157, 223, 154, 154, |
| 2426 | 154, 194, 194, 194, 223, 221, 157, 176, 39, 157, |
| 2427 | 154, 154, 154, 151, 221, 15, 15, 151, 223, 223, |
| 2428 | 15, 228, 223, 15, 223 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2429 | }; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2430 | |
| 2431 | #define yyerrok (yyerrstatus = 0) |
| 2432 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2433 | #define YYEMPTY (-2) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2434 | #define YYEOF 0 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2435 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2436 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2437 | #define YYABORT goto yyabortlab |
| 2438 | #define YYERROR goto yyerrorlab |
| 2439 | |
| 2440 | |
| 2441 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2442 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2443 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2444 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2445 | #define YYFAIL goto yyerrlab |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2446 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2447 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2448 | |
| 2449 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2450 | do \ |
| 2451 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2452 | { \ |
| 2453 | yychar = (Token); \ |
| 2454 | yylval = (Value); \ |
| 2455 | yytoken = YYTRANSLATE (yychar); \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2456 | YYPOPSTACK; \ |
| 2457 | goto yybackup; \ |
| 2458 | } \ |
| 2459 | else \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2460 | { \ |
| 2461 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2462 | YYERROR; \ |
| 2463 | } \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2464 | while (0) |
| 2465 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2466 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2467 | #define YYTERROR 1 |
| 2468 | #define YYERRCODE 256 |
| 2469 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2470 | |
| 2471 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2472 | If N is 0, then set CURRENT to the empty location which ends |
| 2473 | the previous symbol: RHS[0] (always defined). */ |
| 2474 | |
| 2475 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2476 | #ifndef YYLLOC_DEFAULT |
| 2477 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2478 | do \ |
| 2479 | if (N) \ |
| 2480 | { \ |
| 2481 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2482 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2483 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2484 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2485 | } \ |
| 2486 | else \ |
| 2487 | { \ |
| 2488 | (Current).first_line = (Current).last_line = \ |
| 2489 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2490 | (Current).first_column = (Current).last_column = \ |
| 2491 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2492 | } \ |
| 2493 | while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2494 | #endif |
| 2495 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2496 | |
| 2497 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2498 | This macro was not mandated originally: define only if we know |
| 2499 | we won't break user code: when these are the locations we know. */ |
| 2500 | |
| 2501 | #ifndef YY_LOCATION_PRINT |
| 2502 | # if YYLTYPE_IS_TRIVIAL |
| 2503 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2504 | fprintf (File, "%d.%d-%d.%d", \ |
| 2505 | (Loc).first_line, (Loc).first_column, \ |
| 2506 | (Loc).last_line, (Loc).last_column) |
| 2507 | # else |
| 2508 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2509 | # endif |
| 2510 | #endif |
| 2511 | |
| 2512 | |
| 2513 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2514 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2515 | #ifdef YYLEX_PARAM |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2516 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2517 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2518 | # define YYLEX yylex () |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2519 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2520 | |
| 2521 | /* Enable debugging if requested. */ |
| 2522 | #if YYDEBUG |
| 2523 | |
| 2524 | # ifndef YYFPRINTF |
| 2525 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2526 | # define YYFPRINTF fprintf |
| 2527 | # endif |
| 2528 | |
| 2529 | # define YYDPRINTF(Args) \ |
| 2530 | do { \ |
| 2531 | if (yydebug) \ |
| 2532 | YYFPRINTF Args; \ |
| 2533 | } while (0) |
| 2534 | |
| 2535 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2536 | do { \ |
| 2537 | if (yydebug) \ |
| 2538 | { \ |
| 2539 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2540 | yysymprint (stderr, \ |
| 2541 | Type, Value); \ |
| 2542 | YYFPRINTF (stderr, "\n"); \ |
| 2543 | } \ |
| 2544 | } while (0) |
| 2545 | |
| 2546 | /*------------------------------------------------------------------. |
| 2547 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2548 | | TOP (included). | |
| 2549 | `------------------------------------------------------------------*/ |
| 2550 | |
| 2551 | #if defined (__STDC__) || defined (__cplusplus) |
| 2552 | static void |
| 2553 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2554 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2555 | static void |
| 2556 | yy_stack_print (bottom, top) |
| 2557 | short int *bottom; |
| 2558 | short int *top; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2559 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2560 | { |
| 2561 | YYFPRINTF (stderr, "Stack now"); |
| 2562 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2563 | YYFPRINTF (stderr, " %d", *bottom); |
| 2564 | YYFPRINTF (stderr, "\n"); |
| 2565 | } |
| 2566 | |
| 2567 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2568 | do { \ |
| 2569 | if (yydebug) \ |
| 2570 | yy_stack_print ((Bottom), (Top)); \ |
| 2571 | } while (0) |
| 2572 | |
| 2573 | |
| 2574 | /*------------------------------------------------. |
| 2575 | | Report that the YYRULE is going to be reduced. | |
| 2576 | `------------------------------------------------*/ |
| 2577 | |
| 2578 | #if defined (__STDC__) || defined (__cplusplus) |
| 2579 | static void |
| 2580 | yy_reduce_print (int yyrule) |
| 2581 | #else |
| 2582 | static void |
| 2583 | yy_reduce_print (yyrule) |
| 2584 | int yyrule; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2585 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2586 | { |
| 2587 | int yyi; |
| 2588 | unsigned long int yylno = yyrline[yyrule]; |
| 2589 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2590 | yyrule - 1, yylno); |
| 2591 | /* Print the symbols being reduced, and their result. */ |
| 2592 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2593 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2594 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2595 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2596 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2597 | # define YY_REDUCE_PRINT(Rule) \ |
| 2598 | do { \ |
| 2599 | if (yydebug) \ |
| 2600 | yy_reduce_print (Rule); \ |
| 2601 | } while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2602 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2603 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2604 | multiple parsers can coexist. */ |
| 2605 | int yydebug; |
| 2606 | #else /* !YYDEBUG */ |
| 2607 | # define YYDPRINTF(Args) |
| 2608 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2609 | # define YY_STACK_PRINT(Bottom, Top) |
| 2610 | # define YY_REDUCE_PRINT(Rule) |
| 2611 | #endif /* !YYDEBUG */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2612 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2613 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2614 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2615 | #ifndef YYINITDEPTH |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2616 | # define YYINITDEPTH 200 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2617 | #endif |
| 2618 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2619 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2620 | if the built-in stack extension method is used). |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2621 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2622 | Do not make this value too large; the results are undefined if |
| 2623 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2624 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2625 | |
| 2626 | #ifndef YYMAXDEPTH |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2627 | # define YYMAXDEPTH 10000 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2628 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2629 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2630 | |
| 2631 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2632 | #if YYERROR_VERBOSE |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2633 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2634 | # ifndef yystrlen |
| 2635 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2636 | # define yystrlen strlen |
| 2637 | # else |
| 2638 | /* Return the length of YYSTR. */ |
| 2639 | static YYSIZE_T |
| 2640 | # if defined (__STDC__) || defined (__cplusplus) |
| 2641 | yystrlen (const char *yystr) |
| 2642 | # else |
| 2643 | yystrlen (yystr) |
| 2644 | const char *yystr; |
| 2645 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2646 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2647 | const char *yys = yystr; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2648 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2649 | while (*yys++ != '\0') |
| 2650 | continue; |
| 2651 | |
| 2652 | return yys - yystr - 1; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2653 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2654 | # endif |
| 2655 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2656 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2657 | # ifndef yystpcpy |
| 2658 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2659 | # define yystpcpy stpcpy |
| 2660 | # else |
| 2661 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2662 | YYDEST. */ |
| 2663 | static char * |
| 2664 | # if defined (__STDC__) || defined (__cplusplus) |
| 2665 | yystpcpy (char *yydest, const char *yysrc) |
| 2666 | # else |
| 2667 | yystpcpy (yydest, yysrc) |
| 2668 | char *yydest; |
| 2669 | const char *yysrc; |
| 2670 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2671 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2672 | char *yyd = yydest; |
| 2673 | const char *yys = yysrc; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2674 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2675 | while ((*yyd++ = *yys++) != '\0') |
| 2676 | continue; |
| 2677 | |
| 2678 | return yyd - 1; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2679 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2680 | # endif |
| 2681 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2682 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2683 | # ifndef yytnamerr |
| 2684 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2685 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2686 | heuristic is that double-quoting is unnecessary unless the string |
| 2687 | contains an apostrophe, a comma, or backslash (other than |
| 2688 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2689 | null, do not copy; instead, return the length of what the result |
| 2690 | would have been. */ |
| 2691 | static YYSIZE_T |
| 2692 | yytnamerr (char *yyres, const char *yystr) |
| 2693 | { |
| 2694 | if (*yystr == '"') |
| 2695 | { |
| 2696 | size_t yyn = 0; |
| 2697 | char const *yyp = yystr; |
| 2698 | |
| 2699 | for (;;) |
| 2700 | switch (*++yyp) |
| 2701 | { |
| 2702 | case '\'': |
| 2703 | case ',': |
| 2704 | goto do_not_strip_quotes; |
| 2705 | |
| 2706 | case '\\': |
| 2707 | if (*++yyp != '\\') |
| 2708 | goto do_not_strip_quotes; |
| 2709 | /* Fall through. */ |
| 2710 | default: |
| 2711 | if (yyres) |
| 2712 | yyres[yyn] = *yyp; |
| 2713 | yyn++; |
| 2714 | break; |
| 2715 | |
| 2716 | case '"': |
| 2717 | if (yyres) |
| 2718 | yyres[yyn] = '\0'; |
| 2719 | return yyn; |
| 2720 | } |
| 2721 | do_not_strip_quotes: ; |
| 2722 | } |
| 2723 | |
| 2724 | if (! yyres) |
| 2725 | return yystrlen (yystr); |
| 2726 | |
| 2727 | return yystpcpy (yyres, yystr) - yyres; |
| 2728 | } |
| 2729 | # endif |
| 2730 | |
| 2731 | #endif /* YYERROR_VERBOSE */ |
| 2732 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2733 | |
| 2734 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2735 | #if YYDEBUG |
| 2736 | /*--------------------------------. |
| 2737 | | Print this symbol on YYOUTPUT. | |
| 2738 | `--------------------------------*/ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2739 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2740 | #if defined (__STDC__) || defined (__cplusplus) |
| 2741 | static void |
| 2742 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2743 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2744 | static void |
| 2745 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2746 | FILE *yyoutput; |
| 2747 | int yytype; |
| 2748 | YYSTYPE *yyvaluep; |
| 2749 | #endif |
| 2750 | { |
| 2751 | /* Pacify ``unused variable'' warnings. */ |
| 2752 | (void) yyvaluep; |
| 2753 | |
| 2754 | if (yytype < YYNTOKENS) |
| 2755 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2756 | else |
| 2757 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2758 | |
| 2759 | |
| 2760 | # ifdef YYPRINT |
| 2761 | if (yytype < YYNTOKENS) |
| 2762 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2763 | # endif |
| 2764 | switch (yytype) |
| 2765 | { |
| 2766 | default: |
| 2767 | break; |
| 2768 | } |
| 2769 | YYFPRINTF (yyoutput, ")"); |
| 2770 | } |
| 2771 | |
| 2772 | #endif /* ! YYDEBUG */ |
| 2773 | /*-----------------------------------------------. |
| 2774 | | Release the memory associated to this symbol. | |
| 2775 | `-----------------------------------------------*/ |
| 2776 | |
| 2777 | #if defined (__STDC__) || defined (__cplusplus) |
| 2778 | static void |
| 2779 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2780 | #else |
| 2781 | static void |
| 2782 | yydestruct (yymsg, yytype, yyvaluep) |
| 2783 | const char *yymsg; |
| 2784 | int yytype; |
| 2785 | YYSTYPE *yyvaluep; |
| 2786 | #endif |
| 2787 | { |
| 2788 | /* Pacify ``unused variable'' warnings. */ |
| 2789 | (void) yyvaluep; |
| 2790 | |
| 2791 | if (!yymsg) |
| 2792 | yymsg = "Deleting"; |
| 2793 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2794 | |
| 2795 | switch (yytype) |
| 2796 | { |
| 2797 | |
| 2798 | default: |
| 2799 | break; |
| 2800 | } |
| 2801 | } |
| 2802 | |
| 2803 | |
| 2804 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2805 | |
| 2806 | #ifdef YYPARSE_PARAM |
| 2807 | # if defined (__STDC__) || defined (__cplusplus) |
| 2808 | int yyparse (void *YYPARSE_PARAM); |
| 2809 | # else |
| 2810 | int yyparse (); |
| 2811 | # endif |
| 2812 | #else /* ! YYPARSE_PARAM */ |
| 2813 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2814 | int yyparse (void); |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 2815 | #else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2816 | int yyparse (); |
| 2817 | #endif |
| 2818 | #endif /* ! YYPARSE_PARAM */ |
| 2819 | |
| 2820 | |
| 2821 | |
| 2822 | /* The look-ahead symbol. */ |
| 2823 | int yychar; |
| 2824 | |
| 2825 | /* The semantic value of the look-ahead symbol. */ |
| 2826 | YYSTYPE yylval; |
| 2827 | |
| 2828 | /* Number of syntax errors so far. */ |
| 2829 | int yynerrs; |
| 2830 | |
| 2831 | |
| 2832 | |
| 2833 | /*----------. |
| 2834 | | yyparse. | |
| 2835 | `----------*/ |
| 2836 | |
| 2837 | #ifdef YYPARSE_PARAM |
| 2838 | # if defined (__STDC__) || defined (__cplusplus) |
| 2839 | int yyparse (void *YYPARSE_PARAM) |
| 2840 | # else |
| 2841 | int yyparse (YYPARSE_PARAM) |
| 2842 | void *YYPARSE_PARAM; |
| 2843 | # endif |
| 2844 | #else /* ! YYPARSE_PARAM */ |
| 2845 | #if defined (__STDC__) || defined (__cplusplus) |
| 2846 | int |
| 2847 | yyparse (void) |
| 2848 | #else |
| 2849 | int |
| 2850 | yyparse () |
| 2851 | |
| 2852 | #endif |
| 2853 | #endif |
| 2854 | { |
| 2855 | |
| 2856 | int yystate; |
| 2857 | int yyn; |
| 2858 | int yyresult; |
| 2859 | /* Number of tokens to shift before error messages enabled. */ |
| 2860 | int yyerrstatus; |
| 2861 | /* Look-ahead token as an internal (translated) token number. */ |
| 2862 | int yytoken = 0; |
| 2863 | |
| 2864 | /* Three stacks and their tools: |
| 2865 | `yyss': related to states, |
| 2866 | `yyvs': related to semantic values, |
| 2867 | `yyls': related to locations. |
| 2868 | |
| 2869 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2870 | to reallocate them elsewhere. */ |
| 2871 | |
| 2872 | /* The state stack. */ |
| 2873 | short int yyssa[YYINITDEPTH]; |
| 2874 | short int *yyss = yyssa; |
| 2875 | short int *yyssp; |
| 2876 | |
| 2877 | /* The semantic value stack. */ |
| 2878 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2879 | YYSTYPE *yyvs = yyvsa; |
| 2880 | YYSTYPE *yyvsp; |
| 2881 | |
| 2882 | |
| 2883 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2884 | #define YYPOPSTACK (yyvsp--, yyssp--) |
| 2885 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2886 | YYSIZE_T yystacksize = YYINITDEPTH; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2887 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2888 | /* The variables used to return semantic value and location from the |
| 2889 | action routines. */ |
| 2890 | YYSTYPE yyval; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2891 | |
| 2892 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2893 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2894 | rule. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2895 | int yylen; |
| 2896 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2897 | YYDPRINTF ((stderr, "Starting parse\n")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2898 | |
| 2899 | yystate = 0; |
| 2900 | yyerrstatus = 0; |
| 2901 | yynerrs = 0; |
| 2902 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2903 | |
| 2904 | /* Initialize stack pointers. |
| 2905 | Waste one element of value and location stack |
| 2906 | so that they stay on the same level as the state stack. |
| 2907 | The wasted elements are never initialized. */ |
| 2908 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2909 | yyssp = yyss; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2910 | yyvsp = yyvs; |
| 2911 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2912 | goto yysetstate; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2913 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2914 | /*------------------------------------------------------------. |
| 2915 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2916 | `------------------------------------------------------------*/ |
| 2917 | yynewstate: |
| 2918 | /* In all cases, when you get here, the value and location stacks |
| 2919 | have just been pushed. so pushing a state here evens the stacks. |
| 2920 | */ |
| 2921 | yyssp++; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2922 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2923 | yysetstate: |
| 2924 | *yyssp = yystate; |
| 2925 | |
| 2926 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2927 | { |
| 2928 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2929 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2930 | |
| 2931 | #ifdef yyoverflow |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2932 | { |
| 2933 | /* Give user a chance to reallocate the stack. Use copies of |
| 2934 | these so that the &'s don't force the real ones into |
| 2935 | memory. */ |
| 2936 | YYSTYPE *yyvs1 = yyvs; |
| 2937 | short int *yyss1 = yyss; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2938 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2939 | |
| 2940 | /* Each stack pointer address is followed by the size of the |
| 2941 | data in use in that stack, in bytes. This used to be a |
| 2942 | conditional around just the two extra args, but that might |
| 2943 | be undefined if yyoverflow is a macro. */ |
| 2944 | yyoverflow (YY_("memory exhausted"), |
| 2945 | &yyss1, yysize * sizeof (*yyssp), |
| 2946 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2947 | |
| 2948 | &yystacksize); |
| 2949 | |
| 2950 | yyss = yyss1; |
| 2951 | yyvs = yyvs1; |
| 2952 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2953 | #else /* no yyoverflow */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2954 | # ifndef YYSTACK_RELOCATE |
| 2955 | goto yyexhaustedlab; |
| 2956 | # else |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2957 | /* Extend the stack our own way. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2958 | if (YYMAXDEPTH <= yystacksize) |
| 2959 | goto yyexhaustedlab; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2960 | yystacksize *= 2; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2961 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2962 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2963 | |
| 2964 | { |
| 2965 | short int *yyss1 = yyss; |
| 2966 | union yyalloc *yyptr = |
| 2967 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 2968 | if (! yyptr) |
| 2969 | goto yyexhaustedlab; |
| 2970 | YYSTACK_RELOCATE (yyss); |
| 2971 | YYSTACK_RELOCATE (yyvs); |
| 2972 | |
| 2973 | # undef YYSTACK_RELOCATE |
| 2974 | if (yyss1 != yyssa) |
| 2975 | YYSTACK_FREE (yyss1); |
| 2976 | } |
| 2977 | # endif |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2978 | #endif /* no yyoverflow */ |
| 2979 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2980 | yyssp = yyss + yysize - 1; |
| 2981 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2982 | |
| 2983 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2984 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 2985 | (unsigned long int) yystacksize)); |
| 2986 | |
| 2987 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2988 | YYABORT; |
| 2989 | } |
| 2990 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2991 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2992 | |
| 2993 | goto yybackup; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2994 | |
| 2995 | /*-----------. |
| 2996 | | yybackup. | |
| 2997 | `-----------*/ |
| 2998 | yybackup: |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2999 | |
| 3000 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3001 | /* 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] | 3002 | /* yyresume: */ |
| 3003 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3004 | /* 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] | 3005 | |
| 3006 | yyn = yypact[yystate]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3007 | if (yyn == YYPACT_NINF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3008 | goto yydefault; |
| 3009 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3010 | /* 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] | 3011 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3012 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3013 | if (yychar == YYEMPTY) |
| 3014 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3015 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3016 | yychar = YYLEX; |
| 3017 | } |
| 3018 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3019 | if (yychar <= YYEOF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3020 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3021 | yychar = yytoken = YYEOF; |
| 3022 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3023 | } |
| 3024 | else |
| 3025 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3026 | yytoken = YYTRANSLATE (yychar); |
| 3027 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3028 | } |
| 3029 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3030 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3031 | detect an error, take that action. */ |
| 3032 | yyn += yytoken; |
| 3033 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3034 | goto yydefault; |
| 3035 | yyn = yytable[yyn]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3036 | if (yyn <= 0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3037 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3038 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3039 | goto yyerrlab; |
| 3040 | yyn = -yyn; |
| 3041 | goto yyreduce; |
| 3042 | } |
| 3043 | |
| 3044 | if (yyn == YYFINAL) |
| 3045 | YYACCEPT; |
| 3046 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3047 | /* Shift the look-ahead token. */ |
| 3048 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3049 | |
| 3050 | /* Discard the token being shifted unless it is eof. */ |
| 3051 | if (yychar != YYEOF) |
| 3052 | yychar = YYEMPTY; |
| 3053 | |
| 3054 | *++yyvsp = yylval; |
| 3055 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3056 | |
| 3057 | /* Count tokens shifted since error; after three, turn off error |
| 3058 | status. */ |
| 3059 | if (yyerrstatus) |
| 3060 | yyerrstatus--; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3061 | |
| 3062 | yystate = yyn; |
| 3063 | goto yynewstate; |
| 3064 | |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3065 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3066 | /*-----------------------------------------------------------. |
| 3067 | | yydefault -- do the default action for the current state. | |
| 3068 | `-----------------------------------------------------------*/ |
| 3069 | yydefault: |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3070 | yyn = yydefact[yystate]; |
| 3071 | if (yyn == 0) |
| 3072 | goto yyerrlab; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3073 | goto yyreduce; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3074 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3075 | |
| 3076 | /*-----------------------------. |
| 3077 | | yyreduce -- Do a reduction. | |
| 3078 | `-----------------------------*/ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3079 | yyreduce: |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3080 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3081 | yylen = yyr2[yyn]; |
| 3082 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3083 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3084 | `$$ = $1'. |
| 3085 | |
| 3086 | Otherwise, the following line sets YYVAL to garbage. |
| 3087 | This behavior is undocumented and Bison |
| 3088 | users should not rely upon it. Assigning to YYVAL |
| 3089 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3090 | GCC warning that YYVAL may be used uninitialized. */ |
| 3091 | yyval = yyvsp[1-yylen]; |
| 3092 | |
| 3093 | |
| 3094 | YY_REDUCE_PRINT (yyn); |
| 3095 | switch (yyn) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3096 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3097 | case 81: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3098 | #line 1061 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3099 | { |
| 3100 | (yyval.String) = (yyvsp[-1].String); |
| 3101 | ;} |
| 3102 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3103 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3104 | case 82: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3105 | #line 1064 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3106 | { |
| 3107 | (yyval.String) = new std::string(""); |
| 3108 | ;} |
| 3109 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3110 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3111 | case 90: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3112 | #line 1071 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3113 | { (yyval.String) = new std::string(""); ;} |
| 3114 | break; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3115 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3116 | case 97: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3117 | #line 1076 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3118 | { |
| 3119 | *(yyvsp[-1].String) += *(yyvsp[0].String); |
| 3120 | delete (yyvsp[0].String); |
| 3121 | (yyval.String) = (yyvsp[-1].String); |
| 3122 | ;} |
| 3123 | break; |
Reid Spencer | 16244f4 | 2006-12-01 21:10:07 +0000 | [diff] [blame] | 3124 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3125 | case 98: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3126 | #line 1081 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3127 | { (yyval.String) = new std::string(""); ;} |
| 3128 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3129 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3130 | case 99: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3131 | #line 1086 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3132 | { (yyval.String) = new std::string(); ;} |
| 3133 | break; |
| 3134 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3135 | case 100: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3136 | #line 1087 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3137 | { *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;} |
| 3138 | break; |
| 3139 | |
| 3140 | case 101: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3141 | #line 1090 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3142 | { (yyval.String) = new std::string(); ;} |
| 3143 | break; |
| 3144 | |
| 3145 | case 102: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3146 | #line 1091 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3147 | { |
| 3148 | (yyvsp[-1].String)->insert(0, ", "); |
| 3149 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 3150 | delete (yyvsp[0].String); |
| 3151 | (yyval.String) = (yyvsp[-1].String); |
| 3152 | ;} |
| 3153 | break; |
| 3154 | |
| 3155 | case 103: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3156 | #line 1099 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3157 | { |
| 3158 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 3159 | delete (yyvsp[0].String); |
| 3160 | (yyval.String) = (yyvsp[-1].String); |
| 3161 | ;} |
| 3162 | break; |
| 3163 | |
| 3164 | case 104: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3165 | #line 1105 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3166 | { (yyval.String) = new std::string(); ;} |
| 3167 | break; |
| 3168 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3169 | case 106: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3170 | #line 1109 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3171 | { (yyval.String) = new std::string(); ;} |
| 3172 | break; |
| 3173 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3174 | case 107: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3175 | #line 1110 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3176 | { |
| 3177 | (yyvsp[-1].String)->insert(0, ", "); |
| 3178 | if (!(yyvsp[0].String)->empty()) |
| 3179 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 3180 | delete (yyvsp[0].String); |
| 3181 | (yyval.String) = (yyvsp[-1].String); |
| 3182 | ;} |
| 3183 | break; |
| 3184 | |
| 3185 | case 109: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3186 | #line 1120 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3187 | { |
| 3188 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 3189 | delete (yyvsp[0].String); |
| 3190 | (yyval.String) = (yyvsp[-1].String); |
| 3191 | ;} |
| 3192 | break; |
| 3193 | |
| 3194 | case 127: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3195 | #line 1142 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3196 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3197 | (yyval.Ty) = Type::get(*(yyvsp[0].String), OpaqueTy); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3198 | ;} |
| 3199 | break; |
| 3200 | |
| 3201 | case 128: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3202 | #line 1145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3203 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3204 | (yyval.Ty) = Type::get(*(yyvsp[0].String), UnresolvedTy); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3205 | ;} |
| 3206 | break; |
| 3207 | |
| 3208 | case 129: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3209 | #line 1148 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3210 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3211 | (yyval.Ty) = (yyvsp[0].Ty); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3212 | ;} |
| 3213 | break; |
| 3214 | |
| 3215 | case 130: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3216 | #line 1151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3217 | { // Type UpReference |
| 3218 | (yyvsp[0].String)->insert(0, "\\"); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3219 | (yyval.Ty) = Type::get(*(yyvsp[0].String), UpRefTy); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3220 | ;} |
| 3221 | break; |
| 3222 | |
| 3223 | case 131: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3224 | #line 1155 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3225 | { // Function derived type? |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3226 | std::string newTy( (yyvsp[-3].Ty)->getNewTy() + "("); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3227 | for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3228 | if (i != 0) |
| 3229 | newTy += ", "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3230 | if ((*(yyvsp[-1].TypeVec))[i]->isVoid()) |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3231 | newTy += "..."; |
| 3232 | else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3233 | newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3234 | } |
| 3235 | newTy += ")"; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3236 | (yyval.Ty) = Type::get(newTy, (yyvsp[-3].Ty), (yyvsp[-1].TypeVec)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3237 | ;} |
| 3238 | break; |
| 3239 | |
| 3240 | case 132: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3241 | #line 1168 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3242 | { // Sized array type? |
| 3243 | uint64_t elems = atoi((yyvsp[-3].String)->c_str()); |
| 3244 | (yyvsp[-3].String)->insert(0,"[ "); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3245 | *(yyvsp[-3].String) += " x " + (yyvsp[-1].Ty)->getNewTy() + " ]"; |
| 3246 | (yyval.Ty) = Type::get(*(yyvsp[-3].String), ArrayTy, (yyvsp[-1].Ty), elems); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3247 | ;} |
| 3248 | break; |
| 3249 | |
| 3250 | case 133: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3251 | #line 1174 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3252 | { // Packed array type? |
| 3253 | uint64_t elems = atoi((yyvsp[-3].String)->c_str()); |
| 3254 | (yyvsp[-3].String)->insert(0,"< "); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3255 | *(yyvsp[-3].String) += " x " + (yyvsp[-1].Ty)->getNewTy() + " >"; |
| 3256 | (yyval.Ty) = Type::get(*(yyvsp[-3].String), PackedTy, (yyvsp[-1].Ty), elems); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3257 | ;} |
| 3258 | break; |
| 3259 | |
| 3260 | case 134: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3261 | #line 1180 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3262 | { // Structure type? |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3263 | std::string newTy("{"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3264 | for (unsigned i = 0; i < (yyvsp[-1].TypeVec)->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3265 | if (i != 0) |
| 3266 | newTy += ", "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3267 | newTy += (*(yyvsp[-1].TypeVec))[i]->getNewTy(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3268 | } |
| 3269 | newTy += "}"; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3270 | (yyval.Ty) = Type::get(newTy, StructTy, (yyvsp[-1].TypeVec)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3271 | ;} |
| 3272 | break; |
| 3273 | |
| 3274 | case 135: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3275 | #line 1190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3276 | { // Empty structure type? |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3277 | (yyval.Ty) = Type::get("{}", StructTy, new TypeList()); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3278 | ;} |
| 3279 | break; |
| 3280 | |
| 3281 | case 136: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3282 | #line 1193 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3283 | { // Packed Structure type? |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3284 | std::string newTy("<{"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3285 | for (unsigned i = 0; i < (yyvsp[-2].TypeVec)->size(); ++i) { |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3286 | if (i != 0) |
| 3287 | newTy += ", "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3288 | newTy += (*(yyvsp[-2].TypeVec))[i]->getNewTy(); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3289 | } |
| 3290 | newTy += "}>"; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3291 | (yyval.Ty) = Type::get(newTy, PackedStructTy, (yyvsp[-2].TypeVec)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3292 | ;} |
| 3293 | break; |
| 3294 | |
| 3295 | case 137: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3296 | #line 1203 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3297 | { // Empty packed structure type? |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3298 | (yyval.Ty) = Type::get("<{}>", PackedStructTy, new TypeList()); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3299 | ;} |
| 3300 | break; |
| 3301 | |
| 3302 | case 138: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3303 | #line 1206 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3304 | { // Pointer type? |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3305 | (yyval.Ty) = (yyvsp[-1].Ty)->getPointerType(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3306 | ;} |
| 3307 | break; |
| 3308 | |
| 3309 | case 139: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3310 | #line 1214 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3311 | { |
| 3312 | (yyval.TypeVec) = new TypeList(); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3313 | (yyval.TypeVec)->push_back((yyvsp[0].Ty)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3314 | ;} |
| 3315 | break; |
| 3316 | |
| 3317 | case 140: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3318 | #line 1218 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3319 | { |
| 3320 | (yyval.TypeVec) = (yyvsp[-2].TypeVec); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3321 | (yyval.TypeVec)->push_back((yyvsp[0].Ty)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3322 | ;} |
| 3323 | break; |
| 3324 | |
| 3325 | case 142: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3326 | #line 1226 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3327 | { |
| 3328 | (yyval.TypeVec) = (yyvsp[-2].TypeVec); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3329 | (yyval.TypeVec)->push_back(Type::get("void",VoidTy)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3330 | delete (yyvsp[0].String); |
| 3331 | ;} |
| 3332 | break; |
| 3333 | |
| 3334 | case 143: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3335 | #line 1231 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3336 | { |
| 3337 | (yyval.TypeVec) = new TypeList(); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3338 | (yyval.TypeVec)->push_back(Type::get("void",VoidTy)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3339 | delete (yyvsp[0].String); |
| 3340 | ;} |
| 3341 | break; |
| 3342 | |
| 3343 | case 144: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3344 | #line 1236 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3345 | { |
| 3346 | (yyval.TypeVec) = new TypeList(); |
| 3347 | ;} |
| 3348 | break; |
| 3349 | |
| 3350 | case 145: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3351 | #line 1246 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3352 | { // Nonempty unsized arr |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3353 | (yyval.Const) = new Constant; |
| 3354 | (yyval.Const)->type = (yyvsp[-3].Ty); |
| 3355 | (yyval.Const)->cnst = new std::string((yyvsp[-3].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3356 | *(yyval.Const)->cnst += " [ " + *(yyvsp[-1].String) + " ]"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3357 | delete (yyvsp[-1].String); |
| 3358 | ;} |
| 3359 | break; |
| 3360 | |
| 3361 | case 146: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3362 | #line 1253 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3363 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3364 | (yyval.Const) = new Constant; |
| 3365 | (yyval.Const)->type = (yyvsp[-2].Ty); |
| 3366 | (yyval.Const)->cnst = new std::string((yyvsp[-2].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3367 | *(yyval.Const)->cnst += "[ ]"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3368 | ;} |
| 3369 | break; |
| 3370 | |
| 3371 | case 147: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3372 | #line 1259 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3373 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3374 | (yyval.Const) = new Constant; |
| 3375 | (yyval.Const)->type = (yyvsp[-2].Ty); |
| 3376 | (yyval.Const)->cnst = new std::string((yyvsp[-2].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3377 | *(yyval.Const)->cnst += " c" + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3378 | delete (yyvsp[0].String); |
| 3379 | ;} |
| 3380 | break; |
| 3381 | |
| 3382 | case 148: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3383 | #line 1266 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3384 | { // Nonempty unsized arr |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3385 | (yyval.Const) = new Constant; |
| 3386 | (yyval.Const)->type = (yyvsp[-3].Ty); |
| 3387 | (yyval.Const)->cnst = new std::string((yyvsp[-3].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3388 | *(yyval.Const)->cnst += " < " + *(yyvsp[-1].String) + " >"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3389 | delete (yyvsp[-1].String); |
| 3390 | ;} |
| 3391 | break; |
| 3392 | |
| 3393 | case 149: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3394 | #line 1273 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3395 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3396 | (yyval.Const) = new Constant; |
| 3397 | (yyval.Const)->type = (yyvsp[-3].Ty); |
| 3398 | (yyval.Const)->cnst = new std::string((yyvsp[-3].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3399 | *(yyval.Const)->cnst += " { " + *(yyvsp[-1].String) + " }"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3400 | delete (yyvsp[-1].String); |
| 3401 | ;} |
| 3402 | break; |
| 3403 | |
| 3404 | case 150: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3405 | #line 1280 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3406 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3407 | (yyval.Const) = new Constant; |
| 3408 | (yyval.Const)->type = (yyvsp[-2].Ty); |
| 3409 | (yyval.Const)->cnst = new std::string((yyvsp[-2].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3410 | *(yyval.Const)->cnst += " {}"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3411 | ;} |
| 3412 | break; |
| 3413 | |
| 3414 | case 151: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3415 | #line 1286 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3416 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3417 | (yyval.Const) = new Constant; |
| 3418 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3419 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3420 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3421 | delete (yyvsp[0].String); |
| 3422 | ;} |
| 3423 | break; |
| 3424 | |
| 3425 | case 152: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3426 | #line 1293 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3427 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3428 | (yyval.Const) = new Constant; |
| 3429 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3430 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3431 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3432 | delete (yyvsp[0].String); |
| 3433 | ;} |
| 3434 | break; |
| 3435 | |
| 3436 | case 153: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3437 | #line 1300 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3438 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3439 | (yyval.Const) = new Constant; |
| 3440 | std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Ty)->resolve(), true); |
| 3441 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3442 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3443 | *(yyval.Const)->cnst += " " + Name; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3444 | delete (yyvsp[0].String); |
| 3445 | ;} |
| 3446 | break; |
| 3447 | |
| 3448 | case 154: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3449 | #line 1308 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3450 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3451 | (yyval.Const) = new Constant; |
| 3452 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3453 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3454 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3455 | delete (yyvsp[0].String); |
| 3456 | ;} |
| 3457 | break; |
| 3458 | |
| 3459 | case 155: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3460 | #line 1315 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3461 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3462 | (yyval.Const) = new Constant; |
| 3463 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3464 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3465 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3466 | delete (yyvsp[0].String); |
| 3467 | ;} |
| 3468 | break; |
| 3469 | |
| 3470 | case 156: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3471 | #line 1322 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3472 | { // integral constants |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3473 | (yyval.Const) = new Constant; |
| 3474 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3475 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3476 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3477 | delete (yyvsp[0].String); |
| 3478 | ;} |
| 3479 | break; |
| 3480 | |
| 3481 | case 157: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3482 | #line 1329 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3483 | { // integral constants |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3484 | (yyval.Const) = new Constant; |
| 3485 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3486 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3487 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3488 | delete (yyvsp[0].String); |
| 3489 | ;} |
| 3490 | break; |
| 3491 | |
| 3492 | case 158: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3493 | #line 1336 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3494 | { // Boolean constants |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3495 | (yyval.Const) = new Constant; |
| 3496 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3497 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3498 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3499 | delete (yyvsp[0].String); |
| 3500 | ;} |
| 3501 | break; |
| 3502 | |
| 3503 | case 159: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3504 | #line 1343 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3505 | { // Boolean constants |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3506 | (yyval.Const) = new Constant; |
| 3507 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3508 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3509 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3510 | delete (yyvsp[0].String); |
| 3511 | ;} |
| 3512 | break; |
| 3513 | |
| 3514 | case 160: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3515 | #line 1350 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3516 | { // Float & Double constants |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3517 | (yyval.Const) = new Constant; |
| 3518 | (yyval.Const)->type = (yyvsp[-1].Ty); |
| 3519 | (yyval.Const)->cnst = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3520 | *(yyval.Const)->cnst += " " + *(yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3521 | delete (yyvsp[0].String); |
| 3522 | ;} |
| 3523 | break; |
| 3524 | |
| 3525 | case 161: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3526 | #line 1358 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3527 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3528 | std::string source = *(yyvsp[-3].Const)->cnst; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3529 | const Type* SrcTy = (yyvsp[-3].Const)->type->resolve(); |
| 3530 | const Type* DstTy = (yyvsp[-1].Ty)->resolve(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3531 | if (*(yyvsp[-5].String) == "cast") { |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 3532 | // Call getCastUpgrade to upgrade the old cast |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3533 | (yyval.String) = new std::string(getCastUpgrade(source, SrcTy, DstTy, true)); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 3534 | } else { |
| 3535 | // Nothing to upgrade, just create the cast constant expr |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3536 | (yyval.String) = new std::string(*(yyvsp[-5].String)); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3537 | *(yyval.String) += "( " + source + " to " + (yyvsp[-1].Ty)->getNewTy() + ")"; |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 3538 | } |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3539 | delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-2].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3540 | ;} |
| 3541 | break; |
| 3542 | |
| 3543 | case 162: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3544 | #line 1372 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3545 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3546 | *(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const)->cnst; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3547 | for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3548 | Value* V = (*(yyvsp[-1].ValList))[i]; |
| 3549 | *(yyvsp[-4].String) += ", " + *V->val; |
| 3550 | delete V; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 3551 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3552 | *(yyvsp[-4].String) += ")"; |
| 3553 | (yyval.String) = (yyvsp[-4].String); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3554 | delete (yyvsp[-2].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3555 | delete (yyvsp[-1].ValList); |
| 3556 | ;} |
| 3557 | break; |
| 3558 | |
| 3559 | case 163: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3560 | #line 1384 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3561 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3562 | *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3563 | delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3564 | (yyval.String) = (yyvsp[-7].String); |
| 3565 | ;} |
| 3566 | break; |
| 3567 | |
| 3568 | case 164: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3569 | #line 1389 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3570 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3571 | const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const)->type); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3572 | (yyval.String) = new std::string(op); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3573 | *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3574 | delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3575 | ;} |
| 3576 | break; |
| 3577 | |
| 3578 | case 165: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3579 | #line 1395 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3580 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3581 | *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3582 | delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3583 | (yyval.String) = (yyvsp[-5].String); |
| 3584 | ;} |
| 3585 | break; |
| 3586 | |
| 3587 | case 166: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3588 | #line 1400 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3589 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3590 | *(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const)->type); |
| 3591 | *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3592 | delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3593 | (yyval.String) = (yyvsp[-5].String); |
| 3594 | ;} |
| 3595 | break; |
| 3596 | |
| 3597 | case 167: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3598 | #line 1406 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3599 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3600 | *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3601 | delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3602 | (yyval.String) = (yyvsp[-6].String); |
| 3603 | ;} |
| 3604 | break; |
| 3605 | |
| 3606 | case 168: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3607 | #line 1411 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3608 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3609 | *(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " (" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3610 | delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3611 | (yyval.String) = (yyvsp[-6].String); |
| 3612 | ;} |
| 3613 | break; |
| 3614 | |
| 3615 | case 169: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3616 | #line 1416 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3617 | { |
| 3618 | const char* shiftop = (yyvsp[-5].String)->c_str(); |
| 3619 | if (*(yyvsp[-5].String) == "shr") |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3620 | shiftop = ((yyvsp[-3].Const)->type->isUnsigned()) ? "lshr" : "ashr"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3621 | (yyval.String) = new std::string(shiftop); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3622 | *(yyval.String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3623 | delete (yyvsp[-5].String); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3624 | ;} |
| 3625 | break; |
| 3626 | |
| 3627 | case 170: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3628 | #line 1424 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3629 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3630 | *(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3631 | delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3632 | (yyval.String) = (yyvsp[-5].String); |
| 3633 | ;} |
| 3634 | break; |
| 3635 | |
| 3636 | case 171: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3637 | #line 1429 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3638 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3639 | *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3640 | delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3641 | (yyval.String) = (yyvsp[-7].String); |
| 3642 | ;} |
| 3643 | break; |
| 3644 | |
| 3645 | case 172: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3646 | #line 1434 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3647 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3648 | *(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const)->cnst + "," + *(yyvsp[-3].Const)->cnst + "," + *(yyvsp[-1].Const)->cnst + ")"; |
| 3649 | delete (yyvsp[-5].Const); delete (yyvsp[-3].Const); delete (yyvsp[-1].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3650 | (yyval.String) = (yyvsp[-7].String); |
| 3651 | ;} |
| 3652 | break; |
| 3653 | |
| 3654 | case 173: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3655 | #line 1444 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3656 | { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3657 | *(yyvsp[-2].String) += ", " + *(yyvsp[0].Const)->cnst; |
| 3658 | delete (yyvsp[0].Const); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3659 | (yyval.String) = (yyvsp[-2].String); |
| 3660 | ;} |
| 3661 | break; |
| 3662 | |
| 3663 | case 174: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3664 | #line 1449 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3665 | { (yyval.String) = new std::string(*(yyvsp[0].Const)->cnst); delete (yyvsp[0].Const); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3666 | break; |
| 3667 | |
| 3668 | case 177: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3669 | #line 1464 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3670 | { |
| 3671 | ;} |
| 3672 | break; |
| 3673 | |
| 3674 | case 178: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3675 | #line 1469 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3676 | { |
| 3677 | (yyval.String) = 0; |
| 3678 | ;} |
| 3679 | break; |
| 3680 | |
| 3681 | case 179: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3682 | #line 1472 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3683 | { |
| 3684 | *O << *(yyvsp[0].String) << '\n'; |
| 3685 | delete (yyvsp[0].String); |
| 3686 | (yyval.String) = 0; |
| 3687 | ;} |
| 3688 | break; |
| 3689 | |
| 3690 | case 180: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3691 | #line 1477 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3692 | { |
| 3693 | *O << "module asm " << ' ' << *(yyvsp[0].String) << '\n'; |
| 3694 | (yyval.String) = 0; |
| 3695 | ;} |
| 3696 | break; |
| 3697 | |
| 3698 | case 181: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3699 | #line 1481 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3700 | { |
Reid Spencer | d154b57 | 2006-12-01 20:36:40 +0000 | [diff] [blame] | 3701 | *O << "implementation\n"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3702 | (yyval.String) = 0; |
| 3703 | ;} |
| 3704 | break; |
| 3705 | |
| 3706 | case 182: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3707 | #line 1485 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3708 | { (yyval.String) = 0; ;} |
| 3709 | break; |
| 3710 | |
| 3711 | case 184: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3712 | #line 1487 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3713 | { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;} |
| 3714 | break; |
| 3715 | |
| 3716 | case 185: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3717 | #line 1490 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3718 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3719 | Type::EnumeratedTypes.push_back((yyvsp[0].Ty)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3720 | if (!(yyvsp[-2].String)->empty()) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3721 | Type::NamedTypes[*(yyvsp[-2].String)] = (yyvsp[0].Ty); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3722 | *O << *(yyvsp[-2].String) << " = "; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 3723 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3724 | *O << "type " << (yyvsp[0].Ty)->getNewTy() << '\n'; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3725 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); |
| 3726 | (yyval.String) = 0; |
| 3727 | ;} |
| 3728 | break; |
| 3729 | |
| 3730 | case 186: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3731 | #line 1500 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3732 | { // Function prototypes can be in const pool |
| 3733 | *O << *(yyvsp[0].String) << '\n'; |
| 3734 | delete (yyvsp[0].String); |
| 3735 | (yyval.String) = 0; |
| 3736 | ;} |
| 3737 | break; |
| 3738 | |
| 3739 | case 187: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3740 | #line 1505 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3741 | { // Asm blocks can be in the const pool |
| 3742 | *O << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n'; |
| 3743 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 3744 | (yyval.String) = 0; |
| 3745 | ;} |
| 3746 | break; |
| 3747 | |
| 3748 | case 188: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3749 | #line 1510 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3750 | { |
| 3751 | if (!(yyvsp[-4].String)->empty()) { |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3752 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String), (yyvsp[-1].Const)->type->getPointerType(), |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3753 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3754 | *O << Name << " = "; |
Reid Spencer | f12ee42 | 2006-12-05 19:21:25 +0000 | [diff] [blame] | 3755 | } |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 3756 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << *(yyvsp[-1].Const)->cnst << ' ' << *(yyvsp[0].String) << '\n'; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3757 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3758 | (yyval.String) = 0; |
| 3759 | ;} |
| 3760 | break; |
| 3761 | |
| 3762 | case 189: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3763 | #line 1520 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3764 | { |
| 3765 | if (!(yyvsp[-4].String)->empty()) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3766 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Ty)->getPointerType(), |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3767 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3768 | *O << Name << " = "; |
Reid Spencer | f12ee42 | 2006-12-05 19:21:25 +0000 | [diff] [blame] | 3769 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3770 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n'; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3771 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3772 | (yyval.String) = 0; |
| 3773 | ;} |
| 3774 | break; |
| 3775 | |
| 3776 | case 190: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3777 | #line 1530 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3778 | { |
| 3779 | if (!(yyvsp[-4].String)->empty()) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3780 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Ty)->getPointerType(), |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3781 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3782 | *O << Name << " = "; |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3783 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3784 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n'; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3785 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3786 | (yyval.String) = 0; |
| 3787 | ;} |
| 3788 | break; |
| 3789 | |
| 3790 | case 191: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3791 | #line 1540 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3792 | { |
| 3793 | if (!(yyvsp[-4].String)->empty()) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3794 | std::string Name = getGlobalName((yyvsp[-4].String),*(yyvsp[-3].String),(yyvsp[-1].Ty)->getPointerType(), |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3795 | *(yyvsp[-2].String) == "constant"); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3796 | *O << Name << " = "; |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 3797 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3798 | *O << *(yyvsp[-3].String) << ' ' << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].String) << '\n'; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3799 | delete (yyvsp[-4].String); delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3800 | (yyval.String) = 0; |
| 3801 | ;} |
| 3802 | break; |
| 3803 | |
| 3804 | case 192: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3805 | #line 1550 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3806 | { |
| 3807 | *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n'; |
| 3808 | delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 3809 | (yyval.String) = 0; |
| 3810 | ;} |
| 3811 | break; |
| 3812 | |
| 3813 | case 193: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3814 | #line 1555 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3815 | { |
| 3816 | *O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << '\n'; |
| 3817 | delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 3818 | (yyval.String) = 0; |
| 3819 | ;} |
| 3820 | break; |
| 3821 | |
| 3822 | case 194: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3823 | #line 1560 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3824 | { |
| 3825 | (yyval.String) = 0; |
| 3826 | ;} |
| 3827 | break; |
| 3828 | |
| 3829 | case 198: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3830 | #line 1570 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3831 | { |
| 3832 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3833 | delete (yyvsp[0].String); |
| 3834 | (yyval.String) = (yyvsp[-2].String); |
| 3835 | ;} |
| 3836 | break; |
| 3837 | |
| 3838 | case 199: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3839 | #line 1575 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3840 | { |
| 3841 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3842 | if (*(yyvsp[0].String) == "64") |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3843 | SizeOfPointer = 64; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3844 | delete (yyvsp[0].String); |
| 3845 | (yyval.String) = (yyvsp[-2].String); |
| 3846 | ;} |
| 3847 | break; |
| 3848 | |
| 3849 | case 200: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3850 | #line 1582 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3851 | { |
| 3852 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3853 | delete (yyvsp[0].String); |
| 3854 | (yyval.String) = (yyvsp[-2].String); |
| 3855 | ;} |
| 3856 | break; |
| 3857 | |
| 3858 | case 201: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3859 | #line 1587 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3860 | { |
| 3861 | *(yyvsp[-2].String) += " = " + *(yyvsp[0].String); |
| 3862 | delete (yyvsp[0].String); |
| 3863 | (yyval.String) = (yyvsp[-2].String); |
| 3864 | ;} |
| 3865 | break; |
| 3866 | |
| 3867 | case 202: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3868 | #line 1594 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3869 | { |
| 3870 | (yyvsp[-1].String)->insert(0, "[ "); |
| 3871 | *(yyvsp[-1].String) += " ]"; |
| 3872 | (yyval.String) = (yyvsp[-1].String); |
| 3873 | ;} |
| 3874 | break; |
| 3875 | |
| 3876 | case 203: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3877 | #line 1601 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3878 | { |
| 3879 | *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); |
| 3880 | delete (yyvsp[0].String); |
| 3881 | (yyval.String) = (yyvsp[-2].String); |
| 3882 | ;} |
| 3883 | break; |
| 3884 | |
| 3885 | case 205: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3886 | #line 1607 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3887 | { |
| 3888 | (yyval.String) = new std::string(); |
| 3889 | ;} |
| 3890 | break; |
| 3891 | |
| 3892 | case 209: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3893 | #line 1616 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3894 | { (yyval.String) = new std::string(); ;} |
| 3895 | break; |
| 3896 | |
| 3897 | case 210: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3898 | #line 1618 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3899 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3900 | (yyval.String) = new std::string((yyvsp[-1].Ty)->getNewTy()); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3901 | if (!(yyvsp[0].String)->empty()) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3902 | std::string Name = getUniqueName((yyvsp[0].String), (yyvsp[-1].Ty)->resolve()); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3903 | *(yyval.String) += " " + Name; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3904 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3905 | delete (yyvsp[0].String); |
| 3906 | ;} |
| 3907 | break; |
| 3908 | |
| 3909 | case 211: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3910 | #line 1627 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3911 | { |
| 3912 | *(yyvsp[-2].String) += ", " + *(yyvsp[0].String); |
| 3913 | delete (yyvsp[0].String); |
| 3914 | ;} |
| 3915 | break; |
| 3916 | |
| 3917 | case 212: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3918 | #line 1631 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3919 | { |
| 3920 | (yyval.String) = (yyvsp[0].String); |
| 3921 | ;} |
| 3922 | break; |
| 3923 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3924 | case 213: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3925 | #line 1635 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3926 | { |
| 3927 | (yyval.String) = (yyvsp[0].String); |
| 3928 | ;} |
| 3929 | break; |
| 3930 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3931 | case 214: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3932 | #line 1638 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3933 | { |
| 3934 | *(yyvsp[-2].String) += ", ..."; |
| 3935 | (yyval.String) = (yyvsp[-2].String); |
| 3936 | delete (yyvsp[0].String); |
| 3937 | ;} |
| 3938 | break; |
| 3939 | |
| 3940 | case 215: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3941 | #line 1643 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3942 | { |
| 3943 | (yyval.String) = (yyvsp[0].String); |
| 3944 | ;} |
| 3945 | break; |
| 3946 | |
| 3947 | case 216: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3948 | #line 1646 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3949 | { (yyval.String) = new std::string(); ;} |
| 3950 | break; |
| 3951 | |
| 3952 | case 217: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3953 | #line 1649 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3954 | { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3955 | if (*(yyvsp[-5].String) == "%llvm.va_start" || *(yyvsp[-5].String) == "%llvm.va_end") { |
Reid Spencer | f0c9a65 | 2007-01-13 00:13:49 +0000 | [diff] [blame] | 3956 | *(yyvsp[-3].String) = "i8*"; |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3957 | } else if (*(yyvsp[-5].String) == "%llvm.va_copy") { |
| 3958 | *(yyvsp[-3].String) = "i8*, i8*"; |
| 3959 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3960 | if (!(yyvsp[-7].String)->empty()) { |
| 3961 | *(yyvsp[-7].String) += " "; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3962 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3963 | *(yyvsp[-7].String) += (yyvsp[-6].Ty)->getNewTy() + " " + *(yyvsp[-5].String) + "(" + *(yyvsp[-3].String) + ")"; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3964 | if (!(yyvsp[-1].String)->empty()) { |
| 3965 | *(yyvsp[-7].String) += " " + *(yyvsp[-1].String); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3966 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3967 | if (!(yyvsp[0].String)->empty()) { |
| 3968 | *(yyvsp[-7].String) += " " + *(yyvsp[0].String); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3969 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3970 | delete (yyvsp[-5].String); |
| 3971 | delete (yyvsp[-3].String); |
| 3972 | delete (yyvsp[-1].String); |
| 3973 | delete (yyvsp[0].String); |
| 3974 | (yyval.String) = (yyvsp[-7].String); |
| 3975 | ;} |
| 3976 | break; |
| 3977 | |
| 3978 | case 218: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3979 | #line 1672 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3980 | { (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;} |
| 3981 | break; |
| 3982 | |
| 3983 | case 219: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3984 | #line 1673 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3985 | { (yyval.String) = new std::string ("{"); ;} |
| 3986 | break; |
| 3987 | |
| 3988 | case 220: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 3989 | #line 1676 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3990 | { |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3991 | *O << "define "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3992 | if (!(yyvsp[-2].String)->empty()) { |
| 3993 | *O << *(yyvsp[-2].String) << ' '; |
Reid Spencer | 6fd36ab | 2006-12-29 20:35:03 +0000 | [diff] [blame] | 3994 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3995 | *O << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].String) << '\n'; |
| 3996 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 3997 | (yyval.String) = 0; |
| 3998 | ;} |
| 3999 | break; |
| 4000 | |
| 4001 | case 221: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4002 | #line 1687 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4003 | { (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;} |
| 4004 | break; |
| 4005 | |
| 4006 | case 222: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4007 | #line 1688 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4008 | { (yyval.String) = new std::string("}"); ;} |
| 4009 | break; |
| 4010 | |
| 4011 | case 223: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4012 | #line 1690 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4013 | { |
| 4014 | if ((yyvsp[-1].String)) |
| 4015 | *O << *(yyvsp[-1].String); |
| 4016 | *O << *(yyvsp[0].String) << "\n\n"; |
| 4017 | delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String); |
| 4018 | (yyval.String) = 0; |
| 4019 | ;} |
| 4020 | break; |
| 4021 | |
| 4022 | case 224: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4023 | #line 1699 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4024 | { (yyval.String) = new std::string(); ;} |
| 4025 | break; |
| 4026 | |
| 4027 | case 227: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4028 | #line 1705 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4029 | { isDeclare = true; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4030 | break; |
| 4031 | |
| 4032 | case 228: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4033 | #line 1705 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4034 | { |
| 4035 | if (!(yyvsp[-1].String)->empty()) |
| 4036 | *(yyvsp[-3].String) += " " + *(yyvsp[-1].String); |
| 4037 | *(yyvsp[-3].String) += " " + *(yyvsp[0].String); |
| 4038 | delete (yyvsp[-1].String); |
| 4039 | delete (yyvsp[0].String); |
| 4040 | (yyval.String) = (yyvsp[-3].String); |
| 4041 | isDeclare = false; |
| 4042 | ;} |
| 4043 | break; |
| 4044 | |
| 4045 | case 229: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4046 | #line 1719 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4047 | { (yyval.String) = new std::string(); ;} |
| 4048 | break; |
| 4049 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4050 | case 239: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4051 | #line 1725 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4052 | { |
| 4053 | (yyvsp[-1].String)->insert(0, "<"); |
| 4054 | *(yyvsp[-1].String) += ">"; |
| 4055 | (yyval.String) = (yyvsp[-1].String); |
| 4056 | ;} |
| 4057 | break; |
| 4058 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4059 | case 241: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4060 | #line 1731 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4061 | { |
| 4062 | if (!(yyvsp[-3].String)->empty()) { |
| 4063 | *(yyvsp[-4].String) += " " + *(yyvsp[-3].String); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 4064 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4065 | *(yyvsp[-4].String) += " " + *(yyvsp[-2].String) + ", " + *(yyvsp[0].String); |
| 4066 | delete (yyvsp[-3].String); delete (yyvsp[-2].String); delete (yyvsp[0].String); |
| 4067 | (yyval.String) = (yyvsp[-4].String); |
| 4068 | ;} |
| 4069 | break; |
| 4070 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4071 | case 244: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4072 | #line 1744 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4073 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4074 | (yyval.Val) = new Value; |
| 4075 | (yyval.Val)->val = (yyvsp[0].String); |
| 4076 | (yyval.Val)->constant = false; |
| 4077 | (yyval.Val)->type = 0; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4078 | ;} |
| 4079 | break; |
| 4080 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4081 | case 245: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4082 | #line 1750 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4083 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4084 | (yyval.Val) = new Value; |
| 4085 | (yyval.Val)->val = (yyvsp[0].String); |
| 4086 | (yyval.Val)->constant = true; |
| 4087 | (yyval.Val)->type = 0; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4088 | ;} |
| 4089 | break; |
| 4090 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4091 | case 246: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4092 | #line 1761 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4093 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4094 | (yyvsp[-1].Ty) = (yyvsp[-1].Ty)->resolve(); |
| 4095 | std::string Name = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-1].Ty)); |
| 4096 | (yyval.Val) = (yyvsp[0].Val); |
| 4097 | delete (yyval.Val)->val; |
| 4098 | (yyval.Val)->val = new std::string((yyvsp[-1].Ty)->getNewTy() + " " + Name); |
| 4099 | (yyval.Val)->type = (yyvsp[-1].Ty); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4100 | ;} |
| 4101 | break; |
| 4102 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4103 | case 247: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4104 | #line 1770 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4105 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4106 | (yyval.String) = 0; |
| 4107 | ;} |
| 4108 | break; |
| 4109 | |
| 4110 | case 248: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4111 | #line 1773 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4112 | { // Do not allow functions with 0 basic blocks |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4113 | (yyval.String) = 0; |
| 4114 | ;} |
| 4115 | break; |
| 4116 | |
| 4117 | case 249: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4118 | #line 1781 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4119 | { |
| 4120 | (yyval.String) = 0; |
| 4121 | ;} |
| 4122 | break; |
| 4123 | |
| 4124 | case 250: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4125 | #line 1785 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4126 | { |
| 4127 | *O << " " << *(yyvsp[0].String) << '\n'; |
| 4128 | delete (yyvsp[0].String); |
| 4129 | (yyval.String) = 0; |
| 4130 | ;} |
| 4131 | break; |
| 4132 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4133 | case 251: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4134 | #line 1790 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4135 | { |
| 4136 | (yyval.String) = 0; |
| 4137 | ;} |
| 4138 | break; |
| 4139 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4140 | case 252: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4141 | #line 1793 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4142 | { |
| 4143 | *O << *(yyvsp[0].String) << '\n'; |
| 4144 | delete (yyvsp[0].String); |
| 4145 | (yyval.String) = 0; |
| 4146 | ;} |
| 4147 | break; |
| 4148 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4149 | case 254: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4150 | #line 1799 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4151 | { (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;} |
| 4152 | break; |
| 4153 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4154 | case 255: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4155 | #line 1801 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4156 | { // Return with a result... |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4157 | *O << " " << *(yyvsp[-1].String) << ' ' << *(yyvsp[0].Val)->val << '\n'; |
| 4158 | delete (yyvsp[-1].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4159 | (yyval.String) = 0; |
| 4160 | ;} |
| 4161 | break; |
| 4162 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4163 | case 256: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4164 | #line 1806 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4165 | { // Return with no result... |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4166 | *O << " " << *(yyvsp[-1].String) << ' ' << (yyvsp[0].Ty)->getNewTy() << '\n'; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4167 | delete (yyvsp[-1].String); |
| 4168 | (yyval.String) = 0; |
| 4169 | ;} |
| 4170 | break; |
| 4171 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4172 | case 257: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4173 | #line 1811 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4174 | { // Unconditional Branch... |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4175 | *O << " " << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].Val)->val << '\n'; |
| 4176 | delete (yyvsp[-2].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4177 | (yyval.String) = 0; |
| 4178 | ;} |
| 4179 | break; |
| 4180 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4181 | case 258: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4182 | #line 1816 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4183 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4184 | std::string Name = getUniqueName((yyvsp[-6].Val)->val, (yyvsp[-7].Ty)); |
| 4185 | *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Ty)->getNewTy() << ' ' << Name << ", " |
| 4186 | << (yyvsp[-4].Ty)->getNewTy() << ' ' << *(yyvsp[-3].Val)->val << ", " << (yyvsp[-1].Ty)->getNewTy() << ' ' |
| 4187 | << *(yyvsp[0].Val)->val << '\n'; |
| 4188 | delete (yyvsp[-8].String); delete (yyvsp[-6].Val); delete (yyvsp[-3].Val); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4189 | (yyval.String) = 0; |
| 4190 | ;} |
| 4191 | break; |
| 4192 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4193 | case 259: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4194 | #line 1824 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4195 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4196 | std::string Name = getUniqueName((yyvsp[-6].Val)->val, (yyvsp[-7].Ty)); |
| 4197 | *O << " " << *(yyvsp[-8].String) << ' ' << (yyvsp[-7].Ty)->getNewTy() << ' ' << Name << ", " |
| 4198 | << (yyvsp[-4].Ty)->getNewTy() << ' ' << *(yyvsp[-3].Val)->val << " [" << *(yyvsp[-1].String) << " ]\n"; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4199 | delete (yyvsp[-8].String); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4200 | delete (yyvsp[-6].Val); |
| 4201 | delete (yyvsp[-3].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4202 | delete (yyvsp[-1].String); |
| 4203 | (yyval.String) = 0; |
| 4204 | ;} |
| 4205 | break; |
| 4206 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4207 | case 260: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4208 | #line 1834 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4209 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4210 | std::string Name = getUniqueName((yyvsp[-5].Val)->val, (yyvsp[-6].Ty)); |
| 4211 | *O << " " << *(yyvsp[-7].String) << ' ' << (yyvsp[-6].Ty)->getNewTy() << ' ' << Name << ", " |
| 4212 | << (yyvsp[-3].Ty)->getNewTy() << ' ' << *(yyvsp[-2].Val)->val << "[]\n"; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4213 | delete (yyvsp[-7].String); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4214 | delete (yyvsp[-5].Val); |
| 4215 | delete (yyvsp[-2].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4216 | (yyval.String) = 0; |
| 4217 | ;} |
| 4218 | break; |
| 4219 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4220 | case 261: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4221 | #line 1844 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4222 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4223 | const Type* ResTy = getFunctionReturnType((yyvsp[-10].Ty)); |
Reid Spencer | 16244f4 | 2006-12-01 21:10:07 +0000 | [diff] [blame] | 4224 | *O << " "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4225 | if (!(yyvsp[-13].String)->empty()) { |
| 4226 | std::string Name = getUniqueName((yyvsp[-13].String), ResTy); |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 4227 | *O << Name << " = "; |
| 4228 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4229 | *O << *(yyvsp[-12].String) << ' ' << *(yyvsp[-11].String) << ' ' << (yyvsp[-10].Ty)->getNewTy() << ' ' << *(yyvsp[-9].Val)->val << " ("; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4230 | for (unsigned i = 0; i < (yyvsp[-7].ValList)->size(); ++i) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4231 | Value* V = (*(yyvsp[-7].ValList))[i]; |
| 4232 | *O << *V->val; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4233 | if (i+1 < (yyvsp[-7].ValList)->size()) |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4234 | *O << ", "; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4235 | delete V; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4236 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4237 | *O << ") " << *(yyvsp[-5].String) << ' ' << (yyvsp[-4].Ty)->getNewTy() << ' ' << *(yyvsp[-3].Val)->val << ' ' |
| 4238 | << *(yyvsp[-2].String) << ' ' << (yyvsp[-1].Ty)->getNewTy() << ' ' << *(yyvsp[0].Val)->val << '\n'; |
| 4239 | delete (yyvsp[-13].String); delete (yyvsp[-12].String); delete (yyvsp[-11].String); delete (yyvsp[-9].Val); delete (yyvsp[-7].ValList); |
| 4240 | delete (yyvsp[-5].String); delete (yyvsp[-3].Val); delete (yyvsp[-2].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4241 | (yyval.String) = 0; |
| 4242 | ;} |
| 4243 | break; |
| 4244 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4245 | case 262: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4246 | #line 1865 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4247 | { |
| 4248 | *O << " " << *(yyvsp[0].String) << '\n'; |
| 4249 | delete (yyvsp[0].String); |
| 4250 | (yyval.String) = 0; |
| 4251 | ;} |
| 4252 | break; |
| 4253 | |
| 4254 | case 263: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4255 | #line 1870 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4256 | { |
| 4257 | *O << " " << *(yyvsp[0].String) << '\n'; |
| 4258 | delete (yyvsp[0].String); |
| 4259 | (yyval.String) = 0; |
| 4260 | ;} |
| 4261 | break; |
| 4262 | |
| 4263 | case 264: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4264 | #line 1876 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4265 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4266 | *(yyvsp[-5].String) += " " + (yyvsp[-4].Ty)->getNewTy() + " " + *(yyvsp[-3].String) + ", " + (yyvsp[-1].Ty)->getNewTy() + " " + |
| 4267 | *(yyvsp[0].Val)->val; |
| 4268 | delete (yyvsp[-3].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4269 | (yyval.String) = (yyvsp[-5].String); |
| 4270 | ;} |
| 4271 | break; |
| 4272 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4273 | case 265: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4274 | #line 1882 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4275 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4276 | (yyvsp[-3].String)->insert(0, (yyvsp[-4].Ty)->getNewTy() + " " ); |
| 4277 | *(yyvsp[-3].String) += ", " + (yyvsp[-1].Ty)->getNewTy() + " " + *(yyvsp[0].Val)->val; |
| 4278 | delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4279 | (yyval.String) = (yyvsp[-3].String); |
| 4280 | ;} |
| 4281 | break; |
| 4282 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4283 | case 266: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4284 | #line 1890 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4285 | { |
| 4286 | if (!(yyvsp[-1].String)->empty()) { |
| 4287 | // Get a unique name for this value, based on its type. |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4288 | std::string Name = getUniqueName((yyvsp[-1].String), (yyvsp[0].Val)->type); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4289 | *(yyvsp[-1].String) = Name + " = "; |
| 4290 | if (deleteUselessCastFlag && *deleteUselessCastName == Name) { |
| 4291 | // don't actually delete it, just comment it out |
| 4292 | (yyvsp[-1].String)->insert(0, "; USELSS BITCAST: "); |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4293 | delete deleteUselessCastName; |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4294 | } |
| 4295 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4296 | *(yyvsp[-1].String) += *(yyvsp[0].Val)->val; |
| 4297 | delete (yyvsp[0].Val); |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4298 | deleteUselessCastFlag = false; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4299 | (yyval.String) = (yyvsp[-1].String); |
| 4300 | ;} |
| 4301 | break; |
| 4302 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4303 | case 267: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4304 | #line 1908 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4305 | { // Used for PHI nodes |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4306 | std::string Name = getUniqueName((yyvsp[-3].Val)->val, (yyvsp[-5].Ty)); |
| 4307 | Name.insert(0, (yyvsp[-5].Ty)->getNewTy() + "["); |
| 4308 | Name += "," + *(yyvsp[-1].Val)->val + "]"; |
| 4309 | (yyval.Val) = new Value; |
| 4310 | (yyval.Val)->val = new std::string(Name); |
| 4311 | (yyval.Val)->type = (yyvsp[-5].Ty); |
| 4312 | delete (yyvsp[-3].Val); delete (yyvsp[-1].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4313 | ;} |
| 4314 | break; |
| 4315 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4316 | case 268: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4317 | #line 1917 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4318 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4319 | std::string Name = getUniqueName((yyvsp[-3].Val)->val, (yyvsp[-6].Val)->type); |
| 4320 | *(yyvsp[-6].Val)->val += ", [" + Name + "," + *(yyvsp[-1].Val)->val + "]"; |
| 4321 | delete (yyvsp[-3].Val); |
| 4322 | delete (yyvsp[-1].Val); |
| 4323 | (yyval.Val) = (yyvsp[-6].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4324 | ;} |
| 4325 | break; |
| 4326 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4327 | case 269: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4328 | #line 1927 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4329 | { |
| 4330 | (yyval.ValList) = new ValueList(); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4331 | (yyval.ValList)->push_back((yyvsp[0].Val)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4332 | ;} |
| 4333 | break; |
| 4334 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4335 | case 270: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4336 | #line 1931 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4337 | { |
| 4338 | (yyval.ValList) = (yyvsp[-2].ValList); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4339 | (yyval.ValList)->push_back((yyvsp[0].Val)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4340 | ;} |
| 4341 | break; |
| 4342 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4343 | case 271: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4344 | #line 1938 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4345 | { (yyval.ValList) = (yyvsp[0].ValList); ;} |
| 4346 | break; |
| 4347 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4348 | case 272: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4349 | #line 1939 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4350 | { (yyval.ValList) = new ValueList(); ;} |
| 4351 | break; |
| 4352 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4353 | case 273: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4354 | #line 1943 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4355 | { |
| 4356 | *(yyvsp[-1].String) += " " + *(yyvsp[0].String); |
| 4357 | delete (yyvsp[0].String); |
| 4358 | (yyval.String) = (yyvsp[-1].String); |
| 4359 | ;} |
| 4360 | break; |
| 4361 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4362 | case 275: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4363 | #line 1951 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4364 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4365 | const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Ty)); |
| 4366 | std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty)); |
| 4367 | std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty)); |
| 4368 | (yyval.Val) = (yyvsp[-2].Val); |
| 4369 | delete (yyval.Val)->val; |
| 4370 | (yyval.Val)->val = new std::string(op); |
| 4371 | *(yyval.Val)->val += " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + ", " + Name2; |
| 4372 | (yyval.Val)->type = (yyvsp[-3].Ty); |
| 4373 | delete (yyvsp[-4].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4374 | ;} |
| 4375 | break; |
| 4376 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4377 | case 276: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4378 | #line 1962 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4379 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4380 | std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty)); |
| 4381 | std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty)); |
| 4382 | *(yyvsp[-4].String) += " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + ", " + Name2; |
| 4383 | (yyval.Val) = (yyvsp[-2].Val); |
| 4384 | delete (yyval.Val)->val; |
| 4385 | (yyval.Val)->val = (yyvsp[-4].String); |
| 4386 | (yyval.Val)->type = (yyvsp[-3].Ty); |
| 4387 | delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4388 | ;} |
| 4389 | break; |
| 4390 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4391 | case 277: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4392 | #line 1972 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4393 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4394 | std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty)); |
| 4395 | std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty)); |
| 4396 | *(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Ty)); |
| 4397 | *(yyvsp[-4].String) += " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + ", " + Name2; |
| 4398 | (yyval.Val) = (yyvsp[-2].Val); |
| 4399 | delete (yyval.Val)->val; |
| 4400 | (yyval.Val)->val = (yyvsp[-4].String); |
| 4401 | (yyval.Val)->type = Type::get("i1",BoolTy); |
| 4402 | delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4403 | ;} |
| 4404 | break; |
| 4405 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4406 | case 278: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4407 | #line 1983 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4408 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4409 | std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty)); |
| 4410 | std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty)); |
| 4411 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + "," + Name2; |
| 4412 | (yyval.Val) = (yyvsp[-2].Val); |
| 4413 | delete (yyval.Val)->val; |
| 4414 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4415 | (yyval.Val)->type = Type::get("i1",BoolTy); |
| 4416 | delete (yyvsp[-4].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4417 | ;} |
| 4418 | break; |
| 4419 | |
| 4420 | case 279: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4421 | #line 1993 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4422 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4423 | std::string Name1 = getUniqueName((yyvsp[-2].Val)->val, (yyvsp[-3].Ty)); |
| 4424 | std::string Name2 = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-3].Ty)); |
| 4425 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].String) + " " + (yyvsp[-3].Ty)->getNewTy() + " " + Name1 + "," + Name2; |
| 4426 | (yyval.Val) = (yyvsp[-2].Val); |
| 4427 | delete (yyval.Val)->val; |
| 4428 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4429 | (yyval.Val)->type = Type::get("i1",BoolTy); |
| 4430 | delete (yyvsp[-4].String); delete (yyvsp[0].Val); |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4431 | ;} |
| 4432 | break; |
| 4433 | |
| 4434 | case 280: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4435 | #line 2003 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4436 | { |
| 4437 | const char* shiftop = (yyvsp[-3].String)->c_str(); |
| 4438 | if (*(yyvsp[-3].String) == "shr") |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4439 | shiftop = ((yyvsp[-2].Val)->type->isUnsigned()) ? "lshr" : "ashr"; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4440 | std::string *val = new std::string(shiftop); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4441 | *val += " " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val; |
| 4442 | (yyval.Val) = (yyvsp[-2].Val); |
| 4443 | delete (yyval.Val)->val; |
| 4444 | (yyval.Val)->val = val; |
| 4445 | delete (yyvsp[-3].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4446 | ;} |
| 4447 | break; |
| 4448 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4449 | case 281: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4450 | #line 2014 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4451 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4452 | std::string source = *(yyvsp[-2].Val)->val; |
| 4453 | const Type* SrcTy = (yyvsp[-2].Val)->type->resolve(); |
| 4454 | const Type* DstTy = (yyvsp[0].Ty)->resolve(); |
| 4455 | (yyval.Val) = (yyvsp[-2].Val); |
| 4456 | delete (yyval.Val)->val; |
| 4457 | (yyval.Val)->val = new std::string(); |
| 4458 | (yyval.Val)->type = DstTy; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4459 | if (*(yyvsp[-3].String) == "cast") { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4460 | *(yyval.Val)->val += getCastUpgrade(source, SrcTy, DstTy, false); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 4461 | } else { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4462 | *(yyval.Val)->val += *(yyvsp[-3].String) + " " + source + " to " + DstTy->getNewTy(); |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 4463 | } |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4464 | // Check to see if this is a useless cast of a value to the same name |
| 4465 | // and the same type. Such casts will probably cause redefinition errors |
| 4466 | // when assembled and perform no code gen action so just remove them. |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4467 | if (*(yyvsp[-3].String) == "cast" || *(yyvsp[-3].String) == "bitcast") |
| 4468 | if (SrcTy->isInteger() && DstTy->isInteger() && |
| 4469 | SrcTy->getBitWidth() == DstTy->getBitWidth()) { |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4470 | deleteUselessCastFlag = true; // Flag the "Inst" rule |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4471 | deleteUselessCastName = new std::string(*(yyvsp[-2].Val)->val); // save the name |
Reid Spencer | f5626a3 | 2007-01-01 01:20:41 +0000 | [diff] [blame] | 4472 | size_t pos = deleteUselessCastName->find_first_of("%\"",0); |
| 4473 | if (pos != std::string::npos) { |
| 4474 | // remove the type portion before val |
| 4475 | deleteUselessCastName->erase(0, pos); |
| 4476 | } |
| 4477 | } |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4478 | delete (yyvsp[-3].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4479 | delete (yyvsp[-1].String); |
| 4480 | ;} |
| 4481 | break; |
| 4482 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4483 | case 282: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4484 | #line 2044 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4485 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4486 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].Val)->val + ", " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val; |
| 4487 | (yyval.Val) = (yyvsp[-4].Val); |
| 4488 | delete (yyval.Val)->val; |
| 4489 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4490 | (yyval.Val)->type = (yyvsp[-2].Val)->type; |
| 4491 | delete (yyvsp[-2].Val); |
| 4492 | delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4493 | ;} |
| 4494 | break; |
| 4495 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4496 | case 283: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4497 | #line 2053 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4498 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4499 | *(yyvsp[-3].String) += " " + *(yyvsp[-2].Val)->val + ", " + (yyvsp[0].Ty)->getNewTy(); |
| 4500 | (yyval.Val) = (yyvsp[-2].Val); |
| 4501 | delete (yyval.Val)->val; |
| 4502 | (yyval.Val)->val = (yyvsp[-3].String); |
| 4503 | (yyval.Val)->type = (yyvsp[0].Ty); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4504 | ;} |
| 4505 | break; |
| 4506 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4507 | case 284: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4508 | #line 2060 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4509 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4510 | *(yyvsp[-3].String) += " " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val; |
| 4511 | (yyval.Val) = (yyvsp[-2].Val); |
| 4512 | delete (yyval.Val)->val; |
| 4513 | (yyval.Val)->val = (yyvsp[-3].String); |
| 4514 | (yyval.Val)->type = (yyval.Val)->type->resolve(); |
| 4515 | (yyval.Val)->type = (yyval.Val)->type->getElementType(); |
| 4516 | delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4517 | ;} |
| 4518 | break; |
| 4519 | |
| 4520 | case 285: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4521 | #line 2069 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4522 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4523 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].Val)->val + ", " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val; |
| 4524 | (yyval.Val) = (yyvsp[-4].Val); |
| 4525 | delete (yyval.Val)->val; |
| 4526 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4527 | delete (yyvsp[-2].Val); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4528 | ;} |
| 4529 | break; |
| 4530 | |
| 4531 | case 286: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4532 | #line 2076 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4533 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4534 | *(yyvsp[-5].String) += " " + *(yyvsp[-4].Val)->val + ", " + *(yyvsp[-2].Val)->val + ", " + *(yyvsp[0].Val)->val; |
| 4535 | (yyval.Val) = (yyvsp[-4].Val); |
| 4536 | delete (yyval.Val)->val; |
| 4537 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4538 | delete (yyvsp[-2].Val); delete (yyvsp[0].Val); |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4539 | ;} |
| 4540 | break; |
| 4541 | |
| 4542 | case 287: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4543 | #line 2083 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4544 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4545 | *(yyvsp[-1].String) += " " + *(yyvsp[0].Val)->val; |
| 4546 | (yyval.Val) = (yyvsp[0].Val); |
| 4547 | delete (yyvsp[0].Val)->val; |
| 4548 | (yyval.Val)->val = (yyvsp[-1].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4549 | ;} |
| 4550 | break; |
| 4551 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4552 | case 288: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4553 | #line 2089 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4554 | { |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame] | 4555 | // map llvm.isunordered to "fcmp uno" |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4556 | (yyval.Val) = new Value; |
| 4557 | if (*(yyvsp[-3].Val)->val == "%llvm.isunordered.f32" || |
| 4558 | *(yyvsp[-3].Val)->val == "%llvm.isunordered.f64") { |
| 4559 | (yyval.Val)->val = new std::string( "fcmp uno " + *(*(yyvsp[-1].ValList))[0]->val + ", "); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4560 | size_t pos = (*(yyvsp[-1].ValList))[1]->val->find(' '); |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame] | 4561 | assert(pos != std::string::npos && "no space?"); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4562 | *(yyval.Val)->val += (*(yyvsp[-1].ValList))[1]->val->substr(pos+1); |
| 4563 | (yyval.Val)->type = Type::get("i1", BoolTy); |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame] | 4564 | } else { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4565 | static unsigned upgradeCount = 1; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4566 | if (*(yyvsp[-3].Val)->val == "%llvm.va_start" || *(yyvsp[-3].Val)->val == "%llvm.va_end") { |
Reid Spencer | f6e5459 | 2007-01-13 00:23:06 +0000 | [diff] [blame] | 4567 | if (!(yyvsp[-1].ValList)->empty()) { |
| 4568 | std::string name("%va_upgrade"); |
| 4569 | name += llvm::utostr(upgradeCount++); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4570 | (yyvsp[-6].String)->insert(0, name + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n "); |
| 4571 | *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4572 | (*(yyvsp[-1].ValList))[0]->type = Type::get("i8", UByteTy)->getPointerType(); |
Reid Spencer | f6e5459 | 2007-01-13 00:23:06 +0000 | [diff] [blame] | 4573 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4574 | } else if (*(yyvsp[-3].Val)->val == "%llvm.va_copy") { |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4575 | std::string name0("%va_upgrade"); |
| 4576 | name0 += llvm::utostr(upgradeCount++); |
| 4577 | std::string name1("%va_upgrade"); |
| 4578 | name1 += llvm::utostr(upgradeCount++); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4579 | (yyvsp[-6].String)->insert(0, name0 + " = bitcast " + *(*(yyvsp[-1].ValList))[0]->val + " to i8*\n " + |
| 4580 | name1 + " = bitcast " + *(*(yyvsp[-1].ValList))[1]->val + " to i8*\n "); |
| 4581 | *(*(yyvsp[-1].ValList))[0]->val = "i8* " + name0; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4582 | (*(yyvsp[-1].ValList))[0]->type = Type::get("i8", UByteTy)->getPointerType(); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4583 | *(*(yyvsp[-1].ValList))[1]->val = "i8* " + name1; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4584 | (*(yyvsp[-1].ValList))[0]->type = Type::get("i8", UByteTy)->getPointerType(); |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4585 | } |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame] | 4586 | if (!(yyvsp[-5].String)->empty()) |
| 4587 | *(yyvsp[-6].String) += " " + *(yyvsp[-5].String); |
| 4588 | if (!(yyvsp[-6].String)->empty()) |
| 4589 | *(yyvsp[-6].String) += " "; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4590 | *(yyvsp[-6].String) += (yyvsp[-4].Ty)->getNewTy() + " " + *(yyvsp[-3].Val)->val + "("; |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame] | 4591 | for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4592 | Value* V = (*(yyvsp[-1].ValList))[i]; |
| 4593 | *(yyvsp[-6].String) += *V->val; |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame] | 4594 | if (i+1 < (yyvsp[-1].ValList)->size()) |
| 4595 | *(yyvsp[-6].String) += ", "; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4596 | delete V; |
Reid Spencer | 1296988 | 2007-01-07 08:07:39 +0000 | [diff] [blame] | 4597 | } |
| 4598 | *(yyvsp[-6].String) += ")"; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4599 | (yyval.Val) = new Value; |
| 4600 | (yyval.Val)->val = (yyvsp[-6].String); |
| 4601 | (yyval.Val)->type = getFunctionReturnType((yyvsp[-4].Ty)); |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4602 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4603 | delete (yyvsp[-5].String); delete (yyvsp[-3].Val); delete (yyvsp[-1].ValList); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4604 | ;} |
| 4605 | break; |
| 4606 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4607 | case 290: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4608 | #line 2145 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4609 | { (yyval.ValList) = (yyvsp[0].ValList); ;} |
| 4610 | break; |
| 4611 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4612 | case 291: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4613 | #line 2146 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4614 | { (yyval.ValList) = new ValueList(); ;} |
| 4615 | break; |
| 4616 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4617 | case 293: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4618 | #line 2151 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4619 | { (yyval.String) = new std::string(); ;} |
| 4620 | break; |
| 4621 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4622 | case 294: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4623 | #line 2154 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4624 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4625 | *(yyvsp[-2].String) += " " + (yyvsp[-1].Ty)->getNewTy(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4626 | if (!(yyvsp[0].String)->empty()) |
| 4627 | *(yyvsp[-2].String) += " " + *(yyvsp[0].String); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4628 | (yyval.Val) = new Value; |
| 4629 | (yyval.Val)->val = (yyvsp[-2].String); |
| 4630 | (yyval.Val)->type = (yyvsp[-1].Ty)->getPointerType(); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4631 | delete (yyvsp[0].String); |
| 4632 | ;} |
| 4633 | break; |
| 4634 | |
| 4635 | case 295: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4636 | #line 2163 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4637 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4638 | std::string Name = getUniqueName((yyvsp[-1].Val)->val, (yyvsp[-2].Ty)); |
| 4639 | *(yyvsp[-5].String) += " " + (yyvsp[-4].Ty)->getNewTy() + ", " + (yyvsp[-2].Ty)->getNewTy() + " " + Name; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4640 | if (!(yyvsp[0].String)->empty()) |
| 4641 | *(yyvsp[-5].String) += " " + *(yyvsp[0].String); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4642 | (yyval.Val) = new Value; |
| 4643 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4644 | (yyval.Val)->type = (yyvsp[-4].Ty)->getPointerType(); |
| 4645 | delete (yyvsp[-1].Val); delete (yyvsp[0].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4646 | ;} |
| 4647 | break; |
| 4648 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4649 | case 296: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4650 | #line 2173 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4651 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4652 | *(yyvsp[-2].String) += " " + (yyvsp[-1].Ty)->getNewTy(); |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4653 | if (!(yyvsp[0].String)->empty()) |
| 4654 | *(yyvsp[-2].String) += " " + *(yyvsp[0].String); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4655 | (yyval.Val) = new Value; |
| 4656 | (yyval.Val)->val = (yyvsp[-2].String); |
| 4657 | (yyval.Val)->type = (yyvsp[-1].Ty)->getPointerType(); |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4658 | delete (yyvsp[0].String); |
| 4659 | ;} |
| 4660 | break; |
| 4661 | |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 4662 | case 297: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4663 | #line 2182 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4664 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4665 | std::string Name = getUniqueName((yyvsp[-1].Val)->val, (yyvsp[-2].Ty)); |
| 4666 | *(yyvsp[-5].String) += " " + (yyvsp[-4].Ty)->getNewTy() + ", " + (yyvsp[-2].Ty)->getNewTy() + " " + Name; |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4667 | if (!(yyvsp[0].String)->empty()) |
| 4668 | *(yyvsp[-5].String) += " " + *(yyvsp[0].String); |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4669 | (yyval.Val) = (yyvsp[-1].Val); |
| 4670 | delete (yyval.Val)->val; |
| 4671 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4672 | (yyval.Val)->type = (yyvsp[-4].Ty)->getPointerType(); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4673 | delete (yyvsp[0].String); |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4674 | ;} |
| 4675 | break; |
| 4676 | |
| 4677 | case 298: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4678 | #line 2193 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4679 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4680 | *(yyvsp[-1].String) += " " + *(yyvsp[0].Val)->val; |
| 4681 | (yyval.Val) = (yyvsp[0].Val); |
| 4682 | delete (yyvsp[0].Val)->val; |
| 4683 | (yyval.Val)->val = (yyvsp[-1].String); |
| 4684 | (yyval.Val)->type = Type::get("void", VoidTy); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4685 | ;} |
| 4686 | break; |
| 4687 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4688 | case 299: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4689 | #line 2200 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4690 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4691 | std::string Name = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-1].Ty)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4692 | if (!(yyvsp[-3].String)->empty()) |
| 4693 | *(yyvsp[-3].String) += " "; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4694 | *(yyvsp[-3].String) += *(yyvsp[-2].String) + " " + (yyvsp[-1].Ty)->getNewTy() + " " + Name; |
| 4695 | (yyval.Val) = (yyvsp[0].Val); |
| 4696 | delete (yyval.Val)->val; |
| 4697 | (yyval.Val)->val = (yyvsp[-3].String); |
| 4698 | (yyval.Val)->type = (yyvsp[-1].Ty)->getElementType(); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4699 | delete (yyvsp[-2].String); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4700 | ;} |
| 4701 | break; |
| 4702 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4703 | case 300: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4704 | #line 2211 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4705 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4706 | std::string Name = getUniqueName((yyvsp[0].Val)->val, (yyvsp[-1].Ty)); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4707 | if (!(yyvsp[-5].String)->empty()) |
| 4708 | *(yyvsp[-5].String) += " "; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4709 | *(yyvsp[-5].String) += *(yyvsp[-4].String) + " " + *(yyvsp[-3].Val)->val + ", " + (yyvsp[-1].Ty)->getNewTy() + " " + Name; |
| 4710 | (yyval.Val) = (yyvsp[-3].Val); |
| 4711 | delete (yyval.Val)->val; |
| 4712 | (yyval.Val)->val = (yyvsp[-5].String); |
| 4713 | (yyval.Val)->type = Type::get("void", VoidTy); |
| 4714 | delete (yyvsp[-4].String); delete (yyvsp[0].Val); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4715 | ;} |
| 4716 | break; |
| 4717 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4718 | case 301: |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4719 | #line 2222 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4720 | { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4721 | std::string Name = getUniqueName((yyvsp[-1].Val)->val, (yyvsp[-2].Ty)); |
Reid Spencer | f459d39 | 2006-12-02 16:19:52 +0000 | [diff] [blame] | 4722 | // Upgrade the indices |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4723 | for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4724 | Value* V = (*(yyvsp[0].ValList))[i]; |
| 4725 | if (V->type->isUnsigned() && !V->isConstant() && |
| 4726 | V->type->getBitWidth() < 64) { |
| 4727 | *O << " %gep_upgrade" << UniqueNameCounter << " = zext " << *V->val |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 4728 | << " to i64\n"; |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4729 | *V->val = "i64 %gep_upgrade" + llvm::utostr(UniqueNameCounter++); |
| 4730 | V->type = Type::get("i64",ULongTy); |
Reid Spencer | f459d39 | 2006-12-02 16:19:52 +0000 | [diff] [blame] | 4731 | } |
| 4732 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4733 | *(yyvsp[-3].String) += " " + (yyvsp[-2].Ty)->getNewTy() + " " + Name; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4734 | for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) { |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4735 | Value* V = (*(yyvsp[0].ValList))[i]; |
| 4736 | *(yyvsp[-3].String) += ", " + *V->val; |
Reid Spencer | f848365 | 2006-12-02 15:16:01 +0000 | [diff] [blame] | 4737 | } |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4738 | (yyval.Val) = (yyvsp[-1].Val); |
| 4739 | delete (yyval.Val)->val; |
| 4740 | (yyval.Val)->val = (yyvsp[-3].String); |
| 4741 | (yyval.Val)->type = getGEPIndexedType((yyvsp[-2].Ty),(yyvsp[0].ValList)); |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 4742 | for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) |
| 4743 | delete (*(yyvsp[0].ValList))[i]; |
| 4744 | delete (yyvsp[0].ValList); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4745 | ;} |
| 4746 | break; |
| 4747 | |
| 4748 | |
| 4749 | default: break; |
| 4750 | } |
| 4751 | |
| 4752 | /* Line 1126 of yacc.c. */ |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 4753 | #line 4754 "UpgradeParser.tab.c" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4754 | |
| 4755 | yyvsp -= yylen; |
| 4756 | yyssp -= yylen; |
| 4757 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4758 | |
| 4759 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4760 | |
| 4761 | *++yyvsp = yyval; |
| 4762 | |
| 4763 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4764 | /* Now `shift' the result of the reduction. Determine what state |
| 4765 | that goes to, based on the state we popped back to and the rule |
| 4766 | number reduced by. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4767 | |
| 4768 | yyn = yyr1[yyn]; |
| 4769 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4770 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 4771 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4772 | yystate = yytable[yystate]; |
| 4773 | else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4774 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4775 | |
| 4776 | goto yynewstate; |
| 4777 | |
| 4778 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4779 | /*------------------------------------. |
| 4780 | | yyerrlab -- here on detecting error | |
| 4781 | `------------------------------------*/ |
| 4782 | yyerrlab: |
| 4783 | /* If not already recovering from an error, report this error. */ |
| 4784 | if (!yyerrstatus) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4785 | { |
| 4786 | ++yynerrs; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4787 | #if YYERROR_VERBOSE |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4788 | yyn = yypact[yystate]; |
| 4789 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4790 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4791 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4792 | int yytype = YYTRANSLATE (yychar); |
| 4793 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 4794 | YYSIZE_T yysize = yysize0; |
| 4795 | YYSIZE_T yysize1; |
| 4796 | int yysize_overflow = 0; |
| 4797 | char *yymsg = 0; |
| 4798 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 4799 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 4800 | int yyx; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4801 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4802 | #if 0 |
| 4803 | /* This is so xgettext sees the translatable formats that are |
| 4804 | constructed on the fly. */ |
| 4805 | YY_("syntax error, unexpected %s"); |
| 4806 | YY_("syntax error, unexpected %s, expecting %s"); |
| 4807 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 4808 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 4809 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 4810 | #endif |
| 4811 | char *yyfmt; |
| 4812 | char const *yyf; |
| 4813 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 4814 | static char const yyexpecting[] = ", expecting %s"; |
| 4815 | static char const yyor[] = " or %s"; |
| 4816 | char yyformat[sizeof yyunexpected |
| 4817 | + sizeof yyexpecting - 1 |
| 4818 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 4819 | * (sizeof yyor - 1))]; |
| 4820 | char const *yyprefix = yyexpecting; |
| 4821 | |
| 4822 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 4823 | YYCHECK. */ |
| 4824 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 4825 | |
| 4826 | /* Stay within bounds of both yycheck and yytname. */ |
| 4827 | int yychecklim = YYLAST - yyn; |
| 4828 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 4829 | int yycount = 1; |
| 4830 | |
| 4831 | yyarg[0] = yytname[yytype]; |
| 4832 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 4833 | |
| 4834 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 4835 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 4836 | { |
| 4837 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 4838 | { |
| 4839 | yycount = 1; |
| 4840 | yysize = yysize0; |
| 4841 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 4842 | break; |
| 4843 | } |
| 4844 | yyarg[yycount++] = yytname[yyx]; |
| 4845 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 4846 | yysize_overflow |= yysize1 < yysize; |
| 4847 | yysize = yysize1; |
| 4848 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 4849 | yyprefix = yyor; |
| 4850 | } |
| 4851 | |
| 4852 | yyf = YY_(yyformat); |
| 4853 | yysize1 = yysize + yystrlen (yyf); |
| 4854 | yysize_overflow |= yysize1 < yysize; |
| 4855 | yysize = yysize1; |
| 4856 | |
| 4857 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 4858 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 4859 | if (yymsg) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4860 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4861 | /* Avoid sprintf, as that infringes on the user's name space. |
| 4862 | Don't have undefined behavior even if the translation |
| 4863 | produced a string with the wrong number of "%s"s. */ |
| 4864 | char *yyp = yymsg; |
| 4865 | int yyi = 0; |
| 4866 | while ((*yyp = *yyf)) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4867 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4868 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 4869 | { |
| 4870 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 4871 | yyf += 2; |
| 4872 | } |
| 4873 | else |
| 4874 | { |
| 4875 | yyp++; |
| 4876 | yyf++; |
| 4877 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4878 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4879 | yyerror (yymsg); |
| 4880 | YYSTACK_FREE (yymsg); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4881 | } |
| 4882 | else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4883 | { |
| 4884 | yyerror (YY_("syntax error")); |
| 4885 | goto yyexhaustedlab; |
| 4886 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4887 | } |
| 4888 | else |
| 4889 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4890 | yyerror (YY_("syntax error")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4891 | } |
| 4892 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4893 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4894 | |
| 4895 | if (yyerrstatus == 3) |
| 4896 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4897 | /* If just tried and failed to reuse look-ahead token after an |
| 4898 | error, discard it. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4899 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4900 | if (yychar <= YYEOF) |
| 4901 | { |
| 4902 | /* Return failure if at end of input. */ |
| 4903 | if (yychar == YYEOF) |
| 4904 | YYABORT; |
| 4905 | } |
| 4906 | else |
| 4907 | { |
| 4908 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 4909 | yychar = YYEMPTY; |
| 4910 | } |
| 4911 | } |
| 4912 | |
| 4913 | /* Else will try to reuse look-ahead token after shifting the error |
| 4914 | token. */ |
| 4915 | goto yyerrlab1; |
| 4916 | |
| 4917 | |
| 4918 | /*---------------------------------------------------. |
| 4919 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 4920 | `---------------------------------------------------*/ |
| 4921 | yyerrorlab: |
| 4922 | |
| 4923 | /* Pacify compilers like GCC when the user code never invokes |
| 4924 | YYERROR and the label yyerrorlab therefore never appears in user |
| 4925 | code. */ |
| 4926 | if (0) |
| 4927 | goto yyerrorlab; |
| 4928 | |
| 4929 | yyvsp -= yylen; |
| 4930 | yyssp -= yylen; |
| 4931 | yystate = *yyssp; |
| 4932 | goto yyerrlab1; |
| 4933 | |
| 4934 | |
| 4935 | /*-------------------------------------------------------------. |
| 4936 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 4937 | `-------------------------------------------------------------*/ |
| 4938 | yyerrlab1: |
| 4939 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 4940 | |
| 4941 | for (;;) |
| 4942 | { |
| 4943 | yyn = yypact[yystate]; |
| 4944 | if (yyn != YYPACT_NINF) |
| 4945 | { |
| 4946 | yyn += YYTERROR; |
| 4947 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 4948 | { |
| 4949 | yyn = yytable[yyn]; |
| 4950 | if (0 < yyn) |
| 4951 | break; |
| 4952 | } |
| 4953 | } |
| 4954 | |
| 4955 | /* Pop the current state because it cannot handle the error token. */ |
| 4956 | if (yyssp == yyss) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4957 | YYABORT; |
| 4958 | |
| 4959 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4960 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 4961 | YYPOPSTACK; |
| 4962 | yystate = *yyssp; |
| 4963 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4964 | } |
| 4965 | |
| 4966 | if (yyn == YYFINAL) |
| 4967 | YYACCEPT; |
| 4968 | |
| 4969 | *++yyvsp = yylval; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4970 | |
| 4971 | |
| 4972 | /* Shift the error token. */ |
| 4973 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 4974 | |
| 4975 | yystate = yyn; |
| 4976 | goto yynewstate; |
| 4977 | |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 4978 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4979 | /*-------------------------------------. |
| 4980 | | yyacceptlab -- YYACCEPT comes here. | |
| 4981 | `-------------------------------------*/ |
| 4982 | yyacceptlab: |
| 4983 | yyresult = 0; |
| 4984 | goto yyreturn; |
| 4985 | |
| 4986 | /*-----------------------------------. |
| 4987 | | yyabortlab -- YYABORT comes here. | |
| 4988 | `-----------------------------------*/ |
| 4989 | yyabortlab: |
| 4990 | yyresult = 1; |
| 4991 | goto yyreturn; |
| 4992 | |
| 4993 | #ifndef yyoverflow |
| 4994 | /*-------------------------------------------------. |
| 4995 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 4996 | `-------------------------------------------------*/ |
| 4997 | yyexhaustedlab: |
| 4998 | yyerror (YY_("memory exhausted")); |
| 4999 | yyresult = 2; |
| 5000 | /* Fall through. */ |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 5001 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5002 | |
| 5003 | yyreturn: |
| 5004 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5005 | yydestruct ("Cleanup: discarding lookahead", |
| 5006 | yytoken, &yylval); |
| 5007 | while (yyssp != yyss) |
| 5008 | { |
| 5009 | yydestruct ("Cleanup: popping", |
| 5010 | yystos[*yyssp], yyvsp); |
| 5011 | YYPOPSTACK; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 5012 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5013 | #ifndef yyoverflow |
| 5014 | if (yyss != yyssa) |
| 5015 | YYSTACK_FREE (yyss); |
| 5016 | #endif |
| 5017 | return yyresult; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5018 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5019 | |
| 5020 | |
Reid Spencer | b6673a9 | 2007-01-15 02:41:46 +0000 | [diff] [blame^] | 5021 | #line 2249 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5022 | |
| 5023 | |
| 5024 | int yyerror(const char *ErrorMsg) { |
| 5025 | std::string where |
| 5026 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5027 | + ":" + llvm::utostr((unsigned) Upgradelineno) + ": "; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5028 | std::string errMsg = where + "error: " + std::string(ErrorMsg) + |
| 5029 | " while reading "; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5030 | if (yychar == YYEMPTY || yychar == 0) |
| 5031 | errMsg += "end-of-file."; |
| 5032 | else |
| 5033 | errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'"; |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 5034 | std::cerr << "llvm-upgrade: " << errMsg << '\n'; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 5035 | *O << "llvm-upgrade parse failed.\n"; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5036 | exit(1); |
| 5037 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5038 | |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 5039 | void warning(const std::string& ErrorMsg) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5040 | std::string where |
| 5041 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5042 | + ":" + llvm::utostr((unsigned) Upgradelineno) + ": "; |
| 5043 | std::string errMsg = where + "warning: " + std::string(ErrorMsg) + |
| 5044 | " while reading "; |
| 5045 | if (yychar == YYEMPTY || yychar == 0) |
| 5046 | errMsg += "end-of-file."; |
| 5047 | else |
| 5048 | errMsg += "token: '" + std::string(Upgradetext, Upgradeleng) + "'"; |
| 5049 | std::cerr << "llvm-upgrade: " << errMsg << '\n'; |
| 5050 | } |
| 5051 | |