Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +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, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 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 |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 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. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Bison version. */ |
| 40 | #define YYBISON_VERSION "2.1" |
| 41 | |
| 42 | /* Skeleton name. */ |
| 43 | #define YYSKELETON_NAME "yacc.c" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 44 | |
| 45 | /* Pure parsers. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 46 | #define YYPURE 0 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 47 | |
| 48 | /* Using locations. */ |
| 49 | #define YYLSP_NEEDED 0 |
| 50 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 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 { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 67 | ESINT64VAL = 258, |
| 68 | EUINT64VAL = 259, |
| 69 | SINTVAL = 260, |
| 70 | UINTVAL = 261, |
| 71 | FPVAL = 262, |
| 72 | VOID = 263, |
| 73 | BOOL = 264, |
| 74 | SBYTE = 265, |
| 75 | UBYTE = 266, |
| 76 | SHORT = 267, |
| 77 | USHORT = 268, |
| 78 | INT = 269, |
| 79 | UINT = 270, |
| 80 | LONG = 271, |
| 81 | ULONG = 272, |
| 82 | FLOAT = 273, |
| 83 | DOUBLE = 274, |
| 84 | TYPE = 275, |
| 85 | LABEL = 276, |
| 86 | VAR_ID = 277, |
| 87 | LABELSTR = 278, |
| 88 | STRINGCONSTANT = 279, |
| 89 | IMPLEMENTATION = 280, |
| 90 | ZEROINITIALIZER = 281, |
| 91 | TRUETOK = 282, |
| 92 | FALSETOK = 283, |
| 93 | BEGINTOK = 284, |
| 94 | ENDTOK = 285, |
| 95 | DECLARE = 286, |
| 96 | GLOBAL = 287, |
| 97 | CONSTANT = 288, |
| 98 | SECTION = 289, |
| 99 | VOLATILE = 290, |
| 100 | TO = 291, |
| 101 | DOTDOTDOT = 292, |
| 102 | NULL_TOK = 293, |
| 103 | UNDEF = 294, |
| 104 | CONST = 295, |
| 105 | INTERNAL = 296, |
| 106 | LINKONCE = 297, |
| 107 | WEAK = 298, |
| 108 | APPENDING = 299, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 109 | DLLIMPORT = 300, |
| 110 | DLLEXPORT = 301, |
| 111 | EXTERN_WEAK = 302, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 112 | OPAQUE = 303, |
| 113 | NOT = 304, |
| 114 | EXTERNAL = 305, |
| 115 | TARGET = 306, |
| 116 | TRIPLE = 307, |
| 117 | ENDIAN = 308, |
| 118 | POINTERSIZE = 309, |
| 119 | LITTLE = 310, |
| 120 | BIG = 311, |
| 121 | ALIGN = 312, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 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, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 140 | UNREACHABLE = 331, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 141 | UNWIND = 332, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 142 | EXCEPT = 333, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 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, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 165 | MALLOC = 356, |
| 166 | ALLOCA = 357, |
| 167 | FREE = 358, |
| 168 | LOAD = 359, |
| 169 | STORE = 360, |
| 170 | GETELEMENTPTR = 361, |
| 171 | PHI_TOK = 362, |
| 172 | SELECT = 363, |
| 173 | SHL = 364, |
| 174 | SHR = 365, |
| 175 | ASHR = 366, |
| 176 | LSHR = 367, |
| 177 | VAARG = 368, |
| 178 | EXTRACTELEMENT = 369, |
| 179 | INSERTELEMENT = 370, |
| 180 | SHUFFLEVECTOR = 371, |
| 181 | VAARG_old = 372, |
| 182 | VANEXT_old = 373, |
| 183 | EQ = 374, |
| 184 | NE = 375, |
| 185 | SLT = 376, |
| 186 | SGT = 377, |
| 187 | SLE = 378, |
| 188 | SGE = 379, |
| 189 | ULT = 380, |
| 190 | UGT = 381, |
| 191 | ULE = 382, |
| 192 | UGE = 383, |
| 193 | OEQ = 384, |
| 194 | ONE = 385, |
| 195 | OLT = 386, |
| 196 | OGT = 387, |
| 197 | OLE = 388, |
| 198 | OGE = 389, |
| 199 | ORD = 390, |
| 200 | UNO = 391, |
| 201 | UEQ = 392, |
| 202 | UNE = 393, |
| 203 | CAST = 394, |
| 204 | TRUNC = 395, |
| 205 | ZEXT = 396, |
| 206 | SEXT = 397, |
| 207 | FPTRUNC = 398, |
| 208 | FPEXT = 399, |
| 209 | FPTOUI = 400, |
| 210 | FPTOSI = 401, |
| 211 | UITOFP = 402, |
| 212 | SITOFP = 403, |
| 213 | PTRTOINT = 404, |
| 214 | INTTOPTR = 405, |
| 215 | BITCAST = 406 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 216 | }; |
| 217 | #endif |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 218 | /* Tokens. */ |
| 219 | #define ESINT64VAL 258 |
| 220 | #define EUINT64VAL 259 |
| 221 | #define SINTVAL 260 |
| 222 | #define UINTVAL 261 |
| 223 | #define FPVAL 262 |
| 224 | #define VOID 263 |
| 225 | #define BOOL 264 |
| 226 | #define SBYTE 265 |
| 227 | #define UBYTE 266 |
| 228 | #define SHORT 267 |
| 229 | #define USHORT 268 |
| 230 | #define INT 269 |
| 231 | #define UINT 270 |
| 232 | #define LONG 271 |
| 233 | #define ULONG 272 |
| 234 | #define FLOAT 273 |
| 235 | #define DOUBLE 274 |
| 236 | #define TYPE 275 |
| 237 | #define LABEL 276 |
| 238 | #define VAR_ID 277 |
| 239 | #define LABELSTR 278 |
| 240 | #define STRINGCONSTANT 279 |
| 241 | #define IMPLEMENTATION 280 |
| 242 | #define ZEROINITIALIZER 281 |
| 243 | #define TRUETOK 282 |
| 244 | #define FALSETOK 283 |
| 245 | #define BEGINTOK 284 |
| 246 | #define ENDTOK 285 |
| 247 | #define DECLARE 286 |
| 248 | #define GLOBAL 287 |
| 249 | #define CONSTANT 288 |
| 250 | #define SECTION 289 |
| 251 | #define VOLATILE 290 |
| 252 | #define TO 291 |
| 253 | #define DOTDOTDOT 292 |
| 254 | #define NULL_TOK 293 |
| 255 | #define UNDEF 294 |
| 256 | #define CONST 295 |
| 257 | #define INTERNAL 296 |
| 258 | #define LINKONCE 297 |
| 259 | #define WEAK 298 |
| 260 | #define APPENDING 299 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 261 | #define DLLIMPORT 300 |
| 262 | #define DLLEXPORT 301 |
| 263 | #define EXTERN_WEAK 302 |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 264 | #define OPAQUE 303 |
| 265 | #define NOT 304 |
| 266 | #define EXTERNAL 305 |
| 267 | #define TARGET 306 |
| 268 | #define TRIPLE 307 |
| 269 | #define ENDIAN 308 |
| 270 | #define POINTERSIZE 309 |
| 271 | #define LITTLE 310 |
| 272 | #define BIG 311 |
| 273 | #define ALIGN 312 |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 274 | #define DEPLIBS 313 |
| 275 | #define CALL 314 |
| 276 | #define TAIL 315 |
| 277 | #define ASM_TOK 316 |
| 278 | #define MODULE 317 |
| 279 | #define SIDEEFFECT 318 |
| 280 | #define CC_TOK 319 |
| 281 | #define CCC_TOK 320 |
| 282 | #define CSRETCC_TOK 321 |
| 283 | #define FASTCC_TOK 322 |
| 284 | #define COLDCC_TOK 323 |
| 285 | #define X86_STDCALLCC_TOK 324 |
| 286 | #define X86_FASTCALLCC_TOK 325 |
| 287 | #define DATALAYOUT 326 |
| 288 | #define RET 327 |
| 289 | #define BR 328 |
| 290 | #define SWITCH 329 |
| 291 | #define INVOKE 330 |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 292 | #define UNREACHABLE 331 |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 293 | #define UNWIND 332 |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 294 | #define EXCEPT 333 |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 295 | #define ADD 334 |
| 296 | #define SUB 335 |
| 297 | #define MUL 336 |
| 298 | #define DIV 337 |
| 299 | #define UDIV 338 |
| 300 | #define SDIV 339 |
| 301 | #define FDIV 340 |
| 302 | #define REM 341 |
| 303 | #define UREM 342 |
| 304 | #define SREM 343 |
| 305 | #define FREM 344 |
| 306 | #define AND 345 |
| 307 | #define OR 346 |
| 308 | #define XOR 347 |
| 309 | #define SETLE 348 |
| 310 | #define SETGE 349 |
| 311 | #define SETLT 350 |
| 312 | #define SETGT 351 |
| 313 | #define SETEQ 352 |
| 314 | #define SETNE 353 |
| 315 | #define ICMP 354 |
| 316 | #define FCMP 355 |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 317 | #define MALLOC 356 |
| 318 | #define ALLOCA 357 |
| 319 | #define FREE 358 |
| 320 | #define LOAD 359 |
| 321 | #define STORE 360 |
| 322 | #define GETELEMENTPTR 361 |
| 323 | #define PHI_TOK 362 |
| 324 | #define SELECT 363 |
| 325 | #define SHL 364 |
| 326 | #define SHR 365 |
| 327 | #define ASHR 366 |
| 328 | #define LSHR 367 |
| 329 | #define VAARG 368 |
| 330 | #define EXTRACTELEMENT 369 |
| 331 | #define INSERTELEMENT 370 |
| 332 | #define SHUFFLEVECTOR 371 |
| 333 | #define VAARG_old 372 |
| 334 | #define VANEXT_old 373 |
| 335 | #define EQ 374 |
| 336 | #define NE 375 |
| 337 | #define SLT 376 |
| 338 | #define SGT 377 |
| 339 | #define SLE 378 |
| 340 | #define SGE 379 |
| 341 | #define ULT 380 |
| 342 | #define UGT 381 |
| 343 | #define ULE 382 |
| 344 | #define UGE 383 |
| 345 | #define OEQ 384 |
| 346 | #define ONE 385 |
| 347 | #define OLT 386 |
| 348 | #define OGT 387 |
| 349 | #define OLE 388 |
| 350 | #define OGE 389 |
| 351 | #define ORD 390 |
| 352 | #define UNO 391 |
| 353 | #define UEQ 392 |
| 354 | #define UNE 393 |
| 355 | #define CAST 394 |
| 356 | #define TRUNC 395 |
| 357 | #define ZEXT 396 |
| 358 | #define SEXT 397 |
| 359 | #define FPTRUNC 398 |
| 360 | #define FPEXT 399 |
| 361 | #define FPTOUI 400 |
| 362 | #define FPTOSI 401 |
| 363 | #define UITOFP 402 |
| 364 | #define SITOFP 403 |
| 365 | #define PTRTOINT 404 |
| 366 | #define INTTOPTR 405 |
| 367 | #define BITCAST 406 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | /* Copy the first part of user declarations. */ |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 373 | #line 14 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 374 | |
| 375 | #include "UpgradeInternals.h" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 376 | #include "llvm/CallingConv.h" |
| 377 | #include "llvm/InlineAsm.h" |
| 378 | #include "llvm/Instructions.h" |
| 379 | #include "llvm/Module.h" |
| 380 | #include "llvm/SymbolTable.h" |
| 381 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
| 382 | #include "llvm/ADT/STLExtras.h" |
| 383 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 384 | #include <algorithm> |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 385 | #include <iostream> |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 386 | #include <list> |
| 387 | #include <utility> |
| 388 | |
| 389 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 390 | // relating to upreferences in the input stream. |
| 391 | // |
| 392 | //#define DEBUG_UPREFS 1 |
| 393 | #ifdef DEBUG_UPREFS |
| 394 | #define UR_OUT(X) std::cerr << X |
| 395 | #else |
| 396 | #define UR_OUT(X) |
| 397 | #endif |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 398 | |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 399 | #define YYERROR_VERBOSE 1 |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 400 | #define YYINCLUDED_STDLIB_H |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 401 | #define YYDEBUG 1 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 402 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 403 | int yylex(); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 404 | int yyparse(); |
| 405 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 406 | int yyerror(const char*); |
| 407 | static void warning(const std::string& WarningMsg); |
| 408 | |
| 409 | namespace llvm { |
| 410 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 411 | std::istream* LexInput; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 412 | static std::string CurFilename; |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 413 | |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 414 | // This bool controls whether attributes are ever added to function declarations |
| 415 | // definitions and calls. |
| 416 | static bool AddAttributes = false; |
| 417 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 418 | static Module *ParserResult; |
| 419 | static bool ObsoleteVarArgs; |
| 420 | static bool NewVarArgs; |
| 421 | static BasicBlock *CurBB; |
| 422 | static GlobalVariable *CurGV; |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 423 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 424 | // This contains info used when building the body of a function. It is |
| 425 | // destroyed when the function is completed. |
| 426 | // |
| 427 | typedef std::vector<Value *> ValueList; // Numbered defs |
| 428 | |
| 429 | typedef std::pair<std::string,const Type*> RenameMapKey; |
| 430 | typedef std::map<RenameMapKey,std::string> RenameMapType; |
| 431 | |
| 432 | static void |
| 433 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 434 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 435 | |
| 436 | static struct PerModuleInfo { |
| 437 | Module *CurrentModule; |
| 438 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 439 | std::map<const Type *,ValueList> LateResolveValues; |
| 440 | std::vector<PATypeHolder> Types; |
| 441 | std::map<ValID, PATypeHolder> LateResolveTypes; |
| 442 | static Module::Endianness Endian; |
| 443 | static Module::PointerSize PointerSize; |
| 444 | RenameMapType RenameMap; |
| 445 | |
| 446 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
| 447 | /// how they were referenced and on which line of the input they came from so |
| 448 | /// that we can resolve them later and print error messages as appropriate. |
| 449 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 450 | |
| 451 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 452 | // references to global values. Global values may be referenced before they |
| 453 | // are defined, and if so, the temporary object that they represent is held |
| 454 | // here. This is used for forward references of GlobalValues. |
| 455 | // |
| 456 | typedef std::map<std::pair<const PointerType *, ValID>, GlobalValue*> |
| 457 | GlobalRefsType; |
| 458 | GlobalRefsType GlobalRefs; |
| 459 | |
| 460 | void ModuleDone() { |
| 461 | // If we could not resolve some functions at function compilation time |
| 462 | // (calls to functions before they are defined), resolve them now... Types |
| 463 | // are resolved when the constant pool has been completely parsed. |
| 464 | // |
| 465 | ResolveDefinitions(LateResolveValues); |
| 466 | |
| 467 | // Check to make sure that all global value forward references have been |
| 468 | // resolved! |
| 469 | // |
| 470 | if (!GlobalRefs.empty()) { |
| 471 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 472 | |
| 473 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 474 | I != E; ++I) { |
| 475 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 476 | I->first.second.getName() + "\n"; |
| 477 | } |
| 478 | error(UndefinedReferences); |
| 479 | return; |
| 480 | } |
| 481 | |
| 482 | if (CurrentModule->getDataLayout().empty()) { |
| 483 | std::string dataLayout; |
| 484 | if (Endian != Module::AnyEndianness) |
| 485 | dataLayout.append(Endian == Module::BigEndian ? "E" : "e"); |
| 486 | if (PointerSize != Module::AnyPointerSize) { |
| 487 | if (!dataLayout.empty()) |
| 488 | dataLayout += "-"; |
| 489 | dataLayout.append(PointerSize == Module::Pointer64 ? |
| 490 | "p:64:64" : "p:32:32"); |
| 491 | } |
| 492 | CurrentModule->setDataLayout(dataLayout); |
| 493 | } |
| 494 | |
| 495 | Values.clear(); // Clear out function local definitions |
| 496 | Types.clear(); |
| 497 | CurrentModule = 0; |
| 498 | } |
| 499 | |
| 500 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 501 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 502 | // If not, just return null. |
| 503 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 504 | // Check to see if there is a forward reference to this global variable... |
| 505 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 506 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 507 | GlobalValue *Ret = 0; |
| 508 | if (I != GlobalRefs.end()) { |
| 509 | Ret = I->second; |
| 510 | GlobalRefs.erase(I); |
| 511 | } |
| 512 | return Ret; |
| 513 | } |
| 514 | void setEndianness(Module::Endianness E) { Endian = E; } |
| 515 | void setPointerSize(Module::PointerSize sz) { PointerSize = sz; } |
| 516 | } CurModule; |
| 517 | |
| 518 | Module::Endianness PerModuleInfo::Endian = Module::AnyEndianness; |
| 519 | Module::PointerSize PerModuleInfo::PointerSize = Module::AnyPointerSize; |
| 520 | |
| 521 | static struct PerFunctionInfo { |
| 522 | Function *CurrentFunction; // Pointer to current function being created |
| 523 | |
| 524 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
| 525 | std::map<const Type*, ValueList> LateResolveValues; |
| 526 | bool isDeclare; // Is this function a forward declararation? |
| 527 | GlobalValue::LinkageTypes Linkage;// Linkage for forward declaration. |
| 528 | |
| 529 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 530 | /// track of them here. |
| 531 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 532 | std::vector<BasicBlock*> NumberedBlocks; |
| 533 | RenameMapType RenameMap; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 534 | unsigned NextBBNum; |
| 535 | |
| 536 | inline PerFunctionInfo() { |
| 537 | CurrentFunction = 0; |
| 538 | isDeclare = false; |
| 539 | Linkage = GlobalValue::ExternalLinkage; |
| 540 | } |
| 541 | |
| 542 | inline void FunctionStart(Function *M) { |
| 543 | CurrentFunction = M; |
| 544 | NextBBNum = 0; |
| 545 | } |
| 546 | |
| 547 | void FunctionDone() { |
| 548 | NumberedBlocks.clear(); |
| 549 | |
| 550 | // Any forward referenced blocks left? |
| 551 | if (!BBForwardRefs.empty()) { |
| 552 | error("Undefined reference to label " + |
| 553 | BBForwardRefs.begin()->first->getName()); |
| 554 | return; |
| 555 | } |
| 556 | |
| 557 | // Resolve all forward references now. |
| 558 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 559 | |
| 560 | Values.clear(); // Clear out function local definitions |
| 561 | RenameMap.clear(); |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 562 | CurrentFunction = 0; |
| 563 | isDeclare = false; |
| 564 | Linkage = GlobalValue::ExternalLinkage; |
| 565 | } |
| 566 | } CurFun; // Info for the current function... |
| 567 | |
| 568 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 569 | |
| 570 | |
| 571 | //===----------------------------------------------------------------------===// |
| 572 | // Code to handle definitions of all the types |
| 573 | //===----------------------------------------------------------------------===// |
| 574 | |
| 575 | static int InsertValue(Value *V, |
| 576 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 577 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 578 | |
| 579 | // Yes, insert the value into the value table... |
| 580 | ValueList &List = ValueTab[V->getType()]; |
| 581 | List.push_back(V); |
| 582 | return List.size()-1; |
| 583 | } |
| 584 | |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 585 | static const Type *getType(const ValID &D, bool DoNotImprovise = false) { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 586 | switch (D.Type) { |
| 587 | case ValID::NumberVal: // Is it a numbered definition? |
| 588 | // Module constants occupy the lowest numbered slots... |
| 589 | if ((unsigned)D.Num < CurModule.Types.size()) { |
| 590 | return CurModule.Types[(unsigned)D.Num]; |
| 591 | } |
| 592 | break; |
| 593 | case ValID::NameVal: // Is it a named definition? |
| 594 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 595 | D.destroy(); // Free old strdup'd memory... |
| 596 | return N; |
| 597 | } |
| 598 | break; |
| 599 | default: |
| 600 | error("Internal parser error: Invalid symbol type reference"); |
| 601 | return 0; |
| 602 | } |
| 603 | |
| 604 | // If we reached here, we referenced either a symbol that we don't know about |
| 605 | // or an id number that hasn't been read yet. We may be referencing something |
| 606 | // forward, so just create an entry to be resolved later and get to it... |
| 607 | // |
| 608 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 609 | |
| 610 | |
| 611 | if (inFunctionScope()) { |
| 612 | if (D.Type == ValID::NameVal) { |
| 613 | error("Reference to an undefined type: '" + D.getName() + "'"); |
| 614 | return 0; |
| 615 | } else { |
| 616 | error("Reference to an undefined type: #" + itostr(D.Num)); |
| 617 | return 0; |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
| 622 | if (I != CurModule.LateResolveTypes.end()) |
| 623 | return I->second; |
| 624 | |
| 625 | Type *Typ = OpaqueType::get(); |
| 626 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 627 | return Typ; |
| 628 | } |
| 629 | |
| 630 | // getExistingValue - Look up the value specified by the provided type and |
| 631 | // the provided ValID. If the value exists and has already been defined, return |
| 632 | // it. Otherwise return null. |
| 633 | // |
| 634 | static Value *getExistingValue(const Type *Ty, const ValID &D) { |
| 635 | if (isa<FunctionType>(Ty)) { |
| 636 | error("Functions are not values and must be referenced as pointers"); |
| 637 | } |
| 638 | |
| 639 | switch (D.Type) { |
| 640 | case ValID::NumberVal: { // Is it a numbered definition? |
| 641 | unsigned Num = (unsigned)D.Num; |
| 642 | |
| 643 | // Module constants occupy the lowest numbered slots... |
| 644 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 645 | if (VI != CurModule.Values.end()) { |
| 646 | if (Num < VI->second.size()) |
| 647 | return VI->second[Num]; |
| 648 | Num -= VI->second.size(); |
| 649 | } |
| 650 | |
| 651 | // Make sure that our type is within bounds |
| 652 | VI = CurFun.Values.find(Ty); |
| 653 | if (VI == CurFun.Values.end()) return 0; |
| 654 | |
| 655 | // Check that the number is within bounds... |
| 656 | if (VI->second.size() <= Num) return 0; |
| 657 | |
| 658 | return VI->second[Num]; |
| 659 | } |
| 660 | |
| 661 | case ValID::NameVal: { // Is it a named definition? |
| 662 | // Get the name out of the ID |
| 663 | std::string Name(D.Name); |
| 664 | Value* V = 0; |
| 665 | RenameMapKey Key = std::make_pair(Name, Ty); |
| 666 | if (inFunctionScope()) { |
| 667 | // See if the name was renamed |
| 668 | RenameMapType::const_iterator I = CurFun.RenameMap.find(Key); |
| 669 | std::string LookupName; |
| 670 | if (I != CurFun.RenameMap.end()) |
| 671 | LookupName = I->second; |
| 672 | else |
| 673 | LookupName = Name; |
| 674 | SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
| 675 | V = SymTab.lookup(Ty, LookupName); |
| 676 | } |
| 677 | if (!V) { |
| 678 | RenameMapType::const_iterator I = CurModule.RenameMap.find(Key); |
| 679 | std::string LookupName; |
| 680 | if (I != CurModule.RenameMap.end()) |
| 681 | LookupName = I->second; |
| 682 | else |
| 683 | LookupName = Name; |
| 684 | V = CurModule.CurrentModule->getValueSymbolTable().lookup(Ty, LookupName); |
| 685 | } |
| 686 | if (V == 0) |
| 687 | return 0; |
| 688 | |
| 689 | D.destroy(); // Free old strdup'd memory... |
| 690 | return V; |
| 691 | } |
| 692 | |
| 693 | // Check to make sure that "Ty" is an integral type, and that our |
| 694 | // value will fit into the specified type... |
| 695 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
| 696 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
| 697 | error("Signed integral constant '" + itostr(D.ConstPool64) + |
| 698 | "' is invalid for type '" + Ty->getDescription() + "'"); |
| 699 | } |
| 700 | return ConstantInt::get(Ty, D.ConstPool64); |
| 701 | |
| 702 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
| 703 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 704 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) |
| 705 | error("Integral constant '" + utostr(D.UConstPool64) + |
| 706 | "' is invalid or out of range"); |
| 707 | else // This is really a signed reference. Transmogrify. |
| 708 | return ConstantInt::get(Ty, D.ConstPool64); |
| 709 | } else |
| 710 | return ConstantInt::get(Ty, D.UConstPool64); |
| 711 | |
| 712 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
| 713 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) |
| 714 | error("FP constant invalid for type"); |
| 715 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 716 | |
| 717 | case ValID::ConstNullVal: // Is it a null value? |
| 718 | if (!isa<PointerType>(Ty)) |
| 719 | error("Cannot create a a non pointer null"); |
| 720 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 721 | |
| 722 | case ValID::ConstUndefVal: // Is it an undef value? |
| 723 | return UndefValue::get(Ty); |
| 724 | |
| 725 | case ValID::ConstZeroVal: // Is it a zero value? |
| 726 | return Constant::getNullValue(Ty); |
| 727 | |
| 728 | case ValID::ConstantVal: // Fully resolved constant? |
| 729 | if (D.ConstantValue->getType() != Ty) |
| 730 | error("Constant expression type different from required type"); |
| 731 | return D.ConstantValue; |
| 732 | |
| 733 | case ValID::InlineAsmVal: { // Inline asm expression |
| 734 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 735 | const FunctionType *FTy = |
| 736 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
| 737 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) |
| 738 | error("Invalid type for asm constraint string"); |
| 739 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 740 | D.IAD->HasSideEffects); |
| 741 | D.destroy(); // Free InlineAsmDescriptor. |
| 742 | return IA; |
| 743 | } |
| 744 | default: |
| 745 | assert(0 && "Unhandled case"); |
| 746 | return 0; |
| 747 | } // End of switch |
| 748 | |
| 749 | assert(0 && "Unhandled case"); |
| 750 | return 0; |
| 751 | } |
| 752 | |
| 753 | // getVal - This function is identical to getExistingValue, except that if a |
| 754 | // value is not already defined, it "improvises" by creating a placeholder var |
| 755 | // that looks and acts just like the requested variable. When the value is |
| 756 | // defined later, all uses of the placeholder variable are replaced with the |
| 757 | // real thing. |
| 758 | // |
| 759 | static Value *getVal(const Type *Ty, const ValID &ID) { |
| 760 | if (Ty == Type::LabelTy) |
| 761 | error("Cannot use a basic block here"); |
| 762 | |
| 763 | // See if the value has already been defined. |
| 764 | Value *V = getExistingValue(Ty, ID); |
| 765 | if (V) return V; |
| 766 | |
| 767 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) |
| 768 | error("Invalid use of a composite type"); |
| 769 | |
| 770 | // If we reached here, we referenced either a symbol that we don't know about |
| 771 | // or an id number that hasn't been read yet. We may be referencing something |
| 772 | // forward, so just create an entry to be resolved later and get to it... |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 773 | V = new Argument(Ty); |
| 774 | |
| 775 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 776 | // to recycle these things?? |
| 777 | CurModule.PlaceHolderInfo.insert( |
| 778 | std::make_pair(V, std::make_pair(ID, Upgradelineno-1))); |
| 779 | |
| 780 | if (inFunctionScope()) |
| 781 | InsertValue(V, CurFun.LateResolveValues); |
| 782 | else |
| 783 | InsertValue(V, CurModule.LateResolveValues); |
| 784 | return V; |
| 785 | } |
| 786 | |
| 787 | /// getBBVal - This is used for two purposes: |
| 788 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 789 | /// defined. |
| 790 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 791 | /// or may not be a forward reference. |
| 792 | /// |
| 793 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 794 | assert(inFunctionScope() && "Can't get basic block at global scope"); |
| 795 | |
| 796 | std::string Name; |
| 797 | BasicBlock *BB = 0; |
| 798 | switch (ID.Type) { |
| 799 | default: |
| 800 | error("Illegal label reference " + ID.getName()); |
| 801 | break; |
| 802 | case ValID::NumberVal: // Is it a numbered definition? |
| 803 | if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) |
| 804 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 805 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 806 | break; |
| 807 | case ValID::NameVal: // Is it a named definition? |
| 808 | Name = ID.Name; |
| 809 | if (Value *N = CurFun.CurrentFunction-> |
| 810 | getValueSymbolTable().lookup(Type::LabelTy, Name)) { |
| 811 | if (N->getType() != Type::LabelTy) |
| 812 | error("Name '" + Name + "' does not refer to a BasicBlock"); |
| 813 | BB = cast<BasicBlock>(N); |
| 814 | } |
| 815 | break; |
| 816 | } |
| 817 | |
| 818 | // See if the block has already been defined. |
| 819 | if (BB) { |
| 820 | // If this is the definition of the block, make sure the existing value was |
| 821 | // just a forward reference. If it was a forward reference, there will be |
| 822 | // an entry for it in the PlaceHolderInfo map. |
| 823 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) |
| 824 | // The existing value was a definition, not a forward reference. |
| 825 | error("Redefinition of label " + ID.getName()); |
| 826 | |
| 827 | ID.destroy(); // Free strdup'd memory. |
| 828 | return BB; |
| 829 | } |
| 830 | |
| 831 | // Otherwise this block has not been seen before. |
| 832 | BB = new BasicBlock("", CurFun.CurrentFunction); |
| 833 | if (ID.Type == ValID::NameVal) { |
| 834 | BB->setName(ID.Name); |
| 835 | } else { |
| 836 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 837 | } |
| 838 | |
| 839 | // If this is not a definition, keep track of it so we can use it as a forward |
| 840 | // reference. |
| 841 | if (!isDefinition) { |
| 842 | // Remember where this forward reference came from. |
| 843 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, Upgradelineno); |
| 844 | } else { |
| 845 | // The forward declaration could have been inserted anywhere in the |
| 846 | // function: insert it into the correct place now. |
| 847 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 848 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 849 | } |
| 850 | ID.destroy(); |
| 851 | return BB; |
| 852 | } |
| 853 | |
| 854 | |
| 855 | //===----------------------------------------------------------------------===// |
| 856 | // Code to handle forward references in instructions |
| 857 | //===----------------------------------------------------------------------===// |
| 858 | // |
| 859 | // This code handles the late binding needed with statements that reference |
| 860 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 861 | // a loop body. |
| 862 | // |
| 863 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 864 | // and back patchs after we are done. |
| 865 | // |
| 866 | |
| 867 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 868 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 869 | // defs now... |
| 870 | // |
| 871 | static void |
| 872 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 873 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 874 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 875 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 876 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 877 | ValueList &List = LRI->second; |
| 878 | while (!List.empty()) { |
| 879 | Value *V = List.back(); |
| 880 | List.pop_back(); |
| 881 | |
| 882 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 883 | CurModule.PlaceHolderInfo.find(V); |
| 884 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error"); |
| 885 | |
| 886 | ValID &DID = PHI->second.first; |
| 887 | |
| 888 | Value *TheRealValue = getExistingValue(LRI->first, DID); |
| 889 | if (TheRealValue) { |
| 890 | V->replaceAllUsesWith(TheRealValue); |
| 891 | delete V; |
| 892 | CurModule.PlaceHolderInfo.erase(PHI); |
| 893 | } else if (FutureLateResolvers) { |
| 894 | // Functions have their unresolved items forwarded to the module late |
| 895 | // resolver table |
| 896 | InsertValue(V, *FutureLateResolvers); |
| 897 | } else { |
| 898 | if (DID.Type == ValID::NameVal) { |
| 899 | error("Reference to an invalid definition: '" +DID.getName()+ |
| 900 | "' of type '" + V->getType()->getDescription() + "'", |
| 901 | PHI->second.second); |
| 902 | return; |
| 903 | } else { |
| 904 | error("Reference to an invalid definition: #" + |
| 905 | itostr(DID.Num) + " of type '" + |
| 906 | V->getType()->getDescription() + "'", PHI->second.second); |
| 907 | return; |
| 908 | } |
| 909 | } |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | LateResolvers.clear(); |
| 914 | } |
| 915 | |
| 916 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 917 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 918 | // refering to the number can be resolved. Do this now. |
| 919 | // |
| 920 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 921 | ValID D; |
| 922 | if (Name) D = ValID::create(Name); |
| 923 | else D = ValID::create((int)CurModule.Types.size()); |
| 924 | |
| 925 | std::map<ValID, PATypeHolder>::iterator I = |
| 926 | CurModule.LateResolveTypes.find(D); |
| 927 | if (I != CurModule.LateResolveTypes.end()) { |
| 928 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
| 929 | CurModule.LateResolveTypes.erase(I); |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | static std::string makeNameUnique(const std::string& Name) { |
| 934 | static unsigned UniqueNameCounter = 1; |
| 935 | std::string Result(Name); |
| 936 | Result += ".upgrd." + llvm::utostr(UniqueNameCounter++); |
| 937 | return Result; |
| 938 | } |
| 939 | |
| 940 | // setValueName - Set the specified value to the name given. The name may be |
| 941 | // null potentially, in which case this is a noop. The string passed in is |
| 942 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 943 | // |
| 944 | static void setValueName(Value *V, char *NameStr) { |
| 945 | if (NameStr) { |
| 946 | std::string Name(NameStr); // Copy string |
| 947 | free(NameStr); // Free old string |
| 948 | |
| 949 | if (V->getType() == Type::VoidTy) { |
| 950 | error("Can't assign name '" + Name + "' to value with void type"); |
| 951 | return; |
| 952 | } |
| 953 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 954 | assert(inFunctionScope() && "Must be in function scope"); |
| 955 | |
| 956 | // Search the function's symbol table for an existing value of this name |
| 957 | Value* Existing = 0; |
| 958 | SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 959 | SymbolTable::plane_const_iterator PI = ST.plane_begin(), PE =ST.plane_end(); |
| 960 | for ( ; PI != PE; ++PI) { |
| 961 | SymbolTable::value_const_iterator VI = PI->second.find(Name); |
| 962 | if (VI != PI->second.end()) { |
| 963 | Existing = VI->second; |
| 964 | break; |
| 965 | } |
| 966 | } |
| 967 | if (Existing) { |
| 968 | if (Existing->getType() == V->getType()) { |
| 969 | // The type of the Existing value and the new one are the same. This |
| 970 | // is probably a type plane collapsing error. If the types involved |
| 971 | // are both integer, just rename it. Otherwise it |
| 972 | // is a redefinition error. |
| 973 | if (!Existing->getType()->isInteger()) { |
| 974 | error("Redefinition of value named '" + Name + "' in the '" + |
| 975 | V->getType()->getDescription() + "' type plane"); |
| 976 | return; |
| 977 | } |
| 978 | } |
| 979 | // In LLVM 2.0 we don't allow names to be re-used for any values in a |
| 980 | // function, regardless of Type. Previously re-use of names was okay as |
| 981 | // long as they were distinct types. With type planes collapsing because |
| 982 | // of the signedness change and because of PR411, this can no longer be |
| 983 | // supported. We must search the entire symbol table for a conflicting |
| 984 | // name and make the name unique. No warning is needed as this can't |
| 985 | // cause a problem. |
| 986 | std::string NewName = makeNameUnique(Name); |
| 987 | // We're changing the name but it will probably be used by other |
| 988 | // instructions as operands later on. Consequently we have to retain |
| 989 | // a mapping of the renaming that we're doing. |
| 990 | RenameMapKey Key = std::make_pair(Name,V->getType()); |
| 991 | CurFun.RenameMap[Key] = NewName; |
| 992 | Name = NewName; |
| 993 | } |
| 994 | |
| 995 | // Set the name. |
| 996 | V->setName(Name); |
| 997 | } |
| 998 | } |
| 999 | |
| 1000 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1001 | /// this is a declaration, otherwise it is a definition. |
| 1002 | static GlobalVariable * |
| 1003 | ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, |
| 1004 | bool isConstantGlobal, const Type *Ty, |
| 1005 | Constant *Initializer) { |
| 1006 | if (isa<FunctionType>(Ty)) |
| 1007 | error("Cannot declare global vars of function type"); |
| 1008 | |
| 1009 | const PointerType *PTy = PointerType::get(Ty); |
| 1010 | |
| 1011 | std::string Name; |
| 1012 | if (NameStr) { |
| 1013 | Name = NameStr; // Copy string |
| 1014 | free(NameStr); // Free old string |
| 1015 | } |
| 1016 | |
| 1017 | // See if this global value was forward referenced. If so, recycle the |
| 1018 | // object. |
| 1019 | ValID ID; |
| 1020 | if (!Name.empty()) { |
| 1021 | ID = ValID::create((char*)Name.c_str()); |
| 1022 | } else { |
| 1023 | ID = ValID::create((int)CurModule.Values[PTy].size()); |
| 1024 | } |
| 1025 | |
| 1026 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1027 | // Move the global to the end of the list, from whereever it was |
| 1028 | // previously inserted. |
| 1029 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1030 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1031 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1032 | GV->setInitializer(Initializer); |
| 1033 | GV->setLinkage(Linkage); |
| 1034 | GV->setConstant(isConstantGlobal); |
| 1035 | InsertValue(GV, CurModule.Values); |
| 1036 | return GV; |
| 1037 | } |
| 1038 | |
| 1039 | // If this global has a name, check to see if there is already a definition |
| 1040 | // of this global in the module and emit warnings if there are conflicts. |
| 1041 | if (!Name.empty()) { |
| 1042 | // The global has a name. See if there's an existing one of the same name. |
| 1043 | if (CurModule.CurrentModule->getNamedGlobal(Name)) { |
| 1044 | // We found an existing global ov the same name. This isn't allowed |
| 1045 | // in LLVM 2.0. Consequently, we must alter the name of the global so it |
| 1046 | // can at least compile. This can happen because of type planes |
| 1047 | // There is alread a global of the same name which means there is a |
| 1048 | // conflict. Let's see what we can do about it. |
| 1049 | std::string NewName(makeNameUnique(Name)); |
| 1050 | if (Linkage == GlobalValue::InternalLinkage) { |
| 1051 | // The linkage type is internal so just warn about the rename without |
| 1052 | // invoking "scarey language" about linkage failures. GVars with |
| 1053 | // InternalLinkage can be renamed at will. |
| 1054 | warning("Global variable '" + Name + "' was renamed to '"+ |
| 1055 | NewName + "'"); |
| 1056 | } else { |
| 1057 | // The linkage of this gval is external so we can't reliably rename |
| 1058 | // it because it could potentially create a linking problem. |
| 1059 | // However, we can't leave the name conflict in the output either or |
| 1060 | // it won't assemble with LLVM 2.0. So, all we can do is rename |
| 1061 | // this one to something unique and emit a warning about the problem. |
| 1062 | warning("Renaming global variable '" + Name + "' to '" + NewName + |
| 1063 | "' may cause linkage errors"); |
| 1064 | } |
| 1065 | |
| 1066 | // Put the renaming in the global rename map |
| 1067 | RenameMapKey Key = std::make_pair(Name,PointerType::get(Ty)); |
| 1068 | CurModule.RenameMap[Key] = NewName; |
| 1069 | |
| 1070 | // Rename it |
| 1071 | Name = NewName; |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | // Otherwise there is no existing GV to use, create one now. |
| 1076 | GlobalVariable *GV = |
| 1077 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1078 | CurModule.CurrentModule); |
| 1079 | InsertValue(GV, CurModule.Values); |
| 1080 | return GV; |
| 1081 | } |
| 1082 | |
| 1083 | // setTypeName - Set the specified type to the name given. The name may be |
| 1084 | // null potentially, in which case this is a noop. The string passed in is |
| 1085 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1086 | // |
| 1087 | // This function returns true if the type has already been defined, but is |
| 1088 | // allowed to be redefined in the specified context. If the name is a new name |
| 1089 | // for the type plane, it is inserted and false is returned. |
| 1090 | static bool setTypeName(const Type *T, char *NameStr) { |
| 1091 | assert(!inFunctionScope() && "Can't give types function-local names"); |
| 1092 | if (NameStr == 0) return false; |
| 1093 | |
| 1094 | std::string Name(NameStr); // Copy string |
| 1095 | free(NameStr); // Free old string |
| 1096 | |
| 1097 | // We don't allow assigning names to void type |
| 1098 | if (T == Type::VoidTy) { |
| 1099 | error("Can't assign name '" + Name + "' to the void type"); |
| 1100 | return false; |
| 1101 | } |
| 1102 | |
| 1103 | // Set the type name, checking for conflicts as we do so. |
| 1104 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1105 | |
| 1106 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1107 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1108 | assert(Existing && "Conflict but no matching type?"); |
| 1109 | |
| 1110 | // There is only one case where this is allowed: when we are refining an |
| 1111 | // opaque type. In this case, Existing will be an opaque type. |
| 1112 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1113 | // We ARE replacing an opaque type! |
| 1114 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1115 | return true; |
| 1116 | } |
| 1117 | |
| 1118 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1119 | // the redefinition is identical to the original. This will be so if |
| 1120 | // Existing and T point to the same Type object. In this one case we |
| 1121 | // allow the equivalent redefinition. |
| 1122 | if (Existing == T) return true; // Yes, it's equal. |
| 1123 | |
| 1124 | // Any other kind of (non-equivalent) redefinition is an error. |
| 1125 | error("Redefinition of type named '" + Name + "' in the '" + |
| 1126 | T->getDescription() + "' type plane"); |
| 1127 | } |
| 1128 | |
| 1129 | return false; |
| 1130 | } |
| 1131 | |
| 1132 | //===----------------------------------------------------------------------===// |
| 1133 | // Code for handling upreferences in type names... |
| 1134 | // |
| 1135 | |
| 1136 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1137 | // |
| 1138 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1139 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1140 | E) != Ty->subtype_end(); |
| 1141 | } |
| 1142 | |
| 1143 | namespace { |
| 1144 | struct UpRefRecord { |
| 1145 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1146 | // this type is resolved. |
| 1147 | unsigned NestingLevel; |
| 1148 | |
| 1149 | // LastContainedTy - This is the type at the current binding level for the |
| 1150 | // type. Every time we reduce the nesting level, this gets updated. |
| 1151 | const Type *LastContainedTy; |
| 1152 | |
| 1153 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1154 | // represented with. |
| 1155 | OpaqueType *UpRefTy; |
| 1156 | |
| 1157 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1158 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1159 | }; |
| 1160 | } |
| 1161 | |
| 1162 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1163 | static std::vector<UpRefRecord> UpRefs; |
| 1164 | |
| 1165 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1166 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1167 | /// currently active types. For each type, if the up reference is contained in |
| 1168 | /// the newly completed type, we decrement the level count. When the level |
| 1169 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1170 | /// thus we can complete the cycle. |
| 1171 | /// |
| 1172 | static PATypeHolder HandleUpRefs(const Type *ty) { |
| 1173 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1174 | // nothing to resolve here. |
| 1175 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1176 | |
| 1177 | PATypeHolder Ty(ty); |
| 1178 | UR_OUT("Type '" << Ty->getDescription() << |
| 1179 | "' newly formed. Resolving upreferences.\n" << |
| 1180 | UpRefs.size() << " upreferences active!\n"); |
| 1181 | |
| 1182 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1183 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1184 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1185 | // this variable. |
| 1186 | OpaqueType *TypeToResolve = 0; |
| 1187 | |
| 1188 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1189 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1190 | << UpRefs[i].second->getDescription() << ") = " |
| 1191 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1192 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1193 | // Decrement level of upreference |
| 1194 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1195 | UpRefs[i].LastContainedTy = Ty; |
| 1196 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1197 | if (Level == 0) { // Upreference should be resolved! |
| 1198 | if (!TypeToResolve) { |
| 1199 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1200 | } else { |
| 1201 | UR_OUT(" * Resolving upreference for " |
| 1202 | << UpRefs[i].second->getDescription() << "\n"; |
| 1203 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1204 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1205 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1206 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1207 | } |
| 1208 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1209 | --i; // Do not skip the next element... |
| 1210 | } |
| 1211 | } |
| 1212 | } |
| 1213 | |
| 1214 | if (TypeToResolve) { |
| 1215 | UR_OUT(" * Resolving upreference for " |
| 1216 | << UpRefs[i].second->getDescription() << "\n"; |
| 1217 | std::string OldName = TypeToResolve->getDescription()); |
| 1218 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1219 | } |
| 1220 | |
| 1221 | return Ty; |
| 1222 | } |
| 1223 | |
| 1224 | static inline Instruction::TermOps |
| 1225 | getTermOp(TermOps op) { |
| 1226 | switch (op) { |
| 1227 | default : assert(0 && "Invalid OldTermOp"); |
| 1228 | case RetOp : return Instruction::Ret; |
| 1229 | case BrOp : return Instruction::Br; |
| 1230 | case SwitchOp : return Instruction::Switch; |
| 1231 | case InvokeOp : return Instruction::Invoke; |
| 1232 | case UnwindOp : return Instruction::Unwind; |
| 1233 | case UnreachableOp: return Instruction::Unreachable; |
| 1234 | } |
| 1235 | } |
| 1236 | |
| 1237 | static inline Instruction::BinaryOps |
| 1238 | getBinaryOp(BinaryOps op, const Type *Ty, Signedness Sign) { |
| 1239 | switch (op) { |
| 1240 | default : assert(0 && "Invalid OldBinaryOps"); |
| 1241 | case SetEQ : |
| 1242 | case SetNE : |
| 1243 | case SetLE : |
| 1244 | case SetGE : |
| 1245 | case SetLT : |
| 1246 | case SetGT : assert(0 && "Should use getCompareOp"); |
| 1247 | case AddOp : return Instruction::Add; |
| 1248 | case SubOp : return Instruction::Sub; |
| 1249 | case MulOp : return Instruction::Mul; |
| 1250 | case DivOp : { |
| 1251 | // This is an obsolete instruction so we must upgrade it based on the |
| 1252 | // types of its operands. |
| 1253 | bool isFP = Ty->isFloatingPoint(); |
| 1254 | if (const PackedType* PTy = dyn_cast<PackedType>(Ty)) |
| 1255 | // If its a packed type we want to use the element type |
| 1256 | isFP = PTy->getElementType()->isFloatingPoint(); |
| 1257 | if (isFP) |
| 1258 | return Instruction::FDiv; |
| 1259 | else if (Sign == Signed) |
| 1260 | return Instruction::SDiv; |
| 1261 | return Instruction::UDiv; |
| 1262 | } |
| 1263 | case UDivOp : return Instruction::UDiv; |
| 1264 | case SDivOp : return Instruction::SDiv; |
| 1265 | case FDivOp : return Instruction::FDiv; |
| 1266 | case RemOp : { |
| 1267 | // This is an obsolete instruction so we must upgrade it based on the |
| 1268 | // types of its operands. |
| 1269 | bool isFP = Ty->isFloatingPoint(); |
| 1270 | if (const PackedType* PTy = dyn_cast<PackedType>(Ty)) |
| 1271 | // If its a packed type we want to use the element type |
| 1272 | isFP = PTy->getElementType()->isFloatingPoint(); |
| 1273 | // Select correct opcode |
| 1274 | if (isFP) |
| 1275 | return Instruction::FRem; |
| 1276 | else if (Sign == Signed) |
| 1277 | return Instruction::SRem; |
| 1278 | return Instruction::URem; |
| 1279 | } |
| 1280 | case URemOp : return Instruction::URem; |
| 1281 | case SRemOp : return Instruction::SRem; |
| 1282 | case FRemOp : return Instruction::FRem; |
| 1283 | case AndOp : return Instruction::And; |
| 1284 | case OrOp : return Instruction::Or; |
| 1285 | case XorOp : return Instruction::Xor; |
| 1286 | } |
| 1287 | } |
| 1288 | |
| 1289 | static inline Instruction::OtherOps |
| 1290 | getCompareOp(BinaryOps op, unsigned short &predicate, const Type* &Ty, |
| 1291 | Signedness Sign) { |
| 1292 | bool isSigned = Sign == Signed; |
| 1293 | bool isFP = Ty->isFloatingPoint(); |
| 1294 | switch (op) { |
| 1295 | default : assert(0 && "Invalid OldSetCC"); |
| 1296 | case SetEQ : |
| 1297 | if (isFP) { |
| 1298 | predicate = FCmpInst::FCMP_OEQ; |
| 1299 | return Instruction::FCmp; |
| 1300 | } else { |
| 1301 | predicate = ICmpInst::ICMP_EQ; |
| 1302 | return Instruction::ICmp; |
| 1303 | } |
| 1304 | case SetNE : |
| 1305 | if (isFP) { |
| 1306 | predicate = FCmpInst::FCMP_UNE; |
| 1307 | return Instruction::FCmp; |
| 1308 | } else { |
| 1309 | predicate = ICmpInst::ICMP_NE; |
| 1310 | return Instruction::ICmp; |
| 1311 | } |
| 1312 | case SetLE : |
| 1313 | if (isFP) { |
| 1314 | predicate = FCmpInst::FCMP_OLE; |
| 1315 | return Instruction::FCmp; |
| 1316 | } else { |
| 1317 | if (isSigned) |
| 1318 | predicate = ICmpInst::ICMP_SLE; |
| 1319 | else |
| 1320 | predicate = ICmpInst::ICMP_ULE; |
| 1321 | return Instruction::ICmp; |
| 1322 | } |
| 1323 | case SetGE : |
| 1324 | if (isFP) { |
| 1325 | predicate = FCmpInst::FCMP_OGE; |
| 1326 | return Instruction::FCmp; |
| 1327 | } else { |
| 1328 | if (isSigned) |
| 1329 | predicate = ICmpInst::ICMP_SGE; |
| 1330 | else |
| 1331 | predicate = ICmpInst::ICMP_UGE; |
| 1332 | return Instruction::ICmp; |
| 1333 | } |
| 1334 | case SetLT : |
| 1335 | if (isFP) { |
| 1336 | predicate = FCmpInst::FCMP_OLT; |
| 1337 | return Instruction::FCmp; |
| 1338 | } else { |
| 1339 | if (isSigned) |
| 1340 | predicate = ICmpInst::ICMP_SLT; |
| 1341 | else |
| 1342 | predicate = ICmpInst::ICMP_ULT; |
| 1343 | return Instruction::ICmp; |
| 1344 | } |
| 1345 | case SetGT : |
| 1346 | if (isFP) { |
| 1347 | predicate = FCmpInst::FCMP_OGT; |
| 1348 | return Instruction::FCmp; |
| 1349 | } else { |
| 1350 | if (isSigned) |
| 1351 | predicate = ICmpInst::ICMP_SGT; |
| 1352 | else |
| 1353 | predicate = ICmpInst::ICMP_UGT; |
| 1354 | return Instruction::ICmp; |
| 1355 | } |
| 1356 | } |
| 1357 | } |
| 1358 | |
| 1359 | static inline Instruction::MemoryOps getMemoryOp(MemoryOps op) { |
| 1360 | switch (op) { |
| 1361 | default : assert(0 && "Invalid OldMemoryOps"); |
| 1362 | case MallocOp : return Instruction::Malloc; |
| 1363 | case FreeOp : return Instruction::Free; |
| 1364 | case AllocaOp : return Instruction::Alloca; |
| 1365 | case LoadOp : return Instruction::Load; |
| 1366 | case StoreOp : return Instruction::Store; |
| 1367 | case GetElementPtrOp : return Instruction::GetElementPtr; |
| 1368 | } |
| 1369 | } |
| 1370 | |
| 1371 | static inline Instruction::OtherOps |
| 1372 | getOtherOp(OtherOps op, Signedness Sign) { |
| 1373 | switch (op) { |
| 1374 | default : assert(0 && "Invalid OldOtherOps"); |
| 1375 | case PHIOp : return Instruction::PHI; |
| 1376 | case CallOp : return Instruction::Call; |
| 1377 | case ShlOp : return Instruction::Shl; |
| 1378 | case ShrOp : |
| 1379 | if (Sign == Signed) |
| 1380 | return Instruction::AShr; |
| 1381 | return Instruction::LShr; |
| 1382 | case SelectOp : return Instruction::Select; |
| 1383 | case UserOp1 : return Instruction::UserOp1; |
| 1384 | case UserOp2 : return Instruction::UserOp2; |
| 1385 | case VAArg : return Instruction::VAArg; |
| 1386 | case ExtractElementOp : return Instruction::ExtractElement; |
| 1387 | case InsertElementOp : return Instruction::InsertElement; |
| 1388 | case ShuffleVectorOp : return Instruction::ShuffleVector; |
| 1389 | case ICmpOp : return Instruction::ICmp; |
| 1390 | case FCmpOp : return Instruction::FCmp; |
| 1391 | case LShrOp : return Instruction::LShr; |
| 1392 | case AShrOp : return Instruction::AShr; |
| 1393 | }; |
| 1394 | } |
| 1395 | |
| 1396 | static inline Value* |
| 1397 | getCast(CastOps op, Value *Src, Signedness SrcSign, const Type *DstTy, |
| 1398 | Signedness DstSign, bool ForceInstruction = false) { |
| 1399 | Instruction::CastOps Opcode; |
| 1400 | const Type* SrcTy = Src->getType(); |
| 1401 | if (op == CastOp) { |
| 1402 | if (SrcTy->isFloatingPoint() && isa<PointerType>(DstTy)) { |
| 1403 | // fp -> ptr cast is no longer supported but we must upgrade this |
| 1404 | // by doing a double cast: fp -> int -> ptr |
| 1405 | SrcTy = Type::Int64Ty; |
| 1406 | Opcode = Instruction::IntToPtr; |
| 1407 | if (isa<Constant>(Src)) { |
| 1408 | Src = ConstantExpr::getCast(Instruction::FPToUI, |
| 1409 | cast<Constant>(Src), SrcTy); |
| 1410 | } else { |
| 1411 | std::string NewName(makeNameUnique(Src->getName())); |
| 1412 | Src = new FPToUIInst(Src, SrcTy, NewName, CurBB); |
| 1413 | } |
| 1414 | } else if (isa<IntegerType>(DstTy) && |
| 1415 | cast<IntegerType>(DstTy)->getBitWidth() == 1) { |
| 1416 | // cast type %x to bool was previously defined as setne type %x, null |
| 1417 | // The cast semantic is now to truncate, not compare so we must retain |
| 1418 | // the original intent by replacing the cast with a setne |
| 1419 | Constant* Null = Constant::getNullValue(SrcTy); |
| 1420 | Instruction::OtherOps Opcode = Instruction::ICmp; |
| 1421 | unsigned short predicate = ICmpInst::ICMP_NE; |
| 1422 | if (SrcTy->isFloatingPoint()) { |
| 1423 | Opcode = Instruction::FCmp; |
| 1424 | predicate = FCmpInst::FCMP_ONE; |
| 1425 | } else if (!SrcTy->isInteger() && !isa<PointerType>(SrcTy)) { |
| 1426 | error("Invalid cast to bool"); |
| 1427 | } |
| 1428 | if (isa<Constant>(Src) && !ForceInstruction) |
| 1429 | return ConstantExpr::getCompare(predicate, cast<Constant>(Src), Null); |
| 1430 | else |
| 1431 | return CmpInst::create(Opcode, predicate, Src, Null); |
| 1432 | } |
| 1433 | // Determine the opcode to use by calling CastInst::getCastOpcode |
| 1434 | Opcode = |
| 1435 | CastInst::getCastOpcode(Src, SrcSign == Signed, DstTy, DstSign == Signed); |
| 1436 | |
| 1437 | } else switch (op) { |
| 1438 | default: assert(0 && "Invalid cast token"); |
| 1439 | case TruncOp: Opcode = Instruction::Trunc; break; |
| 1440 | case ZExtOp: Opcode = Instruction::ZExt; break; |
| 1441 | case SExtOp: Opcode = Instruction::SExt; break; |
| 1442 | case FPTruncOp: Opcode = Instruction::FPTrunc; break; |
| 1443 | case FPExtOp: Opcode = Instruction::FPExt; break; |
| 1444 | case FPToUIOp: Opcode = Instruction::FPToUI; break; |
| 1445 | case FPToSIOp: Opcode = Instruction::FPToSI; break; |
| 1446 | case UIToFPOp: Opcode = Instruction::UIToFP; break; |
| 1447 | case SIToFPOp: Opcode = Instruction::SIToFP; break; |
| 1448 | case PtrToIntOp: Opcode = Instruction::PtrToInt; break; |
| 1449 | case IntToPtrOp: Opcode = Instruction::IntToPtr; break; |
| 1450 | case BitCastOp: Opcode = Instruction::BitCast; break; |
| 1451 | } |
| 1452 | |
| 1453 | if (isa<Constant>(Src) && !ForceInstruction) |
| 1454 | return ConstantExpr::getCast(Opcode, cast<Constant>(Src), DstTy); |
| 1455 | return CastInst::create(Opcode, Src, DstTy); |
| 1456 | } |
| 1457 | |
| 1458 | static Instruction * |
| 1459 | upgradeIntrinsicCall(const Type* RetTy, const ValID &ID, |
| 1460 | std::vector<Value*>& Args) { |
| 1461 | |
| 1462 | std::string Name = ID.Type == ValID::NameVal ? ID.Name : ""; |
| 1463 | if (Name == "llvm.isunordered.f32" || Name == "llvm.isunordered.f64") { |
| 1464 | if (Args.size() != 2) |
| 1465 | error("Invalid prototype for " + Name + " prototype"); |
| 1466 | return new FCmpInst(FCmpInst::FCMP_UNO, Args[0], Args[1]); |
| 1467 | } else { |
| 1468 | static unsigned upgradeCount = 1; |
| 1469 | const Type* PtrTy = PointerType::get(Type::Int8Ty); |
| 1470 | std::vector<const Type*> Params; |
| 1471 | if (Name == "llvm.va_start" || Name == "llvm.va_end") { |
| 1472 | if (Args.size() != 1) |
| 1473 | error("Invalid prototype for " + Name + " prototype"); |
| 1474 | Params.push_back(PtrTy); |
| 1475 | const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false); |
| 1476 | const PointerType *PFTy = PointerType::get(FTy); |
| 1477 | Value* Func = getVal(PFTy, ID); |
| 1478 | std::string InstName("va_upgrade"); |
| 1479 | InstName += llvm::utostr(upgradeCount++); |
| 1480 | Args[0] = new BitCastInst(Args[0], PtrTy, InstName, CurBB); |
| 1481 | return new CallInst(Func, Args); |
| 1482 | } else if (Name == "llvm.va_copy") { |
| 1483 | if (Args.size() != 2) |
| 1484 | error("Invalid prototype for " + Name + " prototype"); |
| 1485 | Params.push_back(PtrTy); |
| 1486 | Params.push_back(PtrTy); |
| 1487 | const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false); |
| 1488 | const PointerType *PFTy = PointerType::get(FTy); |
| 1489 | Value* Func = getVal(PFTy, ID); |
| 1490 | std::string InstName0("va_upgrade"); |
| 1491 | InstName0 += llvm::utostr(upgradeCount++); |
| 1492 | std::string InstName1("va_upgrade"); |
| 1493 | InstName1 += llvm::utostr(upgradeCount++); |
| 1494 | Args[0] = new BitCastInst(Args[0], PtrTy, InstName0, CurBB); |
| 1495 | Args[1] = new BitCastInst(Args[1], PtrTy, InstName1, CurBB); |
| 1496 | return new CallInst(Func, Args); |
| 1497 | } |
| 1498 | } |
| 1499 | return 0; |
| 1500 | } |
| 1501 | |
| 1502 | const Type* upgradeGEPIndices(const Type* PTy, |
| 1503 | std::vector<ValueInfo> *Indices, |
| 1504 | std::vector<Value*> &VIndices, |
| 1505 | std::vector<Constant*> *CIndices = 0) { |
| 1506 | // Traverse the indices with a gep_type_iterator so we can build the list |
| 1507 | // of constant and value indices for use later. Also perform upgrades |
| 1508 | VIndices.clear(); |
| 1509 | if (CIndices) CIndices->clear(); |
| 1510 | for (unsigned i = 0, e = Indices->size(); i != e; ++i) |
| 1511 | VIndices.push_back((*Indices)[i].V); |
| 1512 | generic_gep_type_iterator<std::vector<Value*>::iterator> |
| 1513 | GTI = gep_type_begin(PTy, VIndices.begin(), VIndices.end()), |
| 1514 | GTE = gep_type_end(PTy, VIndices.begin(), VIndices.end()); |
| 1515 | for (unsigned i = 0, e = Indices->size(); i != e && GTI != GTE; ++i, ++GTI) { |
| 1516 | Value *Index = VIndices[i]; |
| 1517 | if (CIndices && !isa<Constant>(Index)) |
| 1518 | error("Indices to constant getelementptr must be constants"); |
| 1519 | // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte |
| 1520 | // struct indices to i32 struct indices with ZExt for compatibility. |
| 1521 | else if (isa<StructType>(*GTI)) { // Only change struct indices |
| 1522 | if (ConstantInt *CUI = dyn_cast<ConstantInt>(Index)) |
| 1523 | if (CUI->getType()->getBitWidth() == 8) |
| 1524 | Index = |
| 1525 | ConstantExpr::getCast(Instruction::ZExt, CUI, Type::Int32Ty); |
| 1526 | } else { |
| 1527 | // Make sure that unsigned SequentialType indices are zext'd to |
| 1528 | // 64-bits if they were smaller than that because LLVM 2.0 will sext |
| 1529 | // all indices for SequentialType elements. We must retain the same |
| 1530 | // semantic (zext) for unsigned types. |
| 1531 | if (const IntegerType *Ity = dyn_cast<IntegerType>(Index->getType())) |
| 1532 | if (Ity->getBitWidth() < 64 && (*Indices)[i].S == Unsigned) |
| 1533 | if (CIndices) |
| 1534 | Index = ConstantExpr::getCast(Instruction::ZExt, |
| 1535 | cast<Constant>(Index), Type::Int64Ty); |
| 1536 | else |
| 1537 | Index = CastInst::create(Instruction::ZExt, Index, Type::Int64Ty, |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 1538 | makeNameUnique("gep_upgrade"), CurBB); |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1539 | } |
| 1540 | // Add to the CIndices list, if requested. |
| 1541 | if (CIndices) |
| 1542 | CIndices->push_back(cast<Constant>(Index)); |
| 1543 | } |
| 1544 | |
| 1545 | const Type *IdxTy = |
| 1546 | GetElementPtrInst::getIndexedType(PTy, VIndices, true); |
| 1547 | if (!IdxTy) |
| 1548 | error("Index list invalid for constant getelementptr"); |
| 1549 | return IdxTy; |
| 1550 | } |
| 1551 | |
| 1552 | Module* UpgradeAssembly(const std::string &infile, std::istream& in, |
| 1553 | bool debug, bool addAttrs) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1554 | { |
| 1555 | Upgradelineno = 1; |
| 1556 | CurFilename = infile; |
Reid Spencer | 96839be | 2006-11-30 16:50:26 +0000 | [diff] [blame] | 1557 | LexInput = ∈ |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1558 | yydebug = debug; |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 1559 | AddAttributes = addAttrs; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1560 | ObsoleteVarArgs = false; |
| 1561 | NewVarArgs = false; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1562 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1563 | CurModule.CurrentModule = new Module(CurFilename); |
| 1564 | |
| 1565 | // Check to make sure the parser succeeded |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1566 | if (yyparse()) { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1567 | if (ParserResult) |
| 1568 | delete ParserResult; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1569 | std::cerr << "llvm-upgrade: parse failed.\n"; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1570 | return 0; |
| 1571 | } |
| 1572 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1573 | // Check to make sure that parsing produced a result |
| 1574 | if (!ParserResult) { |
| 1575 | std::cerr << "llvm-upgrade: no parse result.\n"; |
| 1576 | return 0; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1577 | } |
| 1578 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1579 | // Reset ParserResult variable while saving its value for the result. |
| 1580 | Module *Result = ParserResult; |
| 1581 | ParserResult = 0; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1582 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1583 | //Not all functions use vaarg, so make a second check for ObsoleteVarArgs |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1584 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1585 | Function* F; |
| 1586 | if ((F = Result->getNamedFunction("llvm.va_start")) |
| 1587 | && F->getFunctionType()->getNumParams() == 0) |
| 1588 | ObsoleteVarArgs = true; |
| 1589 | if((F = Result->getNamedFunction("llvm.va_copy")) |
| 1590 | && F->getFunctionType()->getNumParams() == 1) |
| 1591 | ObsoleteVarArgs = true; |
Reid Spencer | 280d801 | 2006-12-01 23:40:53 +0000 | [diff] [blame] | 1592 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1593 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1594 | if (ObsoleteVarArgs && NewVarArgs) { |
| 1595 | error("This file is corrupt: it uses both new and old style varargs"); |
| 1596 | return 0; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1597 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1598 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1599 | if(ObsoleteVarArgs) { |
| 1600 | if(Function* F = Result->getNamedFunction("llvm.va_start")) { |
| 1601 | if (F->arg_size() != 0) { |
| 1602 | error("Obsolete va_start takes 0 argument"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1603 | return 0; |
| 1604 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1605 | |
| 1606 | //foo = va_start() |
| 1607 | // -> |
| 1608 | //bar = alloca typeof(foo) |
| 1609 | //va_start(bar) |
| 1610 | //foo = load bar |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1611 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1612 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1613 | const Type* ArgTy = F->getFunctionType()->getReturnType(); |
| 1614 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1615 | Function* NF = cast<Function>(Result->getOrInsertFunction( |
| 1616 | "llvm.va_start", RetTy, ArgTyPtr, (Type *)0)); |
| 1617 | |
| 1618 | while (!F->use_empty()) { |
| 1619 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1620 | AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); |
| 1621 | new CallInst(NF, bar, "", CI); |
| 1622 | Value* foo = new LoadInst(bar, "vastart.fix.2", CI); |
| 1623 | CI->replaceAllUsesWith(foo); |
| 1624 | CI->getParent()->getInstList().erase(CI); |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1625 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1626 | Result->getFunctionList().erase(F); |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1627 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1628 | |
| 1629 | if(Function* F = Result->getNamedFunction("llvm.va_end")) { |
| 1630 | if(F->arg_size() != 1) { |
| 1631 | error("Obsolete va_end takes 1 argument"); |
| 1632 | return 0; |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1633 | } |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1634 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1635 | //vaend foo |
| 1636 | // -> |
| 1637 | //bar = alloca 1 of typeof(foo) |
| 1638 | //vaend bar |
| 1639 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1640 | const Type* ArgTy = F->getFunctionType()->getParamType(0); |
| 1641 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1642 | Function* NF = cast<Function>(Result->getOrInsertFunction( |
| 1643 | "llvm.va_end", RetTy, ArgTyPtr, (Type *)0)); |
Reid Spencer | f8383de | 2007-01-06 06:04:32 +0000 | [diff] [blame] | 1644 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1645 | while (!F->use_empty()) { |
| 1646 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1647 | AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); |
| 1648 | new StoreInst(CI->getOperand(1), bar, CI); |
| 1649 | new CallInst(NF, bar, "", CI); |
| 1650 | CI->getParent()->getInstList().erase(CI); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1651 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1652 | Result->getFunctionList().erase(F); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1653 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1654 | |
| 1655 | if(Function* F = Result->getNamedFunction("llvm.va_copy")) { |
| 1656 | if(F->arg_size() != 1) { |
| 1657 | error("Obsolete va_copy takes 1 argument"); |
| 1658 | return 0; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1659 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1660 | //foo = vacopy(bar) |
| 1661 | // -> |
| 1662 | //a = alloca 1 of typeof(foo) |
| 1663 | //b = alloca 1 of typeof(foo) |
| 1664 | //store bar -> b |
| 1665 | //vacopy(a, b) |
| 1666 | //foo = load a |
| 1667 | |
| 1668 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1669 | const Type* ArgTy = F->getFunctionType()->getReturnType(); |
| 1670 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1671 | Function* NF = cast<Function>(Result->getOrInsertFunction( |
| 1672 | "llvm.va_copy", RetTy, ArgTyPtr, ArgTyPtr, (Type *)0)); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 1673 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1674 | while (!F->use_empty()) { |
| 1675 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1676 | AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); |
| 1677 | AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); |
| 1678 | new StoreInst(CI->getOperand(1), b, CI); |
| 1679 | new CallInst(NF, a, b, "", CI); |
| 1680 | Value* foo = new LoadInst(a, "vacopy.fix.3", CI); |
| 1681 | CI->replaceAllUsesWith(foo); |
| 1682 | CI->getParent()->getInstList().erase(CI); |
| 1683 | } |
| 1684 | Result->getFunctionList().erase(F); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1685 | } |
| 1686 | } |
| 1687 | |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 1688 | return Result; |
| 1689 | } |
| 1690 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1691 | } // end llvm namespace |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1692 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1693 | using namespace llvm; |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 1694 | |
| 1695 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1696 | |
| 1697 | /* Enabling traces. */ |
| 1698 | #ifndef YYDEBUG |
| 1699 | # define YYDEBUG 0 |
| 1700 | #endif |
| 1701 | |
| 1702 | /* Enabling verbose error messages. */ |
| 1703 | #ifdef YYERROR_VERBOSE |
| 1704 | # undef YYERROR_VERBOSE |
| 1705 | # define YYERROR_VERBOSE 1 |
| 1706 | #else |
| 1707 | # define YYERROR_VERBOSE 0 |
| 1708 | #endif |
| 1709 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1710 | /* Enabling the token table. */ |
| 1711 | #ifndef YYTOKEN_TABLE |
| 1712 | # define YYTOKEN_TABLE 0 |
| 1713 | #endif |
| 1714 | |
| 1715 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 1716 | #line 1337 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1717 | typedef union YYSTYPE { |
| 1718 | llvm::Module *ModuleVal; |
| 1719 | llvm::Function *FunctionVal; |
| 1720 | std::pair<llvm::PATypeInfo, char*> *ArgVal; |
| 1721 | llvm::BasicBlock *BasicBlockVal; |
| 1722 | llvm::TerminatorInst *TermInstVal; |
| 1723 | llvm::InstrInfo InstVal; |
| 1724 | llvm::ConstInfo ConstVal; |
| 1725 | llvm::ValueInfo ValueVal; |
| 1726 | llvm::PATypeInfo TypeVal; |
| 1727 | llvm::TypeInfo PrimType; |
| 1728 | llvm::PHIListInfo PHIList; |
| 1729 | std::list<llvm::PATypeInfo> *TypeList; |
| 1730 | std::vector<llvm::ValueInfo> *ValueList; |
| 1731 | std::vector<llvm::ConstInfo> *ConstVector; |
| 1732 | |
| 1733 | |
| 1734 | std::vector<std::pair<llvm::PATypeInfo,char*> > *ArgList; |
| 1735 | // Represent the RHS of PHI node |
| 1736 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
| 1737 | |
| 1738 | llvm::GlobalValue::LinkageTypes Linkage; |
| 1739 | int64_t SInt64Val; |
| 1740 | uint64_t UInt64Val; |
| 1741 | int SIntVal; |
| 1742 | unsigned UIntVal; |
| 1743 | double FPVal; |
| 1744 | bool BoolVal; |
| 1745 | |
| 1746 | char *StrVal; // This memory is strdup'd! |
| 1747 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
| 1748 | |
| 1749 | llvm::BinaryOps BinaryOpVal; |
| 1750 | llvm::TermOps TermOpVal; |
| 1751 | llvm::MemoryOps MemOpVal; |
| 1752 | llvm::OtherOps OtherOpVal; |
| 1753 | llvm::CastOps CastOpVal; |
| 1754 | llvm::ICmpInst::Predicate IPred; |
| 1755 | llvm::FCmpInst::Predicate FPred; |
| 1756 | llvm::Module::Endianness Endianness; |
| 1757 | } YYSTYPE; |
| 1758 | /* Line 196 of yacc.c. */ |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 1759 | #line 1760 "UpgradeParser.tab.c" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1760 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1761 | # define YYSTYPE_IS_DECLARED 1 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1762 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1763 | #endif |
| 1764 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1765 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1766 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1767 | /* Copy the second part of user declarations. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1768 | |
| 1769 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1770 | /* Line 219 of yacc.c. */ |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 1771 | #line 1772 "UpgradeParser.tab.c" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1772 | |
| 1773 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1774 | # define YYSIZE_T __SIZE_TYPE__ |
| 1775 | #endif |
| 1776 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1777 | # define YYSIZE_T size_t |
| 1778 | #endif |
| 1779 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1780 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1781 | # define YYSIZE_T size_t |
| 1782 | #endif |
| 1783 | #if ! defined (YYSIZE_T) |
| 1784 | # define YYSIZE_T unsigned int |
| 1785 | #endif |
| 1786 | |
| 1787 | #ifndef YY_ |
| 1788 | # if YYENABLE_NLS |
| 1789 | # if ENABLE_NLS |
| 1790 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1791 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1792 | # endif |
| 1793 | # endif |
| 1794 | # ifndef YY_ |
| 1795 | # define YY_(msgid) msgid |
| 1796 | # endif |
| 1797 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1798 | |
| 1799 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1800 | |
| 1801 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1802 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1803 | # ifdef YYSTACK_USE_ALLOCA |
| 1804 | # if YYSTACK_USE_ALLOCA |
| 1805 | # ifdef __GNUC__ |
| 1806 | # define YYSTACK_ALLOC __builtin_alloca |
Jeff Cohen | ac2dca9 | 2007-01-21 19:30:52 +0000 | [diff] [blame] | 1807 | # else |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1808 | # define YYSTACK_ALLOC alloca |
| 1809 | # if defined (__STDC__) || defined (__cplusplus) |
| 1810 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1811 | # define YYINCLUDED_STDLIB_H |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1812 | # endif |
| 1813 | # endif |
| 1814 | # endif |
| 1815 | # endif |
| 1816 | |
| 1817 | # ifdef YYSTACK_ALLOC |
| 1818 | /* Pacify GCC's `empty if-body' warning. */ |
| 1819 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1820 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1821 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1822 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1823 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1824 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1825 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1826 | # endif |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1827 | # else |
| 1828 | # define YYSTACK_ALLOC YYMALLOC |
| 1829 | # define YYSTACK_FREE YYFREE |
| 1830 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1831 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1832 | # endif |
| 1833 | # ifdef __cplusplus |
| 1834 | extern "C" { |
| 1835 | # endif |
| 1836 | # ifndef YYMALLOC |
| 1837 | # define YYMALLOC malloc |
| 1838 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1839 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1840 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1841 | # endif |
| 1842 | # endif |
| 1843 | # ifndef YYFREE |
| 1844 | # define YYFREE free |
| 1845 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1846 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1847 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1848 | # endif |
| 1849 | # endif |
| 1850 | # ifdef __cplusplus |
| 1851 | } |
| 1852 | # endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1853 | # endif |
| 1854 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1855 | |
| 1856 | |
| 1857 | #if (! defined (yyoverflow) \ |
| 1858 | && (! defined (__cplusplus) \ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1859 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1860 | |
| 1861 | /* A type that is properly aligned for any stack member. */ |
| 1862 | union yyalloc |
| 1863 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1864 | short int yyss; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1865 | YYSTYPE yyvs; |
| 1866 | }; |
| 1867 | |
| 1868 | /* The size of the maximum gap between one aligned stack and the next. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1869 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1870 | |
| 1871 | /* The size of an array large to enough to hold all stacks, each with |
| 1872 | N elements. */ |
| 1873 | # define YYSTACK_BYTES(N) \ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1874 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1875 | + YYSTACK_GAP_MAXIMUM) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1876 | |
| 1877 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1878 | not overlap. */ |
| 1879 | # ifndef YYCOPY |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1880 | # if defined (__GNUC__) && 1 < __GNUC__ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1881 | # define YYCOPY(To, From, Count) \ |
| 1882 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1883 | # else |
| 1884 | # define YYCOPY(To, From, Count) \ |
| 1885 | do \ |
| 1886 | { \ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1887 | YYSIZE_T yyi; \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1888 | for (yyi = 0; yyi < (Count); yyi++) \ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1889 | (To)[yyi] = (From)[yyi]; \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1890 | } \ |
| 1891 | while (0) |
| 1892 | # endif |
| 1893 | # endif |
| 1894 | |
| 1895 | /* Relocate STACK from its old location to the new one. The |
| 1896 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1897 | elements in the stack, and YYPTR gives the new location of the |
| 1898 | stack. Advance YYPTR to a properly aligned location for the next |
| 1899 | stack. */ |
| 1900 | # define YYSTACK_RELOCATE(Stack) \ |
| 1901 | do \ |
| 1902 | { \ |
| 1903 | YYSIZE_T yynewbytes; \ |
| 1904 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1905 | Stack = &yyptr->Stack; \ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1906 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1907 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1908 | } \ |
| 1909 | while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1910 | |
| 1911 | #endif |
| 1912 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1913 | #if defined (__STDC__) || defined (__cplusplus) |
| 1914 | typedef signed char yysigned_char; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1915 | #else |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1916 | typedef short int yysigned_char; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 1917 | #endif |
| 1918 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1919 | /* YYFINAL -- State number of the termination state. */ |
| 1920 | #define YYFINAL 4 |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1921 | /* YYLAST -- Last index in YYTABLE. */ |
| 1922 | #define YYLAST 1712 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1923 | |
| 1924 | /* YYNTOKENS -- Number of terminals. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1925 | #define YYNTOKENS 166 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1926 | /* YYNNTS -- Number of nonterminals. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1927 | #define YYNNTS 79 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1928 | /* YYNRULES -- Number of rules. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1929 | #define YYNRULES 308 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1930 | /* YYNRULES -- Number of states. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1931 | #define YYNSTATES 604 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1932 | |
| 1933 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1934 | #define YYUNDEFTOK 2 |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1935 | #define YYMAXUTOK 406 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1936 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1937 | #define YYTRANSLATE(YYX) \ |
| 1938 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1939 | |
| 1940 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1941 | static const unsigned char yytranslate[] = |
| 1942 | { |
| 1943 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1944 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1945 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1946 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1947 | 155, 156, 164, 2, 153, 2, 2, 2, 2, 2, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1948 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1949 | 160, 152, 161, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1950 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1951 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1952 | 2, 157, 154, 159, 2, 2, 2, 2, 2, 165, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1953 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1954 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1955 | 158, 2, 2, 162, 2, 163, 2, 2, 2, 2, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1956 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1957 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1958 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1959 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1960 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1961 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1962 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1963 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1964 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1965 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1966 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1967 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1968 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1969 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1970 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1971 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1972 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1973 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1974 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1975 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1976 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1977 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1978 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1979 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1980 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1981 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1982 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1983 | 145, 146, 147, 148, 149, 150, 151 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1984 | }; |
| 1985 | |
| 1986 | #if YYDEBUG |
| 1987 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1988 | YYRHS. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 1989 | static const unsigned short int yyprhs[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 1990 | { |
| 1991 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1992 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1993 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1994 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1995 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1996 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1997 | 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, |
| 1998 | 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, |
| 1999 | 159, 161, 164, 165, 167, 169, 171, 173, 175, 177, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2000 | 179, 180, 181, 183, 185, 187, 189, 191, 193, 196, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2001 | 197, 200, 201, 205, 208, 209, 211, 212, 216, 218, |
| 2002 | 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, |
| 2003 | 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, |
| 2004 | 261, 264, 269, 275, 281, 285, 288, 294, 299, 302, |
| 2005 | 304, 308, 310, 314, 316, 317, 322, 326, 330, 335, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2006 | 340, 344, 351, 357, 360, 363, 366, 369, 372, 375, |
| 2007 | 378, 381, 384, 387, 394, 400, 409, 416, 423, 430, |
| 2008 | 438, 446, 453, 460, 469, 478, 482, 484, 486, 488, |
| 2009 | 490, 493, 496, 501, 504, 506, 511, 514, 519, 520, |
| 2010 | 528, 529, 537, 538, 546, 547, 555, 559, 564, 565, |
| 2011 | 567, 569, 571, 575, 579, 583, 587, 591, 595, 597, |
| 2012 | 598, 600, 602, 604, 605, 608, 612, 614, 616, 620, |
| 2013 | 622, 623, 632, 634, 636, 640, 642, 644, 647, 648, |
| 2014 | 650, 652, 653, 658, 659, 661, 663, 665, 667, 669, |
| 2015 | 671, 673, 675, 677, 681, 683, 689, 691, 693, 695, |
| 2016 | 697, 700, 703, 706, 710, 713, 714, 716, 718, 720, |
| 2017 | 723, 726, 730, 740, 750, 759, 773, 775, 777, 784, |
| 2018 | 790, 793, 800, 808, 810, 814, 816, 817, 820, 822, |
| 2019 | 828, 834, 840, 847, 854, 857, 862, 867, 874, 879, |
| 2020 | 884, 889, 894, 901, 908, 911, 919, 921, 924, 925, |
| 2021 | 927, 928, 932, 939, 943, 950, 953, 958, 965 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2022 | }; |
| 2023 | |
| 2024 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2025 | static const short int yyrhs[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2026 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2027 | 200, 0, -1, 5, -1, 6, -1, 3, -1, 4, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2028 | -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, |
| 2029 | -1, 84, -1, 85, -1, 86, -1, 87, -1, 88, |
| 2030 | -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, |
| 2031 | -1, 94, -1, 95, -1, 96, -1, 97, -1, 98, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2032 | -1, 119, -1, 120, -1, 121, -1, 122, -1, 123, |
| 2033 | -1, 124, -1, 125, -1, 126, -1, 127, -1, 128, |
| 2034 | -1, 129, -1, 130, -1, 131, -1, 132, -1, 133, |
| 2035 | -1, 134, -1, 135, -1, 136, -1, 137, -1, 138, |
| 2036 | -1, 125, -1, 126, -1, 127, -1, 128, -1, 27, |
| 2037 | -1, 28, -1, 109, -1, 110, -1, 111, -1, 112, |
| 2038 | -1, 140, -1, 141, -1, 142, -1, 143, -1, 144, |
| 2039 | -1, 145, -1, 146, -1, 147, -1, 148, -1, 149, |
| 2040 | -1, 150, -1, 151, -1, 139, -1, 16, -1, 14, |
| 2041 | -1, 12, -1, 10, -1, 17, -1, 15, -1, 13, |
| 2042 | -1, 11, -1, 176, -1, 177, -1, 18, -1, 19, |
| 2043 | -1, 212, 152, -1, -1, 41, -1, 42, -1, 43, |
| 2044 | -1, 44, -1, 45, -1, 46, -1, 47, -1, -1, |
| 2045 | -1, 65, -1, 66, -1, 67, -1, 68, -1, 69, |
| 2046 | -1, 70, -1, 64, 4, -1, -1, 57, 4, -1, |
| 2047 | -1, 153, 57, 4, -1, 34, 24, -1, -1, 185, |
| 2048 | -1, -1, 153, 188, 187, -1, 185, -1, 57, 4, |
| 2049 | -1, 191, -1, 8, -1, 193, -1, 8, -1, 193, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2050 | -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2051 | -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, |
| 2052 | -1, 19, -1, 21, -1, 192, -1, 48, -1, 227, |
| 2053 | -1, 154, 4, -1, 190, 155, 195, 156, -1, 157, |
| 2054 | 4, 158, 193, 159, -1, 160, 4, 158, 193, 161, |
| 2055 | -1, 162, 194, 163, -1, 162, 163, -1, 160, 162, |
| 2056 | 194, 163, 161, -1, 160, 162, 163, 161, -1, 193, |
| 2057 | 164, -1, 193, -1, 194, 153, 193, -1, 194, -1, |
| 2058 | 194, 153, 37, -1, 37, -1, -1, 191, 157, 198, |
| 2059 | 159, -1, 191, 157, 159, -1, 191, 165, 24, -1, |
| 2060 | 191, 160, 198, 161, -1, 191, 162, 198, 163, -1, |
| 2061 | 191, 162, 163, -1, 191, 160, 162, 198, 163, 161, |
| 2062 | -1, 191, 160, 162, 163, 161, -1, 191, 38, -1, |
| 2063 | 191, 39, -1, 191, 227, -1, 191, 197, -1, 191, |
| 2064 | 26, -1, 176, 168, -1, 177, 4, -1, 9, 27, |
| 2065 | -1, 9, 28, -1, 179, 7, -1, 175, 155, 196, |
| 2066 | 36, 191, 156, -1, 106, 155, 196, 242, 156, -1, |
| 2067 | 108, 155, 196, 153, 196, 153, 196, 156, -1, 169, |
| 2068 | 155, 196, 153, 196, 156, -1, 170, 155, 196, 153, |
| 2069 | 196, 156, -1, 171, 155, 196, 153, 196, 156, -1, |
| 2070 | 99, 172, 155, 196, 153, 196, 156, -1, 100, 173, |
| 2071 | 155, 196, 153, 196, 156, -1, 174, 155, 196, 153, |
| 2072 | 196, 156, -1, 114, 155, 196, 153, 196, 156, -1, |
| 2073 | 115, 155, 196, 153, 196, 153, 196, 156, -1, 116, |
| 2074 | 155, 196, 153, 196, 153, 196, 156, -1, 198, 153, |
| 2075 | 196, -1, 196, -1, 32, -1, 33, -1, 201, -1, |
| 2076 | 201, 221, -1, 201, 223, -1, 201, 62, 61, 207, |
| 2077 | -1, 201, 25, -1, 202, -1, 202, 180, 20, 189, |
| 2078 | -1, 202, 223, -1, 202, 62, 61, 207, -1, -1, |
| 2079 | 202, 180, 181, 199, 196, 203, 187, -1, -1, 202, |
| 2080 | 180, 50, 199, 191, 204, 187, -1, -1, 202, 180, |
| 2081 | 45, 199, 191, 205, 187, -1, -1, 202, 180, 47, |
| 2082 | 199, 191, 206, 187, -1, 202, 51, 209, -1, 202, |
| 2083 | 58, 152, 210, -1, -1, 24, -1, 56, -1, 55, |
| 2084 | -1, 53, 152, 208, -1, 54, 152, 4, -1, 52, |
| 2085 | 152, 24, -1, 71, 152, 24, -1, 157, 211, 159, |
| 2086 | -1, 211, 153, 24, -1, 24, -1, -1, 22, -1, |
| 2087 | 24, -1, 212, -1, -1, 191, 213, -1, 215, 153, |
| 2088 | 214, -1, 214, -1, 215, -1, 215, 153, 37, -1, |
| 2089 | 37, -1, -1, 182, 189, 212, 155, 216, 156, 186, |
| 2090 | 183, -1, 29, -1, 162, -1, 181, 217, 218, -1, |
| 2091 | 30, -1, 163, -1, 230, 220, -1, -1, 45, -1, |
| 2092 | 47, -1, -1, 31, 224, 222, 217, -1, -1, 63, |
| 2093 | -1, 3, -1, 4, -1, 7, -1, 27, -1, 28, |
| 2094 | -1, 38, -1, 39, -1, 26, -1, 160, 198, 161, |
| 2095 | -1, 197, -1, 61, 225, 24, 153, 24, -1, 167, |
| 2096 | -1, 212, -1, 227, -1, 226, -1, 191, 228, -1, |
| 2097 | 230, 231, -1, 219, 231, -1, 232, 180, 234, -1, |
| 2098 | 232, 236, -1, -1, 23, -1, 77, -1, 78, -1, |
| 2099 | 72, 229, -1, 72, 8, -1, 73, 21, 228, -1, |
| 2100 | 73, 9, 228, 153, 21, 228, 153, 21, 228, -1, |
| 2101 | 74, 178, 228, 153, 21, 228, 157, 235, 159, -1, |
| 2102 | 74, 178, 228, 153, 21, 228, 157, 159, -1, 75, |
| 2103 | 182, 189, 228, 155, 239, 156, 36, 21, 228, 233, |
| 2104 | 21, 228, -1, 233, -1, 76, -1, 235, 178, 226, |
| 2105 | 153, 21, 228, -1, 178, 226, 153, 21, 228, -1, |
| 2106 | 180, 241, -1, 191, 157, 228, 153, 228, 159, -1, |
| 2107 | 237, 153, 157, 228, 153, 228, 159, -1, 229, -1, |
| 2108 | 238, 153, 229, -1, 238, -1, -1, 60, 59, -1, |
| 2109 | 59, -1, 169, 191, 228, 153, 228, -1, 170, 191, |
| 2110 | 228, 153, 228, -1, 171, 191, 228, 153, 228, -1, |
| 2111 | 99, 172, 191, 228, 153, 228, -1, 100, 173, 191, |
| 2112 | 228, 153, 228, -1, 49, 229, -1, 174, 229, 153, |
| 2113 | 229, -1, 175, 229, 36, 191, -1, 108, 229, 153, |
| 2114 | 229, 153, 229, -1, 113, 229, 153, 191, -1, 117, |
| 2115 | 229, 153, 191, -1, 118, 229, 153, 191, -1, 114, |
| 2116 | 229, 153, 229, -1, 115, 229, 153, 229, 153, 229, |
| 2117 | -1, 116, 229, 153, 229, 153, 229, -1, 107, 237, |
| 2118 | -1, 240, 182, 189, 228, 155, 239, 156, -1, 244, |
| 2119 | -1, 153, 238, -1, -1, 35, -1, -1, 101, 191, |
| 2120 | 184, -1, 101, 191, 153, 15, 228, 184, -1, 102, |
| 2121 | 191, 184, -1, 102, 191, 153, 15, 228, 184, -1, |
| 2122 | 103, 229, -1, 243, 104, 191, 228, -1, 243, 105, |
| 2123 | 229, 153, 191, 228, -1, 106, 191, 228, 242, -1 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2124 | }; |
| 2125 | |
| 2126 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2127 | static const unsigned short int yyrline[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2128 | { |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 2129 | 0, 1477, 1477, 1478, 1486, 1487, 1497, 1497, 1497, 1497, |
| 2130 | 1497, 1497, 1497, 1497, 1497, 1497, 1497, 1501, 1501, 1501, |
| 2131 | 1505, 1505, 1505, 1505, 1505, 1505, 1509, 1509, 1510, 1510, |
| 2132 | 1511, 1511, 1512, 1512, 1513, 1513, 1517, 1517, 1518, 1518, |
| 2133 | 1519, 1519, 1520, 1520, 1521, 1521, 1522, 1522, 1523, 1523, |
| 2134 | 1524, 1525, 1528, 1528, 1528, 1528, 1532, 1532, 1532, 1532, |
| 2135 | 1532, 1532, 1532, 1533, 1533, 1533, 1533, 1533, 1533, 1539, |
| 2136 | 1539, 1539, 1539, 1543, 1543, 1543, 1543, 1547, 1547, 1551, |
| 2137 | 1551, 1556, 1559, 1564, 1565, 1566, 1567, 1568, 1569, 1570, |
| 2138 | 1571, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1592, |
| 2139 | 1593, 1601, 1602, 1610, 1619, 1620, 1627, 1628, 1632, 1636, |
| 2140 | 1652, 1653, 1660, 1661, 1668, 1676, 1676, 1676, 1676, 1676, |
| 2141 | 1676, 1676, 1677, 1677, 1677, 1677, 1677, 1682, 1686, 1690, |
| 2142 | 1695, 1704, 1720, 1726, 1739, 1748, 1752, 1763, 1767, 1780, |
| 2143 | 1784, 1791, 1792, 1798, 1805, 1817, 1847, 1860, 1883, 1911, |
| 2144 | 1933, 1944, 1966, 1977, 1986, 1991, 2049, 2056, 2064, 2071, |
| 2145 | 2078, 2082, 2086, 2095, 2110, 2123, 2132, 2160, 2173, 2182, |
| 2146 | 2188, 2194, 2203, 2209, 2215, 2226, 2227, 2236, 2237, 2249, |
| 2147 | 2258, 2259, 2260, 2261, 2262, 2278, 2298, 2300, 2302, 2302, |
| 2148 | 2309, 2309, 2316, 2316, 2323, 2323, 2331, 2333, 2335, 2340, |
| 2149 | 2354, 2355, 2359, 2362, 2370, 2374, 2381, 2385, 2389, 2393, |
| 2150 | 2401, 2401, 2405, 2406, 2410, 2418, 2423, 2431, 2432, 2439, |
| 2151 | 2446, 2450, 2556, 2556, 2560, 2570, 2570, 2574, 2578, 2580, |
| 2152 | 2581, 2585, 2585, 2597, 2598, 2603, 2604, 2605, 2606, 2607, |
| 2153 | 2608, 2609, 2610, 2611, 2632, 2635, 2650, 2651, 2656, 2656, |
| 2154 | 2664, 2673, 2676, 2685, 2695, 2700, 2709, 2720, 2720, 2723, |
| 2155 | 2726, 2729, 2733, 2739, 2754, 2760, 2811, 2814, 2820, 2830, |
| 2156 | 2843, 2872, 2880, 2888, 2892, 2899, 2900, 2904, 2907, 2913, |
| 2157 | 2930, 2946, 2960, 2972, 2984, 2995, 3004, 3013, 3022, 3029, |
| 2158 | 3050, 3074, 3080, 3086, 3092, 3108, 3181, 3189, 3190, 3194, |
| 2159 | 3195, 3199, 3205, 3211, 3217, 3223, 3230, 3242, 3256 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2160 | }; |
| 2161 | #endif |
| 2162 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2163 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 2164 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2165 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 2166 | static const char *const yytname[] = |
| 2167 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2168 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", |
| 2169 | "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", |
| 2170 | "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", |
| 2171 | "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", |
| 2172 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 2173 | "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 2174 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", |
| 2175 | "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 2176 | "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", |
| 2177 | "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", |
| 2178 | "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", |
| 2179 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 2180 | "RET", "BR", "SWITCH", "INVOKE", "UNREACHABLE", "UNWIND", "EXCEPT", |
| 2181 | "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM", |
| 2182 | "SREM", "FREM", "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", |
| 2183 | "SETEQ", "SETNE", "ICMP", "FCMP", "MALLOC", "ALLOCA", "FREE", "LOAD", |
| 2184 | "STORE", "GETELEMENTPTR", "PHI_TOK", "SELECT", "SHL", "SHR", "ASHR", |
| 2185 | "LSHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
| 2186 | "VAARG_old", "VANEXT_old", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", |
| 2187 | "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", |
| 2188 | "UNO", "UEQ", "UNE", "CAST", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", |
| 2189 | "FPTOUI", "FPTOSI", "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", |
| 2190 | "BITCAST", "'='", "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", |
| 2191 | "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", "INTVAL", |
| 2192 | "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", "IPredicates", |
| 2193 | "FPredicates", "ShiftOps", "CastOps", "SIntType", "UIntType", "IntType", |
| 2194 | "FPType", "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign", |
| 2195 | "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes", |
| 2196 | "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType", |
| 2197 | "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr", |
| 2198 | "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1", |
| 2199 | "@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition", |
| 2200 | "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", |
| 2201 | "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", |
| 2202 | "END", "Function", "FnDeclareLinkage", "FunctionProto", "@5", |
| 2203 | "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", |
| 2204 | "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", |
| 2205 | "Unwind", "BBTerminatorInst", "JumpTable", "Inst", "PHIList", |
| 2206 | "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList", |
Jeff Cohen | ac2dca9 | 2007-01-21 19:30:52 +0000 | [diff] [blame] | 2207 | "OptVolatile", "MemoryInst", 0 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2208 | }; |
| 2209 | #endif |
| 2210 | |
| 2211 | # ifdef YYPRINT |
| 2212 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 2213 | token YYLEX-NUM. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2214 | static const unsigned short int yytoknum[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2215 | { |
| 2216 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 2217 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 2218 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 2219 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 2220 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 2221 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 2222 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 2223 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 2224 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 2225 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 2226 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 2227 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 2228 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 2229 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 2230 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2231 | 405, 406, 61, 44, 92, 40, 41, 91, 120, 93, |
| 2232 | 60, 62, 123, 125, 42, 99 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2233 | }; |
| 2234 | # endif |
| 2235 | |
| 2236 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 2237 | static const unsigned char yyr1[] = |
| 2238 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2239 | 0, 166, 167, 167, 168, 168, 169, 169, 169, 169, |
| 2240 | 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, |
| 2241 | 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, |
| 2242 | 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, |
| 2243 | 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, |
| 2244 | 173, 173, 174, 174, 174, 174, 175, 175, 175, 175, |
| 2245 | 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, |
| 2246 | 176, 176, 176, 177, 177, 177, 177, 178, 178, 179, |
| 2247 | 179, 180, 180, 181, 181, 181, 181, 181, 181, 181, |
| 2248 | 181, 182, 182, 182, 182, 182, 182, 182, 182, 183, |
| 2249 | 183, 184, 184, 185, 186, 186, 187, 187, 188, 188, |
| 2250 | 189, 189, 190, 190, 191, 192, 192, 192, 192, 192, |
| 2251 | 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, |
| 2252 | 193, 193, 193, 193, 193, 193, 193, 193, 193, 194, |
| 2253 | 194, 195, 195, 195, 195, 196, 196, 196, 196, 196, |
| 2254 | 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, |
| 2255 | 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, |
| 2256 | 197, 197, 197, 197, 197, 198, 198, 199, 199, 200, |
| 2257 | 201, 201, 201, 201, 201, 202, 202, 202, 203, 202, |
| 2258 | 204, 202, 205, 202, 206, 202, 202, 202, 202, 207, |
| 2259 | 208, 208, 209, 209, 209, 209, 210, 211, 211, 211, |
| 2260 | 212, 212, 213, 213, 214, 215, 215, 216, 216, 216, |
| 2261 | 216, 217, 218, 218, 219, 220, 220, 221, 222, 222, |
| 2262 | 222, 224, 223, 225, 225, 226, 226, 226, 226, 226, |
| 2263 | 226, 226, 226, 226, 226, 226, 227, 227, 228, 228, |
| 2264 | 229, 230, 230, 231, 232, 232, 232, 233, 233, 234, |
| 2265 | 234, 234, 234, 234, 234, 234, 234, 234, 235, 235, |
| 2266 | 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, |
| 2267 | 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, |
| 2268 | 241, 241, 241, 241, 241, 241, 241, 242, 242, 243, |
| 2269 | 243, 244, 244, 244, 244, 244, 244, 244, 244 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2270 | }; |
| 2271 | |
| 2272 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 2273 | static const unsigned char yyr2[] = |
| 2274 | { |
| 2275 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2276 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2277 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2278 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2279 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2280 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2281 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2282 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2283 | 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2284 | 0, 0, 1, 1, 1, 1, 1, 1, 2, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2285 | 2, 0, 3, 2, 0, 1, 0, 3, 1, 2, |
| 2286 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2287 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2288 | 2, 4, 5, 5, 3, 2, 5, 4, 2, 1, |
| 2289 | 3, 1, 3, 1, 0, 4, 3, 3, 4, 4, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2290 | 3, 6, 5, 2, 2, 2, 2, 2, 2, 2, |
| 2291 | 2, 2, 2, 6, 5, 8, 6, 6, 6, 7, |
| 2292 | 7, 6, 6, 8, 8, 3, 1, 1, 1, 1, |
| 2293 | 2, 2, 4, 2, 1, 4, 2, 4, 0, 7, |
| 2294 | 0, 7, 0, 7, 0, 7, 3, 4, 0, 1, |
| 2295 | 1, 1, 3, 3, 3, 3, 3, 3, 1, 0, |
| 2296 | 1, 1, 1, 0, 2, 3, 1, 1, 3, 1, |
| 2297 | 0, 8, 1, 1, 3, 1, 1, 2, 0, 1, |
| 2298 | 1, 0, 4, 0, 1, 1, 1, 1, 1, 1, |
| 2299 | 1, 1, 1, 3, 1, 5, 1, 1, 1, 1, |
| 2300 | 2, 2, 2, 3, 2, 0, 1, 1, 1, 2, |
| 2301 | 2, 3, 9, 9, 8, 13, 1, 1, 6, 5, |
| 2302 | 2, 6, 7, 1, 3, 1, 0, 2, 1, 5, |
| 2303 | 5, 5, 6, 6, 2, 4, 4, 6, 4, 4, |
| 2304 | 4, 4, 6, 6, 2, 7, 1, 2, 0, 1, |
| 2305 | 0, 3, 6, 3, 6, 2, 4, 6, 4 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2306 | }; |
| 2307 | |
| 2308 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 2309 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 2310 | means the default is an error. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2311 | static const unsigned short int yydefact[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2312 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2313 | 198, 0, 90, 184, 1, 183, 231, 83, 84, 85, |
| 2314 | 86, 87, 88, 89, 0, 91, 255, 180, 181, 255, |
| 2315 | 210, 211, 0, 0, 0, 90, 0, 186, 228, 0, |
| 2316 | 0, 92, 93, 94, 95, 96, 97, 0, 0, 256, |
| 2317 | 252, 82, 225, 226, 227, 251, 0, 0, 0, 0, |
| 2318 | 196, 0, 0, 0, 0, 0, 0, 0, 81, 229, |
| 2319 | 230, 91, 199, 182, 98, 2, 3, 111, 115, 116, |
| 2320 | 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 2321 | 128, 0, 0, 0, 0, 246, 0, 0, 110, 127, |
| 2322 | 114, 247, 129, 222, 223, 224, 300, 254, 0, 0, |
| 2323 | 0, 0, 209, 197, 187, 185, 177, 178, 0, 0, |
| 2324 | 0, 0, 232, 130, 0, 0, 0, 113, 135, 139, |
| 2325 | 0, 0, 144, 138, 299, 0, 278, 0, 0, 0, |
| 2326 | 0, 91, 267, 257, 258, 6, 7, 8, 9, 10, |
| 2327 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 2328 | 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, |
| 2329 | 0, 0, 0, 52, 53, 54, 55, 0, 0, 0, |
| 2330 | 0, 0, 0, 68, 56, 57, 58, 59, 60, 61, |
| 2331 | 62, 63, 64, 65, 66, 67, 0, 0, 0, 0, |
| 2332 | 0, 266, 253, 91, 270, 0, 296, 204, 201, 200, |
| 2333 | 202, 203, 205, 208, 0, 192, 194, 190, 115, 116, |
| 2334 | 117, 118, 119, 120, 121, 122, 123, 124, 125, 0, |
| 2335 | 0, 0, 0, 188, 0, 0, 0, 0, 0, 134, |
| 2336 | 220, 143, 141, 0, 0, 284, 277, 260, 259, 0, |
| 2337 | 0, 72, 76, 71, 75, 70, 74, 69, 73, 77, |
| 2338 | 78, 0, 0, 26, 27, 28, 29, 30, 31, 32, |
| 2339 | 33, 34, 35, 0, 50, 51, 46, 47, 48, 49, |
| 2340 | 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, |
| 2341 | 0, 101, 101, 305, 0, 0, 294, 0, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2342 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2343 | 0, 0, 0, 206, 106, 106, 106, 160, 161, 4, |
| 2344 | 5, 158, 159, 162, 157, 153, 154, 0, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2345 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2346 | 0, 0, 0, 156, 155, 106, 112, 112, 137, 0, |
| 2347 | 140, 219, 213, 216, 217, 0, 0, 131, 235, 236, |
| 2348 | 237, 242, 238, 239, 240, 241, 233, 0, 244, 249, |
| 2349 | 248, 250, 0, 261, 0, 0, 0, 0, 0, 301, |
| 2350 | 0, 303, 298, 0, 0, 0, 0, 0, 0, 0, |
| 2351 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2352 | 207, 0, 193, 195, 191, 0, 0, 0, 0, 0, |
| 2353 | 0, 0, 146, 176, 0, 0, 0, 150, 0, 147, |
| 2354 | 0, 0, 0, 0, 0, 189, 132, 133, 136, 212, |
| 2355 | 214, 0, 104, 142, 234, 0, 0, 0, 0, 0, |
| 2356 | 0, 0, 0, 0, 0, 0, 308, 0, 0, 0, |
| 2357 | 288, 291, 0, 0, 289, 290, 0, 0, 0, 285, |
| 2358 | 286, 0, 306, 0, 0, 0, 108, 106, 0, 0, |
| 2359 | 298, 0, 0, 0, 0, 0, 145, 135, 114, 0, |
| 2360 | 148, 149, 0, 0, 0, 0, 0, 218, 215, 105, |
| 2361 | 99, 0, 243, 0, 0, 276, 0, 0, 101, 102, |
| 2362 | 101, 273, 297, 0, 0, 0, 0, 0, 279, 280, |
| 2363 | 281, 276, 0, 103, 109, 107, 0, 0, 0, 0, |
| 2364 | 0, 0, 0, 175, 152, 0, 0, 0, 0, 0, |
| 2365 | 0, 0, 221, 0, 0, 0, 275, 0, 282, 283, |
| 2366 | 0, 302, 304, 0, 0, 0, 287, 292, 293, 0, |
| 2367 | 307, 0, 0, 164, 0, 0, 0, 0, 151, 0, |
| 2368 | 0, 0, 0, 0, 100, 245, 0, 0, 0, 274, |
| 2369 | 271, 0, 295, 0, 0, 0, 172, 0, 0, 166, |
| 2370 | 167, 168, 171, 163, 0, 264, 0, 0, 0, 272, |
| 2371 | 169, 170, 0, 0, 0, 262, 0, 263, 0, 0, |
| 2372 | 165, 173, 174, 0, 0, 0, 0, 0, 0, 269, |
| 2373 | 0, 0, 268, 265 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2374 | }; |
| 2375 | |
| 2376 | /* YYDEFGOTO[NTERM-NUM]. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2377 | static const short int yydefgoto[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2378 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2379 | -1, 85, 311, 328, 329, 330, 263, 280, 331, 332, |
| 2380 | 219, 220, 251, 221, 25, 15, 37, 522, 369, 456, |
| 2381 | 480, 392, 457, 86, 87, 222, 89, 90, 120, 233, |
| 2382 | 403, 358, 404, 108, 1, 2, 3, 335, 306, 304, |
| 2383 | 305, 63, 200, 50, 103, 204, 91, 420, 343, 344, |
| 2384 | 345, 38, 95, 16, 44, 17, 61, 18, 28, 425, |
| 2385 | 359, 92, 361, 491, 19, 40, 41, 191, 192, 577, |
| 2386 | 97, 286, 526, 527, 193, 194, 436, 195, 196 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2387 | }; |
| 2388 | |
| 2389 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2390 | STATE-NUM. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2391 | #define YYPACT_NINF -508 |
| 2392 | static const short int yypact[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2393 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2394 | -508, 18, 144, 546, -508, -508, -508, -508, -508, -508, |
| 2395 | -508, -508, -508, -508, 2, 152, 47, -508, -508, -15, |
| 2396 | -508, -508, -30, -75, 29, 69, -10, -508, 98, 104, |
| 2397 | 151, -508, -508, -508, -508, -508, -508, 1307, -8, -508, |
| 2398 | -508, 149, -508, -508, -508, -508, 11, 20, 22, 24, |
| 2399 | -508, 27, 104, 1307, 0, 0, 0, 0, -508, -508, |
| 2400 | -508, 152, -508, -508, -508, -508, -508, 37, -508, -508, |
| 2401 | -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, |
| 2402 | -508, 194, 200, 3, 695, -508, 149, 54, -508, -508, |
| 2403 | -81, -508, -508, -508, -508, -508, 1561, -508, 186, -19, |
| 2404 | 210, 188, 203, -508, -508, -508, -508, -508, 1368, 1368, |
| 2405 | 1368, 1409, -508, -508, 66, 70, 715, -508, -508, -81, |
| 2406 | -85, 75, 781, -508, -508, 1368, -508, 172, 1429, 58, |
| 2407 | 255, 152, -508, -508, -508, -508, -508, -508, -508, -508, |
| 2408 | -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, |
| 2409 | -508, -508, -508, -508, -508, 208, 394, 1368, 1368, 1368, |
| 2410 | 1368, 1368, 1368, -508, -508, -508, -508, 1368, 1368, 1368, |
| 2411 | 1368, 1368, 1368, -508, -508, -508, -508, -508, -508, -508, |
| 2412 | -508, -508, -508, -508, -508, -508, 1368, 1368, 1368, 1368, |
| 2413 | 1368, -508, -508, 152, -508, 55, -508, -508, -508, -508, |
| 2414 | -508, -508, -508, -508, -50, -508, -508, -508, 153, 179, |
| 2415 | 228, 191, 229, 193, 230, 197, 231, 233, 234, 199, |
| 2416 | 232, 235, 537, -508, 1368, 1368, 84, -45, 1368, -508, |
| 2417 | 1149, -508, 93, 91, 898, -508, -508, 37, -508, 898, |
| 2418 | 898, -508, -508, -508, -508, -508, -508, -508, -508, -508, |
| 2419 | -508, 898, 1307, -508, -508, -508, -508, -508, -508, -508, |
| 2420 | -508, -508, -508, 1368, -508, -508, -508, -508, -508, -508, |
| 2421 | -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, |
| 2422 | 1368, 95, 96, -508, 898, 99, 97, 105, 106, 107, |
| 2423 | 120, 123, 126, 127, 898, 898, 898, 128, 221, 1307, |
| 2424 | 1368, 1368, 258, -508, 132, 132, 132, -508, -508, -508, |
| 2425 | -508, -508, -508, -508, -508, -508, -508, 208, 394, 131, |
| 2426 | 134, 135, 136, 137, 1190, 1470, 736, 259, 139, 140, |
| 2427 | 141, 142, 148, -508, -508, 132, -130, -23, -508, 143, |
| 2428 | -81, -508, 149, -508, 155, 154, 1210, -508, -508, -508, |
| 2429 | -508, -508, -508, -508, -508, -508, 224, 1409, -508, -508, |
| 2430 | -508, -508, 156, -508, 163, 898, 898, 898, 4, -508, |
| 2431 | 5, -508, 164, 898, 162, 1368, 1368, 1368, 1368, 1368, |
| 2432 | 1368, 1368, 167, 168, 169, 1368, 1368, 898, 898, 170, |
| 2433 | -508, -17, -508, -508, -508, 150, 182, 1409, 1409, 1409, |
| 2434 | 1409, 1409, -508, -508, -13, 756, -24, -508, -36, -508, |
| 2435 | 1409, 1409, 1409, 1409, 1409, -508, -508, -508, -508, -508, |
| 2436 | -508, 1251, 290, -508, -508, 301, -14, 324, 325, 198, |
| 2437 | 201, 202, 898, 348, 898, 1368, -508, 204, 898, 205, |
| 2438 | -508, -508, 211, 214, -508, -508, 898, 898, 898, -508, |
| 2439 | -508, 213, -508, 1368, 332, 365, -508, 132, 1409, 1409, |
| 2440 | 164, 217, 222, 223, 225, 1409, -508, 216, -71, -27, |
| 2441 | -508, -508, 226, 236, 237, 240, 338, -508, -508, -508, |
| 2442 | 326, 241, -508, 898, 898, 1368, 898, 898, 242, -508, |
| 2443 | 242, -508, 243, 898, 244, 1368, 1368, 1368, -508, -508, |
| 2444 | -508, 1368, 898, -508, -508, -508, 246, 247, 245, 1409, |
| 2445 | 1409, 1409, 1409, -508, -508, 220, 1409, 1409, 1409, 1409, |
| 2446 | 1368, 378, -508, 361, 249, 248, 243, 250, -508, -508, |
| 2447 | 329, -508, -508, 1368, 256, 898, -508, -508, -508, 251, |
| 2448 | -508, 1409, 1409, -508, 261, 252, 270, 271, -508, 269, |
| 2449 | 272, 275, 279, 280, -508, -508, 367, 40, 368, -508, |
| 2450 | -508, 267, -508, 281, 282, 1409, -508, 1409, 1409, -508, |
| 2451 | -508, -508, -508, -508, 898, -508, 996, 85, 382, -508, |
| 2452 | -508, -508, 283, 285, 288, -508, 274, -508, 996, 898, |
| 2453 | -508, -508, -508, 424, 293, 130, 898, 426, 430, -508, |
| 2454 | 898, 898, -508, -508 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2455 | }; |
| 2456 | |
| 2457 | /* YYPGOTO[NTERM-NUM]. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2458 | static const short int yypgoto[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2459 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2460 | -508, -508, -508, 356, 357, 360, 145, 147, 371, 374, |
| 2461 | -128, -127, -497, -508, 416, 436, -117, -508, -277, 41, |
| 2462 | -508, -296, -508, -47, -508, -37, -508, -58, 46, -508, |
| 2463 | -99, 253, -298, 49, -508, -508, -508, -508, -508, -508, |
| 2464 | -508, 419, -508, -508, -508, -508, 8, -508, 51, -508, |
| 2465 | -508, 412, -508, -508, -508, -508, -508, 471, -508, -508, |
| 2466 | -507, -209, 67, -124, -508, 457, -508, -118, -508, -508, |
| 2467 | -508, -508, 43, -22, -508, -508, 21, -508, -508 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2468 | }; |
| 2469 | |
| 2470 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2471 | positive, shift that token. If negative, reduce the rule which |
| 2472 | number is the opposite. If zero, do what YYDEFACT says. |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2473 | If YYTABLE_NINF, syntax error. */ |
| 2474 | #define YYTABLE_NINF -180 |
| 2475 | static const short int yytable[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2476 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2477 | 88, 235, 249, 250, 238, 371, 105, 115, 39, 393, |
| 2478 | 394, 26, 223, 334, 252, 42, 88, 454, 4, 432, |
| 2479 | 434, 93, 46, 47, 48, 360, 119, 406, 408, 416, |
| 2480 | 360, 360, 106, 107, 123, 283, 198, 199, 287, 415, |
| 2481 | 455, 49, 360, 288, 289, 290, 291, 292, 293, 26, |
| 2482 | 241, 242, 243, 244, 245, 246, 247, 248, 119, 426, |
| 2483 | 576, 433, 433, 29, 119, 297, 298, 239, 228, 586, |
| 2484 | 39, 205, 206, 207, -112, 360, 299, 51, 229, 240, |
| 2485 | 588, 594, -139, 123, -112, 360, 360, 360, 234, 53, |
| 2486 | 52, 234, -139, 123, 121, 241, 242, 243, 244, 245, |
| 2487 | 246, 247, 248, 302, 109, 110, 111, 469, 228, 303, |
| 2488 | 7, 8, 9, 10, 54, 12, 55, 465, 339, 56, |
| 2489 | 281, 282, 234, 284, 285, 234, 465, 471, 62, 465, |
| 2490 | 234, 234, 234, 234, 234, 234, 515, 470, 417, 465, |
| 2491 | 465, 123, 58, 59, -179, 60, 466, 482, 43, 294, |
| 2492 | 295, 296, 234, 234, 94, 64, 360, 360, 360, 300, |
| 2493 | 301, 505, 227, 98, 360, 116, 336, 337, 232, 5, |
| 2494 | 340, 20, 99, 21, 100, 6, 101, 389, 360, 360, |
| 2495 | 307, 308, -72, -72, 102, 7, 8, 9, 10, 11, |
| 2496 | 12, 13, -113, 342, -71, -71, -70, -70, 113, 575, |
| 2497 | -69, -69, 309, 310, 114, 365, 14, 133, 134, 122, |
| 2498 | 197, 531, 202, 532, 201, 88, 30, 31, 32, 33, |
| 2499 | 34, 35, 36, 360, 224, 360, 366, 203, 225, 360, |
| 2500 | 230, 236, -76, -75, -74, -73, 312, 360, 360, 360, |
| 2501 | -79, -80, 313, 367, 587, 338, 346, 347, 368, 370, |
| 2502 | 374, 439, 387, 441, 442, 443, 373, 386, 375, 376, |
| 2503 | 377, 449, 88, 388, 234, 241, 242, 243, 244, 245, |
| 2504 | 246, 247, 248, 378, 360, 360, 379, 360, 360, 380, |
| 2505 | 381, 385, 390, 409, 360, 391, 397, 424, 340, 398, |
| 2506 | 399, 400, 401, 360, 410, 411, 412, 413, 460, 461, |
| 2507 | 462, 463, 464, 414, 418, 458, 362, 363, 421, 427, |
| 2508 | 422, 472, 473, 474, 475, 476, 428, 435, 364, 438, |
| 2509 | 446, 447, 448, 453, 454, 481, 360, 253, 254, 255, |
| 2510 | 256, 257, 258, 259, 260, 261, 262, 459, 234, 440, |
| 2511 | 234, 234, 234, 444, 445, 483, 484, 468, 234, 450, |
| 2512 | 419, 372, 489, 485, 486, 487, 503, 493, 495, 506, |
| 2513 | 507, 382, 383, 384, 496, 360, 513, 497, 501, 504, |
| 2514 | 509, 536, 537, 538, 520, 510, 511, 514, 512, 516, |
| 2515 | 360, 548, 554, 521, 342, 555, 433, 360, 574, 517, |
| 2516 | 518, 360, 360, 519, 523, 530, 533, 535, 234, 541, |
| 2517 | 542, 543, 556, 589, 578, 557, 558, 562, 566, 559, |
| 2518 | 544, 545, 546, 547, 565, 560, 502, 549, 550, 551, |
| 2519 | 552, 264, 265, 567, 568, 569, 579, 593, 570, 249, |
| 2520 | 250, 571, 429, 430, 431, 572, 573, 580, 581, 590, |
| 2521 | 437, 591, 563, 564, 592, 596, 597, 600, 234, 249, |
| 2522 | 250, 601, 186, 187, 451, 452, 188, 96, 234, 234, |
| 2523 | 234, 57, 395, 479, 234, 396, 582, 189, 583, 584, |
| 2524 | 190, 104, 478, 112, 27, 333, 45, 598, 492, 539, |
| 2525 | 0, 508, 0, 553, 0, 0, 0, 0, 0, 0, |
| 2526 | 0, 0, 0, 0, 0, 0, 234, 0, 0, 488, |
| 2527 | 0, 490, 0, 0, 0, 494, 0, 0, 0, 0, |
| 2528 | 0, 0, 0, 498, 499, 500, 0, 0, 0, 266, |
| 2529 | 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, |
| 2530 | 277, 278, 279, 0, 0, 0, 0, 0, 0, 0, |
| 2531 | 0, 0, 65, 66, 0, 0, 0, 0, 0, 0, |
| 2532 | 524, 525, 0, 528, 529, 0, 0, 0, 0, 20, |
| 2533 | 534, 21, 0, 314, 0, 0, -82, 0, 20, 540, |
| 2534 | 21, 0, 0, 0, 0, 315, 316, 6, -82, -82, |
| 2535 | 0, 0, 0, 0, 0, 0, 0, -82, -82, -82, |
| 2536 | -82, -82, -82, -82, 0, 0, -82, 22, 0, 0, |
| 2537 | 0, 0, 561, 0, 23, 0, 0, 0, 24, 0, |
| 2538 | 0, 0, 0, 0, 0, 0, 135, 136, 137, 138, |
| 2539 | 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, |
| 2540 | 149, 150, 151, 152, 153, 154, 317, 318, 0, 0, |
| 2541 | 0, 585, 0, 319, 0, 320, 163, 164, 165, 166, |
| 2542 | 0, 321, 322, 323, 0, 0, 595, 0, 0, 0, |
| 2543 | 0, 0, 0, 599, 0, 0, 0, 602, 603, 0, |
| 2544 | 0, 0, 0, 0, 0, 0, 173, 174, 175, 176, |
| 2545 | 177, 178, 179, 180, 181, 182, 183, 184, 185, 0, |
| 2546 | 0, 0, 0, 0, 324, 0, 0, 325, 0, 326, |
| 2547 | 65, 66, 327, 117, 68, 69, 70, 71, 72, 73, |
| 2548 | 74, 75, 76, 77, 78, 0, 79, 20, 0, 21, |
| 2549 | 65, 66, 0, 117, 68, 69, 70, 71, 72, 73, |
| 2550 | 74, 75, 76, 77, 78, 0, 79, 20, 0, 21, |
| 2551 | 0, 65, 66, 80, 117, 208, 209, 210, 211, 212, |
| 2552 | 213, 214, 215, 216, 217, 218, 0, 79, 20, 0, |
| 2553 | 21, 65, 66, 80, 117, 208, 209, 210, 211, 212, |
| 2554 | 213, 214, 215, 216, 217, 218, 0, 79, 20, 0, |
| 2555 | 21, 0, 0, 0, 80, 0, 65, 66, 0, 117, |
| 2556 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2557 | 78, 0, 79, 20, 80, 21, 0, 0, 0, 0, |
| 2558 | 0, 0, 0, 0, 0, 0, 0, 0, 231, 0, |
| 2559 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2560 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2561 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, |
| 2562 | 0, 0, 82, 0, 0, 83, 0, 84, 118, 0, |
| 2563 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, |
| 2564 | 0, 0, 82, 0, 0, 83, 0, 84, 226, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2565 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2566 | 81, 0, 0, 82, 0, 0, 83, 0, 84, 407, |
| 2567 | 0, 348, 349, 65, 66, 350, 0, 0, 0, 0, |
| 2568 | 81, 0, 0, 82, 0, 0, 83, 0, 84, 467, |
| 2569 | 20, 0, 21, 0, 351, 352, 353, 0, 0, 0, |
| 2570 | 0, 0, 0, 0, 0, 81, 354, 355, 82, 0, |
| 2571 | 0, 83, 0, 84, 0, 0, 0, 0, 0, 0, |
| 2572 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 356, |
| 2573 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2574 | 0, 0, 0, 0, 0, 0, 0, 135, 136, 137, |
| 2575 | 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, |
| 2576 | 148, 149, 150, 151, 152, 153, 154, 317, 318, 348, |
| 2577 | 349, 0, 0, 350, 319, 0, 320, 163, 164, 165, |
| 2578 | 166, 0, 321, 322, 323, 0, 0, 0, 0, 0, |
| 2579 | 0, 0, 351, 352, 353, 0, 0, 0, 0, 0, |
| 2580 | 0, 0, 0, 0, 354, 355, 0, 173, 174, 175, |
| 2581 | 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, |
| 2582 | 0, 0, 0, 0, 0, 0, 0, 356, 357, 0, |
| 2583 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2584 | 0, 0, 0, 0, 0, 135, 136, 137, 138, 139, |
| 2585 | 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, |
| 2586 | 150, 151, 152, 153, 154, 317, 318, 0, 0, 0, |
| 2587 | 0, 0, 319, 0, 320, 163, 164, 165, 166, 0, |
| 2588 | 321, 322, 323, 0, 0, 0, 0, 0, 0, 0, |
| 2589 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2590 | 0, 0, 0, 0, 0, 173, 174, 175, 176, 177, |
| 2591 | 178, 179, 180, 181, 182, 183, 184, 185, 0, 0, |
| 2592 | 0, 0, 0, 0, 65, 66, 357, 117, 68, 69, |
| 2593 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 0, |
| 2594 | 79, 20, 0, 21, 0, 0, 0, 0, 0, 0, |
| 2595 | 0, 0, 0, 0, 0, 0, 341, 0, 0, 0, |
| 2596 | 0, 0, 0, 0, 0, 65, 66, 80, 117, 208, |
| 2597 | 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, |
| 2598 | 0, 79, 20, 0, 21, 65, 66, 0, 117, 68, |
| 2599 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2600 | 0, 79, 20, 0, 21, 0, 0, 0, 80, 0, |
| 2601 | 0, 0, 0, 0, 0, 0, 0, 423, 0, 0, |
| 2602 | 0, 0, 0, 0, 0, 0, 65, 66, 80, 117, |
| 2603 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2604 | 78, 0, 79, 20, 0, 21, 0, 0, 0, 0, |
| 2605 | 0, 0, 0, 0, 0, 0, 0, 0, 477, 0, |
| 2606 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, |
| 2607 | 0, 0, 0, 81, 0, 0, 82, 0, 0, 83, |
| 2608 | 0, 84, 65, 66, 0, 67, 68, 69, 70, 71, |
| 2609 | 72, 73, 74, 75, 76, 77, 78, 0, 79, 20, |
| 2610 | 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2611 | 0, 0, 0, 0, 81, 0, 0, 82, 0, 402, |
| 2612 | 83, 0, 84, 0, 0, 80, 0, 0, 0, 0, |
| 2613 | 0, 0, 0, 0, 81, 0, 0, 82, 0, 0, |
| 2614 | 83, 0, 84, 65, 66, 0, 117, 68, 69, 70, |
| 2615 | 71, 72, 73, 74, 75, 76, 77, 78, 0, 79, |
| 2616 | 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, |
| 2617 | 0, 0, 0, 0, 0, 81, 0, 0, 82, 0, |
| 2618 | 0, 83, 0, 84, 65, 66, 80, 117, 208, 209, |
| 2619 | 210, 211, 212, 213, 214, 215, 216, 217, 218, 0, |
| 2620 | 79, 20, 0, 21, 65, 66, 0, 237, 68, 69, |
| 2621 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 0, |
| 2622 | 79, 20, 0, 21, 0, 0, 0, 80, 0, 0, |
| 2623 | 0, 81, 0, 0, 82, 0, 0, 83, 0, 84, |
| 2624 | 0, 0, 0, 0, 0, 65, 66, 80, 117, 208, |
| 2625 | 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, |
| 2626 | 0, 79, 20, 0, 21, 0, 0, 0, 0, 0, |
| 2627 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2628 | 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, |
| 2629 | 0, 0, 81, 0, 0, 82, 0, 0, 83, 0, |
| 2630 | 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 2631 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2632 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2633 | 0, 0, 0, 81, 0, 0, 82, 0, 0, 83, |
| 2634 | 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2635 | 0, 0, 0, 81, 0, 0, 82, 0, 0, 83, |
| 2636 | 0, 84, 0, 0, 0, 0, 124, 0, 0, 0, |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2637 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2638 | 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2639 | 126, 127, 0, 0, 81, 0, 0, 82, 0, 0, |
| 2640 | 83, 0, 405, 128, 129, 130, 131, 132, 133, 134, |
| 2641 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
| 2642 | 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, |
| 2643 | 155, 156, 157, 158, 159, 0, 0, 160, 161, 162, |
| 2644 | 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, |
| 2645 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2646 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2647 | 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, |
| 2648 | 183, 184, 185 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2649 | }; |
| 2650 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2651 | static const short int yycheck[] = |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2652 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2653 | 37, 125, 130, 130, 128, 282, 53, 4, 23, 305, |
| 2654 | 306, 3, 111, 222, 131, 30, 53, 34, 0, 15, |
| 2655 | 15, 29, 52, 53, 54, 234, 84, 325, 326, 159, |
| 2656 | 239, 240, 32, 33, 164, 159, 55, 56, 162, 335, |
| 2657 | 57, 71, 251, 167, 168, 169, 170, 171, 172, 41, |
| 2658 | 10, 11, 12, 13, 14, 15, 16, 17, 116, 357, |
| 2659 | 557, 57, 57, 61, 122, 189, 190, 9, 153, 576, |
| 2660 | 23, 108, 109, 110, 155, 284, 193, 152, 163, 21, |
| 2661 | 577, 588, 153, 164, 155, 294, 295, 296, 125, 20, |
| 2662 | 61, 128, 163, 164, 86, 10, 11, 12, 13, 14, |
| 2663 | 15, 16, 17, 153, 55, 56, 57, 405, 153, 159, |
| 2664 | 41, 42, 43, 44, 45, 46, 47, 153, 163, 50, |
| 2665 | 157, 158, 159, 160, 161, 162, 153, 163, 24, 153, |
| 2666 | 167, 168, 169, 170, 171, 172, 163, 161, 161, 153, |
| 2667 | 153, 164, 152, 45, 0, 47, 159, 161, 163, 186, |
| 2668 | 187, 188, 189, 190, 162, 4, 365, 366, 367, 104, |
| 2669 | 105, 457, 116, 152, 373, 162, 224, 225, 122, 25, |
| 2670 | 228, 22, 152, 24, 152, 31, 152, 301, 387, 388, |
| 2671 | 27, 28, 3, 4, 157, 41, 42, 43, 44, 45, |
| 2672 | 46, 47, 155, 230, 3, 4, 3, 4, 4, 159, |
| 2673 | 3, 4, 3, 4, 4, 252, 62, 77, 78, 155, |
| 2674 | 24, 488, 24, 490, 4, 252, 64, 65, 66, 67, |
| 2675 | 68, 69, 70, 432, 158, 434, 263, 24, 158, 438, |
| 2676 | 155, 59, 4, 4, 4, 4, 4, 446, 447, 448, |
| 2677 | 7, 7, 7, 280, 159, 161, 153, 156, 153, 153, |
| 2678 | 153, 375, 299, 377, 378, 379, 157, 36, 153, 153, |
| 2679 | 153, 385, 299, 300, 301, 10, 11, 12, 13, 14, |
| 2680 | 15, 16, 17, 153, 483, 484, 153, 486, 487, 153, |
| 2681 | 153, 153, 24, 24, 493, 153, 155, 63, 346, 155, |
| 2682 | 155, 155, 155, 502, 155, 155, 155, 155, 397, 398, |
| 2683 | 399, 400, 401, 155, 161, 155, 239, 240, 153, 153, |
| 2684 | 156, 410, 411, 412, 413, 414, 153, 153, 251, 157, |
| 2685 | 153, 153, 153, 153, 34, 24, 535, 119, 120, 121, |
| 2686 | 122, 123, 124, 125, 126, 127, 128, 155, 375, 376, |
| 2687 | 377, 378, 379, 380, 381, 21, 21, 405, 385, 386, |
| 2688 | 342, 284, 4, 155, 153, 153, 24, 153, 153, 458, |
| 2689 | 459, 294, 295, 296, 153, 574, 465, 153, 155, 4, |
| 2690 | 153, 495, 496, 497, 36, 153, 153, 161, 153, 153, |
| 2691 | 589, 161, 4, 57, 421, 24, 57, 596, 21, 153, |
| 2692 | 153, 600, 601, 153, 153, 153, 153, 153, 435, 153, |
| 2693 | 153, 156, 153, 21, 36, 157, 156, 156, 156, 533, |
| 2694 | 509, 510, 511, 512, 153, 159, 453, 516, 517, 518, |
| 2695 | 519, 27, 28, 153, 153, 156, 159, 153, 156, 557, |
| 2696 | 557, 156, 365, 366, 367, 156, 156, 156, 156, 156, |
| 2697 | 373, 156, 541, 542, 156, 21, 153, 21, 485, 577, |
| 2698 | 577, 21, 96, 96, 387, 388, 96, 41, 495, 496, |
| 2699 | 497, 25, 317, 422, 501, 318, 565, 96, 567, 568, |
| 2700 | 96, 52, 421, 61, 3, 222, 19, 595, 435, 501, |
| 2701 | -1, 460, -1, 520, -1, -1, -1, -1, -1, -1, |
| 2702 | -1, -1, -1, -1, -1, -1, 533, -1, -1, 432, |
| 2703 | -1, 434, -1, -1, -1, 438, -1, -1, -1, -1, |
| 2704 | -1, -1, -1, 446, 447, 448, -1, -1, -1, 125, |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 2705 | 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2706 | 136, 137, 138, -1, -1, -1, -1, -1, -1, -1, |
| 2707 | -1, -1, 5, 6, -1, -1, -1, -1, -1, -1, |
| 2708 | 483, 484, -1, 486, 487, -1, -1, -1, -1, 22, |
| 2709 | 493, 24, -1, 26, -1, -1, 20, -1, 22, 502, |
| 2710 | 24, -1, -1, -1, -1, 38, 39, 31, 32, 33, |
| 2711 | -1, -1, -1, -1, -1, -1, -1, 41, 42, 43, |
| 2712 | 44, 45, 46, 47, -1, -1, 50, 51, -1, -1, |
| 2713 | -1, -1, 535, -1, 58, -1, -1, -1, 62, -1, |
| 2714 | -1, -1, -1, -1, -1, -1, 79, 80, 81, 82, |
| 2715 | 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, |
| 2716 | 93, 94, 95, 96, 97, 98, 99, 100, -1, -1, |
| 2717 | -1, 574, -1, 106, -1, 108, 109, 110, 111, 112, |
| 2718 | -1, 114, 115, 116, -1, -1, 589, -1, -1, -1, |
| 2719 | -1, -1, -1, 596, -1, -1, -1, 600, 601, -1, |
| 2720 | -1, -1, -1, -1, -1, -1, 139, 140, 141, 142, |
| 2721 | 143, 144, 145, 146, 147, 148, 149, 150, 151, -1, |
| 2722 | -1, -1, -1, -1, 157, -1, -1, 160, -1, 162, |
| 2723 | 5, 6, 165, 8, 9, 10, 11, 12, 13, 14, |
| 2724 | 15, 16, 17, 18, 19, -1, 21, 22, -1, 24, |
| 2725 | 5, 6, -1, 8, 9, 10, 11, 12, 13, 14, |
| 2726 | 15, 16, 17, 18, 19, -1, 21, 22, -1, 24, |
| 2727 | -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, |
| 2728 | 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, |
| 2729 | 24, 5, 6, 48, 8, 9, 10, 11, 12, 13, |
| 2730 | 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, |
| 2731 | 24, -1, -1, -1, 48, -1, 5, 6, -1, 8, |
| 2732 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2733 | 19, -1, 21, 22, 48, 24, -1, -1, -1, -1, |
| 2734 | -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, |
| 2735 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, |
| 2736 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2737 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, |
| 2738 | -1, -1, 157, -1, -1, 160, -1, 162, 163, -1, |
| 2739 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, |
| 2740 | -1, -1, 157, -1, -1, 160, -1, 162, 163, -1, |
| 2741 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2742 | 154, -1, -1, 157, -1, -1, 160, -1, 162, 163, |
| 2743 | -1, 3, 4, 5, 6, 7, -1, -1, -1, -1, |
| 2744 | 154, -1, -1, 157, -1, -1, 160, -1, 162, 163, |
| 2745 | 22, -1, 24, -1, 26, 27, 28, -1, -1, -1, |
| 2746 | -1, -1, -1, -1, -1, 154, 38, 39, 157, -1, |
| 2747 | -1, 160, -1, 162, -1, -1, -1, -1, -1, -1, |
| 2748 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, |
| 2749 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2750 | -1, -1, -1, -1, -1, -1, -1, 79, 80, 81, |
| 2751 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2752 | 92, 93, 94, 95, 96, 97, 98, 99, 100, 3, |
| 2753 | 4, -1, -1, 7, 106, -1, 108, 109, 110, 111, |
| 2754 | 112, -1, 114, 115, 116, -1, -1, -1, -1, -1, |
| 2755 | -1, -1, 26, 27, 28, -1, -1, -1, -1, -1, |
| 2756 | -1, -1, -1, -1, 38, 39, -1, 139, 140, 141, |
| 2757 | 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, |
| 2758 | -1, -1, -1, -1, -1, -1, -1, 61, 160, -1, |
| 2759 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2760 | -1, -1, -1, -1, -1, 79, 80, 81, 82, 83, |
| 2761 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2762 | 94, 95, 96, 97, 98, 99, 100, -1, -1, -1, |
| 2763 | -1, -1, 106, -1, 108, 109, 110, 111, 112, -1, |
| 2764 | 114, 115, 116, -1, -1, -1, -1, -1, -1, -1, |
| 2765 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2766 | -1, -1, -1, -1, -1, 139, 140, 141, 142, 143, |
| 2767 | 144, 145, 146, 147, 148, 149, 150, 151, -1, -1, |
| 2768 | -1, -1, -1, -1, 5, 6, 160, 8, 9, 10, |
| 2769 | 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, |
| 2770 | 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, |
| 2771 | -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, |
| 2772 | -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, |
| 2773 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
| 2774 | -1, 21, 22, -1, 24, 5, 6, -1, 8, 9, |
| 2775 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
| 2776 | -1, 21, 22, -1, 24, -1, -1, -1, 48, -1, |
| 2777 | -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, |
| 2778 | -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, |
| 2779 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2780 | 19, -1, 21, 22, -1, 24, -1, -1, -1, -1, |
| 2781 | -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, |
| 2782 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, |
| 2783 | -1, -1, -1, 154, -1, -1, 157, -1, -1, 160, |
| 2784 | -1, 162, 5, 6, -1, 8, 9, 10, 11, 12, |
| 2785 | 13, 14, 15, 16, 17, 18, 19, -1, 21, 22, |
| 2786 | -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2787 | -1, -1, -1, -1, 154, -1, -1, 157, -1, 159, |
| 2788 | 160, -1, 162, -1, -1, 48, -1, -1, -1, -1, |
| 2789 | -1, -1, -1, -1, 154, -1, -1, 157, -1, -1, |
| 2790 | 160, -1, 162, 5, 6, -1, 8, 9, 10, 11, |
| 2791 | 12, 13, 14, 15, 16, 17, 18, 19, -1, 21, |
| 2792 | 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2793 | -1, -1, -1, -1, -1, 154, -1, -1, 157, -1, |
| 2794 | -1, 160, -1, 162, 5, 6, 48, 8, 9, 10, |
| 2795 | 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, |
| 2796 | 21, 22, -1, 24, 5, 6, -1, 8, 9, 10, |
| 2797 | 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, |
| 2798 | 21, 22, -1, 24, -1, -1, -1, 48, -1, -1, |
| 2799 | -1, 154, -1, -1, 157, -1, -1, 160, -1, 162, |
| 2800 | -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, |
| 2801 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
| 2802 | -1, 21, 22, -1, 24, -1, -1, -1, -1, -1, |
| 2803 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2804 | -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, |
| 2805 | -1, -1, 154, -1, -1, 157, -1, -1, 160, -1, |
| 2806 | 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2807 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2808 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2809 | -1, -1, -1, 154, -1, -1, 157, -1, -1, 160, |
| 2810 | -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2811 | -1, -1, -1, 154, -1, -1, 157, -1, -1, 160, |
| 2812 | -1, 162, -1, -1, -1, -1, 35, -1, -1, -1, |
| 2813 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2814 | 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2815 | 59, 60, -1, -1, 154, -1, -1, 157, -1, -1, |
| 2816 | 160, -1, 162, 72, 73, 74, 75, 76, 77, 78, |
| 2817 | 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, |
| 2818 | 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, |
| 2819 | 99, 100, 101, 102, 103, -1, -1, 106, 107, 108, |
| 2820 | 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, |
| 2821 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2822 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2823 | 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, |
| 2824 | 149, 150, 151 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2825 | }; |
| 2826 | |
| 2827 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2828 | symbol of state STATE-NUM. */ |
| 2829 | static const unsigned char yystos[] = |
| 2830 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2831 | 0, 200, 201, 202, 0, 25, 31, 41, 42, 43, |
| 2832 | 44, 45, 46, 47, 62, 181, 219, 221, 223, 230, |
| 2833 | 22, 24, 51, 58, 62, 180, 212, 223, 224, 61, |
| 2834 | 64, 65, 66, 67, 68, 69, 70, 182, 217, 23, |
| 2835 | 231, 232, 30, 163, 220, 231, 52, 53, 54, 71, |
| 2836 | 209, 152, 61, 20, 45, 47, 50, 181, 152, 45, |
| 2837 | 47, 222, 24, 207, 4, 5, 6, 8, 9, 10, |
| 2838 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, |
| 2839 | 48, 154, 157, 160, 162, 167, 189, 190, 191, 192, |
| 2840 | 193, 212, 227, 29, 162, 218, 180, 236, 152, 152, |
| 2841 | 152, 152, 157, 210, 207, 189, 32, 33, 199, 199, |
| 2842 | 199, 199, 217, 4, 4, 4, 162, 8, 163, 193, |
| 2843 | 194, 212, 155, 164, 35, 49, 59, 60, 72, 73, |
| 2844 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2845 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2846 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
| 2847 | 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, |
| 2848 | 116, 117, 118, 139, 140, 141, 142, 143, 144, 145, |
| 2849 | 146, 147, 148, 149, 150, 151, 169, 170, 171, 174, |
| 2850 | 175, 233, 234, 240, 241, 243, 244, 24, 55, 56, |
| 2851 | 208, 4, 24, 24, 211, 191, 191, 191, 9, 10, |
| 2852 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 176, |
| 2853 | 177, 179, 191, 196, 158, 158, 163, 194, 153, 163, |
| 2854 | 155, 37, 194, 195, 191, 229, 59, 8, 229, 9, |
| 2855 | 21, 10, 11, 12, 13, 14, 15, 16, 17, 176, |
| 2856 | 177, 178, 182, 119, 120, 121, 122, 123, 124, 125, |
| 2857 | 126, 127, 128, 172, 27, 28, 125, 126, 127, 128, |
| 2858 | 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, |
| 2859 | 173, 191, 191, 229, 191, 191, 237, 229, 229, 229, |
| 2860 | 229, 229, 229, 229, 191, 191, 191, 229, 229, 182, |
| 2861 | 104, 105, 153, 159, 205, 206, 204, 27, 28, 3, |
| 2862 | 4, 168, 4, 7, 26, 38, 39, 99, 100, 106, |
| 2863 | 108, 114, 115, 116, 157, 160, 162, 165, 169, 170, |
| 2864 | 171, 174, 175, 197, 227, 203, 193, 193, 161, 163, |
| 2865 | 193, 37, 191, 214, 215, 216, 153, 156, 3, 4, |
| 2866 | 7, 26, 27, 28, 38, 39, 61, 160, 197, 226, |
| 2867 | 227, 228, 228, 228, 228, 189, 191, 191, 153, 184, |
| 2868 | 153, 184, 228, 157, 153, 153, 153, 153, 153, 153, |
| 2869 | 153, 153, 228, 228, 228, 153, 36, 189, 191, 229, |
| 2870 | 24, 153, 187, 187, 187, 172, 173, 155, 155, 155, |
| 2871 | 155, 155, 159, 196, 198, 162, 198, 163, 198, 24, |
| 2872 | 155, 155, 155, 155, 155, 187, 159, 161, 161, 212, |
| 2873 | 213, 153, 156, 37, 63, 225, 198, 153, 153, 228, |
| 2874 | 228, 228, 15, 57, 15, 153, 242, 228, 157, 229, |
| 2875 | 191, 229, 229, 229, 191, 191, 153, 153, 153, 229, |
| 2876 | 191, 228, 228, 153, 34, 57, 185, 188, 155, 155, |
| 2877 | 196, 196, 196, 196, 196, 153, 159, 163, 193, 198, |
| 2878 | 161, 163, 196, 196, 196, 196, 196, 37, 214, 185, |
| 2879 | 186, 24, 161, 21, 21, 155, 153, 153, 228, 4, |
| 2880 | 228, 229, 238, 153, 228, 153, 153, 153, 228, 228, |
| 2881 | 228, 155, 191, 24, 4, 187, 196, 196, 242, 153, |
| 2882 | 153, 153, 153, 196, 161, 163, 153, 153, 153, 153, |
| 2883 | 36, 57, 183, 153, 228, 228, 238, 239, 228, 228, |
| 2884 | 153, 184, 184, 153, 228, 153, 229, 229, 229, 239, |
| 2885 | 228, 153, 153, 156, 196, 196, 196, 196, 161, 196, |
| 2886 | 196, 196, 196, 191, 4, 24, 153, 157, 156, 229, |
| 2887 | 159, 228, 156, 196, 196, 153, 156, 153, 153, 156, |
| 2888 | 156, 156, 156, 156, 21, 159, 178, 235, 36, 159, |
| 2889 | 156, 156, 196, 196, 196, 228, 226, 159, 178, 21, |
| 2890 | 156, 156, 156, 153, 226, 228, 21, 153, 233, 228, |
| 2891 | 21, 21, 228, 228 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2892 | }; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2893 | |
| 2894 | #define yyerrok (yyerrstatus = 0) |
| 2895 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2896 | #define YYEMPTY (-2) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2897 | #define YYEOF 0 |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2898 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2899 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2900 | #define YYABORT goto yyabortlab |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2901 | #define YYERROR goto yyerrorlab |
| 2902 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2903 | |
| 2904 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2905 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2906 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2907 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2908 | #define YYFAIL goto yyerrlab |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2909 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2910 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2911 | |
| 2912 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2913 | do \ |
| 2914 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2915 | { \ |
| 2916 | yychar = (Token); \ |
| 2917 | yylval = (Value); \ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2918 | yytoken = YYTRANSLATE (yychar); \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2919 | YYPOPSTACK; \ |
| 2920 | goto yybackup; \ |
| 2921 | } \ |
| 2922 | else \ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2923 | { \ |
| 2924 | yyerror (YY_("syntax error: cannot back up")); \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2925 | YYERROR; \ |
| 2926 | } \ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2927 | while (0) |
| 2928 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2929 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2930 | #define YYTERROR 1 |
| 2931 | #define YYERRCODE 256 |
| 2932 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2933 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2934 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2935 | If N is 0, then set CURRENT to the empty location which ends |
| 2936 | the previous symbol: RHS[0] (always defined). */ |
| 2937 | |
| 2938 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2939 | #ifndef YYLLOC_DEFAULT |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2940 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2941 | do \ |
| 2942 | if (N) \ |
| 2943 | { \ |
| 2944 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2945 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2946 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2947 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2948 | } \ |
| 2949 | else \ |
| 2950 | { \ |
| 2951 | (Current).first_line = (Current).last_line = \ |
| 2952 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2953 | (Current).first_column = (Current).last_column = \ |
| 2954 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2955 | } \ |
| 2956 | while (0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 2957 | #endif |
| 2958 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2959 | |
| 2960 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2961 | This macro was not mandated originally: define only if we know |
| 2962 | we won't break user code: when these are the locations we know. */ |
| 2963 | |
| 2964 | #ifndef YY_LOCATION_PRINT |
| 2965 | # if YYLTYPE_IS_TRIVIAL |
| 2966 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2967 | fprintf (File, "%d.%d-%d.%d", \ |
| 2968 | (Loc).first_line, (Loc).first_column, \ |
| 2969 | (Loc).last_line, (Loc).last_column) |
| 2970 | # else |
| 2971 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2972 | # endif |
| 2973 | #endif |
| 2974 | |
| 2975 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2976 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2977 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2978 | #ifdef YYLEX_PARAM |
| 2979 | # define YYLEX yylex (YYLEX_PARAM) |
| 2980 | #else |
| 2981 | # define YYLEX yylex () |
| 2982 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 2983 | |
| 2984 | /* Enable debugging if requested. */ |
| 2985 | #if YYDEBUG |
| 2986 | |
| 2987 | # ifndef YYFPRINTF |
| 2988 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2989 | # define YYFPRINTF fprintf |
| 2990 | # endif |
| 2991 | |
| 2992 | # define YYDPRINTF(Args) \ |
| 2993 | do { \ |
| 2994 | if (yydebug) \ |
| 2995 | YYFPRINTF Args; \ |
| 2996 | } while (0) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 2997 | |
| 2998 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2999 | do { \ |
| 3000 | if (yydebug) \ |
| 3001 | { \ |
| 3002 | YYFPRINTF (stderr, "%s ", Title); \ |
| 3003 | yysymprint (stderr, \ |
| 3004 | Type, Value); \ |
| 3005 | YYFPRINTF (stderr, "\n"); \ |
| 3006 | } \ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3007 | } while (0) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3008 | |
| 3009 | /*------------------------------------------------------------------. |
| 3010 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 3011 | | TOP (included). | |
| 3012 | `------------------------------------------------------------------*/ |
| 3013 | |
| 3014 | #if defined (__STDC__) || defined (__cplusplus) |
| 3015 | static void |
| 3016 | yy_stack_print (short int *bottom, short int *top) |
| 3017 | #else |
| 3018 | static void |
| 3019 | yy_stack_print (bottom, top) |
| 3020 | short int *bottom; |
| 3021 | short int *top; |
| 3022 | #endif |
| 3023 | { |
| 3024 | YYFPRINTF (stderr, "Stack now"); |
| 3025 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 3026 | YYFPRINTF (stderr, " %d", *bottom); |
| 3027 | YYFPRINTF (stderr, "\n"); |
| 3028 | } |
| 3029 | |
| 3030 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 3031 | do { \ |
| 3032 | if (yydebug) \ |
| 3033 | yy_stack_print ((Bottom), (Top)); \ |
| 3034 | } while (0) |
| 3035 | |
| 3036 | |
| 3037 | /*------------------------------------------------. |
| 3038 | | Report that the YYRULE is going to be reduced. | |
| 3039 | `------------------------------------------------*/ |
| 3040 | |
| 3041 | #if defined (__STDC__) || defined (__cplusplus) |
| 3042 | static void |
| 3043 | yy_reduce_print (int yyrule) |
| 3044 | #else |
| 3045 | static void |
| 3046 | yy_reduce_print (yyrule) |
| 3047 | int yyrule; |
| 3048 | #endif |
| 3049 | { |
| 3050 | int yyi; |
| 3051 | unsigned long int yylno = yyrline[yyrule]; |
| 3052 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 3053 | yyrule - 1, yylno); |
| 3054 | /* Print the symbols being reduced, and their result. */ |
| 3055 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 3056 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 3057 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 3058 | } |
| 3059 | |
| 3060 | # define YY_REDUCE_PRINT(Rule) \ |
| 3061 | do { \ |
| 3062 | if (yydebug) \ |
| 3063 | yy_reduce_print (Rule); \ |
| 3064 | } while (0) |
| 3065 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3066 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 3067 | multiple parsers can coexist. */ |
| 3068 | int yydebug; |
| 3069 | #else /* !YYDEBUG */ |
| 3070 | # define YYDPRINTF(Args) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3071 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 3072 | # define YY_STACK_PRINT(Bottom, Top) |
| 3073 | # define YY_REDUCE_PRINT(Rule) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3074 | #endif /* !YYDEBUG */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3075 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3076 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3077 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3078 | #ifndef YYINITDEPTH |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3079 | # define YYINITDEPTH 200 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3080 | #endif |
| 3081 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3082 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 3083 | if the built-in stack extension method is used). |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3084 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3085 | Do not make this value too large; the results are undefined if |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3086 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3087 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3088 | |
| 3089 | #ifndef YYMAXDEPTH |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3090 | # define YYMAXDEPTH 10000 |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3091 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3092 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3093 | |
| 3094 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3095 | #if YYERROR_VERBOSE |
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 | # ifndef yystrlen |
| 3098 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 3099 | # define yystrlen strlen |
| 3100 | # else |
| 3101 | /* Return the length of YYSTR. */ |
| 3102 | static YYSIZE_T |
| 3103 | # if defined (__STDC__) || defined (__cplusplus) |
| 3104 | yystrlen (const char *yystr) |
| 3105 | # else |
| 3106 | yystrlen (yystr) |
| 3107 | const char *yystr; |
| 3108 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3109 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3110 | const char *yys = yystr; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3111 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3112 | while (*yys++ != '\0') |
| 3113 | continue; |
| 3114 | |
| 3115 | return yys - yystr - 1; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3116 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3117 | # endif |
| 3118 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3119 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3120 | # ifndef yystpcpy |
| 3121 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 3122 | # define yystpcpy stpcpy |
| 3123 | # else |
| 3124 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 3125 | YYDEST. */ |
| 3126 | static char * |
| 3127 | # if defined (__STDC__) || defined (__cplusplus) |
| 3128 | yystpcpy (char *yydest, const char *yysrc) |
| 3129 | # else |
| 3130 | yystpcpy (yydest, yysrc) |
| 3131 | char *yydest; |
| 3132 | const char *yysrc; |
| 3133 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3134 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3135 | char *yyd = yydest; |
| 3136 | const char *yys = yysrc; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3137 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3138 | while ((*yyd++ = *yys++) != '\0') |
| 3139 | continue; |
| 3140 | |
| 3141 | return yyd - 1; |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3142 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3143 | # endif |
| 3144 | # endif |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3145 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3146 | # ifndef yytnamerr |
| 3147 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 3148 | quotes and backslashes, so that it's suitable for yyerror. The |
| 3149 | heuristic is that double-quoting is unnecessary unless the string |
| 3150 | contains an apostrophe, a comma, or backslash (other than |
| 3151 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 3152 | null, do not copy; instead, return the length of what the result |
| 3153 | would have been. */ |
| 3154 | static YYSIZE_T |
| 3155 | yytnamerr (char *yyres, const char *yystr) |
| 3156 | { |
| 3157 | if (*yystr == '"') |
| 3158 | { |
| 3159 | size_t yyn = 0; |
| 3160 | char const *yyp = yystr; |
| 3161 | |
| 3162 | for (;;) |
| 3163 | switch (*++yyp) |
| 3164 | { |
| 3165 | case '\'': |
| 3166 | case ',': |
| 3167 | goto do_not_strip_quotes; |
| 3168 | |
| 3169 | case '\\': |
| 3170 | if (*++yyp != '\\') |
| 3171 | goto do_not_strip_quotes; |
| 3172 | /* Fall through. */ |
| 3173 | default: |
| 3174 | if (yyres) |
| 3175 | yyres[yyn] = *yyp; |
| 3176 | yyn++; |
| 3177 | break; |
| 3178 | |
| 3179 | case '"': |
| 3180 | if (yyres) |
| 3181 | yyres[yyn] = '\0'; |
| 3182 | return yyn; |
| 3183 | } |
| 3184 | do_not_strip_quotes: ; |
| 3185 | } |
| 3186 | |
| 3187 | if (! yyres) |
| 3188 | return yystrlen (yystr); |
| 3189 | |
| 3190 | return yystpcpy (yyres, yystr) - yyres; |
| 3191 | } |
| 3192 | # endif |
| 3193 | |
| 3194 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3195 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3196 | |
| 3197 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3198 | #if YYDEBUG |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3199 | /*--------------------------------. |
| 3200 | | Print this symbol on YYOUTPUT. | |
| 3201 | `--------------------------------*/ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3202 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3203 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3204 | static void |
| 3205 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3206 | #else |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3207 | static void |
| 3208 | yysymprint (yyoutput, yytype, yyvaluep) |
| 3209 | FILE *yyoutput; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3210 | int yytype; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3211 | YYSTYPE *yyvaluep; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3212 | #endif |
| 3213 | { |
| 3214 | /* Pacify ``unused variable'' warnings. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3215 | (void) yyvaluep; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3216 | |
| 3217 | if (yytype < YYNTOKENS) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3218 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
Jeff Cohen | ac2dca9 | 2007-01-21 19:30:52 +0000 | [diff] [blame] | 3219 | else |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3220 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Jeff Cohen | ac2dca9 | 2007-01-21 19:30:52 +0000 | [diff] [blame] | 3221 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3222 | |
| 3223 | # ifdef YYPRINT |
| 3224 | if (yytype < YYNTOKENS) |
| 3225 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 3226 | # endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3227 | switch (yytype) |
| 3228 | { |
| 3229 | default: |
| 3230 | break; |
| 3231 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3232 | YYFPRINTF (yyoutput, ")"); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3233 | } |
| 3234 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3235 | #endif /* ! YYDEBUG */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3236 | /*-----------------------------------------------. |
| 3237 | | Release the memory associated to this symbol. | |
| 3238 | `-----------------------------------------------*/ |
| 3239 | |
| 3240 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3241 | static void |
| 3242 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3243 | #else |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3244 | static void |
| 3245 | yydestruct (yymsg, yytype, yyvaluep) |
| 3246 | const char *yymsg; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3247 | int yytype; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3248 | YYSTYPE *yyvaluep; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3249 | #endif |
| 3250 | { |
| 3251 | /* Pacify ``unused variable'' warnings. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3252 | (void) yyvaluep; |
| 3253 | |
| 3254 | if (!yymsg) |
| 3255 | yymsg = "Deleting"; |
| 3256 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3257 | |
| 3258 | switch (yytype) |
| 3259 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3260 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3261 | default: |
| 3262 | break; |
| 3263 | } |
| 3264 | } |
| 3265 | |
| 3266 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3267 | /* Prevent warnings from -Wmissing-prototypes. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3268 | |
| 3269 | #ifdef YYPARSE_PARAM |
| 3270 | # if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3271 | int yyparse (void *YYPARSE_PARAM); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3272 | # else |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3273 | int yyparse (); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3274 | # endif |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3275 | #else /* ! YYPARSE_PARAM */ |
| 3276 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3277 | int yyparse (void); |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3278 | #else |
| 3279 | int yyparse (); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3280 | #endif |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3281 | #endif /* ! YYPARSE_PARAM */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3282 | |
| 3283 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3284 | |
| 3285 | /* The look-ahead symbol. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3286 | int yychar; |
| 3287 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3288 | /* The semantic value of the look-ahead symbol. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3289 | YYSTYPE yylval; |
| 3290 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3291 | /* Number of syntax errors so far. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3292 | int yynerrs; |
| 3293 | |
| 3294 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3295 | |
| 3296 | /*----------. |
| 3297 | | yyparse. | |
| 3298 | `----------*/ |
| 3299 | |
| 3300 | #ifdef YYPARSE_PARAM |
| 3301 | # if defined (__STDC__) || defined (__cplusplus) |
| 3302 | int yyparse (void *YYPARSE_PARAM) |
| 3303 | # else |
| 3304 | int yyparse (YYPARSE_PARAM) |
| 3305 | void *YYPARSE_PARAM; |
| 3306 | # endif |
| 3307 | #else /* ! YYPARSE_PARAM */ |
| 3308 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3309 | int |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3310 | yyparse (void) |
| 3311 | #else |
| 3312 | int |
| 3313 | yyparse () |
| 3314 | |
| 3315 | #endif |
| 3316 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3317 | { |
| 3318 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3319 | int yystate; |
| 3320 | int yyn; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3321 | int yyresult; |
| 3322 | /* Number of tokens to shift before error messages enabled. */ |
| 3323 | int yyerrstatus; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3324 | /* Look-ahead token as an internal (translated) token number. */ |
| 3325 | int yytoken = 0; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3326 | |
| 3327 | /* Three stacks and their tools: |
| 3328 | `yyss': related to states, |
| 3329 | `yyvs': related to semantic values, |
| 3330 | `yyls': related to locations. |
| 3331 | |
| 3332 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3333 | to reallocate them elsewhere. */ |
| 3334 | |
| 3335 | /* The state stack. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3336 | short int yyssa[YYINITDEPTH]; |
| 3337 | short int *yyss = yyssa; |
| 3338 | short int *yyssp; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3339 | |
| 3340 | /* The semantic value stack. */ |
| 3341 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3342 | YYSTYPE *yyvs = yyvsa; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3343 | YYSTYPE *yyvsp; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3344 | |
| 3345 | |
| 3346 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3347 | #define YYPOPSTACK (yyvsp--, yyssp--) |
| 3348 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3349 | YYSIZE_T yystacksize = YYINITDEPTH; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3350 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3351 | /* The variables used to return semantic value and location from the |
| 3352 | action routines. */ |
| 3353 | YYSTYPE yyval; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3354 | |
| 3355 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3356 | /* When reducing, the number of symbols on the RHS of the reduced |
| 3357 | rule. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3358 | int yylen; |
| 3359 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3360 | YYDPRINTF ((stderr, "Starting parse\n")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3361 | |
| 3362 | yystate = 0; |
| 3363 | yyerrstatus = 0; |
| 3364 | yynerrs = 0; |
| 3365 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3366 | |
| 3367 | /* Initialize stack pointers. |
| 3368 | Waste one element of value and location stack |
| 3369 | so that they stay on the same level as the state stack. |
| 3370 | The wasted elements are never initialized. */ |
| 3371 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3372 | yyssp = yyss; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3373 | yyvsp = yyvs; |
| 3374 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3375 | goto yysetstate; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3376 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3377 | /*------------------------------------------------------------. |
| 3378 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3379 | `------------------------------------------------------------*/ |
| 3380 | yynewstate: |
| 3381 | /* In all cases, when you get here, the value and location stacks |
| 3382 | have just been pushed. so pushing a state here evens the stacks. |
| 3383 | */ |
| 3384 | yyssp++; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3385 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3386 | yysetstate: |
| 3387 | *yyssp = yystate; |
| 3388 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3389 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3390 | { |
| 3391 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3392 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3393 | |
| 3394 | #ifdef yyoverflow |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3395 | { |
| 3396 | /* Give user a chance to reallocate the stack. Use copies of |
| 3397 | these so that the &'s don't force the real ones into |
| 3398 | memory. */ |
| 3399 | YYSTYPE *yyvs1 = yyvs; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3400 | short int *yyss1 = yyss; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3401 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3402 | |
| 3403 | /* Each stack pointer address is followed by the size of the |
| 3404 | data in use in that stack, in bytes. This used to be a |
| 3405 | conditional around just the two extra args, but that might |
| 3406 | be undefined if yyoverflow is a macro. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3407 | yyoverflow (YY_("memory exhausted"), |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3408 | &yyss1, yysize * sizeof (*yyssp), |
| 3409 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3410 | |
| 3411 | &yystacksize); |
| 3412 | |
| 3413 | yyss = yyss1; |
| 3414 | yyvs = yyvs1; |
| 3415 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3416 | #else /* no yyoverflow */ |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3417 | # ifndef YYSTACK_RELOCATE |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3418 | goto yyexhaustedlab; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3419 | # else |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3420 | /* Extend the stack our own way. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3421 | if (YYMAXDEPTH <= yystacksize) |
| 3422 | goto yyexhaustedlab; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3423 | yystacksize *= 2; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3424 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3425 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3426 | |
| 3427 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3428 | short int *yyss1 = yyss; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3429 | union yyalloc *yyptr = |
| 3430 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3431 | if (! yyptr) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3432 | goto yyexhaustedlab; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3433 | YYSTACK_RELOCATE (yyss); |
| 3434 | YYSTACK_RELOCATE (yyvs); |
| 3435 | |
| 3436 | # undef YYSTACK_RELOCATE |
| 3437 | if (yyss1 != yyssa) |
| 3438 | YYSTACK_FREE (yyss1); |
| 3439 | } |
| 3440 | # endif |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3441 | #endif /* no yyoverflow */ |
| 3442 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3443 | yyssp = yyss + yysize - 1; |
| 3444 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3445 | |
| 3446 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3447 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3448 | (unsigned long int) yystacksize)); |
| 3449 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3450 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3451 | YYABORT; |
| 3452 | } |
| 3453 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3454 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3455 | |
| 3456 | goto yybackup; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3457 | |
| 3458 | /*-----------. |
| 3459 | | yybackup. | |
| 3460 | `-----------*/ |
| 3461 | yybackup: |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3462 | |
| 3463 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3464 | /* 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] | 3465 | /* yyresume: */ |
| 3466 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3467 | /* 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] | 3468 | |
| 3469 | yyn = yypact[yystate]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3470 | if (yyn == YYPACT_NINF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3471 | goto yydefault; |
| 3472 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3473 | /* 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] | 3474 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3475 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3476 | if (yychar == YYEMPTY) |
| 3477 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3478 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3479 | yychar = YYLEX; |
| 3480 | } |
| 3481 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3482 | if (yychar <= YYEOF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3483 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3484 | yychar = yytoken = YYEOF; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3485 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3486 | } |
| 3487 | else |
| 3488 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3489 | yytoken = YYTRANSLATE (yychar); |
| 3490 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3491 | } |
| 3492 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3493 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3494 | detect an error, take that action. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3495 | yyn += yytoken; |
| 3496 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3497 | goto yydefault; |
| 3498 | yyn = yytable[yyn]; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3499 | if (yyn <= 0) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3500 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3501 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3502 | goto yyerrlab; |
| 3503 | yyn = -yyn; |
| 3504 | goto yyreduce; |
| 3505 | } |
| 3506 | |
| 3507 | if (yyn == YYFINAL) |
| 3508 | YYACCEPT; |
| 3509 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3510 | /* Shift the look-ahead token. */ |
| 3511 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3512 | |
| 3513 | /* Discard the token being shifted unless it is eof. */ |
| 3514 | if (yychar != YYEOF) |
| 3515 | yychar = YYEMPTY; |
| 3516 | |
| 3517 | *++yyvsp = yylval; |
| 3518 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3519 | |
| 3520 | /* Count tokens shifted since error; after three, turn off error |
| 3521 | status. */ |
| 3522 | if (yyerrstatus) |
| 3523 | yyerrstatus--; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3524 | |
| 3525 | yystate = yyn; |
| 3526 | goto yynewstate; |
| 3527 | |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 3528 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3529 | /*-----------------------------------------------------------. |
| 3530 | | yydefault -- do the default action for the current state. | |
| 3531 | `-----------------------------------------------------------*/ |
| 3532 | yydefault: |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3533 | yyn = yydefact[yystate]; |
| 3534 | if (yyn == 0) |
| 3535 | goto yyerrlab; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3536 | goto yyreduce; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3537 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3538 | |
| 3539 | /*-----------------------------. |
| 3540 | | yyreduce -- Do a reduction. | |
| 3541 | `-----------------------------*/ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3542 | yyreduce: |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3543 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3544 | yylen = yyr2[yyn]; |
| 3545 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3546 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3547 | `$$ = $1'. |
| 3548 | |
| 3549 | Otherwise, the following line sets YYVAL to garbage. |
| 3550 | This behavior is undocumented and Bison |
| 3551 | users should not rely upon it. Assigning to YYVAL |
| 3552 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3553 | GCC warning that YYVAL may be used uninitialized. */ |
| 3554 | yyval = yyvsp[1-yylen]; |
| 3555 | |
| 3556 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3557 | YY_REDUCE_PRINT (yyn); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3558 | switch (yyn) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3559 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3560 | case 3: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3561 | #line 1478 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3562 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3563 | if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! |
| 3564 | error("Value too large for type"); |
| 3565 | (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); |
| 3566 | ;} |
| 3567 | break; |
| 3568 | |
| 3569 | case 5: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3570 | #line 1487 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3571 | { |
| 3572 | if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! |
| 3573 | error("Value too large for type"); |
| 3574 | (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val); |
| 3575 | ;} |
| 3576 | break; |
| 3577 | |
| 3578 | case 26: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3579 | #line 1509 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3580 | { (yyval.IPred) = ICmpInst::ICMP_EQ; ;} |
| 3581 | break; |
| 3582 | |
| 3583 | case 27: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3584 | #line 1509 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3585 | { (yyval.IPred) = ICmpInst::ICMP_NE; ;} |
| 3586 | break; |
| 3587 | |
| 3588 | case 28: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3589 | #line 1510 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3590 | { (yyval.IPred) = ICmpInst::ICMP_SLT; ;} |
| 3591 | break; |
| 3592 | |
| 3593 | case 29: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3594 | #line 1510 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3595 | { (yyval.IPred) = ICmpInst::ICMP_SGT; ;} |
| 3596 | break; |
| 3597 | |
| 3598 | case 30: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3599 | #line 1511 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3600 | { (yyval.IPred) = ICmpInst::ICMP_SLE; ;} |
| 3601 | break; |
| 3602 | |
| 3603 | case 31: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3604 | #line 1511 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3605 | { (yyval.IPred) = ICmpInst::ICMP_SGE; ;} |
| 3606 | break; |
| 3607 | |
| 3608 | case 32: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3609 | #line 1512 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3610 | { (yyval.IPred) = ICmpInst::ICMP_ULT; ;} |
| 3611 | break; |
| 3612 | |
| 3613 | case 33: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3614 | #line 1512 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3615 | { (yyval.IPred) = ICmpInst::ICMP_UGT; ;} |
| 3616 | break; |
| 3617 | |
| 3618 | case 34: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3619 | #line 1513 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3620 | { (yyval.IPred) = ICmpInst::ICMP_ULE; ;} |
| 3621 | break; |
| 3622 | |
| 3623 | case 35: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3624 | #line 1513 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3625 | { (yyval.IPred) = ICmpInst::ICMP_UGE; ;} |
| 3626 | break; |
| 3627 | |
| 3628 | case 36: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3629 | #line 1517 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3630 | { (yyval.FPred) = FCmpInst::FCMP_OEQ; ;} |
| 3631 | break; |
| 3632 | |
| 3633 | case 37: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3634 | #line 1517 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3635 | { (yyval.FPred) = FCmpInst::FCMP_ONE; ;} |
| 3636 | break; |
| 3637 | |
| 3638 | case 38: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3639 | #line 1518 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3640 | { (yyval.FPred) = FCmpInst::FCMP_OLT; ;} |
| 3641 | break; |
| 3642 | |
| 3643 | case 39: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3644 | #line 1518 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3645 | { (yyval.FPred) = FCmpInst::FCMP_OGT; ;} |
| 3646 | break; |
| 3647 | |
| 3648 | case 40: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3649 | #line 1519 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3650 | { (yyval.FPred) = FCmpInst::FCMP_OLE; ;} |
| 3651 | break; |
| 3652 | |
| 3653 | case 41: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3654 | #line 1519 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3655 | { (yyval.FPred) = FCmpInst::FCMP_OGE; ;} |
| 3656 | break; |
| 3657 | |
| 3658 | case 42: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3659 | #line 1520 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3660 | { (yyval.FPred) = FCmpInst::FCMP_ORD; ;} |
| 3661 | break; |
| 3662 | |
| 3663 | case 43: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3664 | #line 1520 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3665 | { (yyval.FPred) = FCmpInst::FCMP_UNO; ;} |
| 3666 | break; |
| 3667 | |
| 3668 | case 44: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3669 | #line 1521 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3670 | { (yyval.FPred) = FCmpInst::FCMP_UEQ; ;} |
| 3671 | break; |
| 3672 | |
| 3673 | case 45: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3674 | #line 1521 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3675 | { (yyval.FPred) = FCmpInst::FCMP_UNE; ;} |
| 3676 | break; |
| 3677 | |
| 3678 | case 46: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3679 | #line 1522 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3680 | { (yyval.FPred) = FCmpInst::FCMP_ULT; ;} |
| 3681 | break; |
| 3682 | |
| 3683 | case 47: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3684 | #line 1522 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3685 | { (yyval.FPred) = FCmpInst::FCMP_UGT; ;} |
| 3686 | break; |
| 3687 | |
| 3688 | case 48: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3689 | #line 1523 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3690 | { (yyval.FPred) = FCmpInst::FCMP_ULE; ;} |
| 3691 | break; |
| 3692 | |
| 3693 | case 49: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3694 | #line 1523 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3695 | { (yyval.FPred) = FCmpInst::FCMP_UGE; ;} |
| 3696 | break; |
| 3697 | |
| 3698 | case 50: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3699 | #line 1524 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3700 | { (yyval.FPred) = FCmpInst::FCMP_TRUE; ;} |
| 3701 | break; |
| 3702 | |
| 3703 | case 51: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3704 | #line 1525 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3705 | { (yyval.FPred) = FCmpInst::FCMP_FALSE; ;} |
| 3706 | break; |
| 3707 | |
| 3708 | case 81: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3709 | #line 1556 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3710 | { |
| 3711 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
| 3712 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3713 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3714 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3715 | case 82: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3716 | #line 1559 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3717 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3718 | (yyval.StrVal) = 0; |
| 3719 | ;} |
| 3720 | break; |
| 3721 | |
| 3722 | case 83: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3723 | #line 1564 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3724 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3725 | break; |
| 3726 | |
| 3727 | case 84: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3728 | #line 1565 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3729 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3730 | break; |
| 3731 | |
| 3732 | case 85: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3733 | #line 1566 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3734 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3735 | break; |
| 3736 | |
| 3737 | case 86: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3738 | #line 1567 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3739 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3740 | break; |
| 3741 | |
| 3742 | case 87: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3743 | #line 1568 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3744 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3745 | break; |
| 3746 | |
| 3747 | case 88: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3748 | #line 1569 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3749 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3750 | break; |
| 3751 | |
| 3752 | case 89: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3753 | #line 1570 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3754 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3755 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3756 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3757 | case 90: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3758 | #line 1571 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3759 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3760 | break; |
| 3761 | |
| 3762 | case 91: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3763 | #line 1575 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3764 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3765 | break; |
| 3766 | |
| 3767 | case 92: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3768 | #line 1576 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3769 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3770 | break; |
| 3771 | |
| 3772 | case 93: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3773 | #line 1577 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3774 | { (yyval.UIntVal) = CallingConv::CSRet; ;} |
| 3775 | break; |
| 3776 | |
| 3777 | case 94: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3778 | #line 1578 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3779 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3780 | break; |
| 3781 | |
| 3782 | case 95: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3783 | #line 1579 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3784 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3785 | break; |
| 3786 | |
| 3787 | case 96: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3788 | #line 1580 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3789 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3790 | break; |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 3791 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3792 | case 97: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3793 | #line 1581 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3794 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3795 | break; |
Reid Spencer | 16244f4 | 2006-12-01 21:10:07 +0000 | [diff] [blame] | 3796 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3797 | case 98: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3798 | #line 1582 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3799 | { |
| 3800 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
| 3801 | error("Calling conv too large"); |
| 3802 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3803 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3804 | break; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 3805 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3806 | case 99: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3807 | #line 1592 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3808 | { (yyval.UIntVal) = 0; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3809 | break; |
| 3810 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3811 | case 100: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3812 | #line 1593 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3813 | { |
| 3814 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3815 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3816 | error("Alignment must be a power of two"); |
| 3817 | ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3818 | break; |
| 3819 | |
| 3820 | case 101: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3821 | #line 1601 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3822 | { (yyval.UIntVal) = 0; ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3823 | break; |
| 3824 | |
| 3825 | case 102: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3826 | #line 1602 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3827 | { |
| 3828 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3829 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3830 | error("Alignment must be a power of two"); |
| 3831 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3832 | break; |
| 3833 | |
| 3834 | case 103: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3835 | #line 1610 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3836 | { |
| 3837 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3838 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
| 3839 | error("Invalid character in section name"); |
| 3840 | (yyval.StrVal) = (yyvsp[0].StrVal); |
| 3841 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3842 | break; |
| 3843 | |
| 3844 | case 104: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3845 | #line 1619 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3846 | { (yyval.StrVal) = 0; ;} |
| 3847 | break; |
| 3848 | |
| 3849 | case 105: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3850 | #line 1620 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3851 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3852 | break; |
| 3853 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3854 | case 106: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3855 | #line 1627 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3856 | {;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 3857 | break; |
| 3858 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3859 | case 107: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3860 | #line 1628 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3861 | {;} |
| 3862 | break; |
| 3863 | |
| 3864 | case 108: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3865 | #line 1632 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3866 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3867 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3868 | free((yyvsp[0].StrVal)); |
| 3869 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3870 | break; |
| 3871 | |
| 3872 | case 109: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3873 | #line 1636 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3874 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3875 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
| 3876 | error("Alignment must be a power of two"); |
| 3877 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
| 3878 | |
| 3879 | ;} |
| 3880 | break; |
| 3881 | |
| 3882 | case 111: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3883 | #line 1653 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3884 | { |
| 3885 | (yyval.TypeVal).T = new PATypeHolder((yyvsp[0].PrimType).T); |
| 3886 | (yyval.TypeVal).S = Signless; |
| 3887 | ;} |
| 3888 | break; |
| 3889 | |
| 3890 | case 113: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3891 | #line 1661 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3892 | { |
| 3893 | (yyval.TypeVal).T = new PATypeHolder((yyvsp[0].PrimType).T); |
| 3894 | (yyval.TypeVal).S = Signless; |
| 3895 | ;} |
| 3896 | break; |
| 3897 | |
| 3898 | case 114: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3899 | #line 1668 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3900 | { |
| 3901 | if (!UpRefs.empty()) |
| 3902 | error("Invalid upreference in type: " + (*(yyvsp[0].TypeVal).T)->getDescription()); |
| 3903 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
| 3904 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3905 | break; |
| 3906 | |
| 3907 | case 127: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3908 | #line 1682 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3909 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3910 | (yyval.TypeVal).T = new PATypeHolder((yyvsp[0].PrimType).T); |
| 3911 | (yyval.TypeVal).S = (yyvsp[0].PrimType).S; |
| 3912 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3913 | break; |
| 3914 | |
| 3915 | case 128: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3916 | #line 1686 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3917 | { |
| 3918 | (yyval.TypeVal).T = new PATypeHolder(OpaqueType::get()); |
| 3919 | (yyval.TypeVal).S = Signless; |
| 3920 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3921 | break; |
| 3922 | |
| 3923 | case 129: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3924 | #line 1690 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3925 | { // Named types are also simple types... |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3926 | const Type* tmp = getType((yyvsp[0].ValIDVal)); |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3927 | (yyval.TypeVal).T = new PATypeHolder(tmp); |
| 3928 | (yyval.TypeVal).S = Signless; // FIXME: what if its signed? |
| 3929 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3930 | break; |
| 3931 | |
| 3932 | case 130: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3933 | #line 1695 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3934 | { // Type UpReference |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3935 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) |
| 3936 | error("Value out of range"); |
| 3937 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
| 3938 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
| 3939 | (yyval.TypeVal).T = new PATypeHolder(OT); |
| 3940 | (yyval.TypeVal).S = Signless; |
| 3941 | UR_OUT("New Upreference!\n"); |
| 3942 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3943 | break; |
| 3944 | |
| 3945 | case 131: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3946 | #line 1704 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3947 | { // Function derived type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3948 | std::vector<const Type*> Params; |
| 3949 | for (std::list<llvm::PATypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3950 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) { |
| 3951 | Params.push_back(I->T->get()); |
| 3952 | delete I->T; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 3953 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3954 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3955 | if (isVarArg) Params.pop_back(); |
| 3956 | |
| 3957 | (yyval.TypeVal).T = new PATypeHolder(HandleUpRefs( |
| 3958 | FunctionType::get((yyvsp[-3].TypeVal).T->get(),Params,isVarArg))); |
| 3959 | (yyval.TypeVal).S = (yyvsp[-3].TypeVal).S; |
| 3960 | delete (yyvsp[-3].TypeVal).T; // Delete the return type handle |
| 3961 | delete (yyvsp[-1].TypeList); // Delete the argument list |
| 3962 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3963 | break; |
| 3964 | |
| 3965 | case 132: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3966 | #line 1720 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3967 | { // Sized array type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3968 | (yyval.TypeVal).T = new PATypeHolder(HandleUpRefs(ArrayType::get((yyvsp[-1].TypeVal).T->get(), |
| 3969 | (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3970 | (yyval.TypeVal).S = (yyvsp[-1].TypeVal).S; |
| 3971 | delete (yyvsp[-1].TypeVal).T; |
| 3972 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3973 | break; |
| 3974 | |
| 3975 | case 133: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3976 | #line 1726 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3977 | { // Packed array type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3978 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal).T->get(); |
| 3979 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
| 3980 | error("Unsigned result not equal to signed result"); |
| 3981 | if (!(ElemTy->isInteger() || ElemTy->isFloatingPoint())) |
| 3982 | error("Elements of a PackedType must be integer or floating point"); |
| 3983 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
| 3984 | error("PackedType length should be a power of 2"); |
| 3985 | (yyval.TypeVal).T = new PATypeHolder(HandleUpRefs(PackedType::get(ElemTy, |
| 3986 | (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3987 | (yyval.TypeVal).S = (yyvsp[-1].TypeVal).S; |
| 3988 | delete (yyvsp[-1].TypeVal).T; |
| 3989 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3990 | break; |
| 3991 | |
| 3992 | case 134: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 3993 | #line 1739 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 3994 | { // Structure type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 3995 | std::vector<const Type*> Elements; |
| 3996 | for (std::list<llvm::PATypeInfo>::iterator I = (yyvsp[-1].TypeList)->begin(), |
| 3997 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
| 3998 | Elements.push_back(I->T->get()); |
| 3999 | (yyval.TypeVal).T = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 4000 | (yyval.TypeVal).S = Signless; |
| 4001 | delete (yyvsp[-1].TypeList); |
| 4002 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4003 | break; |
| 4004 | |
| 4005 | case 135: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4006 | #line 1748 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4007 | { // Empty structure type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4008 | (yyval.TypeVal).T = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
| 4009 | (yyval.TypeVal).S = Signless; |
| 4010 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4011 | break; |
| 4012 | |
| 4013 | case 136: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4014 | #line 1752 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4015 | { // Packed Structure type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4016 | std::vector<const Type*> Elements; |
| 4017 | for (std::list<llvm::PATypeInfo>::iterator I = (yyvsp[-2].TypeList)->begin(), |
| 4018 | E = (yyvsp[-2].TypeList)->end(); I != E; ++I) { |
| 4019 | Elements.push_back(I->T->get()); |
| 4020 | delete I->T; |
Reid Spencer | 52402b0 | 2007-01-02 05:45:11 +0000 | [diff] [blame] | 4021 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4022 | (yyval.TypeVal).T = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 4023 | (yyval.TypeVal).S = Signless; |
| 4024 | delete (yyvsp[-2].TypeList); |
| 4025 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4026 | break; |
| 4027 | |
| 4028 | case 137: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4029 | #line 1763 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4030 | { // Empty packed structure type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4031 | (yyval.TypeVal).T = new PATypeHolder(StructType::get(std::vector<const Type*>(),true)); |
| 4032 | (yyval.TypeVal).S = Signless; |
| 4033 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4034 | break; |
| 4035 | |
| 4036 | case 138: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4037 | #line 1767 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4038 | { // Pointer type? |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4039 | if ((yyvsp[-1].TypeVal).T->get() == Type::LabelTy) |
| 4040 | error("Cannot form a pointer to a basic block"); |
| 4041 | (yyval.TypeVal).T = new PATypeHolder(HandleUpRefs(PointerType::get((yyvsp[-1].TypeVal).T->get()))); |
| 4042 | (yyval.TypeVal).S = (yyvsp[-1].TypeVal).S; |
| 4043 | delete (yyvsp[-1].TypeVal).T; |
| 4044 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4045 | break; |
| 4046 | |
| 4047 | case 139: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4048 | #line 1780 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4049 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4050 | (yyval.TypeList) = new std::list<PATypeInfo>(); |
| 4051 | (yyval.TypeList)->push_back((yyvsp[0].TypeVal)); |
| 4052 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4053 | break; |
| 4054 | |
| 4055 | case 140: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4056 | #line 1784 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4057 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4058 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back((yyvsp[0].TypeVal)); |
| 4059 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4060 | break; |
| 4061 | |
| 4062 | case 142: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4063 | #line 1792 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4064 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4065 | PATypeInfo VoidTI; |
| 4066 | VoidTI.T = new PATypeHolder(Type::VoidTy); |
| 4067 | VoidTI.S = Signless; |
| 4068 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(VoidTI); |
| 4069 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4070 | break; |
| 4071 | |
| 4072 | case 143: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4073 | #line 1798 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4074 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4075 | (yyval.TypeList) = new std::list<PATypeInfo>(); |
| 4076 | PATypeInfo VoidTI; |
| 4077 | VoidTI.T = new PATypeHolder(Type::VoidTy); |
| 4078 | VoidTI.S = Signless; |
| 4079 | (yyval.TypeList)->push_back(VoidTI); |
| 4080 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4081 | break; |
| 4082 | |
| 4083 | case 144: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4084 | #line 1805 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4085 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4086 | (yyval.TypeList) = new std::list<PATypeInfo>(); |
| 4087 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4088 | break; |
| 4089 | |
| 4090 | case 145: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4091 | #line 1817 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4092 | { // Nonempty unsized arr |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4093 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal).T->get()); |
| 4094 | if (ATy == 0) |
| 4095 | error("Cannot make array constant with type: '" + |
| 4096 | (yyvsp[-3].TypeVal).T->get()->getDescription() + "'"); |
| 4097 | const Type *ETy = ATy->getElementType(); |
| 4098 | int NumElements = ATy->getNumElements(); |
| 4099 | |
| 4100 | // Verify that we have the correct size... |
| 4101 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
| 4102 | error("Type mismatch: constant sized array initialized with " + |
| 4103 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
| 4104 | itostr(NumElements) + ""); |
| 4105 | |
| 4106 | // Verify all elements are correct type! |
| 4107 | std::vector<Constant*> Elems; |
| 4108 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4109 | Constant *C = (*(yyvsp[-1].ConstVector))[i].C; |
| 4110 | const Type* ValTy = C->getType(); |
| 4111 | if (ETy != ValTy) |
| 4112 | error("Element #" + utostr(i) + " is not of type '" + |
| 4113 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
| 4114 | ValTy->getDescription() + "'"); |
| 4115 | Elems.push_back(C); |
| 4116 | } |
| 4117 | (yyval.ConstVal).C = ConstantArray::get(ATy, Elems); |
| 4118 | (yyval.ConstVal).S = (yyvsp[-3].TypeVal).S; |
| 4119 | delete (yyvsp[-3].TypeVal).T; |
| 4120 | delete (yyvsp[-1].ConstVector); |
| 4121 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4122 | break; |
| 4123 | |
| 4124 | case 146: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4125 | #line 1847 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4126 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4127 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal).T->get()); |
| 4128 | if (ATy == 0) |
| 4129 | error("Cannot make array constant with type: '" + |
| 4130 | (yyvsp[-2].TypeVal).T->get()->getDescription() + "'"); |
| 4131 | int NumElements = ATy->getNumElements(); |
| 4132 | if (NumElements != -1 && NumElements != 0) |
| 4133 | error("Type mismatch: constant sized array initialized with 0" |
| 4134 | " arguments, but has size of " + itostr(NumElements) +""); |
| 4135 | (yyval.ConstVal).C = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 4136 | (yyval.ConstVal).S = (yyvsp[-2].TypeVal).S; |
| 4137 | delete (yyvsp[-2].TypeVal).T; |
| 4138 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4139 | break; |
| 4140 | |
| 4141 | case 147: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4142 | #line 1860 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4143 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4144 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal).T->get()); |
| 4145 | if (ATy == 0) |
| 4146 | error("Cannot make array constant with type: '" + |
| 4147 | (yyvsp[-2].TypeVal).T->get()->getDescription() + "'"); |
| 4148 | int NumElements = ATy->getNumElements(); |
| 4149 | const Type *ETy = dyn_cast<IntegerType>(ATy->getElementType()); |
| 4150 | if (!ETy || cast<IntegerType>(ETy)->getBitWidth() != 8) |
| 4151 | error("String arrays require type i8, not '" + ETy->getDescription() + |
| 4152 | "'"); |
| 4153 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4154 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
| 4155 | error("Can't build string constant of size " + |
| 4156 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + " when array has size " + |
| 4157 | itostr(NumElements) + ""); |
| 4158 | std::vector<Constant*> Vals; |
| 4159 | for (char *C = (char *)(yyvsp[0].StrVal); C != (char *)EndStr; ++C) |
| 4160 | Vals.push_back(ConstantInt::get(ETy, *C)); |
| 4161 | free((yyvsp[0].StrVal)); |
| 4162 | (yyval.ConstVal).C = ConstantArray::get(ATy, Vals); |
| 4163 | (yyval.ConstVal).S = (yyvsp[-2].TypeVal).S; |
| 4164 | delete (yyvsp[-2].TypeVal).T; |
| 4165 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4166 | break; |
| 4167 | |
| 4168 | case 148: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4169 | #line 1883 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4170 | { // Nonempty unsized arr |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4171 | const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal).T->get()); |
| 4172 | if (PTy == 0) |
| 4173 | error("Cannot make packed constant with type: '" + |
| 4174 | (yyvsp[-3].TypeVal).T->get()->getDescription() + "'"); |
| 4175 | const Type *ETy = PTy->getElementType(); |
| 4176 | int NumElements = PTy->getNumElements(); |
| 4177 | // Verify that we have the correct size... |
| 4178 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
| 4179 | error("Type mismatch: constant sized packed initialized with " + |
| 4180 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
| 4181 | itostr(NumElements) + ""); |
| 4182 | // Verify all elements are correct type! |
| 4183 | std::vector<Constant*> Elems; |
| 4184 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 4185 | Constant *C = (*(yyvsp[-1].ConstVector))[i].C; |
| 4186 | const Type* ValTy = C->getType(); |
| 4187 | if (ETy != ValTy) |
| 4188 | error("Element #" + utostr(i) + " is not of type '" + |
| 4189 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
| 4190 | ValTy->getDescription() + "'"); |
| 4191 | Elems.push_back(C); |
| 4192 | } |
| 4193 | (yyval.ConstVal).C = ConstantPacked::get(PTy, Elems); |
| 4194 | (yyval.ConstVal).S = (yyvsp[-3].TypeVal).S; |
| 4195 | delete (yyvsp[-3].TypeVal).T; |
| 4196 | delete (yyvsp[-1].ConstVector); |
| 4197 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4198 | break; |
| 4199 | |
| 4200 | case 149: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4201 | #line 1911 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4202 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4203 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal).T->get()); |
| 4204 | if (STy == 0) |
| 4205 | error("Cannot make struct constant with type: '" + |
| 4206 | (yyvsp[-3].TypeVal).T->get()->getDescription() + "'"); |
| 4207 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
| 4208 | error("Illegal number of initializers for structure type"); |
| 4209 | |
| 4210 | // Check to ensure that constants are compatible with the type initializer! |
| 4211 | std::vector<Constant*> Fields; |
| 4212 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) { |
| 4213 | Constant *C = (*(yyvsp[-1].ConstVector))[i].C; |
| 4214 | if (C->getType() != STy->getElementType(i)) |
| 4215 | error("Expected type '" + STy->getElementType(i)->getDescription() + |
| 4216 | "' for element #" + utostr(i) + " of structure initializer"); |
| 4217 | Fields.push_back(C); |
| 4218 | } |
| 4219 | (yyval.ConstVal).C = ConstantStruct::get(STy, Fields); |
| 4220 | (yyval.ConstVal).S = (yyvsp[-3].TypeVal).S; |
| 4221 | delete (yyvsp[-3].TypeVal).T; |
| 4222 | delete (yyvsp[-1].ConstVector); |
| 4223 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4224 | break; |
| 4225 | |
| 4226 | case 150: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4227 | #line 1933 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4228 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4229 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal).T->get()); |
| 4230 | if (STy == 0) |
| 4231 | error("Cannot make struct constant with type: '" + |
| 4232 | (yyvsp[-2].TypeVal).T->get()->getDescription() + "'"); |
| 4233 | if (STy->getNumContainedTypes() != 0) |
| 4234 | error("Illegal number of initializers for structure type"); |
| 4235 | (yyval.ConstVal).C = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4236 | (yyval.ConstVal).S = (yyvsp[-2].TypeVal).S; |
| 4237 | delete (yyvsp[-2].TypeVal).T; |
| 4238 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4239 | break; |
| 4240 | |
| 4241 | case 151: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4242 | #line 1944 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4243 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4244 | const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal).T->get()); |
| 4245 | if (STy == 0) |
| 4246 | error("Cannot make packed struct constant with type: '" + |
| 4247 | (yyvsp[-5].TypeVal).T->get()->getDescription() + "'"); |
| 4248 | if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes()) |
| 4249 | error("Illegal number of initializers for packed structure type"); |
| 4250 | |
| 4251 | // Check to ensure that constants are compatible with the type initializer! |
| 4252 | std::vector<Constant*> Fields; |
| 4253 | for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i) { |
| 4254 | Constant *C = (*(yyvsp[-2].ConstVector))[i].C; |
| 4255 | if (C->getType() != STy->getElementType(i)) |
| 4256 | error("Expected type '" + STy->getElementType(i)->getDescription() + |
| 4257 | "' for element #" + utostr(i) + " of packed struct initializer"); |
| 4258 | Fields.push_back(C); |
| 4259 | } |
| 4260 | (yyval.ConstVal).C = ConstantStruct::get(STy, Fields); |
| 4261 | (yyval.ConstVal).S = (yyvsp[-5].TypeVal).S; |
| 4262 | delete (yyvsp[-5].TypeVal).T; |
| 4263 | delete (yyvsp[-2].ConstVector); |
| 4264 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4265 | break; |
| 4266 | |
| 4267 | case 152: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4268 | #line 1966 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4269 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4270 | const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal).T->get()); |
| 4271 | if (STy == 0) |
| 4272 | error("Cannot make packed struct constant with type: '" + |
| 4273 | (yyvsp[-4].TypeVal).T->get()->getDescription() + "'"); |
| 4274 | if (STy->getNumContainedTypes() != 0) |
| 4275 | error("Illegal number of initializers for packed structure type"); |
| 4276 | (yyval.ConstVal).C = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4277 | (yyval.ConstVal).S = (yyvsp[-4].TypeVal).S; |
| 4278 | delete (yyvsp[-4].TypeVal).T; |
| 4279 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4280 | break; |
| 4281 | |
| 4282 | case 153: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4283 | #line 1977 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4284 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4285 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal).T->get()); |
| 4286 | if (PTy == 0) |
| 4287 | error("Cannot make null pointer constant with type: '" + |
| 4288 | (yyvsp[-1].TypeVal).T->get()->getDescription() + "'"); |
| 4289 | (yyval.ConstVal).C = ConstantPointerNull::get(PTy); |
| 4290 | (yyval.ConstVal).S = (yyvsp[-1].TypeVal).S; |
| 4291 | delete (yyvsp[-1].TypeVal).T; |
| 4292 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4293 | break; |
| 4294 | |
| 4295 | case 154: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4296 | #line 1986 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4297 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4298 | (yyval.ConstVal).C = UndefValue::get((yyvsp[-1].TypeVal).T->get()); |
| 4299 | (yyval.ConstVal).S = (yyvsp[-1].TypeVal).S; |
| 4300 | delete (yyvsp[-1].TypeVal).T; |
| 4301 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4302 | break; |
| 4303 | |
| 4304 | case 155: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4305 | #line 1991 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4306 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4307 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal).T->get()); |
| 4308 | if (Ty == 0) |
| 4309 | error("Global const reference must be a pointer type, not" + |
| 4310 | (yyvsp[-1].TypeVal).T->get()->getDescription()); |
| 4311 | |
| 4312 | // ConstExprs can exist in the body of a function, thus creating |
| 4313 | // GlobalValues whenever they refer to a variable. Because we are in |
| 4314 | // the context of a function, getExistingValue will search the functions |
| 4315 | // symbol table instead of the module symbol table for the global symbol, |
| 4316 | // which throws things all off. To get around this, we just tell |
| 4317 | // getExistingValue that we are at global scope here. |
| 4318 | // |
| 4319 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4320 | CurFun.CurrentFunction = 0; |
| 4321 | Value *V = getExistingValue(Ty, (yyvsp[0].ValIDVal)); |
| 4322 | CurFun.CurrentFunction = SavedCurFn; |
| 4323 | |
| 4324 | // If this is an initializer for a constant pointer, which is referencing a |
| 4325 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4326 | // in the future with the right type of variable. |
| 4327 | // |
| 4328 | if (V == 0) { |
| 4329 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers"); |
| 4330 | const PointerType *PT = cast<PointerType>(Ty); |
| 4331 | |
| 4332 | // First check to see if the forward references value is already created! |
| 4333 | PerModuleInfo::GlobalRefsType::iterator I = |
| 4334 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
| 4335 | |
| 4336 | if (I != CurModule.GlobalRefs.end()) { |
| 4337 | V = I->second; // Placeholder already exists, use it... |
| 4338 | (yyvsp[0].ValIDVal).destroy(); |
| 4339 | } else { |
| 4340 | std::string Name; |
| 4341 | if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; |
| 4342 | |
| 4343 | // Create the forward referenced global. |
| 4344 | GlobalValue *GV; |
| 4345 | if (const FunctionType *FTy = |
| 4346 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 4347 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 4348 | CurModule.CurrentModule); |
| 4349 | } else { |
| 4350 | GV = new GlobalVariable(PT->getElementType(), false, |
| 4351 | GlobalValue::ExternalLinkage, 0, |
| 4352 | Name, CurModule.CurrentModule); |
| 4353 | } |
| 4354 | |
| 4355 | // Keep track of the fact that we have a forward ref to recycle it |
| 4356 | CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV)); |
| 4357 | V = GV; |
| 4358 | } |
| 4359 | } |
| 4360 | (yyval.ConstVal).C = cast<GlobalValue>(V); |
| 4361 | (yyval.ConstVal).S = (yyvsp[-1].TypeVal).S; |
| 4362 | delete (yyvsp[-1].TypeVal).T; // Free the type handle |
| 4363 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4364 | break; |
| 4365 | |
| 4366 | case 156: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4367 | #line 2049 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4368 | { |
| 4369 | if ((yyvsp[-1].TypeVal).T->get() != (yyvsp[0].ConstVal).C->getType()) |
| 4370 | error("Mismatched types for constant expression"); |
| 4371 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
| 4372 | (yyval.ConstVal).S = (yyvsp[-1].TypeVal).S; |
| 4373 | delete (yyvsp[-1].TypeVal).T; |
| 4374 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4375 | break; |
| 4376 | |
| 4377 | case 157: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4378 | #line 2056 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4379 | { |
| 4380 | const Type *Ty = (yyvsp[-1].TypeVal).T->get(); |
| 4381 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4382 | error("Cannot create a null initialized value of this type"); |
| 4383 | (yyval.ConstVal).C = Constant::getNullValue(Ty); |
| 4384 | (yyval.ConstVal).S = (yyvsp[-1].TypeVal).S; |
| 4385 | delete (yyvsp[-1].TypeVal).T; |
| 4386 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4387 | break; |
| 4388 | |
| 4389 | case 158: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4390 | #line 2064 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4391 | { // integral constants |
| 4392 | const Type *Ty = (yyvsp[-1].PrimType).T; |
| 4393 | if (!ConstantInt::isValueValidForType(Ty, (yyvsp[0].SInt64Val))) |
| 4394 | error("Constant value doesn't fit in type"); |
| 4395 | (yyval.ConstVal).C = ConstantInt::get(Ty, (yyvsp[0].SInt64Val)); |
| 4396 | (yyval.ConstVal).S = Signed; |
| 4397 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4398 | break; |
| 4399 | |
| 4400 | case 159: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4401 | #line 2071 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4402 | { // integral constants |
| 4403 | const Type *Ty = (yyvsp[-1].PrimType).T; |
| 4404 | if (!ConstantInt::isValueValidForType(Ty, (yyvsp[0].UInt64Val))) |
| 4405 | error("Constant value doesn't fit in type"); |
| 4406 | (yyval.ConstVal).C = ConstantInt::get(Ty, (yyvsp[0].UInt64Val)); |
| 4407 | (yyval.ConstVal).S = Unsigned; |
| 4408 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4409 | break; |
| 4410 | |
| 4411 | case 160: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4412 | #line 2078 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4413 | { // Boolean constants |
| 4414 | (yyval.ConstVal).C = ConstantInt::get(Type::Int1Ty, true); |
| 4415 | (yyval.ConstVal).S = Unsigned; |
| 4416 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4417 | break; |
| 4418 | |
| 4419 | case 161: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4420 | #line 2082 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4421 | { // Boolean constants |
| 4422 | (yyval.ConstVal).C = ConstantInt::get(Type::Int1Ty, false); |
| 4423 | (yyval.ConstVal).S = Unsigned; |
| 4424 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4425 | break; |
| 4426 | |
| 4427 | case 162: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4428 | #line 2086 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4429 | { // Float & Double constants |
| 4430 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType).T, (yyvsp[0].FPVal))) |
| 4431 | error("Floating point constant invalid for type"); |
| 4432 | (yyval.ConstVal).C = ConstantFP::get((yyvsp[-1].PrimType).T, (yyvsp[0].FPVal)); |
| 4433 | (yyval.ConstVal).S = Signless; |
| 4434 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4435 | break; |
| 4436 | |
| 4437 | case 163: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4438 | #line 2095 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4439 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4440 | const Type* SrcTy = (yyvsp[-3].ConstVal).C->getType(); |
| 4441 | const Type* DstTy = (yyvsp[-1].TypeVal).T->get(); |
| 4442 | Signedness SrcSign = (yyvsp[-3].ConstVal).S; |
| 4443 | Signedness DstSign = (yyvsp[-1].TypeVal).S; |
| 4444 | if (!SrcTy->isFirstClassType()) |
| 4445 | error("cast constant expression from a non-primitive type: '" + |
| 4446 | SrcTy->getDescription() + "'"); |
| 4447 | if (!DstTy->isFirstClassType()) |
| 4448 | error("cast constant expression to a non-primitive type: '" + |
| 4449 | DstTy->getDescription() + "'"); |
| 4450 | (yyval.ConstVal).C = cast<Constant>(getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal).C, SrcSign, DstTy, DstSign)); |
| 4451 | (yyval.ConstVal).S = DstSign; |
| 4452 | delete (yyvsp[-1].TypeVal).T; |
| 4453 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4454 | break; |
| 4455 | |
| 4456 | case 164: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4457 | #line 2110 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4458 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4459 | const Type *Ty = (yyvsp[-2].ConstVal).C->getType(); |
| 4460 | if (!isa<PointerType>(Ty)) |
| 4461 | error("GetElementPtr requires a pointer operand"); |
| 4462 | |
| 4463 | std::vector<Value*> VIndices; |
| 4464 | std::vector<Constant*> CIndices; |
| 4465 | upgradeGEPIndices((yyvsp[-2].ConstVal).C->getType(), (yyvsp[-1].ValueList), VIndices, &CIndices); |
| 4466 | |
| 4467 | delete (yyvsp[-1].ValueList); |
| 4468 | (yyval.ConstVal).C = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal).C, CIndices); |
| 4469 | (yyval.ConstVal).S = Signless; |
| 4470 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4471 | break; |
| 4472 | |
| 4473 | case 165: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4474 | #line 2123 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4475 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4476 | if (!(yyvsp[-5].ConstVal).C->getType()->isInteger() || |
| 4477 | cast<IntegerType>((yyvsp[-5].ConstVal).C->getType())->getBitWidth() != 1) |
| 4478 | error("Select condition must be bool type"); |
| 4479 | if ((yyvsp[-3].ConstVal).C->getType() != (yyvsp[-1].ConstVal).C->getType()) |
| 4480 | error("Select operand types must match"); |
| 4481 | (yyval.ConstVal).C = ConstantExpr::getSelect((yyvsp[-5].ConstVal).C, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4482 | (yyval.ConstVal).S = Unsigned; |
| 4483 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4484 | break; |
| 4485 | |
| 4486 | case 166: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4487 | #line 2132 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4488 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4489 | const Type *Ty = (yyvsp[-3].ConstVal).C->getType(); |
| 4490 | if (Ty != (yyvsp[-1].ConstVal).C->getType()) |
| 4491 | error("Binary operator types must match"); |
| 4492 | // First, make sure we're dealing with the right opcode by upgrading from |
| 4493 | // obsolete versions. |
| 4494 | Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[-5].BinaryOpVal), Ty, (yyvsp[-3].ConstVal).S); |
| 4495 | |
| 4496 | // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. |
| 4497 | // To retain backward compatibility with these early compilers, we emit a |
| 4498 | // cast to the appropriate integer type automatically if we are in the |
| 4499 | // broken case. See PR424 for more information. |
| 4500 | if (!isa<PointerType>(Ty)) { |
| 4501 | (yyval.ConstVal).C = ConstantExpr::get(Opcode, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4502 | } else { |
| 4503 | const Type *IntPtrTy = 0; |
| 4504 | switch (CurModule.CurrentModule->getPointerSize()) { |
| 4505 | case Module::Pointer32: IntPtrTy = Type::Int32Ty; break; |
| 4506 | case Module::Pointer64: IntPtrTy = Type::Int64Ty; break; |
| 4507 | default: error("invalid pointer binary constant expr"); |
| 4508 | } |
| 4509 | (yyval.ConstVal).C = ConstantExpr::get(Opcode, |
| 4510 | ConstantExpr::getCast(Instruction::PtrToInt, (yyvsp[-3].ConstVal).C, IntPtrTy), |
| 4511 | ConstantExpr::getCast(Instruction::PtrToInt, (yyvsp[-1].ConstVal).C, IntPtrTy)); |
| 4512 | (yyval.ConstVal).C = ConstantExpr::getCast(Instruction::IntToPtr, (yyval.ConstVal).C, Ty); |
| 4513 | } |
| 4514 | (yyval.ConstVal).S = (yyvsp[-3].ConstVal).S; |
| 4515 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4516 | break; |
| 4517 | |
| 4518 | case 167: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4519 | #line 2160 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4520 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4521 | const Type* Ty = (yyvsp[-3].ConstVal).C->getType(); |
| 4522 | if (Ty != (yyvsp[-1].ConstVal).C->getType()) |
| 4523 | error("Logical operator types must match"); |
| 4524 | if (!Ty->isInteger()) { |
| 4525 | if (!isa<PackedType>(Ty) || |
| 4526 | !cast<PackedType>(Ty)->getElementType()->isInteger()) |
| 4527 | error("Logical operator requires integer operands"); |
| 4528 | } |
| 4529 | Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[-5].BinaryOpVal), Ty, (yyvsp[-3].ConstVal).S); |
| 4530 | (yyval.ConstVal).C = ConstantExpr::get(Opcode, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4531 | (yyval.ConstVal).S = (yyvsp[-3].ConstVal).S; |
| 4532 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4533 | break; |
| 4534 | |
| 4535 | case 168: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4536 | #line 2173 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4537 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4538 | const Type* Ty = (yyvsp[-3].ConstVal).C->getType(); |
| 4539 | if (Ty != (yyvsp[-1].ConstVal).C->getType()) |
| 4540 | error("setcc operand types must match"); |
| 4541 | unsigned short pred; |
| 4542 | Instruction::OtherOps Opcode = getCompareOp((yyvsp[-5].BinaryOpVal), pred, Ty, (yyvsp[-3].ConstVal).S); |
| 4543 | (yyval.ConstVal).C = ConstantExpr::getCompare(Opcode, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4544 | (yyval.ConstVal).S = Unsigned; |
| 4545 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4546 | break; |
| 4547 | |
| 4548 | case 169: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4549 | #line 2182 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4550 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4551 | if ((yyvsp[-3].ConstVal).C->getType() != (yyvsp[-1].ConstVal).C->getType()) |
| 4552 | error("icmp operand types must match"); |
| 4553 | (yyval.ConstVal).C = ConstantExpr::getCompare((yyvsp[-5].IPred), (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4554 | (yyval.ConstVal).S = Unsigned; |
| 4555 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4556 | break; |
| 4557 | |
| 4558 | case 170: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4559 | #line 2188 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4560 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4561 | if ((yyvsp[-3].ConstVal).C->getType() != (yyvsp[-1].ConstVal).C->getType()) |
| 4562 | error("fcmp operand types must match"); |
| 4563 | (yyval.ConstVal).C = ConstantExpr::getCompare((yyvsp[-5].FPred), (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4564 | (yyval.ConstVal).S = Unsigned; |
| 4565 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4566 | break; |
| 4567 | |
| 4568 | case 171: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4569 | #line 2194 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4570 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4571 | if (!(yyvsp[-1].ConstVal).C->getType()->isInteger() || |
| 4572 | cast<IntegerType>((yyvsp[-1].ConstVal).C->getType())->getBitWidth() != 8) |
| 4573 | error("Shift count for shift constant must be unsigned byte"); |
| 4574 | if (!(yyvsp[-3].ConstVal).C->getType()->isInteger()) |
| 4575 | error("Shift constant expression requires integer operand"); |
| 4576 | (yyval.ConstVal).C = ConstantExpr::get(getOtherOp((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal).S), (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4577 | (yyval.ConstVal).S = (yyvsp[-3].ConstVal).S; |
| 4578 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4579 | break; |
| 4580 | |
| 4581 | case 172: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4582 | #line 2203 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4583 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4584 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C)) |
| 4585 | error("Invalid extractelement operands"); |
| 4586 | (yyval.ConstVal).C = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4587 | (yyval.ConstVal).S = (yyvsp[-3].ConstVal).S; |
| 4588 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4589 | break; |
| 4590 | |
| 4591 | case 173: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4592 | #line 2209 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4593 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4594 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal).C, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C)) |
| 4595 | error("Invalid insertelement operands"); |
| 4596 | (yyval.ConstVal).C = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal).C, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4597 | (yyval.ConstVal).S = (yyvsp[-5].ConstVal).S; |
| 4598 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4599 | break; |
| 4600 | |
| 4601 | case 174: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4602 | #line 2215 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4603 | { |
| 4604 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal).C, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C)) |
| 4605 | error("Invalid shufflevector operands"); |
| 4606 | (yyval.ConstVal).C = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal).C, (yyvsp[-3].ConstVal).C, (yyvsp[-1].ConstVal).C); |
| 4607 | (yyval.ConstVal).S = (yyvsp[-5].ConstVal).S; |
| 4608 | ;} |
| 4609 | break; |
| 4610 | |
| 4611 | case 175: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4612 | #line 2226 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4613 | { ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); ;} |
| 4614 | break; |
| 4615 | |
| 4616 | case 176: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4617 | #line 2227 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4618 | { |
| 4619 | (yyval.ConstVector) = new std::vector<ConstInfo>(); |
| 4620 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
| 4621 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4622 | break; |
| 4623 | |
| 4624 | case 177: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4625 | #line 2236 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4626 | { (yyval.BoolVal) = false; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4627 | break; |
| 4628 | |
| 4629 | case 178: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4630 | #line 2237 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4631 | { (yyval.BoolVal) = true; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4632 | break; |
| 4633 | |
| 4634 | case 179: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4635 | #line 2249 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4636 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4637 | (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); |
| 4638 | CurModule.ModuleDone(); |
| 4639 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4640 | break; |
| 4641 | |
| 4642 | case 180: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4643 | #line 2258 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4644 | { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4645 | break; |
| 4646 | |
| 4647 | case 181: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4648 | #line 2259 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4649 | { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4650 | break; |
| 4651 | |
| 4652 | case 182: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4653 | #line 2260 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4654 | { (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); ;} |
| 4655 | break; |
| 4656 | |
| 4657 | case 183: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4658 | #line 2261 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4659 | { (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4660 | break; |
| 4661 | |
| 4662 | case 184: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4663 | #line 2262 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4664 | { |
| 4665 | (yyval.ModuleVal) = CurModule.CurrentModule; |
| 4666 | // Emit an error if there are any unresolved types left. |
| 4667 | if (!CurModule.LateResolveTypes.empty()) { |
| 4668 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 4669 | if (DID.Type == ValID::NameVal) { |
| 4670 | error("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4671 | } else { |
| 4672 | error("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4673 | } |
| 4674 | } |
| 4675 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4676 | break; |
| 4677 | |
| 4678 | case 185: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4679 | #line 2278 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4680 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4681 | // Eagerly resolve types. This is not an optimization, this is a |
| 4682 | // requirement that is due to the fact that we could have this: |
| 4683 | // |
| 4684 | // %list = type { %list * } |
| 4685 | // %list = type { %list * } ; repeated type decl |
| 4686 | // |
| 4687 | // If types are not resolved eagerly, then the two types will not be |
| 4688 | // determined to be the same type! |
| 4689 | // |
| 4690 | const Type* Ty = (yyvsp[0].TypeVal).T->get(); |
| 4691 | ResolveTypeTo((yyvsp[-2].StrVal), Ty); |
| 4692 | |
| 4693 | if (!setTypeName(Ty, (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
| 4694 | // If this is a named type that is not a redefinition, add it to the slot |
| 4695 | // table. |
| 4696 | CurModule.Types.push_back(Ty); |
Reid Spencer | a50d596 | 2006-12-02 04:11:07 +0000 | [diff] [blame] | 4697 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4698 | delete (yyvsp[0].TypeVal).T; |
| 4699 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4700 | break; |
| 4701 | |
| 4702 | case 186: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4703 | #line 2298 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4704 | { // Function prototypes can be in const pool |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4705 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4706 | break; |
| 4707 | |
| 4708 | case 187: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4709 | #line 2300 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4710 | { // Asm blocks can be in the const pool |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4711 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4712 | break; |
| 4713 | |
| 4714 | case 188: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4715 | #line 2302 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4716 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4717 | if ((yyvsp[0].ConstVal).C == 0) |
| 4718 | error("Global value initializer is not a constant"); |
| 4719 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal).C->getType(), (yyvsp[0].ConstVal).C); |
| 4720 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4721 | break; |
| 4722 | |
| 4723 | case 189: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4724 | #line 2306 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4725 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4726 | CurGV = 0; |
| 4727 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4728 | break; |
| 4729 | |
| 4730 | case 190: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4731 | #line 2309 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4732 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4733 | const Type *Ty = (yyvsp[0].TypeVal).T->get(); |
| 4734 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), Ty, 0); |
| 4735 | delete (yyvsp[0].TypeVal).T; |
| 4736 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4737 | break; |
| 4738 | |
| 4739 | case 191: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4740 | #line 2313 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4741 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4742 | CurGV = 0; |
| 4743 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4744 | break; |
| 4745 | |
| 4746 | case 192: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4747 | #line 2316 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4748 | { |
| 4749 | const Type *Ty = (yyvsp[0].TypeVal).T->get(); |
| 4750 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), Ty, 0); |
| 4751 | delete (yyvsp[0].TypeVal).T; |
| 4752 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4753 | break; |
| 4754 | |
| 4755 | case 193: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4756 | #line 2320 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4757 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4758 | CurGV = 0; |
| 4759 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4760 | break; |
| 4761 | |
| 4762 | case 194: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4763 | #line 2323 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4764 | { |
| 4765 | const Type *Ty = (yyvsp[0].TypeVal).T->get(); |
| 4766 | CurGV = |
| 4767 | ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), Ty, 0); |
| 4768 | delete (yyvsp[0].TypeVal).T; |
| 4769 | ;} |
| 4770 | break; |
| 4771 | |
| 4772 | case 195: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4773 | #line 2328 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4774 | { |
| 4775 | CurGV = 0; |
| 4776 | ;} |
| 4777 | break; |
| 4778 | |
| 4779 | case 196: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4780 | #line 2331 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4781 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4782 | ;} |
| 4783 | break; |
| 4784 | |
| 4785 | case 197: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4786 | #line 2333 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4787 | { |
| 4788 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4789 | break; |
| 4790 | |
| 4791 | case 198: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4792 | #line 2335 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4793 | { |
| 4794 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4795 | break; |
| 4796 | |
| 4797 | case 199: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4798 | #line 2340 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4799 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4800 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
| 4801 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4802 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4803 | free((yyvsp[0].StrVal)); |
| 4804 | |
| 4805 | if (AsmSoFar.empty()) |
| 4806 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4807 | else |
| 4808 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
| 4809 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4810 | break; |
| 4811 | |
| 4812 | case 200: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4813 | #line 2354 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4814 | { (yyval.Endianness) = Module::BigEndian; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4815 | break; |
| 4816 | |
| 4817 | case 201: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4818 | #line 2355 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4819 | { (yyval.Endianness) = Module::LittleEndian; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4820 | break; |
| 4821 | |
| 4822 | case 202: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4823 | #line 2359 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4824 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4825 | CurModule.setEndianness((yyvsp[0].Endianness)); |
| 4826 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4827 | break; |
| 4828 | |
| 4829 | case 203: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4830 | #line 2362 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4831 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4832 | if ((yyvsp[0].UInt64Val) == 32) |
| 4833 | CurModule.setPointerSize(Module::Pointer32); |
| 4834 | else if ((yyvsp[0].UInt64Val) == 64) |
| 4835 | CurModule.setPointerSize(Module::Pointer64); |
| 4836 | else |
| 4837 | error("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'"); |
| 4838 | ;} |
| 4839 | break; |
| 4840 | |
| 4841 | case 204: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4842 | #line 2370 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4843 | { |
| 4844 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4845 | free((yyvsp[0].StrVal)); |
| 4846 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4847 | break; |
| 4848 | |
| 4849 | case 205: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4850 | #line 2374 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4851 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4852 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4853 | free((yyvsp[0].StrVal)); |
| 4854 | ;} |
| 4855 | break; |
| 4856 | |
| 4857 | case 207: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4858 | #line 2385 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4859 | { |
| 4860 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4861 | free((yyvsp[0].StrVal)); |
| 4862 | ;} |
| 4863 | break; |
| 4864 | |
| 4865 | case 208: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4866 | #line 2389 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4867 | { |
| 4868 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4869 | free((yyvsp[0].StrVal)); |
| 4870 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4871 | break; |
| 4872 | |
| 4873 | case 209: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4874 | #line 2393 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4875 | { ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4876 | break; |
| 4877 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4878 | case 213: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4879 | #line 2406 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4880 | { (yyval.StrVal) = 0; ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 4881 | break; |
| 4882 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4883 | case 214: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4884 | #line 2410 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4885 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4886 | if ((yyvsp[-1].TypeVal).T->get() == Type::VoidTy) |
| 4887 | error("void typed arguments are invalid"); |
| 4888 | (yyval.ArgVal) = new std::pair<PATypeInfo, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); |
| 4889 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4890 | break; |
| 4891 | |
| 4892 | case 215: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4893 | #line 2418 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4894 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4895 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
| 4896 | (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); |
| 4897 | delete (yyvsp[0].ArgVal); |
| 4898 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4899 | break; |
| 4900 | |
| 4901 | case 216: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4902 | #line 2423 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4903 | { |
| 4904 | (yyval.ArgList) = new std::vector<std::pair<PATypeInfo,char*> >(); |
| 4905 | (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); |
| 4906 | delete (yyvsp[0].ArgVal); |
| 4907 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4908 | break; |
| 4909 | |
| 4910 | case 217: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4911 | #line 2431 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4912 | { (yyval.ArgList) = (yyvsp[0].ArgList); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4913 | break; |
| 4914 | |
| 4915 | case 218: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4916 | #line 2432 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4917 | { |
| 4918 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
| 4919 | PATypeInfo VoidTI; |
| 4920 | VoidTI.T = new PATypeHolder(Type::VoidTy); |
| 4921 | VoidTI.S = Signless; |
| 4922 | (yyval.ArgList)->push_back(std::pair<PATypeInfo, char*>(VoidTI, 0)); |
| 4923 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4924 | break; |
| 4925 | |
| 4926 | case 219: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4927 | #line 2439 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4928 | { |
| 4929 | (yyval.ArgList) = new std::vector<std::pair<PATypeInfo,char*> >(); |
| 4930 | PATypeInfo VoidTI; |
| 4931 | VoidTI.T = new PATypeHolder(Type::VoidTy); |
| 4932 | VoidTI.S = Signless; |
| 4933 | (yyval.ArgList)->push_back(std::pair<PATypeInfo, char*>(VoidTI, 0)); |
| 4934 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4935 | break; |
| 4936 | |
| 4937 | case 220: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4938 | #line 2446 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4939 | { (yyval.ArgList) = 0; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4940 | break; |
| 4941 | |
| 4942 | case 221: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 4943 | #line 2450 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 4944 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 4945 | UnEscapeLexed((yyvsp[-5].StrVal)); |
| 4946 | std::string FunctionName((yyvsp[-5].StrVal)); |
| 4947 | free((yyvsp[-5].StrVal)); // Free strdup'd memory! |
| 4948 | |
| 4949 | const Type* RetTy = (yyvsp[-6].TypeVal).T->get(); |
| 4950 | |
| 4951 | if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy) |
| 4952 | error("LLVM functions cannot return aggregate types"); |
| 4953 | |
| 4954 | std::vector<const Type*> ParamTypeList; |
| 4955 | |
| 4956 | // In LLVM 2.0 the signatures of three varargs intrinsics changed to take |
| 4957 | // i8*. We check here for those names and override the parameter list |
| 4958 | // types to ensure the prototype is correct. |
| 4959 | if (FunctionName == "llvm.va_start" || FunctionName == "llvm.va_end") { |
| 4960 | ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); |
| 4961 | } else if (FunctionName == "llvm.va_copy") { |
| 4962 | ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); |
| 4963 | ParamTypeList.push_back(PointerType::get(Type::Int8Ty)); |
| 4964 | } else if ((yyvsp[-3].ArgList)) { // If there are arguments... |
| 4965 | for (std::vector<std::pair<PATypeInfo,char*> >::iterator |
| 4966 | I = (yyvsp[-3].ArgList)->begin(), E = (yyvsp[-3].ArgList)->end(); I != E; ++I) { |
| 4967 | const Type *Ty = I->first.T->get(); |
| 4968 | ParamTypeList.push_back(Ty); |
| 4969 | } |
| 4970 | } |
| 4971 | |
| 4972 | bool isVarArg = |
| 4973 | ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4974 | if (isVarArg) ParamTypeList.pop_back(); |
| 4975 | |
| 4976 | const FunctionType *FT = FunctionType::get(RetTy, ParamTypeList, isVarArg); |
| 4977 | const PointerType *PFT = PointerType::get(FT); |
| 4978 | delete (yyvsp[-6].TypeVal).T; |
| 4979 | |
| 4980 | ValID ID; |
| 4981 | if (!FunctionName.empty()) { |
| 4982 | ID = ValID::create((char*)FunctionName.c_str()); |
| 4983 | } else { |
| 4984 | ID = ValID::create((int)CurModule.Values[PFT].size()); |
| 4985 | } |
| 4986 | |
| 4987 | Function *Fn = 0; |
| 4988 | // See if this function was forward referenced. If so, recycle the object. |
| 4989 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4990 | // Move the function to the end of the list, from whereever it was |
| 4991 | // previously inserted. |
| 4992 | Fn = cast<Function>(FWRef); |
| 4993 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4994 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4995 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4996 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4997 | // If this is the case, either we need to be a forward decl, or it needs |
| 4998 | // to be. |
| 4999 | if (!CurFun.isDeclare && !Fn->isExternal()) |
| 5000 | error("Redefinition of function '" + FunctionName + "'"); |
| 5001 | |
| 5002 | // Make sure to strip off any argument names so we can't get conflicts. |
| 5003 | if (Fn->isExternal()) |
| 5004 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 5005 | AI != AE; ++AI) |
| 5006 | AI->setName(""); |
| 5007 | } else { // Not already defined? |
| 5008 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 5009 | CurModule.CurrentModule); |
| 5010 | |
| 5011 | InsertValue(Fn, CurModule.Values); |
| 5012 | } |
| 5013 | |
| 5014 | CurFun.FunctionStart(Fn); |
| 5015 | |
| 5016 | if (CurFun.isDeclare) { |
| 5017 | // If we have declaration, always overwrite linkage. This will allow us |
| 5018 | // to correctly handle cases, when pointer to function is passed as |
| 5019 | // argument to another function. |
| 5020 | Fn->setLinkage(CurFun.Linkage); |
| 5021 | } |
| 5022 | Fn->setCallingConv((yyvsp[-7].UIntVal)); |
| 5023 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 5024 | if ((yyvsp[-1].StrVal)) { |
| 5025 | Fn->setSection((yyvsp[-1].StrVal)); |
| 5026 | free((yyvsp[-1].StrVal)); |
| 5027 | } |
| 5028 | |
| 5029 | // Add all of the arguments we parsed to the function... |
| 5030 | if ((yyvsp[-3].ArgList)) { // Is null if empty... |
| 5031 | if (isVarArg) { // Nuke the last entry |
| 5032 | assert((yyvsp[-3].ArgList)->back().first.T->get() == Type::VoidTy && |
| 5033 | (yyvsp[-3].ArgList)->back().second == 0 && "Not a varargs marker"); |
| 5034 | delete (yyvsp[-3].ArgList)->back().first.T; |
| 5035 | (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry |
| 5036 | } |
| 5037 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
| 5038 | for (std::vector<std::pair<PATypeInfo,char*> >::iterator |
| 5039 | I = (yyvsp[-3].ArgList)->begin(), E = (yyvsp[-3].ArgList)->end(); I != E; ++I, ++ArgIt) { |
| 5040 | delete I->first.T; // Delete the typeholder... |
| 5041 | setValueName(ArgIt, I->second); // Insert arg into symtab... |
| 5042 | InsertValue(ArgIt); |
| 5043 | } |
| 5044 | delete (yyvsp[-3].ArgList); // We're now done with the argument list |
| 5045 | } |
| 5046 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5047 | break; |
| 5048 | |
| 5049 | case 224: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5050 | #line 2560 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5051 | { |
| 5052 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
| 5053 | |
| 5054 | // Make sure that we keep track of the linkage type even if there was a |
| 5055 | // previous "declare". |
| 5056 | (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); |
| 5057 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5058 | break; |
| 5059 | |
| 5060 | case 227: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5061 | #line 2574 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5062 | { |
| 5063 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 5064 | ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5065 | break; |
| 5066 | |
| 5067 | case 229: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5068 | #line 2580 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5069 | { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} |
| 5070 | break; |
| 5071 | |
| 5072 | case 230: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5073 | #line 2581 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5074 | { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;} |
| 5075 | break; |
| 5076 | |
| 5077 | case 231: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5078 | #line 2585 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5079 | { CurFun.isDeclare = true; ;} |
| 5080 | break; |
| 5081 | |
| 5082 | case 232: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5083 | #line 2585 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5084 | { |
| 5085 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
| 5086 | CurFun.FunctionDone(); |
| 5087 | |
| 5088 | ;} |
| 5089 | break; |
| 5090 | |
| 5091 | case 233: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5092 | #line 2597 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5093 | { (yyval.BoolVal) = false; ;} |
| 5094 | break; |
| 5095 | |
| 5096 | case 234: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5097 | #line 2598 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5098 | { (yyval.BoolVal) = true; ;} |
| 5099 | break; |
| 5100 | |
| 5101 | case 235: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5102 | #line 2603 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5103 | { (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); ;} |
| 5104 | break; |
| 5105 | |
| 5106 | case 236: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5107 | #line 2604 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5108 | { (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); ;} |
| 5109 | break; |
| 5110 | |
| 5111 | case 237: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5112 | #line 2605 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5113 | { (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); ;} |
| 5114 | break; |
| 5115 | |
| 5116 | case 238: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5117 | #line 2606 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5118 | { (yyval.ValIDVal) = ValID::create(ConstantInt::get(Type::Int1Ty, true)); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5119 | break; |
| 5120 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5121 | case 239: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5122 | #line 2607 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5123 | { (yyval.ValIDVal) = ValID::create(ConstantInt::get(Type::Int1Ty, false)); ;} |
| 5124 | break; |
| 5125 | |
| 5126 | case 240: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5127 | #line 2608 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5128 | { (yyval.ValIDVal) = ValID::createNull(); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5129 | break; |
| 5130 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5131 | case 241: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5132 | #line 2609 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5133 | { (yyval.ValIDVal) = ValID::createUndef(); ;} |
| 5134 | break; |
| 5135 | |
| 5136 | case 242: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5137 | #line 2610 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5138 | { (yyval.ValIDVal) = ValID::createZeroInit(); ;} |
| 5139 | break; |
| 5140 | |
| 5141 | case 243: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5142 | #line 2611 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5143 | { // Nonempty unsized packed vector |
| 5144 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0].C->getType(); |
| 5145 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
| 5146 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 5147 | PATypeHolder* PTy = new PATypeHolder( |
| 5148 | HandleUpRefs(PackedType::get(ETy, NumElements))); |
| 5149 | |
| 5150 | // Verify all elements are correct type! |
| 5151 | std::vector<Constant*> Elems; |
| 5152 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
| 5153 | Constant *C = (*(yyvsp[-1].ConstVector))[i].C; |
| 5154 | const Type *CTy = C->getType(); |
| 5155 | if (ETy != CTy) |
| 5156 | error("Element #" + utostr(i) + " is not of type '" + |
| 5157 | ETy->getDescription() +"' as required!\nIt is of type '" + |
| 5158 | CTy->getDescription() + "'"); |
| 5159 | Elems.push_back(C); |
Reid Spencer | e77e35e | 2006-12-01 20:26:20 +0000 | [diff] [blame] | 5160 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5161 | (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, Elems)); |
| 5162 | delete PTy; delete (yyvsp[-1].ConstVector); |
| 5163 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5164 | break; |
| 5165 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5166 | case 244: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5167 | #line 2632 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5168 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5169 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal).C); |
| 5170 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5171 | break; |
| 5172 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5173 | case 245: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5174 | #line 2635 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5175 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5176 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 5177 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 5178 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 5179 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 5180 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 5181 | free((yyvsp[-2].StrVal)); |
| 5182 | free((yyvsp[0].StrVal)); |
| 5183 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5184 | break; |
| 5185 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5186 | case 246: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5187 | #line 2650 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5188 | { (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5189 | break; |
| 5190 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5191 | case 247: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5192 | #line 2651 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5193 | { (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5194 | break; |
| 5195 | |
| 5196 | case 250: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5197 | #line 2664 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5198 | { |
| 5199 | const Type *Ty = (yyvsp[-1].TypeVal).T->get(); |
| 5200 | (yyval.ValueVal).S = (yyvsp[-1].TypeVal).S; |
| 5201 | (yyval.ValueVal).V = getVal(Ty, (yyvsp[0].ValIDVal)); |
| 5202 | delete (yyvsp[-1].TypeVal).T; |
| 5203 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5204 | break; |
| 5205 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5206 | case 251: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5207 | #line 2673 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5208 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5209 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 5210 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5211 | break; |
| 5212 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5213 | case 252: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5214 | #line 2676 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5215 | { // Do not allow functions with 0 basic blocks |
| 5216 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 5217 | ;} |
| 5218 | break; |
| 5219 | |
| 5220 | case 253: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5221 | #line 2685 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5222 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5223 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
| 5224 | InsertValue((yyvsp[0].TermInstVal)); |
| 5225 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 5226 | InsertValue((yyvsp[-2].BasicBlockVal)); |
| 5227 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
| 5228 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5229 | break; |
| 5230 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5231 | case 254: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5232 | #line 2695 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5233 | { |
| 5234 | if ((yyvsp[0].InstVal).I) |
| 5235 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal).I); |
| 5236 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
| 5237 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5238 | break; |
| 5239 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5240 | case 255: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5241 | #line 2700 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5242 | { |
| 5243 | (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); |
| 5244 | // Make sure to move the basic block to the correct location in the |
| 5245 | // function, instead of leaving it inserted wherever it was first |
| 5246 | // referenced. |
| 5247 | Function::BasicBlockListType &BBL = |
| 5248 | CurFun.CurrentFunction->getBasicBlockList(); |
| 5249 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
| 5250 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5251 | break; |
| 5252 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5253 | case 256: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5254 | #line 2709 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5255 | { |
| 5256 | (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); |
| 5257 | // Make sure to move the basic block to the correct location in the |
| 5258 | // function, instead of leaving it inserted wherever it was first |
| 5259 | // referenced. |
| 5260 | Function::BasicBlockListType &BBL = |
| 5261 | CurFun.CurrentFunction->getBasicBlockList(); |
| 5262 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
| 5263 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5264 | break; |
| 5265 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5266 | case 259: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5267 | #line 2723 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5268 | { // Return with a result... |
| 5269 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal).V); |
| 5270 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5271 | break; |
| 5272 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5273 | case 260: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5274 | #line 2726 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5275 | { // Return with no result... |
| 5276 | (yyval.TermInstVal) = new ReturnInst(); |
| 5277 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5278 | break; |
| 5279 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5280 | case 261: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5281 | #line 2729 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5282 | { // Unconditional Branch... |
| 5283 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5284 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 5285 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5286 | break; |
| 5287 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5288 | case 262: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5289 | #line 2733 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5290 | { |
| 5291 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 5292 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5293 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal)); |
| 5294 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 5295 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5296 | break; |
| 5297 | |
| 5298 | case 263: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5299 | #line 2739 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5300 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5301 | Value* tmpVal = getVal((yyvsp[-7].PrimType).T, (yyvsp[-6].ValIDVal)); |
| 5302 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 5303 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 5304 | (yyval.TermInstVal) = S; |
| 5305 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 5306 | E = (yyvsp[-1].JumpTable)->end(); |
| 5307 | for (; I != E; ++I) { |
| 5308 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5309 | S->addCase(CI, I->second); |
| 5310 | else |
| 5311 | error("Switch case is constant, but not a simple integer"); |
| 5312 | } |
| 5313 | delete (yyvsp[-1].JumpTable); |
| 5314 | ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5315 | break; |
| 5316 | |
| 5317 | case 264: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5318 | #line 2754 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5319 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5320 | Value* tmpVal = getVal((yyvsp[-6].PrimType).T, (yyvsp[-5].ValIDVal)); |
| 5321 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
| 5322 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
| 5323 | (yyval.TermInstVal) = S; |
| 5324 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5325 | break; |
| 5326 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5327 | case 265: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5328 | #line 2761 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5329 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5330 | const PointerType *PFTy; |
| 5331 | const FunctionType *Ty; |
| 5332 | |
| 5333 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal).T->get())) || |
| 5334 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5335 | // Pull out the types of all of the arguments... |
| 5336 | std::vector<const Type*> ParamTypes; |
| 5337 | if ((yyvsp[-7].ValueList)) { |
| 5338 | for (std::vector<ValueInfo>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end(); |
| 5339 | I != E; ++I) |
| 5340 | ParamTypes.push_back((*I).V->getType()); |
| 5341 | } |
| 5342 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 5343 | if (isVarArg) ParamTypes.pop_back(); |
| 5344 | Ty = FunctionType::get((yyvsp[-10].TypeVal).T->get(), ParamTypes, isVarArg); |
| 5345 | PFTy = PointerType::get(Ty); |
| 5346 | } |
| 5347 | Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... |
| 5348 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
| 5349 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
| 5350 | |
| 5351 | // Create the call node... |
| 5352 | if (!(yyvsp[-7].ValueList)) { // Has no arguments? |
| 5353 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>()); |
| 5354 | } else { // Has arguments? |
| 5355 | // Loop through FunctionType's arguments and ensure they are specified |
| 5356 | // correctly! |
| 5357 | // |
| 5358 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5359 | FunctionType::param_iterator E = Ty->param_end(); |
| 5360 | std::vector<ValueInfo>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end(); |
| 5361 | |
| 5362 | std::vector<Value*> Args; |
| 5363 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) { |
| 5364 | if ((*ArgI).V->getType() != *I) |
| 5365 | error("Parameter " +(*ArgI).V->getName()+ " is not of type '" + |
| 5366 | (*I)->getDescription() + "'"); |
| 5367 | Args.push_back((*ArgI).V); |
| 5368 | } |
| 5369 | |
| 5370 | if (I != E || (ArgI != ArgE && !Ty->isVarArg())) |
| 5371 | error("Invalid number of parameters detected"); |
| 5372 | |
| 5373 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, Args); |
| 5374 | } |
| 5375 | cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); |
| 5376 | delete (yyvsp[-10].TypeVal).T; |
| 5377 | delete (yyvsp[-7].ValueList); |
| 5378 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5379 | break; |
| 5380 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5381 | case 266: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5382 | #line 2811 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5383 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5384 | (yyval.TermInstVal) = new UnwindInst(); |
| 5385 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5386 | break; |
| 5387 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5388 | case 267: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5389 | #line 2814 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5390 | { |
| 5391 | (yyval.TermInstVal) = new UnreachableInst(); |
| 5392 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5393 | break; |
| 5394 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5395 | case 268: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5396 | #line 2820 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5397 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5398 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
| 5399 | Constant *V = cast<Constant>(getExistingValue((yyvsp[-4].PrimType).T, (yyvsp[-3].ValIDVal))); |
| 5400 | |
| 5401 | if (V == 0) |
| 5402 | error("May only switch on a constant pool value"); |
| 5403 | |
| 5404 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5405 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5406 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5407 | break; |
| 5408 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5409 | case 269: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5410 | #line 2830 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5411 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5412 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5413 | Constant *V = cast<Constant>(getExistingValue((yyvsp[-4].PrimType).T, (yyvsp[-3].ValIDVal))); |
| 5414 | |
| 5415 | if (V == 0) |
| 5416 | error("May only switch on a constant pool value"); |
| 5417 | |
| 5418 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 5419 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5420 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5421 | break; |
| 5422 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5423 | case 270: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5424 | #line 2843 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5425 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5426 | bool omit = false; |
| 5427 | if ((yyvsp[-1].StrVal)) |
| 5428 | if (BitCastInst *BCI = dyn_cast<BitCastInst>((yyvsp[0].InstVal).I)) |
| 5429 | if (BCI->getSrcTy() == BCI->getDestTy() && |
| 5430 | BCI->getOperand(0)->getName() == (yyvsp[-1].StrVal)) |
| 5431 | // This is a useless bit cast causing a name redefinition. It is |
| 5432 | // a bit cast from a type to the same type of an operand with the |
| 5433 | // same name as the name we would give this instruction. Since this |
| 5434 | // instruction results in no code generation, it is safe to omit |
| 5435 | // the instruction. This situation can occur because of collapsed |
| 5436 | // type planes. For example: |
| 5437 | // %X = add int %Y, %Z |
| 5438 | // %X = cast int %Y to uint |
| 5439 | // After upgrade, this looks like: |
| 5440 | // %X = add i32 %Y, %Z |
| 5441 | // %X = bitcast i32 to i32 |
| 5442 | // The bitcast is clearly useless so we omit it. |
| 5443 | omit = true; |
| 5444 | if (omit) { |
| 5445 | (yyval.InstVal).I = 0; |
| 5446 | (yyval.InstVal).S = Signless; |
| 5447 | } else { |
| 5448 | setValueName((yyvsp[0].InstVal).I, (yyvsp[-1].StrVal)); |
| 5449 | InsertValue((yyvsp[0].InstVal).I); |
| 5450 | (yyval.InstVal) = (yyvsp[0].InstVal); |
| 5451 | } |
| 5452 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5453 | break; |
| 5454 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5455 | case 271: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5456 | #line 2872 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5457 | { // Used for PHI nodes |
| 5458 | (yyval.PHIList).P = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5459 | (yyval.PHIList).S = (yyvsp[-5].TypeVal).S; |
| 5460 | Value* tmpVal = getVal((yyvsp[-5].TypeVal).T->get(), (yyvsp[-3].ValIDVal)); |
| 5461 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
| 5462 | (yyval.PHIList).P->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5463 | delete (yyvsp[-5].TypeVal).T; |
| 5464 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5465 | break; |
| 5466 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5467 | case 272: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5468 | #line 2880 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5469 | { |
| 5470 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 5471 | Value* tmpVal = getVal((yyvsp[-6].PHIList).P->front().first->getType(), (yyvsp[-3].ValIDVal)); |
| 5472 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
| 5473 | (yyvsp[-6].PHIList).P->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5474 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5475 | break; |
| 5476 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5477 | case 273: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5478 | #line 2888 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5479 | { // Used for call statements, and memory insts... |
| 5480 | (yyval.ValueList) = new std::vector<ValueInfo>(); |
| 5481 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
| 5482 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5483 | break; |
| 5484 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5485 | case 274: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5486 | #line 2892 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5487 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5488 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 5489 | (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); |
| 5490 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5491 | break; |
| 5492 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5493 | case 276: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5494 | #line 2900 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5495 | { (yyval.ValueList) = 0; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5496 | break; |
| 5497 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5498 | case 277: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5499 | #line 2904 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5500 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5501 | (yyval.BoolVal) = true; |
| 5502 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5503 | break; |
| 5504 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5505 | case 278: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5506 | #line 2907 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5507 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5508 | (yyval.BoolVal) = false; |
| 5509 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5510 | break; |
| 5511 | |
| 5512 | case 279: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5513 | #line 2913 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5514 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5515 | const Type* Ty = (yyvsp[-3].TypeVal).T->get(); |
| 5516 | if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa<PackedType>(Ty)) |
| 5517 | error("Arithmetic operator requires integer, FP, or packed operands"); |
| 5518 | if (isa<PackedType>(Ty) && |
| 5519 | ((yyvsp[-4].BinaryOpVal) == URemOp || (yyvsp[-4].BinaryOpVal) == SRemOp || (yyvsp[-4].BinaryOpVal) == FRemOp || (yyvsp[-4].BinaryOpVal) == RemOp)) |
| 5520 | error("Remainder not supported on packed types"); |
| 5521 | // Upgrade the opcode from obsolete versions before we do anything with it. |
| 5522 | Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[-4].BinaryOpVal), Ty, (yyvsp[-3].TypeVal).S); |
| 5523 | Value* val1 = getVal(Ty, (yyvsp[-2].ValIDVal)); |
| 5524 | Value* val2 = getVal(Ty, (yyvsp[0].ValIDVal)); |
| 5525 | (yyval.InstVal).I = BinaryOperator::create(Opcode, val1, val2); |
| 5526 | if ((yyval.InstVal).I == 0) |
| 5527 | error("binary operator returned null"); |
| 5528 | (yyval.InstVal).S = (yyvsp[-3].TypeVal).S; |
| 5529 | delete (yyvsp[-3].TypeVal).T; |
| 5530 | ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5531 | break; |
| 5532 | |
| 5533 | case 280: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5534 | #line 2930 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5535 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5536 | const Type *Ty = (yyvsp[-3].TypeVal).T->get(); |
| 5537 | if (!Ty->isInteger()) { |
| 5538 | if (!isa<PackedType>(Ty) || |
| 5539 | !cast<PackedType>(Ty)->getElementType()->isInteger()) |
| 5540 | error("Logical operator requires integral operands"); |
| 5541 | } |
| 5542 | Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[-4].BinaryOpVal), Ty, (yyvsp[-3].TypeVal).S); |
| 5543 | Value* tmpVal1 = getVal(Ty, (yyvsp[-2].ValIDVal)); |
| 5544 | Value* tmpVal2 = getVal(Ty, (yyvsp[0].ValIDVal)); |
| 5545 | (yyval.InstVal).I = BinaryOperator::create(Opcode, tmpVal1, tmpVal2); |
| 5546 | if ((yyval.InstVal).I == 0) |
| 5547 | error("binary operator returned null"); |
| 5548 | (yyval.InstVal).S = (yyvsp[-3].TypeVal).S; |
| 5549 | delete (yyvsp[-3].TypeVal).T; |
| 5550 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5551 | break; |
| 5552 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5553 | case 281: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5554 | #line 2946 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5555 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5556 | const Type* Ty = (yyvsp[-3].TypeVal).T->get(); |
| 5557 | if(isa<PackedType>(Ty)) |
| 5558 | error("PackedTypes currently not supported in setcc instructions"); |
| 5559 | unsigned short pred; |
| 5560 | Instruction::OtherOps Opcode = getCompareOp((yyvsp[-4].BinaryOpVal), pred, Ty, (yyvsp[-3].TypeVal).S); |
| 5561 | Value* tmpVal1 = getVal(Ty, (yyvsp[-2].ValIDVal)); |
| 5562 | Value* tmpVal2 = getVal(Ty, (yyvsp[0].ValIDVal)); |
| 5563 | (yyval.InstVal).I = CmpInst::create(Opcode, pred, tmpVal1, tmpVal2); |
| 5564 | if ((yyval.InstVal).I == 0) |
| 5565 | error("binary operator returned null"); |
| 5566 | (yyval.InstVal).S = Unsigned; |
| 5567 | delete (yyvsp[-3].TypeVal).T; |
| 5568 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5569 | break; |
| 5570 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5571 | case 282: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5572 | #line 2960 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5573 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5574 | const Type *Ty = (yyvsp[-3].TypeVal).T->get(); |
| 5575 | if (isa<PackedType>(Ty)) |
| 5576 | error("PackedTypes currently not supported in icmp instructions"); |
| 5577 | else if (!Ty->isInteger() && !isa<PointerType>(Ty)) |
| 5578 | error("icmp requires integer or pointer typed operands"); |
| 5579 | Value* tmpVal1 = getVal(Ty, (yyvsp[-2].ValIDVal)); |
| 5580 | Value* tmpVal2 = getVal(Ty, (yyvsp[0].ValIDVal)); |
| 5581 | (yyval.InstVal).I = new ICmpInst((yyvsp[-4].IPred), tmpVal1, tmpVal2); |
| 5582 | (yyval.InstVal).S = Unsigned; |
| 5583 | delete (yyvsp[-3].TypeVal).T; |
| 5584 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5585 | break; |
| 5586 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5587 | case 283: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5588 | #line 2972 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5589 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5590 | const Type *Ty = (yyvsp[-3].TypeVal).T->get(); |
| 5591 | if (isa<PackedType>(Ty)) |
| 5592 | error("PackedTypes currently not supported in fcmp instructions"); |
| 5593 | else if (!Ty->isFloatingPoint()) |
| 5594 | error("fcmp instruction requires floating point operands"); |
| 5595 | Value* tmpVal1 = getVal(Ty, (yyvsp[-2].ValIDVal)); |
| 5596 | Value* tmpVal2 = getVal(Ty, (yyvsp[0].ValIDVal)); |
| 5597 | (yyval.InstVal).I = new FCmpInst((yyvsp[-4].FPred), tmpVal1, tmpVal2); |
| 5598 | (yyval.InstVal).S = Unsigned; |
| 5599 | delete (yyvsp[-3].TypeVal).T; |
| 5600 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5601 | break; |
| 5602 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5603 | case 284: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5604 | #line 2984 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5605 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5606 | warning("Use of obsolete 'not' instruction: Replacing with 'xor"); |
| 5607 | const Type *Ty = (yyvsp[0].ValueVal).V->getType(); |
| 5608 | Value *Ones = ConstantInt::getAllOnesValue(Ty); |
| 5609 | if (Ones == 0) |
| 5610 | error("Expected integral type for not instruction"); |
| 5611 | (yyval.InstVal).I = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal).V, Ones); |
| 5612 | if ((yyval.InstVal).I == 0) |
| 5613 | error("Could not create a xor instruction"); |
| 5614 | (yyval.InstVal).S = (yyvsp[0].ValueVal).S |
| 5615 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5616 | break; |
| 5617 | |
| 5618 | case 285: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5619 | #line 2995 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5620 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5621 | if (!(yyvsp[0].ValueVal).V->getType()->isInteger() || |
| 5622 | cast<IntegerType>((yyvsp[0].ValueVal).V->getType())->getBitWidth() != 8) |
| 5623 | error("Shift amount must be int8"); |
| 5624 | if (!(yyvsp[-2].ValueVal).V->getType()->isInteger()) |
| 5625 | error("Shift constant expression requires integer operand"); |
| 5626 | (yyval.InstVal).I = new ShiftInst(getOtherOp((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal).S), (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V); |
| 5627 | (yyval.InstVal).S = (yyvsp[-2].ValueVal).S; |
| 5628 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5629 | break; |
| 5630 | |
| 5631 | case 286: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5632 | #line 3004 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5633 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5634 | const Type *DstTy = (yyvsp[0].TypeVal).T->get(); |
| 5635 | if (!DstTy->isFirstClassType()) |
| 5636 | error("cast instruction to a non-primitive type: '" + |
| 5637 | DstTy->getDescription() + "'"); |
| 5638 | (yyval.InstVal).I = cast<Instruction>(getCast((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal).V, (yyvsp[-2].ValueVal).S, DstTy, (yyvsp[0].TypeVal).S, true)); |
| 5639 | (yyval.InstVal).S = (yyvsp[0].TypeVal).S; |
| 5640 | delete (yyvsp[0].TypeVal).T; |
| 5641 | ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5642 | break; |
| 5643 | |
| 5644 | case 287: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5645 | #line 3013 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5646 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5647 | if (!(yyvsp[-4].ValueVal).V->getType()->isInteger() || |
| 5648 | cast<IntegerType>((yyvsp[-4].ValueVal).V->getType())->getBitWidth() != 1) |
| 5649 | error("select condition must be bool"); |
| 5650 | if ((yyvsp[-2].ValueVal).V->getType() != (yyvsp[0].ValueVal).V->getType()) |
| 5651 | error("select value types should match"); |
| 5652 | (yyval.InstVal).I = new SelectInst((yyvsp[-4].ValueVal).V, (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V); |
| 5653 | (yyval.InstVal).S = (yyvsp[-4].ValueVal).S; |
| 5654 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5655 | break; |
| 5656 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5657 | case 288: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5658 | #line 3022 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5659 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5660 | const Type *Ty = (yyvsp[0].TypeVal).T->get(); |
| 5661 | NewVarArgs = true; |
| 5662 | (yyval.InstVal).I = new VAArgInst((yyvsp[-2].ValueVal).V, Ty); |
| 5663 | (yyval.InstVal).S = (yyvsp[0].TypeVal).S; |
| 5664 | delete (yyvsp[0].TypeVal).T; |
| 5665 | ;} |
| 5666 | break; |
| 5667 | |
| 5668 | case 289: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5669 | #line 3029 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5670 | { |
| 5671 | const Type* ArgTy = (yyvsp[-2].ValueVal).V->getType(); |
| 5672 | const Type* DstTy = (yyvsp[0].TypeVal).T->get(); |
| 5673 | ObsoleteVarArgs = true; |
| 5674 | Function* NF = cast<Function>(CurModule.CurrentModule-> |
| 5675 | getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0)); |
| 5676 | |
| 5677 | //b = vaarg a, t -> |
| 5678 | //foo = alloca 1 of t |
| 5679 | //bar = vacopy a |
| 5680 | //store bar -> foo |
| 5681 | //b = vaarg foo, t |
| 5682 | AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); |
| 5683 | CurBB->getInstList().push_back(foo); |
| 5684 | CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal).V); |
| 5685 | CurBB->getInstList().push_back(bar); |
| 5686 | CurBB->getInstList().push_back(new StoreInst(bar, foo)); |
| 5687 | (yyval.InstVal).I = new VAArgInst(foo, DstTy); |
| 5688 | (yyval.InstVal).S = (yyvsp[0].TypeVal).S; |
| 5689 | delete (yyvsp[0].TypeVal).T; |
| 5690 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5691 | break; |
| 5692 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5693 | case 290: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5694 | #line 3050 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5695 | { |
| 5696 | const Type* ArgTy = (yyvsp[-2].ValueVal).V->getType(); |
| 5697 | const Type* DstTy = (yyvsp[0].TypeVal).T->get(); |
| 5698 | ObsoleteVarArgs = true; |
| 5699 | Function* NF = cast<Function>(CurModule.CurrentModule-> |
| 5700 | getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0)); |
| 5701 | |
| 5702 | //b = vanext a, t -> |
| 5703 | //foo = alloca 1 of t |
| 5704 | //bar = vacopy a |
| 5705 | //store bar -> foo |
| 5706 | //tmp = vaarg foo, t |
| 5707 | //b = load foo |
| 5708 | AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); |
| 5709 | CurBB->getInstList().push_back(foo); |
| 5710 | CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal).V); |
| 5711 | CurBB->getInstList().push_back(bar); |
| 5712 | CurBB->getInstList().push_back(new StoreInst(bar, foo)); |
| 5713 | Instruction* tmp = new VAArgInst(foo, DstTy); |
| 5714 | CurBB->getInstList().push_back(tmp); |
| 5715 | (yyval.InstVal).I = new LoadInst(foo); |
| 5716 | (yyval.InstVal).S = (yyvsp[0].TypeVal).S; |
| 5717 | delete (yyvsp[0].TypeVal).T; |
| 5718 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5719 | break; |
| 5720 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5721 | case 291: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5722 | #line 3074 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5723 | { |
| 5724 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V)) |
| 5725 | error("Invalid extractelement operands"); |
| 5726 | (yyval.InstVal).I = new ExtractElementInst((yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V); |
| 5727 | (yyval.InstVal).S = (yyvsp[-2].ValueVal).S; |
| 5728 | ;} |
| 5729 | break; |
| 5730 | |
| 5731 | case 292: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5732 | #line 3080 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5733 | { |
| 5734 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal).V, (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V)) |
| 5735 | error("Invalid insertelement operands"); |
| 5736 | (yyval.InstVal).I = new InsertElementInst((yyvsp[-4].ValueVal).V, (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V); |
| 5737 | (yyval.InstVal).S = (yyvsp[-4].ValueVal).S; |
| 5738 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5739 | break; |
| 5740 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5741 | case 293: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5742 | #line 3086 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5743 | { |
| 5744 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal).V, (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V)) |
| 5745 | error("Invalid shufflevector operands"); |
| 5746 | (yyval.InstVal).I = new ShuffleVectorInst((yyvsp[-4].ValueVal).V, (yyvsp[-2].ValueVal).V, (yyvsp[0].ValueVal).V); |
| 5747 | (yyval.InstVal).S = (yyvsp[-4].ValueVal).S; |
| 5748 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5749 | break; |
| 5750 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5751 | case 294: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5752 | #line 3092 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5753 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5754 | const Type *Ty = (yyvsp[0].PHIList).P->front().first->getType(); |
| 5755 | if (!Ty->isFirstClassType()) |
| 5756 | error("PHI node operands must be of first class type"); |
| 5757 | PHINode *PHI = new PHINode(Ty); |
| 5758 | PHI->reserveOperandSpace((yyvsp[0].PHIList).P->size()); |
| 5759 | while ((yyvsp[0].PHIList).P->begin() != (yyvsp[0].PHIList).P->end()) { |
| 5760 | if ((yyvsp[0].PHIList).P->front().first->getType() != Ty) |
| 5761 | error("All elements of a PHI node must be of the same type"); |
| 5762 | PHI->addIncoming((yyvsp[0].PHIList).P->front().first, (yyvsp[0].PHIList).P->front().second); |
| 5763 | (yyvsp[0].PHIList).P->pop_front(); |
| 5764 | } |
| 5765 | (yyval.InstVal).I = PHI; |
| 5766 | (yyval.InstVal).S = (yyvsp[0].PHIList).S; |
| 5767 | delete (yyvsp[0].PHIList).P; // Free the list... |
| 5768 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5769 | break; |
| 5770 | |
| 5771 | case 295: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5772 | #line 3108 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5773 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5774 | |
| 5775 | // Handle the short call syntax |
| 5776 | const PointerType *PFTy; |
| 5777 | const FunctionType *FTy; |
| 5778 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal).T->get())) || |
| 5779 | !(FTy = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5780 | // Pull out the types of all of the arguments... |
| 5781 | std::vector<const Type*> ParamTypes; |
| 5782 | if ((yyvsp[-1].ValueList)) { |
| 5783 | for (std::vector<ValueInfo>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end(); |
| 5784 | I != E; ++I) |
| 5785 | ParamTypes.push_back((*I).V->getType()); |
| 5786 | } |
| 5787 | |
| 5788 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 5789 | if (isVarArg) ParamTypes.pop_back(); |
| 5790 | |
| 5791 | const Type *RetTy = (yyvsp[-4].TypeVal).T->get(); |
| 5792 | if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy) |
| 5793 | error("Functions cannot return aggregate types"); |
| 5794 | |
| 5795 | FTy = FunctionType::get(RetTy, ParamTypes, isVarArg); |
| 5796 | PFTy = PointerType::get(FTy); |
| 5797 | } |
| 5798 | |
| 5799 | // First upgrade any intrinsic calls. |
| 5800 | std::vector<Value*> Args; |
| 5801 | if ((yyvsp[-1].ValueList)) |
| 5802 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i < e; ++i) |
| 5803 | Args.push_back((*(yyvsp[-1].ValueList))[i].V); |
| 5804 | Instruction *Inst = upgradeIntrinsicCall(FTy, (yyvsp[-3].ValIDVal), Args); |
| 5805 | |
| 5806 | // If we got an upgraded intrinsic |
| 5807 | if (Inst) { |
| 5808 | (yyval.InstVal).I = Inst; |
| 5809 | (yyval.InstVal).S = Signless; |
| 5810 | } else { |
| 5811 | // Get the function we're calling |
| 5812 | Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); |
| 5813 | |
| 5814 | // Check the argument values match |
| 5815 | if (!(yyvsp[-1].ValueList)) { // Has no arguments? |
| 5816 | // Make sure no arguments is a good thing! |
| 5817 | if (FTy->getNumParams() != 0) |
| 5818 | error("No arguments passed to a function that expects arguments"); |
| 5819 | } else { // Has arguments? |
| 5820 | // Loop through FunctionType's arguments and ensure they are specified |
| 5821 | // correctly! |
| 5822 | // |
| 5823 | FunctionType::param_iterator I = FTy->param_begin(); |
| 5824 | FunctionType::param_iterator E = FTy->param_end(); |
| 5825 | std::vector<ValueInfo>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end(); |
| 5826 | |
| 5827 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) |
| 5828 | if ((*ArgI).V->getType() != *I) |
| 5829 | error("Parameter " +(*ArgI).V->getName()+ " is not of type '" + |
| 5830 | (*I)->getDescription() + "'"); |
| 5831 | |
| 5832 | if (I != E || (ArgI != ArgE && !FTy->isVarArg())) |
| 5833 | error("Invalid number of parameters detected"); |
| 5834 | } |
| 5835 | |
| 5836 | // Create the call instruction |
| 5837 | CallInst *CI = new CallInst(V, Args); |
| 5838 | CI->setTailCall((yyvsp[-6].BoolVal)); |
| 5839 | CI->setCallingConv((yyvsp[-5].UIntVal)); |
| 5840 | (yyval.InstVal).I = CI; |
| 5841 | (yyval.InstVal).S = (yyvsp[-4].TypeVal).S; |
| 5842 | } |
| 5843 | delete (yyvsp[-4].TypeVal).T; |
| 5844 | delete (yyvsp[-1].ValueList); |
| 5845 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5846 | break; |
| 5847 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5848 | case 296: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5849 | #line 3181 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5850 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5851 | (yyval.InstVal) = (yyvsp[0].InstVal); |
| 5852 | ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5853 | break; |
| 5854 | |
Reid Spencer | 609ca3e | 2007-01-12 20:10:51 +0000 | [diff] [blame] | 5855 | case 297: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5856 | #line 3189 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5857 | { (yyval.ValueList) = (yyvsp[0].ValueList); ;} |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5858 | break; |
| 5859 | |
| 5860 | case 298: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5861 | #line 3190 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5862 | { (yyval.ValueList) = new std::vector<ValueInfo>(); ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5863 | break; |
| 5864 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5865 | case 299: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5866 | #line 3194 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5867 | { (yyval.BoolVal) = true; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5868 | break; |
| 5869 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5870 | case 300: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5871 | #line 3195 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5872 | { (yyval.BoolVal) = false; ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5873 | break; |
| 5874 | |
Reid Spencer | c4d9625 | 2007-01-13 00:03:30 +0000 | [diff] [blame] | 5875 | case 301: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5876 | #line 3199 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5877 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5878 | const Type *Ty = (yyvsp[-1].TypeVal).T->get(); |
| 5879 | (yyval.InstVal).S = (yyvsp[-1].TypeVal).S; |
| 5880 | (yyval.InstVal).I = new MallocInst(Ty, 0, (yyvsp[0].UIntVal)); |
| 5881 | delete (yyvsp[-1].TypeVal).T; |
| 5882 | ;} |
| 5883 | break; |
| 5884 | |
| 5885 | case 302: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5886 | #line 3205 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5887 | { |
| 5888 | const Type *Ty = (yyvsp[-4].TypeVal).T->get(); |
| 5889 | (yyval.InstVal).S = (yyvsp[-4].TypeVal).S; |
| 5890 | (yyval.InstVal).I = new MallocInst(Ty, getVal((yyvsp[-2].PrimType).T, (yyvsp[-1].ValIDVal)), (yyvsp[0].UIntVal)); |
| 5891 | delete (yyvsp[-4].TypeVal).T; |
| 5892 | ;} |
| 5893 | break; |
| 5894 | |
| 5895 | case 303: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5896 | #line 3211 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5897 | { |
| 5898 | const Type *Ty = (yyvsp[-1].TypeVal).T->get(); |
| 5899 | (yyval.InstVal).S = (yyvsp[-1].TypeVal).S; |
| 5900 | (yyval.InstVal).I = new AllocaInst(Ty, 0, (yyvsp[0].UIntVal)); |
| 5901 | delete (yyvsp[-1].TypeVal).T; |
| 5902 | ;} |
| 5903 | break; |
| 5904 | |
| 5905 | case 304: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5906 | #line 3217 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5907 | { |
| 5908 | const Type *Ty = (yyvsp[-4].TypeVal).T->get(); |
| 5909 | (yyval.InstVal).S = (yyvsp[-4].TypeVal).S; |
| 5910 | (yyval.InstVal).I = new AllocaInst(Ty, getVal((yyvsp[-2].PrimType).T, (yyvsp[-1].ValIDVal)), (yyvsp[0].UIntVal)); |
| 5911 | delete (yyvsp[-4].TypeVal).T; |
| 5912 | ;} |
| 5913 | break; |
| 5914 | |
| 5915 | case 305: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5916 | #line 3223 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5917 | { |
| 5918 | const Type *PTy = (yyvsp[0].ValueVal).V->getType(); |
| 5919 | if (!isa<PointerType>(PTy)) |
| 5920 | error("Trying to free nonpointer type '" + PTy->getDescription() + "'"); |
| 5921 | (yyval.InstVal).I = new FreeInst((yyvsp[0].ValueVal).V); |
| 5922 | (yyval.InstVal).S = Signless; |
| 5923 | ;} |
| 5924 | break; |
| 5925 | |
| 5926 | case 306: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5927 | #line 3230 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5928 | { |
| 5929 | const Type* Ty = (yyvsp[-1].TypeVal).T->get(); |
| 5930 | (yyval.InstVal).S = (yyvsp[-1].TypeVal).S; |
| 5931 | if (!isa<PointerType>(Ty)) |
| 5932 | error("Can't load from nonpointer type: " + Ty->getDescription()); |
| 5933 | if (!cast<PointerType>(Ty)->getElementType()->isFirstClassType()) |
| 5934 | error("Can't load from pointer of non-first-class type: " + |
| 5935 | Ty->getDescription()); |
| 5936 | Value* tmpVal = getVal(Ty, (yyvsp[0].ValIDVal)); |
| 5937 | (yyval.InstVal).I = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
| 5938 | delete (yyvsp[-1].TypeVal).T; |
| 5939 | ;} |
| 5940 | break; |
| 5941 | |
| 5942 | case 307: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5943 | #line 3242 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5944 | { |
| 5945 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal).T->get()); |
| 5946 | if (!PTy) |
| 5947 | error("Can't store to a nonpointer type: " + |
| 5948 | (yyvsp[-1].TypeVal).T->get()->getDescription()); |
| 5949 | const Type *ElTy = PTy->getElementType(); |
| 5950 | if (ElTy != (yyvsp[-3].ValueVal).V->getType()) |
| 5951 | error("Can't store '" + (yyvsp[-3].ValueVal).V->getType()->getDescription() + |
| 5952 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 5953 | Value* tmpVal = getVal(PTy, (yyvsp[0].ValIDVal)); |
| 5954 | (yyval.InstVal).I = new StoreInst((yyvsp[-3].ValueVal).V, tmpVal, (yyvsp[-5].BoolVal)); |
| 5955 | (yyval.InstVal).S = Signless; |
| 5956 | delete (yyvsp[-1].TypeVal).T; |
| 5957 | ;} |
| 5958 | break; |
| 5959 | |
| 5960 | case 308: |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5961 | #line 3256 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5962 | { |
| 5963 | const Type* Ty = (yyvsp[-2].TypeVal).T->get(); |
| 5964 | if (!isa<PointerType>(Ty)) |
| 5965 | error("getelementptr insn requires pointer operand"); |
| 5966 | |
| 5967 | std::vector<Value*> VIndices; |
| 5968 | upgradeGEPIndices(Ty, (yyvsp[0].ValueList), VIndices); |
| 5969 | |
| 5970 | Value* tmpVal = getVal(Ty, (yyvsp[-1].ValIDVal)); |
| 5971 | (yyval.InstVal).I = new GetElementPtrInst(tmpVal, VIndices); |
| 5972 | (yyval.InstVal).S = Signless; |
| 5973 | delete (yyvsp[-2].TypeVal).T; |
| 5974 | delete (yyvsp[0].ValueList); |
| 5975 | ;} |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5976 | break; |
| 5977 | |
| 5978 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5979 | default: break; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5980 | } |
| 5981 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5982 | /* Line 1126 of yacc.c. */ |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 5983 | #line 5984 "UpgradeParser.tab.c" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5984 | |
| 5985 | yyvsp -= yylen; |
| 5986 | yyssp -= yylen; |
| 5987 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5988 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 5989 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5990 | |
| 5991 | *++yyvsp = yyval; |
| 5992 | |
| 5993 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 5994 | /* Now `shift' the result of the reduction. Determine what state |
| 5995 | that goes to, based on the state we popped back to and the rule |
| 5996 | number reduced by. */ |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 5997 | |
| 5998 | yyn = yyr1[yyn]; |
| 5999 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6000 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 6001 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6002 | yystate = yytable[yystate]; |
| 6003 | else |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6004 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6005 | |
| 6006 | goto yynewstate; |
| 6007 | |
| 6008 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6009 | /*------------------------------------. |
| 6010 | | yyerrlab -- here on detecting error | |
| 6011 | `------------------------------------*/ |
| 6012 | yyerrlab: |
| 6013 | /* If not already recovering from an error, report this error. */ |
| 6014 | if (!yyerrstatus) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6015 | { |
| 6016 | ++yynerrs; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6017 | #if YYERROR_VERBOSE |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6018 | yyn = yypact[yystate]; |
| 6019 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6020 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6021 | { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6022 | int yytype = YYTRANSLATE (yychar); |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6023 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 6024 | YYSIZE_T yysize = yysize0; |
| 6025 | YYSIZE_T yysize1; |
| 6026 | int yysize_overflow = 0; |
| 6027 | char *yymsg = 0; |
| 6028 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 6029 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 6030 | int yyx; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6031 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6032 | #if 0 |
| 6033 | /* This is so xgettext sees the translatable formats that are |
| 6034 | constructed on the fly. */ |
| 6035 | YY_("syntax error, unexpected %s"); |
| 6036 | YY_("syntax error, unexpected %s, expecting %s"); |
| 6037 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 6038 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 6039 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 6040 | #endif |
| 6041 | char *yyfmt; |
| 6042 | char const *yyf; |
| 6043 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 6044 | static char const yyexpecting[] = ", expecting %s"; |
| 6045 | static char const yyor[] = " or %s"; |
| 6046 | char yyformat[sizeof yyunexpected |
| 6047 | + sizeof yyexpecting - 1 |
| 6048 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 6049 | * (sizeof yyor - 1))]; |
| 6050 | char const *yyprefix = yyexpecting; |
| 6051 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6052 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 6053 | YYCHECK. */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6054 | int yyxbegin = yyn < 0 ? -yyn : 0; |
Jeff Cohen | ac2dca9 | 2007-01-21 19:30:52 +0000 | [diff] [blame] | 6055 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6056 | /* Stay within bounds of both yycheck and yytname. */ |
| 6057 | int yychecklim = YYLAST - yyn; |
| 6058 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 6059 | int yycount = 1; |
| 6060 | |
| 6061 | yyarg[0] = yytname[yytype]; |
| 6062 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 6063 | |
| 6064 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 6065 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 6066 | { |
| 6067 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 6068 | { |
| 6069 | yycount = 1; |
| 6070 | yysize = yysize0; |
| 6071 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 6072 | break; |
| 6073 | } |
| 6074 | yyarg[yycount++] = yytname[yyx]; |
| 6075 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 6076 | yysize_overflow |= yysize1 < yysize; |
| 6077 | yysize = yysize1; |
| 6078 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 6079 | yyprefix = yyor; |
| 6080 | } |
| 6081 | |
| 6082 | yyf = YY_(yyformat); |
| 6083 | yysize1 = yysize + yystrlen (yyf); |
| 6084 | yysize_overflow |= yysize1 < yysize; |
| 6085 | yysize = yysize1; |
| 6086 | |
| 6087 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 6088 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 6089 | if (yymsg) |
| 6090 | { |
| 6091 | /* Avoid sprintf, as that infringes on the user's name space. |
| 6092 | Don't have undefined behavior even if the translation |
| 6093 | produced a string with the wrong number of "%s"s. */ |
| 6094 | char *yyp = yymsg; |
| 6095 | int yyi = 0; |
| 6096 | while ((*yyp = *yyf)) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6097 | { |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6098 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 6099 | { |
| 6100 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 6101 | yyf += 2; |
| 6102 | } |
| 6103 | else |
| 6104 | { |
| 6105 | yyp++; |
| 6106 | yyf++; |
| 6107 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6108 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6109 | yyerror (yymsg); |
| 6110 | YYSTACK_FREE (yymsg); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6111 | } |
| 6112 | else |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6113 | { |
| 6114 | yyerror (YY_("syntax error")); |
| 6115 | goto yyexhaustedlab; |
| 6116 | } |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6117 | } |
| 6118 | else |
| 6119 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6120 | yyerror (YY_("syntax error")); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6121 | } |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6122 | |
| 6123 | |
| 6124 | |
| 6125 | if (yyerrstatus == 3) |
| 6126 | { |
| 6127 | /* If just tried and failed to reuse look-ahead token after an |
| 6128 | error, discard it. */ |
| 6129 | |
| 6130 | if (yychar <= YYEOF) |
| 6131 | { |
| 6132 | /* Return failure if at end of input. */ |
| 6133 | if (yychar == YYEOF) |
| 6134 | YYABORT; |
| 6135 | } |
| 6136 | else |
| 6137 | { |
| 6138 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 6139 | yychar = YYEMPTY; |
| 6140 | } |
| 6141 | } |
| 6142 | |
| 6143 | /* Else will try to reuse look-ahead token after shifting the error |
| 6144 | token. */ |
Jeff Cohen | ac2dca9 | 2007-01-21 19:30:52 +0000 | [diff] [blame] | 6145 | goto yyerrlab1; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6146 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6147 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6148 | /*---------------------------------------------------. |
| 6149 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 6150 | `---------------------------------------------------*/ |
| 6151 | yyerrorlab: |
| 6152 | |
| 6153 | /* Pacify compilers like GCC when the user code never invokes |
| 6154 | YYERROR and the label yyerrorlab therefore never appears in user |
| 6155 | code. */ |
| 6156 | if (0) |
| 6157 | goto yyerrorlab; |
| 6158 | |
| 6159 | yyvsp -= yylen; |
| 6160 | yyssp -= yylen; |
| 6161 | yystate = *yyssp; |
| 6162 | goto yyerrlab1; |
| 6163 | |
| 6164 | |
| 6165 | /*-------------------------------------------------------------. |
| 6166 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 6167 | `-------------------------------------------------------------*/ |
Jeff Cohen | ac2dca9 | 2007-01-21 19:30:52 +0000 | [diff] [blame] | 6168 | yyerrlab1: |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6169 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 6170 | |
| 6171 | for (;;) |
| 6172 | { |
| 6173 | yyn = yypact[yystate]; |
| 6174 | if (yyn != YYPACT_NINF) |
| 6175 | { |
| 6176 | yyn += YYTERROR; |
| 6177 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 6178 | { |
| 6179 | yyn = yytable[yyn]; |
| 6180 | if (0 < yyn) |
| 6181 | break; |
| 6182 | } |
| 6183 | } |
| 6184 | |
| 6185 | /* Pop the current state because it cannot handle the error token. */ |
| 6186 | if (yyssp == yyss) |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6187 | YYABORT; |
| 6188 | |
| 6189 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6190 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 6191 | YYPOPSTACK; |
| 6192 | yystate = *yyssp; |
| 6193 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6194 | } |
| 6195 | |
| 6196 | if (yyn == YYFINAL) |
| 6197 | YYACCEPT; |
| 6198 | |
| 6199 | *++yyvsp = yylval; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6200 | |
| 6201 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6202 | /* Shift the error token. */ |
| 6203 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
| 6204 | |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6205 | yystate = yyn; |
| 6206 | goto yynewstate; |
| 6207 | |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 6208 | |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6209 | /*-------------------------------------. |
| 6210 | | yyacceptlab -- YYACCEPT comes here. | |
| 6211 | `-------------------------------------*/ |
| 6212 | yyacceptlab: |
| 6213 | yyresult = 0; |
| 6214 | goto yyreturn; |
| 6215 | |
| 6216 | /*-----------------------------------. |
| 6217 | | yyabortlab -- YYABORT comes here. | |
| 6218 | `-----------------------------------*/ |
| 6219 | yyabortlab: |
| 6220 | yyresult = 1; |
| 6221 | goto yyreturn; |
| 6222 | |
| 6223 | #ifndef yyoverflow |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6224 | /*-------------------------------------------------. |
| 6225 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 6226 | `-------------------------------------------------*/ |
| 6227 | yyexhaustedlab: |
| 6228 | yyerror (YY_("memory exhausted")); |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6229 | yyresult = 2; |
| 6230 | /* Fall through. */ |
Chris Lattner | 37e01c5 | 2007-01-04 18:46:42 +0000 | [diff] [blame] | 6231 | #endif |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6232 | |
| 6233 | yyreturn: |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6234 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 6235 | yydestruct ("Cleanup: discarding lookahead", |
| 6236 | yytoken, &yylval); |
| 6237 | while (yyssp != yyss) |
| 6238 | { |
| 6239 | yydestruct ("Cleanup: popping", |
| 6240 | yystos[*yyssp], yyvsp); |
| 6241 | YYPOPSTACK; |
| 6242 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6243 | #ifndef yyoverflow |
| 6244 | if (yyss != yyssa) |
| 6245 | YYSTACK_FREE (yyss); |
| 6246 | #endif |
| 6247 | return yyresult; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6248 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6249 | |
| 6250 | |
Reid Spencer | d7c4f8c | 2007-01-26 19:59:25 +0000 | [diff] [blame^] | 6251 | #line 3272 "/proj/llvm/llvm-2/tools/llvm-upgrade/UpgradeParser.y" |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6252 | |
| 6253 | |
| 6254 | int yyerror(const char *ErrorMsg) { |
| 6255 | std::string where |
| 6256 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6257 | + ":" + llvm::utostr((unsigned) Upgradelineno-1) + ": "; |
| 6258 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
| 6259 | if (yychar != YYEMPTY && yychar != 0) |
| 6260 | errMsg += " while reading token '" + std::string(Upgradetext, Upgradeleng) + |
| 6261 | "'."; |
Reid Spencer | 71d2ec9 | 2006-12-31 06:02:26 +0000 | [diff] [blame] | 6262 | std::cerr << "llvm-upgrade: " << errMsg << '\n'; |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6263 | std::cout << "llvm-upgrade: parse failed.\n"; |
Reid Spencer | e7c3c60 | 2006-11-30 06:36:44 +0000 | [diff] [blame] | 6264 | exit(1); |
| 6265 | } |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6266 | |
Reid Spencer | 30d0c58 | 2007-01-15 00:26:18 +0000 | [diff] [blame] | 6267 | void warning(const std::string& ErrorMsg) { |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6268 | std::string where |
| 6269 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6270 | + ":" + llvm::utostr((unsigned) Upgradelineno-1) + ": "; |
| 6271 | std::string errMsg = where + "warning: " + std::string(ErrorMsg); |
| 6272 | if (yychar != YYEMPTY && yychar != 0) |
| 6273 | errMsg += " while reading token '" + std::string(Upgradetext, Upgradeleng) + |
| 6274 | "'."; |
Reid Spencer | 319a730 | 2007-01-05 17:20:02 +0000 | [diff] [blame] | 6275 | std::cerr << "llvm-upgrade: " << errMsg << '\n'; |
| 6276 | } |
| 6277 | |
Reid Spencer | 950bf60 | 2007-01-26 08:19:09 +0000 | [diff] [blame] | 6278 | void error(const std::string& ErrorMsg, int LineNo) { |
| 6279 | if (LineNo == -1) LineNo = Upgradelineno; |
| 6280 | Upgradelineno = LineNo; |
| 6281 | yyerror(ErrorMsg.c_str()); |
| 6282 | } |
| 6283 | |
| 6284 | |