Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1 | /* A Bison parser, made by GNU Bison 2.3. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
| 4 | |
| 5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 |
| 6 | Free Software Foundation, Inc. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; either version 2, or (at your option) |
| 11 | any later version. |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 12 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program; if not, write to the Free Software |
| 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 | Boston, MA 02110-1301, USA. */ |
| 22 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 23 | /* As a special exception, you may create a larger work that contains |
| 24 | part or all of the Bison parser skeleton and distribute that work |
| 25 | under terms of your choice, so long as that work isn't itself a |
| 26 | parser generator using the skeleton or a modified version thereof |
| 27 | as a parser skeleton. Alternatively, if you modify or redistribute |
| 28 | the parser skeleton itself, you may (at your option) remove this |
| 29 | special exception, which will cause the skeleton and the resulting |
| 30 | Bison output files to be licensed under the GNU General Public |
| 31 | License without this special exception. |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 32 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 33 | This special exception was added by the Free Software Foundation in |
| 34 | version 2.2 of Bison. */ |
| 35 | |
| 36 | /* C LALR(1) parser skeleton written by Richard Stallman, by |
| 37 | simplifying the original so-called "semantic" parser. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 38 | |
| 39 | /* All symbols defined below should begin with yy or YY, to avoid |
| 40 | infringing on user name space. This should be done even for local |
| 41 | variables, as they might otherwise be expanded by user macros. |
| 42 | There are some unavoidable exceptions within include files to |
| 43 | define necessary library symbols; they are noted "INFRINGES ON |
| 44 | USER NAME SPACE" below. */ |
| 45 | |
| 46 | /* Identify Bison output. */ |
| 47 | #define YYBISON 1 |
| 48 | |
| 49 | /* Bison version. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 50 | #define YYBISON_VERSION "2.3" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 51 | |
| 52 | /* Skeleton name. */ |
| 53 | #define YYSKELETON_NAME "yacc.c" |
| 54 | |
| 55 | /* Pure parsers. */ |
| 56 | #define YYPURE 0 |
| 57 | |
| 58 | /* Using locations. */ |
| 59 | #define YYLSP_NEEDED 0 |
| 60 | |
| 61 | /* Substitute the variable and function names. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 62 | #define yyparse llvmAsmparse |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 63 | #define yylex llvmAsmlex |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 64 | #define yyerror llvmAsmerror |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 65 | #define yylval llvmAsmlval |
| 66 | #define yychar llvmAsmchar |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 67 | #define yydebug llvmAsmdebug |
| 68 | #define yynerrs llvmAsmnerrs |
| 69 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 70 | |
| 71 | /* Tokens. */ |
| 72 | #ifndef YYTOKENTYPE |
| 73 | # define YYTOKENTYPE |
| 74 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 75 | know about them. */ |
| 76 | enum yytokentype { |
| 77 | ESINT64VAL = 258, |
| 78 | EUINT64VAL = 259, |
| 79 | SINTVAL = 260, |
| 80 | UINTVAL = 261, |
| 81 | FPVAL = 262, |
| 82 | VOID = 263, |
| 83 | BOOL = 264, |
| 84 | SBYTE = 265, |
| 85 | UBYTE = 266, |
| 86 | SHORT = 267, |
| 87 | USHORT = 268, |
| 88 | INT = 269, |
| 89 | UINT = 270, |
| 90 | LONG = 271, |
| 91 | ULONG = 272, |
| 92 | FLOAT = 273, |
| 93 | DOUBLE = 274, |
| 94 | TYPE = 275, |
| 95 | LABEL = 276, |
| 96 | VAR_ID = 277, |
| 97 | LABELSTR = 278, |
| 98 | STRINGCONSTANT = 279, |
| 99 | IMPLEMENTATION = 280, |
| 100 | ZEROINITIALIZER = 281, |
| 101 | TRUETOK = 282, |
| 102 | FALSETOK = 283, |
| 103 | BEGINTOK = 284, |
| 104 | ENDTOK = 285, |
| 105 | DECLARE = 286, |
| 106 | GLOBAL = 287, |
| 107 | CONSTANT = 288, |
| 108 | SECTION = 289, |
| 109 | VOLATILE = 290, |
| 110 | TO = 291, |
| 111 | DOTDOTDOT = 292, |
| 112 | NULL_TOK = 293, |
| 113 | UNDEF = 294, |
| 114 | CONST = 295, |
| 115 | INTERNAL = 296, |
| 116 | LINKONCE = 297, |
| 117 | WEAK = 298, |
| 118 | APPENDING = 299, |
| 119 | DLLIMPORT = 300, |
| 120 | DLLEXPORT = 301, |
| 121 | EXTERN_WEAK = 302, |
| 122 | OPAQUE = 303, |
| 123 | NOT = 304, |
| 124 | EXTERNAL = 305, |
| 125 | TARGET = 306, |
| 126 | TRIPLE = 307, |
| 127 | ENDIAN = 308, |
| 128 | POINTERSIZE = 309, |
| 129 | LITTLE = 310, |
| 130 | BIG = 311, |
| 131 | ALIGN = 312, |
| 132 | DEPLIBS = 313, |
| 133 | CALL = 314, |
| 134 | TAIL = 315, |
| 135 | ASM_TOK = 316, |
| 136 | MODULE = 317, |
| 137 | SIDEEFFECT = 318, |
| 138 | CC_TOK = 319, |
| 139 | CCC_TOK = 320, |
| 140 | CSRETCC_TOK = 321, |
| 141 | FASTCC_TOK = 322, |
| 142 | COLDCC_TOK = 323, |
| 143 | X86_STDCALLCC_TOK = 324, |
| 144 | X86_FASTCALLCC_TOK = 325, |
| 145 | DATALAYOUT = 326, |
| 146 | RET = 327, |
| 147 | BR = 328, |
| 148 | SWITCH = 329, |
| 149 | INVOKE = 330, |
| 150 | UNWIND = 331, |
| 151 | UNREACHABLE = 332, |
| 152 | ADD = 333, |
| 153 | SUB = 334, |
| 154 | MUL = 335, |
| 155 | UDIV = 336, |
| 156 | SDIV = 337, |
| 157 | FDIV = 338, |
| 158 | UREM = 339, |
| 159 | SREM = 340, |
| 160 | FREM = 341, |
| 161 | AND = 342, |
| 162 | OR = 343, |
| 163 | XOR = 344, |
| 164 | SETLE = 345, |
| 165 | SETGE = 346, |
| 166 | SETLT = 347, |
| 167 | SETGT = 348, |
| 168 | SETEQ = 349, |
| 169 | SETNE = 350, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 170 | ICMP = 351, |
| 171 | FCMP = 352, |
| 172 | EQ = 353, |
| 173 | NE = 354, |
| 174 | SLT = 355, |
| 175 | SGT = 356, |
| 176 | SLE = 357, |
| 177 | SGE = 358, |
| 178 | ULT = 359, |
| 179 | UGT = 360, |
| 180 | ULE = 361, |
| 181 | UGE = 362, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 182 | OEQ = 363, |
| 183 | ONE = 364, |
| 184 | OLT = 365, |
| 185 | OGT = 366, |
| 186 | OLE = 367, |
| 187 | OGE = 368, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 188 | ORD = 369, |
| 189 | UNO = 370, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 190 | UEQ = 371, |
| 191 | UNE = 372, |
| 192 | MALLOC = 373, |
| 193 | ALLOCA = 374, |
| 194 | FREE = 375, |
| 195 | LOAD = 376, |
| 196 | STORE = 377, |
| 197 | GETELEMENTPTR = 378, |
| 198 | TRUNC = 379, |
| 199 | ZEXT = 380, |
| 200 | SEXT = 381, |
| 201 | FPTRUNC = 382, |
| 202 | FPEXT = 383, |
| 203 | BITCAST = 384, |
| 204 | UITOFP = 385, |
| 205 | SITOFP = 386, |
| 206 | FPTOUI = 387, |
| 207 | FPTOSI = 388, |
| 208 | INTTOPTR = 389, |
| 209 | PTRTOINT = 390, |
| 210 | PHI_TOK = 391, |
| 211 | SELECT = 392, |
| 212 | SHL = 393, |
| 213 | LSHR = 394, |
| 214 | ASHR = 395, |
| 215 | VAARG = 396, |
| 216 | EXTRACTELEMENT = 397, |
| 217 | INSERTELEMENT = 398, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 218 | SHUFFLEVECTOR = 399 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 219 | }; |
| 220 | #endif |
| 221 | /* Tokens. */ |
| 222 | #define ESINT64VAL 258 |
| 223 | #define EUINT64VAL 259 |
| 224 | #define SINTVAL 260 |
| 225 | #define UINTVAL 261 |
| 226 | #define FPVAL 262 |
| 227 | #define VOID 263 |
| 228 | #define BOOL 264 |
| 229 | #define SBYTE 265 |
| 230 | #define UBYTE 266 |
| 231 | #define SHORT 267 |
| 232 | #define USHORT 268 |
| 233 | #define INT 269 |
| 234 | #define UINT 270 |
| 235 | #define LONG 271 |
| 236 | #define ULONG 272 |
| 237 | #define FLOAT 273 |
| 238 | #define DOUBLE 274 |
| 239 | #define TYPE 275 |
| 240 | #define LABEL 276 |
| 241 | #define VAR_ID 277 |
| 242 | #define LABELSTR 278 |
| 243 | #define STRINGCONSTANT 279 |
| 244 | #define IMPLEMENTATION 280 |
| 245 | #define ZEROINITIALIZER 281 |
| 246 | #define TRUETOK 282 |
| 247 | #define FALSETOK 283 |
| 248 | #define BEGINTOK 284 |
| 249 | #define ENDTOK 285 |
| 250 | #define DECLARE 286 |
| 251 | #define GLOBAL 287 |
| 252 | #define CONSTANT 288 |
| 253 | #define SECTION 289 |
| 254 | #define VOLATILE 290 |
| 255 | #define TO 291 |
| 256 | #define DOTDOTDOT 292 |
| 257 | #define NULL_TOK 293 |
| 258 | #define UNDEF 294 |
| 259 | #define CONST 295 |
| 260 | #define INTERNAL 296 |
| 261 | #define LINKONCE 297 |
| 262 | #define WEAK 298 |
| 263 | #define APPENDING 299 |
| 264 | #define DLLIMPORT 300 |
| 265 | #define DLLEXPORT 301 |
| 266 | #define EXTERN_WEAK 302 |
| 267 | #define OPAQUE 303 |
| 268 | #define NOT 304 |
| 269 | #define EXTERNAL 305 |
| 270 | #define TARGET 306 |
| 271 | #define TRIPLE 307 |
| 272 | #define ENDIAN 308 |
| 273 | #define POINTERSIZE 309 |
| 274 | #define LITTLE 310 |
| 275 | #define BIG 311 |
| 276 | #define ALIGN 312 |
| 277 | #define DEPLIBS 313 |
| 278 | #define CALL 314 |
| 279 | #define TAIL 315 |
| 280 | #define ASM_TOK 316 |
| 281 | #define MODULE 317 |
| 282 | #define SIDEEFFECT 318 |
| 283 | #define CC_TOK 319 |
| 284 | #define CCC_TOK 320 |
| 285 | #define CSRETCC_TOK 321 |
| 286 | #define FASTCC_TOK 322 |
| 287 | #define COLDCC_TOK 323 |
| 288 | #define X86_STDCALLCC_TOK 324 |
| 289 | #define X86_FASTCALLCC_TOK 325 |
| 290 | #define DATALAYOUT 326 |
| 291 | #define RET 327 |
| 292 | #define BR 328 |
| 293 | #define SWITCH 329 |
| 294 | #define INVOKE 330 |
| 295 | #define UNWIND 331 |
| 296 | #define UNREACHABLE 332 |
| 297 | #define ADD 333 |
| 298 | #define SUB 334 |
| 299 | #define MUL 335 |
| 300 | #define UDIV 336 |
| 301 | #define SDIV 337 |
| 302 | #define FDIV 338 |
| 303 | #define UREM 339 |
| 304 | #define SREM 340 |
| 305 | #define FREM 341 |
| 306 | #define AND 342 |
| 307 | #define OR 343 |
| 308 | #define XOR 344 |
| 309 | #define SETLE 345 |
| 310 | #define SETGE 346 |
| 311 | #define SETLT 347 |
| 312 | #define SETGT 348 |
| 313 | #define SETEQ 349 |
| 314 | #define SETNE 350 |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 315 | #define ICMP 351 |
| 316 | #define FCMP 352 |
| 317 | #define EQ 353 |
| 318 | #define NE 354 |
| 319 | #define SLT 355 |
| 320 | #define SGT 356 |
| 321 | #define SLE 357 |
| 322 | #define SGE 358 |
| 323 | #define ULT 359 |
| 324 | #define UGT 360 |
| 325 | #define ULE 361 |
| 326 | #define UGE 362 |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 327 | #define OEQ 363 |
| 328 | #define ONE 364 |
| 329 | #define OLT 365 |
| 330 | #define OGT 366 |
| 331 | #define OLE 367 |
| 332 | #define OGE 368 |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 333 | #define ORD 369 |
| 334 | #define UNO 370 |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 335 | #define UEQ 371 |
| 336 | #define UNE 372 |
| 337 | #define MALLOC 373 |
| 338 | #define ALLOCA 374 |
| 339 | #define FREE 375 |
| 340 | #define LOAD 376 |
| 341 | #define STORE 377 |
| 342 | #define GETELEMENTPTR 378 |
| 343 | #define TRUNC 379 |
| 344 | #define ZEXT 380 |
| 345 | #define SEXT 381 |
| 346 | #define FPTRUNC 382 |
| 347 | #define FPEXT 383 |
| 348 | #define BITCAST 384 |
| 349 | #define UITOFP 385 |
| 350 | #define SITOFP 386 |
| 351 | #define FPTOUI 387 |
| 352 | #define FPTOSI 388 |
| 353 | #define INTTOPTR 389 |
| 354 | #define PTRTOINT 390 |
| 355 | #define PHI_TOK 391 |
| 356 | #define SELECT 392 |
| 357 | #define SHL 393 |
| 358 | #define LSHR 394 |
| 359 | #define ASHR 395 |
| 360 | #define VAARG 396 |
| 361 | #define EXTRACTELEMENT 397 |
| 362 | #define INSERTELEMENT 398 |
| 363 | #define SHUFFLEVECTOR 399 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | /* Copy the first part of user declarations. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 369 | #line 14 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 370 | |
| 371 | #include "ParserInternals.h" |
| 372 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 373 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 374 | #include "llvm/Instructions.h" |
| 375 | #include "llvm/Module.h" |
| 376 | #include "llvm/SymbolTable.h" |
| 377 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
| 378 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 379 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 380 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 381 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 382 | #include <list> |
| 383 | #include <utility> |
| 384 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 385 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 386 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 387 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 388 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 389 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 390 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 391 | // GenerateError are made from inside productions and they must simulate the |
| 392 | // previous exception behavior by exiting the production immediately. We have |
| 393 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 394 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 395 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 396 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 397 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 398 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 399 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 400 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 401 | int yylex(); // declaration" of xxx warnings. |
| 402 | int yyparse(); |
| 403 | |
| 404 | namespace llvm { |
| 405 | std::string CurFilename; |
| 406 | } |
| 407 | using namespace llvm; |
| 408 | |
| 409 | static Module *ParserResult; |
| 410 | |
| 411 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 412 | // relating to upreferences in the input stream. |
| 413 | // |
| 414 | //#define DEBUG_UPREFS 1 |
| 415 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 416 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 417 | #else |
| 418 | #define UR_OUT(X) |
| 419 | #endif |
| 420 | |
| 421 | #define YYERROR_VERBOSE 1 |
| 422 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 423 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 424 | |
| 425 | |
| 426 | // This contains info used when building the body of a function. It is |
| 427 | // destroyed when the function is completed. |
| 428 | // |
| 429 | typedef std::vector<Value *> ValueList; // Numbered defs |
| 430 | static void |
| 431 | ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers, |
| 432 | std::map<const Type *,ValueList> *FutureLateResolvers = 0); |
| 433 | |
| 434 | static struct PerModuleInfo { |
| 435 | Module *CurrentModule; |
| 436 | std::map<const Type *, ValueList> Values; // Module level numbered definitions |
| 437 | std::map<const Type *,ValueList> LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 438 | std::vector<PATypeHolder> Types; |
| 439 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 440 | |
| 441 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 442 | /// 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] | 443 | /// that we can resolve them later and print error messages as appropriate. |
| 444 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 445 | |
| 446 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 447 | // references to global values. Global values may be referenced before they |
| 448 | // are defined, and if so, the temporary object that they represent is held |
| 449 | // here. This is used for forward references of GlobalValues. |
| 450 | // |
| 451 | typedef std::map<std::pair<const PointerType *, |
| 452 | ValID>, GlobalValue*> GlobalRefsType; |
| 453 | GlobalRefsType GlobalRefs; |
| 454 | |
| 455 | void ModuleDone() { |
| 456 | // If we could not resolve some functions at function compilation time |
| 457 | // (calls to functions before they are defined), resolve them now... Types |
| 458 | // are resolved when the constant pool has been completely parsed. |
| 459 | // |
| 460 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 461 | if (TriggerError) |
| 462 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 463 | |
| 464 | // Check to make sure that all global value forward references have been |
| 465 | // resolved! |
| 466 | // |
| 467 | if (!GlobalRefs.empty()) { |
| 468 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 469 | |
| 470 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 471 | I != E; ++I) { |
| 472 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 473 | I->first.second.getName() + "\n"; |
| 474 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 475 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 476 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | Values.clear(); // Clear out function local definitions |
| 480 | Types.clear(); |
| 481 | CurrentModule = 0; |
| 482 | } |
| 483 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 484 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 485 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 486 | // If not, just return null. |
| 487 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 488 | // Check to see if there is a forward reference to this global variable... |
| 489 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 490 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 491 | GlobalValue *Ret = 0; |
| 492 | if (I != GlobalRefs.end()) { |
| 493 | Ret = I->second; |
| 494 | GlobalRefs.erase(I); |
| 495 | } |
| 496 | return Ret; |
| 497 | } |
| 498 | } CurModule; |
| 499 | |
| 500 | static struct PerFunctionInfo { |
| 501 | Function *CurrentFunction; // Pointer to current function being created |
| 502 | |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 503 | std::map<const Type*, ValueList> Values; // Keep track of #'d definitions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 504 | std::map<const Type*, ValueList> LateResolveValues; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 505 | bool isDeclare; // Is this function a forward declararation? |
| 506 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 507 | |
| 508 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 509 | /// track of them here. |
| 510 | std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs; |
| 511 | std::vector<BasicBlock*> NumberedBlocks; |
| 512 | unsigned NextBBNum; |
| 513 | |
| 514 | inline PerFunctionInfo() { |
| 515 | CurrentFunction = 0; |
| 516 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 517 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | inline void FunctionStart(Function *M) { |
| 521 | CurrentFunction = M; |
| 522 | NextBBNum = 0; |
| 523 | } |
| 524 | |
| 525 | void FunctionDone() { |
| 526 | NumberedBlocks.clear(); |
| 527 | |
| 528 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 529 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 530 | GenerateError("Undefined reference to label " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 531 | BBForwardRefs.begin()->first->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 532 | return; |
| 533 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 534 | |
| 535 | // Resolve all forward references now. |
| 536 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 537 | |
| 538 | Values.clear(); // Clear out function local definitions |
| 539 | CurrentFunction = 0; |
| 540 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 541 | Linkage = GlobalValue::ExternalLinkage; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 542 | } |
| 543 | } CurFun; // Info for the current function... |
| 544 | |
| 545 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 546 | |
| 547 | |
| 548 | //===----------------------------------------------------------------------===// |
| 549 | // Code to handle definitions of all the types |
| 550 | //===----------------------------------------------------------------------===// |
| 551 | |
| 552 | static int InsertValue(Value *V, |
| 553 | std::map<const Type*,ValueList> &ValueTab = CurFun.Values) { |
| 554 | if (V->hasName()) return -1; // Is this a numbered definition? |
| 555 | |
| 556 | // Yes, insert the value into the value table... |
| 557 | ValueList &List = ValueTab[V->getType()]; |
| 558 | List.push_back(V); |
| 559 | return List.size()-1; |
| 560 | } |
| 561 | |
| 562 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 563 | switch (D.Type) { |
| 564 | case ValID::NumberVal: // Is it a numbered definition? |
| 565 | // Module constants occupy the lowest numbered slots... |
| 566 | if ((unsigned)D.Num < CurModule.Types.size()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 567 | return CurModule.Types[(unsigned)D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 568 | break; |
| 569 | case ValID::NameVal: // Is it a named definition? |
| 570 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { |
| 571 | D.destroy(); // Free old strdup'd memory... |
| 572 | return N; |
| 573 | } |
| 574 | break; |
| 575 | default: |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 576 | GenerateError("Internal parser error: Invalid symbol type reference!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 577 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | // If we reached here, we referenced either a symbol that we don't know about |
| 581 | // or an id number that hasn't been read yet. We may be referencing something |
| 582 | // forward, so just create an entry to be resolved later and get to it... |
| 583 | // |
| 584 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 585 | |
| 586 | |
| 587 | if (inFunctionScope()) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 588 | if (D.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 589 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 590 | return 0; |
| 591 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 592 | GenerateError("Reference to an undefined type: #" + itostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 593 | return 0; |
| 594 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 595 | } |
| 596 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 597 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 598 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 599 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 600 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 601 | Type *Typ = OpaqueType::get(); |
| 602 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 603 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 604 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 605 | |
| 606 | static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { |
| 607 | SymbolTable &SymTab = |
| 608 | inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : |
| 609 | CurModule.CurrentModule->getSymbolTable(); |
| 610 | return SymTab.lookup(Ty, Name); |
| 611 | } |
| 612 | |
| 613 | // getValNonImprovising - Look up the value specified by the provided type and |
| 614 | // the provided ValID. If the value exists and has already been defined, return |
| 615 | // it. Otherwise return null. |
| 616 | // |
| 617 | static Value *getValNonImprovising(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 618 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 619 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 620 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 621 | return 0; |
| 622 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 623 | |
| 624 | switch (D.Type) { |
| 625 | case ValID::NumberVal: { // Is it a numbered definition? |
| 626 | unsigned Num = (unsigned)D.Num; |
| 627 | |
| 628 | // Module constants occupy the lowest numbered slots... |
| 629 | std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty); |
| 630 | if (VI != CurModule.Values.end()) { |
| 631 | if (Num < VI->second.size()) |
| 632 | return VI->second[Num]; |
| 633 | Num -= VI->second.size(); |
| 634 | } |
| 635 | |
| 636 | // Make sure that our type is within bounds |
| 637 | VI = CurFun.Values.find(Ty); |
| 638 | if (VI == CurFun.Values.end()) return 0; |
| 639 | |
| 640 | // Check that the number is within bounds... |
| 641 | if (VI->second.size() <= Num) return 0; |
| 642 | |
| 643 | return VI->second[Num]; |
| 644 | } |
| 645 | |
| 646 | case ValID::NameVal: { // Is it a named definition? |
| 647 | Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); |
| 648 | if (N == 0) return 0; |
| 649 | |
| 650 | D.destroy(); // Free old strdup'd memory... |
| 651 | return N; |
| 652 | } |
| 653 | |
| 654 | // Check to make sure that "Ty" is an integral type, and that our |
| 655 | // value will fit into the specified type... |
| 656 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 657 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 658 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 659 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 660 | Ty->getDescription() + "'!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 661 | return 0; |
| 662 | } |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 663 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 664 | |
| 665 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 666 | if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { |
| 667 | if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 668 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 669 | "' is invalid or out of range!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 670 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 671 | } else { // This is really a signed reference. Transmogrify. |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 672 | return ConstantInt::get(Ty, D.ConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 673 | } |
| 674 | } else { |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 675 | return ConstantInt::get(Ty, D.UConstPool64); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 676 | } |
| 677 | |
| 678 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 679 | if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 680 | GenerateError("FP constant invalid for type!!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 681 | return 0; |
| 682 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 683 | return ConstantFP::get(Ty, D.ConstPoolFP); |
| 684 | |
| 685 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 686 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 687 | GenerateError("Cannot create a a non pointer null!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 688 | return 0; |
| 689 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 690 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 691 | |
| 692 | case ValID::ConstUndefVal: // Is it an undef value? |
| 693 | return UndefValue::get(Ty); |
| 694 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 695 | case ValID::ConstZeroVal: // Is it a zero value? |
| 696 | return Constant::getNullValue(Ty); |
| 697 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 698 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 699 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 700 | GenerateError("Constant expression type different from required type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 701 | return 0; |
| 702 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 703 | return D.ConstantValue; |
| 704 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 705 | case ValID::InlineAsmVal: { // Inline asm expression |
| 706 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 707 | const FunctionType *FTy = |
| 708 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 709 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 710 | GenerateError("Invalid type for asm constraint string!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 711 | return 0; |
| 712 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 713 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 714 | D.IAD->HasSideEffects); |
| 715 | D.destroy(); // Free InlineAsmDescriptor. |
| 716 | return IA; |
| 717 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 718 | default: |
| 719 | assert(0 && "Unhandled case!"); |
| 720 | return 0; |
| 721 | } // End of switch |
| 722 | |
| 723 | assert(0 && "Unhandled case!"); |
| 724 | return 0; |
| 725 | } |
| 726 | |
| 727 | // getVal - This function is identical to getValNonImprovising, except that if a |
| 728 | // value is not already defined, it "improvises" by creating a placeholder var |
| 729 | // that looks and acts just like the requested variable. When the value is |
| 730 | // defined later, all uses of the placeholder variable are replaced with the |
| 731 | // real thing. |
| 732 | // |
| 733 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 734 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 735 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 736 | return 0; |
| 737 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 738 | |
| 739 | // See if the value has already been defined. |
| 740 | Value *V = getValNonImprovising(Ty, ID); |
| 741 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 742 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 743 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 744 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 745 | GenerateError("Invalid use of a composite type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 746 | return 0; |
| 747 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 748 | |
| 749 | // If we reached here, we referenced either a symbol that we don't know about |
| 750 | // or an id number that hasn't been read yet. We may be referencing something |
| 751 | // forward, so just create an entry to be resolved later and get to it... |
| 752 | // |
| 753 | V = new Argument(Ty); |
| 754 | |
| 755 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 756 | // to recycle these things?? |
| 757 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
| 758 | llvmAsmlineno))); |
| 759 | |
| 760 | if (inFunctionScope()) |
| 761 | InsertValue(V, CurFun.LateResolveValues); |
| 762 | else |
| 763 | InsertValue(V, CurModule.LateResolveValues); |
| 764 | return V; |
| 765 | } |
| 766 | |
| 767 | /// getBBVal - This is used for two purposes: |
| 768 | /// * If isDefinition is true, a new basic block with the specified ID is being |
| 769 | /// defined. |
| 770 | /// * If isDefinition is true, this is a reference to a basic block, which may |
| 771 | /// or may not be a forward reference. |
| 772 | /// |
| 773 | static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { |
| 774 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 775 | |
| 776 | std::string Name; |
| 777 | BasicBlock *BB = 0; |
| 778 | switch (ID.Type) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 779 | default: |
| 780 | GenerateError("Illegal label reference " + ID.getName()); |
| 781 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 782 | case ValID::NumberVal: // Is it a numbered definition? |
| 783 | if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) |
| 784 | CurFun.NumberedBlocks.resize(ID.Num+1); |
| 785 | BB = CurFun.NumberedBlocks[ID.Num]; |
| 786 | break; |
| 787 | case ValID::NameVal: // Is it a named definition? |
| 788 | Name = ID.Name; |
| 789 | if (Value *N = CurFun.CurrentFunction-> |
| 790 | getSymbolTable().lookup(Type::LabelTy, Name)) |
| 791 | BB = cast<BasicBlock>(N); |
| 792 | break; |
| 793 | } |
| 794 | |
| 795 | // See if the block has already been defined. |
| 796 | if (BB) { |
| 797 | // If this is the definition of the block, make sure the existing value was |
| 798 | // just a forward reference. If it was a forward reference, there will be |
| 799 | // an entry for it in the PlaceHolderInfo map. |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 800 | if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 801 | // The existing value was a definition, not a forward reference. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 802 | GenerateError("Redefinition of label " + ID.getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 803 | return 0; |
| 804 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 805 | |
| 806 | ID.destroy(); // Free strdup'd memory. |
| 807 | return BB; |
| 808 | } |
| 809 | |
| 810 | // Otherwise this block has not been seen before. |
| 811 | BB = new BasicBlock("", CurFun.CurrentFunction); |
| 812 | if (ID.Type == ValID::NameVal) { |
| 813 | BB->setName(ID.Name); |
| 814 | } else { |
| 815 | CurFun.NumberedBlocks[ID.Num] = BB; |
| 816 | } |
| 817 | |
| 818 | // If this is not a definition, keep track of it so we can use it as a forward |
| 819 | // reference. |
| 820 | if (!isDefinition) { |
| 821 | // Remember where this forward reference came from. |
| 822 | CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); |
| 823 | } else { |
| 824 | // The forward declaration could have been inserted anywhere in the |
| 825 | // function: insert it into the correct place now. |
| 826 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 827 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 828 | } |
| 829 | ID.destroy(); |
| 830 | return BB; |
| 831 | } |
| 832 | |
| 833 | |
| 834 | //===----------------------------------------------------------------------===// |
| 835 | // Code to handle forward references in instructions |
| 836 | //===----------------------------------------------------------------------===// |
| 837 | // |
| 838 | // This code handles the late binding needed with statements that reference |
| 839 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 840 | // a loop body. |
| 841 | // |
| 842 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 843 | // and back patchs after we are done. |
| 844 | // |
| 845 | |
| 846 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 847 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 848 | // defs now... |
| 849 | // |
| 850 | static void |
| 851 | ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, |
| 852 | std::map<const Type*,ValueList> *FutureLateResolvers) { |
| 853 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 854 | for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(), |
| 855 | E = LateResolvers.end(); LRI != E; ++LRI) { |
| 856 | ValueList &List = LRI->second; |
| 857 | while (!List.empty()) { |
| 858 | Value *V = List.back(); |
| 859 | List.pop_back(); |
| 860 | |
| 861 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 862 | CurModule.PlaceHolderInfo.find(V); |
| 863 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 864 | |
| 865 | ValID &DID = PHI->second.first; |
| 866 | |
| 867 | Value *TheRealValue = getValNonImprovising(LRI->first, DID); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 868 | if (TriggerError) |
| 869 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 870 | if (TheRealValue) { |
| 871 | V->replaceAllUsesWith(TheRealValue); |
| 872 | delete V; |
| 873 | CurModule.PlaceHolderInfo.erase(PHI); |
| 874 | } else if (FutureLateResolvers) { |
| 875 | // Functions have their unresolved items forwarded to the module late |
| 876 | // resolver table |
| 877 | InsertValue(V, *FutureLateResolvers); |
| 878 | } else { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 879 | if (DID.Type == ValID::NameVal) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 880 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 881 | "' of type '" + V->getType()->getDescription() + "'", |
| 882 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 883 | return; |
| 884 | } else { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 885 | GenerateError("Reference to an invalid definition: #" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 886 | itostr(DID.Num) + " of type '" + |
| 887 | V->getType()->getDescription() + "'", |
| 888 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 889 | return; |
| 890 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 891 | } |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | LateResolvers.clear(); |
| 896 | } |
| 897 | |
| 898 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 899 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 900 | // refering to the number can be resolved. Do this now. |
| 901 | // |
| 902 | static void ResolveTypeTo(char *Name, const Type *ToTy) { |
| 903 | ValID D; |
| 904 | if (Name) D = ValID::create(Name); |
| 905 | else D = ValID::create((int)CurModule.Types.size()); |
| 906 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 907 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 908 | CurModule.LateResolveTypes.find(D); |
| 909 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 910 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 911 | CurModule.LateResolveTypes.erase(I); |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | // setValueName - Set the specified value to the name given. The name may be |
| 916 | // null potentially, in which case this is a noop. The string passed in is |
| 917 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 918 | // |
| 919 | static void setValueName(Value *V, char *NameStr) { |
| 920 | if (NameStr) { |
| 921 | std::string Name(NameStr); // Copy string |
| 922 | free(NameStr); // Free old string |
| 923 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 924 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 925 | GenerateError("Can't assign name '" + Name+"' to value with void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 926 | return; |
| 927 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 928 | |
| 929 | assert(inFunctionScope() && "Must be in function scope!"); |
| 930 | SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 931 | if (ST.lookup(V->getType(), Name)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 932 | GenerateError("Redefinition of value named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 933 | V->getType()->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 934 | return; |
| 935 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 936 | |
| 937 | // Set the name. |
| 938 | V->setName(Name); |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 943 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 944 | static GlobalVariable * |
| 945 | ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, |
| 946 | bool isConstantGlobal, const Type *Ty, |
| 947 | Constant *Initializer) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 948 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 949 | GenerateError("Cannot declare global vars of function type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 950 | return 0; |
| 951 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 952 | |
| 953 | const PointerType *PTy = PointerType::get(Ty); |
| 954 | |
| 955 | std::string Name; |
| 956 | if (NameStr) { |
| 957 | Name = NameStr; // Copy string |
| 958 | free(NameStr); // Free old string |
| 959 | } |
| 960 | |
| 961 | // See if this global value was forward referenced. If so, recycle the |
| 962 | // object. |
| 963 | ValID ID; |
| 964 | if (!Name.empty()) { |
| 965 | ID = ValID::create((char*)Name.c_str()); |
| 966 | } else { |
| 967 | ID = ValID::create((int)CurModule.Values[PTy].size()); |
| 968 | } |
| 969 | |
| 970 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 971 | // Move the global to the end of the list, from whereever it was |
| 972 | // previously inserted. |
| 973 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 974 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 975 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 976 | GV->setInitializer(Initializer); |
| 977 | GV->setLinkage(Linkage); |
| 978 | GV->setConstant(isConstantGlobal); |
| 979 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 980 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 981 | } |
| 982 | |
| 983 | // If this global has a name, check to see if there is already a definition |
| 984 | // of this global in the module. If so, merge as appropriate. Note that |
| 985 | // this is really just a hack around problems in the CFE. :( |
| 986 | if (!Name.empty()) { |
| 987 | // We are a simple redefinition of a value, check to see if it is defined |
| 988 | // the same as the old one. |
| 989 | if (GlobalVariable *EGV = |
| 990 | CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { |
| 991 | // We are allowed to redefine a global variable in two circumstances: |
| 992 | // 1. If at least one of the globals is uninitialized or |
| 993 | // 2. If both initializers have the same value. |
| 994 | // |
| 995 | if (!EGV->hasInitializer() || !Initializer || |
| 996 | EGV->getInitializer() == Initializer) { |
| 997 | |
| 998 | // Make sure the existing global version gets the initializer! Make |
| 999 | // sure that it also gets marked const if the new version is. |
| 1000 | if (Initializer && !EGV->hasInitializer()) |
| 1001 | EGV->setInitializer(Initializer); |
| 1002 | if (isConstantGlobal) |
| 1003 | EGV->setConstant(true); |
| 1004 | EGV->setLinkage(Linkage); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1005 | return EGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1006 | } |
| 1007 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1008 | GenerateError("Redefinition of global variable named '" + Name + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1009 | "' in the '" + Ty->getDescription() + "' type plane!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1010 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | // Otherwise there is no existing GV to use, create one now. |
| 1015 | GlobalVariable *GV = |
| 1016 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
| 1017 | CurModule.CurrentModule); |
| 1018 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1019 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1020 | } |
| 1021 | |
| 1022 | // setTypeName - Set the specified type to the name given. The name may be |
| 1023 | // null potentially, in which case this is a noop. The string passed in is |
| 1024 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1025 | // |
| 1026 | // This function returns true if the type has already been defined, but is |
| 1027 | // allowed to be redefined in the specified context. If the name is a new name |
| 1028 | // for the type plane, it is inserted and false is returned. |
| 1029 | static bool setTypeName(const Type *T, char *NameStr) { |
| 1030 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 1031 | if (NameStr == 0) return false; |
| 1032 | |
| 1033 | std::string Name(NameStr); // Copy string |
| 1034 | free(NameStr); // Free old string |
| 1035 | |
| 1036 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1037 | if (T == Type::VoidTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1038 | GenerateError("Can't assign name '" + Name + "' to the void type!"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1039 | return false; |
| 1040 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1041 | |
| 1042 | // Set the type name, checking for conflicts as we do so. |
| 1043 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1044 | |
| 1045 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1046 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1047 | assert(Existing && "Conflict but no matching type?"); |
| 1048 | |
| 1049 | // There is only one case where this is allowed: when we are refining an |
| 1050 | // opaque type. In this case, Existing will be an opaque type. |
| 1051 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1052 | // We ARE replacing an opaque type! |
| 1053 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1054 | return true; |
| 1055 | } |
| 1056 | |
| 1057 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1058 | // the redefinition is identical to the original. This will be so if |
| 1059 | // Existing and T point to the same Type object. In this one case we |
| 1060 | // allow the equivalent redefinition. |
| 1061 | if (Existing == T) return true; // Yes, it's equal. |
| 1062 | |
| 1063 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1064 | GenerateError("Redefinition of type named '" + Name + "' in the '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1065 | T->getDescription() + "' type plane!"); |
| 1066 | } |
| 1067 | |
| 1068 | return false; |
| 1069 | } |
| 1070 | |
| 1071 | //===----------------------------------------------------------------------===// |
| 1072 | // Code for handling upreferences in type names... |
| 1073 | // |
| 1074 | |
| 1075 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1076 | // |
| 1077 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1078 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1079 | E) != Ty->subtype_end(); |
| 1080 | } |
| 1081 | |
| 1082 | namespace { |
| 1083 | struct UpRefRecord { |
| 1084 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1085 | // this type is resolved. |
| 1086 | unsigned NestingLevel; |
| 1087 | |
| 1088 | // LastContainedTy - This is the type at the current binding level for the |
| 1089 | // type. Every time we reduce the nesting level, this gets updated. |
| 1090 | const Type *LastContainedTy; |
| 1091 | |
| 1092 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1093 | // represented with. |
| 1094 | OpaqueType *UpRefTy; |
| 1095 | |
| 1096 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1097 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1098 | }; |
| 1099 | } |
| 1100 | |
| 1101 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1102 | static std::vector<UpRefRecord> UpRefs; |
| 1103 | |
| 1104 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1105 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1106 | /// currently active types. For each type, if the up reference is contained in |
| 1107 | /// the newly completed type, we decrement the level count. When the level |
| 1108 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1109 | /// thus we can complete the cycle. |
| 1110 | /// |
| 1111 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1112 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1113 | // nothing to resolve here. |
| 1114 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1115 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1116 | PATypeHolder Ty(ty); |
| 1117 | UR_OUT("Type '" << Ty->getDescription() << |
| 1118 | "' newly formed. Resolving upreferences.\n" << |
| 1119 | UpRefs.size() << " upreferences active!\n"); |
| 1120 | |
| 1121 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1122 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1123 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1124 | // this variable. |
| 1125 | OpaqueType *TypeToResolve = 0; |
| 1126 | |
| 1127 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1128 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1129 | << UpRefs[i].second->getDescription() << ") = " |
| 1130 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1131 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1132 | // Decrement level of upreference |
| 1133 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1134 | UpRefs[i].LastContainedTy = Ty; |
| 1135 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1136 | if (Level == 0) { // Upreference should be resolved! |
| 1137 | if (!TypeToResolve) { |
| 1138 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1139 | } else { |
| 1140 | UR_OUT(" * Resolving upreference for " |
| 1141 | << UpRefs[i].second->getDescription() << "\n"; |
| 1142 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1143 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1144 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1145 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1146 | } |
| 1147 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1148 | --i; // Do not skip the next element... |
| 1149 | } |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | if (TypeToResolve) { |
| 1154 | UR_OUT(" * Resolving upreference for " |
| 1155 | << UpRefs[i].second->getDescription() << "\n"; |
| 1156 | std::string OldName = TypeToResolve->getDescription()); |
| 1157 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1158 | } |
| 1159 | |
| 1160 | return Ty; |
| 1161 | } |
| 1162 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1163 | // common code from the two 'RunVMAsmParser' functions |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1164 | static Module* RunParser(Module * M) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1165 | |
| 1166 | llvmAsmlineno = 1; // Reset the current line number... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1167 | CurModule.CurrentModule = M; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 1168 | |
| 1169 | // Check to make sure the parser succeeded |
| 1170 | if (yyparse()) { |
| 1171 | if (ParserResult) |
| 1172 | delete ParserResult; |
| 1173 | return 0; |
| 1174 | } |
| 1175 | |
| 1176 | // Check to make sure that parsing produced a result |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 1177 | if (!ParserResult) |
| 1178 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1179 | |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 1180 | // Reset ParserResult variable while saving its value for the result. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1181 | Module *Result = ParserResult; |
| 1182 | ParserResult = 0; |
| 1183 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1184 | return Result; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1185 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1186 | |
| 1187 | //===----------------------------------------------------------------------===// |
| 1188 | // RunVMAsmParser - Define an interface to this parser |
| 1189 | //===----------------------------------------------------------------------===// |
| 1190 | // |
| 1191 | Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { |
| 1192 | set_scan_file(F); |
| 1193 | |
| 1194 | CurFilename = Filename; |
| 1195 | return RunParser(new Module(CurFilename)); |
| 1196 | } |
| 1197 | |
| 1198 | Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { |
| 1199 | set_scan_string(AsmString); |
| 1200 | |
| 1201 | CurFilename = "from_memory"; |
| 1202 | if (M == NULL) { |
| 1203 | return RunParser(new Module (CurFilename)); |
| 1204 | } else { |
| 1205 | return RunParser(M); |
| 1206 | } |
| 1207 | } |
| 1208 | |
| 1209 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1210 | |
| 1211 | /* Enabling traces. */ |
| 1212 | #ifndef YYDEBUG |
| 1213 | # define YYDEBUG 0 |
| 1214 | #endif |
| 1215 | |
| 1216 | /* Enabling verbose error messages. */ |
| 1217 | #ifdef YYERROR_VERBOSE |
| 1218 | # undef YYERROR_VERBOSE |
| 1219 | # define YYERROR_VERBOSE 1 |
| 1220 | #else |
| 1221 | # define YYERROR_VERBOSE 0 |
| 1222 | #endif |
| 1223 | |
| 1224 | /* Enabling the token table. */ |
| 1225 | #ifndef YYTOKEN_TABLE |
| 1226 | # define YYTOKEN_TABLE 0 |
| 1227 | #endif |
| 1228 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1229 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 1230 | typedef union YYSTYPE |
| 1231 | #line 855 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
| 1232 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1233 | llvm::Module *ModuleVal; |
| 1234 | llvm::Function *FunctionVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1235 | std::pair<llvm::PATypeHolder*, char*> *ArgVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1236 | llvm::BasicBlock *BasicBlockVal; |
| 1237 | llvm::TerminatorInst *TermInstVal; |
| 1238 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1239 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1240 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1241 | const llvm::Type *PrimType; |
| 1242 | llvm::PATypeHolder *TypeVal; |
| 1243 | llvm::Value *ValueVal; |
| 1244 | |
| 1245 | std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList; |
| 1246 | std::vector<llvm::Value*> *ValueList; |
| 1247 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1248 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1249 | std::list<std::pair<llvm::Value*, |
| 1250 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1251 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1252 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1253 | |
| 1254 | llvm::GlobalValue::LinkageTypes Linkage; |
| 1255 | int64_t SInt64Val; |
| 1256 | uint64_t UInt64Val; |
| 1257 | int SIntVal; |
| 1258 | unsigned UIntVal; |
| 1259 | double FPVal; |
| 1260 | bool BoolVal; |
| 1261 | |
| 1262 | char *StrVal; // This memory is strdup'd! |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1263 | llvm::ValID ValIDVal; // strdup'd memory maybe! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1264 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1265 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1266 | llvm::Instruction::TermOps TermOpVal; |
| 1267 | llvm::Instruction::MemoryOps MemOpVal; |
| 1268 | llvm::Instruction::CastOps CastOpVal; |
| 1269 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 1270 | llvm::Module::Endianness Endianness; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1271 | llvm::ICmpInst::Predicate IPredicate; |
| 1272 | llvm::FCmpInst::Predicate FPredicate; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1273 | } |
| 1274 | /* Line 193 of yacc.c. */ |
| 1275 | #line 1276 "llvmAsmParser.tab.c" |
| 1276 | YYSTYPE; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1277 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1278 | # define YYSTYPE_IS_DECLARED 1 |
| 1279 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1280 | #endif |
| 1281 | |
| 1282 | |
| 1283 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1284 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1285 | |
| 1286 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1287 | /* Line 216 of yacc.c. */ |
| 1288 | #line 1289 "llvmAsmParser.tab.c" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1289 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1290 | #ifdef short |
| 1291 | # undef short |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1292 | #endif |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1293 | |
| 1294 | #ifdef YYTYPE_UINT8 |
| 1295 | typedef YYTYPE_UINT8 yytype_uint8; |
| 1296 | #else |
| 1297 | typedef unsigned char yytype_uint8; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1298 | #endif |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1299 | |
| 1300 | #ifdef YYTYPE_INT8 |
| 1301 | typedef YYTYPE_INT8 yytype_int8; |
| 1302 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 1303 | || defined __cplusplus || defined _MSC_VER) |
| 1304 | typedef signed char yytype_int8; |
| 1305 | #else |
| 1306 | typedef short int yytype_int8; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1307 | #endif |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1308 | |
| 1309 | #ifdef YYTYPE_UINT16 |
| 1310 | typedef YYTYPE_UINT16 yytype_uint16; |
| 1311 | #else |
| 1312 | typedef unsigned short int yytype_uint16; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1313 | #endif |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 1314 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1315 | #ifdef YYTYPE_INT16 |
| 1316 | typedef YYTYPE_INT16 yytype_int16; |
| 1317 | #else |
| 1318 | typedef short int yytype_int16; |
| 1319 | #endif |
| 1320 | |
| 1321 | #ifndef YYSIZE_T |
| 1322 | # ifdef __SIZE_TYPE__ |
| 1323 | # define YYSIZE_T __SIZE_TYPE__ |
| 1324 | # elif defined size_t |
| 1325 | # define YYSIZE_T size_t |
| 1326 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1327 | || defined __cplusplus || defined _MSC_VER) |
| 1328 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1329 | # define YYSIZE_T size_t |
| 1330 | # else |
| 1331 | # define YYSIZE_T unsigned int |
| 1332 | # endif |
| 1333 | #endif |
| 1334 | |
| 1335 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 1336 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1337 | #ifndef YY_ |
| 1338 | # if YYENABLE_NLS |
| 1339 | # if ENABLE_NLS |
| 1340 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1341 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1342 | # endif |
| 1343 | # endif |
| 1344 | # ifndef YY_ |
| 1345 | # define YY_(msgid) msgid |
| 1346 | # endif |
| 1347 | #endif |
| 1348 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1349 | /* Suppress unused-variable warnings by "using" E. */ |
| 1350 | #if ! defined lint || defined __GNUC__ |
| 1351 | # define YYUSE(e) ((void) (e)) |
| 1352 | #else |
| 1353 | # define YYUSE(e) /* empty */ |
| 1354 | #endif |
| 1355 | |
| 1356 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 1357 | #ifndef lint |
| 1358 | # define YYID(n) (n) |
| 1359 | #else |
| 1360 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1361 | || defined __cplusplus || defined _MSC_VER) |
| 1362 | static int |
| 1363 | YYID (int i) |
| 1364 | #else |
| 1365 | static int |
| 1366 | YYID (i) |
| 1367 | int i; |
| 1368 | #endif |
| 1369 | { |
| 1370 | return i; |
| 1371 | } |
| 1372 | #endif |
| 1373 | |
| 1374 | #if ! defined yyoverflow || YYERROR_VERBOSE |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1375 | |
| 1376 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1377 | |
| 1378 | # ifdef YYSTACK_USE_ALLOCA |
| 1379 | # if YYSTACK_USE_ALLOCA |
| 1380 | # ifdef __GNUC__ |
| 1381 | # define YYSTACK_ALLOC __builtin_alloca |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1382 | # elif defined __BUILTIN_VA_ARG_INCR |
| 1383 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 1384 | # elif defined _AIX |
| 1385 | # define YYSTACK_ALLOC __alloca |
| 1386 | # elif defined _MSC_VER |
| 1387 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 1388 | # define alloca _alloca |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1389 | # else |
| 1390 | # define YYSTACK_ALLOC alloca |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1391 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1392 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1393 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1394 | # ifndef _STDLIB_H |
| 1395 | # define _STDLIB_H 1 |
| 1396 | # endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1397 | # endif |
| 1398 | # endif |
| 1399 | # endif |
| 1400 | # endif |
| 1401 | |
| 1402 | # ifdef YYSTACK_ALLOC |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1403 | /* Pacify GCC's `empty if-body' warning. */ |
| 1404 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1405 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1406 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1407 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1408 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1409 | to allow for a few compiler-allocated temporary stack slots. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1410 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1411 | # endif |
| 1412 | # else |
| 1413 | # define YYSTACK_ALLOC YYMALLOC |
| 1414 | # define YYSTACK_FREE YYFREE |
| 1415 | # ifndef YYSTACK_ALLOC_MAXIMUM |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1416 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1417 | # endif |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1418 | # if (defined __cplusplus && ! defined _STDLIB_H \ |
| 1419 | && ! ((defined YYMALLOC || defined malloc) \ |
| 1420 | && (defined YYFREE || defined free))) |
| 1421 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1422 | # ifndef _STDLIB_H |
| 1423 | # define _STDLIB_H 1 |
| 1424 | # endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1425 | # endif |
| 1426 | # ifndef YYMALLOC |
| 1427 | # define YYMALLOC malloc |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1428 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1429 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1430 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1431 | # endif |
| 1432 | # endif |
| 1433 | # ifndef YYFREE |
| 1434 | # define YYFREE free |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1435 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1436 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1437 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1438 | # endif |
| 1439 | # endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1440 | # endif |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1441 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1442 | |
| 1443 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1444 | #if (! defined yyoverflow \ |
| 1445 | && (! defined __cplusplus \ |
| 1446 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1447 | |
| 1448 | /* A type that is properly aligned for any stack member. */ |
| 1449 | union yyalloc |
| 1450 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1451 | yytype_int16 yyss; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1452 | YYSTYPE yyvs; |
| 1453 | }; |
| 1454 | |
| 1455 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1456 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1457 | |
| 1458 | /* The size of an array large to enough to hold all stacks, each with |
| 1459 | N elements. */ |
| 1460 | # define YYSTACK_BYTES(N) \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1461 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1462 | + YYSTACK_GAP_MAXIMUM) |
| 1463 | |
| 1464 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1465 | not overlap. */ |
| 1466 | # ifndef YYCOPY |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1467 | # if defined __GNUC__ && 1 < __GNUC__ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1468 | # define YYCOPY(To, From, Count) \ |
| 1469 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1470 | # else |
| 1471 | # define YYCOPY(To, From, Count) \ |
| 1472 | do \ |
| 1473 | { \ |
| 1474 | YYSIZE_T yyi; \ |
| 1475 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1476 | (To)[yyi] = (From)[yyi]; \ |
| 1477 | } \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1478 | while (YYID (0)) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1479 | # endif |
| 1480 | # endif |
| 1481 | |
| 1482 | /* Relocate STACK from its old location to the new one. The |
| 1483 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1484 | elements in the stack, and YYPTR gives the new location of the |
| 1485 | stack. Advance YYPTR to a properly aligned location for the next |
| 1486 | stack. */ |
| 1487 | # define YYSTACK_RELOCATE(Stack) \ |
| 1488 | do \ |
| 1489 | { \ |
| 1490 | YYSIZE_T yynewbytes; \ |
| 1491 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1492 | Stack = &yyptr->Stack; \ |
| 1493 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1494 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1495 | } \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1496 | while (YYID (0)) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 1497 | |
| 1498 | #endif |
| 1499 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1500 | /* YYFINAL -- State number of the termination state. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1501 | #define YYFINAL 4 |
| 1502 | /* YYLAST -- Last index in YYTABLE. */ |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1503 | #define YYLAST 1509 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1504 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1505 | /* YYNTOKENS -- Number of terminals. */ |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1506 | #define YYNTOKENS 159 |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1507 | /* YYNNTS -- Number of nonterminals. */ |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1508 | #define YYNNTS 78 |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1509 | /* YYNRULES -- Number of rules. */ |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1510 | #define YYNRULES 297 |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1511 | /* YYNRULES -- Number of states. */ |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1512 | #define YYNSTATES 578 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1513 | |
| 1514 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1515 | #define YYUNDEFTOK 2 |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1516 | #define YYMAXUTOK 399 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1517 | |
| 1518 | #define YYTRANSLATE(YYX) \ |
| 1519 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1520 | |
| 1521 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1522 | static const yytype_uint8 yytranslate[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1523 | { |
| 1524 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1525 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1526 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1527 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1528 | 148, 149, 157, 2, 146, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1529 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1530 | 153, 145, 154, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1531 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1532 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1533 | 2, 150, 147, 152, 2, 2, 2, 2, 2, 158, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1534 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1535 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1536 | 151, 2, 2, 155, 2, 156, 2, 2, 2, 2, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1537 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1538 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1539 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1540 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1541 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1542 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1543 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1544 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1545 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1546 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1547 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1548 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1549 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1550 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1551 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1552 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1553 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1554 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1555 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1556 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1557 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1558 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1559 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1560 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1561 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1562 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1563 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1564 | }; |
| 1565 | |
| 1566 | #if YYDEBUG |
| 1567 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1568 | YYRHS. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1569 | static const yytype_uint16 yyprhs[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1570 | { |
| 1571 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1572 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1573 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1574 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1575 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1576 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1577 | 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1578 | 139, 141, 143, 145, 147, 149, 151, 153, 156, 157, |
| 1579 | 159, 161, 163, 165, 167, 169, 171, 172, 173, 175, |
| 1580 | 177, 179, 181, 183, 185, 188, 189, 192, 193, 197, |
| 1581 | 200, 201, 203, 204, 208, 210, 213, 215, 217, 219, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1582 | 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1583 | 241, 243, 245, 247, 249, 251, 253, 255, 258, 263, |
| 1584 | 269, 275, 279, 282, 285, 287, 291, 293, 297, 299, |
| 1585 | 300, 305, 309, 313, 318, 323, 327, 330, 333, 336, |
| 1586 | 339, 342, 345, 348, 351, 354, 357, 364, 370, 379, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 1587 | 386, 393, 400, 408, 416, 423, 430, 439, 448, 452, |
| 1588 | 454, 456, 458, 460, 463, 466, 471, 474, 476, 481, |
| 1589 | 484, 489, 490, 498, 499, 507, 508, 516, 517, 525, |
| 1590 | 529, 534, 535, 537, 539, 541, 545, 549, 553, 557, |
| 1591 | 561, 565, 567, 568, 570, 572, 574, 575, 578, 582, |
| 1592 | 584, 586, 590, 592, 593, 602, 604, 606, 610, 612, |
| 1593 | 614, 617, 618, 620, 622, 623, 628, 629, 631, 633, |
| 1594 | 635, 637, 639, 641, 643, 645, 647, 651, 653, 659, |
| 1595 | 661, 663, 665, 667, 670, 673, 676, 680, 683, 684, |
| 1596 | 686, 689, 692, 696, 706, 716, 725, 739, 741, 743, |
| 1597 | 750, 756, 759, 766, 774, 776, 780, 782, 783, 786, |
| 1598 | 788, 794, 800, 806, 813, 820, 823, 828, 833, 840, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1599 | 845, 850, 857, 864, 867, 875, 877, 880, 881, 883, |
| 1600 | 884, 888, 895, 899, 906, 909, 914, 921 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1601 | }; |
| 1602 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1603 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1604 | static const yytype_int16 yyrhs[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1605 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1606 | 193, 0, -1, 5, -1, 6, -1, 3, -1, 4, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1607 | -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, |
| 1608 | -1, 83, -1, 84, -1, 85, -1, 86, -1, 87, |
| 1609 | -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1610 | -1, 93, -1, 94, -1, 95, -1, 124, -1, 125, |
| 1611 | -1, 126, -1, 127, -1, 128, -1, 129, -1, 130, |
| 1612 | -1, 131, -1, 132, -1, 133, -1, 134, -1, 135, |
| 1613 | -1, 138, -1, 139, -1, 140, -1, 98, -1, 99, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1614 | -1, 100, -1, 101, -1, 102, -1, 103, -1, 104, |
| 1615 | -1, 105, -1, 106, -1, 107, -1, 108, -1, 109, |
| 1616 | -1, 110, -1, 111, -1, 112, -1, 113, -1, 114, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1617 | -1, 115, -1, 116, -1, 117, -1, 104, -1, 105, |
| 1618 | -1, 106, -1, 107, -1, 27, -1, 28, -1, 16, |
| 1619 | -1, 14, -1, 12, -1, 10, -1, 17, -1, 15, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1620 | -1, 13, -1, 11, -1, 169, -1, 170, -1, 18, |
| 1621 | -1, 19, -1, 205, 145, -1, -1, 41, -1, 42, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1622 | -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, |
| 1623 | -1, -1, -1, 65, -1, 66, -1, 67, -1, 68, |
| 1624 | -1, 69, -1, 70, -1, 64, 4, -1, -1, 57, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1625 | 4, -1, -1, 146, 57, 4, -1, 34, 24, -1, |
| 1626 | -1, 178, -1, -1, 146, 181, 180, -1, 178, -1, |
| 1627 | 57, 4, -1, 184, -1, 8, -1, 186, -1, 8, |
| 1628 | -1, 186, -1, 9, -1, 10, -1, 11, -1, 12, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1629 | -1, 13, -1, 14, -1, 15, -1, 16, -1, 17, |
| 1630 | -1, 18, -1, 19, -1, 20, -1, 21, -1, 48, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1631 | -1, 185, -1, 220, -1, 147, 4, -1, 183, 148, |
| 1632 | 188, 149, -1, 150, 4, 151, 186, 152, -1, 153, |
| 1633 | 4, 151, 186, 154, -1, 155, 187, 156, -1, 155, |
| 1634 | 156, -1, 186, 157, -1, 186, -1, 187, 146, 186, |
| 1635 | -1, 187, -1, 187, 146, 37, -1, 37, -1, -1, |
| 1636 | 184, 150, 191, 152, -1, 184, 150, 152, -1, 184, |
| 1637 | 158, 24, -1, 184, 153, 191, 154, -1, 184, 155, |
| 1638 | 191, 156, -1, 184, 155, 156, -1, 184, 38, -1, |
| 1639 | 184, 39, -1, 184, 220, -1, 184, 190, -1, 184, |
| 1640 | 26, -1, 169, 161, -1, 170, 4, -1, 9, 27, |
| 1641 | -1, 9, 28, -1, 172, 7, -1, 165, 148, 189, |
| 1642 | 36, 184, 149, -1, 123, 148, 189, 234, 149, -1, |
| 1643 | 137, 148, 189, 146, 189, 146, 189, 149, -1, 162, |
| 1644 | 148, 189, 146, 189, 149, -1, 163, 148, 189, 146, |
| 1645 | 189, 149, -1, 164, 148, 189, 146, 189, 149, -1, |
| 1646 | 96, 167, 148, 189, 146, 189, 149, -1, 97, 168, |
| 1647 | 148, 189, 146, 189, 149, -1, 166, 148, 189, 146, |
| 1648 | 189, 149, -1, 142, 148, 189, 146, 189, 149, -1, |
| 1649 | 143, 148, 189, 146, 189, 146, 189, 149, -1, 144, |
| 1650 | 148, 189, 146, 189, 146, 189, 149, -1, 191, 146, |
| 1651 | 189, -1, 189, -1, 32, -1, 33, -1, 194, -1, |
| 1652 | 194, 214, -1, 194, 216, -1, 194, 62, 61, 200, |
| 1653 | -1, 194, 25, -1, 195, -1, 195, 173, 20, 182, |
| 1654 | -1, 195, 216, -1, 195, 62, 61, 200, -1, -1, |
| 1655 | 195, 173, 174, 192, 189, 196, 180, -1, -1, 195, |
| 1656 | 173, 50, 192, 184, 197, 180, -1, -1, 195, 173, |
| 1657 | 45, 192, 184, 198, 180, -1, -1, 195, 173, 47, |
| 1658 | 192, 184, 199, 180, -1, 195, 51, 202, -1, 195, |
| 1659 | 58, 145, 203, -1, -1, 24, -1, 56, -1, 55, |
| 1660 | -1, 53, 145, 201, -1, 54, 145, 4, -1, 52, |
| 1661 | 145, 24, -1, 71, 145, 24, -1, 150, 204, 152, |
| 1662 | -1, 204, 146, 24, -1, 24, -1, -1, 22, -1, |
| 1663 | 24, -1, 205, -1, -1, 184, 206, -1, 208, 146, |
| 1664 | 207, -1, 207, -1, 208, -1, 208, 146, 37, -1, |
| 1665 | 37, -1, -1, 175, 182, 205, 148, 209, 149, 179, |
| 1666 | 176, -1, 29, -1, 155, -1, 174, 210, 211, -1, |
| 1667 | 30, -1, 156, -1, 223, 213, -1, -1, 45, -1, |
| 1668 | 47, -1, -1, 31, 217, 215, 210, -1, -1, 63, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 1669 | -1, 3, -1, 4, -1, 7, -1, 27, -1, 28, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1670 | -1, 38, -1, 39, -1, 26, -1, 153, 191, 154, |
| 1671 | -1, 190, -1, 61, 218, 24, 146, 24, -1, 160, |
| 1672 | -1, 205, -1, 220, -1, 219, -1, 184, 221, -1, |
| 1673 | 223, 224, -1, 212, 224, -1, 225, 173, 226, -1, |
| 1674 | 225, 228, -1, -1, 23, -1, 72, 222, -1, 72, |
| 1675 | 8, -1, 73, 21, 221, -1, 73, 9, 221, 146, |
| 1676 | 21, 221, 146, 21, 221, -1, 74, 171, 221, 146, |
| 1677 | 21, 221, 150, 227, 152, -1, 74, 171, 221, 146, |
| 1678 | 21, 221, 150, 152, -1, 75, 175, 182, 221, 148, |
| 1679 | 231, 149, 36, 21, 221, 76, 21, 221, -1, 76, |
| 1680 | -1, 77, -1, 227, 171, 219, 146, 21, 221, -1, |
| 1681 | 171, 219, 146, 21, 221, -1, 173, 233, -1, 184, |
| 1682 | 150, 221, 146, 221, 152, -1, 229, 146, 150, 221, |
| 1683 | 146, 221, 152, -1, 222, -1, 230, 146, 222, -1, |
| 1684 | 230, -1, -1, 60, 59, -1, 59, -1, 162, 184, |
| 1685 | 221, 146, 221, -1, 163, 184, 221, 146, 221, -1, |
| 1686 | 164, 184, 221, 146, 221, -1, 96, 167, 184, 221, |
| 1687 | 146, 221, -1, 97, 168, 184, 221, 146, 221, -1, |
| 1688 | 49, 222, -1, 166, 222, 146, 222, -1, 165, 222, |
| 1689 | 36, 184, -1, 137, 222, 146, 222, 146, 222, -1, |
| 1690 | 141, 222, 146, 184, -1, 142, 222, 146, 222, -1, |
| 1691 | 143, 222, 146, 222, 146, 222, -1, 144, 222, 146, |
| 1692 | 222, 146, 222, -1, 136, 229, -1, 232, 175, 182, |
| 1693 | 221, 148, 231, 149, -1, 236, -1, 146, 230, -1, |
| 1694 | -1, 35, -1, -1, 118, 184, 177, -1, 118, 184, |
| 1695 | 146, 15, 221, 177, -1, 119, 184, 177, -1, 119, |
| 1696 | 184, 146, 15, 221, 177, -1, 120, 222, -1, 235, |
| 1697 | 121, 184, 221, -1, 235, 122, 222, 146, 184, 221, |
| 1698 | -1, 123, 184, 221, 234, -1 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1699 | }; |
| 1700 | |
| 1701 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1702 | static const yytype_uint16 yyrline[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1703 | { |
Reid Spencer | b25389c | 2006-12-05 23:50:48 +0000 | [diff] [blame] | 1704 | 0, 990, 990, 991, 999, 1000, 1010, 1010, 1010, 1010, |
| 1705 | 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1012, 1012, |
| 1706 | 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, 1013, |
| 1707 | 1014, 1014, 1014, 1014, 1014, 1014, 1015, 1015, 1015, 1017, |
| 1708 | 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1025, |
| 1709 | 1025, 1026, 1026, 1027, 1027, 1028, 1028, 1029, 1029, 1030, |
| 1710 | 1030, 1031, 1031, 1032, 1033, 1038, 1038, 1038, 1038, 1039, |
| 1711 | 1039, 1039, 1039, 1040, 1040, 1041, 1041, 1044, 1048, 1053, |
| 1712 | 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1062, 1063, 1064, |
| 1713 | 1065, 1066, 1067, 1068, 1069, 1078, 1079, 1085, 1086, 1094, |
| 1714 | 1102, 1103, 1108, 1109, 1110, 1115, 1129, 1129, 1130, 1130, |
| 1715 | 1132, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1143, 1143, |
| 1716 | 1143, 1143, 1143, 1143, 1144, 1148, 1152, 1160, 1168, 1181, |
| 1717 | 1186, 1198, 1208, 1212, 1223, 1228, 1234, 1235, 1239, 1243, |
| 1718 | 1254, 1280, 1294, 1324, 1350, 1371, 1384, 1394, 1399, 1460, |
| 1719 | 1467, 1475, 1481, 1487, 1491, 1495, 1503, 1515, 1536, 1544, |
| 1720 | 1550, 1561, 1567, 1572, 1577, 1586, 1592, 1598, 1607, 1611, |
| 1721 | 1619, 1619, 1629, 1637, 1642, 1646, 1650, 1654, 1669, 1691, |
| 1722 | 1694, 1697, 1697, 1705, 1705, 1713, 1713, 1721, 1721, 1730, |
| 1723 | 1733, 1736, 1740, 1753, 1754, 1756, 1760, 1769, 1773, 1778, |
| 1724 | 1780, 1785, 1790, 1799, 1799, 1800, 1800, 1802, 1809, 1815, |
| 1725 | 1822, 1826, 1832, 1837, 1842, 1937, 1937, 1939, 1947, 1947, |
| 1726 | 1949, 1954, 1955, 1956, 1958, 1958, 1968, 1972, 1977, 1981, |
| 1727 | 1985, 1989, 1993, 1997, 2001, 2005, 2009, 2034, 2038, 2052, |
| 1728 | 2056, 2062, 2062, 2068, 2073, 2077, 2086, 2097, 2106, 2118, |
| 1729 | 2131, 2135, 2139, 2144, 2153, 2172, 2181, 2237, 2241, 2248, |
| 1730 | 2259, 2272, 2281, 2290, 2300, 2304, 2311, 2311, 2313, 2317, |
| 1731 | 2322, 2341, 2356, 2370, 2381, 2392, 2405, 2414, 2425, 2433, |
| 1732 | 2438, 2444, 2450, 2456, 2471, 2530, 2537, 2540, 2545, 2549, |
| 1733 | 2556, 2561, 2567, 2572, 2578, 2586, 2598, 2613 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1734 | }; |
| 1735 | #endif |
| 1736 | |
| 1737 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1738 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1739 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1740 | static const char *const yytname[] = |
| 1741 | { |
| 1742 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", |
| 1743 | "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", |
| 1744 | "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", |
| 1745 | "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", |
| 1746 | "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", |
| 1747 | "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", |
| 1748 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", |
| 1749 | "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1750 | "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", |
| 1751 | "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", |
| 1752 | "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", |
| 1753 | "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", |
| 1754 | "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", |
| 1755 | "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1756 | "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP", |
| 1757 | "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1758 | "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", |
| 1759 | "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", |
| 1760 | "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", |
| 1761 | "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", |
| 1762 | "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT", |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1763 | "INSERTELEMENT", "SHUFFLEVECTOR", "'='", "','", "'\\\\'", "'('", "')'", |
| 1764 | "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", |
| 1765 | "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", |
| 1766 | "CastOps", "ShiftOps", "IPredicates", "FPredicates", "SIntType", |
| 1767 | "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage", |
| 1768 | "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection", |
| 1769 | "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV", |
| 1770 | "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", |
| 1771 | "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList", |
| 1772 | "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle", |
| 1773 | "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName", |
| 1774 | "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", |
| 1775 | "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto", |
| 1776 | "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", |
| 1777 | "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", |
| 1778 | "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", |
| 1779 | "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", |
| 1780 | "MemoryInst", 0 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1781 | }; |
| 1782 | #endif |
| 1783 | |
| 1784 | # ifdef YYPRINT |
| 1785 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1786 | token YYLEX-NUM. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1787 | static const yytype_uint16 yytoknum[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1788 | { |
| 1789 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1790 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1791 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1792 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1793 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1794 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1795 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1796 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1797 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1798 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1799 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1800 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1801 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1802 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1803 | 395, 396, 397, 398, 399, 61, 44, 92, 40, 41, |
| 1804 | 91, 120, 93, 60, 62, 123, 125, 42, 99 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1805 | }; |
| 1806 | # endif |
| 1807 | |
| 1808 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1809 | static const yytype_uint8 yyr1[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1810 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1811 | 0, 159, 160, 160, 161, 161, 162, 162, 162, 162, |
| 1812 | 162, 162, 162, 162, 162, 163, 163, 163, 164, 164, |
| 1813 | 164, 164, 164, 164, 165, 165, 165, 165, 165, 165, |
| 1814 | 165, 165, 165, 165, 165, 165, 166, 166, 166, 167, |
| 1815 | 167, 167, 167, 167, 167, 167, 167, 167, 167, 168, |
| 1816 | 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, |
| 1817 | 168, 168, 168, 168, 168, 169, 169, 169, 169, 170, |
| 1818 | 170, 170, 170, 171, 171, 172, 172, 173, 173, 174, |
| 1819 | 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, |
| 1820 | 175, 175, 175, 175, 175, 176, 176, 177, 177, 178, |
| 1821 | 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, |
| 1822 | 184, 185, 185, 185, 185, 185, 185, 185, 185, 185, |
| 1823 | 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, |
| 1824 | 186, 186, 186, 186, 187, 187, 188, 188, 188, 188, |
| 1825 | 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, |
| 1826 | 189, 189, 189, 189, 189, 189, 190, 190, 190, 190, |
| 1827 | 190, 190, 190, 190, 190, 190, 190, 190, 191, 191, |
| 1828 | 192, 192, 193, 194, 194, 194, 194, 194, 195, 195, |
| 1829 | 195, 196, 195, 197, 195, 198, 195, 199, 195, 195, |
| 1830 | 195, 195, 200, 201, 201, 202, 202, 202, 202, 203, |
| 1831 | 204, 204, 204, 205, 205, 206, 206, 207, 208, 208, |
| 1832 | 209, 209, 209, 209, 210, 211, 211, 212, 213, 213, |
| 1833 | 214, 215, 215, 215, 217, 216, 218, 218, 219, 219, |
| 1834 | 219, 219, 219, 219, 219, 219, 219, 219, 219, 220, |
| 1835 | 220, 221, 221, 222, 223, 223, 224, 225, 225, 225, |
| 1836 | 226, 226, 226, 226, 226, 226, 226, 226, 226, 227, |
| 1837 | 227, 228, 229, 229, 230, 230, 231, 231, 232, 232, |
| 1838 | 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, |
| 1839 | 233, 233, 233, 233, 233, 233, 234, 234, 235, 235, |
| 1840 | 236, 236, 236, 236, 236, 236, 236, 236 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1841 | }; |
| 1842 | |
| 1843 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1844 | static const yytype_uint8 yyr2[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1845 | { |
| 1846 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1847 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1848 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1849 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1850 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 1851 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1852 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1853 | 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, |
| 1854 | 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, |
| 1855 | 1, 1, 1, 1, 2, 0, 2, 0, 3, 2, |
| 1856 | 0, 1, 0, 3, 1, 2, 1, 1, 1, 1, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1857 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1858 | 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, |
| 1859 | 5, 3, 2, 2, 1, 3, 1, 3, 1, 0, |
| 1860 | 4, 3, 3, 4, 4, 3, 2, 2, 2, 2, |
| 1861 | 2, 2, 2, 2, 2, 2, 6, 5, 8, 6, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 1862 | 6, 6, 7, 7, 6, 6, 8, 8, 3, 1, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1863 | 1, 1, 1, 2, 2, 4, 2, 1, 4, 2, |
| 1864 | 4, 0, 7, 0, 7, 0, 7, 0, 7, 3, |
| 1865 | 4, 0, 1, 1, 1, 3, 3, 3, 3, 3, |
| 1866 | 3, 1, 0, 1, 1, 1, 0, 2, 3, 1, |
| 1867 | 1, 3, 1, 0, 8, 1, 1, 3, 1, 1, |
| 1868 | 2, 0, 1, 1, 0, 4, 0, 1, 1, 1, |
| 1869 | 1, 1, 1, 1, 1, 1, 3, 1, 5, 1, |
| 1870 | 1, 1, 1, 2, 2, 2, 3, 2, 0, 1, |
| 1871 | 2, 2, 3, 9, 9, 8, 13, 1, 1, 6, |
| 1872 | 5, 2, 6, 7, 1, 3, 1, 0, 2, 1, |
| 1873 | 5, 5, 5, 6, 6, 2, 4, 4, 6, 4, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1874 | 4, 6, 6, 2, 7, 1, 2, 0, 1, 0, |
| 1875 | 3, 6, 3, 6, 2, 4, 6, 4 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1876 | }; |
| 1877 | |
| 1878 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 1879 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 1880 | means the default is an error. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1881 | static const yytype_uint16 yydefact[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1882 | { |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1883 | 191, 0, 86, 177, 1, 176, 224, 79, 80, 81, |
| 1884 | 82, 83, 84, 85, 0, 87, 248, 173, 174, 248, |
| 1885 | 203, 204, 0, 0, 0, 86, 0, 179, 221, 0, |
| 1886 | 0, 88, 89, 90, 91, 92, 93, 0, 0, 249, |
| 1887 | 245, 78, 218, 219, 220, 244, 0, 0, 0, 0, |
| 1888 | 189, 0, 0, 0, 0, 0, 0, 0, 77, 222, |
| 1889 | 223, 87, 192, 175, 94, 2, 3, 107, 111, 112, |
| 1890 | 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, |
| 1891 | 123, 124, 0, 0, 0, 0, 239, 0, 0, 106, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1892 | 125, 110, 240, 126, 215, 216, 217, 289, 247, 0, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1893 | 0, 0, 0, 202, 190, 180, 178, 170, 171, 0, |
| 1894 | 0, 0, 0, 225, 127, 0, 0, 109, 132, 134, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1895 | 0, 0, 139, 133, 288, 0, 269, 0, 0, 0, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1896 | 0, 87, 257, 258, 6, 7, 8, 9, 10, 11, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1897 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1898 | 22, 23, 0, 0, 0, 0, 0, 0, 24, 25, |
| 1899 | 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 1900 | 0, 0, 36, 37, 38, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1901 | 0, 0, 0, 0, 246, 87, 261, 0, 285, 197, |
| 1902 | 194, 193, 195, 196, 198, 201, 0, 185, 187, 183, |
| 1903 | 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
| 1904 | 121, 0, 0, 0, 0, 181, 0, 0, 0, 131, |
| 1905 | 213, 138, 136, 0, 0, 275, 268, 251, 250, 0, |
| 1906 | 0, 68, 72, 67, 71, 66, 70, 65, 69, 73, |
| 1907 | 74, 0, 0, 39, 40, 41, 42, 43, 44, 45, |
| 1908 | 46, 47, 48, 0, 63, 64, 59, 60, 61, 62, |
| 1909 | 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, |
| 1910 | 0, 97, 97, 294, 0, 0, 283, 0, 0, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1911 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1912 | 0, 199, 102, 102, 102, 153, 154, 4, 5, 151, |
| 1913 | 152, 155, 150, 146, 147, 0, 0, 0, 0, 0, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1914 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1915 | 0, 149, 148, 102, 108, 108, 135, 212, 206, 209, |
| 1916 | 210, 0, 0, 128, 228, 229, 230, 235, 231, 232, |
| 1917 | 233, 234, 226, 0, 237, 242, 241, 243, 0, 252, |
| 1918 | 0, 0, 0, 0, 0, 290, 0, 292, 287, 0, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 1919 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1920 | 0, 0, 0, 0, 200, 0, 186, 188, 184, 0, |
| 1921 | 0, 0, 0, 0, 0, 0, 141, 169, 0, 0, |
| 1922 | 145, 0, 142, 0, 0, 0, 0, 0, 182, 129, |
| 1923 | 130, 205, 207, 0, 100, 137, 227, 0, 0, 0, |
| 1924 | 0, 0, 0, 0, 0, 0, 0, 0, 297, 0, |
| 1925 | 0, 0, 279, 280, 0, 0, 0, 0, 0, 277, |
| 1926 | 276, 0, 295, 0, 0, 0, 104, 102, 0, 0, |
| 1927 | 287, 0, 0, 0, 0, 0, 140, 143, 144, 0, |
| 1928 | 0, 0, 0, 0, 211, 208, 101, 95, 0, 236, |
| 1929 | 0, 0, 267, 0, 0, 97, 98, 97, 264, 286, |
| 1930 | 0, 0, 0, 0, 0, 270, 271, 272, 267, 0, |
| 1931 | 99, 105, 103, 0, 0, 0, 0, 0, 0, 0, |
| 1932 | 168, 0, 0, 0, 0, 0, 0, 214, 0, 0, |
| 1933 | 0, 266, 0, 273, 274, 0, 291, 293, 0, 0, |
| 1934 | 0, 278, 281, 282, 0, 296, 0, 0, 157, 0, |
| 1935 | 0, 0, 0, 0, 0, 0, 0, 0, 96, 238, |
| 1936 | 0, 0, 0, 265, 262, 0, 284, 0, 0, 0, |
| 1937 | 165, 0, 0, 159, 160, 161, 156, 164, 0, 255, |
| 1938 | 0, 0, 0, 263, 162, 163, 0, 0, 0, 253, |
| 1939 | 0, 254, 0, 0, 158, 166, 167, 0, 0, 0, |
| 1940 | 0, 0, 0, 260, 0, 0, 259, 256 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1941 | }; |
| 1942 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1943 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 1944 | static const yytype_int16 yydefgoto[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1945 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1946 | -1, 86, 299, 316, 317, 318, 319, 320, 253, 270, |
| 1947 | 211, 212, 241, 213, 25, 15, 37, 497, 355, 436, |
| 1948 | 457, 376, 437, 87, 88, 214, 90, 91, 120, 223, |
| 1949 | 387, 344, 388, 109, 1, 2, 3, 323, 294, 292, |
| 1950 | 293, 63, 192, 50, 104, 196, 92, 402, 329, 330, |
| 1951 | 331, 38, 96, 16, 44, 17, 61, 18, 28, 407, |
| 1952 | 345, 93, 347, 468, 19, 40, 41, 184, 551, 98, |
| 1953 | 276, 501, 502, 185, 186, 418, 187, 188 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1954 | }; |
| 1955 | |
| 1956 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 1957 | STATE-NUM. */ |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1958 | #define YYPACT_NINF -517 |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 1959 | static const yytype_int16 yypact[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 1960 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 1961 | -517, 40, 69, 528, -517, -517, -517, -517, -517, -517, |
| 1962 | -517, -517, -517, -517, 16, 90, 76, -517, -517, 5, |
| 1963 | -517, -517, 50, -40, 71, 37, -15, -517, -4, 124, |
| 1964 | 164, -517, -517, -517, -517, -517, -517, 1244, -18, -517, |
| 1965 | -517, 125, -517, -517, -517, -517, 45, 53, 54, 59, |
| 1966 | -517, 67, 124, 1244, 103, 103, 103, 103, -517, -517, |
| 1967 | -517, 90, -517, -517, -517, -517, -517, 70, -517, -517, |
| 1968 | -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, |
| 1969 | -517, -517, 197, 215, 216, 670, -517, 125, 73, -517, |
| 1970 | -517, -62, -517, -517, -517, -517, -517, 1349, -517, 198, |
| 1971 | 111, 219, 200, 201, -517, -517, -517, -517, -517, 1264, |
| 1972 | 1264, 1264, 1309, -517, -517, 75, 77, -517, -517, -62, |
| 1973 | -108, 81, 1051, -517, -517, 1264, -517, 168, 1354, 24, |
| 1974 | 112, 90, -517, -517, -517, -517, -517, -517, -517, -517, |
| 1975 | -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, |
| 1976 | -517, -517, 108, 65, 1264, 1264, 1264, 1264, -517, -517, |
| 1977 | -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, |
| 1978 | 1264, 1264, -517, -517, -517, 1264, 1264, 1264, 1264, 1264, |
| 1979 | 1264, 1264, 1264, 1264, -517, 90, -517, 42, -517, -517, |
| 1980 | -517, -517, -517, -517, -517, -517, -110, -517, -517, -517, |
| 1981 | 157, 183, 226, 185, 227, 189, 228, 191, 230, 231, |
| 1982 | 235, 193, 239, 237, 577, -517, 1264, 1264, 1264, -517, |
| 1983 | 1092, -517, 89, 96, 763, -517, -517, 70, -517, 763, |
| 1984 | 763, -517, -517, -517, -517, -517, -517, -517, -517, -517, |
| 1985 | -517, 763, 1244, -517, -517, -517, -517, -517, -517, -517, |
| 1986 | -517, -517, -517, 1264, -517, -517, -517, -517, -517, -517, |
| 1987 | -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, |
| 1988 | 1264, 101, 102, -517, 763, 99, 107, 109, 110, 113, |
| 1989 | 114, 115, 763, 763, 763, 218, 116, 1244, 1264, 1264, |
| 1990 | 233, -517, 117, 117, 117, -517, -517, -517, -517, -517, |
| 1991 | -517, -517, -517, -517, -517, 108, 65, 119, 120, 121, |
| 1992 | 123, 126, 998, 1309, 728, 234, 127, 128, 129, 130, |
| 1993 | 131, -517, -517, 117, -56, -142, -62, -517, 125, -517, |
| 1994 | 118, 132, 1149, -517, -517, -517, -517, -517, -517, -517, |
| 1995 | -517, -517, 202, 1309, -517, -517, -517, -517, 136, -517, |
| 1996 | 137, 763, 763, 763, -7, -517, -2, -517, 138, 763, |
| 1997 | 122, 1264, 1264, 1264, 1264, 1264, 146, 147, 148, 1264, |
| 1998 | 1264, 763, 763, 149, -517, -20, -517, -517, -517, 150, |
| 1999 | 156, 1309, 1309, 1309, 1309, 1309, -517, -517, -76, -57, |
| 2000 | -517, -71, -517, 1309, 1309, 1309, 1309, 1309, -517, -517, |
| 2001 | -517, -517, -517, 1203, 262, -517, -517, 249, -48, 284, |
| 2002 | 285, 159, 165, 166, 763, 306, 763, 1264, -517, 167, |
| 2003 | 763, 169, -517, -517, 170, 171, 763, 763, 763, -517, |
| 2004 | -517, 173, -517, 1264, 290, 314, -517, 117, 1309, 1309, |
| 2005 | 138, 176, 177, 188, 190, 1309, -517, -517, -517, 195, |
| 2006 | 196, 206, 283, 208, -517, -517, -517, 272, 209, -517, |
| 2007 | 763, 763, 1264, 763, 763, 210, -517, 210, -517, 211, |
| 2008 | 763, 212, 1264, 1264, 1264, -517, -517, -517, 1264, 763, |
| 2009 | -517, -517, -517, 213, 214, 186, 1309, 1309, 1309, 1309, |
| 2010 | -517, 1309, 1309, 1309, 1264, 1309, 333, -517, 319, 221, |
| 2011 | 220, 211, 222, -517, -517, 289, -517, -517, 1264, 217, |
| 2012 | 763, -517, -517, -517, 223, -517, 1309, 1309, -517, 229, |
| 2013 | 224, 232, 236, 225, 238, 240, 241, 242, -517, -517, |
| 2014 | 326, 10, 328, -517, -517, 248, -517, 253, 254, 1309, |
| 2015 | -517, 1309, 1309, -517, -517, -517, -517, -517, 763, -517, |
| 2016 | 905, 51, 344, -517, -517, -517, 256, 261, 263, -517, |
| 2017 | 265, -517, 905, 763, -517, -517, -517, 347, 267, 300, |
| 2018 | 763, 356, 358, -517, 763, 763, -517, -517 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2019 | }; |
| 2020 | |
| 2021 | /* YYPGOTO[NTERM-NUM]. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2022 | static const yytype_int16 yypgoto[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2023 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2024 | -517, -517, -517, 286, 288, 291, 317, 320, 134, 80, |
| 2025 | -127, -125, -502, -517, 340, 391, -114, -517, -265, 14, |
| 2026 | -517, -284, -517, -51, -517, -37, -517, -66, 297, -517, |
| 2027 | -94, 207, -283, 52, -517, -517, -517, -517, -517, -517, |
| 2028 | -517, 368, -517, -517, -517, -517, 3, -517, 26, -517, |
| 2029 | -517, 372, -517, -517, -517, -517, -517, 431, -517, -517, |
| 2030 | -516, 56, 79, -124, -517, 421, -517, -517, -517, -517, |
| 2031 | -517, 25, -35, -517, -517, 4, -517, -517 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2032 | }; |
| 2033 | |
| 2034 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2035 | positive, shift that token. If negative, reduce the rule which |
| 2036 | number is the opposite. If zero, do what YYDEFACT says. |
| 2037 | If YYTABLE_NINF, syntax error. */ |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 2038 | #define YYTABLE_NINF -173 |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2039 | static const yytype_int16 yytable[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2040 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2041 | 89, 225, 106, 239, 228, 240, 26, 357, 414, 377, |
| 2042 | 378, 94, 400, 416, 434, 123, 89, 242, 215, 119, |
| 2043 | 231, 232, 233, 234, 235, 236, 237, 238, 39, 550, |
| 2044 | 389, 391, 273, 229, 560, 42, 290, 435, 218, 398, |
| 2045 | 4, 59, 291, 60, 26, 230, 568, 277, 219, 562, |
| 2046 | 415, 278, 279, 280, 281, 415, 119, 53, 285, 286, |
| 2047 | 408, 231, 232, 233, 234, 235, 236, 237, 238, -172, |
| 2048 | 445, 287, 197, 198, 199, 445, 446, 29, 7, 8, |
| 2049 | 9, 10, 54, 12, 55, 448, -108, 56, 224, 445, |
| 2050 | 121, 224, 254, 255, 5, 123, 399, 447, 445, 39, |
| 2051 | 6, 123, 46, 47, 48, 51, 459, 110, 111, 112, |
| 2052 | 7, 8, 9, 10, 11, 12, 13, 271, 272, 224, |
| 2053 | 274, 49, 231, 232, 233, 234, 235, 236, 237, 238, |
| 2054 | 58, 14, 52, 275, 224, 107, 108, 95, 224, 224, |
| 2055 | 224, 224, 282, 283, 284, 224, 224, 20, 62, 21, |
| 2056 | 324, 325, 326, 482, 30, 31, 32, 33, 34, 35, |
| 2057 | 36, 43, 549, 288, 289, 373, 190, 191, 64, 256, |
| 2058 | 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, |
| 2059 | 267, 268, 269, 328, 295, 296, -68, -68, -67, -67, |
| 2060 | 99, 351, -66, -66, -65, -65, 297, 298, 100, 101, |
| 2061 | 506, 114, 507, 561, 102, 89, 243, 244, 245, 246, |
| 2062 | 247, 248, 249, 250, 251, 252, 352, 103, -109, 115, |
| 2063 | 116, 122, 189, 193, 194, 195, 216, 226, 217, 220, |
| 2064 | -72, -71, -70, 353, -69, 332, 371, 421, -75, 423, |
| 2065 | 424, 425, -76, 300, 301, 333, 430, 354, 356, 359, |
| 2066 | 89, 372, 224, 360, 369, 361, 362, 374, 392, 363, |
| 2067 | 364, 365, 370, 375, 403, 406, 326, 381, 382, 383, |
| 2068 | 322, 384, 420, 458, 385, 393, 394, 395, 396, 397, |
| 2069 | 346, 404, 409, 410, 417, 346, 346, 440, 441, 442, |
| 2070 | 443, 444, 426, 427, 428, 433, 434, 346, 438, 449, |
| 2071 | 450, 451, 452, 453, 439, 460, 461, 462, 348, 349, |
| 2072 | 466, 463, 464, 470, 480, 472, 473, 474, 481, 494, |
| 2073 | 350, 478, 486, 487, 224, 422, 224, 224, 224, 496, |
| 2074 | 346, 401, 429, 224, 488, 518, 489, 528, 346, 346, |
| 2075 | 346, 491, 492, 529, 483, 484, 415, 548, 511, 512, |
| 2076 | 513, 490, 493, 358, 495, 498, 505, 508, 510, 516, |
| 2077 | 517, 366, 367, 368, 552, 563, 328, 530, 570, 534, |
| 2078 | 531, 532, 536, 540, 543, 539, 572, 574, 541, 575, |
| 2079 | 224, 97, 542, 179, 533, 180, 380, 544, 181, 545, |
| 2080 | 546, 547, 519, 520, 521, 522, 479, 523, 524, 525, |
| 2081 | 553, 527, 554, 555, 239, 564, 240, 346, 346, 346, |
| 2082 | 565, 567, 566, 571, 182, 346, 57, 183, 456, 222, |
| 2083 | 105, 321, 537, 538, 239, 224, 240, 346, 346, 455, |
| 2084 | 411, 412, 413, 113, 27, 224, 224, 224, 419, 379, |
| 2085 | 45, 224, 469, 514, 485, 556, 0, 557, 558, 0, |
| 2086 | 431, 432, 0, 0, 0, 0, 0, 526, 0, 0, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2087 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2088 | 346, 224, 346, 0, 0, 0, 346, 0, 0, 0, |
| 2089 | 0, 0, 346, 346, 346, 0, 0, 0, 0, 0, |
| 2090 | 0, 0, 0, 465, 0, 467, 0, 0, 0, 471, |
| 2091 | 0, 0, 0, 0, 0, 475, 476, 477, 0, 0, |
| 2092 | 0, 0, 0, 0, 0, 0, 346, 346, 0, 346, |
| 2093 | 346, 0, 0, 0, 0, 0, 346, 0, 0, 0, |
| 2094 | 0, 0, 0, 0, 0, 346, 0, 0, 0, 499, |
| 2095 | 500, 0, 503, 504, 0, 0, 0, 0, -78, 509, |
| 2096 | 20, 0, 21, 0, 0, 0, 0, 0, 515, 6, |
| 2097 | -78, -78, 0, 0, 0, 0, 346, 0, 0, -78, |
| 2098 | -78, -78, -78, -78, -78, -78, 0, 0, -78, 22, |
| 2099 | 0, 0, 65, 66, 0, 0, 23, 0, 0, 535, |
| 2100 | 24, 0, 0, 0, 0, 0, 0, 0, 0, 20, |
| 2101 | 0, 21, 0, 302, 346, 0, 0, 0, 0, 0, |
| 2102 | 0, 0, 0, 0, 0, 303, 304, 0, 0, 346, |
| 2103 | 0, 0, 0, 0, 0, 0, 346, 559, 0, 0, |
| 2104 | 346, 346, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2105 | 0, 0, 569, 0, 0, 0, 0, 0, 0, 573, |
| 2106 | 0, 0, 0, 576, 577, 134, 135, 136, 137, 138, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2107 | 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2108 | 149, 150, 151, 305, 306, 65, 66, 0, 117, 68, |
| 2109 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2110 | 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, |
| 2111 | 307, 158, 159, 160, 161, 162, 163, 164, 165, 166, |
| 2112 | 167, 168, 169, 0, 308, 172, 173, 174, 81, 309, |
| 2113 | 310, 311, 0, 0, 0, 0, 0, 312, 0, 0, |
| 2114 | 313, 0, 314, 65, 66, 315, 117, 200, 201, 202, |
| 2115 | 203, 204, 205, 206, 207, 208, 209, 210, 79, 80, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 2116 | 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2117 | 0, 0, 0, 0, 0, 0, 334, 335, 65, 66, |
| 2118 | 336, 0, 0, 0, 0, 0, 81, 0, 0, 0, |
| 2119 | 0, 0, 0, 0, 0, 20, 0, 21, 0, 337, |
| 2120 | 338, 339, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2121 | 0, 340, 341, 0, 0, 0, 0, 0, 0, 0, |
| 2122 | 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, |
| 2123 | 83, 0, 0, 84, 342, 85, 118, 0, 0, 0, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2124 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2125 | 0, 134, 135, 136, 137, 138, 139, 140, 141, 142, |
| 2126 | 143, 144, 145, 146, 147, 148, 149, 150, 151, 305, |
| 2127 | 306, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2128 | 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, |
| 2129 | 0, 84, 0, 85, 390, 0, 307, 158, 159, 160, |
| 2130 | 161, 162, 163, 164, 165, 166, 167, 168, 169, 0, |
| 2131 | 308, 172, 173, 174, 0, 309, 310, 311, 334, 335, |
| 2132 | 0, 0, 336, 0, 0, 0, 343, 0, 0, 0, |
| 2133 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2134 | 0, 337, 338, 339, 0, 0, 0, 0, 0, 0, |
| 2135 | 0, 0, 0, 340, 341, 0, 0, 0, 0, 0, |
| 2136 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2137 | 0, 0, 0, 0, 0, 0, 342, 0, 0, 0, |
| 2138 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2139 | 0, 0, 0, 134, 135, 136, 137, 138, 139, 140, |
| 2140 | 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, |
| 2141 | 151, 305, 306, 65, 66, 0, 117, 200, 201, 202, |
| 2142 | 203, 204, 205, 206, 207, 208, 209, 210, 79, 80, |
| 2143 | 20, 0, 21, 0, 0, 0, 0, 0, 307, 158, |
| 2144 | 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, |
| 2145 | 169, 0, 308, 172, 173, 174, 81, 309, 310, 311, |
| 2146 | 0, 0, 0, 0, 0, 0, 65, 66, 343, 117, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2147 | 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, |
| 2148 | 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2149 | 0, 0, 0, 0, 0, 0, 0, 0, 221, 0, |
| 2150 | 0, 0, 0, 0, 0, 0, 0, 65, 66, 81, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2151 | 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, |
| 2152 | 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2153 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 327, |
| 2154 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2155 | 81, 0, 0, 0, 0, 82, 0, 0, 83, 0, |
| 2156 | 386, 84, 0, 85, 65, 66, 0, 117, 68, 69, |
| 2157 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2158 | 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, |
| 2159 | 0, 0, 0, 0, 0, 0, 405, 0, 0, 0, |
| 2160 | 0, 0, 0, 0, 0, 0, 0, 81, 82, 0, |
| 2161 | 0, 83, 0, 0, 84, 0, 85, 0, 65, 66, |
| 2162 | 0, 117, 68, 69, 70, 71, 72, 73, 74, 75, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2163 | 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2164 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, |
| 2165 | 454, 0, 83, 0, 0, 84, 0, 85, 0, 65, |
| 2166 | 66, 81, 67, 68, 69, 70, 71, 72, 73, 74, |
| 2167 | 75, 76, 77, 78, 79, 80, 20, 0, 21, 65, |
| 2168 | 66, 0, 117, 68, 69, 70, 71, 72, 73, 74, |
| 2169 | 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, |
| 2170 | 0, 0, 81, 0, 0, 0, 82, 0, 0, 83, |
| 2171 | 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, |
| 2172 | 0, 0, 81, 0, 65, 66, 0, 117, 200, 201, |
| 2173 | 202, 203, 204, 205, 206, 207, 208, 209, 210, 79, |
| 2174 | 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2175 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2176 | 82, 0, 0, 83, 0, 0, 84, 81, 85, 65, |
| 2177 | 66, 0, 227, 68, 69, 70, 71, 72, 73, 74, |
| 2178 | 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, |
| 2179 | 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, |
| 2180 | 0, 82, 0, 0, 83, 0, 0, 84, 125, 85, |
| 2181 | 0, 0, 81, 0, 0, 0, 0, 0, 126, 127, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2182 | 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2183 | 0, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
| 2184 | 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, |
| 2185 | 147, 148, 149, 150, 151, 152, 153, 0, 0, 0, |
| 2186 | 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, |
| 2187 | 0, 0, 84, 0, 85, 0, 0, 154, 155, 156, |
| 2188 | 0, 0, 157, 158, 159, 160, 161, 162, 163, 164, |
| 2189 | 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, |
| 2190 | 175, 176, 177, 178, 0, 0, 0, 0, 0, 0, |
| 2191 | 0, 82, 0, 0, 83, 0, 0, 84, 0, 85 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2192 | }; |
| 2193 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2194 | static const yytype_int16 yycheck[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2195 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2196 | 37, 125, 53, 130, 128, 130, 3, 272, 15, 293, |
| 2197 | 294, 29, 154, 15, 34, 157, 53, 131, 112, 85, |
| 2198 | 10, 11, 12, 13, 14, 15, 16, 17, 23, 531, |
| 2199 | 313, 314, 156, 9, 550, 30, 146, 57, 146, 323, |
| 2200 | 0, 45, 152, 47, 41, 21, 562, 171, 156, 551, |
| 2201 | 57, 175, 176, 177, 178, 57, 122, 20, 182, 183, |
| 2202 | 343, 10, 11, 12, 13, 14, 15, 16, 17, 0, |
| 2203 | 146, 185, 109, 110, 111, 146, 152, 61, 41, 42, |
| 2204 | 43, 44, 45, 46, 47, 156, 148, 50, 125, 146, |
| 2205 | 87, 128, 27, 28, 25, 157, 152, 154, 146, 23, |
| 2206 | 31, 157, 52, 53, 54, 145, 154, 55, 56, 57, |
| 2207 | 41, 42, 43, 44, 45, 46, 47, 154, 155, 156, |
| 2208 | 157, 71, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2209 | 145, 62, 61, 170, 171, 32, 33, 155, 175, 176, |
| 2210 | 177, 178, 179, 180, 181, 182, 183, 22, 24, 24, |
| 2211 | 216, 217, 218, 437, 64, 65, 66, 67, 68, 69, |
| 2212 | 70, 156, 152, 121, 122, 289, 55, 56, 4, 104, |
| 2213 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 2214 | 115, 116, 117, 220, 27, 28, 3, 4, 3, 4, |
| 2215 | 145, 242, 3, 4, 3, 4, 3, 4, 145, 145, |
| 2216 | 465, 4, 467, 152, 145, 242, 98, 99, 100, 101, |
| 2217 | 102, 103, 104, 105, 106, 107, 253, 150, 148, 4, |
| 2218 | 4, 148, 24, 4, 24, 24, 151, 59, 151, 148, |
| 2219 | 4, 4, 4, 270, 4, 146, 287, 361, 7, 363, |
| 2220 | 364, 365, 7, 4, 7, 149, 370, 146, 146, 150, |
| 2221 | 287, 288, 289, 146, 36, 146, 146, 24, 24, 146, |
| 2222 | 146, 146, 146, 146, 146, 63, 332, 148, 148, 148, |
| 2223 | 214, 148, 150, 24, 148, 148, 148, 148, 148, 148, |
| 2224 | 224, 149, 146, 146, 146, 229, 230, 381, 382, 383, |
| 2225 | 384, 385, 146, 146, 146, 146, 34, 241, 148, 393, |
| 2226 | 394, 395, 396, 397, 148, 21, 21, 148, 229, 230, |
| 2227 | 4, 146, 146, 146, 24, 146, 146, 146, 4, 36, |
| 2228 | 241, 148, 146, 146, 361, 362, 363, 364, 365, 57, |
| 2229 | 274, 328, 369, 370, 146, 149, 146, 4, 282, 283, |
| 2230 | 284, 146, 146, 24, 438, 439, 57, 21, 472, 473, |
| 2231 | 474, 445, 146, 274, 146, 146, 146, 146, 146, 146, |
| 2232 | 146, 282, 283, 284, 36, 21, 403, 146, 21, 152, |
| 2233 | 150, 149, 149, 149, 149, 146, 76, 21, 146, 21, |
| 2234 | 417, 41, 146, 97, 508, 97, 306, 149, 97, 149, |
| 2235 | 149, 149, 486, 487, 488, 489, 433, 491, 492, 493, |
| 2236 | 152, 495, 149, 149, 531, 149, 531, 351, 352, 353, |
| 2237 | 149, 146, 149, 146, 97, 359, 25, 97, 404, 122, |
| 2238 | 52, 214, 516, 517, 551, 462, 551, 371, 372, 403, |
| 2239 | 351, 352, 353, 61, 3, 472, 473, 474, 359, 305, |
| 2240 | 19, 478, 417, 478, 440, 539, -1, 541, 542, -1, |
| 2241 | 371, 372, -1, -1, -1, -1, -1, 494, -1, -1, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2242 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2243 | 414, 508, 416, -1, -1, -1, 420, -1, -1, -1, |
| 2244 | -1, -1, 426, 427, 428, -1, -1, -1, -1, -1, |
| 2245 | -1, -1, -1, 414, -1, 416, -1, -1, -1, 420, |
| 2246 | -1, -1, -1, -1, -1, 426, 427, 428, -1, -1, |
| 2247 | -1, -1, -1, -1, -1, -1, 460, 461, -1, 463, |
| 2248 | 464, -1, -1, -1, -1, -1, 470, -1, -1, -1, |
| 2249 | -1, -1, -1, -1, -1, 479, -1, -1, -1, 460, |
| 2250 | 461, -1, 463, 464, -1, -1, -1, -1, 20, 470, |
| 2251 | 22, -1, 24, -1, -1, -1, -1, -1, 479, 31, |
| 2252 | 32, 33, -1, -1, -1, -1, 510, -1, -1, 41, |
| 2253 | 42, 43, 44, 45, 46, 47, -1, -1, 50, 51, |
| 2254 | -1, -1, 5, 6, -1, -1, 58, -1, -1, 510, |
| 2255 | 62, -1, -1, -1, -1, -1, -1, -1, -1, 22, |
| 2256 | -1, 24, -1, 26, 548, -1, -1, -1, -1, -1, |
| 2257 | -1, -1, -1, -1, -1, 38, 39, -1, -1, 563, |
| 2258 | -1, -1, -1, -1, -1, -1, 570, 548, -1, -1, |
| 2259 | 574, 575, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2260 | -1, -1, 563, -1, -1, -1, -1, -1, -1, 570, |
| 2261 | -1, -1, -1, 574, 575, 78, 79, 80, 81, 82, |
| 2262 | 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, |
| 2263 | 93, 94, 95, 96, 97, 5, 6, -1, 8, 9, |
| 2264 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, |
| 2265 | 20, 21, 22, -1, 24, -1, -1, -1, -1, -1, |
| 2266 | 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, |
| 2267 | 133, 134, 135, -1, 137, 138, 139, 140, 48, 142, |
| 2268 | 143, 144, -1, -1, -1, -1, -1, 150, -1, -1, |
| 2269 | 153, -1, 155, 5, 6, 158, 8, 9, 10, 11, |
| 2270 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 2271 | 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2272 | -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, |
| 2273 | 7, -1, -1, -1, -1, -1, 48, -1, -1, -1, |
| 2274 | -1, -1, -1, -1, -1, 22, -1, 24, -1, 26, |
| 2275 | 27, 28, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2276 | -1, 38, 39, -1, -1, -1, -1, -1, -1, -1, |
| 2277 | -1, -1, -1, -1, -1, -1, -1, 147, -1, -1, |
| 2278 | 150, -1, -1, 153, 61, 155, 156, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2279 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2280 | -1, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2281 | 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, |
| 2282 | 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2283 | -1, -1, -1, -1, -1, 147, -1, -1, 150, -1, |
| 2284 | -1, 153, -1, 155, 156, -1, 123, 124, 125, 126, |
| 2285 | 127, 128, 129, 130, 131, 132, 133, 134, 135, -1, |
| 2286 | 137, 138, 139, 140, -1, 142, 143, 144, 3, 4, |
| 2287 | -1, -1, 7, -1, -1, -1, 153, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2288 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2289 | -1, 26, 27, 28, -1, -1, -1, -1, -1, -1, |
| 2290 | -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 2291 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2292 | -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, |
| 2293 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2294 | -1, -1, -1, 78, 79, 80, 81, 82, 83, 84, |
| 2295 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 2296 | 95, 96, 97, 5, 6, -1, 8, 9, 10, 11, |
| 2297 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
| 2298 | 22, -1, 24, -1, -1, -1, -1, -1, 123, 124, |
| 2299 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 2300 | 135, -1, 137, 138, 139, 140, 48, 142, 143, 144, |
| 2301 | -1, -1, -1, -1, -1, -1, 5, 6, 153, 8, |
| 2302 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2303 | 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, |
| 2304 | -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, |
| 2305 | -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, |
| 2306 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2307 | 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, |
| 2308 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, |
| 2309 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2310 | 48, -1, -1, -1, -1, 147, -1, -1, 150, -1, |
| 2311 | 152, 153, -1, 155, 5, 6, -1, 8, 9, 10, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2312 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2313 | 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, |
| 2314 | -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, |
| 2315 | -1, -1, -1, -1, -1, -1, -1, 48, 147, -1, |
| 2316 | -1, 150, -1, -1, 153, -1, 155, -1, 5, 6, |
| 2317 | -1, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 2318 | 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, |
| 2319 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 147, |
| 2320 | 37, -1, 150, -1, -1, 153, -1, 155, -1, 5, |
| 2321 | 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, |
| 2322 | 16, 17, 18, 19, 20, 21, 22, -1, 24, 5, |
| 2323 | 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, |
| 2324 | 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, |
| 2325 | -1, -1, 48, -1, -1, -1, 147, -1, -1, 150, |
| 2326 | -1, -1, 153, -1, 155, -1, -1, -1, -1, -1, |
| 2327 | -1, -1, 48, -1, 5, 6, -1, 8, 9, 10, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2328 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 2329 | 21, 22, -1, 24, -1, -1, -1, -1, -1, -1, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 2330 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2331 | 147, -1, -1, 150, -1, -1, 153, 48, 155, 5, |
| 2332 | 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, |
| 2333 | 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, |
| 2334 | -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, |
| 2335 | -1, 147, -1, -1, 150, -1, -1, 153, 49, 155, |
| 2336 | -1, -1, 48, -1, -1, -1, -1, -1, 59, 60, |
| 2337 | -1, 147, -1, -1, 150, -1, -1, 153, -1, 155, |
| 2338 | -1, 72, 73, 74, 75, 76, 77, 78, 79, 80, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2339 | 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2340 | 91, 92, 93, 94, 95, 96, 97, -1, -1, -1, |
| 2341 | -1, -1, -1, -1, -1, -1, 147, -1, -1, 150, |
| 2342 | -1, -1, 153, -1, 155, -1, -1, 118, 119, 120, |
Reid Spencer | 4012e83 | 2006-12-04 05:24:24 +0000 | [diff] [blame] | 2343 | -1, -1, 123, 124, 125, 126, 127, 128, 129, 130, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2344 | 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, |
| 2345 | 141, 142, 143, 144, -1, -1, -1, -1, -1, -1, |
| 2346 | -1, 147, -1, -1, 150, -1, -1, 153, -1, 155 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2347 | }; |
| 2348 | |
| 2349 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2350 | symbol of state STATE-NUM. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2351 | static const yytype_uint8 yystos[] = |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2352 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2353 | 0, 193, 194, 195, 0, 25, 31, 41, 42, 43, |
| 2354 | 44, 45, 46, 47, 62, 174, 212, 214, 216, 223, |
| 2355 | 22, 24, 51, 58, 62, 173, 205, 216, 217, 61, |
| 2356 | 64, 65, 66, 67, 68, 69, 70, 175, 210, 23, |
| 2357 | 224, 225, 30, 156, 213, 224, 52, 53, 54, 71, |
| 2358 | 202, 145, 61, 20, 45, 47, 50, 174, 145, 45, |
| 2359 | 47, 215, 24, 200, 4, 5, 6, 8, 9, 10, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2360 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2361 | 21, 48, 147, 150, 153, 155, 160, 182, 183, 184, |
| 2362 | 185, 186, 205, 220, 29, 155, 211, 173, 228, 145, |
| 2363 | 145, 145, 145, 150, 203, 200, 182, 32, 33, 192, |
| 2364 | 192, 192, 192, 210, 4, 4, 4, 8, 156, 186, |
| 2365 | 187, 205, 148, 157, 35, 49, 59, 60, 72, 73, |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2366 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2367 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 2368 | 94, 95, 96, 97, 118, 119, 120, 123, 124, 125, |
| 2369 | 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 2370 | 136, 137, 138, 139, 140, 141, 142, 143, 144, 162, |
| 2371 | 163, 164, 165, 166, 226, 232, 233, 235, 236, 24, |
| 2372 | 55, 56, 201, 4, 24, 24, 204, 184, 184, 184, |
| 2373 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
| 2374 | 19, 169, 170, 172, 184, 189, 151, 151, 146, 156, |
| 2375 | 148, 37, 187, 188, 184, 222, 59, 8, 222, 9, |
| 2376 | 21, 10, 11, 12, 13, 14, 15, 16, 17, 169, |
| 2377 | 170, 171, 175, 98, 99, 100, 101, 102, 103, 104, |
| 2378 | 105, 106, 107, 167, 27, 28, 104, 105, 106, 107, |
| 2379 | 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, |
| 2380 | 168, 184, 184, 222, 184, 184, 229, 222, 222, 222, |
| 2381 | 222, 222, 184, 184, 184, 222, 222, 175, 121, 122, |
| 2382 | 146, 152, 198, 199, 197, 27, 28, 3, 4, 161, |
| 2383 | 4, 7, 26, 38, 39, 96, 97, 123, 137, 142, |
| 2384 | 143, 144, 150, 153, 155, 158, 162, 163, 164, 165, |
| 2385 | 166, 190, 220, 196, 186, 186, 186, 37, 184, 207, |
| 2386 | 208, 209, 146, 149, 3, 4, 7, 26, 27, 28, |
| 2387 | 38, 39, 61, 153, 190, 219, 220, 221, 221, 221, |
| 2388 | 221, 182, 184, 184, 146, 177, 146, 177, 221, 150, |
| 2389 | 146, 146, 146, 146, 146, 146, 221, 221, 221, 36, |
| 2390 | 146, 182, 184, 222, 24, 146, 180, 180, 180, 167, |
| 2391 | 168, 148, 148, 148, 148, 148, 152, 189, 191, 191, |
| 2392 | 156, 191, 24, 148, 148, 148, 148, 148, 180, 152, |
| 2393 | 154, 205, 206, 146, 149, 37, 63, 218, 191, 146, |
| 2394 | 146, 221, 221, 221, 15, 57, 15, 146, 234, 221, |
| 2395 | 150, 222, 184, 222, 222, 222, 146, 146, 146, 184, |
| 2396 | 222, 221, 221, 146, 34, 57, 178, 181, 148, 148, |
| 2397 | 189, 189, 189, 189, 189, 146, 152, 154, 156, 189, |
| 2398 | 189, 189, 189, 189, 37, 207, 178, 179, 24, 154, |
| 2399 | 21, 21, 148, 146, 146, 221, 4, 221, 222, 230, |
| 2400 | 146, 221, 146, 146, 146, 221, 221, 221, 148, 184, |
| 2401 | 24, 4, 180, 189, 189, 234, 146, 146, 146, 146, |
| 2402 | 189, 146, 146, 146, 36, 146, 57, 176, 146, 221, |
| 2403 | 221, 230, 231, 221, 221, 146, 177, 177, 146, 221, |
| 2404 | 146, 222, 222, 222, 231, 221, 146, 146, 149, 189, |
| 2405 | 189, 189, 189, 189, 189, 189, 184, 189, 4, 24, |
| 2406 | 146, 150, 149, 222, 152, 221, 149, 189, 189, 146, |
| 2407 | 149, 146, 146, 149, 149, 149, 149, 149, 21, 152, |
| 2408 | 171, 227, 36, 152, 149, 149, 189, 189, 189, 221, |
| 2409 | 219, 152, 171, 21, 149, 149, 149, 146, 219, 221, |
| 2410 | 21, 146, 76, 221, 21, 21, 221, 221 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2411 | }; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2412 | |
| 2413 | #define yyerrok (yyerrstatus = 0) |
| 2414 | #define yyclearin (yychar = YYEMPTY) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2415 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2416 | #define YYEOF 0 |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2417 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2418 | #define YYACCEPT goto yyacceptlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2419 | #define YYABORT goto yyabortlab |
| 2420 | #define YYERROR goto yyerrorlab |
| 2421 | |
| 2422 | |
| 2423 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2424 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2425 | Once GCC version 2 has supplanted version 1, this can go. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2426 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2427 | #define YYFAIL goto yyerrlab |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2428 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2429 | #define YYRECOVERING() (!!yyerrstatus) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2430 | |
| 2431 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2432 | do \ |
| 2433 | if (yychar == YYEMPTY && yylen == 1) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2434 | { \ |
| 2435 | yychar = (Token); \ |
| 2436 | yylval = (Value); \ |
| 2437 | yytoken = YYTRANSLATE (yychar); \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2438 | YYPOPSTACK (1); \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2439 | goto yybackup; \ |
| 2440 | } \ |
| 2441 | else \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2442 | { \ |
| 2443 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2444 | YYERROR; \ |
| 2445 | } \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2446 | while (YYID (0)) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 2447 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2448 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2449 | #define YYTERROR 1 |
| 2450 | #define YYERRCODE 256 |
| 2451 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2452 | |
| 2453 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2454 | If N is 0, then set CURRENT to the empty location which ends |
| 2455 | the previous symbol: RHS[0] (always defined). */ |
| 2456 | |
| 2457 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2458 | #ifndef YYLLOC_DEFAULT |
| 2459 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2460 | do \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2461 | if (YYID (N)) \ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2462 | { \ |
| 2463 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2464 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2465 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2466 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2467 | } \ |
| 2468 | else \ |
| 2469 | { \ |
| 2470 | (Current).first_line = (Current).last_line = \ |
| 2471 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2472 | (Current).first_column = (Current).last_column = \ |
| 2473 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2474 | } \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2475 | while (YYID (0)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2476 | #endif |
| 2477 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2478 | |
| 2479 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2480 | This macro was not mandated originally: define only if we know |
| 2481 | we won't break user code: when these are the locations we know. */ |
| 2482 | |
| 2483 | #ifndef YY_LOCATION_PRINT |
| 2484 | # if YYLTYPE_IS_TRIVIAL |
| 2485 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2486 | fprintf (File, "%d.%d-%d.%d", \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2487 | (Loc).first_line, (Loc).first_column, \ |
| 2488 | (Loc).last_line, (Loc).last_column) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2489 | # else |
| 2490 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2491 | # endif |
| 2492 | #endif |
| 2493 | |
| 2494 | |
| 2495 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2496 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2497 | #ifdef YYLEX_PARAM |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2498 | # define YYLEX yylex (YYLEX_PARAM) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2499 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2500 | # define YYLEX yylex () |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2501 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2502 | |
| 2503 | /* Enable debugging if requested. */ |
| 2504 | #if YYDEBUG |
| 2505 | |
| 2506 | # ifndef YYFPRINTF |
| 2507 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2508 | # define YYFPRINTF fprintf |
| 2509 | # endif |
| 2510 | |
| 2511 | # define YYDPRINTF(Args) \ |
| 2512 | do { \ |
| 2513 | if (yydebug) \ |
| 2514 | YYFPRINTF Args; \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2515 | } while (YYID (0)) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2516 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2517 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2518 | do { \ |
| 2519 | if (yydebug) \ |
| 2520 | { \ |
| 2521 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2522 | yy_symbol_print (stderr, \ |
| 2523 | Type, Value); \ |
| 2524 | YYFPRINTF (stderr, "\n"); \ |
| 2525 | } \ |
| 2526 | } while (YYID (0)) |
| 2527 | |
| 2528 | |
| 2529 | /*--------------------------------. |
| 2530 | | Print this symbol on YYOUTPUT. | |
| 2531 | `--------------------------------*/ |
| 2532 | |
| 2533 | /*ARGSUSED*/ |
| 2534 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2535 | || defined __cplusplus || defined _MSC_VER) |
| 2536 | static void |
| 2537 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 2538 | #else |
| 2539 | static void |
| 2540 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 2541 | FILE *yyoutput; |
| 2542 | int yytype; |
| 2543 | YYSTYPE const * const yyvaluep; |
| 2544 | #endif |
| 2545 | { |
| 2546 | if (!yyvaluep) |
| 2547 | return; |
| 2548 | # ifdef YYPRINT |
| 2549 | if (yytype < YYNTOKENS) |
| 2550 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2551 | # else |
| 2552 | YYUSE (yyoutput); |
| 2553 | # endif |
| 2554 | switch (yytype) |
| 2555 | { |
| 2556 | default: |
| 2557 | break; |
| 2558 | } |
| 2559 | } |
| 2560 | |
| 2561 | |
| 2562 | /*--------------------------------. |
| 2563 | | Print this symbol on YYOUTPUT. | |
| 2564 | `--------------------------------*/ |
| 2565 | |
| 2566 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2567 | || defined __cplusplus || defined _MSC_VER) |
| 2568 | static void |
| 2569 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 2570 | #else |
| 2571 | static void |
| 2572 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 2573 | FILE *yyoutput; |
| 2574 | int yytype; |
| 2575 | YYSTYPE const * const yyvaluep; |
| 2576 | #endif |
| 2577 | { |
| 2578 | if (yytype < YYNTOKENS) |
| 2579 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2580 | else |
| 2581 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
| 2582 | |
| 2583 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 2584 | YYFPRINTF (yyoutput, ")"); |
| 2585 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2586 | |
| 2587 | /*------------------------------------------------------------------. |
| 2588 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2589 | | TOP (included). | |
| 2590 | `------------------------------------------------------------------*/ |
| 2591 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2592 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2593 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2594 | static void |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2595 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2596 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2597 | static void |
| 2598 | yy_stack_print (bottom, top) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2599 | yytype_int16 *bottom; |
| 2600 | yytype_int16 *top; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2601 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2602 | { |
| 2603 | YYFPRINTF (stderr, "Stack now"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2604 | for (; bottom <= top; ++bottom) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2605 | YYFPRINTF (stderr, " %d", *bottom); |
| 2606 | YYFPRINTF (stderr, "\n"); |
| 2607 | } |
| 2608 | |
| 2609 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2610 | do { \ |
| 2611 | if (yydebug) \ |
| 2612 | yy_stack_print ((Bottom), (Top)); \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2613 | } while (YYID (0)) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2614 | |
| 2615 | |
| 2616 | /*------------------------------------------------. |
| 2617 | | Report that the YYRULE is going to be reduced. | |
| 2618 | `------------------------------------------------*/ |
| 2619 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2620 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2621 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2622 | static void |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2623 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2624 | #else |
| 2625 | static void |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2626 | yy_reduce_print (yyvsp, yyrule) |
| 2627 | YYSTYPE *yyvsp; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2628 | int yyrule; |
Chris Lattner | 1ae022f | 2006-10-22 06:08:13 +0000 | [diff] [blame] | 2629 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2630 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2631 | int yynrhs = yyr2[yyrule]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2632 | int yyi; |
| 2633 | unsigned long int yylno = yyrline[yyrule]; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2634 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 2635 | yyrule - 1, yylno); |
| 2636 | /* The symbols being reduced. */ |
| 2637 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 2638 | { |
| 2639 | fprintf (stderr, " $%d = ", yyi + 1); |
| 2640 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 2641 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 2642 | ); |
| 2643 | fprintf (stderr, "\n"); |
| 2644 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2645 | } |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2646 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2647 | # define YY_REDUCE_PRINT(Rule) \ |
| 2648 | do { \ |
| 2649 | if (yydebug) \ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2650 | yy_reduce_print (yyvsp, Rule); \ |
| 2651 | } while (YYID (0)) |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2652 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2653 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2654 | multiple parsers can coexist. */ |
| 2655 | int yydebug; |
| 2656 | #else /* !YYDEBUG */ |
| 2657 | # define YYDPRINTF(Args) |
| 2658 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2659 | # define YY_STACK_PRINT(Bottom, Top) |
| 2660 | # define YY_REDUCE_PRINT(Rule) |
| 2661 | #endif /* !YYDEBUG */ |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2662 | |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2663 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2664 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2665 | #ifndef YYINITDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2666 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2667 | #endif |
| 2668 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2669 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2670 | if the built-in stack extension method is used). |
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 | Do not make this value too large; the results are undefined if |
| 2673 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2674 | evaluated with infinite-precision integer arithmetic. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2675 | |
| 2676 | #ifndef YYMAXDEPTH |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2677 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2678 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2679 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2680 | |
| 2681 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2682 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2683 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2684 | # ifndef yystrlen |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2685 | # if defined __GLIBC__ && defined _STRING_H |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2686 | # define yystrlen strlen |
| 2687 | # else |
| 2688 | /* Return the length of YYSTR. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2689 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2690 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2691 | static YYSIZE_T |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2692 | yystrlen (const char *yystr) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2693 | #else |
| 2694 | static YYSIZE_T |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2695 | yystrlen (yystr) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2696 | const char *yystr; |
| 2697 | #endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2698 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2699 | YYSIZE_T yylen; |
| 2700 | for (yylen = 0; yystr[yylen]; yylen++) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2701 | continue; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2702 | return yylen; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2703 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2704 | # endif |
| 2705 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2706 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2707 | # ifndef yystpcpy |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2708 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2709 | # define yystpcpy stpcpy |
| 2710 | # else |
| 2711 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2712 | YYDEST. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2713 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2714 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2715 | static char * |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2716 | yystpcpy (char *yydest, const char *yysrc) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2717 | #else |
| 2718 | static char * |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2719 | yystpcpy (yydest, yysrc) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2720 | char *yydest; |
| 2721 | const char *yysrc; |
| 2722 | #endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2723 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2724 | char *yyd = yydest; |
| 2725 | const char *yys = yysrc; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2726 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2727 | while ((*yyd++ = *yys++) != '\0') |
| 2728 | continue; |
| 2729 | |
| 2730 | return yyd - 1; |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2731 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2732 | # endif |
| 2733 | # endif |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2734 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2735 | # ifndef yytnamerr |
| 2736 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 2737 | quotes and backslashes, so that it's suitable for yyerror. The |
| 2738 | heuristic is that double-quoting is unnecessary unless the string |
| 2739 | contains an apostrophe, a comma, or backslash (other than |
| 2740 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 2741 | null, do not copy; instead, return the length of what the result |
| 2742 | would have been. */ |
| 2743 | static YYSIZE_T |
| 2744 | yytnamerr (char *yyres, const char *yystr) |
| 2745 | { |
| 2746 | if (*yystr == '"') |
| 2747 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2748 | YYSIZE_T yyn = 0; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2749 | char const *yyp = yystr; |
| 2750 | |
| 2751 | for (;;) |
| 2752 | switch (*++yyp) |
| 2753 | { |
| 2754 | case '\'': |
| 2755 | case ',': |
| 2756 | goto do_not_strip_quotes; |
| 2757 | |
| 2758 | case '\\': |
| 2759 | if (*++yyp != '\\') |
| 2760 | goto do_not_strip_quotes; |
| 2761 | /* Fall through. */ |
| 2762 | default: |
| 2763 | if (yyres) |
| 2764 | yyres[yyn] = *yyp; |
| 2765 | yyn++; |
| 2766 | break; |
| 2767 | |
| 2768 | case '"': |
| 2769 | if (yyres) |
| 2770 | yyres[yyn] = '\0'; |
| 2771 | return yyn; |
| 2772 | } |
| 2773 | do_not_strip_quotes: ; |
| 2774 | } |
| 2775 | |
| 2776 | if (! yyres) |
| 2777 | return yystrlen (yystr); |
| 2778 | |
| 2779 | return yystpcpy (yyres, yystr) - yyres; |
| 2780 | } |
| 2781 | # endif |
| 2782 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2783 | /* Copy into YYRESULT an error message about the unexpected token |
| 2784 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 2785 | including the terminating null byte. If YYRESULT is null, do not |
| 2786 | copy anything; just return the number of bytes that would be |
| 2787 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 2788 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 2789 | size calculation. */ |
| 2790 | static YYSIZE_T |
| 2791 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 2792 | { |
| 2793 | int yyn = yypact[yystate]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2794 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2795 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 2796 | return 0; |
| 2797 | else |
| 2798 | { |
| 2799 | int yytype = YYTRANSLATE (yychar); |
| 2800 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 2801 | YYSIZE_T yysize = yysize0; |
| 2802 | YYSIZE_T yysize1; |
| 2803 | int yysize_overflow = 0; |
| 2804 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 2805 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 2806 | int yyx; |
| 2807 | |
| 2808 | # if 0 |
| 2809 | /* This is so xgettext sees the translatable formats that are |
| 2810 | constructed on the fly. */ |
| 2811 | YY_("syntax error, unexpected %s"); |
| 2812 | YY_("syntax error, unexpected %s, expecting %s"); |
| 2813 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 2814 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 2815 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 2816 | # endif |
| 2817 | char *yyfmt; |
| 2818 | char const *yyf; |
| 2819 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 2820 | static char const yyexpecting[] = ", expecting %s"; |
| 2821 | static char const yyor[] = " or %s"; |
| 2822 | char yyformat[sizeof yyunexpected |
| 2823 | + sizeof yyexpecting - 1 |
| 2824 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 2825 | * (sizeof yyor - 1))]; |
| 2826 | char const *yyprefix = yyexpecting; |
| 2827 | |
| 2828 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 2829 | YYCHECK. */ |
| 2830 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 2831 | |
| 2832 | /* Stay within bounds of both yycheck and yytname. */ |
| 2833 | int yychecklim = YYLAST - yyn + 1; |
| 2834 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 2835 | int yycount = 1; |
| 2836 | |
| 2837 | yyarg[0] = yytname[yytype]; |
| 2838 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 2839 | |
| 2840 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 2841 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 2842 | { |
| 2843 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 2844 | { |
| 2845 | yycount = 1; |
| 2846 | yysize = yysize0; |
| 2847 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 2848 | break; |
| 2849 | } |
| 2850 | yyarg[yycount++] = yytname[yyx]; |
| 2851 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 2852 | yysize_overflow |= (yysize1 < yysize); |
| 2853 | yysize = yysize1; |
| 2854 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 2855 | yyprefix = yyor; |
| 2856 | } |
| 2857 | |
| 2858 | yyf = YY_(yyformat); |
| 2859 | yysize1 = yysize + yystrlen (yyf); |
| 2860 | yysize_overflow |= (yysize1 < yysize); |
| 2861 | yysize = yysize1; |
| 2862 | |
| 2863 | if (yysize_overflow) |
| 2864 | return YYSIZE_MAXIMUM; |
| 2865 | |
| 2866 | if (yyresult) |
| 2867 | { |
| 2868 | /* Avoid sprintf, as that infringes on the user's name space. |
| 2869 | Don't have undefined behavior even if the translation |
| 2870 | produced a string with the wrong number of "%s"s. */ |
| 2871 | char *yyp = yyresult; |
| 2872 | int yyi = 0; |
| 2873 | while ((*yyp = *yyf) != '\0') |
| 2874 | { |
| 2875 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 2876 | { |
| 2877 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 2878 | yyf += 2; |
| 2879 | } |
| 2880 | else |
| 2881 | { |
| 2882 | yyp++; |
| 2883 | yyf++; |
| 2884 | } |
| 2885 | } |
| 2886 | } |
| 2887 | return yysize; |
| 2888 | } |
| 2889 | } |
| 2890 | #endif /* YYERROR_VERBOSE */ |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 2891 | |
| 2892 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2893 | /*-----------------------------------------------. |
| 2894 | | Release the memory associated to this symbol. | |
| 2895 | `-----------------------------------------------*/ |
| 2896 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2897 | /*ARGSUSED*/ |
| 2898 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2899 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2900 | static void |
| 2901 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 2902 | #else |
| 2903 | static void |
| 2904 | yydestruct (yymsg, yytype, yyvaluep) |
| 2905 | const char *yymsg; |
| 2906 | int yytype; |
| 2907 | YYSTYPE *yyvaluep; |
| 2908 | #endif |
| 2909 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2910 | YYUSE (yyvaluep); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2911 | |
| 2912 | if (!yymsg) |
| 2913 | yymsg = "Deleting"; |
| 2914 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 2915 | |
| 2916 | switch (yytype) |
| 2917 | { |
| 2918 | |
| 2919 | default: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2920 | break; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2921 | } |
| 2922 | } |
| 2923 | |
| 2924 | |
| 2925 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 2926 | |
| 2927 | #ifdef YYPARSE_PARAM |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2928 | #if defined __STDC__ || defined __cplusplus |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2929 | int yyparse (void *YYPARSE_PARAM); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2930 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2931 | int yyparse (); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2932 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2933 | #else /* ! YYPARSE_PARAM */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2934 | #if defined __STDC__ || defined __cplusplus |
Reid Spencer | e812fb2 | 2006-01-19 01:21:04 +0000 | [diff] [blame] | 2935 | int yyparse (void); |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 2936 | #else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2937 | int yyparse (); |
| 2938 | #endif |
| 2939 | #endif /* ! YYPARSE_PARAM */ |
| 2940 | |
| 2941 | |
| 2942 | |
| 2943 | /* The look-ahead symbol. */ |
| 2944 | int yychar; |
| 2945 | |
| 2946 | /* The semantic value of the look-ahead symbol. */ |
| 2947 | YYSTYPE yylval; |
| 2948 | |
| 2949 | /* Number of syntax errors so far. */ |
| 2950 | int yynerrs; |
| 2951 | |
| 2952 | |
| 2953 | |
| 2954 | /*----------. |
| 2955 | | yyparse. | |
| 2956 | `----------*/ |
| 2957 | |
| 2958 | #ifdef YYPARSE_PARAM |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2959 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2960 | || defined __cplusplus || defined _MSC_VER) |
| 2961 | int |
| 2962 | yyparse (void *YYPARSE_PARAM) |
| 2963 | #else |
| 2964 | int |
| 2965 | yyparse (YYPARSE_PARAM) |
| 2966 | void *YYPARSE_PARAM; |
| 2967 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2968 | #else /* ! YYPARSE_PARAM */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2969 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2970 | || defined __cplusplus || defined _MSC_VER) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2971 | int |
| 2972 | yyparse (void) |
| 2973 | #else |
| 2974 | int |
| 2975 | yyparse () |
| 2976 | |
| 2977 | #endif |
| 2978 | #endif |
| 2979 | { |
| 2980 | |
| 2981 | int yystate; |
| 2982 | int yyn; |
| 2983 | int yyresult; |
| 2984 | /* Number of tokens to shift before error messages enabled. */ |
| 2985 | int yyerrstatus; |
| 2986 | /* Look-ahead token as an internal (translated) token number. */ |
| 2987 | int yytoken = 0; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 2988 | #if YYERROR_VERBOSE |
| 2989 | /* Buffer for error messages, and its allocated size. */ |
| 2990 | char yymsgbuf[128]; |
| 2991 | char *yymsg = yymsgbuf; |
| 2992 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
| 2993 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 2994 | |
| 2995 | /* Three stacks and their tools: |
| 2996 | `yyss': related to states, |
| 2997 | `yyvs': related to semantic values, |
| 2998 | `yyls': related to locations. |
| 2999 | |
| 3000 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3001 | to reallocate them elsewhere. */ |
| 3002 | |
| 3003 | /* The state stack. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3004 | yytype_int16 yyssa[YYINITDEPTH]; |
| 3005 | yytype_int16 *yyss = yyssa; |
| 3006 | yytype_int16 *yyssp; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3007 | |
| 3008 | /* The semantic value stack. */ |
| 3009 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3010 | YYSTYPE *yyvs = yyvsa; |
| 3011 | YYSTYPE *yyvsp; |
| 3012 | |
| 3013 | |
| 3014 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3015 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 3016 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3017 | YYSIZE_T yystacksize = YYINITDEPTH; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 3018 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3019 | /* The variables used to return semantic value and location from the |
| 3020 | action routines. */ |
| 3021 | YYSTYPE yyval; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 3022 | |
| 3023 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3024 | /* The number of symbols on the RHS of the reduced rule. |
| 3025 | Keep to zero when no symbol should be popped. */ |
| 3026 | int yylen = 0; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 3027 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3028 | YYDPRINTF ((stderr, "Starting parse\n")); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 3029 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3030 | yystate = 0; |
| 3031 | yyerrstatus = 0; |
| 3032 | yynerrs = 0; |
| 3033 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3034 | |
| 3035 | /* Initialize stack pointers. |
| 3036 | Waste one element of value and location stack |
| 3037 | so that they stay on the same level as the state stack. |
| 3038 | The wasted elements are never initialized. */ |
| 3039 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3040 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3041 | yyvsp = yyvs; |
| 3042 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3043 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 3044 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3045 | /*------------------------------------------------------------. |
| 3046 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3047 | `------------------------------------------------------------*/ |
| 3048 | yynewstate: |
| 3049 | /* In all cases, when you get here, the value and location stacks |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3050 | have just been pushed. So pushing a state here evens the stacks. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3051 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3052 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3053 | yysetstate: |
| 3054 | *yyssp = yystate; |
| 3055 | |
| 3056 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3057 | { |
| 3058 | /* Get the current used size of the three stacks, in elements. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3059 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3060 | |
| 3061 | #ifdef yyoverflow |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3062 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3063 | /* Give user a chance to reallocate the stack. Use copies of |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3064 | these so that the &'s don't force the real ones into |
| 3065 | memory. */ |
| 3066 | YYSTYPE *yyvs1 = yyvs; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3067 | yytype_int16 *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3068 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3069 | |
| 3070 | /* Each stack pointer address is followed by the size of the |
| 3071 | data in use in that stack, in bytes. This used to be a |
| 3072 | conditional around just the two extra args, but that might |
| 3073 | be undefined if yyoverflow is a macro. */ |
| 3074 | yyoverflow (YY_("memory exhausted"), |
| 3075 | &yyss1, yysize * sizeof (*yyssp), |
| 3076 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3077 | |
| 3078 | &yystacksize); |
| 3079 | |
| 3080 | yyss = yyss1; |
| 3081 | yyvs = yyvs1; |
| 3082 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3083 | #else /* no yyoverflow */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3084 | # ifndef YYSTACK_RELOCATE |
| 3085 | goto yyexhaustedlab; |
| 3086 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3087 | /* Extend the stack our own way. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3088 | if (YYMAXDEPTH <= yystacksize) |
| 3089 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3090 | yystacksize *= 2; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3091 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3092 | yystacksize = YYMAXDEPTH; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3093 | |
| 3094 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3095 | yytype_int16 *yyss1 = yyss; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3096 | union yyalloc *yyptr = |
| 3097 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3098 | if (! yyptr) |
| 3099 | goto yyexhaustedlab; |
| 3100 | YYSTACK_RELOCATE (yyss); |
| 3101 | YYSTACK_RELOCATE (yyvs); |
| 3102 | |
| 3103 | # undef YYSTACK_RELOCATE |
| 3104 | if (yyss1 != yyssa) |
| 3105 | YYSTACK_FREE (yyss1); |
| 3106 | } |
| 3107 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3108 | #endif /* no yyoverflow */ |
| 3109 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3110 | yyssp = yyss + yysize - 1; |
| 3111 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3112 | |
| 3113 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3114 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3115 | (unsigned long int) yystacksize)); |
| 3116 | |
| 3117 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3118 | YYABORT; |
| 3119 | } |
| 3120 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3121 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3122 | |
| 3123 | goto yybackup; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3124 | |
| 3125 | /*-----------. |
| 3126 | | yybackup. | |
| 3127 | `-----------*/ |
| 3128 | yybackup: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3129 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3130 | /* Do appropriate processing given the current state. Read a |
| 3131 | look-ahead token if we need one and don't already have one. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3132 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3133 | /* First try to decide what to do without reference to look-ahead token. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3134 | yyn = yypact[yystate]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3135 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3136 | goto yydefault; |
| 3137 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3138 | /* 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] | 3139 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3140 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3141 | if (yychar == YYEMPTY) |
| 3142 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3143 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3144 | yychar = YYLEX; |
| 3145 | } |
| 3146 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3147 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3148 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3149 | yychar = yytoken = YYEOF; |
| 3150 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3151 | } |
| 3152 | else |
| 3153 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3154 | yytoken = YYTRANSLATE (yychar); |
| 3155 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3156 | } |
| 3157 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3158 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3159 | detect an error, take that action. */ |
| 3160 | yyn += yytoken; |
| 3161 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3162 | goto yydefault; |
| 3163 | yyn = yytable[yyn]; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3164 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3165 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3166 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3167 | goto yyerrlab; |
| 3168 | yyn = -yyn; |
| 3169 | goto yyreduce; |
| 3170 | } |
| 3171 | |
| 3172 | if (yyn == YYFINAL) |
| 3173 | YYACCEPT; |
| 3174 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3175 | /* Count tokens shifted since error; after three, turn off error |
| 3176 | status. */ |
| 3177 | if (yyerrstatus) |
| 3178 | yyerrstatus--; |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 3179 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3180 | /* Shift the look-ahead token. */ |
| 3181 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
| 3182 | |
| 3183 | /* Discard the shifted token unless it is eof. */ |
| 3184 | if (yychar != YYEOF) |
| 3185 | yychar = YYEMPTY; |
| 3186 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3187 | yystate = yyn; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3188 | *++yyvsp = yylval; |
| 3189 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3190 | goto yynewstate; |
| 3191 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 3192 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3193 | /*-----------------------------------------------------------. |
| 3194 | | yydefault -- do the default action for the current state. | |
| 3195 | `-----------------------------------------------------------*/ |
| 3196 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3197 | yyn = yydefact[yystate]; |
| 3198 | if (yyn == 0) |
| 3199 | goto yyerrlab; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3200 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3201 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3202 | |
| 3203 | /*-----------------------------. |
| 3204 | | yyreduce -- Do a reduction. | |
| 3205 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3206 | yyreduce: |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3207 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3208 | yylen = yyr2[yyn]; |
| 3209 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3210 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3211 | `$$ = $1'. |
| 3212 | |
| 3213 | Otherwise, the following line sets YYVAL to garbage. |
| 3214 | This behavior is undocumented and Bison |
| 3215 | users should not rely upon it. Assigning to YYVAL |
| 3216 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3217 | GCC warning that YYVAL may be used uninitialized. */ |
| 3218 | yyval = yyvsp[1-yylen]; |
| 3219 | |
| 3220 | |
| 3221 | YY_REDUCE_PRINT (yyn); |
| 3222 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3223 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3224 | case 3: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3225 | #line 991 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3226 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3227 | if ((yyvsp[(1) - (1)].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3228 | GEN_ERROR("Value too large for type!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3229 | (yyval.SIntVal) = (int32_t)(yyvsp[(1) - (1)].UIntVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3230 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3231 | ;} |
| 3232 | break; |
| 3233 | |
| 3234 | case 5: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3235 | #line 1000 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3236 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3237 | if ((yyvsp[(1) - (1)].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3238 | GEN_ERROR("Value too large for type!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3239 | (yyval.SInt64Val) = (int64_t)(yyvsp[(1) - (1)].UInt64Val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3240 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3241 | ;} |
| 3242 | break; |
| 3243 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3244 | case 39: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3245 | #line 1017 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3246 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3247 | break; |
| 3248 | |
| 3249 | case 40: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3250 | #line 1017 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3251 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3252 | break; |
| 3253 | |
| 3254 | case 41: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3255 | #line 1018 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3256 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3257 | break; |
| 3258 | |
| 3259 | case 42: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3260 | #line 1018 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3261 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3262 | break; |
| 3263 | |
| 3264 | case 43: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3265 | #line 1019 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3266 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3267 | break; |
| 3268 | |
| 3269 | case 44: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3270 | #line 1019 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3271 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3272 | break; |
| 3273 | |
| 3274 | case 45: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3275 | #line 1020 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3276 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3277 | break; |
| 3278 | |
| 3279 | case 46: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3280 | #line 1020 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3281 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3282 | break; |
| 3283 | |
| 3284 | case 47: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3285 | #line 1021 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3286 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3287 | break; |
| 3288 | |
| 3289 | case 48: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3290 | #line 1021 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3291 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3292 | break; |
| 3293 | |
| 3294 | case 49: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3295 | #line 1025 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3296 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3297 | break; |
| 3298 | |
| 3299 | case 50: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3300 | #line 1025 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3301 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3302 | break; |
| 3303 | |
| 3304 | case 51: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3305 | #line 1026 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3306 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3307 | break; |
| 3308 | |
| 3309 | case 52: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3310 | #line 1026 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3311 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3312 | break; |
| 3313 | |
| 3314 | case 53: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3315 | #line 1027 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3316 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3317 | break; |
| 3318 | |
| 3319 | case 54: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3320 | #line 1027 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3321 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3322 | break; |
| 3323 | |
| 3324 | case 55: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3325 | #line 1028 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3326 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3327 | break; |
| 3328 | |
| 3329 | case 56: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3330 | #line 1028 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3331 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3332 | break; |
| 3333 | |
| 3334 | case 57: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3335 | #line 1029 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3336 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3337 | break; |
| 3338 | |
| 3339 | case 58: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3340 | #line 1029 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3341 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3342 | break; |
| 3343 | |
| 3344 | case 59: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3345 | #line 1030 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3346 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3347 | break; |
| 3348 | |
| 3349 | case 60: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3350 | #line 1030 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3351 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3352 | break; |
| 3353 | |
| 3354 | case 61: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3355 | #line 1031 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3356 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3357 | break; |
| 3358 | |
| 3359 | case 62: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3360 | #line 1031 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3361 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3362 | break; |
| 3363 | |
| 3364 | case 63: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3365 | #line 1032 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3366 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3367 | break; |
| 3368 | |
| 3369 | case 64: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3370 | #line 1033 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3371 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3372 | break; |
| 3373 | |
| 3374 | case 77: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3375 | #line 1044 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3376 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3377 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3378 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3379 | ;} |
| 3380 | break; |
| 3381 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3382 | case 78: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3383 | #line 1048 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3384 | { |
| 3385 | (yyval.StrVal) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3386 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3387 | ;} |
| 3388 | break; |
| 3389 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3390 | case 79: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3391 | #line 1053 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3392 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3393 | break; |
| 3394 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3395 | case 80: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3396 | #line 1054 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3397 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3398 | break; |
| 3399 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3400 | case 81: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3401 | #line 1055 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3402 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3403 | break; |
| 3404 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3405 | case 82: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3406 | #line 1056 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3407 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3408 | break; |
| 3409 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3410 | case 83: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3411 | #line 1057 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3412 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3413 | break; |
| 3414 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3415 | case 84: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3416 | #line 1058 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3417 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3418 | break; |
| 3419 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3420 | case 85: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3421 | #line 1059 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3422 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3423 | break; |
| 3424 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3425 | case 86: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3426 | #line 1060 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3427 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3428 | break; |
| 3429 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3430 | case 87: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3431 | #line 1062 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3432 | { (yyval.UIntVal) = CallingConv::C; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3433 | break; |
| 3434 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3435 | case 88: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3436 | #line 1063 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3437 | { (yyval.UIntVal) = CallingConv::C; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3438 | break; |
| 3439 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3440 | case 89: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3441 | #line 1064 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3442 | { (yyval.UIntVal) = CallingConv::CSRet; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3443 | break; |
| 3444 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3445 | case 90: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3446 | #line 1065 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3447 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3448 | break; |
| 3449 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3450 | case 91: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3451 | #line 1066 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3452 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3453 | break; |
| 3454 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3455 | case 92: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3456 | #line 1067 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3457 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3458 | break; |
| 3459 | |
| 3460 | case 93: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3461 | #line 1068 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3462 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3463 | break; |
| 3464 | |
| 3465 | case 94: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3466 | #line 1069 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3467 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3468 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3469 | GEN_ERROR("Calling conv too large!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3470 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3471 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3472 | ;} |
| 3473 | break; |
| 3474 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3475 | case 95: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3476 | #line 1078 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3477 | { (yyval.UIntVal) = 0; ;} |
| 3478 | break; |
| 3479 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3480 | case 96: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3481 | #line 1079 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3482 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3483 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3484 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 3485 | GEN_ERROR("Alignment must be a power of two!"); |
| 3486 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3487 | ;} |
| 3488 | break; |
| 3489 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3490 | case 97: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3491 | #line 1085 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3492 | { (yyval.UIntVal) = 0; ;} |
| 3493 | break; |
| 3494 | |
| 3495 | case 98: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3496 | #line 1086 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3497 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3498 | (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3499 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
| 3500 | GEN_ERROR("Alignment must be a power of two!"); |
| 3501 | CHECK_FOR_ERROR |
| 3502 | ;} |
| 3503 | break; |
| 3504 | |
| 3505 | case 99: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3506 | #line 1094 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3507 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3508 | for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i) |
| 3509 | if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\') |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3510 | GEN_ERROR("Invalid character in section name!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3511 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3512 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3513 | ;} |
| 3514 | break; |
| 3515 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3516 | case 100: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3517 | #line 1102 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3518 | { (yyval.StrVal) = 0; ;} |
| 3519 | break; |
| 3520 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3521 | case 101: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3522 | #line 1103 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
| 3523 | { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3524 | break; |
| 3525 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3526 | case 102: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3527 | #line 1108 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3528 | {;} |
| 3529 | break; |
| 3530 | |
| 3531 | case 103: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3532 | #line 1109 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3533 | {;} |
| 3534 | break; |
| 3535 | |
| 3536 | case 104: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3537 | #line 1110 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3538 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3539 | CurGV->setSection((yyvsp[(1) - (1)].StrVal)); |
| 3540 | free((yyvsp[(1) - (1)].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3541 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3542 | ;} |
| 3543 | break; |
| 3544 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3545 | case 105: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3546 | #line 1115 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3547 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3548 | if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3549 | GEN_ERROR("Alignment must be a power of two!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3550 | CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3551 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3552 | ;} |
| 3553 | break; |
| 3554 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3555 | case 107: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3556 | #line 1129 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
| 3557 | { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3558 | break; |
| 3559 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3560 | case 109: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3561 | #line 1130 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
| 3562 | { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3563 | break; |
| 3564 | |
| 3565 | case 110: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3566 | #line 1132 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3567 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3568 | if (!UpRefs.empty()) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3569 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); |
| 3570 | (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3571 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3572 | ;} |
| 3573 | break; |
| 3574 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3575 | case 124: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3576 | #line 1144 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3577 | { |
| 3578 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
| 3579 | CHECK_FOR_ERROR |
| 3580 | ;} |
| 3581 | break; |
| 3582 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3583 | case 125: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3584 | #line 1148 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3585 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3586 | (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3587 | CHECK_FOR_ERROR |
| 3588 | ;} |
| 3589 | break; |
| 3590 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3591 | case 126: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3592 | #line 1152 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3593 | { // Named types are also simple types... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3594 | const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3595 | CHECK_FOR_ERROR |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3596 | (yyval.TypeVal) = new PATypeHolder(tmp); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3597 | ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3598 | break; |
| 3599 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3600 | case 127: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3601 | #line 1160 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3602 | { // Type UpReference |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3603 | if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3604 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3605 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3606 | (yyval.TypeVal) = new PATypeHolder(OT); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3607 | UR_OUT("New Upreference!\n"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3608 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3609 | ;} |
| 3610 | break; |
| 3611 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3612 | case 128: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3613 | #line 1168 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3614 | { // Function derived type? |
| 3615 | std::vector<const Type*> Params; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3616 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (4)].TypeList)->begin(), |
| 3617 | E = (yyvsp[(3) - (4)].TypeList)->end(); I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3618 | Params.push_back(*I); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3619 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 3620 | if (isVarArg) Params.pop_back(); |
| 3621 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3622 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[(1) - (4)].TypeVal),Params,isVarArg))); |
| 3623 | delete (yyvsp[(3) - (4)].TypeList); // Delete the argument list |
| 3624 | delete (yyvsp[(1) - (4)].TypeVal); // Delete the return type handle |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3625 | CHECK_FOR_ERROR |
| 3626 | ;} |
| 3627 | break; |
| 3628 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3629 | case 129: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3630 | #line 1181 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3631 | { // Sized array type? |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3632 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 3633 | delete (yyvsp[(4) - (5)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3634 | CHECK_FOR_ERROR |
| 3635 | ;} |
| 3636 | break; |
| 3637 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3638 | case 130: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3639 | #line 1186 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3640 | { // Packed array type? |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3641 | const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); |
| 3642 | if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3643 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 3644 | if (!ElemTy->isPrimitiveType()) |
| 3645 | GEN_ERROR("Elemental type of a PackedType must be primitive"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3646 | if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val))) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3647 | GEN_ERROR("Vector length should be a power of 2!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3648 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 3649 | delete (yyvsp[(4) - (5)].TypeVal); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3650 | CHECK_FOR_ERROR |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3651 | ;} |
| 3652 | break; |
| 3653 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3654 | case 131: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3655 | #line 1198 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3656 | { // Structure type? |
| 3657 | std::vector<const Type*> Elements; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3658 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), |
| 3659 | E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3660 | Elements.push_back(*I); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3661 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3662 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3663 | delete (yyvsp[(2) - (3)].TypeList); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3664 | CHECK_FOR_ERROR |
| 3665 | ;} |
| 3666 | break; |
| 3667 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3668 | case 132: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3669 | #line 1208 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3670 | { // Empty structure type? |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3671 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3672 | CHECK_FOR_ERROR |
| 3673 | ;} |
| 3674 | break; |
| 3675 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3676 | case 133: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3677 | #line 1212 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3678 | { // Pointer type? |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3679 | if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy) |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3680 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3681 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal)))); |
| 3682 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3683 | CHECK_FOR_ERROR |
| 3684 | ;} |
| 3685 | break; |
| 3686 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3687 | case 134: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3688 | #line 1223 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3689 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3690 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3691 | (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); delete (yyvsp[(1) - (1)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3692 | CHECK_FOR_ERROR |
| 3693 | ;} |
| 3694 | break; |
| 3695 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3696 | case 135: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3697 | #line 1228 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3698 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3699 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3700 | CHECK_FOR_ERROR |
| 3701 | ;} |
| 3702 | break; |
| 3703 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3704 | case 137: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3705 | #line 1235 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3706 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3707 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(Type::VoidTy); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3708 | CHECK_FOR_ERROR |
| 3709 | ;} |
| 3710 | break; |
| 3711 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3712 | case 138: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3713 | #line 1239 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3714 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3715 | ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3716 | CHECK_FOR_ERROR |
| 3717 | ;} |
| 3718 | break; |
| 3719 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3720 | case 139: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3721 | #line 1243 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3722 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3723 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 3724 | CHECK_FOR_ERROR |
| 3725 | ;} |
| 3726 | break; |
| 3727 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3728 | case 140: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3729 | #line 1254 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3730 | { // Nonempty unsized arr |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3731 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3732 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3733 | GEN_ERROR("Cannot make array constant with type: '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3734 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3735 | const Type *ETy = ATy->getElementType(); |
| 3736 | int NumElements = ATy->getNumElements(); |
| 3737 | |
| 3738 | // Verify that we have the correct size... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3739 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3740 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3741 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3742 | itostr(NumElements) + "!"); |
| 3743 | |
| 3744 | // Verify all elements are correct type! |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3745 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 3746 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3747 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3748 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3749 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3750 | } |
| 3751 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3752 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); |
| 3753 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3754 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3755 | ;} |
| 3756 | break; |
| 3757 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3758 | case 141: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3759 | #line 1280 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3760 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3761 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3762 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3763 | GEN_ERROR("Cannot make array constant with type: '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3764 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3765 | |
| 3766 | int NumElements = ATy->getNumElements(); |
| 3767 | if (NumElements != -1 && NumElements != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3768 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3769 | " arguments, but has size of " + itostr(NumElements) +"!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3770 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3771 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3772 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3773 | ;} |
| 3774 | break; |
| 3775 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3776 | case 142: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3777 | #line 1294 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3778 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3779 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3780 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3781 | GEN_ERROR("Cannot make array constant with type: '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3782 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3783 | |
| 3784 | int NumElements = ATy->getNumElements(); |
| 3785 | const Type *ETy = ATy->getElementType(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3786 | char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true); |
| 3787 | if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3788 | GEN_ERROR("Can't build string constant of size " + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3789 | itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3790 | " when array has size " + itostr(NumElements) + "!"); |
| 3791 | std::vector<Constant*> Vals; |
| 3792 | if (ETy == Type::SByteTy) { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3793 | for (signed char *C = (signed char *)(yyvsp[(3) - (3)].StrVal); C != (signed char *)EndStr; ++C) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 3794 | Vals.push_back(ConstantInt::get(ETy, *C)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3795 | } else if (ETy == Type::UByteTy) { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3796 | for (unsigned char *C = (unsigned char *)(yyvsp[(3) - (3)].StrVal); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 3797 | C != (unsigned char*)EndStr; ++C) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 3798 | Vals.push_back(ConstantInt::get(ETy, *C)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3799 | } else { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3800 | free((yyvsp[(3) - (3)].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3801 | GEN_ERROR("Cannot build string arrays of non byte sized elements!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3802 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3803 | free((yyvsp[(3) - (3)].StrVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3804 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3805 | delete (yyvsp[(1) - (3)].TypeVal); |
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 | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3810 | case 143: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3811 | #line 1324 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3812 | { // Nonempty unsized arr |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3813 | const PackedType *PTy = dyn_cast<PackedType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3814 | if (PTy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3815 | GEN_ERROR("Cannot make packed constant with type: '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3816 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3817 | const Type *ETy = PTy->getElementType(); |
| 3818 | int NumElements = PTy->getNumElements(); |
| 3819 | |
| 3820 | // Verify that we have the correct size... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3821 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3822 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3823 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3824 | itostr(NumElements) + "!"); |
| 3825 | |
| 3826 | // Verify all elements are correct type! |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3827 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 3828 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3829 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3830 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3831 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3832 | } |
| 3833 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3834 | (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); |
| 3835 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3836 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3837 | ;} |
| 3838 | break; |
| 3839 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3840 | case 144: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3841 | #line 1350 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3842 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3843 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3844 | if (STy == 0) |
| 3845 | GEN_ERROR("Cannot make struct constant with type: '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3846 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3847 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3848 | if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3849 | GEN_ERROR("Illegal number of initializers for structure type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3850 | |
| 3851 | // Check to ensure that constants are compatible with the type initializer! |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3852 | for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) |
| 3853 | if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3854 | GEN_ERROR("Expected type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3855 | STy->getElementType(i)->getDescription() + |
| 3856 | "' for element #" + utostr(i) + |
| 3857 | " of structure initializer!"); |
| 3858 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3859 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); |
| 3860 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3861 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3862 | ;} |
| 3863 | break; |
| 3864 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3865 | case 145: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3866 | #line 1371 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3867 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3868 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3869 | if (STy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3870 | GEN_ERROR("Cannot make struct constant with type: '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3871 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3872 | |
| 3873 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3874 | GEN_ERROR("Illegal number of initializers for structure type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3875 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3876 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3877 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3878 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3879 | ;} |
| 3880 | break; |
| 3881 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3882 | case 146: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3883 | #line 1384 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3884 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3885 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3886 | if (PTy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3887 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3888 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3889 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3890 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3891 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3892 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3893 | ;} |
| 3894 | break; |
| 3895 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3896 | case 147: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3897 | #line 1394 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3898 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3899 | (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); |
| 3900 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3901 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3902 | ;} |
| 3903 | break; |
| 3904 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3905 | case 148: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3906 | #line 1399 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3907 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3908 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3909 | if (Ty == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3910 | GEN_ERROR("Global const reference must be a pointer type!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3911 | |
| 3912 | // ConstExprs can exist in the body of a function, thus creating |
| 3913 | // GlobalValues whenever they refer to a variable. Because we are in |
| 3914 | // the context of a function, getValNonImprovising will search the functions |
| 3915 | // symbol table instead of the module symbol table for the global symbol, |
| 3916 | // which throws things all off. To get around this, we just tell |
| 3917 | // getValNonImprovising that we are at global scope here. |
| 3918 | // |
| 3919 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 3920 | CurFun.CurrentFunction = 0; |
| 3921 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3922 | Value *V = getValNonImprovising(Ty, (yyvsp[(2) - (2)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 3923 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3924 | |
| 3925 | CurFun.CurrentFunction = SavedCurFn; |
| 3926 | |
| 3927 | // If this is an initializer for a constant pointer, which is referencing a |
| 3928 | // (currently) undefined variable, create a stub now that shall be replaced |
| 3929 | // in the future with the right type of variable. |
| 3930 | // |
| 3931 | if (V == 0) { |
| 3932 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 3933 | const PointerType *PT = cast<PointerType>(Ty); |
| 3934 | |
| 3935 | // First check to see if the forward references value is already created! |
| 3936 | PerModuleInfo::GlobalRefsType::iterator I = |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3937 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3938 | |
| 3939 | if (I != CurModule.GlobalRefs.end()) { |
| 3940 | V = I->second; // Placeholder already exists, use it... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3941 | (yyvsp[(2) - (2)].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3942 | } else { |
| 3943 | std::string Name; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3944 | if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[(2) - (2)].ValIDVal).Name; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3945 | |
| 3946 | // Create the forward referenced global. |
| 3947 | GlobalValue *GV; |
| 3948 | if (const FunctionType *FTy = |
| 3949 | dyn_cast<FunctionType>(PT->getElementType())) { |
| 3950 | GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, |
| 3951 | CurModule.CurrentModule); |
| 3952 | } else { |
| 3953 | GV = new GlobalVariable(PT->getElementType(), false, |
| 3954 | GlobalValue::ExternalLinkage, 0, |
| 3955 | Name, CurModule.CurrentModule); |
| 3956 | } |
| 3957 | |
| 3958 | // Keep track of the fact that we have a forward ref to recycle it |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3959 | CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3960 | V = GV; |
| 3961 | } |
| 3962 | } |
| 3963 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3964 | (yyval.ConstVal) = cast<GlobalValue>(V); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3965 | delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3966 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3967 | ;} |
| 3968 | break; |
| 3969 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3970 | case 149: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3971 | #line 1460 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3972 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3973 | if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3974 | GEN_ERROR("Mismatched types for constant expression!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3975 | (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); |
| 3976 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3977 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3978 | ;} |
| 3979 | break; |
| 3980 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3981 | case 150: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3982 | #line 1467 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3983 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3984 | const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3985 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3986 | GEN_ERROR("Cannot create a null initialized value of this type!"); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 3987 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3988 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3989 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3990 | ;} |
| 3991 | break; |
| 3992 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 3993 | case 151: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3994 | #line 1475 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 3995 | { // integral constants |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3996 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3997 | GEN_ERROR("Constant value doesn't fit in type!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 3998 | (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 3999 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4000 | ;} |
| 4001 | break; |
| 4002 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4003 | case 152: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4004 | #line 1481 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4005 | { // integral constants |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4006 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4007 | GEN_ERROR("Constant value doesn't fit in type!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4008 | (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4009 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4010 | ;} |
| 4011 | break; |
| 4012 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4013 | case 153: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4014 | #line 1487 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4015 | { // Boolean constants |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4016 | (yyval.ConstVal) = ConstantBool::getTrue(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4017 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4018 | ;} |
| 4019 | break; |
| 4020 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4021 | case 154: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4022 | #line 1491 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4023 | { // Boolean constants |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4024 | (yyval.ConstVal) = ConstantBool::getFalse(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4025 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4026 | ;} |
| 4027 | break; |
| 4028 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4029 | case 155: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4030 | #line 1495 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4031 | { // Float & Double constants |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4032 | if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4033 | GEN_ERROR("Floating point constant invalid for type!!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4034 | (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4035 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4036 | ;} |
| 4037 | break; |
| 4038 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4039 | case 156: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4040 | #line 1503 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4041 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4042 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 4043 | const Type *Ty = (yyvsp[(5) - (6)].TypeVal)->get(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4044 | if (!Val->getType()->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4045 | GEN_ERROR("cast constant expression from a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4046 | Val->getType()->getDescription() + "'!"); |
| 4047 | if (!Ty->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4048 | GEN_ERROR("cast constant expression to a non-primitive type: '" + |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4049 | Ty->getDescription() + "'!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4050 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].TypeVal)->get()); |
| 4051 | delete (yyvsp[(5) - (6)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4052 | ;} |
| 4053 | break; |
| 4054 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4055 | case 157: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4056 | #line 1515 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4057 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4058 | if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4059 | GEN_ERROR("GetElementPtr requires a pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4060 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4061 | const Type *IdxTy = |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4062 | GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), *(yyvsp[(4) - (5)].ValueList), true); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4063 | if (!IdxTy) |
| 4064 | GEN_ERROR("Index list invalid for constant getelementptr!"); |
| 4065 | |
| 4066 | std::vector<Constant*> IdxVec; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4067 | for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) |
| 4068 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4069 | IdxVec.push_back(C); |
| 4070 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4071 | GEN_ERROR("Indices to constant getelementptr must be constants!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4072 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4073 | delete (yyvsp[(4) - (5)].ValueList); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4074 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4075 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), IdxVec); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4076 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4077 | ;} |
| 4078 | break; |
| 4079 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4080 | case 158: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4081 | #line 1536 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4082 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4083 | if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::BoolTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4084 | GEN_ERROR("Select condition must be of boolean type!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4085 | if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4086 | GEN_ERROR("Select operand types must match!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4087 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4088 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4089 | ;} |
| 4090 | break; |
| 4091 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4092 | case 159: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4093 | #line 1544 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4094 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4095 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4096 | GEN_ERROR("Binary operator types must match!"); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4097 | CHECK_FOR_ERROR; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4098 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4099 | ;} |
| 4100 | break; |
| 4101 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4102 | case 160: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4103 | #line 1550 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4104 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4105 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4106 | GEN_ERROR("Logical operator types must match!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4107 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isIntegral()) { |
| 4108 | if (!isa<PackedType>((yyvsp[(3) - (6)].ConstVal)->getType()) || |
| 4109 | !cast<PackedType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isIntegral()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4110 | GEN_ERROR("Logical operator requires integral operands!"); |
Chris Lattner | 524a131 | 2005-12-21 18:31:50 +0000 | [diff] [blame] | 4111 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4112 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
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 | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4117 | case 161: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4118 | #line 1561 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4119 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4120 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4121 | GEN_ERROR("setcc operand types must match!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4122 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4123 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4124 | ;} |
| 4125 | break; |
| 4126 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4127 | case 162: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4128 | #line 1567 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4129 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4130 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4131 | GEN_ERROR("icmp operand types must match!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4132 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4133 | ;} |
| 4134 | break; |
| 4135 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4136 | case 163: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4137 | #line 1572 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4138 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4139 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4140 | GEN_ERROR("fcmp operand types must match!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4141 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4142 | ;} |
| 4143 | break; |
| 4144 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4145 | case 164: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4146 | #line 1577 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4147 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4148 | if ((yyvsp[(5) - (6)].ConstVal)->getType() != Type::UByteTy) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4149 | GEN_ERROR("Shift count for shift constant must be unsigned byte!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4150 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4151 | GEN_ERROR("Shift constant expression requires integer operand!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4152 | CHECK_FOR_ERROR; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4153 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 1628cec | 2006-10-26 06:15:43 +0000 | [diff] [blame] | 4154 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4155 | ;} |
| 4156 | break; |
| 4157 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4158 | case 165: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4159 | #line 1586 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4160 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4161 | if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4162 | GEN_ERROR("Invalid extractelement operands!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4163 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4164 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4165 | ;} |
| 4166 | break; |
| 4167 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4168 | case 166: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4169 | #line 1592 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4170 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4171 | if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4172 | GEN_ERROR("Invalid insertelement operands!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4173 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4174 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4175 | ;} |
| 4176 | break; |
| 4177 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4178 | case 167: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4179 | #line 1598 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4180 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4181 | if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4182 | GEN_ERROR("Invalid shufflevector operands!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4183 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4184 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4185 | ;} |
| 4186 | break; |
| 4187 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4188 | case 168: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4189 | #line 1607 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4190 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4191 | ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4192 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4193 | ;} |
| 4194 | break; |
| 4195 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4196 | case 169: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4197 | #line 1611 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4198 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4199 | (yyval.ConstVector) = new std::vector<Constant*>(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4200 | (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4201 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4202 | ;} |
| 4203 | break; |
| 4204 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4205 | case 170: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4206 | #line 1619 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4207 | { (yyval.BoolVal) = false; ;} |
| 4208 | break; |
| 4209 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4210 | case 171: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4211 | #line 1619 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4212 | { (yyval.BoolVal) = true; ;} |
| 4213 | break; |
| 4214 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4215 | case 172: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4216 | #line 1629 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4217 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4218 | (yyval.ModuleVal) = ParserResult = (yyvsp[(1) - (1)].ModuleVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4219 | CurModule.ModuleDone(); |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 4220 | CHECK_FOR_ERROR; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4221 | ;} |
| 4222 | break; |
| 4223 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4224 | case 173: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4225 | #line 1637 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4226 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4227 | (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4228 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4229 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4230 | ;} |
| 4231 | break; |
| 4232 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4233 | case 174: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4234 | #line 1642 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4235 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4236 | (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4237 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4238 | ;} |
| 4239 | break; |
| 4240 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4241 | case 175: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4242 | #line 1646 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4243 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4244 | (yyval.ModuleVal) = (yyvsp[(1) - (4)].ModuleVal); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4245 | CHECK_FOR_ERROR |
| 4246 | ;} |
| 4247 | break; |
| 4248 | |
| 4249 | case 176: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4250 | #line 1650 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4251 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4252 | (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4253 | CHECK_FOR_ERROR |
| 4254 | ;} |
| 4255 | break; |
| 4256 | |
| 4257 | case 177: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4258 | #line 1654 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4259 | { |
| 4260 | (yyval.ModuleVal) = CurModule.CurrentModule; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4261 | // Emit an error if there are any unresolved types left. |
| 4262 | if (!CurModule.LateResolveTypes.empty()) { |
| 4263 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4264 | if (DID.Type == ValID::NameVal) { |
| 4265 | GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); |
| 4266 | } else { |
| 4267 | GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); |
| 4268 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4269 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4270 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4271 | ;} |
| 4272 | break; |
| 4273 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4274 | case 178: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4275 | #line 1669 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4276 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4277 | // Eagerly resolve types. This is not an optimization, this is a |
| 4278 | // requirement that is due to the fact that we could have this: |
| 4279 | // |
| 4280 | // %list = type { %list * } |
| 4281 | // %list = type { %list * } ; repeated type decl |
| 4282 | // |
| 4283 | // If types are not resolved eagerly, then the two types will not be |
| 4284 | // determined to be the same type! |
| 4285 | // |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4286 | ResolveTypeTo((yyvsp[(2) - (4)].StrVal), *(yyvsp[(4) - (4)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4287 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4288 | if (!setTypeName(*(yyvsp[(4) - (4)].TypeVal), (yyvsp[(2) - (4)].StrVal)) && !(yyvsp[(2) - (4)].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4289 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4290 | // If this is a named type that is not a redefinition, add it to the slot |
| 4291 | // table. |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4292 | CurModule.Types.push_back(*(yyvsp[(4) - (4)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4293 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4294 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4295 | delete (yyvsp[(4) - (4)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4296 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4297 | ;} |
| 4298 | break; |
| 4299 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4300 | case 179: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4301 | #line 1691 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4302 | { // Function prototypes can be in const pool |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4303 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4304 | ;} |
| 4305 | break; |
| 4306 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4307 | case 180: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4308 | #line 1694 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4309 | { // Asm blocks can be in the const pool |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4310 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4311 | ;} |
| 4312 | break; |
| 4313 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4314 | case 181: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4315 | #line 1697 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4316 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4317 | if ((yyvsp[(5) - (5)].ConstVal) == 0) |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4318 | GEN_ERROR("Global value initializer is not a constant!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4319 | CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), (yyvsp[(3) - (5)].Linkage), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4320 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4321 | ;} |
| 4322 | break; |
| 4323 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4324 | case 182: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4325 | #line 1702 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4326 | { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4327 | CurGV = 0; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4328 | ;} |
| 4329 | break; |
| 4330 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4331 | case 183: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4332 | #line 1705 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4333 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4334 | CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::ExternalLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4335 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4336 | delete (yyvsp[(5) - (5)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4337 | ;} |
| 4338 | break; |
| 4339 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4340 | case 184: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4341 | #line 1709 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4342 | { |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 4343 | CurGV = 0; |
| 4344 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4345 | ;} |
| 4346 | break; |
| 4347 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4348 | case 185: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4349 | #line 1713 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4350 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4351 | CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4352 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4353 | delete (yyvsp[(5) - (5)].TypeVal); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4354 | ;} |
| 4355 | break; |
| 4356 | |
| 4357 | case 186: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4358 | #line 1717 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4359 | { |
| 4360 | CurGV = 0; |
| 4361 | CHECK_FOR_ERROR |
| 4362 | ;} |
| 4363 | break; |
| 4364 | |
| 4365 | case 187: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4366 | #line 1721 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4367 | { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4368 | CurGV = |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4369 | ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4370 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4371 | delete (yyvsp[(5) - (5)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4372 | ;} |
| 4373 | break; |
| 4374 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4375 | case 188: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4376 | #line 1726 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4377 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4378 | CurGV = 0; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4379 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4380 | ;} |
| 4381 | break; |
| 4382 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4383 | case 189: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4384 | #line 1730 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4385 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4386 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4387 | ;} |
| 4388 | break; |
| 4389 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4390 | case 190: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4391 | #line 1733 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4392 | { |
Anton Korobeynikov | bcb9770 | 2006-09-17 20:25:45 +0000 | [diff] [blame] | 4393 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4394 | ;} |
| 4395 | break; |
| 4396 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4397 | case 191: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4398 | #line 1736 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4399 | { |
| 4400 | ;} |
| 4401 | break; |
| 4402 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4403 | case 192: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4404 | #line 1740 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4405 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4406 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4407 | char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true); |
| 4408 | std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr); |
| 4409 | free((yyvsp[(1) - (1)].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 4410 | |
| 4411 | if (AsmSoFar.empty()) |
| 4412 | CurModule.CurrentModule->setModuleInlineAsm(NewAsm); |
| 4413 | else |
| 4414 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4415 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4416 | ;} |
| 4417 | break; |
| 4418 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4419 | case 193: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4420 | #line 1753 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4421 | { (yyval.Endianness) = Module::BigEndian; ;} |
| 4422 | break; |
| 4423 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4424 | case 194: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4425 | #line 1754 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4426 | { (yyval.Endianness) = Module::LittleEndian; ;} |
| 4427 | break; |
| 4428 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4429 | case 195: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4430 | #line 1756 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4431 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4432 | CurModule.CurrentModule->setEndianness((yyvsp[(3) - (3)].Endianness)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4433 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4434 | ;} |
| 4435 | break; |
| 4436 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4437 | case 196: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4438 | #line 1760 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4439 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4440 | if ((yyvsp[(3) - (3)].UInt64Val) == 32) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4441 | CurModule.CurrentModule->setPointerSize(Module::Pointer32); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4442 | else if ((yyvsp[(3) - (3)].UInt64Val) == 64) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4443 | CurModule.CurrentModule->setPointerSize(Module::Pointer64); |
| 4444 | else |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4445 | GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[(3) - (3)].UInt64Val)) + "'!"); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4446 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4447 | ;} |
| 4448 | break; |
| 4449 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4450 | case 197: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4451 | #line 1769 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4452 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4453 | CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal)); |
| 4454 | free((yyvsp[(3) - (3)].StrVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4455 | ;} |
| 4456 | break; |
| 4457 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4458 | case 198: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4459 | #line 1773 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4460 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4461 | CurModule.CurrentModule->setDataLayout((yyvsp[(3) - (3)].StrVal)); |
| 4462 | free((yyvsp[(3) - (3)].StrVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4463 | ;} |
| 4464 | break; |
| 4465 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4466 | case 200: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4467 | #line 1780 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4468 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4469 | CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal)); |
| 4470 | free((yyvsp[(3) - (3)].StrVal)); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4471 | CHECK_FOR_ERROR |
| 4472 | ;} |
| 4473 | break; |
| 4474 | |
| 4475 | case 201: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4476 | #line 1785 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4477 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4478 | CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal)); |
| 4479 | free((yyvsp[(1) - (1)].StrVal)); |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4480 | CHECK_FOR_ERROR |
| 4481 | ;} |
| 4482 | break; |
| 4483 | |
| 4484 | case 202: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4485 | #line 1790 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4486 | { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4487 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4488 | ;} |
| 4489 | break; |
| 4490 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4491 | case 206: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4492 | #line 1800 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4493 | { (yyval.StrVal) = 0; ;} |
| 4494 | break; |
| 4495 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4496 | case 207: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4497 | #line 1802 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4498 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4499 | if (*(yyvsp[(1) - (2)].TypeVal) == Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4500 | GEN_ERROR("void typed arguments are invalid!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4501 | (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].StrVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4502 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4503 | ;} |
| 4504 | break; |
| 4505 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4506 | case 208: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4507 | #line 1809 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4508 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4509 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
| 4510 | (yyvsp[(1) - (3)].ArgList)->push_back(*(yyvsp[(3) - (3)].ArgVal)); |
| 4511 | delete (yyvsp[(3) - (3)].ArgVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4512 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4513 | ;} |
| 4514 | break; |
| 4515 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4516 | case 209: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4517 | #line 1815 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4518 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4519 | (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4520 | (yyval.ArgList)->push_back(*(yyvsp[(1) - (1)].ArgVal)); |
| 4521 | delete (yyvsp[(1) - (1)].ArgVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4522 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4523 | ;} |
| 4524 | break; |
| 4525 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4526 | case 210: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4527 | #line 1822 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4528 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4529 | (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4530 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4531 | ;} |
| 4532 | break; |
| 4533 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4534 | case 211: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4535 | #line 1826 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4536 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4537 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4538 | (yyval.ArgList)->push_back(std::pair<PATypeHolder*, |
| 4539 | char*>(new PATypeHolder(Type::VoidTy), 0)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4540 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4541 | ;} |
| 4542 | break; |
| 4543 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4544 | case 212: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4545 | #line 1832 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4546 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4547 | (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >(); |
| 4548 | (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] | 4549 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4550 | ;} |
| 4551 | break; |
| 4552 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4553 | case 213: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4554 | #line 1837 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4555 | { |
| 4556 | (yyval.ArgList) = 0; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4557 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4558 | ;} |
| 4559 | break; |
| 4560 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4561 | case 214: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4562 | #line 1843 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4563 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4564 | UnEscapeLexed((yyvsp[(3) - (8)].StrVal)); |
| 4565 | std::string FunctionName((yyvsp[(3) - (8)].StrVal)); |
| 4566 | free((yyvsp[(3) - (8)].StrVal)); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4567 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4568 | if (!(*(yyvsp[(2) - (8)].TypeVal))->isFirstClassType() && *(yyvsp[(2) - (8)].TypeVal) != Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4569 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4570 | |
| 4571 | std::vector<const Type*> ParamTypeList; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4572 | if ((yyvsp[(5) - (8)].ArgList)) { // If there are arguments... |
| 4573 | for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); |
| 4574 | I != (yyvsp[(5) - (8)].ArgList)->end(); ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4575 | ParamTypeList.push_back(I->first->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4576 | } |
| 4577 | |
| 4578 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 4579 | if (isVarArg) ParamTypeList.pop_back(); |
| 4580 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4581 | const FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (8)].TypeVal), ParamTypeList, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4582 | const PointerType *PFT = PointerType::get(FT); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4583 | delete (yyvsp[(2) - (8)].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4584 | |
| 4585 | ValID ID; |
| 4586 | if (!FunctionName.empty()) { |
| 4587 | ID = ValID::create((char*)FunctionName.c_str()); |
| 4588 | } else { |
| 4589 | ID = ValID::create((int)CurModule.Values[PFT].size()); |
| 4590 | } |
| 4591 | |
| 4592 | Function *Fn = 0; |
| 4593 | // See if this function was forward referenced. If so, recycle the object. |
| 4594 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 4595 | // Move the function to the end of the list, from whereever it was |
| 4596 | // previously inserted. |
| 4597 | Fn = cast<Function>(FWRef); |
| 4598 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 4599 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 4600 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 4601 | (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { |
| 4602 | // If this is the case, either we need to be a forward decl, or it needs |
| 4603 | // to be. |
| 4604 | if (!CurFun.isDeclare && !Fn->isExternal()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4605 | GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4606 | |
| 4607 | // Make sure to strip off any argument names so we can't get conflicts. |
| 4608 | if (Fn->isExternal()) |
| 4609 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 4610 | AI != AE; ++AI) |
| 4611 | AI->setName(""); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4612 | } else { // Not already defined? |
| 4613 | Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, |
| 4614 | CurModule.CurrentModule); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4615 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4616 | InsertValue(Fn, CurModule.Values); |
| 4617 | } |
| 4618 | |
| 4619 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 4620 | |
| 4621 | if (CurFun.isDeclare) { |
| 4622 | // If we have declaration, always overwrite linkage. This will allow us to |
| 4623 | // correctly handle cases, when pointer to function is passed as argument to |
| 4624 | // another function. |
| 4625 | Fn->setLinkage(CurFun.Linkage); |
| 4626 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4627 | Fn->setCallingConv((yyvsp[(1) - (8)].UIntVal)); |
| 4628 | Fn->setAlignment((yyvsp[(8) - (8)].UIntVal)); |
| 4629 | if ((yyvsp[(7) - (8)].StrVal)) { |
| 4630 | Fn->setSection((yyvsp[(7) - (8)].StrVal)); |
| 4631 | free((yyvsp[(7) - (8)].StrVal)); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 4632 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4633 | |
| 4634 | // Add all of the arguments we parsed to the function... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4635 | if ((yyvsp[(5) - (8)].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4636 | if (isVarArg) { // Nuke the last entry |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4637 | assert((yyvsp[(5) - (8)].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[(5) - (8)].ArgList)->back().second == 0&& |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4638 | "Not a varargs marker!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4639 | delete (yyvsp[(5) - (8)].ArgList)->back().first; |
| 4640 | (yyvsp[(5) - (8)].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4641 | } |
| 4642 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4643 | for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); |
| 4644 | I != (yyvsp[(5) - (8)].ArgList)->end(); ++I, ++ArgIt) { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4645 | delete I->first; // Delete the typeholder... |
| 4646 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4647 | setValueName(ArgIt, I->second); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4648 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4649 | InsertValue(ArgIt); |
| 4650 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4651 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4652 | delete (yyvsp[(5) - (8)].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4653 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4654 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4655 | ;} |
| 4656 | break; |
| 4657 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4658 | case 217: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4659 | #line 1939 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4660 | { |
| 4661 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4662 | |
| 4663 | // Make sure that we keep track of the linkage type even if there was a |
| 4664 | // previous "declare". |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4665 | (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (3)].Linkage)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4666 | ;} |
| 4667 | break; |
| 4668 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4669 | case 220: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4670 | #line 1949 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4671 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4672 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4673 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4674 | ;} |
| 4675 | break; |
| 4676 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4677 | case 222: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4678 | #line 1955 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4679 | { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} |
| 4680 | break; |
| 4681 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4682 | case 223: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4683 | #line 1956 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 4684 | { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;} |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4685 | break; |
| 4686 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4687 | case 224: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4688 | #line 1958 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4689 | { CurFun.isDeclare = true; ;} |
| 4690 | break; |
| 4691 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4692 | case 225: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4693 | #line 1958 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4694 | { |
| 4695 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4696 | CurFun.FunctionDone(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4697 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4698 | ;} |
| 4699 | break; |
| 4700 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4701 | case 226: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4702 | #line 1968 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4703 | { |
| 4704 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4705 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4706 | ;} |
| 4707 | break; |
| 4708 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4709 | case 227: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4710 | #line 1972 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4711 | { |
| 4712 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4713 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4714 | ;} |
| 4715 | break; |
| 4716 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4717 | case 228: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4718 | #line 1977 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4719 | { // A reference to a direct constant |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4720 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); |
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 | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4725 | case 229: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4726 | #line 1981 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4727 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4728 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4729 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4730 | ;} |
| 4731 | break; |
| 4732 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4733 | case 230: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4734 | #line 1985 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4735 | { // Perhaps it's an FP constant? |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4736 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); |
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; |
| 4740 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4741 | case 231: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4742 | #line 1989 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4743 | { |
| 4744 | (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4745 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4746 | ;} |
| 4747 | break; |
| 4748 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4749 | case 232: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4750 | #line 1993 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4751 | { |
| 4752 | (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4753 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4754 | ;} |
| 4755 | break; |
| 4756 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4757 | case 233: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4758 | #line 1997 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4759 | { |
| 4760 | (yyval.ValIDVal) = ValID::createNull(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4761 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4762 | ;} |
| 4763 | break; |
| 4764 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4765 | case 234: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4766 | #line 2001 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4767 | { |
| 4768 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4769 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4770 | ;} |
| 4771 | break; |
| 4772 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4773 | case 235: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4774 | #line 2005 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4775 | { // A vector zero constant. |
| 4776 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 4777 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4778 | ;} |
| 4779 | break; |
| 4780 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4781 | case 236: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4782 | #line 2009 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4783 | { // Nonempty unsized packed vector |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4784 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
| 4785 | int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4786 | |
| 4787 | PackedType* pt = PackedType::get(ETy, NumElements); |
| 4788 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 4789 | HandleUpRefs( |
| 4790 | PackedType::get( |
| 4791 | ETy, |
| 4792 | NumElements) |
| 4793 | ) |
| 4794 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4795 | |
| 4796 | // Verify all elements are correct type! |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4797 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 4798 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4799 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4800 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4801 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4802 | } |
| 4803 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4804 | (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[(2) - (3)].ConstVector))); |
| 4805 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4806 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4807 | ;} |
| 4808 | break; |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4809 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4810 | case 237: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4811 | #line 2034 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4812 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4813 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4814 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4815 | ;} |
| 4816 | break; |
| 4817 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4818 | case 238: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4819 | #line 2038 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4820 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4821 | char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true); |
| 4822 | std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End); |
| 4823 | End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true); |
| 4824 | std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End); |
| 4825 | (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal)); |
| 4826 | free((yyvsp[(3) - (5)].StrVal)); |
| 4827 | free((yyvsp[(5) - (5)].StrVal)); |
Reid Spencer | 21be865 | 2006-10-22 07:03:43 +0000 | [diff] [blame] | 4828 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4829 | ;} |
| 4830 | break; |
| 4831 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4832 | case 239: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4833 | #line 2052 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4834 | { // Is it an integer reference...? |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4835 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SIntVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4836 | CHECK_FOR_ERROR |
| 4837 | ;} |
| 4838 | break; |
| 4839 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4840 | case 240: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4841 | #line 2056 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4842 | { // Is it a named reference...? |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4843 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].StrVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4844 | CHECK_FOR_ERROR |
| 4845 | ;} |
| 4846 | break; |
| 4847 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4848 | case 243: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4849 | #line 2068 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4850 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4851 | (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4852 | CHECK_FOR_ERROR |
| 4853 | ;} |
| 4854 | break; |
| 4855 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4856 | case 244: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4857 | #line 2073 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4858 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4859 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4860 | CHECK_FOR_ERROR |
| 4861 | ;} |
| 4862 | break; |
| 4863 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4864 | case 245: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4865 | #line 2077 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4866 | { // Do not allow functions with 0 basic blocks |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4867 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4868 | CHECK_FOR_ERROR |
| 4869 | ;} |
| 4870 | break; |
| 4871 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4872 | case 246: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4873 | #line 2086 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4874 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4875 | setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4876 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4877 | InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4878 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4879 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 4880 | InsertValue((yyvsp[(1) - (3)].BasicBlockVal)); |
| 4881 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4882 | CHECK_FOR_ERROR |
| 4883 | ;} |
| 4884 | break; |
| 4885 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4886 | case 247: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4887 | #line 2097 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4888 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4889 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4890 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 4891 | if (CI2->getParent() == 0) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4892 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); |
| 4893 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); |
| 4894 | (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4895 | CHECK_FOR_ERROR |
| 4896 | ;} |
| 4897 | break; |
| 4898 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4899 | case 248: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4900 | #line 2106 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4901 | { |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 4902 | (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4903 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4904 | |
| 4905 | // Make sure to move the basic block to the correct location in the |
| 4906 | // function, instead of leaving it inserted wherever it was first |
| 4907 | // referenced. |
| 4908 | Function::BasicBlockListType &BBL = |
| 4909 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4910 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4911 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4912 | ;} |
| 4913 | break; |
| 4914 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4915 | case 249: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4916 | #line 2118 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4917 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4918 | (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[(1) - (1)].StrVal)), true); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4919 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4920 | |
| 4921 | // Make sure to move the basic block to the correct location in the |
| 4922 | // function, instead of leaving it inserted wherever it was first |
| 4923 | // referenced. |
| 4924 | Function::BasicBlockListType &BBL = |
| 4925 | CurFun.CurrentFunction->getBasicBlockList(); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4926 | BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4927 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4928 | ;} |
| 4929 | break; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4930 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4931 | case 250: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4932 | #line 2131 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4933 | { // Return with a result... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4934 | (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4935 | CHECK_FOR_ERROR |
| 4936 | ;} |
| 4937 | break; |
| 4938 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4939 | case 251: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4940 | #line 2135 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4941 | { // Return with no result... |
| 4942 | (yyval.TermInstVal) = new ReturnInst(); |
| 4943 | CHECK_FOR_ERROR |
| 4944 | ;} |
| 4945 | break; |
| 4946 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4947 | case 252: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4948 | #line 2139 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4949 | { // Unconditional Branch... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4950 | BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4951 | CHECK_FOR_ERROR |
| 4952 | (yyval.TermInstVal) = new BranchInst(tmpBB); |
| 4953 | ;} |
| 4954 | break; |
| 4955 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4956 | case 253: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4957 | #line 2144 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4958 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4959 | BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4960 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4961 | BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4962 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4963 | Value* tmpVal = getVal(Type::BoolTy, (yyvsp[(3) - (9)].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4964 | CHECK_FOR_ERROR |
| 4965 | (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); |
| 4966 | ;} |
| 4967 | break; |
| 4968 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4969 | case 254: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4970 | #line 2153 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4971 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4972 | Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4973 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4974 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4975 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4976 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4977 | (yyval.TermInstVal) = S; |
| 4978 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4979 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), |
| 4980 | E = (yyvsp[(8) - (9)].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4981 | for (; I != E; ++I) { |
| 4982 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 4983 | S->addCase(CI, I->second); |
| 4984 | else |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4985 | GEN_ERROR("Switch case is constant, but not a simple integer!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4986 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4987 | delete (yyvsp[(8) - (9)].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4988 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4989 | ;} |
| 4990 | break; |
| 4991 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 4992 | case 255: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4993 | #line 2172 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 4994 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4995 | Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4996 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 4997 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4998 | CHECK_FOR_ERROR |
| 4999 | SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5000 | (yyval.TermInstVal) = S; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5001 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5002 | ;} |
| 5003 | break; |
| 5004 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5005 | case 256: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5006 | #line 2182 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5007 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5008 | const PointerType *PFTy; |
| 5009 | const FunctionType *Ty; |
| 5010 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5011 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (13)].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5012 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5013 | // Pull out the types of all of the arguments... |
| 5014 | std::vector<const Type*> ParamTypes; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5015 | if ((yyvsp[(6) - (13)].ValueList)) { |
| 5016 | for (std::vector<Value*>::iterator I = (yyvsp[(6) - (13)].ValueList)->begin(), E = (yyvsp[(6) - (13)].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5017 | I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5018 | ParamTypes.push_back((*I)->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5019 | } |
| 5020 | |
| 5021 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 5022 | if (isVarArg) ParamTypes.pop_back(); |
| 5023 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5024 | Ty = FunctionType::get((yyvsp[(3) - (13)].TypeVal)->get(), ParamTypes, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5025 | PFTy = PointerType::get(Ty); |
| 5026 | } |
| 5027 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5028 | Value *V = getVal(PFTy, (yyvsp[(4) - (13)].ValIDVal)); // Get the function we're calling... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5029 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5030 | BasicBlock *Normal = getBBVal((yyvsp[(10) - (13)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5031 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5032 | BasicBlock *Except = getBBVal((yyvsp[(13) - (13)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5033 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5034 | |
| 5035 | // Create the call node... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5036 | if (!(yyvsp[(6) - (13)].ValueList)) { // Has no arguments? |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5037 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5038 | } else { // Has arguments? |
| 5039 | // Loop through FunctionType's arguments and ensure they are specified |
| 5040 | // correctly! |
| 5041 | // |
| 5042 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5043 | FunctionType::param_iterator E = Ty->param_end(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5044 | std::vector<Value*>::iterator ArgI = (yyvsp[(6) - (13)].ValueList)->begin(), ArgE = (yyvsp[(6) - (13)].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5045 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5046 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) |
| 5047 | if ((*ArgI)->getType() != *I) |
| 5048 | GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + |
| 5049 | (*I)->getDescription() + "'!"); |
| 5050 | |
| 5051 | if (I != E || (ArgI != ArgE && !Ty->isVarArg())) |
| 5052 | GEN_ERROR("Invalid number of parameters detected!"); |
| 5053 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5054 | (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[(6) - (13)].ValueList)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5055 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5056 | cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[(2) - (13)].UIntVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5057 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5058 | delete (yyvsp[(3) - (13)].TypeVal); |
| 5059 | delete (yyvsp[(6) - (13)].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5060 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5061 | ;} |
| 5062 | break; |
| 5063 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5064 | case 257: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5065 | #line 2237 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5066 | { |
| 5067 | (yyval.TermInstVal) = new UnwindInst(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5068 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5069 | ;} |
| 5070 | break; |
| 5071 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5072 | case 258: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5073 | #line 2241 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5074 | { |
| 5075 | (yyval.TermInstVal) = new UnreachableInst(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5076 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5077 | ;} |
| 5078 | break; |
| 5079 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5080 | case 259: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5081 | #line 2248 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5082 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5083 | (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); |
| 5084 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5085 | CHECK_FOR_ERROR |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5086 | if (V == 0) |
| 5087 | GEN_ERROR("May only switch on a constant pool value!"); |
| 5088 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5089 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5090 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5091 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5092 | ;} |
| 5093 | break; |
| 5094 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5095 | case 260: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5096 | #line 2259 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5097 | { |
| 5098 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5099 | Constant *V = cast<Constant>(getValNonImprovising((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5100 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5101 | |
| 5102 | if (V == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5103 | GEN_ERROR("May only switch on a constant pool value!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5104 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5105 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5106 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5107 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5108 | ;} |
| 5109 | break; |
| 5110 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5111 | case 261: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5112 | #line 2272 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5113 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5114 | // Is this definition named?? if so, assign the name... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5115 | setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5116 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5117 | InsertValue((yyvsp[(2) - (2)].InstVal)); |
| 5118 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5119 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5120 | ;} |
| 5121 | break; |
| 5122 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5123 | case 262: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5124 | #line 2281 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5125 | { // Used for PHI nodes |
| 5126 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5127 | Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5128 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5129 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5130 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5131 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5132 | delete (yyvsp[(1) - (6)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5133 | ;} |
| 5134 | break; |
| 5135 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5136 | case 263: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5137 | #line 2290 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5138 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5139 | (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); |
| 5140 | Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5141 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5142 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5143 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5144 | (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5145 | ;} |
| 5146 | break; |
| 5147 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5148 | case 264: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5149 | #line 2300 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5150 | { // Used for call statements, and memory insts... |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5151 | (yyval.ValueList) = new std::vector<Value*>(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5152 | (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5153 | ;} |
| 5154 | break; |
| 5155 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5156 | case 265: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5157 | #line 2304 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5158 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5159 | (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); |
| 5160 | (yyvsp[(1) - (3)].ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5161 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5162 | ;} |
| 5163 | break; |
| 5164 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5165 | case 267: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5166 | #line 2311 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5167 | { (yyval.ValueList) = 0; ;} |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 5168 | break; |
| 5169 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5170 | case 268: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5171 | #line 2313 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5172 | { |
| 5173 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5174 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5175 | ;} |
| 5176 | break; |
| 5177 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5178 | case 269: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5179 | #line 2317 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5180 | { |
| 5181 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5182 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5183 | ;} |
| 5184 | break; |
| 5185 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5186 | case 270: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5187 | #line 2322 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5188 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5189 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && |
| 5190 | !isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5191 | GEN_ERROR( |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5192 | "Arithmetic operator requires integer, FP, or packed operands!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5193 | if (isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get()) && |
| 5194 | ((yyvsp[(1) - (5)].BinaryOpVal) == Instruction::URem || |
| 5195 | (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::SRem || |
| 5196 | (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::FRem)) |
Reid Spencer | 3ed469c | 2006-11-02 20:25:50 +0000 | [diff] [blame] | 5197 | GEN_ERROR("U/S/FRem not supported on packed types!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5198 | Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5199 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5200 | Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5201 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5202 | (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5203 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5204 | GEN_ERROR("binary operator returned null!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5205 | delete (yyvsp[(2) - (5)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5206 | ;} |
| 5207 | break; |
| 5208 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5209 | case 271: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5210 | #line 2341 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5211 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5212 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isIntegral()) { |
| 5213 | if (!isa<PackedType>((yyvsp[(2) - (5)].TypeVal)->get()) || |
| 5214 | !cast<PackedType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isIntegral()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5215 | GEN_ERROR("Logical operator requires integral operands!"); |
Chris Lattner | 524a131 | 2005-12-21 18:31:50 +0000 | [diff] [blame] | 5216 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5217 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5218 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5219 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5220 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5221 | (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5222 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5223 | GEN_ERROR("binary operator returned null!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5224 | delete (yyvsp[(2) - (5)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5225 | ;} |
| 5226 | break; |
| 5227 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5228 | case 272: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5229 | #line 2356 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5230 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5231 | if(isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get())) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5232 | GEN_ERROR( |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5233 | "PackedTypes currently not supported in setcc instructions!"); |
| 5234 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5235 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5236 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5237 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5238 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5239 | (yyval.InstVal) = new SetCondInst((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5240 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5241 | GEN_ERROR("binary operator returned null!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5242 | delete (yyvsp[(2) - (5)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5243 | ;} |
| 5244 | break; |
| 5245 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5246 | case 273: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5247 | #line 2370 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5248 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5249 | if (isa<PackedType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5250 | GEN_ERROR("Packed types not supported by icmp instruction"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5251 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5252 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5253 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5254 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5255 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5256 | if ((yyval.InstVal) == 0) |
| 5257 | GEN_ERROR("icmp operator returned null!"); |
| 5258 | ;} |
| 5259 | break; |
| 5260 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5261 | case 274: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5262 | #line 2381 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5263 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5264 | if (isa<PackedType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5265 | GEN_ERROR("Packed types not supported by fcmp instruction"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5266 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5267 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5268 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5269 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5270 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5271 | if ((yyval.InstVal) == 0) |
| 5272 | GEN_ERROR("fcmp operator returned null!"); |
| 5273 | ;} |
| 5274 | break; |
| 5275 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5276 | case 275: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5277 | #line 2392 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5278 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5279 | cerr << "WARNING: Use of eliminated 'not' instruction:" |
| 5280 | << " Replacing with 'xor'.\n"; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5281 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5282 | Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[(2) - (2)].ValueVal)->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5283 | if (Ones == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5284 | GEN_ERROR("Expected integral type for not instruction!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5285 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5286 | (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[(2) - (2)].ValueVal), Ones); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5287 | if ((yyval.InstVal) == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5288 | GEN_ERROR("Could not create a xor instruction!"); |
| 5289 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5290 | ;} |
| 5291 | break; |
| 5292 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5293 | case 276: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5294 | #line 2405 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5295 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5296 | if ((yyvsp[(4) - (4)].ValueVal)->getType() != Type::UByteTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5297 | GEN_ERROR("Shift amount must be ubyte!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5298 | if (!(yyvsp[(2) - (4)].ValueVal)->getType()->isInteger()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5299 | GEN_ERROR("Shift constant expression requires integer operand!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5300 | CHECK_FOR_ERROR; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5301 | (yyval.InstVal) = new ShiftInst((yyvsp[(1) - (4)].OtherOpVal), (yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5302 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5303 | ;} |
| 5304 | break; |
| 5305 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5306 | case 277: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5307 | #line 2414 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5308 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5309 | Value* Val = (yyvsp[(2) - (4)].ValueVal); |
| 5310 | const Type* Ty = (yyvsp[(4) - (4)].TypeVal)->get(); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5311 | if (!Val->getType()->isFirstClassType()) |
| 5312 | GEN_ERROR("cast from a non-primitive type: '" + |
| 5313 | Val->getType()->getDescription() + "'!"); |
| 5314 | if (!Ty->isFirstClassType()) |
| 5315 | GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5316 | (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), (yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].TypeVal)->get()); |
| 5317 | delete (yyvsp[(4) - (4)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5318 | ;} |
| 5319 | break; |
| 5320 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5321 | case 278: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5322 | #line 2425 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5323 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5324 | if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::BoolTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5325 | GEN_ERROR("select condition must be boolean!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5326 | if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5327 | GEN_ERROR("select value types should match!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5328 | (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5329 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5330 | ;} |
| 5331 | break; |
| 5332 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5333 | case 279: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5334 | #line 2433 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5335 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5336 | (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); |
| 5337 | delete (yyvsp[(4) - (4)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5338 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5339 | ;} |
| 5340 | break; |
| 5341 | |
Reid Spencer | 6e18b7d | 2006-12-03 06:59:29 +0000 | [diff] [blame] | 5342 | case 280: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5343 | #line 2438 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5344 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5345 | if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5346 | GEN_ERROR("Invalid extractelement operands!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5347 | (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5348 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5349 | ;} |
| 5350 | break; |
| 5351 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5352 | case 281: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5353 | #line 2444 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5354 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5355 | if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5356 | GEN_ERROR("Invalid insertelement operands!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5357 | (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5358 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5359 | ;} |
| 5360 | break; |
| 5361 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5362 | case 282: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5363 | #line 2450 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5364 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5365 | if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5366 | GEN_ERROR("Invalid shufflevector operands!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5367 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5368 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5369 | ;} |
| 5370 | break; |
| 5371 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5372 | case 283: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5373 | #line 2456 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5374 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5375 | const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5376 | if (!Ty->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5377 | GEN_ERROR("PHI node operands must be of first class type!"); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5378 | (yyval.InstVal) = new PHINode(Ty); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5379 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); |
| 5380 | while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { |
| 5381 | if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5382 | GEN_ERROR("All elements of a PHI node must be of the same type!"); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5383 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); |
| 5384 | (yyvsp[(2) - (2)].PHIList)->pop_front(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5385 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5386 | delete (yyvsp[(2) - (2)].PHIList); // Free the list... |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5387 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5388 | ;} |
| 5389 | break; |
| 5390 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5391 | case 284: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5392 | #line 2471 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5393 | { |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 5394 | const PointerType *PFTy = 0; |
| 5395 | const FunctionType *Ty = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5396 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5397 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (7)].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5398 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5399 | // Pull out the types of all of the arguments... |
| 5400 | std::vector<const Type*> ParamTypes; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5401 | if ((yyvsp[(6) - (7)].ValueList)) { |
| 5402 | for (std::vector<Value*>::iterator I = (yyvsp[(6) - (7)].ValueList)->begin(), E = (yyvsp[(6) - (7)].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5403 | I != E; ++I) |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5404 | ParamTypes.push_back((*I)->getType()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5405 | } |
| 5406 | |
| 5407 | bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; |
| 5408 | if (isVarArg) ParamTypes.pop_back(); |
| 5409 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5410 | if (!(*(yyvsp[(3) - (7)].TypeVal))->isFirstClassType() && *(yyvsp[(3) - (7)].TypeVal) != Type::VoidTy) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5411 | GEN_ERROR("LLVM functions cannot return aggregate types!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5412 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5413 | Ty = FunctionType::get((yyvsp[(3) - (7)].TypeVal)->get(), ParamTypes, isVarArg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5414 | PFTy = PointerType::get(Ty); |
| 5415 | } |
| 5416 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5417 | Value *V = getVal(PFTy, (yyvsp[(4) - (7)].ValIDVal)); // Get the function we're calling... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5418 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5419 | |
| 5420 | // Create the call node... |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5421 | if (!(yyvsp[(6) - (7)].ValueList)) { // Has no arguments? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5422 | // Make sure no arguments is a good thing! |
| 5423 | if (Ty->getNumParams() != 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5424 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5425 | "expects arguments!"); |
| 5426 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5427 | (yyval.InstVal) = new CallInst(V, std::vector<Value*>()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5428 | } else { // Has arguments? |
| 5429 | // Loop through FunctionType's arguments and ensure they are specified |
| 5430 | // correctly! |
| 5431 | // |
| 5432 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5433 | FunctionType::param_iterator E = Ty->param_end(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5434 | std::vector<Value*>::iterator ArgI = (yyvsp[(6) - (7)].ValueList)->begin(), ArgE = (yyvsp[(6) - (7)].ValueList)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5435 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5436 | for (; ArgI != ArgE && I != E; ++ArgI, ++I) |
| 5437 | if ((*ArgI)->getType() != *I) |
| 5438 | GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + |
| 5439 | (*I)->getDescription() + "'!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5440 | |
| 5441 | if (I != E || (ArgI != ArgE && !Ty->isVarArg())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5442 | GEN_ERROR("Invalid number of parameters detected!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5443 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5444 | (yyval.InstVal) = new CallInst(V, *(yyvsp[(6) - (7)].ValueList)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5445 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5446 | cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[(1) - (7)].BoolVal)); |
| 5447 | cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[(2) - (7)].UIntVal)); |
| 5448 | delete (yyvsp[(3) - (7)].TypeVal); |
| 5449 | delete (yyvsp[(6) - (7)].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5450 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5451 | ;} |
| 5452 | break; |
| 5453 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5454 | case 285: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5455 | #line 2530 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5456 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5457 | (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5458 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5459 | ;} |
| 5460 | break; |
| 5461 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5462 | case 286: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5463 | #line 2537 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5464 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5465 | (yyval.ValueList) = (yyvsp[(2) - (2)].ValueList); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5466 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5467 | ;} |
| 5468 | break; |
| 5469 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5470 | case 287: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5471 | #line 2540 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5472 | { |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5473 | (yyval.ValueList) = new std::vector<Value*>(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5474 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5475 | ;} |
| 5476 | break; |
| 5477 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5478 | case 288: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5479 | #line 2545 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5480 | { |
| 5481 | (yyval.BoolVal) = true; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5482 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5483 | ;} |
| 5484 | break; |
| 5485 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5486 | case 289: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5487 | #line 2549 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5488 | { |
| 5489 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5490 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5491 | ;} |
| 5492 | break; |
| 5493 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5494 | case 290: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5495 | #line 2556 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5496 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5497 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 5498 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5499 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5500 | ;} |
| 5501 | break; |
| 5502 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5503 | case 291: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5504 | #line 2561 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5505 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5506 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5507 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5508 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 5509 | delete (yyvsp[(2) - (6)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5510 | ;} |
| 5511 | break; |
| 5512 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5513 | case 292: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5514 | #line 2567 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5515 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5516 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 5517 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5518 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5519 | ;} |
| 5520 | break; |
| 5521 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5522 | case 293: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5523 | #line 2572 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5524 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5525 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5526 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5527 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 5528 | delete (yyvsp[(2) - (6)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5529 | ;} |
| 5530 | break; |
| 5531 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5532 | case 294: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5533 | #line 2578 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5534 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5535 | if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5536 | GEN_ERROR("Trying to free nonpointer type " + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5537 | (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "!"); |
| 5538 | (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5539 | CHECK_FOR_ERROR |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5540 | ;} |
| 5541 | break; |
| 5542 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5543 | case 295: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5544 | #line 2586 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5545 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5546 | if (!isa<PointerType>((yyvsp[(3) - (4)].TypeVal)->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5547 | GEN_ERROR("Can't load from nonpointer type: " + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5548 | (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); |
| 5549 | if (!cast<PointerType>((yyvsp[(3) - (4)].TypeVal)->get())->getElementType()->isFirstClassType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5550 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5551 | (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); |
| 5552 | Value* tmpVal = getVal(*(yyvsp[(3) - (4)].TypeVal), (yyvsp[(4) - (4)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5553 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5554 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (4)].BoolVal)); |
| 5555 | delete (yyvsp[(3) - (4)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5556 | ;} |
| 5557 | break; |
| 5558 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5559 | case 296: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5560 | #line 2598 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5561 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5562 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (6)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5563 | if (!PT) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5564 | GEN_ERROR("Can't store to a nonpointer type: " + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5565 | (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5566 | const Type *ElTy = PT->getElementType(); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5567 | if (ElTy != (yyvsp[(3) - (6)].ValueVal)->getType()) |
| 5568 | GEN_ERROR("Can't store '" + (yyvsp[(3) - (6)].ValueVal)->getType()->getDescription() + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5569 | "' into space of type '" + ElTy->getDescription() + "'!"); |
| 5570 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5571 | Value* tmpVal = getVal(*(yyvsp[(5) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5572 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5573 | (yyval.InstVal) = new StoreInst((yyvsp[(3) - (6)].ValueVal), tmpVal, (yyvsp[(1) - (6)].BoolVal)); |
| 5574 | delete (yyvsp[(5) - (6)].TypeVal); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5575 | ;} |
| 5576 | break; |
| 5577 | |
Reid Spencer | cd42c58 | 2006-12-05 23:29:42 +0000 | [diff] [blame] | 5578 | case 297: |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5579 | #line 2613 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5580 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5581 | if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5582 | GEN_ERROR("getelementptr insn requires pointer operand!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5583 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5584 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), *(yyvsp[(4) - (4)].ValueList), true)) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5585 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5586 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'!"); |
| 5587 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5588 | CHECK_FOR_ERROR |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5589 | (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[(4) - (4)].ValueList)); |
| 5590 | delete (yyvsp[(2) - (4)].TypeVal); |
| 5591 | delete (yyvsp[(4) - (4)].ValueList); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5592 | ;} |
| 5593 | break; |
| 5594 | |
| 5595 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5596 | /* Line 1267 of yacc.c. */ |
| 5597 | #line 5598 "llvmAsmParser.tab.c" |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5598 | default: break; |
| 5599 | } |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5600 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5601 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5602 | YYPOPSTACK (yylen); |
| 5603 | yylen = 0; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5604 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5605 | |
| 5606 | *++yyvsp = yyval; |
| 5607 | |
| 5608 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5609 | /* Now `shift' the result of the reduction. Determine what state |
| 5610 | that goes to, based on the state we popped back to and the rule |
| 5611 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5612 | |
| 5613 | yyn = yyr1[yyn]; |
| 5614 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5615 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 5616 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5617 | yystate = yytable[yystate]; |
| 5618 | else |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5619 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5620 | |
| 5621 | goto yynewstate; |
| 5622 | |
| 5623 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5624 | /*------------------------------------. |
| 5625 | | yyerrlab -- here on detecting error | |
| 5626 | `------------------------------------*/ |
| 5627 | yyerrlab: |
| 5628 | /* If not already recovering from an error, report this error. */ |
| 5629 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5630 | { |
| 5631 | ++yynerrs; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5632 | #if ! YYERROR_VERBOSE |
| 5633 | yyerror (YY_("syntax error")); |
| 5634 | #else |
| 5635 | { |
| 5636 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 5637 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 5638 | { |
| 5639 | YYSIZE_T yyalloc = 2 * yysize; |
| 5640 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 5641 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 5642 | if (yymsg != yymsgbuf) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5643 | YYSTACK_FREE (yymsg); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5644 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 5645 | if (yymsg) |
| 5646 | yymsg_alloc = yyalloc; |
| 5647 | else |
| 5648 | { |
| 5649 | yymsg = yymsgbuf; |
| 5650 | yymsg_alloc = sizeof yymsgbuf; |
| 5651 | } |
| 5652 | } |
| 5653 | |
| 5654 | if (0 < yysize && yysize <= yymsg_alloc) |
| 5655 | { |
| 5656 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 5657 | yyerror (yymsg); |
| 5658 | } |
| 5659 | else |
| 5660 | { |
| 5661 | yyerror (YY_("syntax error")); |
| 5662 | if (yysize != 0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5663 | goto yyexhaustedlab; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5664 | } |
| 5665 | } |
| 5666 | #endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5667 | } |
| 5668 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5669 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5670 | |
| 5671 | if (yyerrstatus == 3) |
| 5672 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5673 | /* If just tried and failed to reuse look-ahead token after an |
| 5674 | error, discard it. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5675 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5676 | if (yychar <= YYEOF) |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5677 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5678 | /* Return failure if at end of input. */ |
| 5679 | if (yychar == YYEOF) |
| 5680 | YYABORT; |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5681 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5682 | else |
| 5683 | { |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5684 | yydestruct ("Error: discarding", |
| 5685 | yytoken, &yylval); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5686 | yychar = YYEMPTY; |
| 5687 | } |
| 5688 | } |
| 5689 | |
| 5690 | /* Else will try to reuse look-ahead token after shifting the error |
| 5691 | token. */ |
| 5692 | goto yyerrlab1; |
| 5693 | |
| 5694 | |
| 5695 | /*---------------------------------------------------. |
| 5696 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 5697 | `---------------------------------------------------*/ |
| 5698 | yyerrorlab: |
| 5699 | |
| 5700 | /* Pacify compilers like GCC when the user code never invokes |
| 5701 | YYERROR and the label yyerrorlab therefore never appears in user |
| 5702 | code. */ |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5703 | if (/*CONSTCOND*/ 0) |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5704 | goto yyerrorlab; |
| 5705 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5706 | /* Do not reclaim the symbols of the rule which action triggered |
| 5707 | this YYERROR. */ |
| 5708 | YYPOPSTACK (yylen); |
| 5709 | yylen = 0; |
| 5710 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5711 | yystate = *yyssp; |
| 5712 | goto yyerrlab1; |
| 5713 | |
| 5714 | |
| 5715 | /*-------------------------------------------------------------. |
| 5716 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 5717 | `-------------------------------------------------------------*/ |
| 5718 | yyerrlab1: |
| 5719 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 5720 | |
| 5721 | for (;;) |
| 5722 | { |
| 5723 | yyn = yypact[yystate]; |
| 5724 | if (yyn != YYPACT_NINF) |
| 5725 | { |
| 5726 | yyn += YYTERROR; |
| 5727 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 5728 | { |
| 5729 | yyn = yytable[yyn]; |
| 5730 | if (0 < yyn) |
| 5731 | break; |
| 5732 | } |
| 5733 | } |
| 5734 | |
| 5735 | /* Pop the current state because it cannot handle the error token. */ |
| 5736 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5737 | YYABORT; |
| 5738 | |
Chris Lattner | 8335e84 | 2006-01-23 23:05:42 +0000 | [diff] [blame] | 5739 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5740 | yydestruct ("Error: popping", |
| 5741 | yystos[yystate], yyvsp); |
| 5742 | YYPOPSTACK (1); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5743 | yystate = *yyssp; |
| 5744 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5745 | } |
| 5746 | |
| 5747 | if (yyn == YYFINAL) |
| 5748 | YYACCEPT; |
| 5749 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5750 | *++yyvsp = yylval; |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5751 | |
| 5752 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5753 | /* Shift the error token. */ |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5754 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5755 | |
| 5756 | yystate = yyn; |
| 5757 | goto yynewstate; |
| 5758 | |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5759 | |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5760 | /*-------------------------------------. |
| 5761 | | yyacceptlab -- YYACCEPT comes here. | |
| 5762 | `-------------------------------------*/ |
| 5763 | yyacceptlab: |
| 5764 | yyresult = 0; |
| 5765 | goto yyreturn; |
| 5766 | |
| 5767 | /*-----------------------------------. |
| 5768 | | yyabortlab -- YYABORT comes here. | |
| 5769 | `-----------------------------------*/ |
| 5770 | yyabortlab: |
| 5771 | yyresult = 1; |
| 5772 | goto yyreturn; |
| 5773 | |
| 5774 | #ifndef yyoverflow |
| 5775 | /*-------------------------------------------------. |
| 5776 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 5777 | `-------------------------------------------------*/ |
| 5778 | yyexhaustedlab: |
| 5779 | yyerror (YY_("memory exhausted")); |
| 5780 | yyresult = 2; |
| 5781 | /* Fall through. */ |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5782 | #endif |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5783 | |
| 5784 | yyreturn: |
| 5785 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 5786 | yydestruct ("Cleanup: discarding lookahead", |
| 5787 | yytoken, &yylval); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5788 | /* Do not reclaim the symbols of the rule which action triggered |
| 5789 | this YYABORT or YYACCEPT. */ |
| 5790 | YYPOPSTACK (yylen); |
| 5791 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5792 | while (yyssp != yyss) |
| 5793 | { |
| 5794 | yydestruct ("Cleanup: popping", |
| 5795 | yystos[*yyssp], yyvsp); |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5796 | YYPOPSTACK (1); |
Chris Lattner | f49c176 | 2006-11-08 05:58:47 +0000 | [diff] [blame] | 5797 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5798 | #ifndef yyoverflow |
| 5799 | if (yyss != yyssa) |
| 5800 | YYSTACK_FREE (yyss); |
| 5801 | #endif |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5802 | #if YYERROR_VERBOSE |
| 5803 | if (yymsg != yymsgbuf) |
| 5804 | YYSTACK_FREE (yymsg); |
| 5805 | #endif |
| 5806 | /* Make sure YYID is used. */ |
| 5807 | return YYID (yyresult); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5808 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5809 | |
| 5810 | |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame^] | 5811 | #line 2628 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5812 | |
| 5813 | |
| 5814 | void llvm::GenerateError(const std::string &message, int LineNo) { |
| 5815 | if (LineNo == -1) LineNo = llvmAsmlineno; |
| 5816 | // TODO: column number in exception |
| 5817 | if (TheParseError) |
| 5818 | TheParseError->setError(CurFilename, message, LineNo); |
| 5819 | TriggerError = 1; |
| 5820 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5821 | |
| 5822 | int yyerror(const char *ErrorMsg) { |
| 5823 | std::string where |
| 5824 | = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename) |
| 5825 | + ":" + utostr((unsigned) llvmAsmlineno) + ": "; |
| 5826 | std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; |
| 5827 | if (yychar == YYEMPTY || yychar == 0) |
| 5828 | errMsg += "end-of-file."; |
| 5829 | else |
| 5830 | errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5831 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5832 | return 0; |
| 5833 | } |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5834 | |