Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 2.1. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +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. |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 10 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. */ |
| 20 | |
| 21 | /* As a special exception, when this file is copied by Bison into a |
| 22 | Bison output file, you may use that output file without restriction. |
| 23 | This special exception was added by the Free Software Foundation |
| 24 | in version 1.24 of Bison. */ |
| 25 | |
| 26 | /* Written by Richard Stallman by simplifying the original so called |
| 27 | ``semantic'' parser. */ |
| 28 | |
| 29 | /* All symbols defined below should begin with yy or YY, to avoid |
| 30 | infringing on user name space. This should be done even for local |
| 31 | variables, as they might otherwise be expanded by user macros. |
| 32 | There are some unavoidable exceptions within include files to |
| 33 | define necessary library symbols; they are noted "INFRINGES ON |
| 34 | USER NAME SPACE" below. */ |
| 35 | |
| 36 | /* Identify Bison output. */ |
| 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Bison version. */ |
| 40 | #define YYBISON_VERSION "2.1" |
| 41 | |
| 42 | /* Skeleton name. */ |
| 43 | #define YYSKELETON_NAME "yacc.c" |
| 44 | |
| 45 | /* Pure parsers. */ |
| 46 | #define YYPURE 0 |
| 47 | |
| 48 | /* Using locations. */ |
| 49 | #define YYLSP_NEEDED 0 |
| 50 | |
| 51 | /* Substitute the variable and function names. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 52 | #define yyparse llvmAsmparse |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 53 | #define yylex llvmAsmlex |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 54 | #define yyerror llvmAsmerror |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 55 | #define yylval llvmAsmlval |
| 56 | #define yychar llvmAsmchar |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 57 | #define yydebug llvmAsmdebug |
| 58 | #define yynerrs llvmAsmnerrs |
| 59 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 60 | |
| 61 | /* Tokens. */ |
| 62 | #ifndef YYTOKENTYPE |
| 63 | # define YYTOKENTYPE |
| 64 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 65 | know about them. */ |
| 66 | enum yytokentype { |
| 67 | 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, |
| 109 | DLLIMPORT = 300, |
| 110 | DLLEXPORT = 301, |
| 111 | EXTERN_WEAK = 302, |
| 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, |
| 122 | DEPLIBS = 313, |
| 123 | CALL = 314, |
| 124 | TAIL = 315, |
| 125 | ASM_TOK = 316, |
| 126 | MODULE = 317, |
| 127 | SIDEEFFECT = 318, |
| 128 | CC_TOK = 319, |
| 129 | CCC_TOK = 320, |
| 130 | CSRETCC_TOK = 321, |
| 131 | FASTCC_TOK = 322, |
| 132 | COLDCC_TOK = 323, |
| 133 | X86_STDCALLCC_TOK = 324, |
| 134 | X86_FASTCALLCC_TOK = 325, |
| 135 | DATALAYOUT = 326, |
| 136 | RET = 327, |
| 137 | BR = 328, |
| 138 | SWITCH = 329, |
| 139 | INVOKE = 330, |
| 140 | UNWIND = 331, |
| 141 | UNREACHABLE = 332, |
| 142 | ADD = 333, |
| 143 | SUB = 334, |
| 144 | MUL = 335, |
| 145 | UDIV = 336, |
| 146 | SDIV = 337, |
| 147 | FDIV = 338, |
| 148 | UREM = 339, |
| 149 | SREM = 340, |
| 150 | FREM = 341, |
| 151 | AND = 342, |
| 152 | OR = 343, |
| 153 | XOR = 344, |
| 154 | SETLE = 345, |
| 155 | SETGE = 346, |
| 156 | SETLT = 347, |
| 157 | SETGT = 348, |
| 158 | SETEQ = 349, |
| 159 | SETNE = 350, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 160 | ICMP = 351, |
| 161 | FCMP = 352, |
| 162 | EQ = 353, |
| 163 | NE = 354, |
| 164 | SLT = 355, |
| 165 | SGT = 356, |
| 166 | SLE = 357, |
| 167 | SGE = 358, |
| 168 | ULT = 359, |
| 169 | UGT = 360, |
| 170 | ULE = 361, |
| 171 | UGE = 362, |
| 172 | ORDEQ = 363, |
| 173 | ORDNE = 364, |
| 174 | ORDLT = 365, |
| 175 | ORDGT = 366, |
| 176 | ORDLE = 367, |
| 177 | ORDGE = 368, |
| 178 | ORD = 369, |
| 179 | UNO = 370, |
| 180 | UNOEQ = 371, |
| 181 | UNONE = 372, |
| 182 | UNOLT = 373, |
| 183 | UNOGT = 374, |
| 184 | UNOLE = 375, |
| 185 | UNOGE = 376, |
| 186 | MALLOC = 377, |
| 187 | ALLOCA = 378, |
| 188 | FREE = 379, |
| 189 | LOAD = 380, |
| 190 | STORE = 381, |
| 191 | GETELEMENTPTR = 382, |
| 192 | TRUNC = 383, |
| 193 | ZEXT = 384, |
| 194 | SEXT = 385, |
| 195 | FPTRUNC = 386, |
| 196 | FPEXT = 387, |
| 197 | BITCAST = 388, |
| 198 | UITOFP = 389, |
| 199 | SITOFP = 390, |
| 200 | FPTOUI = 391, |
| 201 | FPTOSI = 392, |
| 202 | INTTOPTR = 393, |
| 203 | PTRTOINT = 394, |
| 204 | PHI_TOK = 395, |
| 205 | SELECT = 396, |
| 206 | SHL = 397, |
| 207 | LSHR = 398, |
| 208 | ASHR = 399, |
| 209 | VAARG = 400, |
| 210 | EXTRACTELEMENT = 401, |
| 211 | INSERTELEMENT = 402, |
| 212 | SHUFFLEVECTOR = 403, |
| 213 | VAARG_old = 404, |
| 214 | VANEXT_old = 405 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 215 | }; |
| 216 | #endif |
| 217 | /* Tokens. */ |
| 218 | #define ESINT64VAL 258 |
| 219 | #define EUINT64VAL 259 |
| 220 | #define SINTVAL 260 |
| 221 | #define UINTVAL 261 |
| 222 | #define FPVAL 262 |
| 223 | #define VOID 263 |
| 224 | #define BOOL 264 |
| 225 | #define SBYTE 265 |
| 226 | #define UBYTE 266 |
| 227 | #define SHORT 267 |
| 228 | #define USHORT 268 |
| 229 | #define INT 269 |
| 230 | #define UINT 270 |
| 231 | #define LONG 271 |
| 232 | #define ULONG 272 |
| 233 | #define FLOAT 273 |
| 234 | #define DOUBLE 274 |
| 235 | #define TYPE 275 |
| 236 | #define LABEL 276 |
| 237 | #define VAR_ID 277 |
| 238 | #define LABELSTR 278 |
| 239 | #define STRINGCONSTANT 279 |
| 240 | #define IMPLEMENTATION 280 |
| 241 | #define ZEROINITIALIZER 281 |
| 242 | #define TRUETOK 282 |
| 243 | #define FALSETOK 283 |
| 244 | #define BEGINTOK 284 |
| 245 | #define ENDTOK 285 |
| 246 | #define DECLARE 286 |
| 247 | #define GLOBAL 287 |
| 248 | #define CONSTANT 288 |
| 249 | #define SECTION 289 |
| 250 | #define VOLATILE 290 |
| 251 | #define TO 291 |
| 252 | #define DOTDOTDOT 292 |
| 253 | #define NULL_TOK 293 |
| 254 | #define UNDEF 294 |
| 255 | #define CONST 295 |
| 256 | #define INTERNAL 296 |
| 257 | #define LINKONCE 297 |
| 258 | #define WEAK 298 |
| 259 | #define APPENDING 299 |
| 260 | #define DLLIMPORT 300 |
| 261 | #define DLLEXPORT 301 |
| 262 | #define EXTERN_WEAK 302 |
| 263 | #define OPAQUE 303 |
| 264 | #define NOT 304 |
| 265 | #define EXTERNAL 305 |
| 266 | #define TARGET 306 |
| 267 | #define TRIPLE 307 |
| 268 | #define ENDIAN 308 |
| 269 | #define POINTERSIZE 309 |
| 270 | #define LITTLE 310 |
| 271 | #define BIG 311 |
| 272 | #define ALIGN 312 |
| 273 | #define DEPLIBS 313 |
| 274 | #define CALL 314 |
| 275 | #define TAIL 315 |
| 276 | #define ASM_TOK 316 |
| 277 | #define MODULE 317 |
| 278 | #define SIDEEFFECT 318 |
| 279 | #define CC_TOK 319 |
| 280 | #define CCC_TOK 320 |
| 281 | #define CSRETCC_TOK 321 |
| 282 | #define FASTCC_TOK 322 |
| 283 | #define COLDCC_TOK 323 |
| 284 | #define X86_STDCALLCC_TOK 324 |
| 285 | #define X86_FASTCALLCC_TOK 325 |
| 286 | #define DATALAYOUT 326 |
| 287 | #define RET 327 |
| 288 | #define BR 328 |
| 289 | #define SWITCH 329 |
| 290 | #define INVOKE 330 |
| 291 | #define UNWIND 331 |
| 292 | #define UNREACHABLE 332 |
| 293 | #define ADD 333 |
| 294 | #define SUB 334 |
| 295 | #define MUL 335 |
| 296 | #define UDIV 336 |
| 297 | #define SDIV 337 |
| 298 | #define FDIV 338 |
| 299 | #define UREM 339 |
| 300 | #define SREM 340 |
| 301 | #define FREM 341 |
| 302 | #define AND 342 |
| 303 | #define OR 343 |
| 304 | #define XOR 344 |
| 305 | #define SETLE 345 |
| 306 | #define SETGE 346 |
| 307 | #define SETLT 347 |
| 308 | #define SETGT 348 |
| 309 | #define SETEQ 349 |
| 310 | #define SETNE 350 |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 311 | #define ICMP 351 |
| 312 | #define FCMP 352 |
| 313 | #define EQ 353 |
| 314 | #define NE 354 |
| 315 | #define SLT 355 |
| 316 | #define SGT 356 |
| 317 | #define SLE 357 |
| 318 | #define SGE 358 |
| 319 | #define ULT 359 |
| 320 | #define UGT 360 |
| 321 | #define ULE 361 |
| 322 | #define UGE 362 |
| 323 | #define ORDEQ 363 |
| 324 | #define ORDNE 364 |
| 325 | #define ORDLT 365 |
| 326 | #define ORDGT 366 |
| 327 | #define ORDLE 367 |
| 328 | #define ORDGE 368 |
| 329 | #define ORD 369 |
| 330 | #define UNO 370 |
| 331 | #define UNOEQ 371 |
| 332 | #define UNONE 372 |
| 333 | #define UNOLT 373 |
| 334 | #define UNOGT 374 |
| 335 | #define UNOLE 375 |
| 336 | #define UNOGE 376 |
| 337 | #define MALLOC 377 |
| 338 | #define ALLOCA 378 |
| 339 | #define FREE 379 |
| 340 | #define LOAD 380 |
| 341 | #define STORE 381 |
| 342 | #define GETELEMENTPTR 382 |
| 343 | #define TRUNC 383 |
| 344 | #define ZEXT 384 |
| 345 | #define SEXT 385 |
| 346 | #define FPTRUNC 386 |
| 347 | #define FPEXT 387 |
| 348 | #define BITCAST 388 |
| 349 | #define UITOFP 389 |
| 350 | #define SITOFP 390 |
| 351 | #define FPTOUI 391 |
| 352 | #define FPTOSI 392 |
| 353 | #define INTTOPTR 393 |
| 354 | #define PTRTOINT 394 |
| 355 | #define PHI_TOK 395 |
| 356 | #define SELECT 396 |
| 357 | #define SHL 397 |
| 358 | #define LSHR 398 |
| 359 | #define ASHR 399 |
| 360 | #define VAARG 400 |
| 361 | #define EXTRACTELEMENT 401 |
| 362 | #define INSERTELEMENT 402 |
| 363 | #define SHUFFLEVECTOR 403 |
| 364 | #define VAARG_old 404 |
| 365 | #define VANEXT_old 405 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | /* Copy the first part of user declarations. */ |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 371 | #line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 372 | |
| 373 | #include "ParserInternals.h" |
| 374 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 375 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 376 | #include "llvm/Instructions.h" |
| 377 | #include "llvm/Module.h" |
| 378 | #include "llvm/SymbolTable.h" |
Reid Spencer | 0b11820 | 2006-01-16 21:12:35 +0000 | [diff] [blame] | 379 | #include "llvm/Assembly/AutoUpgrade.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 380 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
| 381 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 382 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 383 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 384 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 385 | #include <list> |
| 386 | #include <utility> |
| 387 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 388 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 389 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 390 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 391 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 392 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 393 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 394 | // GenerateError are made from inside productions and they must simulate the |
| 395 | // previous exception behavior by exiting the production immediately. We have |
| 396 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 397 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 398 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 399 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 400 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 401 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 402 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 403 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 404 | int yylex(); // declaration" of xxx warnings. |
| 405 | int yyparse(); |
| 406 | |
| 407 | namespace llvm { |
| 408 | std::string CurFilename; |
| 409 | } |
| 410 | using namespace llvm; |
| 411 | |
| 412 | static Module *ParserResult; |
| 413 | |
| 414 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 415 | // relating to upreferences in the input stream. |
| 416 | // |
| 417 | //#define DEBUG_UPREFS 1 |
| 418 | #ifdef DEBUG_UPREFS |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 419 | #define UR_OUT(X) llvm_cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 420 | #else |
| 421 | #define UR_OUT(X) |
| 422 | #endif |
| 423 | |
| 424 | #define YYERROR_VERBOSE 1 |
| 425 | |
| 426 | static bool ObsoleteVarArgs; |
| 427 | static bool NewVarArgs; |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 428 | static BasicBlock *CurBB; |
| 429 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 430 | |
| 431 | |
| 432 | // This contains info used when building the body of a function. It is |
| 433 | // destroyed when the function is completed. |
| 434 | // |
| 435 | typedef std::vector<Value *> ValueList; // Numbered defs |
| 436 | static void |
| 437 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 438 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 439 | |
| 440 | static struct PerModuleInfo { |
| 441 | Module *CurrentModule; |
| 442 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 443 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 444 | std::vector<PATypeHolder> Types; |
| 445 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 446 | |
| 447 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 448 | /// how they were referenced and on which line of the input they came from so |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 449 | /// that we can resolve them later and print error messages as appropriate. |
| 450 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 451 | |
| 452 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 453 | // references to global values. Global values may be referenced before they |
| 454 | // are defined, and if so, the temporary object that they represent is held |
| 455 | // here. This is used for forward references of GlobalValues. |
| 456 | // |
| 457 | typedef std::map<std::pair<const PointerType *, |
| 458 | ValID>, GlobalValue*> GlobalRefsType; |
| 459 | GlobalRefsType GlobalRefs; |
| 460 | |
| 461 | void ModuleDone() { |
| 462 | // If we could not resolve some functions at function compilation time |
| 463 | // (calls to functions before they are defined), resolve them now... Types |
| 464 | // are resolved when the constant pool has been completely parsed. |
| 465 | // |
| 466 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 467 | if (TriggerError) |
| 468 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 469 | |
| 470 | // Check to make sure that all global value forward references have been |
| 471 | // resolved! |
| 472 | // |
| 473 | if (!GlobalRefs.empty()) { |
| 474 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 475 | |
| 476 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 477 | I != E; ++I) { |
| 478 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 479 | I->first.second.getName() + "\n"; |
| 480 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 481 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 482 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | Values.clear(); // Clear out function local definitions |
| 486 | Types.clear(); |
| 487 | CurrentModule = 0; |
| 488 | } |
| 489 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 490 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 491 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 492 | // If not, just return null. |
| 493 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 494 | // Check to see if there is a forward reference to this global variable... |
| 495 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 496 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 497 | GlobalValue *Ret = 0; |
| 498 | if (I != GlobalRefs.end()) { |
| 499 | Ret = I->second; |
| 500 | GlobalRefs.erase(I); |
| 501 | } |
| 502 | return Ret; |
| 503 | } |
| 504 | } CurModule; |
| 505 | |
| 506 | static struct PerFunctionInfo { |
| 507 | Function *CurrentFunction; // Pointer to current function being created |
| 508 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 509 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 510 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 511 | bool isDeclare; // Is this function a forward declararation? |
| 512 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 513 | |
| 514 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 515 | /// track of them here. |
| 516 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 517 | std::vector<BasicBlock*> NumberedBlocks; |
| 518 | unsigned NextBBNum; |
| 519 | |
| 520 | inline PerFunctionInfo() { |
| 521 | CurrentFunction = 0; |
| 522 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 523 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 524 | } |
| 525 | |
| 526 | inline void FunctionStart(Function *M) { |
| 527 | CurrentFunction = M; |
| 528 | NextBBNum = 0; |
| 529 | } |
| 530 | |
| 531 | void FunctionDone() { |
| 532 | NumberedBlocks.clear(); |
| 533 | |
| 534 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 535 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 536 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 537 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 538 | return; |
| 539 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 540 | |
| 541 | // Resolve all forward references now. |
| 542 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 543 | |
| 544 | Values.clear(); // Clear out function local definitions |
| 545 | CurrentFunction = 0; |
| 546 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 547 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 548 | } |
| 549 | } CurFun; // Info for the current function... |
| 550 | |
| 551 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 552 | |
| 553 | |
| 554 | //===----------------------------------------------------------------------===// |
| 555 | // Code to handle definitions of all the types |
| 556 | //===----------------------------------------------------------------------===// |
| 557 | |
| 558 | static int InsertValue(Value *V, |
| 559 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 560 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 561 | |
| 562 | // Yes, insert the value into the value table... |
| 563 | ValueList &List = ValueTab[V->getType()]; |
| 564 | List.push_back(V); |
| 565 | return List.size()-1; |
| 566 | } |
| 567 | |
| 568 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 569 | switch (D.Type) { |
| 570 | case ValID::NumberVal: // Is it a numbered definition? |
| 571 | // Module constants occupy the lowest numbered slots... |
| 572 | if ((unsigned)D.Num < CurModule.Types.size()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 573 | return CurModule.Types[(unsigned)D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 574 | break; |
| 575 | case ValID::NameVal: // Is it a named definition? |
| 576 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 577 | D.destroy(); // Free old strdup'd memory... |
| 578 | return N; |
| 579 | } |
| 580 | break; |
| 581 | default: |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 582 | GenerateError("Internal parser error: Invalid symbol type reference!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 583 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | // If we reached here, we referenced either a symbol that we don't know about |
| 587 | // or an id number that hasn't been read yet. We may be referencing something |
| 588 | // forward, so just create an entry to be resolved later and get to it... |
| 589 | // |
| 590 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 591 | |
| 592 | |
| 593 | if (inFunctionScope()) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 594 | if (D.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 595 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 596 | return 0; |
| 597 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 598 | GenerateError("Reference to an undefined type: #" + itostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 599 | return 0; |
| 600 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 601 | } |
| 602 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 603 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 604 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 605 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 606 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 607 | Type *Typ = OpaqueType::get(); |
| 608 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 609 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 610 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 611 | |
| 612 | static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { |
| 613 | SymbolTable &SymTab = |
| 614 | inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : |
| 615 | CurModule.CurrentModule->getSymbolTable(); |
| 616 | return SymTab.lookup(Ty, Name); |
| 617 | } |
| 618 | |
| 619 | // getValNonImprovising - Look up the value specified by the provided type and |
| 620 | // the provided ValID. If the value exists and has already been defined, return |
| 621 | // it. Otherwise return null. |
| 622 | // |
| 623 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 624 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 625 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 626 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 627 | return 0; |
| 628 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 629 | |
| 630 | switch (D.Type) { |
| 631 | case ValID::NumberVal: { // Is it a numbered definition? |
| 632 | unsigned Num = (unsigned)D.Num; |
| 633 | |
| 634 | // Module constants occupy the lowest numbered slots... |
| 635 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 636 | if (VI != CurModule.Values.end()) { |
| 637 | if (Num < VI->second.size()) |
| 638 | return VI->second[Num]; |
| 639 | Num -= VI->second.size(); |
| 640 | } |
| 641 | |
| 642 | // Make sure that our type is within bounds |
| 643 | VI = CurFun.Values.find(Ty); |
| 644 | if (VI == CurFun.Values.end()) return 0; |
| 645 | |
| 646 | // Check that the number is within bounds... |
| 647 | if (VI->second.size() <= Num) return 0; |
| 648 | |
| 649 | return VI->second[Num]; |
| 650 | } |
| 651 | |
| 652 | case ValID::NameVal: { // Is it a named definition? |
| 653 | Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); |
| 654 | if (N == 0) return 0; |
| 655 | |
| 656 | D.destroy(); // Free old strdup'd memory... |
| 657 | return N; |
| 658 | } |
| 659 | |
| 660 | // Check to make sure that "Ty" is an integral type, and that our |
| 661 | // value will fit into the specified type... |
| 662 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 663 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 664 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 665 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 666 | Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 667 | return 0; |
| 668 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 669 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 670 | |
| 671 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 672 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 673 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 674 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 675 | "' is invalid or out of range!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 676 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 677 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 678 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 679 | } |
| 680 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 681 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 682 | } |
| 683 | |
| 684 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 685 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 686 | GenerateError("FP constant invalid for type!!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 687 | return 0; |
| 688 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 689 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 690 | |
| 691 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 692 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 693 | GenerateError("Cannot create a a non pointer null!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 694 | return 0; |
| 695 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 696 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 697 | |
| 698 | case ValID::ConstUndefVal: // Is it an undef value? |
| 699 | return UndefValue::get(Ty); |
| 700 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 701 | case ValID::ConstZeroVal: // Is it a zero value? |
| 702 | return Constant::getNullValue(Ty); |
| 703 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 704 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 705 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 706 | GenerateError("Constant expression type different from required type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 707 | return 0; |
| 708 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 709 | return D.ConstantValue; |
| 710 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 711 | case ValID::InlineAsmVal: { // Inline asm expression |
| 712 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 713 | const FunctionType *FTy = |
| 714 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 715 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 716 | GenerateError("Invalid type for asm constraint string!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 717 | return 0; |
| 718 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 719 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 720 | D.IAD->HasSideEffects); |
| 721 | D.destroy(); // Free InlineAsmDescriptor. |
| 722 | return IA; |
| 723 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 724 | default: |
| 725 | assert(0 && "Unhandled case!"); |
| 726 | return 0; |
| 727 | } // End of switch |
| 728 | |
| 729 | assert(0 && "Unhandled case!"); |
| 730 | return 0; |
| 731 | } |
| 732 | |
| 733 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 734 | // value is not already defined, it "improvises" by creating a placeholder var |
| 735 | // that looks and acts just like the requested variable. When the value is |
| 736 | // defined later, all uses of the placeholder variable are replaced with the |
| 737 | // real thing. |
| 738 | // |
| 739 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 740 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 741 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 742 | return 0; |
| 743 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 744 | |
| 745 | // See if the value has already been defined. |
| 746 | Value *V = getValNonImprovising(Ty, ID); |
| 747 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 748 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 749 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 750 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 751 | GenerateError("Invalid use of a composite type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 752 | return 0; |
| 753 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 754 | |
| 755 | // If we reached here, we referenced either a symbol that we don't know about |
| 756 | // or an id number that hasn't been read yet. We may be referencing something |
| 757 | // forward, so just create an entry to be resolved later and get to it... |
| 758 | // |
| 759 | V = new Argument(Ty); |
| 760 | |
| 761 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 762 | // to recycle these things?? |
| 763 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 764 | llvmAsmlineno))); |
| 765 | |
| 766 | if (inFunctionScope()) |
| 767 | InsertValue(V, CurFun.LateResolveValues); |
| 768 | else |
| 769 | InsertValue(V, CurModule.LateResolveValues); |
| 770 | return V; |
| 771 | } |
| 772 | |
| 773 | /// getBBVal - This is used for two purposes: |
| 774 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 775 | /// defined. |
| 776 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 777 | /// or may not be a forward reference. |
| 778 | /// |
| 779 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 780 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 781 | |
| 782 | std::string Name; |
| 783 | BasicBlock *BB = 0; |
| 784 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 785 | default: |
| 786 | GenerateError("Illegal label reference " + ID.getName()); |
| 787 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 788 | case ValID::NumberVal: // Is it a numbered definition? |
| 789 | if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) |
| 790 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 791 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 792 | break; |
| 793 | case ValID::NameVal: // Is it a named definition? |
| 794 | Name = ID.Name; |
| 795 | if (Value *N = CurFun.CurrentFunction-> |
| 796 | getSymbolTable().lookup(Type::LabelTy, Name)) |
| 797 | BB = cast<BasicBlock>(N); |
| 798 | break; |
| 799 | } |
| 800 | |
| 801 | // See if the block has already been defined. |
| 802 | if (BB) { |
| 803 | // If this is the definition of the block, make sure the existing value was |
| 804 | // just a forward reference. If it was a forward reference, there will be |
| 805 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 806 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 807 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 808 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 809 | return 0; |
| 810 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 811 | |
| 812 | ID.destroy(); // Free strdup'd memory. |
| 813 | return BB; |
| 814 | } |
| 815 | |
| 816 | // Otherwise this block has not been seen before. |
| 817 | BB = new BasicBlock("", CurFun.CurrentFunction); |
| 818 | if (ID.Type == ValID::NameVal) { |
| 819 | BB->setName(ID.Name); |
| 820 | } else { |
| 821 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 822 | } |
| 823 | |
| 824 | // If this is not a definition, keep track of it so we can use it as a forward |
| 825 | // reference. |
| 826 | if (!isDefinition) { |
| 827 | // Remember where this forward reference came from. |
| 828 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 829 | } else { |
| 830 | // The forward declaration could have been inserted anywhere in the |
| 831 | // function: insert it into the correct place now. |
| 832 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 833 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 834 | } |
| 835 | ID.destroy(); |
| 836 | return BB; |
| 837 | } |
| 838 | |
| 839 | |
| 840 | //===----------------------------------------------------------------------===// |
| 841 | // Code to handle forward references in instructions |
| 842 | //===----------------------------------------------------------------------===// |
| 843 | // |
| 844 | // This code handles the late binding needed with statements that reference |
| 845 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 846 | // a loop body. |
| 847 | // |
| 848 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 849 | // and back patchs after we are done. |
| 850 | // |
| 851 | |
| 852 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 853 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 854 | // defs now... |
| 855 | // |
| 856 | static void |
| 857 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 858 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 859 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 860 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 861 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 862 | ValueList &List = LRI->second; |
| 863 | while (!List.empty()) { |
| 864 | Value *V = List.back(); |
| 865 | List.pop_back(); |
| 866 | |
| 867 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 868 | CurModule.PlaceHolderInfo.find(V); |
| 869 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 870 | |
| 871 | ValID &DID = PHI->second.first; |
| 872 | |
| 873 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 874 | if (TriggerError) |
| 875 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 876 | if (TheRealValue) { |
| 877 | V->replaceAllUsesWith(TheRealValue); |
| 878 | delete V; |
| 879 | CurModule.PlaceHolderInfo.erase(PHI); |
| 880 | } else if (FutureLateResolvers) { |
| 881 | // Functions have their unresolved items forwarded to the module late |
| 882 | // resolver table |
| 883 | InsertValue(V, *FutureLateResolvers); |
| 884 | } else { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 885 | if (DID.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 886 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 887 | "' of type '" + V->getType()->getDescription() + "'", |
| 888 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 889 | return; |
| 890 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 891 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 892 | itostr(DID.Num) + " of type '" + |
| 893 | V->getType()->getDescription() + "'", |
| 894 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 895 | return; |
| 896 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 897 | } |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | LateResolvers.clear(); |
| 902 | } |
| 903 | |
| 904 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 905 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 906 | // refering to the number can be resolved. Do this now. |
| 907 | // |
| 908 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 909 | ValID D; |
| 910 | if (Name) D = ValID::create(Name); |
| 911 | else D = ValID::create((int)CurModule.Types.size()); |
| 912 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 913 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 914 | CurModule.LateResolveTypes.find(D); |
| 915 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 916 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 917 | CurModule.LateResolveTypes.erase(I); |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | // setValueName - Set the specified value to the name given. The name may be |
| 922 | // null potentially, in which case this is a noop. The string passed in is |
| 923 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 924 | // |
| 925 | static void setValueName(Value *V, char *NameStr) { |
| 926 | if (NameStr) { |
| 927 | std::string Name(NameStr); // Copy string |
| 928 | free(NameStr); // Free old string |
| 929 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 930 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 931 | GenerateError("Can't assign name '" + Name+"' to value with void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 932 | return; |
| 933 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 934 | |
| 935 | assert(inFunctionScope() && "Must be in function scope!"); |
| 936 | SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 937 | if (ST.lookup(V->getType(), Name)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 938 | GenerateError("Redefinition of value named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 939 | V->getType()->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 940 | return; |
| 941 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 942 | |
| 943 | // Set the name. |
| 944 | V->setName(Name); |
| 945 | } |
| 946 | } |
| 947 | |
| 948 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 949 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 950 | static GlobalVariable * |
| 951 | ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, |
| 952 | bool isConstantGlobal, const Type *Ty, |
| 953 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 954 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 955 | GenerateError("Cannot declare global vars of function type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 956 | return 0; |
| 957 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 958 | |
| 959 | const PointerType *PTy = PointerType::get(Ty); |
| 960 | |
| 961 | std::string Name; |
| 962 | if (NameStr) { |
| 963 | Name = NameStr; // Copy string |
| 964 | free(NameStr); // Free old string |
| 965 | } |
| 966 | |
| 967 | // See if this global value was forward referenced. If so, recycle the |
| 968 | // object. |
| 969 | ValID ID; |
| 970 | if (!Name.empty()) { |
| 971 | ID = ValID::create((char*)Name.c_str()); |
| 972 | } else { |
| 973 | ID = ValID::create((int)CurModule.Values[PTy].size()); |
| 974 | } |
| 975 | |
| 976 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 977 | // Move the global to the end of the list, from whereever it was |
| 978 | // previously inserted. |
| 979 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 980 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 981 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 982 | GV->setInitializer(Initializer); |
| 983 | GV->setLinkage(Linkage); |
| 984 | GV->setConstant(isConstantGlobal); |
| 985 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 986 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 987 | } |
| 988 | |
| 989 | // If this global has a name, check to see if there is already a definition |
| 990 | // of this global in the module. If so, merge as appropriate. Note that |
| 991 | // this is really just a hack around problems in the CFE. :( |
| 992 | if (!Name.empty()) { |
| 993 | // We are a simple redefinition of a value, check to see if it is defined |
| 994 | // the same as the old one. |
| 995 | if (GlobalVariable *EGV = |
| 996 | CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
| 997 | // We are allowed to redefine a global variable in two circumstances: |
| 998 | // 1. If at least one of the globals is uninitialized or |
| 999 | // 2. If both initializers have the same value. |
| 1000 | // |
| 1001 | if (!EGV->hasInitializer() || !Initializer || |
| 1002 | EGV->getInitializer() == Initializer) { |
| 1003 | |
| 1004 | // Make sure the existing global version gets the initializer! Make |
| 1005 | // sure that it also gets marked const if the new version is. |
| 1006 | if (Initializer && !EGV->hasInitializer()) |
| 1007 | EGV->setInitializer(Initializer); |
| 1008 | if (isConstantGlobal) |
| 1009 | EGV->setConstant(true); |
| 1010 | EGV->setLinkage(Linkage); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1011 | return EGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1012 | } |
| 1013 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1014 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1015 | "' in the '" + Ty->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1016 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | // Otherwise there is no existing GV to use, create one now. |
| 1021 | GlobalVariable *GV = |
| 1022 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1023 | CurModule.CurrentModule); |
| 1024 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1025 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1026 | } |
| 1027 | |
| 1028 | // setTypeName - Set the specified type to the name given. The name may be |
| 1029 | // null potentially, in which case this is a noop. The string passed in is |
| 1030 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1031 | // |
| 1032 | // This function returns true if the type has already been defined, but is |
| 1033 | // allowed to be redefined in the specified context. If the name is a new name |
| 1034 | // for the type plane, it is inserted and false is returned. |
| 1035 | static bool setTypeName(const Type *T, char *NameStr) { |
| 1036 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 1037 | if (NameStr == 0) return false; |
| 1038 | |
| 1039 | std::string Name(NameStr); // Copy string |
| 1040 | free(NameStr); // Free old string |
| 1041 | |
| 1042 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1043 | if (T == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1044 | GenerateError("Can't assign name '" + Name + "' to the void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1045 | return false; |
| 1046 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1047 | |
| 1048 | // Set the type name, checking for conflicts as we do so. |
| 1049 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1050 | |
| 1051 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1052 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1053 | assert(Existing && "Conflict but no matching type?"); |
| 1054 | |
| 1055 | // There is only one case where this is allowed: when we are refining an |
| 1056 | // opaque type. In this case, Existing will be an opaque type. |
| 1057 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1058 | // We ARE replacing an opaque type! |
| 1059 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1060 | return true; |
| 1061 | } |
| 1062 | |
| 1063 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1064 | // the redefinition is identical to the original. This will be so if |
| 1065 | // Existing and T point to the same Type object. In this one case we |
| 1066 | // allow the equivalent redefinition. |
| 1067 | if (Existing == T) return true; // Yes, it's equal. |
| 1068 | |
| 1069 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1070 | GenerateError("Redefinition of type named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1071 | T->getDescription() + "' type plane!"); |
| 1072 | } |
| 1073 | |
| 1074 | return false; |
| 1075 | } |
| 1076 | |
| 1077 | //===----------------------------------------------------------------------===// |
| 1078 | // Code for handling upreferences in type names... |
| 1079 | // |
| 1080 | |
| 1081 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1082 | // |
| 1083 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1084 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1085 | E) != Ty->subtype_end(); |
| 1086 | } |
| 1087 | |
| 1088 | namespace { |
| 1089 | struct UpRefRecord { |
| 1090 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1091 | // this type is resolved. |
| 1092 | unsigned NestingLevel; |
| 1093 | |
| 1094 | // LastContainedTy - This is the type at the current binding level for the |
| 1095 | // type. Every time we reduce the nesting level, this gets updated. |
| 1096 | const Type *LastContainedTy; |
| 1097 | |
| 1098 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1099 | // represented with. |
| 1100 | OpaqueType *UpRefTy; |
| 1101 | |
| 1102 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1103 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1104 | }; |
| 1105 | } |
| 1106 | |
| 1107 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1108 | static std::vector<UpRefRecord> UpRefs; |
| 1109 | |
| 1110 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1111 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1112 | /// currently active types. For each type, if the up reference is contained in |
| 1113 | /// the newly completed type, we decrement the level count. When the level |
| 1114 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1115 | /// thus we can complete the cycle. |
| 1116 | /// |
| 1117 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1118 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1119 | // nothing to resolve here. |
| 1120 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1121 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1122 | PATypeHolder Ty(ty); |
| 1123 | UR_OUT("Type '" << Ty->getDescription() << |
| 1124 | "' newly formed. Resolving upreferences.\n" << |
| 1125 | UpRefs.size() << " upreferences active!\n"); |
| 1126 | |
| 1127 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1128 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1129 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1130 | // this variable. |
| 1131 | OpaqueType *TypeToResolve = 0; |
| 1132 | |
| 1133 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1134 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1135 | << UpRefs[i].second->getDescription() << ") = " |
| 1136 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1137 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1138 | // Decrement level of upreference |
| 1139 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1140 | UpRefs[i].LastContainedTy = Ty; |
| 1141 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1142 | if (Level == 0) { // Upreference should be resolved! |
| 1143 | if (!TypeToResolve) { |
| 1144 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1145 | } else { |
| 1146 | UR_OUT(" * Resolving upreference for " |
| 1147 | << UpRefs[i].second->getDescription() << "\n"; |
| 1148 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1149 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1150 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1151 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1152 | } |
| 1153 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1154 | --i; // Do not skip the next element... |
| 1155 | } |
| 1156 | } |
| 1157 | } |
| 1158 | |
| 1159 | if (TypeToResolve) { |
| 1160 | UR_OUT(" * Resolving upreference for " |
| 1161 | << UpRefs[i].second->getDescription() << "\n"; |
| 1162 | std::string OldName = TypeToResolve->getDescription()); |
| 1163 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1164 | } |
| 1165 | |
| 1166 | return Ty; |
| 1167 | } |
| 1168 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1169 | // common code from the two 'RunVMAsmParser' functions |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1170 | static Module* RunParser(Module * M) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1171 | |
| 1172 | llvmAsmlineno = 1; // Reset the current line number... |
| 1173 | ObsoleteVarArgs = false; |
| 1174 | NewVarArgs = false; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1175 | CurModule.CurrentModule = M; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 1176 | |
| 1177 | // Check to make sure the parser succeeded |
| 1178 | if (yyparse()) { |
| 1179 | if (ParserResult) |
| 1180 | delete ParserResult; |
| 1181 | return 0; |
| 1182 | } |
| 1183 | |
| 1184 | // Check to make sure that parsing produced a result |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1185 | if (!ParserResult) |
| 1186 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1187 | |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 1188 | // Reset ParserResult variable while saving its value for the result. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1189 | Module *Result = ParserResult; |
| 1190 | ParserResult = 0; |
| 1191 | |
| 1192 | //Not all functions use vaarg, so make a second check for ObsoleteVarArgs |
| 1193 | { |
| 1194 | Function* F; |
| 1195 | if ((F = Result->getNamedFunction("llvm.va_start")) |
| 1196 | && F->getFunctionType()->getNumParams() == 0) |
| 1197 | ObsoleteVarArgs = true; |
| 1198 | if((F = Result->getNamedFunction("llvm.va_copy")) |
| 1199 | && F->getFunctionType()->getNumParams() == 1) |
| 1200 | ObsoleteVarArgs = true; |
| 1201 | } |
| 1202 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1203 | if (ObsoleteVarArgs && NewVarArgs) { |
| 1204 | GenerateError( |
| 1205 | "This file is corrupt: it uses both new and old style varargs"); |
| 1206 | return 0; |
| 1207 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1208 | |
| 1209 | if(ObsoleteVarArgs) { |
| 1210 | if(Function* F = Result->getNamedFunction("llvm.va_start")) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1211 | if (F->arg_size() != 0) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1212 | GenerateError("Obsolete va_start takes 0 argument!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1213 | return 0; |
| 1214 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1215 | |
| 1216 | //foo = va_start() |
| 1217 | // -> |
| 1218 | //bar = alloca typeof(foo) |
| 1219 | //va_start(bar) |
| 1220 | //foo = load bar |
| 1221 | |
| 1222 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1223 | const Type* ArgTy = F->getFunctionType()->getReturnType(); |
| 1224 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1225 | Function* NF = Result->getOrInsertFunction("llvm.va_start", |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 1226 | RetTy, ArgTyPtr, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1227 | |
| 1228 | while (!F->use_empty()) { |
| 1229 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1230 | AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); |
| 1231 | new CallInst(NF, bar, "", CI); |
| 1232 | Value* foo = new LoadInst(bar, "vastart.fix.2", CI); |
| 1233 | CI->replaceAllUsesWith(foo); |
| 1234 | CI->getParent()->getInstList().erase(CI); |
| 1235 | } |
| 1236 | Result->getFunctionList().erase(F); |
| 1237 | } |
| 1238 | |
| 1239 | if(Function* F = Result->getNamedFunction("llvm.va_end")) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1240 | if(F->arg_size() != 1) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1241 | GenerateError("Obsolete va_end takes 1 argument!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1242 | return 0; |
| 1243 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1244 | |
| 1245 | //vaend foo |
| 1246 | // -> |
| 1247 | //bar = alloca 1 of typeof(foo) |
| 1248 | //vaend bar |
| 1249 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1250 | const Type* ArgTy = F->getFunctionType()->getParamType(0); |
| 1251 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1252 | Function* NF = Result->getOrInsertFunction("llvm.va_end", |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 1253 | RetTy, ArgTyPtr, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1254 | |
| 1255 | while (!F->use_empty()) { |
| 1256 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1257 | AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); |
| 1258 | new StoreInst(CI->getOperand(1), bar, CI); |
| 1259 | new CallInst(NF, bar, "", CI); |
| 1260 | CI->getParent()->getInstList().erase(CI); |
| 1261 | } |
| 1262 | Result->getFunctionList().erase(F); |
| 1263 | } |
| 1264 | |
| 1265 | if(Function* F = Result->getNamedFunction("llvm.va_copy")) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1266 | if(F->arg_size() != 1) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1267 | GenerateError("Obsolete va_copy takes 1 argument!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1268 | return 0; |
| 1269 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1270 | //foo = vacopy(bar) |
| 1271 | // -> |
| 1272 | //a = alloca 1 of typeof(foo) |
| 1273 | //b = alloca 1 of typeof(foo) |
| 1274 | //store bar -> b |
| 1275 | //vacopy(a, b) |
| 1276 | //foo = load a |
| 1277 | |
| 1278 | const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); |
| 1279 | const Type* ArgTy = F->getFunctionType()->getReturnType(); |
| 1280 | const Type* ArgTyPtr = PointerType::get(ArgTy); |
| 1281 | Function* NF = Result->getOrInsertFunction("llvm.va_copy", |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 1282 | RetTy, ArgTyPtr, ArgTyPtr, |
| 1283 | (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1284 | |
| 1285 | while (!F->use_empty()) { |
| 1286 | CallInst* CI = cast<CallInst>(F->use_back()); |
| 1287 | AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); |
| 1288 | AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); |
| 1289 | new StoreInst(CI->getOperand(1), b, CI); |
| 1290 | new CallInst(NF, a, b, "", CI); |
| 1291 | Value* foo = new LoadInst(a, "vacopy.fix.3", CI); |
| 1292 | CI->replaceAllUsesWith(foo); |
| 1293 | CI->getParent()->getInstList().erase(CI); |
| 1294 | } |
| 1295 | Result->getFunctionList().erase(F); |
| 1296 | } |
| 1297 | } |
| 1298 | |
| 1299 | return Result; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1300 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1301 | |
| 1302 | //===----------------------------------------------------------------------===// |
| 1303 | // RunVMAsmParser - Define an interface to this parser |
| 1304 | //===----------------------------------------------------------------------===// |
| 1305 | // |
| 1306 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1307 | set_scan_file(F); |
| 1308 | |
| 1309 | CurFilename = Filename; |
| 1310 | return RunParser(new Module(CurFilename)); |
| 1311 | } |
| 1312 | |
| 1313 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1314 | set_scan_string(AsmString); |
| 1315 | |
| 1316 | CurFilename = "from_memory"; |
| 1317 | if (M == NULL) { |
| 1318 | return RunParser(new Module (CurFilename)); |
| 1319 | } else { |
| 1320 | return RunParser(M); |
| 1321 | } |
| 1322 | } |
| 1323 | |
| 1324 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1325 | |
| 1326 | /* Enabling traces. */ |
| 1327 | #ifndef YYDEBUG |
| 1328 | # define YYDEBUG 0 |
| 1329 | #endif |
| 1330 | |
| 1331 | /* Enabling verbose error messages. */ |
| 1332 | #ifdef YYERROR_VERBOSE |
| 1333 | # undef YYERROR_VERBOSE |
| 1334 | # define YYERROR_VERBOSE 1 |
| 1335 | #else |
| 1336 | # define YYERROR_VERBOSE 0 |
| 1337 | #endif |
| 1338 | |
| 1339 | /* Enabling the token table. */ |
| 1340 | #ifndef YYTOKEN_TABLE |
| 1341 | # define YYTOKEN_TABLE 0 |
| 1342 | #endif |
| 1343 | |
| 1344 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1345 | #line 968 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1346 | typedef union YYSTYPE { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1347 | llvm::Module *ModuleVal; |
| 1348 | llvm::Function *FunctionVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1349 | std::pair<llvm::PATypeHolder*, char*> *ArgVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1350 | llvm::BasicBlock *BasicBlockVal; |
| 1351 | llvm::TerminatorInst *TermInstVal; |
| 1352 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1353 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1354 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1355 | const llvm::Type *PrimType; |
| 1356 | llvm::PATypeHolder *TypeVal; |
| 1357 | llvm::Value *ValueVal; |
| 1358 | |
| 1359 | std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList; |
| 1360 | std::vector<llvm::Value*> *ValueList; |
| 1361 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1362 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1363 | std::list<std::pair<llvm::Value*, |
| 1364 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1365 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1366 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1367 | |
| 1368 | llvm::GlobalValue::LinkageTypes Linkage; |
| 1369 | int64_t SInt64Val; |
| 1370 | uint64_t UInt64Val; |
| 1371 | int SIntVal; |
| 1372 | unsigned UIntVal; |
| 1373 | double FPVal; |
| 1374 | bool BoolVal; |
| 1375 | |
| 1376 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1377 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1378 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1379 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1380 | llvm::Instruction::TermOps TermOpVal; |
| 1381 | llvm::Instruction::MemoryOps MemOpVal; |
| 1382 | llvm::Instruction::CastOps CastOpVal; |
| 1383 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1384 | llvm::Module::Endianness Endianness; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1385 | llvm::ICmpInst::Predicate IPredicate; |
| 1386 | llvm::FCmpInst::Predicate FPredicate; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1387 | } YYSTYPE; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1388 | /* Line 196 of yacc.c. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1389 | #line 1390 "llvmAsmParser.tab.c" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1390 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1391 | # define YYSTYPE_IS_DECLARED 1 |
| 1392 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1393 | #endif |
| 1394 | |
| 1395 | |
| 1396 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1397 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1398 | |
| 1399 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1400 | /* Line 219 of yacc.c. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1401 | #line 1402 "llvmAsmParser.tab.c" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1402 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1403 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 1404 | # define YYSIZE_T __SIZE_TYPE__ |
| 1405 | #endif |
| 1406 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 1407 | # define YYSIZE_T size_t |
| 1408 | #endif |
| 1409 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) |
| 1410 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1411 | # define YYSIZE_T size_t |
| 1412 | #endif |
| 1413 | #if ! defined (YYSIZE_T) |
| 1414 | # define YYSIZE_T unsigned int |
| 1415 | #endif |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 1416 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1417 | #ifndef YY_ |
| 1418 | # if YYENABLE_NLS |
| 1419 | # if ENABLE_NLS |
| 1420 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1421 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1422 | # endif |
| 1423 | # endif |
| 1424 | # ifndef YY_ |
| 1425 | # define YY_(msgid) msgid |
| 1426 | # endif |
| 1427 | #endif |
| 1428 | |
| 1429 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 1430 | |
| 1431 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1432 | |
| 1433 | # ifdef YYSTACK_USE_ALLOCA |
| 1434 | # if YYSTACK_USE_ALLOCA |
| 1435 | # ifdef __GNUC__ |
| 1436 | # define YYSTACK_ALLOC __builtin_alloca |
| 1437 | # else |
| 1438 | # define YYSTACK_ALLOC alloca |
| 1439 | # if defined (__STDC__) || defined (__cplusplus) |
| 1440 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1441 | # define YYINCLUDED_STDLIB_H |
| 1442 | # endif |
| 1443 | # endif |
| 1444 | # endif |
| 1445 | # endif |
| 1446 | |
| 1447 | # ifdef YYSTACK_ALLOC |
| 1448 | /* Pacify GCC's `empty if-body' warning. */ |
| 1449 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 1450 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1451 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1452 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1453 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1454 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1455 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ |
| 1456 | # endif |
| 1457 | # else |
| 1458 | # define YYSTACK_ALLOC YYMALLOC |
| 1459 | # define YYSTACK_FREE YYFREE |
| 1460 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1461 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) |
| 1462 | # endif |
| 1463 | # ifdef __cplusplus |
| 1464 | extern "C" { |
| 1465 | # endif |
| 1466 | # ifndef YYMALLOC |
| 1467 | # define YYMALLOC malloc |
| 1468 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1469 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1470 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1471 | # endif |
| 1472 | # endif |
| 1473 | # ifndef YYFREE |
| 1474 | # define YYFREE free |
| 1475 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ |
| 1476 | && (defined (__STDC__) || defined (__cplusplus))) |
| 1477 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1478 | # endif |
| 1479 | # endif |
| 1480 | # ifdef __cplusplus |
| 1481 | } |
| 1482 | # endif |
| 1483 | # endif |
| 1484 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 1485 | |
| 1486 | |
| 1487 | #if (! defined (yyoverflow) \ |
| 1488 | && (! defined (__cplusplus) \ |
| 1489 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) |
| 1490 | |
| 1491 | /* A type that is properly aligned for any stack member. */ |
| 1492 | union yyalloc |
| 1493 | { |
| 1494 | short int yyss; |
| 1495 | YYSTYPE yyvs; |
| 1496 | }; |
| 1497 | |
| 1498 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1499 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1500 | |
| 1501 | /* The size of an array large to enough to hold all stacks, each with |
| 1502 | N elements. */ |
| 1503 | # define YYSTACK_BYTES(N) \ |
| 1504 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ |
| 1505 | + YYSTACK_GAP_MAXIMUM) |
| 1506 | |
| 1507 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1508 | not overlap. */ |
| 1509 | # ifndef YYCOPY |
| 1510 | # if defined (__GNUC__) && 1 < __GNUC__ |
| 1511 | # define YYCOPY(To, From, Count) \ |
| 1512 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1513 | # else |
| 1514 | # define YYCOPY(To, From, Count) \ |
| 1515 | do \ |
| 1516 | { \ |
| 1517 | YYSIZE_T yyi; \ |
| 1518 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1519 | (To)[yyi] = (From)[yyi]; \ |
| 1520 | } \ |
| 1521 | while (0) |
| 1522 | # endif |
| 1523 | # endif |
| 1524 | |
| 1525 | /* Relocate STACK from its old location to the new one. The |
| 1526 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1527 | elements in the stack, and YYPTR gives the new location of the |
| 1528 | stack. Advance YYPTR to a properly aligned location for the next |
| 1529 | stack. */ |
| 1530 | # define YYSTACK_RELOCATE(Stack) \ |
| 1531 | do \ |
| 1532 | { \ |
| 1533 | YYSIZE_T yynewbytes; \ |
| 1534 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1535 | Stack = &yyptr->Stack; \ |
| 1536 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1537 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1538 | } \ |
| 1539 | while (0) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 1540 | |
| 1541 | #endif |
| 1542 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1543 | #if defined (__STDC__) || defined (__cplusplus) |
| 1544 | typedef signed char yysigned_char; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1545 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1546 | typedef short int yysigned_char; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1547 | #endif |
| 1548 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1549 | /* YYFINAL -- State number of the termination state. */ |
| 1550 | #define YYFINAL 4 |
| 1551 | /* YYLAST -- Last index in YYTABLE. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1552 | #define YYLAST 1503 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1553 | |
| 1554 | /* YYNTOKENS -- Number of terminals. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1555 | #define YYNTOKENS 165 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1556 | /* YYNNTS -- Number of nonterminals. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1557 | #define YYNNTS 78 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1558 | /* YYNRULES -- Number of rules. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1559 | #define YYNRULES 297 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1560 | /* YYNRULES -- Number of states. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1561 | #define YYNSTATES 586 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1562 | |
| 1563 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1564 | #define YYUNDEFTOK 2 |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1565 | #define YYMAXUTOK 405 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1566 | |
| 1567 | #define YYTRANSLATE(YYX) \ |
| 1568 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1569 | |
| 1570 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1571 | static const unsigned char yytranslate[] = |
| 1572 | { |
| 1573 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1574 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1575 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1576 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1577 | 154, 155, 163, 2, 152, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1578 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1579 | 159, 151, 160, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1580 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1581 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1582 | 2, 156, 153, 158, 2, 2, 2, 2, 2, 164, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1583 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1584 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1585 | 157, 2, 2, 161, 2, 162, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1586 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1587 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1588 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1589 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1590 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1591 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1592 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1593 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1594 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1595 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1596 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1597 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1598 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1599 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1600 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1601 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1602 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1603 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1604 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1605 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1606 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1607 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1608 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1609 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1610 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1611 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1612 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
| 1613 | 145, 146, 147, 148, 149, 150 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1614 | }; |
| 1615 | |
| 1616 | #if YYDEBUG |
| 1617 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1618 | YYRHS. */ |
| 1619 | static const unsigned short int yyprhs[] = |
| 1620 | { |
| 1621 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1622 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1623 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1624 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1625 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1626 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1627 | 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, |
| 1628 | 139, 141, 143, 145, 147, 149, 152, 153, 155, 157, |
| 1629 | 159, 161, 163, 165, 167, 168, 169, 171, 173, 175, |
| 1630 | 177, 179, 181, 184, 185, 188, 189, 193, 196, 197, |
| 1631 | 199, 200, 204, 206, 209, 211, 213, 215, 217, 219, |
| 1632 | 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, |
| 1633 | 241, 243, 245, 247, 249, 251, 254, 259, 265, 271, |
| 1634 | 275, 278, 281, 283, 287, 289, 293, 295, 296, 301, |
| 1635 | 305, 309, 314, 319, 323, 326, 329, 332, 335, 338, |
| 1636 | 341, 344, 347, 350, 353, 360, 366, 375, 382, 389, |
| 1637 | 396, 405, 414, 421, 428, 437, 446, 450, 452, 454, |
| 1638 | 456, 458, 461, 464, 469, 472, 474, 479, 482, 487, |
| 1639 | 488, 496, 497, 505, 506, 514, 515, 523, 527, 532, |
| 1640 | 533, 535, 537, 539, 543, 547, 551, 555, 559, 563, |
| 1641 | 565, 566, 568, 570, 572, 573, 576, 580, 582, 584, |
| 1642 | 588, 590, 591, 600, 602, 604, 608, 610, 612, 615, |
| 1643 | 616, 618, 620, 621, 626, 627, 629, 631, 633, 635, |
| 1644 | 637, 639, 641, 643, 645, 649, 651, 657, 659, 661, |
| 1645 | 663, 665, 668, 671, 674, 678, 681, 682, 684, 687, |
| 1646 | 690, 694, 704, 714, 723, 737, 739, 741, 748, 754, |
| 1647 | 757, 764, 772, 774, 778, 780, 781, 784, 786, 792, |
| 1648 | 798, 804, 811, 818, 821, 826, 831, 838, 843, 848, |
| 1649 | 853, 858, 865, 872, 875, 883, 885, 888, 889, 891, |
| 1650 | 892, 896, 903, 907, 914, 917, 922, 929 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1651 | }; |
| 1652 | |
| 1653 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1654 | static const short int yyrhs[] = |
| 1655 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1656 | 199, 0, -1, 5, -1, 6, -1, 3, -1, 4, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1657 | -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, |
| 1658 | -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, |
| 1659 | -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1660 | -1, 93, -1, 94, -1, 95, -1, 128, -1, 129, |
| 1661 | -1, 130, -1, 131, -1, 132, -1, 133, -1, 134, |
| 1662 | -1, 135, -1, 136, -1, 137, -1, 138, -1, 139, |
| 1663 | -1, 142, -1, 143, -1, 144, -1, 98, -1, 99, |
| 1664 | -1, 100, -1, 101, -1, 102, -1, 103, -1, 104, |
| 1665 | -1, 105, -1, 106, -1, 107, -1, 108, -1, 109, |
| 1666 | -1, 110, -1, 111, -1, 112, -1, 113, -1, 114, |
| 1667 | -1, 115, -1, 116, -1, 117, -1, 118, -1, 119, |
| 1668 | -1, 120, -1, 121, -1, 16, -1, 14, -1, 12, |
| 1669 | -1, 10, -1, 17, -1, 15, -1, 13, -1, 11, |
| 1670 | -1, 175, -1, 176, -1, 18, -1, 19, -1, 211, |
| 1671 | 151, -1, -1, 41, -1, 42, -1, 43, -1, 44, |
| 1672 | -1, 45, -1, 46, -1, 47, -1, -1, -1, 65, |
| 1673 | -1, 66, -1, 67, -1, 68, -1, 69, -1, 70, |
| 1674 | -1, 64, 4, -1, -1, 57, 4, -1, -1, 152, |
| 1675 | 57, 4, -1, 34, 24, -1, -1, 184, -1, -1, |
| 1676 | 152, 187, 186, -1, 184, -1, 57, 4, -1, 190, |
| 1677 | -1, 8, -1, 192, -1, 8, -1, 192, -1, 9, |
| 1678 | -1, 10, -1, 11, -1, 12, -1, 13, -1, 14, |
| 1679 | -1, 15, -1, 16, -1, 17, -1, 18, -1, 19, |
| 1680 | -1, 20, -1, 21, -1, 48, -1, 191, -1, 226, |
| 1681 | -1, 153, 4, -1, 189, 154, 194, 155, -1, 156, |
| 1682 | 4, 157, 192, 158, -1, 159, 4, 157, 192, 160, |
| 1683 | -1, 161, 193, 162, -1, 161, 162, -1, 192, 163, |
| 1684 | -1, 192, -1, 193, 152, 192, -1, 193, -1, 193, |
| 1685 | 152, 37, -1, 37, -1, -1, 190, 156, 197, 158, |
| 1686 | -1, 190, 156, 158, -1, 190, 164, 24, -1, 190, |
| 1687 | 159, 197, 160, -1, 190, 161, 197, 162, -1, 190, |
| 1688 | 161, 162, -1, 190, 38, -1, 190, 39, -1, 190, |
| 1689 | 226, -1, 190, 196, -1, 190, 26, -1, 175, 167, |
| 1690 | -1, 176, 4, -1, 9, 27, -1, 9, 28, -1, |
| 1691 | 178, 7, -1, 171, 154, 195, 36, 190, 155, -1, |
| 1692 | 127, 154, 195, 240, 155, -1, 141, 154, 195, 152, |
| 1693 | 195, 152, 195, 155, -1, 168, 154, 195, 152, 195, |
| 1694 | 155, -1, 169, 154, 195, 152, 195, 155, -1, 170, |
| 1695 | 154, 195, 152, 195, 155, -1, 96, 154, 173, 152, |
| 1696 | 195, 152, 195, 155, -1, 97, 154, 174, 152, 195, |
| 1697 | 152, 195, 155, -1, 172, 154, 195, 152, 195, 155, |
| 1698 | -1, 146, 154, 195, 152, 195, 155, -1, 147, 154, |
| 1699 | 195, 152, 195, 152, 195, 155, -1, 148, 154, 195, |
| 1700 | 152, 195, 152, 195, 155, -1, 197, 152, 195, -1, |
| 1701 | 195, -1, 32, -1, 33, -1, 200, -1, 200, 220, |
| 1702 | -1, 200, 222, -1, 200, 62, 61, 206, -1, 200, |
| 1703 | 25, -1, 201, -1, 201, 179, 20, 188, -1, 201, |
| 1704 | 222, -1, 201, 62, 61, 206, -1, -1, 201, 179, |
| 1705 | 180, 198, 195, 202, 186, -1, -1, 201, 179, 50, |
| 1706 | 198, 190, 203, 186, -1, -1, 201, 179, 45, 198, |
| 1707 | 190, 204, 186, -1, -1, 201, 179, 47, 198, 190, |
| 1708 | 205, 186, -1, 201, 51, 208, -1, 201, 58, 151, |
| 1709 | 209, -1, -1, 24, -1, 56, -1, 55, -1, 53, |
| 1710 | 151, 207, -1, 54, 151, 4, -1, 52, 151, 24, |
| 1711 | -1, 71, 151, 24, -1, 156, 210, 158, -1, 210, |
| 1712 | 152, 24, -1, 24, -1, -1, 22, -1, 24, -1, |
| 1713 | 211, -1, -1, 190, 212, -1, 214, 152, 213, -1, |
| 1714 | 213, -1, 214, -1, 214, 152, 37, -1, 37, -1, |
| 1715 | -1, 181, 188, 211, 154, 215, 155, 185, 182, -1, |
| 1716 | 29, -1, 161, -1, 180, 216, 217, -1, 30, -1, |
| 1717 | 162, -1, 229, 219, -1, -1, 45, -1, 47, -1, |
| 1718 | -1, 31, 223, 221, 216, -1, -1, 63, -1, 3, |
| 1719 | -1, 4, -1, 7, -1, 27, -1, 28, -1, 38, |
| 1720 | -1, 39, -1, 26, -1, 159, 197, 160, -1, 196, |
| 1721 | -1, 61, 224, 24, 152, 24, -1, 166, -1, 211, |
| 1722 | -1, 226, -1, 225, -1, 190, 227, -1, 229, 230, |
| 1723 | -1, 218, 230, -1, 231, 179, 232, -1, 231, 234, |
| 1724 | -1, -1, 23, -1, 72, 228, -1, 72, 8, -1, |
| 1725 | 73, 21, 227, -1, 73, 9, 227, 152, 21, 227, |
| 1726 | 152, 21, 227, -1, 74, 177, 227, 152, 21, 227, |
| 1727 | 156, 233, 158, -1, 74, 177, 227, 152, 21, 227, |
| 1728 | 156, 158, -1, 75, 181, 188, 227, 154, 237, 155, |
| 1729 | 36, 21, 227, 76, 21, 227, -1, 76, -1, 77, |
| 1730 | -1, 233, 177, 225, 152, 21, 227, -1, 177, 225, |
| 1731 | 152, 21, 227, -1, 179, 239, -1, 190, 156, 227, |
| 1732 | 152, 227, 158, -1, 235, 152, 156, 227, 152, 227, |
| 1733 | 158, -1, 228, -1, 236, 152, 228, -1, 236, -1, |
| 1734 | -1, 60, 59, -1, 59, -1, 168, 190, 227, 152, |
| 1735 | 227, -1, 169, 190, 227, 152, 227, -1, 170, 190, |
| 1736 | 227, 152, 227, -1, 96, 173, 190, 227, 152, 227, |
| 1737 | -1, 97, 174, 190, 227, 152, 227, -1, 49, 228, |
| 1738 | -1, 172, 228, 152, 228, -1, 171, 228, 36, 190, |
| 1739 | -1, 141, 228, 152, 228, 152, 228, -1, 145, 228, |
| 1740 | 152, 190, -1, 149, 228, 152, 190, -1, 150, 228, |
| 1741 | 152, 190, -1, 146, 228, 152, 228, -1, 147, 228, |
| 1742 | 152, 228, 152, 228, -1, 148, 228, 152, 228, 152, |
| 1743 | 228, -1, 140, 235, -1, 238, 181, 188, 227, 154, |
| 1744 | 237, 155, -1, 242, -1, 152, 236, -1, -1, 35, |
| 1745 | -1, -1, 122, 190, 183, -1, 122, 190, 152, 15, |
| 1746 | 227, 183, -1, 123, 190, 183, -1, 123, 190, 152, |
| 1747 | 15, 227, 183, -1, 124, 228, -1, 241, 125, 190, |
| 1748 | 227, -1, 241, 126, 228, 152, 190, 227, -1, 127, |
| 1749 | 190, 227, 240, -1 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1750 | }; |
| 1751 | |
| 1752 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1753 | static const unsigned short int yyrline[] = |
| 1754 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1755 | 0, 1105, 1105, 1106, 1114, 1115, 1125, 1125, 1125, 1125, |
| 1756 | 1125, 1125, 1125, 1125, 1125, 1126, 1126, 1126, 1127, 1127, |
| 1757 | 1127, 1127, 1127, 1127, 1128, 1128, 1128, 1128, 1128, 1128, |
| 1758 | 1129, 1129, 1129, 1129, 1129, 1129, 1130, 1130, 1130, 1131, |
| 1759 | 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1132, |
| 1760 | 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1133, 1133, 1133, |
| 1761 | 1133, 1133, 1133, 1137, 1137, 1137, 1137, 1138, 1138, 1138, |
| 1762 | 1138, 1139, 1139, 1140, 1140, 1143, 1147, 1152, 1153, 1154, |
| 1763 | 1155, 1156, 1157, 1158, 1159, 1161, 1162, 1163, 1164, 1165, |
| 1764 | 1166, 1167, 1168, 1177, 1178, 1184, 1185, 1193, 1201, 1202, |
| 1765 | 1207, 1208, 1209, 1214, 1228, 1228, 1229, 1229, 1231, 1241, |
| 1766 | 1241, 1241, 1241, 1241, 1241, 1241, 1242, 1242, 1242, 1242, |
| 1767 | 1242, 1242, 1243, 1247, 1251, 1259, 1267, 1280, 1285, 1297, |
| 1768 | 1307, 1311, 1322, 1327, 1333, 1334, 1338, 1342, 1353, 1379, |
| 1769 | 1393, 1423, 1449, 1470, 1483, 1493, 1498, 1559, 1566, 1574, |
| 1770 | 1580, 1586, 1590, 1594, 1602, 1614, 1646, 1654, 1678, 1689, |
| 1771 | 1695, 1700, 1705, 1714, 1720, 1726, 1735, 1739, 1747, 1747, |
| 1772 | 1757, 1765, 1770, 1774, 1778, 1782, 1797, 1819, 1822, 1825, |
| 1773 | 1825, 1833, 1833, 1841, 1841, 1849, 1849, 1858, 1861, 1864, |
| 1774 | 1868, 1881, 1882, 1884, 1888, 1897, 1901, 1906, 1908, 1913, |
| 1775 | 1918, 1927, 1927, 1928, 1928, 1930, 1937, 1943, 1950, 1954, |
| 1776 | 1960, 1965, 1970, 2065, 2065, 2067, 2075, 2075, 2077, 2082, |
| 1777 | 2083, 2084, 2086, 2086, 2096, 2100, 2105, 2109, 2113, 2117, |
| 1778 | 2121, 2125, 2129, 2133, 2137, 2162, 2166, 2180, 2184, 2190, |
| 1779 | 2190, 2196, 2201, 2205, 2214, 2225, 2234, 2246, 2259, 2263, |
| 1780 | 2267, 2272, 2281, 2300, 2309, 2365, 2369, 2376, 2387, 2400, |
| 1781 | 2409, 2418, 2428, 2432, 2439, 2439, 2441, 2445, 2450, 2469, |
| 1782 | 2484, 2498, 2509, 2520, 2533, 2542, 2553, 2561, 2567, 2587, |
| 1783 | 2610, 2616, 2622, 2628, 2643, 2702, 2709, 2712, 2717, 2721, |
| 1784 | 2728, 2733, 2739, 2744, 2750, 2758, 2770, 2785 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1785 | }; |
| 1786 | #endif |
| 1787 | |
| 1788 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1789 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1790 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1791 | static const char *const yytname[] = |
| 1792 | { |
| 1793 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", |
| 1794 | "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", |
| 1795 | "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", |
| 1796 | "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", |
| 1797 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1798 | "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1799 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", |
| 1800 | "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1801 | "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", |
| 1802 | "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", |
| 1803 | "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", |
| 1804 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1805 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", |
| 1806 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1807 | "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP", |
| 1808 | "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", |
| 1809 | "UGE", "ORDEQ", "ORDNE", "ORDLT", "ORDGT", "ORDLE", "ORDGE", "ORD", |
| 1810 | "UNO", "UNOEQ", "UNONE", "UNOLT", "UNOGT", "UNOLE", "UNOGE", "MALLOC", |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1811 | "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", |
| 1812 | "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", |
| 1813 | "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR", |
| 1814 | "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
| 1815 | "VAARG_old", "VANEXT_old", "'='", "','", "'\\\\'", "'('", "')'", "'['", |
| 1816 | "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", |
| 1817 | "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1818 | "CastOps", "ShiftOps", "IPredicates", "FPredicates", "SIntType", |
| 1819 | "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage", |
| 1820 | "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection", |
| 1821 | "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV", |
| 1822 | "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", |
| 1823 | "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList", |
| 1824 | "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle", |
| 1825 | "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName", |
| 1826 | "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", |
| 1827 | "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto", |
| 1828 | "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1829 | "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", |
| 1830 | "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", |
| 1831 | "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", |
| 1832 | "MemoryInst", 0 |
| 1833 | }; |
| 1834 | #endif |
| 1835 | |
| 1836 | # ifdef YYPRINT |
| 1837 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1838 | token YYLEX-NUM. */ |
| 1839 | static const unsigned short int yytoknum[] = |
| 1840 | { |
| 1841 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1842 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1843 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1844 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1845 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1846 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1847 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1848 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1849 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1850 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1851 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1852 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1853 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1854 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1855 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
| 1856 | 405, 61, 44, 92, 40, 41, 91, 120, 93, 60, |
| 1857 | 62, 123, 125, 42, 99 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1858 | }; |
| 1859 | # endif |
| 1860 | |
| 1861 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1862 | static const unsigned char yyr1[] = |
| 1863 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1864 | 0, 165, 166, 166, 167, 167, 168, 168, 168, 168, |
| 1865 | 168, 168, 168, 168, 168, 169, 169, 169, 170, 170, |
| 1866 | 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, |
| 1867 | 171, 171, 171, 171, 171, 171, 172, 172, 172, 173, |
| 1868 | 173, 173, 173, 173, 173, 173, 173, 173, 173, 174, |
| 1869 | 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, |
| 1870 | 174, 174, 174, 175, 175, 175, 175, 176, 176, 176, |
| 1871 | 176, 177, 177, 178, 178, 179, 179, 180, 180, 180, |
| 1872 | 180, 180, 180, 180, 180, 181, 181, 181, 181, 181, |
| 1873 | 181, 181, 181, 182, 182, 183, 183, 184, 185, 185, |
| 1874 | 186, 186, 187, 187, 188, 188, 189, 189, 190, 191, |
| 1875 | 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, |
| 1876 | 191, 191, 192, 192, 192, 192, 192, 192, 192, 192, |
| 1877 | 192, 192, 193, 193, 194, 194, 194, 194, 195, 195, |
| 1878 | 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, |
| 1879 | 195, 195, 195, 195, 196, 196, 196, 196, 196, 196, |
| 1880 | 196, 196, 196, 196, 196, 196, 197, 197, 198, 198, |
| 1881 | 199, 200, 200, 200, 200, 200, 201, 201, 201, 202, |
| 1882 | 201, 203, 201, 204, 201, 205, 201, 201, 201, 201, |
| 1883 | 206, 207, 207, 208, 208, 208, 208, 209, 210, 210, |
| 1884 | 210, 211, 211, 212, 212, 213, 214, 214, 215, 215, |
| 1885 | 215, 215, 216, 217, 217, 218, 219, 219, 220, 221, |
| 1886 | 221, 221, 223, 222, 224, 224, 225, 225, 225, 225, |
| 1887 | 225, 225, 225, 225, 225, 225, 225, 226, 226, 227, |
| 1888 | 227, 228, 229, 229, 230, 231, 231, 231, 232, 232, |
| 1889 | 232, 232, 232, 232, 232, 232, 232, 233, 233, 234, |
| 1890 | 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, |
| 1891 | 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, |
| 1892 | 239, 239, 239, 239, 239, 239, 240, 240, 241, 241, |
| 1893 | 242, 242, 242, 242, 242, 242, 242, 242 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1894 | }; |
| 1895 | |
| 1896 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1897 | static const unsigned char yyr2[] = |
| 1898 | { |
| 1899 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1900 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1901 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1902 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1903 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1904 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1905 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1906 | 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, |
| 1907 | 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, |
| 1908 | 1, 1, 2, 0, 2, 0, 3, 2, 0, 1, |
| 1909 | 0, 3, 1, 2, 1, 1, 1, 1, 1, 1, |
| 1910 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1911 | 1, 1, 1, 1, 1, 2, 4, 5, 5, 3, |
| 1912 | 2, 2, 1, 3, 1, 3, 1, 0, 4, 3, |
| 1913 | 3, 4, 4, 3, 2, 2, 2, 2, 2, 2, |
| 1914 | 2, 2, 2, 2, 6, 5, 8, 6, 6, 6, |
| 1915 | 8, 8, 6, 6, 8, 8, 3, 1, 1, 1, |
| 1916 | 1, 2, 2, 4, 2, 1, 4, 2, 4, 0, |
| 1917 | 7, 0, 7, 0, 7, 0, 7, 3, 4, 0, |
| 1918 | 1, 1, 1, 3, 3, 3, 3, 3, 3, 1, |
| 1919 | 0, 1, 1, 1, 0, 2, 3, 1, 1, 3, |
| 1920 | 1, 0, 8, 1, 1, 3, 1, 1, 2, 0, |
| 1921 | 1, 1, 0, 4, 0, 1, 1, 1, 1, 1, |
| 1922 | 1, 1, 1, 1, 3, 1, 5, 1, 1, 1, |
| 1923 | 1, 2, 2, 2, 3, 2, 0, 1, 2, 2, |
| 1924 | 3, 9, 9, 8, 13, 1, 1, 6, 5, 2, |
| 1925 | 6, 7, 1, 3, 1, 0, 2, 1, 5, 5, |
| 1926 | 5, 6, 6, 2, 4, 4, 6, 4, 4, 4, |
| 1927 | 4, 6, 6, 2, 7, 1, 2, 0, 1, 0, |
| 1928 | 3, 6, 3, 6, 2, 4, 6, 4 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1929 | }; |
| 1930 | |
| 1931 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1932 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1933 | means the default is an error. */ |
| 1934 | static const unsigned short int yydefact[] = |
| 1935 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1936 | 189, 0, 84, 175, 1, 174, 222, 77, 78, 79, |
| 1937 | 80, 81, 82, 83, 0, 85, 246, 171, 172, 246, |
| 1938 | 201, 202, 0, 0, 0, 84, 0, 177, 219, 0, |
| 1939 | 0, 86, 87, 88, 89, 90, 91, 0, 0, 247, |
| 1940 | 243, 76, 216, 217, 218, 242, 0, 0, 0, 0, |
| 1941 | 187, 0, 0, 0, 0, 0, 0, 0, 75, 220, |
| 1942 | 221, 85, 190, 173, 92, 2, 3, 105, 109, 110, |
| 1943 | 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 1944 | 121, 122, 0, 0, 0, 0, 237, 0, 0, 104, |
| 1945 | 123, 108, 238, 124, 213, 214, 215, 289, 245, 0, |
| 1946 | 0, 0, 0, 200, 188, 178, 176, 168, 169, 0, |
| 1947 | 0, 0, 0, 223, 125, 0, 0, 107, 130, 132, |
| 1948 | 0, 0, 137, 131, 288, 0, 267, 0, 0, 0, |
| 1949 | 0, 85, 255, 256, 6, 7, 8, 9, 10, 11, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1950 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1951 | 22, 23, 0, 0, 0, 0, 0, 0, 24, 25, |
| 1952 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 1953 | 0, 0, 36, 37, 38, 0, 0, 0, 0, 0, |
| 1954 | 0, 0, 0, 0, 0, 0, 244, 85, 259, 0, |
| 1955 | 285, 195, 192, 191, 193, 194, 196, 199, 0, 183, |
| 1956 | 185, 181, 109, 110, 111, 112, 113, 114, 115, 116, |
| 1957 | 117, 118, 119, 0, 0, 0, 0, 179, 0, 0, |
| 1958 | 0, 129, 211, 136, 134, 0, 0, 273, 266, 249, |
| 1959 | 248, 0, 0, 66, 70, 65, 69, 64, 68, 63, |
| 1960 | 67, 71, 72, 0, 0, 39, 40, 41, 42, 43, |
| 1961 | 44, 45, 46, 47, 48, 0, 49, 50, 51, 52, |
| 1962 | 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, |
| 1963 | 0, 95, 95, 294, 0, 0, 283, 0, 0, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1964 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1965 | 0, 0, 0, 197, 100, 100, 100, 151, 152, 4, |
| 1966 | 5, 149, 150, 153, 148, 144, 145, 0, 0, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1967 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 1968 | 0, 0, 0, 147, 146, 100, 106, 106, 133, 210, |
| 1969 | 204, 207, 208, 0, 0, 126, 226, 227, 228, 233, |
| 1970 | 229, 230, 231, 232, 224, 0, 235, 240, 239, 241, |
| 1971 | 0, 250, 0, 0, 0, 0, 0, 290, 0, 292, |
| 1972 | 287, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1973 | 0, 0, 0, 0, 0, 0, 0, 0, 198, 0, |
| 1974 | 184, 186, 182, 0, 0, 0, 0, 0, 0, 0, |
| 1975 | 139, 167, 0, 0, 143, 0, 140, 0, 0, 0, |
| 1976 | 0, 0, 180, 127, 128, 203, 205, 0, 98, 135, |
| 1977 | 225, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1978 | 0, 0, 297, 0, 0, 0, 277, 280, 0, 0, |
| 1979 | 278, 279, 0, 0, 0, 275, 274, 0, 295, 0, |
| 1980 | 0, 0, 102, 100, 0, 0, 287, 0, 0, 0, |
| 1981 | 0, 0, 138, 141, 142, 0, 0, 0, 0, 0, |
| 1982 | 209, 206, 99, 93, 0, 234, 0, 0, 265, 0, |
| 1983 | 0, 95, 96, 95, 262, 286, 0, 0, 0, 0, |
| 1984 | 0, 268, 269, 270, 265, 0, 97, 103, 101, 0, |
| 1985 | 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, |
| 1986 | 0, 0, 0, 212, 0, 0, 0, 264, 0, 271, |
| 1987 | 272, 0, 291, 293, 0, 0, 0, 276, 281, 282, |
| 1988 | 0, 296, 0, 0, 155, 0, 0, 0, 0, 0, |
| 1989 | 0, 0, 0, 0, 94, 236, 0, 0, 0, 263, |
| 1990 | 260, 0, 284, 0, 0, 0, 163, 0, 0, 157, |
| 1991 | 158, 159, 154, 162, 0, 253, 0, 0, 0, 261, |
| 1992 | 0, 0, 0, 0, 0, 251, 0, 252, 0, 0, |
| 1993 | 160, 161, 156, 164, 165, 0, 0, 0, 0, 0, |
| 1994 | 0, 258, 0, 0, 257, 254 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1995 | }; |
| 1996 | |
| 1997 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1998 | static const short int yydefgoto[] = |
| 1999 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2000 | -1, 86, 301, 318, 319, 320, 321, 322, 255, 270, |
| 2001 | 213, 214, 243, 215, 25, 15, 37, 503, 357, 442, |
| 2002 | 463, 380, 443, 87, 88, 216, 90, 91, 120, 225, |
| 2003 | 391, 346, 392, 109, 1, 2, 3, 325, 296, 294, |
| 2004 | 295, 63, 194, 50, 104, 198, 92, 406, 331, 332, |
| 2005 | 333, 38, 96, 16, 44, 17, 61, 18, 28, 411, |
| 2006 | 347, 93, 349, 474, 19, 40, 41, 186, 557, 98, |
| 2007 | 276, 507, 508, 187, 188, 422, 189, 190 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2008 | }; |
| 2009 | |
| 2010 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2011 | STATE-NUM. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2012 | #define YYPACT_NINF -531 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2013 | static const short int yypact[] = |
| 2014 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2015 | -531, 114, 234, 65, -531, -531, -531, -531, -531, -531, |
| 2016 | -531, -531, -531, -531, 74, 132, 47, -531, -531, -13, |
| 2017 | -531, -531, 24, -15, 98, 145, 13, -531, 84, 153, |
| 2018 | 175, -531, -531, -531, -531, -531, -531, 1181, -24, -531, |
| 2019 | -531, 108, -531, -531, -531, -531, 29, 30, 32, 33, |
| 2020 | -531, 26, 153, 1181, 10, 10, 10, 10, -531, -531, |
| 2021 | -531, 132, -531, -531, -531, -531, -531, 50, -531, -531, |
| 2022 | -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, |
| 2023 | -531, -531, 202, 204, 205, 593, -531, 108, 56, -531, |
| 2024 | -531, -70, -531, -531, -531, -531, -531, 1353, -531, 187, |
| 2025 | 70, 209, 190, 192, -531, -531, -531, -531, -531, 1201, |
| 2026 | 1201, 1201, 1242, -531, -531, 62, 63, -531, -531, -70, |
| 2027 | -140, 68, 982, -531, -531, 1201, -531, 164, 1262, 0, |
| 2028 | 273, 132, -531, -531, -531, -531, -531, -531, -531, -531, |
| 2029 | -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, |
| 2030 | -531, -531, 216, 516, 1201, 1201, 1201, 1201, -531, -531, |
| 2031 | -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, |
| 2032 | 1201, 1201, -531, -531, -531, 1201, 1201, 1201, 1201, 1201, |
| 2033 | 1201, 1201, 1201, 1201, 1201, 1201, -531, 132, -531, 31, |
| 2034 | -531, -531, -531, -531, -531, -531, -531, -531, -72, -531, |
| 2035 | -531, -531, 133, 159, 220, 163, 221, 165, 222, 167, |
| 2036 | 223, 225, 228, 172, 224, 229, 433, -531, 1201, 1201, |
| 2037 | 1201, -531, 1023, -531, 85, 83, 684, -531, -531, 50, |
| 2038 | -531, 684, 684, -531, -531, -531, -531, -531, -531, -531, |
| 2039 | -531, -531, -531, 684, 1181, -531, -531, -531, -531, -531, |
| 2040 | -531, -531, -531, -531, -531, 1201, -531, -531, -531, -531, |
| 2041 | -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, |
| 2042 | 1201, 88, 89, -531, 684, 86, 91, 92, 93, 95, |
| 2043 | 99, 103, 104, 106, 684, 684, 684, 226, 109, 1181, |
| 2044 | 1201, 1201, 236, -531, 116, 116, 116, -531, -531, -531, |
| 2045 | -531, -531, -531, -531, -531, -531, -531, 117, 118, 120, |
| 2046 | 143, 144, 148, 154, 927, 1242, 648, 246, 155, 156, |
| 2047 | 157, 170, 171, -531, -531, 116, -59, -39, -70, -531, |
| 2048 | 108, -531, 147, 179, 1084, -531, -531, -531, -531, -531, |
| 2049 | -531, -531, -531, -531, 272, 1242, -531, -531, -531, -531, |
| 2050 | 186, -531, 188, 684, 684, 684, -1, -531, 9, -531, |
| 2051 | 189, 684, 183, 1201, 1201, 1201, 1201, 1201, 1201, 1201, |
| 2052 | 193, 194, 195, 1201, 1201, 684, 684, 196, -531, -19, |
| 2053 | -531, -531, -531, 216, 516, 1242, 1242, 1242, 1242, 1242, |
| 2054 | -531, -531, -30, -60, -531, -83, -531, 1242, 1242, 1242, |
| 2055 | 1242, 1242, -531, -531, -531, -531, -531, 1140, 308, -531, |
| 2056 | -531, 320, -47, 328, 329, 198, 206, 207, 684, 352, |
| 2057 | 684, 1201, -531, 208, 684, 212, -531, -531, 213, 215, |
| 2058 | -531, -531, 684, 684, 684, -531, -531, 214, -531, 1201, |
| 2059 | 345, 367, -531, 116, 230, 231, 189, 233, 235, 237, |
| 2060 | 238, 1242, -531, -531, -531, 239, 240, 241, 336, 242, |
| 2061 | -531, -531, -531, 316, 254, -531, 684, 684, 1201, 684, |
| 2062 | 684, 258, -531, 258, -531, 259, 684, 260, 1201, 1201, |
| 2063 | 1201, -531, -531, -531, 1201, 684, -531, -531, -531, 1242, |
| 2064 | 1242, 219, 1242, 1242, 1242, 1242, -531, 1242, 1242, 1242, |
| 2065 | 1201, 1242, 372, -531, 353, 261, 232, 259, 262, -531, |
| 2066 | -531, 321, -531, -531, 1201, 256, 684, -531, -531, -531, |
| 2067 | 263, -531, 264, 267, -531, 268, 266, 274, 275, 270, |
| 2068 | 277, 278, 279, 280, -531, -531, 360, 20, 350, -531, |
| 2069 | -531, 257, -531, 1242, 1242, 1242, -531, 1242, 1242, -531, |
| 2070 | -531, -531, -531, -531, 684, -531, 830, 35, 415, -531, |
| 2071 | 282, 285, 291, 293, 297, -531, 304, -531, 830, 684, |
| 2072 | -531, -531, -531, -531, -531, 437, 309, 384, 684, 441, |
| 2073 | 443, -531, 684, 684, -531, -531 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2074 | }; |
| 2075 | |
| 2076 | /* YYPGOTO[NTERM-NUM]. */ |
| 2077 | static const short int yypgoto[] = |
| 2078 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2079 | -531, -531, -531, 368, 369, 370, 371, 373, 90, 94, |
| 2080 | -129, -128, -530, -531, 428, 449, -112, -531, -268, 67, |
| 2081 | -531, -231, -531, -50, -531, -37, -531, -65, 354, -531, |
| 2082 | -94, 265, -290, 46, -531, -531, -531, -531, -531, -531, |
| 2083 | -531, 427, -531, -531, -531, -531, 3, -531, 73, -531, |
| 2084 | -531, 421, -531, -531, -531, -531, -531, 480, -531, -531, |
| 2085 | -515, -203, 69, -117, -531, 465, -531, -531, -531, -531, |
| 2086 | -531, 64, 2, -531, -531, 42, -531, -531 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2087 | }; |
| 2088 | |
| 2089 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2090 | positive, shift that token. If negative, reduce the rule which |
| 2091 | number is the opposite. If zero, do what YYDEFACT says. |
| 2092 | If YYTABLE_NINF, syntax error. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2093 | #define YYTABLE_NINF -171 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2094 | static const short int yytable[] = |
| 2095 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2096 | 89, 241, 242, 106, 359, 94, 26, 556, 227, 231, |
| 2097 | 39, 230, 220, 324, 418, 440, 89, 42, 217, 244, |
| 2098 | 119, 232, 221, 348, 420, 393, 395, 568, 348, 348, |
| 2099 | 233, 234, 235, 236, 237, 238, 239, 240, 441, 273, |
| 2100 | 348, 566, 107, 108, 26, 233, 234, 235, 236, 237, |
| 2101 | 238, 239, 240, 576, 277, 412, 419, 119, 278, 279, |
| 2102 | 280, 281, 282, 283, 381, 382, 419, 287, 288, 451, |
| 2103 | 39, 348, 199, 200, 201, 289, 46, 47, 48, 454, |
| 2104 | 292, 348, 348, 348, -106, -76, 293, 20, 226, 21, |
| 2105 | 121, 226, 451, 123, 402, 49, 6, -76, -76, 403, |
| 2106 | 453, 110, 111, 112, 123, 451, -76, -76, -76, -76, |
| 2107 | -76, -76, -76, 465, 4, -76, 22, 271, 272, 226, |
| 2108 | 274, 404, 451, 23, 123, 192, 193, 24, 452, 59, |
| 2109 | 20, 60, 21, 275, 226, 29, 51, 95, 226, 226, |
| 2110 | 226, 226, 226, 226, 284, 285, 286, 226, 226, 43, |
| 2111 | 348, 348, 348, 326, 327, 328, 290, 291, 348, 52, |
| 2112 | 297, 298, -66, -66, 58, 53, -65, -65, -64, -64, |
| 2113 | -63, -63, 348, 348, 377, 299, 300, 62, 555, 64, |
| 2114 | 99, 100, 103, 101, 102, 330, 7, 8, 9, 10, |
| 2115 | 54, 12, 55, 567, 353, 56, 30, 31, 32, 33, |
| 2116 | 34, 35, 36, 512, -107, 513, 114, 89, 115, 116, |
| 2117 | 122, 191, 488, 195, 196, 348, 197, 348, 354, 218, |
| 2118 | 219, 348, 222, 228, -70, -69, -68, -67, 302, 348, |
| 2119 | 348, 348, -73, 355, -170, -74, 303, 334, 335, 375, |
| 2120 | 356, 358, 361, 362, 363, 364, 425, 365, 427, 428, |
| 2121 | 429, 366, 89, 376, 226, 367, 368, 436, 369, 5, |
| 2122 | 378, 374, 373, 348, 348, 6, 348, 348, 379, 328, |
| 2123 | 396, 383, 384, 348, 385, 7, 8, 9, 10, 11, |
| 2124 | 12, 13, 348, 233, 234, 235, 236, 237, 238, 239, |
| 2125 | 240, 446, 447, 448, 449, 450, 14, 386, 387, 407, |
| 2126 | 350, 351, 388, 455, 456, 457, 458, 459, 389, 397, |
| 2127 | 398, 399, 352, 348, 245, 246, 247, 248, 249, 250, |
| 2128 | 251, 252, 253, 254, 400, 401, 226, 426, 226, 226, |
| 2129 | 226, 430, 431, 405, 408, 410, 435, 226, 413, 424, |
| 2130 | 414, 421, 440, 360, 464, 432, 433, 434, 439, 466, |
| 2131 | 467, 348, 468, 370, 371, 372, 472, 496, 469, 470, |
| 2132 | 476, 517, 518, 519, 478, 479, 348, 480, 484, 486, |
| 2133 | 330, 487, 500, 502, 524, 348, 534, 535, 419, 348, |
| 2134 | 348, 554, 489, 490, 226, 492, 558, 493, 537, 494, |
| 2135 | 495, 497, 498, 499, 501, 522, 523, 539, 525, 526, |
| 2136 | 527, 528, 485, 529, 530, 531, 504, 533, 241, 242, |
| 2137 | 511, 514, 516, 536, 540, 559, 543, 538, 542, 544, |
| 2138 | 545, 546, 415, 416, 417, 549, 547, 548, 241, 242, |
| 2139 | 423, 226, 550, 551, 552, 553, 569, 570, 65, 66, |
| 2140 | 571, 226, 226, 226, 437, 438, 572, 226, 573, 560, |
| 2141 | 561, 562, 574, 563, 564, 20, 575, 21, 578, 304, |
| 2142 | 580, 579, 582, 532, 583, 181, 182, 183, 184, 97, |
| 2143 | 185, 305, 306, 444, 57, 462, 224, 226, 445, 105, |
| 2144 | 461, 323, 113, 27, 45, 475, 520, 471, 491, 473, |
| 2145 | 0, 0, 0, 477, 0, 0, 0, 0, 0, 0, |
| 2146 | 0, 481, 482, 483, 0, 0, 0, 0, 0, 0, |
| 2147 | 0, 134, 135, 136, 137, 138, 139, 140, 141, 142, |
| 2148 | 143, 144, 145, 146, 147, 148, 149, 150, 151, 307, |
| 2149 | 308, 0, 0, 0, 0, 505, 506, 0, 509, 510, |
| 2150 | 0, 0, 0, 0, 0, 515, 0, 0, 0, 0, |
| 2151 | 0, 0, 0, 0, 521, 0, 0, 0, 0, 0, |
| 2152 | 309, 158, 159, 160, 161, 162, 163, 164, 165, 166, |
| 2153 | 167, 168, 169, 0, 310, 172, 173, 174, 0, 311, |
| 2154 | 312, 313, 0, 0, 0, 541, 0, 0, 0, 314, |
| 2155 | 0, 0, 315, 0, 316, 0, 0, 317, 65, 66, |
| 2156 | 0, 117, 68, 69, 70, 71, 72, 73, 74, 75, |
| 2157 | 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, |
| 2158 | 0, 0, 0, 565, 256, 257, 258, 259, 260, 261, |
| 2159 | 262, 263, 264, 265, 266, 267, 268, 269, 577, 0, |
| 2160 | 0, 81, 0, 0, 0, 0, 0, 581, 0, 0, |
| 2161 | 0, 584, 585, 65, 66, 0, 117, 202, 203, 204, |
| 2162 | 205, 206, 207, 208, 209, 210, 211, 212, 79, 80, |
| 2163 | 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, |
| 2164 | 0, 0, 0, 0, 0, 0, 0, 336, 337, 65, |
| 2165 | 66, 338, 0, 0, 0, 0, 81, 0, 0, 0, |
| 2166 | 0, 0, 0, 0, 0, 0, 20, 0, 21, 0, |
| 2167 | 339, 340, 341, 0, 0, 0, 0, 0, 0, 0, |
| 2168 | 0, 0, 342, 343, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2169 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2170 | 0, 0, 0, 0, 0, 344, 82, 0, 0, 83, |
| 2171 | 0, 0, 84, 0, 85, 118, 0, 0, 0, 0, |
| 2172 | 0, 0, 134, 135, 136, 137, 138, 139, 140, 141, |
| 2173 | 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, |
| 2174 | 307, 308, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2175 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2176 | 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, |
| 2177 | 394, 309, 158, 159, 160, 161, 162, 163, 164, 165, |
| 2178 | 166, 167, 168, 169, 0, 310, 172, 173, 174, 0, |
| 2179 | 311, 312, 313, 336, 337, 0, 0, 338, 0, 0, |
| 2180 | 0, 0, 0, 345, 0, 0, 0, 0, 0, 0, |
| 2181 | 0, 0, 0, 0, 0, 0, 339, 340, 341, 0, |
| 2182 | 0, 0, 0, 0, 0, 0, 0, 0, 342, 343, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2183 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2184 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2185 | 0, 344, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2186 | 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, |
| 2187 | 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, |
| 2188 | 146, 147, 148, 149, 150, 151, 307, 308, 0, 0, |
| 2189 | 0, 0, 65, 66, 0, 117, 202, 203, 204, 205, |
| 2190 | 206, 207, 208, 209, 210, 211, 212, 79, 80, 20, |
| 2191 | 0, 21, 0, 0, 0, 0, 0, 309, 158, 159, |
| 2192 | 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, |
| 2193 | 0, 310, 172, 173, 174, 81, 311, 312, 313, 0, |
| 2194 | 0, 0, 0, 0, 0, 0, 0, 65, 66, 345, |
| 2195 | 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2196 | 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, |
| 2197 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, |
| 2198 | 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, |
| 2199 | 81, 117, 68, 69, 70, 71, 72, 73, 74, 75, |
| 2200 | 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2201 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2202 | 329, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2203 | 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2204 | 82, 0, 0, 83, 0, 390, 84, 0, 85, 65, |
| 2205 | 66, 0, 117, 68, 69, 70, 71, 72, 73, 74, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2206 | 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, |
| 2207 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2208 | 0, 409, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2209 | 0, 0, 81, 0, 0, 82, 0, 0, 83, 0, |
| 2210 | 0, 84, 0, 85, 0, 65, 66, 0, 117, 68, |
| 2211 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2212 | 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, |
| 2213 | 0, 0, 0, 0, 0, 0, 82, 460, 0, 83, |
| 2214 | 0, 0, 84, 0, 85, 0, 65, 66, 81, 67, |
| 2215 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2216 | 78, 79, 80, 20, 0, 21, 65, 66, 0, 117, |
| 2217 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2218 | 78, 79, 80, 20, 0, 21, 0, 0, 0, 81, |
| 2219 | 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, |
| 2220 | 83, 0, 0, 84, 0, 85, 0, 65, 66, 81, |
| 2221 | 117, 202, 203, 204, 205, 206, 207, 208, 209, 210, |
| 2222 | 211, 212, 79, 80, 20, 0, 21, 65, 66, 0, |
| 2223 | 229, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2224 | 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, |
| 2225 | 81, 0, 0, 82, 0, 0, 83, 0, 0, 84, |
| 2226 | 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2227 | 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2228 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2229 | 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, |
| 2230 | 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2231 | 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, |
| 2232 | 84, 0, 85, 0, 0, 0, 0, 0, 0, 0, |
| 2233 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2234 | 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, |
| 2235 | 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, |
| 2236 | 0, 84, 125, 85, 0, 0, 0, 0, 0, 0, |
| 2237 | 0, 0, 126, 127, 0, 82, 0, 0, 83, 0, |
| 2238 | 0, 84, 0, 85, 0, 128, 129, 130, 131, 132, |
| 2239 | 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, |
| 2240 | 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, |
| 2241 | 153, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2242 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2243 | 0, 0, 0, 0, 0, 154, 155, 156, 0, 0, |
| 2244 | 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, |
| 2245 | 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, |
| 2246 | 177, 178, 179, 180 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2247 | }; |
| 2248 | |
| 2249 | static const short int yycheck[] = |
| 2250 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2251 | 37, 130, 130, 53, 272, 29, 3, 537, 125, 9, |
| 2252 | 23, 128, 152, 216, 15, 34, 53, 30, 112, 131, |
| 2253 | 85, 21, 162, 226, 15, 315, 316, 557, 231, 232, |
| 2254 | 10, 11, 12, 13, 14, 15, 16, 17, 57, 156, |
| 2255 | 243, 556, 32, 33, 41, 10, 11, 12, 13, 14, |
| 2256 | 15, 16, 17, 568, 171, 345, 57, 122, 175, 176, |
| 2257 | 177, 178, 179, 180, 295, 296, 57, 184, 185, 152, |
| 2258 | 23, 274, 109, 110, 111, 187, 52, 53, 54, 162, |
| 2259 | 152, 284, 285, 286, 154, 20, 158, 22, 125, 24, |
| 2260 | 87, 128, 152, 163, 325, 71, 31, 32, 33, 158, |
| 2261 | 160, 55, 56, 57, 163, 152, 41, 42, 43, 44, |
| 2262 | 45, 46, 47, 160, 0, 50, 51, 154, 155, 156, |
| 2263 | 157, 160, 152, 58, 163, 55, 56, 62, 158, 45, |
| 2264 | 22, 47, 24, 170, 171, 61, 151, 161, 175, 176, |
| 2265 | 177, 178, 179, 180, 181, 182, 183, 184, 185, 162, |
| 2266 | 353, 354, 355, 218, 219, 220, 125, 126, 361, 61, |
| 2267 | 27, 28, 3, 4, 151, 20, 3, 4, 3, 4, |
| 2268 | 3, 4, 375, 376, 291, 3, 4, 24, 158, 4, |
| 2269 | 151, 151, 156, 151, 151, 222, 41, 42, 43, 44, |
| 2270 | 45, 46, 47, 158, 244, 50, 64, 65, 66, 67, |
| 2271 | 68, 69, 70, 471, 154, 473, 4, 244, 4, 4, |
| 2272 | 154, 24, 443, 4, 24, 418, 24, 420, 255, 157, |
| 2273 | 157, 424, 154, 59, 4, 4, 4, 4, 4, 432, |
| 2274 | 433, 434, 7, 270, 0, 7, 7, 152, 155, 289, |
| 2275 | 152, 152, 156, 152, 152, 152, 363, 152, 365, 366, |
| 2276 | 367, 152, 289, 290, 291, 152, 152, 374, 152, 25, |
| 2277 | 24, 152, 36, 466, 467, 31, 469, 470, 152, 334, |
| 2278 | 24, 154, 154, 476, 154, 41, 42, 43, 44, 45, |
| 2279 | 46, 47, 485, 10, 11, 12, 13, 14, 15, 16, |
| 2280 | 17, 385, 386, 387, 388, 389, 62, 154, 154, 152, |
| 2281 | 231, 232, 154, 397, 398, 399, 400, 401, 154, 154, |
| 2282 | 154, 154, 243, 516, 98, 99, 100, 101, 102, 103, |
| 2283 | 104, 105, 106, 107, 154, 154, 363, 364, 365, 366, |
| 2284 | 367, 368, 369, 330, 155, 63, 373, 374, 152, 156, |
| 2285 | 152, 152, 34, 274, 24, 152, 152, 152, 152, 21, |
| 2286 | 21, 554, 154, 284, 285, 286, 4, 451, 152, 152, |
| 2287 | 152, 478, 479, 480, 152, 152, 569, 152, 154, 24, |
| 2288 | 407, 4, 36, 57, 155, 578, 4, 24, 57, 582, |
| 2289 | 583, 21, 152, 152, 421, 152, 36, 152, 156, 152, |
| 2290 | 152, 152, 152, 152, 152, 489, 490, 514, 492, 493, |
| 2291 | 494, 495, 439, 497, 498, 499, 152, 501, 537, 537, |
| 2292 | 152, 152, 152, 152, 158, 158, 152, 155, 155, 152, |
| 2293 | 152, 155, 353, 354, 355, 155, 152, 152, 557, 557, |
| 2294 | 361, 468, 155, 155, 155, 155, 21, 155, 5, 6, |
| 2295 | 155, 478, 479, 480, 375, 376, 155, 484, 155, 543, |
| 2296 | 544, 545, 155, 547, 548, 22, 152, 24, 21, 26, |
| 2297 | 76, 152, 21, 500, 21, 97, 97, 97, 97, 41, |
| 2298 | 97, 38, 39, 383, 25, 408, 122, 514, 384, 52, |
| 2299 | 407, 216, 61, 3, 19, 421, 484, 418, 446, 420, |
| 2300 | -1, -1, -1, 424, -1, -1, -1, -1, -1, -1, |
| 2301 | -1, 432, 433, 434, -1, -1, -1, -1, -1, -1, |
| 2302 | -1, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2303 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 2304 | 97, -1, -1, -1, -1, 466, 467, -1, 469, 470, |
| 2305 | -1, -1, -1, -1, -1, 476, -1, -1, -1, -1, |
| 2306 | -1, -1, -1, -1, 485, -1, -1, -1, -1, -1, |
| 2307 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
| 2308 | 137, 138, 139, -1, 141, 142, 143, 144, -1, 146, |
| 2309 | 147, 148, -1, -1, -1, 516, -1, -1, -1, 156, |
| 2310 | -1, -1, 159, -1, 161, -1, -1, 164, 5, 6, |
| 2311 | -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2312 | 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, |
| 2313 | -1, -1, -1, 554, 108, 109, 110, 111, 112, 113, |
| 2314 | 114, 115, 116, 117, 118, 119, 120, 121, 569, -1, |
| 2315 | -1, 48, -1, -1, -1, -1, -1, 578, -1, -1, |
| 2316 | -1, 582, 583, 5, 6, -1, 8, 9, 10, 11, |
| 2317 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 2318 | 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2319 | -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, |
| 2320 | 6, 7, -1, -1, -1, -1, 48, -1, -1, -1, |
| 2321 | -1, -1, -1, -1, -1, -1, 22, -1, 24, -1, |
| 2322 | 26, 27, 28, -1, -1, -1, -1, -1, -1, -1, |
| 2323 | -1, -1, 38, 39, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2324 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2325 | -1, -1, -1, -1, -1, 61, 153, -1, -1, 156, |
| 2326 | -1, -1, 159, -1, 161, 162, -1, -1, -1, -1, |
| 2327 | -1, -1, 78, 79, 80, 81, 82, 83, 84, 85, |
| 2328 | 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, |
| 2329 | 96, 97, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2330 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2331 | -1, 153, -1, -1, 156, -1, -1, 159, -1, 161, |
| 2332 | 162, 127, 128, 129, 130, 131, 132, 133, 134, 135, |
| 2333 | 136, 137, 138, 139, -1, 141, 142, 143, 144, -1, |
| 2334 | 146, 147, 148, 3, 4, -1, -1, 7, -1, -1, |
| 2335 | -1, -1, -1, 159, -1, -1, -1, -1, -1, -1, |
| 2336 | -1, -1, -1, -1, -1, -1, 26, 27, 28, -1, |
| 2337 | -1, -1, -1, -1, -1, -1, -1, -1, 38, 39, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2338 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2339 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2340 | -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2341 | -1, -1, -1, -1, -1, -1, -1, -1, 78, 79, |
| 2342 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2343 | 90, 91, 92, 93, 94, 95, 96, 97, -1, -1, |
| 2344 | -1, -1, 5, 6, -1, 8, 9, 10, 11, 12, |
| 2345 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
| 2346 | -1, 24, -1, -1, -1, -1, -1, 127, 128, 129, |
| 2347 | 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, |
| 2348 | -1, 141, 142, 143, 144, 48, 146, 147, 148, -1, |
| 2349 | -1, -1, -1, -1, -1, -1, -1, 5, 6, 159, |
| 2350 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2351 | 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, |
| 2352 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, |
| 2353 | -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, |
| 2354 | 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2355 | 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2356 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2357 | 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2358 | -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2359 | 153, -1, -1, 156, -1, 158, 159, -1, 161, 5, |
| 2360 | 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2361 | 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, |
| 2362 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2363 | -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2364 | -1, -1, 48, -1, -1, 153, -1, -1, 156, -1, |
| 2365 | -1, 159, -1, 161, -1, 5, 6, -1, 8, 9, |
| 2366 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
| 2367 | 20, 21, 22, -1, 24, -1, -1, -1, -1, -1, |
| 2368 | -1, -1, -1, -1, -1, -1, 153, 37, -1, 156, |
| 2369 | -1, -1, 159, -1, 161, -1, 5, 6, 48, 8, |
| 2370 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2371 | 19, 20, 21, 22, -1, 24, 5, 6, -1, 8, |
| 2372 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2373 | 19, 20, 21, 22, -1, 24, -1, -1, -1, 48, |
| 2374 | -1, -1, -1, -1, -1, -1, -1, 153, -1, -1, |
| 2375 | 156, -1, -1, 159, -1, 161, -1, 5, 6, 48, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2376 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2377 | 18, 19, 20, 21, 22, -1, 24, 5, 6, -1, |
| 2378 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2379 | 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, |
| 2380 | 48, -1, -1, 153, -1, -1, 156, -1, -1, 159, |
| 2381 | -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2382 | 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2383 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2384 | -1, -1, -1, -1, 153, -1, -1, 156, -1, -1, |
| 2385 | 159, -1, 161, -1, -1, -1, -1, -1, -1, -1, |
| 2386 | -1, -1, -1, -1, 153, -1, -1, 156, -1, -1, |
| 2387 | 159, -1, 161, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2388 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2389 | -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, |
| 2390 | -1, -1, -1, -1, -1, 153, -1, -1, 156, -1, |
| 2391 | -1, 159, 49, 161, -1, -1, -1, -1, -1, -1, |
| 2392 | -1, -1, 59, 60, -1, 153, -1, -1, 156, -1, |
| 2393 | -1, 159, -1, 161, -1, 72, 73, 74, 75, 76, |
| 2394 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2395 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 2396 | 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2397 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2398 | -1, -1, -1, -1, -1, 122, 123, 124, -1, -1, |
| 2399 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
| 2400 | 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, |
| 2401 | 147, 148, 149, 150 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2402 | }; |
| 2403 | |
| 2404 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2405 | symbol of state STATE-NUM. */ |
| 2406 | static const unsigned char yystos[] = |
| 2407 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2408 | 0, 199, 200, 201, 0, 25, 31, 41, 42, 43, |
| 2409 | 44, 45, 46, 47, 62, 180, 218, 220, 222, 229, |
| 2410 | 22, 24, 51, 58, 62, 179, 211, 222, 223, 61, |
| 2411 | 64, 65, 66, 67, 68, 69, 70, 181, 216, 23, |
| 2412 | 230, 231, 30, 162, 219, 230, 52, 53, 54, 71, |
| 2413 | 208, 151, 61, 20, 45, 47, 50, 180, 151, 45, |
| 2414 | 47, 221, 24, 206, 4, 5, 6, 8, 9, 10, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2415 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2416 | 21, 48, 153, 156, 159, 161, 166, 188, 189, 190, |
| 2417 | 191, 192, 211, 226, 29, 161, 217, 179, 234, 151, |
| 2418 | 151, 151, 151, 156, 209, 206, 188, 32, 33, 198, |
| 2419 | 198, 198, 198, 216, 4, 4, 4, 8, 162, 192, |
| 2420 | 193, 211, 154, 163, 35, 49, 59, 60, 72, 73, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2421 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2422 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 2423 | 94, 95, 96, 97, 122, 123, 124, 127, 128, 129, |
| 2424 | 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, |
| 2425 | 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, |
| 2426 | 150, 168, 169, 170, 171, 172, 232, 238, 239, 241, |
| 2427 | 242, 24, 55, 56, 207, 4, 24, 24, 210, 190, |
| 2428 | 190, 190, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2429 | 17, 18, 19, 175, 176, 178, 190, 195, 157, 157, |
| 2430 | 152, 162, 154, 37, 193, 194, 190, 228, 59, 8, |
| 2431 | 228, 9, 21, 10, 11, 12, 13, 14, 15, 16, |
| 2432 | 17, 175, 176, 177, 181, 98, 99, 100, 101, 102, |
| 2433 | 103, 104, 105, 106, 107, 173, 108, 109, 110, 111, |
| 2434 | 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, |
| 2435 | 174, 190, 190, 228, 190, 190, 235, 228, 228, 228, |
| 2436 | 228, 228, 228, 228, 190, 190, 190, 228, 228, 181, |
| 2437 | 125, 126, 152, 158, 204, 205, 203, 27, 28, 3, |
| 2438 | 4, 167, 4, 7, 26, 38, 39, 96, 97, 127, |
| 2439 | 141, 146, 147, 148, 156, 159, 161, 164, 168, 169, |
| 2440 | 170, 171, 172, 196, 226, 202, 192, 192, 192, 37, |
| 2441 | 190, 213, 214, 215, 152, 155, 3, 4, 7, 26, |
| 2442 | 27, 28, 38, 39, 61, 159, 196, 225, 226, 227, |
| 2443 | 227, 227, 227, 188, 190, 190, 152, 183, 152, 183, |
| 2444 | 227, 156, 152, 152, 152, 152, 152, 152, 152, 152, |
| 2445 | 227, 227, 227, 36, 152, 188, 190, 228, 24, 152, |
| 2446 | 186, 186, 186, 154, 154, 154, 154, 154, 154, 154, |
| 2447 | 158, 195, 197, 197, 162, 197, 24, 154, 154, 154, |
| 2448 | 154, 154, 186, 158, 160, 211, 212, 152, 155, 37, |
| 2449 | 63, 224, 197, 152, 152, 227, 227, 227, 15, 57, |
| 2450 | 15, 152, 240, 227, 156, 228, 190, 228, 228, 228, |
| 2451 | 190, 190, 152, 152, 152, 190, 228, 227, 227, 152, |
| 2452 | 34, 57, 184, 187, 173, 174, 195, 195, 195, 195, |
| 2453 | 195, 152, 158, 160, 162, 195, 195, 195, 195, 195, |
| 2454 | 37, 213, 184, 185, 24, 160, 21, 21, 154, 152, |
| 2455 | 152, 227, 4, 227, 228, 236, 152, 227, 152, 152, |
| 2456 | 152, 227, 227, 227, 154, 190, 24, 4, 186, 152, |
| 2457 | 152, 240, 152, 152, 152, 152, 195, 152, 152, 152, |
| 2458 | 36, 152, 57, 182, 152, 227, 227, 236, 237, 227, |
| 2459 | 227, 152, 183, 183, 152, 227, 152, 228, 228, 228, |
| 2460 | 237, 227, 195, 195, 155, 195, 195, 195, 195, 195, |
| 2461 | 195, 195, 190, 195, 4, 24, 152, 156, 155, 228, |
| 2462 | 158, 227, 155, 152, 152, 152, 155, 152, 152, 155, |
| 2463 | 155, 155, 155, 155, 21, 158, 177, 233, 36, 158, |
| 2464 | 195, 195, 195, 195, 195, 227, 225, 158, 177, 21, |
| 2465 | 155, 155, 155, 155, 155, 152, 225, 227, 21, 152, |
| 2466 | 76, 227, 21, 21, 227, 227 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2467 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2468 | |
| 2469 | #define yyerrok (yyerrstatus = 0) |
| 2470 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2471 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2472 | #define YYEOF 0 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2473 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2474 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2475 | #define YYABORT goto yyabortlab |
| 2476 | #define YYERROR goto yyerrorlab |
| 2477 | |
| 2478 | |
| 2479 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2480 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2481 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2482 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2483 | #define YYFAIL goto yyerrlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2484 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2485 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2486 | |
| 2487 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2488 | do \ |
| 2489 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2490 | { \ |
| 2491 | yychar = (Token); \ |
| 2492 | yylval = (Value); \ |
| 2493 | yytoken = YYTRANSLATE (yychar); \ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2494 | YYPOPSTACK; \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2495 | goto yybackup; \ |
| 2496 | } \ |
| 2497 | else \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2498 | { \ |
| 2499 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2500 | YYERROR; \ |
| 2501 | } \ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2502 | while (0) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2503 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2504 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2505 | #define YYTERROR 1 |
| 2506 | #define YYERRCODE 256 |
| 2507 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2508 | |
| 2509 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2510 | If N is 0, then set CURRENT to the empty location which ends |
| 2511 | the previous symbol: RHS[0] (always defined). */ |
| 2512 | |
| 2513 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2514 | #ifndef YYLLOC_DEFAULT |
| 2515 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2516 | do \ |
| 2517 | if (N) \ |
| 2518 | { \ |
| 2519 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2520 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2521 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2522 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2523 | } \ |
| 2524 | else \ |
| 2525 | { \ |
| 2526 | (Current).first_line = (Current).last_line = \ |
| 2527 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2528 | (Current).first_column = (Current).last_column = \ |
| 2529 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2530 | } \ |
| 2531 | while (0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2532 | #endif |
| 2533 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2534 | |
| 2535 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2536 | This macro was not mandated originally: define only if we know |
| 2537 | we won't break user code: when these are the locations we know. */ |
| 2538 | |
| 2539 | #ifndef YY_LOCATION_PRINT |
| 2540 | # if YYLTYPE_IS_TRIVIAL |
| 2541 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2542 | fprintf (File, "%d.%d-%d.%d", \ |
| 2543 | (Loc).first_line, (Loc).first_column, \ |
| 2544 | (Loc).last_line, (Loc).last_column) |
| 2545 | # else |
| 2546 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2547 | # endif |
| 2548 | #endif |
| 2549 | |
| 2550 | |
| 2551 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2552 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2553 | #ifdef YYLEX_PARAM |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2554 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2555 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2556 | # define YYLEX yylex () |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2557 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2558 | |
| 2559 | /* Enable debugging if requested. */ |
| 2560 | #if YYDEBUG |
| 2561 | |
| 2562 | # ifndef YYFPRINTF |
| 2563 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2564 | # define YYFPRINTF fprintf |
| 2565 | # endif |
| 2566 | |
| 2567 | # define YYDPRINTF(Args) \ |
| 2568 | do { \ |
| 2569 | if (yydebug) \ |
| 2570 | YYFPRINTF Args; \ |
| 2571 | } while (0) |
| 2572 | |
| 2573 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2574 | do { \ |
| 2575 | if (yydebug) \ |
| 2576 | { \ |
| 2577 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2578 | yysymprint (stderr, \ |
| 2579 | Type, Value); \ |
| 2580 | YYFPRINTF (stderr, "\n"); \ |
| 2581 | } \ |
| 2582 | } while (0) |
| 2583 | |
| 2584 | /*------------------------------------------------------------------. |
| 2585 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2586 | | TOP (included). | |
| 2587 | `------------------------------------------------------------------*/ |
| 2588 | |
| 2589 | #if defined (__STDC__) || defined (__cplusplus) |
| 2590 | static void |
| 2591 | yy_stack_print (short int *bottom, short int *top) |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2592 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2593 | static void |
| 2594 | yy_stack_print (bottom, top) |
| 2595 | short int *bottom; |
| 2596 | short int *top; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2597 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2598 | { |
| 2599 | YYFPRINTF (stderr, "Stack now"); |
| 2600 | for (/* Nothing. */; bottom <= top; ++bottom) |
| 2601 | YYFPRINTF (stderr, " %d", *bottom); |
| 2602 | YYFPRINTF (stderr, "\n"); |
| 2603 | } |
| 2604 | |
| 2605 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2606 | do { \ |
| 2607 | if (yydebug) \ |
| 2608 | yy_stack_print ((Bottom), (Top)); \ |
| 2609 | } while (0) |
| 2610 | |
| 2611 | |
| 2612 | /*------------------------------------------------. |
| 2613 | | Report that the YYRULE is going to be reduced. | |
| 2614 | `------------------------------------------------*/ |
| 2615 | |
| 2616 | #if defined (__STDC__) || defined (__cplusplus) |
| 2617 | static void |
| 2618 | yy_reduce_print (int yyrule) |
| 2619 | #else |
| 2620 | static void |
| 2621 | yy_reduce_print (yyrule) |
| 2622 | int yyrule; |
Chris Lattner | 1ae022f | 2006-10-22 06:08:13 +0000 | [diff] [blame] | 2623 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2624 | { |
| 2625 | int yyi; |
| 2626 | unsigned long int yylno = yyrline[yyrule]; |
| 2627 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
| 2628 | yyrule - 1, yylno); |
| 2629 | /* Print the symbols being reduced, and their result. */ |
| 2630 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
| 2631 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 2632 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
| 2633 | } |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2634 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2635 | # define YY_REDUCE_PRINT(Rule) \ |
| 2636 | do { \ |
| 2637 | if (yydebug) \ |
| 2638 | yy_reduce_print (Rule); \ |
| 2639 | } while (0) |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2640 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2641 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2642 | multiple parsers can coexist. */ |
| 2643 | int yydebug; |
| 2644 | #else /* !YYDEBUG */ |
| 2645 | # define YYDPRINTF(Args) |
| 2646 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2647 | # define YY_STACK_PRINT(Bottom, Top) |
| 2648 | # define YY_REDUCE_PRINT(Rule) |
| 2649 | #endif /* !YYDEBUG */ |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2650 | |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2651 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2652 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2653 | #ifndef YYINITDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2654 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2655 | #endif |
| 2656 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2657 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2658 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2659 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2660 | Do not make this value too large; the results are undefined if |
| 2661 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2662 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2663 | |
| 2664 | #ifndef YYMAXDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2665 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2666 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2667 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2668 | |
| 2669 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2670 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2671 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2672 | # ifndef yystrlen |
| 2673 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 2674 | # define yystrlen strlen |
| 2675 | # else |
| 2676 | /* Return the length of YYSTR. */ |
| 2677 | static YYSIZE_T |
| 2678 | # if defined (__STDC__) || defined (__cplusplus) |
| 2679 | yystrlen (const char *yystr) |
| 2680 | # else |
| 2681 | yystrlen (yystr) |
| 2682 | const char *yystr; |
| 2683 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2684 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2685 | const char *yys = yystr; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2686 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2687 | while (*yys++ != '\0') |
| 2688 | continue; |
| 2689 | |
| 2690 | return yys - yystr - 1; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2691 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2692 | # endif |
| 2693 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2694 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2695 | # ifndef yystpcpy |
| 2696 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 2697 | # define yystpcpy stpcpy |
| 2698 | # else |
| 2699 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2700 | YYDEST. */ |
| 2701 | static char * |
| 2702 | # if defined (__STDC__) || defined (__cplusplus) |
| 2703 | yystpcpy (char *yydest, const char *yysrc) |
| 2704 | # else |
| 2705 | yystpcpy (yydest, yysrc) |
| 2706 | char *yydest; |
| 2707 | const char *yysrc; |
| 2708 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2709 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2710 | char *yyd = yydest; |
| 2711 | const char *yys = yysrc; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2712 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2713 | while ((*yyd++ = *yys++) != '\0') |
| 2714 | continue; |
| 2715 | |
| 2716 | return yyd - 1; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2717 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2718 | # endif |
| 2719 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2720 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2721 | # ifndef yytnamerr |
| 2722 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2723 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2724 | heuristic is that double-quoting is unnecessary unless the string |
| 2725 | contains an apostrophe, a comma, or backslash (other than |
| 2726 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2727 | null, do not copy; instead, return the length of what the result |
| 2728 | would have been. */ |
| 2729 | static YYSIZE_T |
| 2730 | yytnamerr (char *yyres, const char *yystr) |
| 2731 | { |
| 2732 | if (*yystr == '"') |
| 2733 | { |
| 2734 | size_t yyn = 0; |
| 2735 | char const *yyp = yystr; |
| 2736 | |
| 2737 | for (;;) |
| 2738 | switch (*++yyp) |
| 2739 | { |
| 2740 | case '\'': |
| 2741 | case ',': |
| 2742 | goto do_not_strip_quotes; |
| 2743 | |
| 2744 | case '\\': |
| 2745 | if (*++yyp != '\\') |
| 2746 | goto do_not_strip_quotes; |
| 2747 | /* Fall through. */ |
| 2748 | default: |
| 2749 | if (yyres) |
| 2750 | yyres[yyn] = *yyp; |
| 2751 | yyn++; |
| 2752 | break; |
| 2753 | |
| 2754 | case '"': |
| 2755 | if (yyres) |
| 2756 | yyres[yyn] = '\0'; |
| 2757 | return yyn; |
| 2758 | } |
| 2759 | do_not_strip_quotes: ; |
| 2760 | } |
| 2761 | |
| 2762 | if (! yyres) |
| 2763 | return yystrlen (yystr); |
| 2764 | |
| 2765 | return yystpcpy (yyres, yystr) - yyres; |
| 2766 | } |
| 2767 | # endif |
| 2768 | |
| 2769 | #endif /* YYERROR_VERBOSE */ |
| 2770 | |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2771 | |
| 2772 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2773 | #if YYDEBUG |
| 2774 | /*--------------------------------. |
| 2775 | | Print this symbol on YYOUTPUT. | |
| 2776 | `--------------------------------*/ |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2777 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2778 | #if defined (__STDC__) || defined (__cplusplus) |
| 2779 | static void |
| 2780 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2781 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2782 | static void |
| 2783 | yysymprint (yyoutput, yytype, yyvaluep) |
| 2784 | FILE *yyoutput; |
| 2785 | int yytype; |
| 2786 | YYSTYPE *yyvaluep; |
| 2787 | #endif |
| 2788 | { |
| 2789 | /* Pacify ``unused variable'' warnings. */ |
| 2790 | (void) yyvaluep; |
| 2791 | |
| 2792 | if (yytype < YYNTOKENS) |
| 2793 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2794 | else |
| 2795 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2796 | |
| 2797 | |
| 2798 | # ifdef YYPRINT |
| 2799 | if (yytype < YYNTOKENS) |
| 2800 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2801 | # endif |
| 2802 | switch (yytype) |
| 2803 | { |
| 2804 | default: |
| 2805 | break; |
| 2806 | } |
| 2807 | YYFPRINTF (yyoutput, ")"); |
| 2808 | } |
| 2809 | |
| 2810 | #endif /* ! YYDEBUG */ |
| 2811 | /*-----------------------------------------------. |
| 2812 | | Release the memory associated to this symbol. | |
| 2813 | `-----------------------------------------------*/ |
| 2814 | |
| 2815 | #if defined (__STDC__) || defined (__cplusplus) |
| 2816 | static void |
| 2817 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2818 | #else |
| 2819 | static void |
| 2820 | yydestruct (yymsg, yytype, yyvaluep) |
| 2821 | const char *yymsg; |
| 2822 | int yytype; |
| 2823 | YYSTYPE *yyvaluep; |
| 2824 | #endif |
| 2825 | { |
| 2826 | /* Pacify ``unused variable'' warnings. */ |
| 2827 | (void) yyvaluep; |
| 2828 | |
| 2829 | if (!yymsg) |
| 2830 | yymsg = "Deleting"; |
| 2831 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2832 | |
| 2833 | switch (yytype) |
| 2834 | { |
| 2835 | |
| 2836 | default: |
| 2837 | break; |
| 2838 | } |
| 2839 | } |
| 2840 | |
| 2841 | |
| 2842 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2843 | |
| 2844 | #ifdef YYPARSE_PARAM |
| 2845 | # if defined (__STDC__) || defined (__cplusplus) |
| 2846 | int yyparse (void *YYPARSE_PARAM); |
| 2847 | # else |
| 2848 | int yyparse (); |
| 2849 | # endif |
| 2850 | #else /* ! YYPARSE_PARAM */ |
| 2851 | #if defined (__STDC__) || defined (__cplusplus) |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2852 | int yyparse (void); |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2853 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2854 | int yyparse (); |
| 2855 | #endif |
| 2856 | #endif /* ! YYPARSE_PARAM */ |
| 2857 | |
| 2858 | |
| 2859 | |
| 2860 | /* The look-ahead symbol. */ |
| 2861 | int yychar; |
| 2862 | |
| 2863 | /* The semantic value of the look-ahead symbol. */ |
| 2864 | YYSTYPE yylval; |
| 2865 | |
| 2866 | /* Number of syntax errors so far. */ |
| 2867 | int yynerrs; |
| 2868 | |
| 2869 | |
| 2870 | |
| 2871 | /*----------. |
| 2872 | | yyparse. | |
| 2873 | `----------*/ |
| 2874 | |
| 2875 | #ifdef YYPARSE_PARAM |
| 2876 | # if defined (__STDC__) || defined (__cplusplus) |
| 2877 | int yyparse (void *YYPARSE_PARAM) |
| 2878 | # else |
| 2879 | int yyparse (YYPARSE_PARAM) |
| 2880 | void *YYPARSE_PARAM; |
| 2881 | # endif |
| 2882 | #else /* ! YYPARSE_PARAM */ |
| 2883 | #if defined (__STDC__) || defined (__cplusplus) |
| 2884 | int |
| 2885 | yyparse (void) |
| 2886 | #else |
| 2887 | int |
| 2888 | yyparse () |
| 2889 | |
| 2890 | #endif |
| 2891 | #endif |
| 2892 | { |
| 2893 | |
| 2894 | int yystate; |
| 2895 | int yyn; |
| 2896 | int yyresult; |
| 2897 | /* Number of tokens to shift before error messages enabled. */ |
| 2898 | int yyerrstatus; |
| 2899 | /* Look-ahead token as an internal (translated) token number. */ |
| 2900 | int yytoken = 0; |
| 2901 | |
| 2902 | /* Three stacks and their tools: |
| 2903 | `yyss': related to states, |
| 2904 | `yyvs': related to semantic values, |
| 2905 | `yyls': related to locations. |
| 2906 | |
| 2907 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 2908 | to reallocate them elsewhere. */ |
| 2909 | |
| 2910 | /* The state stack. */ |
| 2911 | short int yyssa[YYINITDEPTH]; |
| 2912 | short int *yyss = yyssa; |
| 2913 | short int *yyssp; |
| 2914 | |
| 2915 | /* The semantic value stack. */ |
| 2916 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 2917 | YYSTYPE *yyvs = yyvsa; |
| 2918 | YYSTYPE *yyvsp; |
| 2919 | |
| 2920 | |
| 2921 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2922 | #define YYPOPSTACK (yyvsp--, yyssp--) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2923 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2924 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2925 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2926 | /* The variables used to return semantic value and location from the |
| 2927 | action routines. */ |
| 2928 | YYSTYPE yyval; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2929 | |
| 2930 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2931 | /* When reducing, the number of symbols on the RHS of the reduced |
| 2932 | rule. */ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 2933 | int yylen; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2934 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2935 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2936 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2937 | yystate = 0; |
| 2938 | yyerrstatus = 0; |
| 2939 | yynerrs = 0; |
| 2940 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 2941 | |
| 2942 | /* Initialize stack pointers. |
| 2943 | Waste one element of value and location stack |
| 2944 | so that they stay on the same level as the state stack. |
| 2945 | The wasted elements are never initialized. */ |
| 2946 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2947 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2948 | yyvsp = yyvs; |
| 2949 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2950 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 2951 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2952 | /*------------------------------------------------------------. |
| 2953 | | yynewstate -- Push a new state, which is found in yystate. | |
| 2954 | `------------------------------------------------------------*/ |
| 2955 | yynewstate: |
| 2956 | /* In all cases, when you get here, the value and location stacks |
| 2957 | have just been pushed. so pushing a state here evens the stacks. |
| 2958 | */ |
| 2959 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2960 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2961 | yysetstate: |
| 2962 | *yyssp = yystate; |
| 2963 | |
| 2964 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2965 | { |
| 2966 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2967 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2968 | |
| 2969 | #ifdef yyoverflow |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2970 | { |
| 2971 | /* Give user a chance to reallocate the stack. Use copies of |
| 2972 | these so that the &'s don't force the real ones into |
| 2973 | memory. */ |
| 2974 | YYSTYPE *yyvs1 = yyvs; |
| 2975 | short int *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2976 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2977 | |
| 2978 | /* Each stack pointer address is followed by the size of the |
| 2979 | data in use in that stack, in bytes. This used to be a |
| 2980 | conditional around just the two extra args, but that might |
| 2981 | be undefined if yyoverflow is a macro. */ |
| 2982 | yyoverflow (YY_("memory exhausted"), |
| 2983 | &yyss1, yysize * sizeof (*yyssp), |
| 2984 | &yyvs1, yysize * sizeof (*yyvsp), |
| 2985 | |
| 2986 | &yystacksize); |
| 2987 | |
| 2988 | yyss = yyss1; |
| 2989 | yyvs = yyvs1; |
| 2990 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2991 | #else /* no yyoverflow */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2992 | # ifndef YYSTACK_RELOCATE |
| 2993 | goto yyexhaustedlab; |
| 2994 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2995 | /* Extend the stack our own way. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2996 | if (YYMAXDEPTH <= yystacksize) |
| 2997 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2998 | yystacksize *= 2; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2999 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3000 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3001 | |
| 3002 | { |
| 3003 | short int *yyss1 = yyss; |
| 3004 | union yyalloc *yyptr = |
| 3005 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3006 | if (! yyptr) |
| 3007 | goto yyexhaustedlab; |
| 3008 | YYSTACK_RELOCATE (yyss); |
| 3009 | YYSTACK_RELOCATE (yyvs); |
| 3010 | |
| 3011 | # undef YYSTACK_RELOCATE |
| 3012 | if (yyss1 != yyssa) |
| 3013 | YYSTACK_FREE (yyss1); |
| 3014 | } |
| 3015 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3016 | #endif /* no yyoverflow */ |
| 3017 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3018 | yyssp = yyss + yysize - 1; |
| 3019 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3020 | |
| 3021 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3022 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3023 | (unsigned long int) yystacksize)); |
| 3024 | |
| 3025 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3026 | YYABORT; |
| 3027 | } |
| 3028 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3029 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3030 | |
| 3031 | goto yybackup; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3032 | |
| 3033 | /*-----------. |
| 3034 | | yybackup. | |
| 3035 | `-----------*/ |
| 3036 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3037 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3038 | /* Do appropriate processing given the current state. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3039 | /* Read a look-ahead token if we need one and don't already have one. */ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3040 | /* yyresume: */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3041 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3042 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3043 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3044 | yyn = yypact[yystate]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3045 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3046 | goto yydefault; |
| 3047 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3048 | /* Not known => get a look-ahead token if don't already have one. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3049 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3050 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3051 | if (yychar == YYEMPTY) |
| 3052 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3053 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3054 | yychar = YYLEX; |
| 3055 | } |
| 3056 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3057 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3058 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3059 | yychar = yytoken = YYEOF; |
| 3060 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3061 | } |
| 3062 | else |
| 3063 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3064 | yytoken = YYTRANSLATE (yychar); |
| 3065 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3066 | } |
| 3067 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3068 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3069 | detect an error, take that action. */ |
| 3070 | yyn += yytoken; |
| 3071 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3072 | goto yydefault; |
| 3073 | yyn = yytable[yyn]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3074 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3075 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3076 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3077 | goto yyerrlab; |
| 3078 | yyn = -yyn; |
| 3079 | goto yyreduce; |
| 3080 | } |
| 3081 | |
| 3082 | if (yyn == YYFINAL) |
| 3083 | YYACCEPT; |
| 3084 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3085 | /* Shift the look-ahead token. */ |
| 3086 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3087 | |
| 3088 | /* Discard the token being shifted unless it is eof. */ |
| 3089 | if (yychar != YYEOF) |
| 3090 | yychar = YYEMPTY; |
| 3091 | |
| 3092 | *++yyvsp = yylval; |
| 3093 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3094 | |
| 3095 | /* Count tokens shifted since error; after three, turn off error |
| 3096 | status. */ |
| 3097 | if (yyerrstatus) |
| 3098 | yyerrstatus--; |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 3099 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3100 | yystate = yyn; |
| 3101 | goto yynewstate; |
| 3102 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 3103 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3104 | /*-----------------------------------------------------------. |
| 3105 | | yydefault -- do the default action for the current state. | |
| 3106 | `-----------------------------------------------------------*/ |
| 3107 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3108 | yyn = yydefact[yystate]; |
| 3109 | if (yyn == 0) |
| 3110 | goto yyerrlab; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3111 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3112 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3113 | |
| 3114 | /*-----------------------------. |
| 3115 | | yyreduce -- Do a reduction. | |
| 3116 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3117 | yyreduce: |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3118 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3119 | yylen = yyr2[yyn]; |
| 3120 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3121 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3122 | `$$ = $1'. |
| 3123 | |
| 3124 | Otherwise, the following line sets YYVAL to garbage. |
| 3125 | This behavior is undocumented and Bison |
| 3126 | users should not rely upon it. Assigning to YYVAL |
| 3127 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3128 | GCC warning that YYVAL may be used uninitialized. */ |
| 3129 | yyval = yyvsp[1-yylen]; |
| 3130 | |
| 3131 | |
| 3132 | YY_REDUCE_PRINT (yyn); |
| 3133 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3134 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3135 | case 3: |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3136 | #line 1106 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3137 | { |
| 3138 | if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3139 | GEN_ERROR("Value too large for type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3140 | (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3141 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3142 | ;} |
| 3143 | break; |
| 3144 | |
| 3145 | case 5: |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3146 | #line 1115 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3147 | { |
| 3148 | if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3149 | GEN_ERROR("Value too large for type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3150 | (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3151 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3152 | ;} |
| 3153 | break; |
| 3154 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3155 | case 75: |
| 3156 | #line 1143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3157 | { |
| 3158 | (yyval.StrVal) = (yyvsp[-1].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3159 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3160 | ;} |
| 3161 | break; |
| 3162 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3163 | case 76: |
| 3164 | #line 1147 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3165 | { |
| 3166 | (yyval.StrVal) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3167 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3168 | ;} |
| 3169 | break; |
| 3170 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3171 | case 77: |
| 3172 | #line 1152 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3173 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3174 | break; |
| 3175 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3176 | case 78: |
| 3177 | #line 1153 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3178 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3179 | break; |
| 3180 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3181 | case 79: |
| 3182 | #line 1154 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3183 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3184 | break; |
| 3185 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3186 | case 80: |
| 3187 | #line 1155 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3188 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3189 | break; |
| 3190 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3191 | case 81: |
| 3192 | #line 1156 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3193 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3194 | break; |
| 3195 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3196 | case 82: |
| 3197 | #line 1157 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3198 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3199 | break; |
| 3200 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3201 | case 83: |
| 3202 | #line 1158 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3203 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3204 | break; |
| 3205 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3206 | case 84: |
| 3207 | #line 1159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3208 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3209 | break; |
| 3210 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3211 | case 85: |
| 3212 | #line 1161 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3213 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3214 | break; |
| 3215 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3216 | case 86: |
| 3217 | #line 1162 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3218 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3219 | break; |
| 3220 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3221 | case 87: |
| 3222 | #line 1163 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3223 | { (yyval.UIntVal) = CallingConv::CSRet; ;} |
| 3224 | break; |
| 3225 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3226 | case 88: |
| 3227 | #line 1164 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3228 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3229 | break; |
| 3230 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3231 | case 89: |
| 3232 | #line 1165 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3233 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3234 | break; |
| 3235 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3236 | case 90: |
| 3237 | #line 1166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3238 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3239 | break; |
| 3240 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3241 | case 91: |
| 3242 | #line 1167 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3243 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3244 | break; |
| 3245 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3246 | case 92: |
| 3247 | #line 1168 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3248 | { |
| 3249 | if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3250 | GEN_ERROR("Calling conv too large!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3251 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3252 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3253 | ;} |
| 3254 | break; |
| 3255 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3256 | case 93: |
| 3257 | #line 1177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3258 | { (yyval.UIntVal) = 0; ;} |
| 3259 | break; |
| 3260 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3261 | case 94: |
| 3262 | #line 1178 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3263 | { |
| 3264 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3265 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3266 | GEN_ERROR("Alignment must be a power of two!"); |
| 3267 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3268 | ;} |
| 3269 | break; |
| 3270 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3271 | case 95: |
| 3272 | #line 1184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3273 | { (yyval.UIntVal) = 0; ;} |
| 3274 | break; |
| 3275 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3276 | case 96: |
| 3277 | #line 1185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3278 | { |
| 3279 | (yyval.UIntVal) = (yyvsp[0].UInt64Val); |
| 3280 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 3281 | GEN_ERROR("Alignment must be a power of two!"); |
| 3282 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3283 | ;} |
| 3284 | break; |
| 3285 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3286 | case 97: |
| 3287 | #line 1193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3288 | { |
| 3289 | for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) |
| 3290 | if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3291 | GEN_ERROR("Invalid character in section name!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3292 | (yyval.StrVal) = (yyvsp[0].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3293 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3294 | ;} |
| 3295 | break; |
| 3296 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3297 | case 98: |
| 3298 | #line 1201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3299 | { (yyval.StrVal) = 0; ;} |
| 3300 | break; |
| 3301 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3302 | case 99: |
| 3303 | #line 1202 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3304 | { (yyval.StrVal) = (yyvsp[0].StrVal); ;} |
| 3305 | break; |
| 3306 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3307 | case 100: |
| 3308 | #line 1207 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3309 | {;} |
| 3310 | break; |
| 3311 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3312 | case 101: |
| 3313 | #line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3314 | {;} |
| 3315 | break; |
| 3316 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3317 | case 102: |
| 3318 | #line 1209 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3319 | { |
| 3320 | CurGV->setSection((yyvsp[0].StrVal)); |
| 3321 | free((yyvsp[0].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3322 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3323 | ;} |
| 3324 | break; |
| 3325 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3326 | case 103: |
| 3327 | #line 1214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3328 | { |
| 3329 | if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3330 | GEN_ERROR("Alignment must be a power of two!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3331 | CurGV->setAlignment((yyvsp[0].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3332 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3333 | ;} |
| 3334 | break; |
| 3335 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3336 | case 105: |
| 3337 | #line 1228 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3338 | { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3339 | break; |
| 3340 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3341 | case 107: |
| 3342 | #line 1229 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3343 | { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3344 | break; |
| 3345 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3346 | case 108: |
| 3347 | #line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3348 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3349 | if (!UpRefs.empty()) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3350 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3351 | (yyval.TypeVal) = (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3352 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3353 | ;} |
| 3354 | break; |
| 3355 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3356 | case 122: |
| 3357 | #line 1243 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3358 | { |
| 3359 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
| 3360 | CHECK_FOR_ERROR |
| 3361 | ;} |
| 3362 | break; |
| 3363 | |
| 3364 | case 123: |
| 3365 | #line 1247 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3366 | { |
| 3367 | (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); |
| 3368 | CHECK_FOR_ERROR |
| 3369 | ;} |
| 3370 | break; |
| 3371 | |
| 3372 | case 124: |
| 3373 | #line 1251 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3374 | { // Named types are also simple types... |
| 3375 | const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); |
| 3376 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3377 | (yyval.TypeVal) = new PATypeHolder(tmp); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3378 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3379 | break; |
| 3380 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3381 | case 125: |
| 3382 | #line 1259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3383 | { // Type UpReference |
| 3384 | if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); |
| 3385 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
| 3386 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3387 | (yyval.TypeVal) = new PATypeHolder(OT); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3388 | UR_OUT("New Upreference!\n"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3389 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3390 | ;} |
| 3391 | break; |
| 3392 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3393 | case 126: |
| 3394 | #line 1267 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3395 | { // Function derived type? |
| 3396 | std::vector<const Type*> Params; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3397 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3398 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3399 | Params.push_back(*I); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3400 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3401 | if (isVarArg) Params.pop_back(); |
| 3402 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3403 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg))); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3404 | delete (yyvsp[-1].TypeList); // Delete the argument list |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3405 | delete (yyvsp[-3].TypeVal); // Delete the return type handle |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3406 | CHECK_FOR_ERROR |
| 3407 | ;} |
| 3408 | break; |
| 3409 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3410 | case 127: |
| 3411 | #line 1280 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3412 | { // Sized array type? |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3413 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3414 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3415 | CHECK_FOR_ERROR |
| 3416 | ;} |
| 3417 | break; |
| 3418 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3419 | case 128: |
| 3420 | #line 1285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3421 | { // Packed array type? |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3422 | const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); |
| 3423 | if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) |
| 3424 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3425 | if (!ElemTy->isPrimitiveType()) |
| 3426 | GEN_ERROR("Elemental type of a PackedType must be primitive"); |
| 3427 | if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) |
| 3428 | GEN_ERROR("Vector length should be a power of 2!"); |
| 3429 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); |
| 3430 | delete (yyvsp[-1].TypeVal); |
| 3431 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3432 | ;} |
| 3433 | break; |
| 3434 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3435 | case 129: |
| 3436 | #line 1297 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3437 | { // Structure type? |
| 3438 | std::vector<const Type*> Elements; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3439 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(), |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3440 | E = (yyvsp[-1].TypeList)->end(); I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3441 | Elements.push_back(*I); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3442 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3443 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3444 | delete (yyvsp[-1].TypeList); |
| 3445 | CHECK_FOR_ERROR |
| 3446 | ;} |
| 3447 | break; |
| 3448 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3449 | case 130: |
| 3450 | #line 1307 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3451 | { // Empty structure type? |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3452 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3453 | CHECK_FOR_ERROR |
| 3454 | ;} |
| 3455 | break; |
| 3456 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3457 | case 131: |
| 3458 | #line 1311 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3459 | { // Pointer type? |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3460 | if (*(yyvsp[-1].TypeVal) == Type::LabelTy) |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3461 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3462 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); |
| 3463 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3464 | CHECK_FOR_ERROR |
| 3465 | ;} |
| 3466 | break; |
| 3467 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3468 | case 132: |
| 3469 | #line 1322 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3470 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3471 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 3472 | (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3473 | CHECK_FOR_ERROR |
| 3474 | ;} |
| 3475 | break; |
| 3476 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3477 | case 133: |
| 3478 | #line 1327 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3479 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3480 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3481 | CHECK_FOR_ERROR |
| 3482 | ;} |
| 3483 | break; |
| 3484 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3485 | case 135: |
| 3486 | #line 1334 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3487 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3488 | ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3489 | CHECK_FOR_ERROR |
| 3490 | ;} |
| 3491 | break; |
| 3492 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3493 | case 136: |
| 3494 | #line 1338 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3495 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3496 | ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3497 | CHECK_FOR_ERROR |
| 3498 | ;} |
| 3499 | break; |
| 3500 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3501 | case 137: |
| 3502 | #line 1342 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3503 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3504 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3505 | CHECK_FOR_ERROR |
| 3506 | ;} |
| 3507 | break; |
| 3508 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3509 | case 138: |
| 3510 | #line 1353 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3511 | { // Nonempty unsized arr |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3512 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3513 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3514 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3515 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3516 | const Type *ETy = ATy->getElementType(); |
| 3517 | int NumElements = ATy->getNumElements(); |
| 3518 | |
| 3519 | // Verify that we have the correct size... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3520 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3521 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3522 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3523 | itostr(NumElements) + "!"); |
| 3524 | |
| 3525 | // Verify all elements are correct type! |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3526 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3527 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3528 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3529 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3530 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3531 | } |
| 3532 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3533 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); |
| 3534 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3535 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3536 | ;} |
| 3537 | break; |
| 3538 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3539 | case 139: |
| 3540 | #line 1379 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3541 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3542 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3543 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3544 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3545 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3546 | |
| 3547 | int NumElements = ATy->getNumElements(); |
| 3548 | if (NumElements != -1 && NumElements != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3549 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3550 | " arguments, but has size of " + itostr(NumElements) +"!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3551 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 3552 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3553 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3554 | ;} |
| 3555 | break; |
| 3556 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3557 | case 140: |
| 3558 | #line 1393 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3559 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3560 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3561 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3562 | GEN_ERROR("Cannot make array constant with type: '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3563 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3564 | |
| 3565 | int NumElements = ATy->getNumElements(); |
| 3566 | const Type *ETy = ATy->getElementType(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3567 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 3568 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3569 | GEN_ERROR("Can't build string constant of size " + |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3570 | itostr((int)(EndStr-(yyvsp[0].StrVal))) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3571 | " when array has size " + itostr(NumElements) + "!"); |
| 3572 | std::vector<Constant*> Vals; |
| 3573 | if (ETy == Type::SByteTy) { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3574 | for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 3575 | Vals.push_back(ConstantInt::get(ETy, *C)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3576 | } else if (ETy == Type::UByteTy) { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3577 | for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 3578 | C != (unsigned char*)EndStr; ++C) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 3579 | Vals.push_back(ConstantInt::get(ETy, *C)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3580 | } else { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3581 | free((yyvsp[0].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3582 | GEN_ERROR("Cannot build string arrays of non byte sized elements!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3583 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3584 | free((yyvsp[0].StrVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3585 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 3586 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3587 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3588 | ;} |
| 3589 | break; |
| 3590 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3591 | case 141: |
| 3592 | #line 1423 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3593 | { // Nonempty unsized arr |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3594 | const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3595 | if (PTy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3596 | GEN_ERROR("Cannot make packed constant with type: '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3597 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3598 | const Type *ETy = PTy->getElementType(); |
| 3599 | int NumElements = PTy->getNumElements(); |
| 3600 | |
| 3601 | // Verify that we have the correct size... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3602 | if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3603 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3604 | utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3605 | itostr(NumElements) + "!"); |
| 3606 | |
| 3607 | // Verify all elements are correct type! |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3608 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3609 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3610 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3611 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3612 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3613 | } |
| 3614 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3615 | (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); |
| 3616 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3617 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3618 | ;} |
| 3619 | break; |
| 3620 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3621 | case 142: |
| 3622 | #line 1449 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3623 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3624 | const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3625 | if (STy == 0) |
| 3626 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3627 | (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3628 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3629 | if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3630 | GEN_ERROR("Illegal number of initializers for structure type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3631 | |
| 3632 | // Check to ensure that constants are compatible with the type initializer! |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3633 | for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3634 | if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3635 | GEN_ERROR("Expected type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3636 | STy->getElementType(i)->getDescription() + |
| 3637 | "' for element #" + utostr(i) + |
| 3638 | " of structure initializer!"); |
| 3639 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3640 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); |
| 3641 | delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3642 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3643 | ;} |
| 3644 | break; |
| 3645 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3646 | case 143: |
| 3647 | #line 1470 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3648 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3649 | const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3650 | if (STy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3651 | GEN_ERROR("Cannot make struct constant with type: '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3652 | (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3653 | |
| 3654 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3655 | GEN_ERROR("Illegal number of initializers for structure type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3656 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3657 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 3658 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3659 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3660 | ;} |
| 3661 | break; |
| 3662 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3663 | case 144: |
| 3664 | #line 1483 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3665 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3666 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3667 | if (PTy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3668 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3669 | (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3670 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3671 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 3672 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3673 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3674 | ;} |
| 3675 | break; |
| 3676 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3677 | case 145: |
| 3678 | #line 1493 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3679 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3680 | (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); |
| 3681 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3682 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3683 | ;} |
| 3684 | break; |
| 3685 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3686 | case 146: |
| 3687 | #line 1498 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3688 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3689 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3690 | if (Ty == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3691 | GEN_ERROR("Global const reference must be a pointer type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3692 | |
| 3693 | // ConstExprs can exist in the body of a function, thus creating |
| 3694 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3695 | // the context of a function, getValNonImprovising will search the functions |
| 3696 | // symbol table instead of the module symbol table for the global symbol, |
| 3697 | // which throws things all off. To get around this, we just tell |
| 3698 | // getValNonImprovising that we are at global scope here. |
| 3699 | // |
| 3700 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3701 | CurFun.CurrentFunction = 0; |
| 3702 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3703 | Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3704 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3705 | |
| 3706 | CurFun.CurrentFunction = SavedCurFn; |
| 3707 | |
| 3708 | // If this is an initializer for a constant pointer, which is referencing a |
| 3709 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3710 | // in the future with the right type of variable. |
| 3711 | // |
| 3712 | if (V == 0) { |
| 3713 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 3714 | const PointerType *PT = cast<PointerType>(Ty); |
| 3715 | |
| 3716 | // First check to see if the forward references value is already created! |
| 3717 | PerModuleInfo::GlobalRefsType::iterator I = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3718 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3719 | |
| 3720 | if (I != CurModule.GlobalRefs.end()) { |
| 3721 | V = I->second; // Placeholder already exists, use it... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3722 | (yyvsp[0].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3723 | } else { |
| 3724 | std::string Name; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3725 | if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3726 | |
| 3727 | // Create the forward referenced global. |
| 3728 | GlobalValue *GV; |
| 3729 | if (const FunctionType *FTy = |
| 3730 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3731 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3732 | CurModule.CurrentModule); |
| 3733 | } else { |
| 3734 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3735 | GlobalValue::ExternalLinkage, 0, |
| 3736 | Name, CurModule.CurrentModule); |
| 3737 | } |
| 3738 | |
| 3739 | // Keep track of the fact that we have a forward ref to recycle it |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3740 | CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3741 | V = GV; |
| 3742 | } |
| 3743 | } |
| 3744 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3745 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 3746 | delete (yyvsp[-1].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3747 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3748 | ;} |
| 3749 | break; |
| 3750 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3751 | case 147: |
| 3752 | #line 1559 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3753 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3754 | if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3755 | GEN_ERROR("Mismatched types for constant expression!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3756 | (yyval.ConstVal) = (yyvsp[0].ConstVal); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3757 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3758 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3759 | ;} |
| 3760 | break; |
| 3761 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3762 | case 148: |
| 3763 | #line 1566 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3764 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3765 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3766 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3767 | GEN_ERROR("Cannot create a null initialized value of this type!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3768 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 3769 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3770 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3771 | ;} |
| 3772 | break; |
| 3773 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3774 | case 149: |
| 3775 | #line 1574 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3776 | { // integral constants |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3777 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3778 | GEN_ERROR("Constant value doesn't fit in type!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3779 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3780 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3781 | ;} |
| 3782 | break; |
| 3783 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3784 | case 150: |
| 3785 | #line 1580 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3786 | { // integral constants |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3787 | if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3788 | GEN_ERROR("Constant value doesn't fit in type!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3789 | (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3790 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3791 | ;} |
| 3792 | break; |
| 3793 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3794 | case 151: |
| 3795 | #line 1586 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3796 | { // Boolean constants |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3797 | (yyval.ConstVal) = ConstantBool::getTrue(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3798 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3799 | ;} |
| 3800 | break; |
| 3801 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3802 | case 152: |
| 3803 | #line 1590 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3804 | { // Boolean constants |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3805 | (yyval.ConstVal) = ConstantBool::getFalse(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3806 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3807 | ;} |
| 3808 | break; |
| 3809 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3810 | case 153: |
| 3811 | #line 1594 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3812 | { // Float & Double constants |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3813 | if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3814 | GEN_ERROR("Floating point constant invalid for type!!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3815 | (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3816 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3817 | ;} |
| 3818 | break; |
| 3819 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3820 | case 154: |
| 3821 | #line 1602 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3822 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3823 | Constant *Val = (yyvsp[-3].ConstVal); |
| 3824 | const Type *Ty = (yyvsp[-1].TypeVal)->get(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3825 | if (!Val->getType()->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3826 | GEN_ERROR("cast constant expression from a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3827 | Val->getType()->getDescription() + "'!"); |
| 3828 | if (!Ty->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3829 | GEN_ERROR("cast constant expression to a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3830 | Ty->getDescription() + "'!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3831 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get()); |
| 3832 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3833 | ;} |
| 3834 | break; |
| 3835 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3836 | case 155: |
| 3837 | #line 1614 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3838 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3839 | if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3840 | GEN_ERROR("GetElementPtr requires a pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3841 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3842 | // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct |
| 3843 | // indices to uint struct indices for compatibility. |
| 3844 | generic_gep_type_iterator<std::vector<Value*>::iterator> |
| 3845 | GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()), |
| 3846 | GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()); |
| 3847 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) |
| 3848 | if (isa<StructType>(*GTI)) // Only change struct indices |
| 3849 | if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[-1].ValueList))[i])) |
| 3850 | if (CUI->getType() == Type::UByteTy) |
| 3851 | (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); |
| 3852 | |
| 3853 | const Type *IdxTy = |
| 3854 | GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); |
| 3855 | if (!IdxTy) |
| 3856 | GEN_ERROR("Index list invalid for constant getelementptr!"); |
| 3857 | |
| 3858 | std::vector<Constant*> IdxVec; |
| 3859 | for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) |
| 3860 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i])) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3861 | IdxVec.push_back(C); |
| 3862 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3863 | GEN_ERROR("Indices to constant getelementptr must be constants!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3864 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3865 | delete (yyvsp[-1].ValueList); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3866 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3867 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3868 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3869 | ;} |
| 3870 | break; |
| 3871 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3872 | case 156: |
| 3873 | #line 1646 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3874 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3875 | if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3876 | GEN_ERROR("Select condition must be of boolean type!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3877 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3878 | GEN_ERROR("Select operand types must match!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3879 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3880 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3881 | ;} |
| 3882 | break; |
| 3883 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3884 | case 157: |
| 3885 | #line 1654 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3886 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3887 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3888 | GEN_ERROR("Binary operator types must match!"); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3889 | CHECK_FOR_ERROR; |
| 3890 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3891 | // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. |
| 3892 | // To retain backward compatibility with these early compilers, we emit a |
| 3893 | // cast to the appropriate integer type automatically if we are in the |
| 3894 | // broken case. See PR424 for more information. |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3895 | if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) { |
| 3896 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3897 | } else { |
| 3898 | const Type *IntPtrTy = 0; |
| 3899 | switch (CurModule.CurrentModule->getPointerSize()) { |
| 3900 | case Module::Pointer32: IntPtrTy = Type::IntTy; break; |
| 3901 | case Module::Pointer64: IntPtrTy = Type::LongTy; break; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3902 | default: GEN_ERROR("invalid pointer binary constant expr!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3903 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3904 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy), |
| 3905 | ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy)); |
| 3906 | (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3907 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3908 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3909 | ;} |
| 3910 | break; |
| 3911 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3912 | case 158: |
| 3913 | #line 1678 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3914 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3915 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3916 | GEN_ERROR("Logical operator types must match!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3917 | if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) { |
| 3918 | if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) || |
| 3919 | !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3920 | GEN_ERROR("Logical operator requires integral operands!"); |
Chris Lattner | 524a131 | 2005-12-21 18:31:50 +0000 | [diff] [blame] | 3921 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3922 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3923 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3924 | ;} |
| 3925 | break; |
| 3926 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3927 | case 159: |
| 3928 | #line 1689 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3929 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3930 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3931 | GEN_ERROR("setcc operand types must match!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3932 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3933 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3934 | ;} |
| 3935 | break; |
| 3936 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3937 | case 160: |
| 3938 | #line 1695 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3939 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3940 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 3941 | GEN_ERROR("icmp operand types must match!"); |
| 3942 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 3943 | ;} |
| 3944 | break; |
| 3945 | |
| 3946 | case 161: |
| 3947 | #line 1700 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3948 | { |
| 3949 | if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) |
| 3950 | GEN_ERROR("fcmp operand types must match!"); |
| 3951 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
| 3952 | ;} |
| 3953 | break; |
| 3954 | |
| 3955 | case 162: |
| 3956 | #line 1705 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 3957 | { |
| 3958 | if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3959 | GEN_ERROR("Shift count for shift constant must be unsigned byte!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3960 | if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3961 | GEN_ERROR("Shift constant expression requires integer operand!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3962 | CHECK_FOR_ERROR; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3963 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 3964 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3965 | ;} |
| 3966 | break; |
| 3967 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3968 | case 163: |
| 3969 | #line 1714 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3970 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3971 | if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3972 | GEN_ERROR("Invalid extractelement operands!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3973 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3974 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3975 | ;} |
| 3976 | break; |
| 3977 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3978 | case 164: |
| 3979 | #line 1720 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3980 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3981 | if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3982 | GEN_ERROR("Invalid insertelement operands!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3983 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3984 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3985 | ;} |
| 3986 | break; |
| 3987 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3988 | case 165: |
| 3989 | #line 1726 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3990 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3991 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3992 | GEN_ERROR("Invalid shufflevector operands!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3993 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3994 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3995 | ;} |
| 3996 | break; |
| 3997 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 3998 | case 166: |
| 3999 | #line 1735 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4000 | { |
| 4001 | ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4002 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4003 | ;} |
| 4004 | break; |
| 4005 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4006 | case 167: |
| 4007 | #line 1739 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4008 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4009 | (yyval.ConstVector) = new std::vector<Constant*>(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4010 | (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4011 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4012 | ;} |
| 4013 | break; |
| 4014 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4015 | case 168: |
| 4016 | #line 1747 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4017 | { (yyval.BoolVal) = false; ;} |
| 4018 | break; |
| 4019 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4020 | case 169: |
| 4021 | #line 1747 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4022 | { (yyval.BoolVal) = true; ;} |
| 4023 | break; |
| 4024 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4025 | case 170: |
| 4026 | #line 1757 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4027 | { |
| 4028 | (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4029 | CurModule.ModuleDone(); |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 4030 | CHECK_FOR_ERROR; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4031 | ;} |
| 4032 | break; |
| 4033 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4034 | case 171: |
| 4035 | #line 1765 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4036 | { |
| 4037 | (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4038 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4039 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4040 | ;} |
| 4041 | break; |
| 4042 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4043 | case 172: |
| 4044 | #line 1770 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4045 | { |
| 4046 | (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4047 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4048 | ;} |
| 4049 | break; |
| 4050 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4051 | case 173: |
| 4052 | #line 1774 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4053 | { |
| 4054 | (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4055 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4056 | ;} |
| 4057 | break; |
| 4058 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4059 | case 174: |
| 4060 | #line 1778 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4061 | { |
| 4062 | (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4063 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4064 | ;} |
| 4065 | break; |
| 4066 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4067 | case 175: |
| 4068 | #line 1782 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4069 | { |
| 4070 | (yyval.ModuleVal) = CurModule.CurrentModule; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4071 | // Emit an error if there are any unresolved types left. |
| 4072 | if (!CurModule.LateResolveTypes.empty()) { |
| 4073 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4074 | if (DID.Type == ValID::NameVal) { |
| 4075 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4076 | } else { |
| 4077 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4078 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4079 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4080 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4081 | ;} |
| 4082 | break; |
| 4083 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4084 | case 176: |
| 4085 | #line 1797 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4086 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4087 | // Eagerly resolve types. This is not an optimization, this is a |
| 4088 | // requirement that is due to the fact that we could have this: |
| 4089 | // |
| 4090 | // %list = type { %list * } |
| 4091 | // %list = type { %list * } ; repeated type decl |
| 4092 | // |
| 4093 | // If types are not resolved eagerly, then the two types will not be |
| 4094 | // determined to be the same type! |
| 4095 | // |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4096 | ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4097 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4098 | if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4099 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4100 | // If this is a named type that is not a redefinition, add it to the slot |
| 4101 | // table. |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4102 | CurModule.Types.push_back(*(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4103 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4104 | |
| 4105 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4106 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4107 | ;} |
| 4108 | break; |
| 4109 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4110 | case 177: |
| 4111 | #line 1819 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4112 | { // Function prototypes can be in const pool |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4113 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4114 | ;} |
| 4115 | break; |
| 4116 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4117 | case 178: |
| 4118 | #line 1822 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4119 | { // Asm blocks can be in the const pool |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4120 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4121 | ;} |
| 4122 | break; |
| 4123 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4124 | case 179: |
| 4125 | #line 1825 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4126 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4127 | if ((yyvsp[0].ConstVal) == 0) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4128 | GEN_ERROR("Global value initializer is not a constant!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4129 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4130 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4131 | ;} |
| 4132 | break; |
| 4133 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4134 | case 180: |
| 4135 | #line 1830 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4136 | { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4137 | CurGV = 0; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4138 | ;} |
| 4139 | break; |
| 4140 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4141 | case 181: |
| 4142 | #line 1833 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4143 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4144 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4145 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4146 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4147 | ;} |
| 4148 | break; |
| 4149 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4150 | case 182: |
| 4151 | #line 1837 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4152 | { |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4153 | CurGV = 0; |
| 4154 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4155 | ;} |
| 4156 | break; |
| 4157 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4158 | case 183: |
| 4159 | #line 1841 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4160 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4161 | CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4162 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4163 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4164 | ;} |
| 4165 | break; |
| 4166 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4167 | case 184: |
| 4168 | #line 1845 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4169 | { |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4170 | CurGV = 0; |
| 4171 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4172 | ;} |
| 4173 | break; |
| 4174 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4175 | case 185: |
| 4176 | #line 1849 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4177 | { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4178 | CurGV = |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4179 | ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4180 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4181 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4182 | ;} |
| 4183 | break; |
| 4184 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4185 | case 186: |
| 4186 | #line 1854 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4187 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4188 | CurGV = 0; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4189 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4190 | ;} |
| 4191 | break; |
| 4192 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4193 | case 187: |
| 4194 | #line 1858 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4195 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4196 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4197 | ;} |
| 4198 | break; |
| 4199 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4200 | case 188: |
| 4201 | #line 1861 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4202 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4203 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4204 | ;} |
| 4205 | break; |
| 4206 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4207 | case 189: |
| 4208 | #line 1864 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4209 | { |
| 4210 | ;} |
| 4211 | break; |
| 4212 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4213 | case 190: |
| 4214 | #line 1868 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4215 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4216 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4217 | char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4218 | std::string NewAsm((yyvsp[0].StrVal), EndStr); |
| 4219 | free((yyvsp[0].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4220 | |
| 4221 | if (AsmSoFar.empty()) |
| 4222 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4223 | else |
| 4224 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4225 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4226 | ;} |
| 4227 | break; |
| 4228 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4229 | case 191: |
| 4230 | #line 1881 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4231 | { (yyval.Endianness) = Module::BigEndian; ;} |
| 4232 | break; |
| 4233 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4234 | case 192: |
| 4235 | #line 1882 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4236 | { (yyval.Endianness) = Module::LittleEndian; ;} |
| 4237 | break; |
| 4238 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4239 | case 193: |
| 4240 | #line 1884 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4241 | { |
| 4242 | CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4243 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4244 | ;} |
| 4245 | break; |
| 4246 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4247 | case 194: |
| 4248 | #line 1888 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4249 | { |
| 4250 | if ((yyvsp[0].UInt64Val) == 32) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4251 | CurModule.CurrentModule->setPointerSize(Module::Pointer32); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4252 | else if ((yyvsp[0].UInt64Val) == 64) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4253 | CurModule.CurrentModule->setPointerSize(Module::Pointer64); |
| 4254 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4255 | GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4256 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4257 | ;} |
| 4258 | break; |
| 4259 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4260 | case 195: |
| 4261 | #line 1897 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4262 | { |
| 4263 | CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); |
| 4264 | free((yyvsp[0].StrVal)); |
| 4265 | ;} |
| 4266 | break; |
| 4267 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4268 | case 196: |
| 4269 | #line 1901 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4270 | { |
| 4271 | CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); |
| 4272 | free((yyvsp[0].StrVal)); |
| 4273 | ;} |
| 4274 | break; |
| 4275 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4276 | case 198: |
| 4277 | #line 1908 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4278 | { |
| 4279 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4280 | free((yyvsp[0].StrVal)); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4281 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4282 | ;} |
| 4283 | break; |
| 4284 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4285 | case 199: |
| 4286 | #line 1913 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4287 | { |
| 4288 | CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); |
| 4289 | free((yyvsp[0].StrVal)); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4290 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4291 | ;} |
| 4292 | break; |
| 4293 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4294 | case 200: |
| 4295 | #line 1918 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4296 | { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4297 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4298 | ;} |
| 4299 | break; |
| 4300 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4301 | case 204: |
| 4302 | #line 1928 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4303 | { (yyval.StrVal) = 0; ;} |
| 4304 | break; |
| 4305 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4306 | case 205: |
| 4307 | #line 1930 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4308 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4309 | if (*(yyvsp[-1].TypeVal) == Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4310 | GEN_ERROR("void typed arguments are invalid!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4311 | (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4312 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4313 | ;} |
| 4314 | break; |
| 4315 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4316 | case 206: |
| 4317 | #line 1937 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4318 | { |
| 4319 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
| 4320 | (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); |
| 4321 | delete (yyvsp[0].ArgVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4322 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4323 | ;} |
| 4324 | break; |
| 4325 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4326 | case 207: |
| 4327 | #line 1943 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4328 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4329 | (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4330 | (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); |
| 4331 | delete (yyvsp[0].ArgVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4332 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4333 | ;} |
| 4334 | break; |
| 4335 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4336 | case 208: |
| 4337 | #line 1950 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4338 | { |
| 4339 | (yyval.ArgList) = (yyvsp[0].ArgList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4340 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4341 | ;} |
| 4342 | break; |
| 4343 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4344 | case 209: |
| 4345 | #line 1954 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4346 | { |
| 4347 | (yyval.ArgList) = (yyvsp[-2].ArgList); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4348 | (yyval.ArgList)->push_back(std::pair<PATypeHolder*, |
| 4349 | char*>(new PATypeHolder(Type::VoidTy), 0)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4350 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4351 | ;} |
| 4352 | break; |
| 4353 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4354 | case 210: |
| 4355 | #line 1960 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4356 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4357 | (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >(); |
| 4358 | (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4359 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4360 | ;} |
| 4361 | break; |
| 4362 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4363 | case 211: |
| 4364 | #line 1965 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4365 | { |
| 4366 | (yyval.ArgList) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4367 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4368 | ;} |
| 4369 | break; |
| 4370 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4371 | case 212: |
| 4372 | #line 1971 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4373 | { |
| 4374 | UnEscapeLexed((yyvsp[-5].StrVal)); |
| 4375 | std::string FunctionName((yyvsp[-5].StrVal)); |
| 4376 | free((yyvsp[-5].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4377 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4378 | if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4379 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4380 | |
| 4381 | std::vector<const Type*> ParamTypeList; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4382 | if ((yyvsp[-3].ArgList)) { // If there are arguments... |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4383 | for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4384 | I != (yyvsp[-3].ArgList)->end(); ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4385 | ParamTypeList.push_back(I->first->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4386 | } |
| 4387 | |
| 4388 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4389 | if (isVarArg) ParamTypeList.pop_back(); |
| 4390 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4391 | const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4392 | const PointerType *PFT = PointerType::get(FT); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4393 | delete (yyvsp[-6].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4394 | |
| 4395 | ValID ID; |
| 4396 | if (!FunctionName.empty()) { |
| 4397 | ID = ValID::create((char*)FunctionName.c_str()); |
| 4398 | } else { |
| 4399 | ID = ValID::create((int)CurModule.Values[PFT].size()); |
| 4400 | } |
| 4401 | |
| 4402 | Function *Fn = 0; |
| 4403 | // See if this function was forward referenced. If so, recycle the object. |
| 4404 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4405 | // Move the function to the end of the list, from whereever it was |
| 4406 | // previously inserted. |
| 4407 | Fn = cast<Function>(FWRef); |
| 4408 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4409 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4410 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4411 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4412 | // If this is the case, either we need to be a forward decl, or it needs |
| 4413 | // to be. |
| 4414 | if (!CurFun.isDeclare && !Fn->isExternal()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4415 | GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4416 | |
| 4417 | // Make sure to strip off any argument names so we can't get conflicts. |
| 4418 | if (Fn->isExternal()) |
| 4419 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4420 | AI != AE; ++AI) |
| 4421 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4422 | } else { // Not already defined? |
| 4423 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4424 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4425 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4426 | InsertValue(Fn, CurModule.Values); |
| 4427 | } |
| 4428 | |
| 4429 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4430 | |
| 4431 | if (CurFun.isDeclare) { |
| 4432 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4433 | // correctly handle cases, when pointer to function is passed as argument to |
| 4434 | // another function. |
| 4435 | Fn->setLinkage(CurFun.Linkage); |
| 4436 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4437 | Fn->setCallingConv((yyvsp[-7].UIntVal)); |
| 4438 | Fn->setAlignment((yyvsp[0].UIntVal)); |
| 4439 | if ((yyvsp[-1].StrVal)) { |
| 4440 | Fn->setSection((yyvsp[-1].StrVal)); |
| 4441 | free((yyvsp[-1].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4442 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4443 | |
| 4444 | // Add all of the arguments we parsed to the function... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4445 | if ((yyvsp[-3].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4446 | if (isVarArg) { // Nuke the last entry |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4447 | assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&& |
| 4448 | "Not a varargs marker!"); |
| 4449 | delete (yyvsp[-3].ArgList)->back().first; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4450 | (yyvsp[-3].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4451 | } |
| 4452 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4453 | for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4454 | I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4455 | delete I->first; // Delete the typeholder... |
| 4456 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4457 | setValueName(ArgIt, I->second); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4458 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4459 | InsertValue(ArgIt); |
| 4460 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4461 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4462 | delete (yyvsp[-3].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4463 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4464 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4465 | ;} |
| 4466 | break; |
| 4467 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4468 | case 215: |
| 4469 | #line 2067 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4470 | { |
| 4471 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4472 | |
| 4473 | // Make sure that we keep track of the linkage type even if there was a |
| 4474 | // previous "declare". |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4475 | (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); |
| 4476 | ;} |
| 4477 | break; |
| 4478 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4479 | case 218: |
| 4480 | #line 2077 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4481 | { |
| 4482 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4483 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4484 | ;} |
| 4485 | break; |
| 4486 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4487 | case 220: |
| 4488 | #line 2083 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4489 | { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} |
| 4490 | break; |
| 4491 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4492 | case 221: |
| 4493 | #line 2084 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 4494 | { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4495 | break; |
| 4496 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4497 | case 222: |
| 4498 | #line 2086 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4499 | { CurFun.isDeclare = true; ;} |
| 4500 | break; |
| 4501 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4502 | case 223: |
| 4503 | #line 2086 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4504 | { |
| 4505 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4506 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4507 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4508 | ;} |
| 4509 | break; |
| 4510 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4511 | case 224: |
| 4512 | #line 2096 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4513 | { |
| 4514 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4515 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4516 | ;} |
| 4517 | break; |
| 4518 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4519 | case 225: |
| 4520 | #line 2100 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4521 | { |
| 4522 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4523 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4524 | ;} |
| 4525 | break; |
| 4526 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4527 | case 226: |
| 4528 | #line 2105 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4529 | { // A reference to a direct constant |
| 4530 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4531 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4532 | ;} |
| 4533 | break; |
| 4534 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4535 | case 227: |
| 4536 | #line 2109 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4537 | { |
| 4538 | (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4539 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4540 | ;} |
| 4541 | break; |
| 4542 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4543 | case 228: |
| 4544 | #line 2113 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4545 | { // Perhaps it's an FP constant? |
| 4546 | (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4547 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4548 | ;} |
| 4549 | break; |
| 4550 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4551 | case 229: |
| 4552 | #line 2117 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4553 | { |
| 4554 | (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4555 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4556 | ;} |
| 4557 | break; |
| 4558 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4559 | case 230: |
| 4560 | #line 2121 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4561 | { |
| 4562 | (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4563 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4564 | ;} |
| 4565 | break; |
| 4566 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4567 | case 231: |
| 4568 | #line 2125 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4569 | { |
| 4570 | (yyval.ValIDVal) = ValID::createNull(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4571 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4572 | ;} |
| 4573 | break; |
| 4574 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4575 | case 232: |
| 4576 | #line 2129 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4577 | { |
| 4578 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4579 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4580 | ;} |
| 4581 | break; |
| 4582 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4583 | case 233: |
| 4584 | #line 2133 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4585 | { // A vector zero constant. |
| 4586 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4587 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4588 | ;} |
| 4589 | break; |
| 4590 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4591 | case 234: |
| 4592 | #line 2137 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4593 | { // Nonempty unsized packed vector |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4594 | const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4595 | int NumElements = (yyvsp[-1].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4596 | |
| 4597 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 4598 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4599 | HandleUpRefs( |
| 4600 | PackedType::get( |
| 4601 | ETy, |
| 4602 | NumElements) |
| 4603 | ) |
| 4604 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4605 | |
| 4606 | // Verify all elements are correct type! |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4607 | for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4608 | if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4609 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4610 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4611 | (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4612 | } |
| 4613 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4614 | (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4615 | delete PTy; delete (yyvsp[-1].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4616 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4617 | ;} |
| 4618 | break; |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4619 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4620 | case 235: |
| 4621 | #line 2162 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4622 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4623 | (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4624 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4625 | ;} |
| 4626 | break; |
| 4627 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4628 | case 236: |
| 4629 | #line 2166 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4630 | { |
| 4631 | char *End = UnEscapeLexed((yyvsp[-2].StrVal), true); |
| 4632 | std::string AsmStr = std::string((yyvsp[-2].StrVal), End); |
| 4633 | End = UnEscapeLexed((yyvsp[0].StrVal), true); |
| 4634 | std::string Constraints = std::string((yyvsp[0].StrVal), End); |
| 4635 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal)); |
| 4636 | free((yyvsp[-2].StrVal)); |
| 4637 | free((yyvsp[0].StrVal)); |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4638 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4639 | ;} |
| 4640 | break; |
| 4641 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4642 | case 237: |
| 4643 | #line 2180 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4644 | { // Is it an integer reference...? |
| 4645 | (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); |
| 4646 | CHECK_FOR_ERROR |
| 4647 | ;} |
| 4648 | break; |
| 4649 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4650 | case 238: |
| 4651 | #line 2184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4652 | { // Is it a named reference...? |
| 4653 | (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); |
| 4654 | CHECK_FOR_ERROR |
| 4655 | ;} |
| 4656 | break; |
| 4657 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4658 | case 241: |
| 4659 | #line 2196 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4660 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4661 | (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4662 | CHECK_FOR_ERROR |
| 4663 | ;} |
| 4664 | break; |
| 4665 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4666 | case 242: |
| 4667 | #line 2201 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4668 | { |
| 4669 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 4670 | CHECK_FOR_ERROR |
| 4671 | ;} |
| 4672 | break; |
| 4673 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4674 | case 243: |
| 4675 | #line 2205 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4676 | { // Do not allow functions with 0 basic blocks |
| 4677 | (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); |
| 4678 | CHECK_FOR_ERROR |
| 4679 | ;} |
| 4680 | break; |
| 4681 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4682 | case 244: |
| 4683 | #line 2214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4684 | { |
| 4685 | setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); |
| 4686 | CHECK_FOR_ERROR |
| 4687 | InsertValue((yyvsp[0].TermInstVal)); |
| 4688 | |
| 4689 | (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); |
| 4690 | InsertValue((yyvsp[-2].BasicBlockVal)); |
| 4691 | (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); |
| 4692 | CHECK_FOR_ERROR |
| 4693 | ;} |
| 4694 | break; |
| 4695 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4696 | case 245: |
| 4697 | #line 2225 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4698 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4699 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal))) |
| 4700 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4701 | if (CI2->getParent() == 0) |
| 4702 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4703 | (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); |
| 4704 | (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); |
| 4705 | CHECK_FOR_ERROR |
| 4706 | ;} |
| 4707 | break; |
| 4708 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4709 | case 246: |
| 4710 | #line 2234 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4711 | { |
| 4712 | (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4713 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4714 | |
| 4715 | // Make sure to move the basic block to the correct location in the |
| 4716 | // function, instead of leaving it inserted wherever it was first |
| 4717 | // referenced. |
| 4718 | Function::BasicBlockListType &BBL = |
| 4719 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4720 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4721 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4722 | ;} |
| 4723 | break; |
| 4724 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4725 | case 247: |
| 4726 | #line 2246 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4727 | { |
| 4728 | (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4729 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4730 | |
| 4731 | // Make sure to move the basic block to the correct location in the |
| 4732 | // function, instead of leaving it inserted wherever it was first |
| 4733 | // referenced. |
| 4734 | Function::BasicBlockListType &BBL = |
| 4735 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4736 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4737 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4738 | ;} |
| 4739 | break; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4740 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4741 | case 248: |
| 4742 | #line 2259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4743 | { // Return with a result... |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4744 | (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4745 | CHECK_FOR_ERROR |
| 4746 | ;} |
| 4747 | break; |
| 4748 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4749 | case 249: |
| 4750 | #line 2263 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4751 | { // Return with no result... |
| 4752 | (yyval.TermInstVal) = new ReturnInst(); |
| 4753 | CHECK_FOR_ERROR |
| 4754 | ;} |
| 4755 | break; |
| 4756 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4757 | case 250: |
| 4758 | #line 2267 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4759 | { // Unconditional Branch... |
| 4760 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4761 | CHECK_FOR_ERROR |
| 4762 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 4763 | ;} |
| 4764 | break; |
| 4765 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4766 | case 251: |
| 4767 | #line 2272 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4768 | { |
| 4769 | BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); |
| 4770 | CHECK_FOR_ERROR |
| 4771 | BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); |
| 4772 | CHECK_FOR_ERROR |
| 4773 | Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); |
| 4774 | CHECK_FOR_ERROR |
| 4775 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 4776 | ;} |
| 4777 | break; |
| 4778 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4779 | case 252: |
| 4780 | #line 2281 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4781 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4782 | Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4783 | CHECK_FOR_ERROR |
| 4784 | BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); |
| 4785 | CHECK_FOR_ERROR |
| 4786 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); |
| 4787 | (yyval.TermInstVal) = S; |
| 4788 | |
| 4789 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(), |
| 4790 | E = (yyvsp[-1].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4791 | for (; I != E; ++I) { |
| 4792 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4793 | S->addCase(CI, I->second); |
| 4794 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4795 | GEN_ERROR("Switch case is constant, but not a simple integer!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4796 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4797 | delete (yyvsp[-1].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4798 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4799 | ;} |
| 4800 | break; |
| 4801 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4802 | case 253: |
| 4803 | #line 2300 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4804 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4805 | Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4806 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4807 | BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4808 | CHECK_FOR_ERROR |
| 4809 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4810 | (yyval.TermInstVal) = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4811 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4812 | ;} |
| 4813 | break; |
| 4814 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4815 | case 254: |
| 4816 | #line 2310 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4817 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4818 | const PointerType *PFTy; |
| 4819 | const FunctionType *Ty; |
| 4820 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4821 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4822 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 4823 | // Pull out the types of all of the arguments... |
| 4824 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4825 | if ((yyvsp[-7].ValueList)) { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4826 | for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4827 | I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4828 | ParamTypes.push_back((*I)->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4829 | } |
| 4830 | |
| 4831 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 4832 | if (isVarArg) ParamTypes.pop_back(); |
| 4833 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4834 | Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4835 | PFTy = PointerType::get(Ty); |
| 4836 | } |
| 4837 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4838 | Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4839 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4840 | BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4841 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4842 | BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4843 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4844 | |
| 4845 | // Create the call node... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4846 | if (!(yyvsp[-7].ValueList)) { // Has no arguments? |
| 4847 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4848 | } else { // Has arguments? |
| 4849 | // Loop through FunctionType's arguments and ensure they are specified |
| 4850 | // correctly! |
| 4851 | // |
| 4852 | FunctionType::param_iterator I = Ty->param_begin(); |
| 4853 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4854 | std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4855 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4856 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) |
| 4857 | if ((*ArgI)->getType() != *I) |
| 4858 | GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + |
| 4859 | (*I)->getDescription() + "'!"); |
| 4860 | |
| 4861 | if (I != E || (ArgI != ArgE && !Ty->isVarArg())) |
| 4862 | GEN_ERROR("Invalid number of parameters detected!"); |
| 4863 | |
| 4864 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4865 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4866 | cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4867 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4868 | delete (yyvsp[-10].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4869 | delete (yyvsp[-7].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4870 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4871 | ;} |
| 4872 | break; |
| 4873 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4874 | case 255: |
| 4875 | #line 2365 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4876 | { |
| 4877 | (yyval.TermInstVal) = new UnwindInst(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4878 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4879 | ;} |
| 4880 | break; |
| 4881 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4882 | case 256: |
| 4883 | #line 2369 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4884 | { |
| 4885 | (yyval.TermInstVal) = new UnreachableInst(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4886 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4887 | ;} |
| 4888 | break; |
| 4889 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4890 | case 257: |
| 4891 | #line 2376 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4892 | { |
| 4893 | (yyval.JumpTable) = (yyvsp[-5].JumpTable); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4894 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4895 | CHECK_FOR_ERROR |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4896 | if (V == 0) |
| 4897 | GEN_ERROR("May only switch on a constant pool value!"); |
| 4898 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4899 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4900 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4901 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 4902 | ;} |
| 4903 | break; |
| 4904 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4905 | case 258: |
| 4906 | #line 2387 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4907 | { |
| 4908 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4909 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4910 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4911 | |
| 4912 | if (V == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4913 | GEN_ERROR("May only switch on a constant pool value!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4914 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4915 | BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4916 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4917 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 4918 | ;} |
| 4919 | break; |
| 4920 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4921 | case 259: |
| 4922 | #line 2400 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4923 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4924 | // Is this definition named?? if so, assign the name... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4925 | setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4926 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4927 | InsertValue((yyvsp[0].InstVal)); |
| 4928 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4929 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4930 | ;} |
| 4931 | break; |
| 4932 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4933 | case 260: |
| 4934 | #line 2409 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4935 | { // Used for PHI nodes |
| 4936 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4937 | Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4938 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4939 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4940 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4941 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4942 | delete (yyvsp[-5].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4943 | ;} |
| 4944 | break; |
| 4945 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4946 | case 261: |
| 4947 | #line 2418 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4948 | { |
| 4949 | (yyval.PHIList) = (yyvsp[-6].PHIList); |
| 4950 | Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4951 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4952 | BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4953 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4954 | (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 4955 | ;} |
| 4956 | break; |
| 4957 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4958 | case 262: |
| 4959 | #line 2428 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4960 | { // Used for call statements, and memory insts... |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4961 | (yyval.ValueList) = new std::vector<Value*>(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4962 | (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); |
| 4963 | ;} |
| 4964 | break; |
| 4965 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4966 | case 263: |
| 4967 | #line 2432 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4968 | { |
| 4969 | (yyval.ValueList) = (yyvsp[-2].ValueList); |
| 4970 | (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4971 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4972 | ;} |
| 4973 | break; |
| 4974 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4975 | case 265: |
| 4976 | #line 2439 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 4977 | { (yyval.ValueList) = 0; ;} |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 4978 | break; |
| 4979 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4980 | case 266: |
| 4981 | #line 2441 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4982 | { |
| 4983 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4984 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4985 | ;} |
| 4986 | break; |
| 4987 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4988 | case 267: |
| 4989 | #line 2445 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4990 | { |
| 4991 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4992 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4993 | ;} |
| 4994 | break; |
| 4995 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4996 | case 268: |
| 4997 | #line 2450 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4998 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 4999 | if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && |
| 5000 | !isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5001 | GEN_ERROR( |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5002 | "Arithmetic operator requires integer, FP, or packed operands!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5003 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && |
| 5004 | ((yyvsp[-4].BinaryOpVal) == Instruction::URem || |
| 5005 | (yyvsp[-4].BinaryOpVal) == Instruction::SRem || |
| 5006 | (yyvsp[-4].BinaryOpVal) == Instruction::FRem)) |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 5007 | GEN_ERROR("U/S/FRem not supported on packed types!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5008 | Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5009 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5010 | Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5011 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5012 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5013 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5014 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5015 | delete (yyvsp[-3].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5016 | ;} |
| 5017 | break; |
| 5018 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5019 | case 269: |
| 5020 | #line 2469 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5021 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5022 | if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { |
| 5023 | if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) || |
| 5024 | !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5025 | GEN_ERROR("Logical operator requires integral operands!"); |
Chris Lattner | 524a131 | 2005-12-21 18:31:50 +0000 | [diff] [blame] | 5026 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5027 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5028 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5029 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5030 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5031 | (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5032 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5033 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5034 | delete (yyvsp[-3].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5035 | ;} |
| 5036 | break; |
| 5037 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5038 | case 270: |
| 5039 | #line 2484 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5040 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5041 | if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5042 | GEN_ERROR( |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5043 | "PackedTypes currently not supported in setcc instructions!"); |
| 5044 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5045 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5046 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5047 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5048 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5049 | (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5050 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5051 | GEN_ERROR("binary operator returned null!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5052 | delete (yyvsp[-3].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5053 | ;} |
| 5054 | break; |
| 5055 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5056 | case 271: |
| 5057 | #line 2498 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5058 | { |
| 5059 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
| 5060 | GEN_ERROR("Packed types not supported by icmp instruction"); |
| 5061 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
| 5062 | CHECK_FOR_ERROR |
| 5063 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
| 5064 | CHECK_FOR_ERROR |
| 5065 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2); |
| 5066 | if ((yyval.InstVal) == 0) |
| 5067 | GEN_ERROR("icmp operator returned null!"); |
| 5068 | ;} |
| 5069 | break; |
| 5070 | |
| 5071 | case 272: |
| 5072 | #line 2509 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
| 5073 | { |
| 5074 | if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) |
| 5075 | GEN_ERROR("Packed types not supported by fcmp instruction"); |
| 5076 | Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); |
| 5077 | CHECK_FOR_ERROR |
| 5078 | Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); |
| 5079 | CHECK_FOR_ERROR |
| 5080 | (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2); |
| 5081 | if ((yyval.InstVal) == 0) |
| 5082 | GEN_ERROR("fcmp operator returned null!"); |
| 5083 | ;} |
| 5084 | break; |
| 5085 | |
| 5086 | case 273: |
| 5087 | #line 2520 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5088 | { |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 5089 | llvm_cerr << "WARNING: Use of eliminated 'not' instruction:" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5090 | << " Replacing with 'xor'.\n"; |
| 5091 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5092 | Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5093 | if (Ones == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5094 | GEN_ERROR("Expected integral type for not instruction!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5095 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5096 | (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5097 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5098 | GEN_ERROR("Could not create a xor instruction!"); |
| 5099 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5100 | ;} |
| 5101 | break; |
| 5102 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5103 | case 274: |
| 5104 | #line 2533 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5105 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5106 | if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5107 | GEN_ERROR("Shift amount must be ubyte!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5108 | if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5109 | GEN_ERROR("Shift constant expression requires integer operand!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5110 | CHECK_FOR_ERROR; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5111 | (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5112 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5113 | ;} |
| 5114 | break; |
| 5115 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5116 | case 275: |
| 5117 | #line 2542 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5118 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5119 | Value* Val = (yyvsp[-2].ValueVal); |
| 5120 | const Type* Ty = (yyvsp[0].TypeVal)->get(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5121 | if (!Val->getType()->isFirstClassType()) |
| 5122 | GEN_ERROR("cast from a non-primitive type: '" + |
| 5123 | Val->getType()->getDescription() + "'!"); |
| 5124 | if (!Ty->isFirstClassType()) |
| 5125 | GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5126 | (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get()); |
| 5127 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5128 | ;} |
| 5129 | break; |
| 5130 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5131 | case 276: |
| 5132 | #line 2553 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5133 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5134 | if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5135 | GEN_ERROR("select condition must be boolean!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5136 | if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5137 | GEN_ERROR("select value types should match!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5138 | (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5139 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5140 | ;} |
| 5141 | break; |
| 5142 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5143 | case 277: |
| 5144 | #line 2561 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5145 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5146 | NewVarArgs = true; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5147 | (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); |
| 5148 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5149 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5150 | ;} |
| 5151 | break; |
| 5152 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5153 | case 278: |
| 5154 | #line 2567 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5155 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5156 | ObsoleteVarArgs = true; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5157 | const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5158 | Function* NF = CurModule.CurrentModule-> |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 5159 | getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5160 | |
| 5161 | //b = vaarg a, t -> |
| 5162 | //foo = alloca 1 of t |
| 5163 | //bar = vacopy a |
| 5164 | //store bar -> foo |
| 5165 | //b = vaarg foo, t |
| 5166 | AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); |
| 5167 | CurBB->getInstList().push_back(foo); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5168 | CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5169 | CurBB->getInstList().push_back(bar); |
| 5170 | CurBB->getInstList().push_back(new StoreInst(bar, foo)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5171 | (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal)); |
| 5172 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5173 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5174 | ;} |
| 5175 | break; |
| 5176 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5177 | case 279: |
| 5178 | #line 2587 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5179 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5180 | ObsoleteVarArgs = true; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5181 | const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5182 | Function* NF = CurModule.CurrentModule-> |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 5183 | getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5184 | |
| 5185 | //b = vanext a, t -> |
| 5186 | //foo = alloca 1 of t |
| 5187 | //bar = vacopy a |
| 5188 | //store bar -> foo |
| 5189 | //tmp = vaarg foo, t |
| 5190 | //b = load foo |
| 5191 | AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); |
| 5192 | CurBB->getInstList().push_back(foo); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5193 | CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5194 | CurBB->getInstList().push_back(bar); |
| 5195 | CurBB->getInstList().push_back(new StoreInst(bar, foo)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5196 | Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5197 | CurBB->getInstList().push_back(tmp); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5198 | (yyval.InstVal) = new LoadInst(foo); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5199 | delete (yyvsp[0].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5200 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5201 | ;} |
| 5202 | break; |
| 5203 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5204 | case 280: |
| 5205 | #line 2610 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5206 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5207 | if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5208 | GEN_ERROR("Invalid extractelement operands!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5209 | (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5210 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5211 | ;} |
| 5212 | break; |
| 5213 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5214 | case 281: |
| 5215 | #line 2616 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5216 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5217 | if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5218 | GEN_ERROR("Invalid insertelement operands!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5219 | (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5220 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5221 | ;} |
| 5222 | break; |
| 5223 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5224 | case 282: |
| 5225 | #line 2622 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5226 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5227 | if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5228 | GEN_ERROR("Invalid shufflevector operands!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5229 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5230 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5231 | ;} |
| 5232 | break; |
| 5233 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5234 | case 283: |
| 5235 | #line 2628 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5236 | { |
| 5237 | const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5238 | if (!Ty->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5239 | GEN_ERROR("PHI node operands must be of first class type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5240 | (yyval.InstVal) = new PHINode(Ty); |
| 5241 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); |
| 5242 | while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { |
| 5243 | if ((yyvsp[0].PHIList)->front().first->getType() != Ty) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5244 | GEN_ERROR("All elements of a PHI node must be of the same type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5245 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); |
| 5246 | (yyvsp[0].PHIList)->pop_front(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5247 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5248 | delete (yyvsp[0].PHIList); // Free the list... |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5249 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5250 | ;} |
| 5251 | break; |
| 5252 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5253 | case 284: |
| 5254 | #line 2643 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5255 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5256 | const PointerType *PFTy = 0; |
| 5257 | const FunctionType *Ty = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5258 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5259 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5260 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5261 | // Pull out the types of all of the arguments... |
| 5262 | std::vector<const Type*> ParamTypes; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5263 | if ((yyvsp[-1].ValueList)) { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5264 | for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5265 | I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5266 | ParamTypes.push_back((*I)->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5267 | } |
| 5268 | |
| 5269 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 5270 | if (isVarArg) ParamTypes.pop_back(); |
| 5271 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5272 | if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5273 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5274 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5275 | Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5276 | PFTy = PointerType::get(Ty); |
| 5277 | } |
| 5278 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5279 | Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5280 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5281 | |
| 5282 | // Create the call node... |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5283 | if (!(yyvsp[-1].ValueList)) { // Has no arguments? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5284 | // Make sure no arguments is a good thing! |
| 5285 | if (Ty->getNumParams() != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5286 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5287 | "expects arguments!"); |
| 5288 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5289 | (yyval.InstVal) = new CallInst(V, std::vector<Value*>()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5290 | } else { // Has arguments? |
| 5291 | // Loop through FunctionType's arguments and ensure they are specified |
| 5292 | // correctly! |
| 5293 | // |
| 5294 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5295 | FunctionType::param_iterator E = Ty->param_end(); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5296 | std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5297 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5298 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) |
| 5299 | if ((*ArgI)->getType() != *I) |
| 5300 | GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + |
| 5301 | (*I)->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5302 | |
| 5303 | if (I != E || (ArgI != ArgE && !Ty->isVarArg())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5304 | GEN_ERROR("Invalid number of parameters detected!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5305 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5306 | (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5307 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5308 | cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal)); |
| 5309 | cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5310 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5311 | delete (yyvsp[-1].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5312 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5313 | ;} |
| 5314 | break; |
| 5315 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5316 | case 285: |
| 5317 | #line 2702 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5318 | { |
| 5319 | (yyval.InstVal) = (yyvsp[0].InstVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5320 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5321 | ;} |
| 5322 | break; |
| 5323 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5324 | case 286: |
| 5325 | #line 2709 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5326 | { |
| 5327 | (yyval.ValueList) = (yyvsp[0].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5328 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5329 | ;} |
| 5330 | break; |
| 5331 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5332 | case 287: |
| 5333 | #line 2712 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5334 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5335 | (yyval.ValueList) = new std::vector<Value*>(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5336 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5337 | ;} |
| 5338 | break; |
| 5339 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5340 | case 288: |
| 5341 | #line 2717 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5342 | { |
| 5343 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5344 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5345 | ;} |
| 5346 | break; |
| 5347 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5348 | case 289: |
| 5349 | #line 2721 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5350 | { |
| 5351 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5352 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5353 | ;} |
| 5354 | break; |
| 5355 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5356 | case 290: |
| 5357 | #line 2728 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5358 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5359 | (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5360 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5361 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5362 | ;} |
| 5363 | break; |
| 5364 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5365 | case 291: |
| 5366 | #line 2733 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5367 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5368 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5369 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5370 | (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5371 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5372 | ;} |
| 5373 | break; |
| 5374 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5375 | case 292: |
| 5376 | #line 2739 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5377 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5378 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); |
| 5379 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5380 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5381 | ;} |
| 5382 | break; |
| 5383 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5384 | case 293: |
| 5385 | #line 2744 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5386 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5387 | Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5388 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5389 | (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); |
| 5390 | delete (yyvsp[-4].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5391 | ;} |
| 5392 | break; |
| 5393 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5394 | case 294: |
| 5395 | #line 2750 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5396 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5397 | if (!isa<PointerType>((yyvsp[0].ValueVal)->getType())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5398 | GEN_ERROR("Trying to free nonpointer type " + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5399 | (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); |
| 5400 | (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5401 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5402 | ;} |
| 5403 | break; |
| 5404 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5405 | case 295: |
| 5406 | #line 2758 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5407 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5408 | if (!isa<PointerType>((yyvsp[-1].TypeVal)->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5409 | GEN_ERROR("Can't load from nonpointer type: " + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5410 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5411 | if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5412 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5413 | (*(yyvsp[-1].TypeVal))->getDescription()); |
| 5414 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5415 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5416 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5417 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5418 | ;} |
| 5419 | break; |
| 5420 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5421 | case 296: |
| 5422 | #line 2770 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5423 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5424 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5425 | if (!PT) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5426 | GEN_ERROR("Can't store to a nonpointer type: " + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5427 | (*(yyvsp[-1].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5428 | const Type *ElTy = PT->getElementType(); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5429 | if (ElTy != (yyvsp[-3].ValueVal)->getType()) |
| 5430 | GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5431 | "' into space of type '" + ElTy->getDescription() + "'!"); |
| 5432 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5433 | Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5434 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5435 | (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); |
| 5436 | delete (yyvsp[-1].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5437 | ;} |
| 5438 | break; |
| 5439 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5440 | case 297: |
| 5441 | #line 2785 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5442 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5443 | if (!isa<PointerType>((yyvsp[-2].TypeVal)->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5444 | GEN_ERROR("getelementptr insn requires pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5445 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5446 | // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct |
| 5447 | // indices to uint struct indices for compatibility. |
| 5448 | generic_gep_type_iterator<std::vector<Value*>::iterator> |
| 5449 | GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()), |
| 5450 | GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()); |
| 5451 | for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) |
| 5452 | if (isa<StructType>(*GTI)) // Only change struct indices |
| 5453 | if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[0].ValueList))[i])) |
| 5454 | if (CUI->getType() == Type::UByteTy) |
| 5455 | (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5456 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5457 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5458 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5459 | (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); |
| 5460 | Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5461 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5462 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); |
| 5463 | delete (yyvsp[-2].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5464 | delete (yyvsp[0].ValueList); |
| 5465 | ;} |
| 5466 | break; |
| 5467 | |
| 5468 | |
| 5469 | default: break; |
| 5470 | } |
| 5471 | |
| 5472 | /* Line 1126 of yacc.c. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5473 | #line 5474 "llvmAsmParser.tab.c" |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5474 | |
| 5475 | yyvsp -= yylen; |
| 5476 | yyssp -= yylen; |
| 5477 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5478 | |
| 5479 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5480 | |
| 5481 | *++yyvsp = yyval; |
| 5482 | |
| 5483 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5484 | /* Now `shift' the result of the reduction. Determine what state |
| 5485 | that goes to, based on the state we popped back to and the rule |
| 5486 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5487 | |
| 5488 | yyn = yyr1[yyn]; |
| 5489 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5490 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5491 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5492 | yystate = yytable[yystate]; |
| 5493 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5494 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5495 | |
| 5496 | goto yynewstate; |
| 5497 | |
| 5498 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5499 | /*------------------------------------. |
| 5500 | | yyerrlab -- here on detecting error | |
| 5501 | `------------------------------------*/ |
| 5502 | yyerrlab: |
| 5503 | /* If not already recovering from an error, report this error. */ |
| 5504 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5505 | { |
| 5506 | ++yynerrs; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5507 | #if YYERROR_VERBOSE |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5508 | yyn = yypact[yystate]; |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 5509 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5510 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5511 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5512 | int yytype = YYTRANSLATE (yychar); |
| 5513 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 5514 | YYSIZE_T yysize = yysize0; |
| 5515 | YYSIZE_T yysize1; |
| 5516 | int yysize_overflow = 0; |
| 5517 | char *yymsg = 0; |
| 5518 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 |
| 5519 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 5520 | int yyx; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5521 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5522 | #if 0 |
| 5523 | /* This is so xgettext sees the translatable formats that are |
| 5524 | constructed on the fly. */ |
| 5525 | YY_("syntax error, unexpected %s"); |
| 5526 | YY_("syntax error, unexpected %s, expecting %s"); |
| 5527 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 5528 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 5529 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 5530 | #endif |
| 5531 | char *yyfmt; |
| 5532 | char const *yyf; |
| 5533 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 5534 | static char const yyexpecting[] = ", expecting %s"; |
| 5535 | static char const yyor[] = " or %s"; |
| 5536 | char yyformat[sizeof yyunexpected |
| 5537 | + sizeof yyexpecting - 1 |
| 5538 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 5539 | * (sizeof yyor - 1))]; |
| 5540 | char const *yyprefix = yyexpecting; |
| 5541 | |
| 5542 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 5543 | YYCHECK. */ |
| 5544 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 5545 | |
| 5546 | /* Stay within bounds of both yycheck and yytname. */ |
| 5547 | int yychecklim = YYLAST - yyn; |
| 5548 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 5549 | int yycount = 1; |
| 5550 | |
| 5551 | yyarg[0] = yytname[yytype]; |
| 5552 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 5553 | |
| 5554 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 5555 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 5556 | { |
| 5557 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 5558 | { |
| 5559 | yycount = 1; |
| 5560 | yysize = yysize0; |
| 5561 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 5562 | break; |
| 5563 | } |
| 5564 | yyarg[yycount++] = yytname[yyx]; |
| 5565 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 5566 | yysize_overflow |= yysize1 < yysize; |
| 5567 | yysize = yysize1; |
| 5568 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 5569 | yyprefix = yyor; |
| 5570 | } |
| 5571 | |
| 5572 | yyf = YY_(yyformat); |
| 5573 | yysize1 = yysize + yystrlen (yyf); |
| 5574 | yysize_overflow |= yysize1 < yysize; |
| 5575 | yysize = yysize1; |
| 5576 | |
| 5577 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) |
| 5578 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 5579 | if (yymsg) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5580 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5581 | /* Avoid sprintf, as that infringes on the user's name space. |
| 5582 | Don't have undefined behavior even if the translation |
| 5583 | produced a string with the wrong number of "%s"s. */ |
| 5584 | char *yyp = yymsg; |
| 5585 | int yyi = 0; |
| 5586 | while ((*yyp = *yyf)) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5587 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5588 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 5589 | { |
| 5590 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 5591 | yyf += 2; |
| 5592 | } |
| 5593 | else |
| 5594 | { |
| 5595 | yyp++; |
| 5596 | yyf++; |
| 5597 | } |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5598 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5599 | yyerror (yymsg); |
| 5600 | YYSTACK_FREE (yymsg); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5601 | } |
| 5602 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5603 | { |
| 5604 | yyerror (YY_("syntax error")); |
| 5605 | goto yyexhaustedlab; |
| 5606 | } |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5607 | } |
| 5608 | else |
| 5609 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5610 | yyerror (YY_("syntax error")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5611 | } |
| 5612 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5613 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5614 | |
| 5615 | if (yyerrstatus == 3) |
| 5616 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5617 | /* If just tried and failed to reuse look-ahead token after an |
| 5618 | error, discard it. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5619 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5620 | if (yychar <= YYEOF) |
| 5621 | { |
| 5622 | /* Return failure if at end of input. */ |
| 5623 | if (yychar == YYEOF) |
| 5624 | YYABORT; |
| 5625 | } |
| 5626 | else |
| 5627 | { |
| 5628 | yydestruct ("Error: discarding", yytoken, &yylval); |
| 5629 | yychar = YYEMPTY; |
| 5630 | } |
| 5631 | } |
| 5632 | |
| 5633 | /* Else will try to reuse look-ahead token after shifting the error |
| 5634 | token. */ |
| 5635 | goto yyerrlab1; |
| 5636 | |
| 5637 | |
| 5638 | /*---------------------------------------------------. |
| 5639 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5640 | `---------------------------------------------------*/ |
| 5641 | yyerrorlab: |
| 5642 | |
| 5643 | /* Pacify compilers like GCC when the user code never invokes |
| 5644 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5645 | code. */ |
| 5646 | if (0) |
| 5647 | goto yyerrorlab; |
| 5648 | |
| 5649 | yyvsp -= yylen; |
| 5650 | yyssp -= yylen; |
| 5651 | yystate = *yyssp; |
| 5652 | goto yyerrlab1; |
| 5653 | |
| 5654 | |
| 5655 | /*-------------------------------------------------------------. |
| 5656 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5657 | `-------------------------------------------------------------*/ |
| 5658 | yyerrlab1: |
| 5659 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5660 | |
| 5661 | for (;;) |
| 5662 | { |
| 5663 | yyn = yypact[yystate]; |
| 5664 | if (yyn != YYPACT_NINF) |
| 5665 | { |
| 5666 | yyn += YYTERROR; |
| 5667 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5668 | { |
| 5669 | yyn = yytable[yyn]; |
| 5670 | if (0 < yyn) |
| 5671 | break; |
| 5672 | } |
| 5673 | } |
| 5674 | |
| 5675 | /* Pop the current state because it cannot handle the error token. */ |
| 5676 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5677 | YYABORT; |
| 5678 | |
Chris Lattner | 8335e84 | 2006-01-23 23:05:42 +0000 | [diff] [blame] | 5679 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5680 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 5681 | YYPOPSTACK; |
| 5682 | yystate = *yyssp; |
| 5683 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5684 | } |
| 5685 | |
| 5686 | if (yyn == YYFINAL) |
| 5687 | YYACCEPT; |
| 5688 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5689 | *++yyvsp = yylval; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5690 | |
| 5691 | |
| 5692 | /* Shift the error token. */ |
| 5693 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5694 | |
| 5695 | yystate = yyn; |
| 5696 | goto yynewstate; |
| 5697 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5698 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5699 | /*-------------------------------------. |
| 5700 | | yyacceptlab -- YYACCEPT comes here. | |
| 5701 | `-------------------------------------*/ |
| 5702 | yyacceptlab: |
| 5703 | yyresult = 0; |
| 5704 | goto yyreturn; |
| 5705 | |
| 5706 | /*-----------------------------------. |
| 5707 | | yyabortlab -- YYABORT comes here. | |
| 5708 | `-----------------------------------*/ |
| 5709 | yyabortlab: |
| 5710 | yyresult = 1; |
| 5711 | goto yyreturn; |
| 5712 | |
| 5713 | #ifndef yyoverflow |
| 5714 | /*-------------------------------------------------. |
| 5715 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5716 | `-------------------------------------------------*/ |
| 5717 | yyexhaustedlab: |
| 5718 | yyerror (YY_("memory exhausted")); |
| 5719 | yyresult = 2; |
| 5720 | /* Fall through. */ |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5721 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5722 | |
| 5723 | yyreturn: |
| 5724 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5725 | yydestruct ("Cleanup: discarding lookahead", |
| 5726 | yytoken, &yylval); |
| 5727 | while (yyssp != yyss) |
| 5728 | { |
| 5729 | yydestruct ("Cleanup: popping", |
| 5730 | yystos[*yyssp], yyvsp); |
| 5731 | YYPOPSTACK; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5732 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5733 | #ifndef yyoverflow |
| 5734 | if (yyss != yyssa) |
| 5735 | YYSTACK_FREE (yyss); |
| 5736 | #endif |
| 5737 | return yyresult; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5738 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5739 | |
| 5740 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame^] | 5741 | #line 2811 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5742 | |
| 5743 | |
| 5744 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5745 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5746 | // TODO: column number in exception |
| 5747 | if (TheParseError) |
| 5748 | TheParseError->setError(CurFilename, message, LineNo); |
| 5749 | TriggerError = 1; |
| 5750 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5751 | |
| 5752 | int yyerror(const char *ErrorMsg) { |
| 5753 | std::string where |
| 5754 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5755 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5756 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5757 | if (yychar == YYEMPTY || yychar == 0) |
| 5758 | errMsg += "end-of-file."; |
| 5759 | else |
| 5760 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5761 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5762 | return 0; |
| 5763 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5764 | |