Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +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 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 |
| 6 | Free Software Foundation, Inc. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 7 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +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. |
| 12 | |
| 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 | |
| 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. |
| 32 | |
| 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. */ |
| 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. */ |
| 50 | #define YYBISON_VERSION "2.3" |
| 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 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 63 | #define yylex llvmAsmlex |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 64 | #define yyerror llvmAsmerror |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +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 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +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 | ESAPINTVAL = 260, |
| 80 | EUAPINTVAL = 261, |
| 81 | LOCALVAL_ID = 262, |
| 82 | GLOBALVAL_ID = 263, |
| 83 | FPVAL = 264, |
| 84 | VOID = 265, |
| 85 | INTTYPE = 266, |
| 86 | FLOAT = 267, |
| 87 | DOUBLE = 268, |
| 88 | X86_FP80 = 269, |
| 89 | FP128 = 270, |
| 90 | PPC_FP128 = 271, |
| 91 | LABEL = 272, |
| 92 | TYPE = 273, |
| 93 | LOCALVAR = 274, |
| 94 | GLOBALVAR = 275, |
| 95 | LABELSTR = 276, |
| 96 | STRINGCONSTANT = 277, |
| 97 | ATSTRINGCONSTANT = 278, |
| 98 | PCTSTRINGCONSTANT = 279, |
| 99 | ZEROINITIALIZER = 280, |
| 100 | TRUETOK = 281, |
| 101 | FALSETOK = 282, |
| 102 | BEGINTOK = 283, |
| 103 | ENDTOK = 284, |
| 104 | DECLARE = 285, |
| 105 | DEFINE = 286, |
| 106 | GLOBAL = 287, |
| 107 | CONSTANT = 288, |
| 108 | SECTION = 289, |
| 109 | ALIAS = 290, |
| 110 | VOLATILE = 291, |
| 111 | THREAD_LOCAL = 292, |
| 112 | TO = 293, |
| 113 | DOTDOTDOT = 294, |
| 114 | NULL_TOK = 295, |
| 115 | UNDEF = 296, |
| 116 | INTERNAL = 297, |
| 117 | LINKONCE = 298, |
| 118 | WEAK = 299, |
| 119 | APPENDING = 300, |
| 120 | DLLIMPORT = 301, |
| 121 | DLLEXPORT = 302, |
| 122 | EXTERN_WEAK = 303, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 123 | COMMON = 304, |
| 124 | OPAQUE = 305, |
| 125 | EXTERNAL = 306, |
| 126 | TARGET = 307, |
| 127 | TRIPLE = 308, |
| 128 | ALIGN = 309, |
| 129 | ADDRSPACE = 310, |
| 130 | DEPLIBS = 311, |
| 131 | CALL = 312, |
| 132 | TAIL = 313, |
| 133 | ASM_TOK = 314, |
| 134 | MODULE = 315, |
| 135 | SIDEEFFECT = 316, |
| 136 | CC_TOK = 317, |
| 137 | CCC_TOK = 318, |
| 138 | FASTCC_TOK = 319, |
| 139 | COLDCC_TOK = 320, |
| 140 | X86_STDCALLCC_TOK = 321, |
| 141 | X86_FASTCALLCC_TOK = 322, |
| 142 | DATALAYOUT = 323, |
| 143 | RET = 324, |
| 144 | BR = 325, |
| 145 | SWITCH = 326, |
| 146 | INVOKE = 327, |
| 147 | UNWIND = 328, |
| 148 | UNREACHABLE = 329, |
| 149 | ADD = 330, |
| 150 | SUB = 331, |
| 151 | MUL = 332, |
| 152 | UDIV = 333, |
| 153 | SDIV = 334, |
| 154 | FDIV = 335, |
| 155 | UREM = 336, |
| 156 | SREM = 337, |
| 157 | FREM = 338, |
| 158 | AND = 339, |
| 159 | OR = 340, |
| 160 | XOR = 341, |
| 161 | SHL = 342, |
| 162 | LSHR = 343, |
| 163 | ASHR = 344, |
| 164 | ICMP = 345, |
| 165 | FCMP = 346, |
| 166 | VICMP = 347, |
| 167 | VFCMP = 348, |
| 168 | EQ = 349, |
| 169 | NE = 350, |
| 170 | SLT = 351, |
| 171 | SGT = 352, |
| 172 | SLE = 353, |
| 173 | SGE = 354, |
| 174 | ULT = 355, |
| 175 | UGT = 356, |
| 176 | ULE = 357, |
| 177 | UGE = 358, |
| 178 | OEQ = 359, |
| 179 | ONE = 360, |
| 180 | OLT = 361, |
| 181 | OGT = 362, |
| 182 | OLE = 363, |
| 183 | OGE = 364, |
| 184 | ORD = 365, |
| 185 | UNO = 366, |
| 186 | UEQ = 367, |
| 187 | UNE = 368, |
| 188 | MALLOC = 369, |
| 189 | ALLOCA = 370, |
| 190 | FREE = 371, |
| 191 | LOAD = 372, |
| 192 | STORE = 373, |
| 193 | GETELEMENTPTR = 374, |
| 194 | TRUNC = 375, |
| 195 | ZEXT = 376, |
| 196 | SEXT = 377, |
| 197 | FPTRUNC = 378, |
| 198 | FPEXT = 379, |
| 199 | BITCAST = 380, |
| 200 | UITOFP = 381, |
| 201 | SITOFP = 382, |
| 202 | FPTOUI = 383, |
| 203 | FPTOSI = 384, |
| 204 | INTTOPTR = 385, |
| 205 | PTRTOINT = 386, |
| 206 | PHI_TOK = 387, |
| 207 | SELECT = 388, |
| 208 | VAARG = 389, |
| 209 | EXTRACTELEMENT = 390, |
| 210 | INSERTELEMENT = 391, |
| 211 | SHUFFLEVECTOR = 392, |
| 212 | GETRESULT = 393, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 213 | EXTRACTVALUE = 394, |
| 214 | INSERTVALUE = 395, |
| 215 | SIGNEXT = 396, |
| 216 | ZEROEXT = 397, |
| 217 | NORETURN = 398, |
| 218 | INREG = 399, |
| 219 | SRET = 400, |
| 220 | NOUNWIND = 401, |
| 221 | NOALIAS = 402, |
| 222 | BYVAL = 403, |
| 223 | NEST = 404, |
| 224 | READNONE = 405, |
| 225 | READONLY = 406, |
| 226 | GC = 407, |
| 227 | DEFAULT = 408, |
| 228 | HIDDEN = 409, |
| 229 | PROTECTED = 410 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 230 | }; |
| 231 | #endif |
| 232 | /* Tokens. */ |
| 233 | #define ESINT64VAL 258 |
| 234 | #define EUINT64VAL 259 |
| 235 | #define ESAPINTVAL 260 |
| 236 | #define EUAPINTVAL 261 |
| 237 | #define LOCALVAL_ID 262 |
| 238 | #define GLOBALVAL_ID 263 |
| 239 | #define FPVAL 264 |
| 240 | #define VOID 265 |
| 241 | #define INTTYPE 266 |
| 242 | #define FLOAT 267 |
| 243 | #define DOUBLE 268 |
| 244 | #define X86_FP80 269 |
| 245 | #define FP128 270 |
| 246 | #define PPC_FP128 271 |
| 247 | #define LABEL 272 |
| 248 | #define TYPE 273 |
| 249 | #define LOCALVAR 274 |
| 250 | #define GLOBALVAR 275 |
| 251 | #define LABELSTR 276 |
| 252 | #define STRINGCONSTANT 277 |
| 253 | #define ATSTRINGCONSTANT 278 |
| 254 | #define PCTSTRINGCONSTANT 279 |
| 255 | #define ZEROINITIALIZER 280 |
| 256 | #define TRUETOK 281 |
| 257 | #define FALSETOK 282 |
| 258 | #define BEGINTOK 283 |
| 259 | #define ENDTOK 284 |
| 260 | #define DECLARE 285 |
| 261 | #define DEFINE 286 |
| 262 | #define GLOBAL 287 |
| 263 | #define CONSTANT 288 |
| 264 | #define SECTION 289 |
| 265 | #define ALIAS 290 |
| 266 | #define VOLATILE 291 |
| 267 | #define THREAD_LOCAL 292 |
| 268 | #define TO 293 |
| 269 | #define DOTDOTDOT 294 |
| 270 | #define NULL_TOK 295 |
| 271 | #define UNDEF 296 |
| 272 | #define INTERNAL 297 |
| 273 | #define LINKONCE 298 |
| 274 | #define WEAK 299 |
| 275 | #define APPENDING 300 |
| 276 | #define DLLIMPORT 301 |
| 277 | #define DLLEXPORT 302 |
| 278 | #define EXTERN_WEAK 303 |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 279 | #define COMMON 304 |
| 280 | #define OPAQUE 305 |
| 281 | #define EXTERNAL 306 |
| 282 | #define TARGET 307 |
| 283 | #define TRIPLE 308 |
| 284 | #define ALIGN 309 |
| 285 | #define ADDRSPACE 310 |
| 286 | #define DEPLIBS 311 |
| 287 | #define CALL 312 |
| 288 | #define TAIL 313 |
| 289 | #define ASM_TOK 314 |
| 290 | #define MODULE 315 |
| 291 | #define SIDEEFFECT 316 |
| 292 | #define CC_TOK 317 |
| 293 | #define CCC_TOK 318 |
| 294 | #define FASTCC_TOK 319 |
| 295 | #define COLDCC_TOK 320 |
| 296 | #define X86_STDCALLCC_TOK 321 |
| 297 | #define X86_FASTCALLCC_TOK 322 |
| 298 | #define DATALAYOUT 323 |
| 299 | #define RET 324 |
| 300 | #define BR 325 |
| 301 | #define SWITCH 326 |
| 302 | #define INVOKE 327 |
| 303 | #define UNWIND 328 |
| 304 | #define UNREACHABLE 329 |
| 305 | #define ADD 330 |
| 306 | #define SUB 331 |
| 307 | #define MUL 332 |
| 308 | #define UDIV 333 |
| 309 | #define SDIV 334 |
| 310 | #define FDIV 335 |
| 311 | #define UREM 336 |
| 312 | #define SREM 337 |
| 313 | #define FREM 338 |
| 314 | #define AND 339 |
| 315 | #define OR 340 |
| 316 | #define XOR 341 |
| 317 | #define SHL 342 |
| 318 | #define LSHR 343 |
| 319 | #define ASHR 344 |
| 320 | #define ICMP 345 |
| 321 | #define FCMP 346 |
| 322 | #define VICMP 347 |
| 323 | #define VFCMP 348 |
| 324 | #define EQ 349 |
| 325 | #define NE 350 |
| 326 | #define SLT 351 |
| 327 | #define SGT 352 |
| 328 | #define SLE 353 |
| 329 | #define SGE 354 |
| 330 | #define ULT 355 |
| 331 | #define UGT 356 |
| 332 | #define ULE 357 |
| 333 | #define UGE 358 |
| 334 | #define OEQ 359 |
| 335 | #define ONE 360 |
| 336 | #define OLT 361 |
| 337 | #define OGT 362 |
| 338 | #define OLE 363 |
| 339 | #define OGE 364 |
| 340 | #define ORD 365 |
| 341 | #define UNO 366 |
| 342 | #define UEQ 367 |
| 343 | #define UNE 368 |
| 344 | #define MALLOC 369 |
| 345 | #define ALLOCA 370 |
| 346 | #define FREE 371 |
| 347 | #define LOAD 372 |
| 348 | #define STORE 373 |
| 349 | #define GETELEMENTPTR 374 |
| 350 | #define TRUNC 375 |
| 351 | #define ZEXT 376 |
| 352 | #define SEXT 377 |
| 353 | #define FPTRUNC 378 |
| 354 | #define FPEXT 379 |
| 355 | #define BITCAST 380 |
| 356 | #define UITOFP 381 |
| 357 | #define SITOFP 382 |
| 358 | #define FPTOUI 383 |
| 359 | #define FPTOSI 384 |
| 360 | #define INTTOPTR 385 |
| 361 | #define PTRTOINT 386 |
| 362 | #define PHI_TOK 387 |
| 363 | #define SELECT 388 |
| 364 | #define VAARG 389 |
| 365 | #define EXTRACTELEMENT 390 |
| 366 | #define INSERTELEMENT 391 |
| 367 | #define SHUFFLEVECTOR 392 |
| 368 | #define GETRESULT 393 |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 369 | #define EXTRACTVALUE 394 |
| 370 | #define INSERTVALUE 395 |
| 371 | #define SIGNEXT 396 |
| 372 | #define ZEROEXT 397 |
| 373 | #define NORETURN 398 |
| 374 | #define INREG 399 |
| 375 | #define SRET 400 |
| 376 | #define NOUNWIND 401 |
| 377 | #define NOALIAS 402 |
| 378 | #define BYVAL 403 |
| 379 | #define NEST 404 |
| 380 | #define READNONE 405 |
| 381 | #define READONLY 406 |
| 382 | #define GC 407 |
| 383 | #define DEFAULT 408 |
| 384 | #define HIDDEN 409 |
| 385 | #define PROTECTED 410 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 386 | |
| 387 | |
| 388 | |
| 389 | |
| 390 | /* Copy the first part of user declarations. */ |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 391 | #line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 392 | |
| 393 | #include "ParserInternals.h" |
| 394 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 395 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 396 | #include "llvm/Instructions.h" |
| 397 | #include "llvm/Module.h" |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 398 | #include "llvm/ValueSymbolTable.h" |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 399 | #include "llvm/AutoUpgrade.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 400 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 401 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 402 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 403 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 404 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 405 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 406 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 407 | #include <list> |
Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 408 | #include <map> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 409 | #include <utility> |
| 410 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 411 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 412 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 413 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 414 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 415 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 416 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 417 | // GenerateError are made from inside productions and they must simulate the |
| 418 | // previous exception behavior by exiting the production immediately. We have |
| 419 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 420 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 421 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 422 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 423 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 424 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 425 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 426 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 427 | int yylex(); // declaration" of xxx warnings. |
| 428 | int yyparse(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 429 | using namespace llvm; |
| 430 | |
| 431 | static Module *ParserResult; |
| 432 | |
| 433 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 434 | // relating to upreferences in the input stream. |
| 435 | // |
| 436 | //#define DEBUG_UPREFS 1 |
| 437 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 438 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 439 | #else |
| 440 | #define UR_OUT(X) |
| 441 | #endif |
| 442 | |
| 443 | #define YYERROR_VERBOSE 1 |
| 444 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 445 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 446 | |
| 447 | |
| 448 | // This contains info used when building the body of a function. It is |
| 449 | // destroyed when the function is completed. |
| 450 | // |
| 451 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 452 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 453 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 454 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 455 | |
| 456 | static struct PerModuleInfo { |
| 457 | Module *CurrentModule; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 458 | ValueList Values; // Module level numbered definitions |
| 459 | ValueList LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 460 | std::vector<PATypeHolder> Types; |
| 461 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 462 | |
| 463 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 464 | /// 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] | 465 | /// that we can resolve them later and print error messages as appropriate. |
| 466 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 467 | |
| 468 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 469 | // references to global values. Global values may be referenced before they |
| 470 | // are defined, and if so, the temporary object that they represent is held |
| 471 | // here. This is used for forward references of GlobalValues. |
| 472 | // |
| 473 | typedef std::map<std::pair<const PointerType *, |
| 474 | ValID>, GlobalValue*> GlobalRefsType; |
| 475 | GlobalRefsType GlobalRefs; |
| 476 | |
| 477 | void ModuleDone() { |
| 478 | // If we could not resolve some functions at function compilation time |
| 479 | // (calls to functions before they are defined), resolve them now... Types |
| 480 | // are resolved when the constant pool has been completely parsed. |
| 481 | // |
| 482 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 483 | if (TriggerError) |
| 484 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 485 | |
| 486 | // Check to make sure that all global value forward references have been |
| 487 | // resolved! |
| 488 | // |
| 489 | if (!GlobalRefs.empty()) { |
| 490 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 491 | |
| 492 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 493 | I != E; ++I) { |
| 494 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 495 | I->first.second.getName() + "\n"; |
| 496 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 497 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 498 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 499 | } |
| 500 | |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 501 | // Look for intrinsic functions and CallInst that need to be upgraded |
| 502 | for (Module::iterator FI = CurrentModule->begin(), |
| 503 | FE = CurrentModule->end(); FI != FE; ) |
| 504 | UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove |
| 505 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 506 | Values.clear(); // Clear out function local definitions |
| 507 | Types.clear(); |
| 508 | CurrentModule = 0; |
| 509 | } |
| 510 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 511 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 512 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 513 | // If not, just return null. |
| 514 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 515 | // Check to see if there is a forward reference to this global variable... |
| 516 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 517 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 518 | GlobalValue *Ret = 0; |
| 519 | if (I != GlobalRefs.end()) { |
| 520 | Ret = I->second; |
| 521 | GlobalRefs.erase(I); |
| 522 | } |
| 523 | return Ret; |
| 524 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 525 | |
| 526 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 527 | // If it isn't abstract, its resolved |
| 528 | const Type* Ty = PATy->get(); |
| 529 | if (!Ty->isAbstract()) |
| 530 | return false; |
| 531 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 532 | // we don't need to traverse that leg of the type. |
| 533 | std::vector<const Type*> WorkList, SeenList; |
| 534 | WorkList.push_back(Ty); |
| 535 | while (!WorkList.empty()) { |
| 536 | const Type* Ty = WorkList.back(); |
| 537 | SeenList.push_back(Ty); |
| 538 | WorkList.pop_back(); |
| 539 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 540 | // Check to see if this is an unresolved type |
| 541 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 542 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 543 | for ( ; I != E; ++I) { |
| 544 | if (I->second.get() == OpTy) |
| 545 | return true; |
| 546 | } |
| 547 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 548 | const Type* TheTy = SeqTy->getElementType(); |
| 549 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 550 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 551 | E = SeenList.end(); |
| 552 | for ( ; I != E; ++I) |
| 553 | if (*I == TheTy) |
| 554 | break; |
| 555 | if (I == E) |
| 556 | WorkList.push_back(TheTy); |
| 557 | } |
| 558 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 559 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 560 | const Type* TheTy = StrTy->getElementType(i); |
| 561 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 562 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 563 | E = SeenList.end(); |
| 564 | for ( ; I != E; ++I) |
| 565 | if (*I == TheTy) |
| 566 | break; |
| 567 | if (I == E) |
| 568 | WorkList.push_back(TheTy); |
| 569 | } |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | return false; |
| 574 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 575 | } CurModule; |
| 576 | |
| 577 | static struct PerFunctionInfo { |
| 578 | Function *CurrentFunction; // Pointer to current function being created |
| 579 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 580 | ValueList Values; // Keep track of #'d definitions |
| 581 | unsigned NextValNum; |
| 582 | ValueList LateResolveValues; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 583 | bool isDeclare; // Is this function a forward declararation? |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 584 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 585 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 586 | |
| 587 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 588 | /// track of them here. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 589 | std::map<ValID, BasicBlock*> BBForwardRefs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 590 | |
| 591 | inline PerFunctionInfo() { |
| 592 | CurrentFunction = 0; |
| 593 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 594 | Linkage = GlobalValue::ExternalLinkage; |
| 595 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | inline void FunctionStart(Function *M) { |
| 599 | CurrentFunction = M; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 600 | NextValNum = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 601 | } |
| 602 | |
| 603 | void FunctionDone() { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 604 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 605 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 606 | GenerateError("Undefined reference to label " + |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 607 | BBForwardRefs.begin()->second->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 608 | return; |
| 609 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 610 | |
| 611 | // Resolve all forward references now. |
| 612 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 613 | |
| 614 | Values.clear(); // Clear out function local definitions |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 615 | BBForwardRefs.clear(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 616 | CurrentFunction = 0; |
| 617 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 618 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 619 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 620 | } |
| 621 | } CurFun; // Info for the current function... |
| 622 | |
| 623 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 624 | |
| 625 | |
| 626 | //===----------------------------------------------------------------------===// |
| 627 | // Code to handle definitions of all the types |
| 628 | //===----------------------------------------------------------------------===// |
| 629 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 630 | static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
| 631 | // Things that have names or are void typed don't get slot numbers |
| 632 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
| 633 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 634 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 635 | // In the case of function values, we have to allow for the forward reference |
| 636 | // of basic blocks, which are included in the numbering. Consequently, we keep |
| 637 | // track of the next insertion location with NextValNum. When a BB gets |
| 638 | // inserted, it could change the size of the CurFun.Values vector. |
| 639 | if (&ValueTab == &CurFun.Values) { |
| 640 | if (ValueTab.size() <= CurFun.NextValNum) |
| 641 | ValueTab.resize(CurFun.NextValNum+1); |
| 642 | ValueTab[CurFun.NextValNum++] = V; |
| 643 | return; |
| 644 | } |
| 645 | // For all other lists, its okay to just tack it on the back of the vector. |
| 646 | ValueTab.push_back(V); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 650 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 651 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 652 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 653 | if (D.Num < CurModule.Types.size()) |
| 654 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 655 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 656 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 657 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 658 | D.destroy(); // Free old strdup'd memory... |
| 659 | return N; |
| 660 | } |
| 661 | break; |
| 662 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 663 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 664 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 665 | } |
| 666 | |
| 667 | // If we reached here, we referenced either a symbol that we don't know about |
| 668 | // or an id number that hasn't been read yet. We may be referencing something |
| 669 | // forward, so just create an entry to be resolved later and get to it... |
| 670 | // |
| 671 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 672 | |
| 673 | |
| 674 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 675 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 676 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 677 | return 0; |
| 678 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 679 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 680 | return 0; |
| 681 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 682 | } |
| 683 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 684 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 685 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 686 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 687 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 688 | Type *Typ = OpaqueType::get(); |
| 689 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 690 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 691 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 692 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 693 | // getExistingVal - Look up the value specified by the provided type and |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 694 | // the provided ValID. If the value exists and has already been defined, return |
| 695 | // it. Otherwise return null. |
| 696 | // |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 697 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 698 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 699 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 700 | "must be referenced as pointers"); |
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 | |
| 704 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 705 | case ValID::LocalID: { // Is it a numbered definition? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 706 | // Check that the number is within bounds. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 707 | if (D.Num >= CurFun.Values.size()) |
| 708 | return 0; |
| 709 | Value *Result = CurFun.Values[D.Num]; |
| 710 | if (Ty != Result->getType()) { |
| 711 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
| 712 | Result->getType()->getDescription() + "' does not match " |
| 713 | "expected type, '" + Ty->getDescription() + "'"); |
| 714 | return 0; |
| 715 | } |
| 716 | return Result; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 717 | } |
| 718 | case ValID::GlobalID: { // Is it a numbered definition? |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 719 | if (D.Num >= CurModule.Values.size()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 720 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 721 | Value *Result = CurModule.Values[D.Num]; |
| 722 | if (Ty != Result->getType()) { |
| 723 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
| 724 | Result->getType()->getDescription() + "' does not match " |
| 725 | "expected type, '" + Ty->getDescription() + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 726 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 727 | } |
| 728 | return Result; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 729 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 730 | |
| 731 | case ValID::LocalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 732 | if (!inFunctionScope()) |
| 733 | return 0; |
| 734 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 735 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 736 | if (N == 0) |
| 737 | return 0; |
| 738 | if (N->getType() != Ty) |
| 739 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 740 | |
| 741 | D.destroy(); // Free old strdup'd memory... |
| 742 | return N; |
| 743 | } |
| 744 | case ValID::GlobalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 745 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 746 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 747 | if (N == 0) |
| 748 | return 0; |
| 749 | if (N->getType() != Ty) |
| 750 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 751 | |
| 752 | D.destroy(); // Free old strdup'd memory... |
| 753 | return N; |
| 754 | } |
| 755 | |
| 756 | // Check to make sure that "Ty" is an integral type, and that our |
| 757 | // value will fit into the specified type... |
| 758 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 759 | if (!isa<IntegerType>(Ty) || |
| 760 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 761 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 762 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 763 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 764 | return 0; |
| 765 | } |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 766 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 767 | |
| 768 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 769 | if (isa<IntegerType>(Ty) && |
| 770 | ConstantInt::isValueValidForType(Ty, D.UConstPool64)) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 771 | return ConstantInt::get(Ty, D.UConstPool64); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 772 | |
| 773 | if (!isa<IntegerType>(Ty) || |
| 774 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
| 775 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
| 776 | "' is invalid or out of range for type '" + |
| 777 | Ty->getDescription() + "'"); |
| 778 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 779 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 780 | // This is really a signed reference. Transmogrify. |
| 781 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 782 | |
| 783 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 784 | if (!Ty->isFloatingPoint() || |
| 785 | !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 786 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 787 | return 0; |
| 788 | } |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 789 | // Lexer has no type info, so builds all float and double FP constants |
Dale Johannesen | c72cd7e | 2007-09-11 18:33:39 +0000 | [diff] [blame] | 790 | // as double. Fix this here. Long double does not need this. |
| 791 | if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && |
| 792 | Ty==Type::FloatTy) |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 793 | D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 794 | return ConstantFP::get(*D.ConstPoolFP); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 795 | |
| 796 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 797 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 798 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 799 | return 0; |
| 800 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 801 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 802 | |
| 803 | case ValID::ConstUndefVal: // Is it an undef value? |
| 804 | return UndefValue::get(Ty); |
| 805 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 806 | case ValID::ConstZeroVal: // Is it a zero value? |
| 807 | return Constant::getNullValue(Ty); |
| 808 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 809 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 810 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 811 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 812 | return 0; |
| 813 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 814 | return D.ConstantValue; |
| 815 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 816 | case ValID::InlineAsmVal: { // Inline asm expression |
| 817 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 818 | const FunctionType *FTy = |
| 819 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 820 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 821 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 822 | return 0; |
| 823 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 824 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 825 | D.IAD->HasSideEffects); |
| 826 | D.destroy(); // Free InlineAsmDescriptor. |
| 827 | return IA; |
| 828 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 829 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 830 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 831 | return 0; |
| 832 | } // End of switch |
| 833 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 834 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 835 | return 0; |
| 836 | } |
| 837 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 838 | // getVal - This function is identical to getExistingVal, except that if a |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 839 | // value is not already defined, it "improvises" by creating a placeholder var |
| 840 | // that looks and acts just like the requested variable. When the value is |
| 841 | // defined later, all uses of the placeholder variable are replaced with the |
| 842 | // real thing. |
| 843 | // |
| 844 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 845 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 846 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 847 | return 0; |
| 848 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 849 | |
| 850 | // See if the value has already been defined. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 851 | Value *V = getExistingVal(Ty, ID); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 852 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 853 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 854 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 855 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 856 | GenerateError("Invalid use of a non-first-class type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 857 | return 0; |
| 858 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 859 | |
| 860 | // If we reached here, we referenced either a symbol that we don't know about |
| 861 | // or an id number that hasn't been read yet. We may be referencing something |
| 862 | // forward, so just create an entry to be resolved later and get to it... |
| 863 | // |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 864 | switch (ID.Type) { |
| 865 | case ValID::GlobalName: |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 866 | case ValID::GlobalID: { |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 867 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 868 | if (!PTy) { |
| 869 | GenerateError("Invalid type for reference to global" ); |
| 870 | return 0; |
| 871 | } |
| 872 | const Type* ElTy = PTy->getElementType(); |
| 873 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 874 | V = Function::Create(FTy, GlobalValue::ExternalLinkage); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 875 | else |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 876 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", |
| 877 | (Module*)0, false, PTy->getAddressSpace()); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 878 | break; |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 879 | } |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 880 | default: |
| 881 | V = new Argument(Ty); |
| 882 | } |
| 883 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 884 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 885 | // to recycle these things?? |
| 886 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 887 | LLLgetLineNo()))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 888 | |
| 889 | if (inFunctionScope()) |
| 890 | InsertValue(V, CurFun.LateResolveValues); |
| 891 | else |
| 892 | InsertValue(V, CurModule.LateResolveValues); |
| 893 | return V; |
| 894 | } |
| 895 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 896 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 897 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 898 | static BasicBlock *defineBBVal(const ValID &ID) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 899 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 900 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 901 | BasicBlock *BB = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 902 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 903 | // First, see if this was forward referenced |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 904 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 905 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 906 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 907 | BB = BBI->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 908 | // The forward declaration could have been inserted anywhere in the |
| 909 | // function: insert it into the correct place now. |
| 910 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 911 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 912 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 913 | // We're about to erase the entry, save the key so we can clean it up. |
| 914 | ValID Tmp = BBI->first; |
| 915 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 916 | // Erase the forward ref from the map as its no longer "forward" |
| 917 | CurFun.BBForwardRefs.erase(ID); |
| 918 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 919 | // The key has been removed from the map but so we don't want to leave |
| 920 | // strdup'd memory around so destroy it too. |
| 921 | Tmp.destroy(); |
| 922 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 923 | // If its a numbered definition, bump the number and set the BB value. |
| 924 | if (ID.Type == ValID::LocalID) { |
| 925 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 926 | InsertValue(BB); |
| 927 | } |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 928 | } else { |
| 929 | // We haven't seen this BB before and its first mention is a definition. |
| 930 | // Just create it and return it. |
| 931 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 932 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 933 | if (ID.Type == ValID::LocalID) { |
| 934 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 935 | InsertValue(BB); |
| 936 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 937 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 938 | |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 939 | ID.destroy(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 940 | return BB; |
| 941 | } |
| 942 | |
| 943 | /// getBBVal - get an existing BB value or create a forward reference for it. |
| 944 | /// |
| 945 | static BasicBlock *getBBVal(const ValID &ID) { |
| 946 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 947 | |
| 948 | BasicBlock *BB = 0; |
| 949 | |
| 950 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 951 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 952 | BB = BBI->second; |
| 953 | } if (ID.Type == ValID::LocalName) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 954 | std::string Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 955 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 956 | if (N) { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 957 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 958 | BB = cast<BasicBlock>(N); |
| 959 | else |
| 960 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 961 | N->getType()->getDescription() + "'"); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 962 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 963 | } else if (ID.Type == ValID::LocalID) { |
| 964 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 965 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 966 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 967 | else |
| 968 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 969 | "' is actually of type '"+ |
| 970 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 971 | } |
| 972 | } else { |
| 973 | GenerateError("Illegal label reference " + ID.getName()); |
| 974 | return 0; |
| 975 | } |
| 976 | |
| 977 | // If its already been defined, return it now. |
| 978 | if (BB) { |
| 979 | ID.destroy(); // Free strdup'd memory. |
| 980 | return BB; |
| 981 | } |
| 982 | |
| 983 | // Otherwise, this block has not been seen before, create it. |
| 984 | std::string Name; |
| 985 | if (ID.Type == ValID::LocalName) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 986 | Name = ID.getName(); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 987 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 988 | |
| 989 | // Insert it in the forward refs map. |
| 990 | CurFun.BBForwardRefs[ID] = BB; |
| 991 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 992 | return BB; |
| 993 | } |
| 994 | |
| 995 | |
| 996 | //===----------------------------------------------------------------------===// |
| 997 | // Code to handle forward references in instructions |
| 998 | //===----------------------------------------------------------------------===// |
| 999 | // |
| 1000 | // This code handles the late binding needed with statements that reference |
| 1001 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 1002 | // a loop body. |
| 1003 | // |
| 1004 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 1005 | // and back patchs after we are done. |
| 1006 | // |
| 1007 | |
| 1008 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 1009 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 1010 | // defs now... |
| 1011 | // |
| 1012 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1013 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1014 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1015 | while (!LateResolvers.empty()) { |
| 1016 | Value *V = LateResolvers.back(); |
| 1017 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1018 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1019 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 1020 | CurModule.PlaceHolderInfo.find(V); |
| 1021 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1022 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1023 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1024 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1025 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 1026 | if (TriggerError) |
| 1027 | return; |
| 1028 | if (TheRealValue) { |
| 1029 | V->replaceAllUsesWith(TheRealValue); |
| 1030 | delete V; |
| 1031 | CurModule.PlaceHolderInfo.erase(PHI); |
| 1032 | } else if (FutureLateResolvers) { |
| 1033 | // Functions have their unresolved items forwarded to the module late |
| 1034 | // resolver table |
| 1035 | InsertValue(V, *FutureLateResolvers); |
| 1036 | } else { |
| 1037 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 1038 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 1039 | "' of type '" + V->getType()->getDescription() + "'", |
| 1040 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1041 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1042 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1043 | GenerateError("Reference to an invalid definition: #" + |
| 1044 | itostr(DID.Num) + " of type '" + |
| 1045 | V->getType()->getDescription() + "'", |
| 1046 | PHI->second.second); |
| 1047 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1048 | } |
| 1049 | } |
| 1050 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1051 | LateResolvers.clear(); |
| 1052 | } |
| 1053 | |
| 1054 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 1055 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 1056 | // refering to the number can be resolved. Do this now. |
| 1057 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1058 | static void ResolveTypeTo(std::string *Name, const Type *ToTy) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1059 | ValID D; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1060 | if (Name) |
| 1061 | D = ValID::createLocalName(*Name); |
| 1062 | else |
| 1063 | D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1064 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1065 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1066 | CurModule.LateResolveTypes.find(D); |
| 1067 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1068 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1069 | CurModule.LateResolveTypes.erase(I); |
| 1070 | } |
| 1071 | } |
| 1072 | |
| 1073 | // setValueName - Set the specified value to the name given. The name may be |
| 1074 | // null potentially, in which case this is a noop. The string passed in is |
| 1075 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1076 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1077 | static void setValueName(Value *V, std::string *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1078 | if (!NameStr) return; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1079 | std::string Name(*NameStr); // Copy string |
| 1080 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1081 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1082 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1083 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1084 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1085 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1086 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1087 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1088 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1089 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1090 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1091 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1092 | return; |
| 1093 | } |
| 1094 | |
| 1095 | // Set the name. |
| 1096 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1097 | } |
| 1098 | |
| 1099 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1100 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1101 | static GlobalVariable * |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1102 | ParseGlobalVariable(std::string *NameStr, |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1103 | GlobalValue::LinkageTypes Linkage, |
| 1104 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1105 | bool isConstantGlobal, const Type *Ty, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1106 | Constant *Initializer, bool IsThreadLocal, |
| 1107 | unsigned AddressSpace = 0) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1108 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1109 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1110 | return 0; |
| 1111 | } |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1112 | if (Ty == Type::LabelTy) { |
| 1113 | GenerateError("Cannot declare global vars of label type"); |
| 1114 | return 0; |
| 1115 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1116 | |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1117 | const PointerType *PTy = PointerType::get(Ty, AddressSpace); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1118 | |
| 1119 | std::string Name; |
| 1120 | if (NameStr) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1121 | Name = *NameStr; // Copy string |
| 1122 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1123 | } |
| 1124 | |
| 1125 | // See if this global value was forward referenced. If so, recycle the |
| 1126 | // object. |
| 1127 | ValID ID; |
| 1128 | if (!Name.empty()) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1129 | ID = ValID::createGlobalName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1130 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1131 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1132 | } |
| 1133 | |
| 1134 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1135 | // Move the global to the end of the list, from whereever it was |
| 1136 | // previously inserted. |
| 1137 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1138 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1139 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1140 | GV->setInitializer(Initializer); |
| 1141 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1142 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1143 | GV->setConstant(isConstantGlobal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1144 | GV->setThreadLocal(IsThreadLocal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1145 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1146 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1147 | } |
| 1148 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1149 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1150 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1151 | // if the global we're parsing has an initializer (is a definition) and |
| 1152 | // has external linkage. |
| 1153 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1154 | // If there is already a global with external linkage with this name |
| 1155 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1156 | // If we allow this GVar to get created, it will be renamed in the |
| 1157 | // symbol table because it conflicts with an existing GVar. We can't |
| 1158 | // allow redefinition of GVars whose linking indicates that their name |
| 1159 | // must stay the same. Issue the error. |
| 1160 | GenerateError("Redefinition of global variable named '" + Name + |
| 1161 | "' of type '" + Ty->getDescription() + "'"); |
| 1162 | return 0; |
| 1163 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1164 | } |
| 1165 | |
| 1166 | // Otherwise there is no existing GV to use, create one now. |
| 1167 | GlobalVariable *GV = |
| 1168 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1169 | CurModule.CurrentModule, IsThreadLocal, AddressSpace); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1170 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1171 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1172 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1173 | } |
| 1174 | |
| 1175 | // setTypeName - Set the specified type to the name given. The name may be |
| 1176 | // null potentially, in which case this is a noop. The string passed in is |
| 1177 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1178 | // |
| 1179 | // This function returns true if the type has already been defined, but is |
| 1180 | // allowed to be redefined in the specified context. If the name is a new name |
| 1181 | // for the type plane, it is inserted and false is returned. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1182 | static bool setTypeName(const Type *T, std::string *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1183 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1184 | if (NameStr == 0) return false; |
| 1185 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1186 | std::string Name(*NameStr); // Copy string |
| 1187 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1188 | |
| 1189 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1190 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1191 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1192 | return false; |
| 1193 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1194 | |
| 1195 | // Set the type name, checking for conflicts as we do so. |
| 1196 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1197 | |
| 1198 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1199 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1200 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1201 | |
| 1202 | // There is only one case where this is allowed: when we are refining an |
| 1203 | // opaque type. In this case, Existing will be an opaque type. |
| 1204 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1205 | // We ARE replacing an opaque type! |
| 1206 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1207 | return true; |
| 1208 | } |
| 1209 | |
| 1210 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1211 | // the redefinition is identical to the original. This will be so if |
| 1212 | // Existing and T point to the same Type object. In this one case we |
| 1213 | // allow the equivalent redefinition. |
| 1214 | if (Existing == T) return true; // Yes, it's equal. |
| 1215 | |
| 1216 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1217 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1218 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1219 | } |
| 1220 | |
| 1221 | return false; |
| 1222 | } |
| 1223 | |
| 1224 | //===----------------------------------------------------------------------===// |
| 1225 | // Code for handling upreferences in type names... |
| 1226 | // |
| 1227 | |
| 1228 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1229 | // |
| 1230 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1231 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1232 | E) != Ty->subtype_end(); |
| 1233 | } |
| 1234 | |
| 1235 | namespace { |
| 1236 | struct UpRefRecord { |
| 1237 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1238 | // this type is resolved. |
| 1239 | unsigned NestingLevel; |
| 1240 | |
| 1241 | // LastContainedTy - This is the type at the current binding level for the |
| 1242 | // type. Every time we reduce the nesting level, this gets updated. |
| 1243 | const Type *LastContainedTy; |
| 1244 | |
| 1245 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1246 | // represented with. |
| 1247 | OpaqueType *UpRefTy; |
| 1248 | |
| 1249 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1250 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1251 | }; |
| 1252 | } |
| 1253 | |
| 1254 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1255 | static std::vector<UpRefRecord> UpRefs; |
| 1256 | |
| 1257 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1258 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1259 | /// currently active types. For each type, if the up reference is contained in |
| 1260 | /// the newly completed type, we decrement the level count. When the level |
| 1261 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1262 | /// thus we can complete the cycle. |
| 1263 | /// |
| 1264 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1265 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1266 | // nothing to resolve here. |
| 1267 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1268 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1269 | PATypeHolder Ty(ty); |
| 1270 | UR_OUT("Type '" << Ty->getDescription() << |
| 1271 | "' newly formed. Resolving upreferences.\n" << |
| 1272 | UpRefs.size() << " upreferences active!\n"); |
| 1273 | |
| 1274 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1275 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1276 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1277 | // this variable. |
| 1278 | OpaqueType *TypeToResolve = 0; |
| 1279 | |
| 1280 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1281 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1282 | << UpRefs[i].second->getDescription() << ") = " |
| 1283 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1284 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1285 | // Decrement level of upreference |
| 1286 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1287 | UpRefs[i].LastContainedTy = Ty; |
| 1288 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1289 | if (Level == 0) { // Upreference should be resolved! |
| 1290 | if (!TypeToResolve) { |
| 1291 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1292 | } else { |
| 1293 | UR_OUT(" * Resolving upreference for " |
| 1294 | << UpRefs[i].second->getDescription() << "\n"; |
| 1295 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1296 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1297 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1298 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1299 | } |
| 1300 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1301 | --i; // Do not skip the next element... |
| 1302 | } |
| 1303 | } |
| 1304 | } |
| 1305 | |
| 1306 | if (TypeToResolve) { |
| 1307 | UR_OUT(" * Resolving upreference for " |
| 1308 | << UpRefs[i].second->getDescription() << "\n"; |
| 1309 | std::string OldName = TypeToResolve->getDescription()); |
| 1310 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1311 | } |
| 1312 | |
| 1313 | return Ty; |
| 1314 | } |
| 1315 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1316 | //===----------------------------------------------------------------------===// |
| 1317 | // RunVMAsmParser - Define an interface to this parser |
| 1318 | //===----------------------------------------------------------------------===// |
| 1319 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1320 | static Module* RunParser(Module * M); |
| 1321 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 1322 | Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { |
| 1323 | InitLLLexer(MB); |
| 1324 | Module *M = RunParser(new Module(LLLgetFilename())); |
| 1325 | FreeLexer(); |
| 1326 | return M; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1327 | } |
| 1328 | |
| 1329 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1330 | |
| 1331 | /* Enabling traces. */ |
| 1332 | #ifndef YYDEBUG |
| 1333 | # define YYDEBUG 0 |
| 1334 | #endif |
| 1335 | |
| 1336 | /* Enabling verbose error messages. */ |
| 1337 | #ifdef YYERROR_VERBOSE |
| 1338 | # undef YYERROR_VERBOSE |
| 1339 | # define YYERROR_VERBOSE 1 |
| 1340 | #else |
| 1341 | # define YYERROR_VERBOSE 0 |
| 1342 | #endif |
| 1343 | |
| 1344 | /* Enabling the token table. */ |
| 1345 | #ifndef YYTOKEN_TABLE |
| 1346 | # define YYTOKEN_TABLE 0 |
| 1347 | #endif |
| 1348 | |
| 1349 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 1350 | typedef union YYSTYPE |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1351 | #line 953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1352 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1353 | llvm::Module *ModuleVal; |
| 1354 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1355 | llvm::BasicBlock *BasicBlockVal; |
| 1356 | llvm::TerminatorInst *TermInstVal; |
| 1357 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1358 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1359 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1360 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1361 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1362 | llvm::PATypeHolder *TypeVal; |
| 1363 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1364 | std::vector<llvm::Value*> *ValueList; |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1365 | std::vector<unsigned> *ConstantList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1366 | llvm::ArgListType *ArgList; |
| 1367 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1368 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 1369 | llvm::ParamList *ParamList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1370 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1371 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1372 | std::list<std::pair<llvm::Value*, |
| 1373 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1374 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1375 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1376 | |
| 1377 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1378 | llvm::GlobalValue::VisibilityTypes Visibility; |
Dale Johannesen | 222ebf7 | 2008-02-19 21:40:51 +0000 | [diff] [blame] | 1379 | llvm::ParameterAttributes ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1380 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1381 | int64_t SInt64Val; |
| 1382 | uint64_t UInt64Val; |
| 1383 | int SIntVal; |
| 1384 | unsigned UIntVal; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 1385 | llvm::APFloat *FPVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1386 | bool BoolVal; |
| 1387 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1388 | std::string *StrVal; // This memory must be deleted |
| 1389 | llvm::ValID ValIDVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1390 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1391 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1392 | llvm::Instruction::TermOps TermOpVal; |
| 1393 | llvm::Instruction::MemoryOps MemOpVal; |
| 1394 | llvm::Instruction::CastOps CastOpVal; |
| 1395 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1396 | llvm::ICmpInst::Predicate IPredicate; |
| 1397 | llvm::FCmpInst::Predicate FPredicate; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1398 | } |
| 1399 | /* Line 193 of yacc.c. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1400 | #line 1401 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1401 | YYSTYPE; |
| 1402 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1403 | # define YYSTYPE_IS_DECLARED 1 |
| 1404 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1405 | #endif |
| 1406 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1407 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1408 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1409 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1410 | |
| 1411 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1412 | /* Line 216 of yacc.c. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1413 | #line 1414 "llvmAsmParser.tab.c" |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1414 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1415 | #ifdef short |
| 1416 | # undef short |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1417 | #endif |
| 1418 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1419 | #ifdef YYTYPE_UINT8 |
| 1420 | typedef YYTYPE_UINT8 yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1421 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1422 | typedef unsigned char yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1423 | #endif |
| 1424 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1425 | #ifdef YYTYPE_INT8 |
| 1426 | typedef YYTYPE_INT8 yytype_int8; |
| 1427 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 1428 | || defined __cplusplus || defined _MSC_VER) |
| 1429 | typedef signed char yytype_int8; |
| 1430 | #else |
| 1431 | typedef short int yytype_int8; |
| 1432 | #endif |
| 1433 | |
| 1434 | #ifdef YYTYPE_UINT16 |
| 1435 | typedef YYTYPE_UINT16 yytype_uint16; |
| 1436 | #else |
| 1437 | typedef unsigned short int yytype_uint16; |
| 1438 | #endif |
| 1439 | |
| 1440 | #ifdef YYTYPE_INT16 |
| 1441 | typedef YYTYPE_INT16 yytype_int16; |
| 1442 | #else |
| 1443 | typedef short int yytype_int16; |
| 1444 | #endif |
| 1445 | |
| 1446 | #ifndef YYSIZE_T |
| 1447 | # ifdef __SIZE_TYPE__ |
| 1448 | # define YYSIZE_T __SIZE_TYPE__ |
| 1449 | # elif defined size_t |
| 1450 | # define YYSIZE_T size_t |
| 1451 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1452 | || defined __cplusplus || defined _MSC_VER) |
| 1453 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1454 | # define YYSIZE_T size_t |
| 1455 | # else |
| 1456 | # define YYSIZE_T unsigned int |
| 1457 | # endif |
| 1458 | #endif |
| 1459 | |
| 1460 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 1461 | |
| 1462 | #ifndef YY_ |
| 1463 | # if defined YYENABLE_NLS && YYENABLE_NLS |
| 1464 | # if ENABLE_NLS |
| 1465 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1466 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1467 | # endif |
| 1468 | # endif |
| 1469 | # ifndef YY_ |
| 1470 | # define YY_(msgid) msgid |
| 1471 | # endif |
| 1472 | #endif |
| 1473 | |
| 1474 | /* Suppress unused-variable warnings by "using" E. */ |
| 1475 | #if ! defined lint || defined __GNUC__ |
| 1476 | # define YYUSE(e) ((void) (e)) |
| 1477 | #else |
| 1478 | # define YYUSE(e) /* empty */ |
| 1479 | #endif |
| 1480 | |
| 1481 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 1482 | #ifndef lint |
| 1483 | # define YYID(n) (n) |
| 1484 | #else |
| 1485 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1486 | || defined __cplusplus || defined _MSC_VER) |
| 1487 | static int |
| 1488 | YYID (int i) |
| 1489 | #else |
| 1490 | static int |
| 1491 | YYID (i) |
| 1492 | int i; |
| 1493 | #endif |
| 1494 | { |
| 1495 | return i; |
| 1496 | } |
| 1497 | #endif |
| 1498 | |
| 1499 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 1500 | |
| 1501 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1502 | |
| 1503 | # ifdef YYSTACK_USE_ALLOCA |
| 1504 | # if YYSTACK_USE_ALLOCA |
| 1505 | # ifdef __GNUC__ |
| 1506 | # define YYSTACK_ALLOC __builtin_alloca |
| 1507 | # elif defined __BUILTIN_VA_ARG_INCR |
| 1508 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 1509 | # elif defined _AIX |
| 1510 | # define YYSTACK_ALLOC __alloca |
| 1511 | # elif defined _MSC_VER |
| 1512 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 1513 | # define alloca _alloca |
| 1514 | # else |
| 1515 | # define YYSTACK_ALLOC alloca |
| 1516 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1517 | || defined __cplusplus || defined _MSC_VER) |
| 1518 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1519 | # ifndef _STDLIB_H |
| 1520 | # define _STDLIB_H 1 |
| 1521 | # endif |
| 1522 | # endif |
| 1523 | # endif |
| 1524 | # endif |
| 1525 | # endif |
| 1526 | |
| 1527 | # ifdef YYSTACK_ALLOC |
| 1528 | /* Pacify GCC's `empty if-body' warning. */ |
| 1529 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
| 1530 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1531 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1532 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1533 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1534 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1535 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 1536 | # endif |
| 1537 | # else |
| 1538 | # define YYSTACK_ALLOC YYMALLOC |
| 1539 | # define YYSTACK_FREE YYFREE |
| 1540 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1541 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 1542 | # endif |
| 1543 | # if (defined __cplusplus && ! defined _STDLIB_H \ |
| 1544 | && ! ((defined YYMALLOC || defined malloc) \ |
| 1545 | && (defined YYFREE || defined free))) |
| 1546 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1547 | # ifndef _STDLIB_H |
| 1548 | # define _STDLIB_H 1 |
| 1549 | # endif |
| 1550 | # endif |
| 1551 | # ifndef YYMALLOC |
| 1552 | # define YYMALLOC malloc |
| 1553 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1554 | || defined __cplusplus || defined _MSC_VER) |
| 1555 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1556 | # endif |
| 1557 | # endif |
| 1558 | # ifndef YYFREE |
| 1559 | # define YYFREE free |
| 1560 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1561 | || defined __cplusplus || defined _MSC_VER) |
| 1562 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1563 | # endif |
| 1564 | # endif |
| 1565 | # endif |
| 1566 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 1567 | |
| 1568 | |
| 1569 | #if (! defined yyoverflow \ |
| 1570 | && (! defined __cplusplus \ |
| 1571 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 1572 | |
| 1573 | /* A type that is properly aligned for any stack member. */ |
| 1574 | union yyalloc |
| 1575 | { |
| 1576 | yytype_int16 yyss; |
| 1577 | YYSTYPE yyvs; |
| 1578 | }; |
| 1579 | |
| 1580 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1581 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1582 | |
| 1583 | /* The size of an array large to enough to hold all stacks, each with |
| 1584 | N elements. */ |
| 1585 | # define YYSTACK_BYTES(N) \ |
| 1586 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 1587 | + YYSTACK_GAP_MAXIMUM) |
| 1588 | |
| 1589 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1590 | not overlap. */ |
| 1591 | # ifndef YYCOPY |
| 1592 | # if defined __GNUC__ && 1 < __GNUC__ |
| 1593 | # define YYCOPY(To, From, Count) \ |
| 1594 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1595 | # else |
| 1596 | # define YYCOPY(To, From, Count) \ |
| 1597 | do \ |
| 1598 | { \ |
| 1599 | YYSIZE_T yyi; \ |
| 1600 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1601 | (To)[yyi] = (From)[yyi]; \ |
| 1602 | } \ |
| 1603 | while (YYID (0)) |
| 1604 | # endif |
| 1605 | # endif |
| 1606 | |
| 1607 | /* Relocate STACK from its old location to the new one. The |
| 1608 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1609 | elements in the stack, and YYPTR gives the new location of the |
| 1610 | stack. Advance YYPTR to a properly aligned location for the next |
| 1611 | stack. */ |
| 1612 | # define YYSTACK_RELOCATE(Stack) \ |
| 1613 | do \ |
| 1614 | { \ |
| 1615 | YYSIZE_T yynewbytes; \ |
| 1616 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1617 | Stack = &yyptr->Stack; \ |
| 1618 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1619 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1620 | } \ |
| 1621 | while (YYID (0)) |
| 1622 | |
| 1623 | #endif |
| 1624 | |
| 1625 | /* YYFINAL -- State number of the termination state. */ |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1626 | #define YYFINAL 44 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1627 | /* YYLAST -- Last index in YYTABLE. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1628 | #define YYLAST 2191 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1629 | |
| 1630 | /* YYNTOKENS -- Number of terminals. */ |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1631 | #define YYNTOKENS 170 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1632 | /* YYNNTS -- Number of nonterminals. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1633 | #define YYNNTS 86 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1634 | /* YYNRULES -- Number of rules. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1635 | #define YYNRULES 333 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1636 | /* YYNRULES -- Number of states. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1637 | #define YYNSTATES 683 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1638 | |
| 1639 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1640 | #define YYUNDEFTOK 2 |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1641 | #define YYMAXUTOK 410 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1642 | |
| 1643 | #define YYTRANSLATE(YYX) \ |
| 1644 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1645 | |
| 1646 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1647 | static const yytype_uint8 yytranslate[] = |
| 1648 | { |
| 1649 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1650 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1651 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1652 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1653 | 156, 157, 160, 2, 159, 2, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1654 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1655 | 165, 158, 166, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1656 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1657 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1658 | 2, 162, 161, 164, 2, 2, 2, 2, 2, 169, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1659 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1660 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1661 | 163, 2, 2, 167, 2, 168, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1662 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1663 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1664 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1665 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1666 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1667 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1668 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1669 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1670 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1671 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1672 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1673 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1674 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1675 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1676 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1677 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1678 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1679 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1680 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1681 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1682 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1683 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1684 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1685 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1686 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1687 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1688 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1689 | 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, |
| 1690 | 155 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1691 | }; |
| 1692 | |
| 1693 | #if YYDEBUG |
| 1694 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1695 | YYRHS. */ |
| 1696 | static const yytype_uint16 yyprhs[] = |
| 1697 | { |
| 1698 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1699 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1700 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1701 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1702 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1703 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1704 | 119, 121, 123, 125, 127, 129, 130, 135, 136, 139, |
| 1705 | 140, 142, 144, 146, 147, 150, 152, 154, 156, 158, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1706 | 160, 162, 164, 166, 168, 169, 171, 173, 175, 176, |
| 1707 | 178, 180, 181, 183, 185, 187, 189, 190, 192, 194, |
| 1708 | 195, 197, 199, 201, 203, 205, 208, 210, 212, 214, |
| 1709 | 216, 218, 220, 222, 224, 226, 229, 230, 233, 235, |
| 1710 | 237, 239, 241, 243, 245, 246, 249, 250, 253, 254, |
| 1711 | 257, 258, 262, 265, 266, 268, 269, 273, 275, 278, |
| 1712 | 280, 282, 284, 286, 288, 290, 292, 294, 296, 300, |
| 1713 | 302, 305, 311, 317, 323, 329, 333, 336, 342, 347, |
| 1714 | 350, 352, 354, 356, 360, 362, 366, 368, 369, 371, |
| 1715 | 375, 380, 384, 388, 393, 398, 402, 409, 415, 418, |
| 1716 | 421, 424, 427, 430, 433, 436, 439, 442, 445, 448, |
| 1717 | 451, 458, 464, 473, 480, 487, 495, 503, 511, 519, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1718 | 526, 535, 544, 550, 558, 562, 564, 566, 568, 570, |
| 1719 | 571, 574, 581, 583, 584, 586, 589, 590, 594, 595, |
| 1720 | 599, 603, 607, 611, 612, 621, 622, 632, 633, 643, |
| 1721 | 649, 652, 656, 658, 662, 666, 670, 674, 676, 677, |
| 1722 | 683, 687, 689, 693, 695, 696, 707, 709, 711, 716, |
| 1723 | 718, 720, 723, 727, 728, 730, 732, 734, 736, 738, |
| 1724 | 740, 742, 744, 746, 750, 752, 758, 760, 762, 764, |
| 1725 | 766, 768, 770, 773, 775, 779, 782, 785, 789, 792, |
| 1726 | 793, 795, 798, 801, 805, 815, 825, 834, 849, 851, |
| 1727 | 853, 860, 866, 869, 876, 884, 889, 894, 901, 908, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1728 | 909, 910, 914, 917, 921, 924, 926, 932, 938, 945, |
| 1729 | 952, 959, 966, 971, 978, 983, 988, 995, 1002, 1005, |
| 1730 | 1014, 1016, 1018, 1019, 1023, 1030, 1034, 1041, 1044, 1050, |
| 1731 | 1058, 1064, 1069, 1074 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1732 | }; |
| 1733 | |
| 1734 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1735 | static const yytype_int16 yyrhs[] = |
| 1736 | { |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1737 | 216, 0, -1, 75, -1, 76, -1, 77, -1, 78, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1738 | -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, |
| 1739 | -1, 87, -1, 88, -1, 89, -1, 84, -1, 85, |
| 1740 | -1, 86, -1, 120, -1, 121, -1, 122, -1, 123, |
| 1741 | -1, 124, -1, 125, -1, 126, -1, 127, -1, 128, |
| 1742 | -1, 129, -1, 130, -1, 131, -1, 94, -1, 95, |
| 1743 | -1, 96, -1, 97, -1, 98, -1, 99, -1, 100, |
| 1744 | -1, 101, -1, 102, -1, 103, -1, 104, -1, 105, |
| 1745 | -1, 106, -1, 107, -1, 108, -1, 109, -1, 110, |
| 1746 | -1, 111, -1, 112, -1, 113, -1, 100, -1, 101, |
| 1747 | -1, 102, -1, 103, -1, 26, -1, 27, -1, 11, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1748 | -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1749 | -1, 19, -1, 22, -1, 24, -1, 178, -1, -1, |
| 1750 | 55, 156, 4, 157, -1, -1, 178, 158, -1, -1, |
| 1751 | 20, -1, 23, -1, 184, -1, -1, 182, 158, -1, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1752 | 42, -1, 44, -1, 43, -1, 45, -1, 47, -1, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1753 | 49, -1, 46, -1, 48, -1, 51, -1, -1, 153, |
| 1754 | -1, 154, -1, 155, -1, -1, 46, -1, 48, -1, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1755 | -1, 42, -1, 43, -1, 44, -1, 47, -1, -1, |
| 1756 | 44, -1, 42, -1, -1, 63, -1, 64, -1, 65, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1757 | -1, 66, -1, 67, -1, 62, 4, -1, 142, -1, |
| 1758 | 121, -1, 141, -1, 122, -1, 144, -1, 145, -1, |
| 1759 | 147, -1, 148, -1, 149, -1, 54, 4, -1, -1, |
| 1760 | 193, 192, -1, 143, -1, 146, -1, 142, -1, 141, |
| 1761 | -1, 150, -1, 151, -1, -1, 195, 194, -1, -1, |
| 1762 | 152, 22, -1, -1, 54, 4, -1, -1, 159, 54, |
| 1763 | 4, -1, 34, 22, -1, -1, 199, -1, -1, 159, |
| 1764 | 202, 201, -1, 199, -1, 54, 4, -1, 11, -1, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1765 | 12, -1, 13, -1, 16, -1, 15, -1, 14, -1, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1766 | 17, -1, 50, -1, 203, -1, 204, 180, 160, -1, |
| 1767 | 238, -1, 161, 4, -1, 204, 156, 208, 157, 195, |
| 1768 | -1, 10, 156, 208, 157, 195, -1, 162, 4, 163, |
| 1769 | 204, 164, -1, 165, 4, 163, 204, 166, -1, 167, |
| 1770 | 209, 168, -1, 167, 168, -1, 165, 167, 209, 168, |
| 1771 | 166, -1, 165, 167, 168, 166, -1, 204, 193, -1, |
| 1772 | 204, -1, 10, -1, 205, -1, 207, 159, 205, -1, |
| 1773 | 207, -1, 207, 159, 39, -1, 39, -1, -1, 204, |
| 1774 | -1, 209, 159, 204, -1, 204, 162, 212, 164, -1, |
| 1775 | 204, 162, 164, -1, 204, 169, 22, -1, 204, 165, |
| 1776 | 212, 166, -1, 204, 167, 212, 168, -1, 204, 167, |
| 1777 | 168, -1, 204, 165, 167, 212, 168, 166, -1, 204, |
| 1778 | 165, 167, 168, 166, -1, 204, 40, -1, 204, 41, |
| 1779 | -1, 204, 238, -1, 204, 211, -1, 204, 25, -1, |
| 1780 | 176, 3, -1, 176, 5, -1, 176, 4, -1, 176, |
| 1781 | 6, -1, 11, 26, -1, 11, 27, -1, 177, 9, |
| 1782 | -1, 173, 156, 210, 38, 204, 157, -1, 119, 156, |
| 1783 | 210, 250, 157, -1, 133, 156, 210, 159, 210, 159, |
| 1784 | 210, 157, -1, 171, 156, 210, 159, 210, 157, -1, |
| 1785 | 172, 156, 210, 159, 210, 157, -1, 90, 174, 156, |
| 1786 | 210, 159, 210, 157, -1, 91, 175, 156, 210, 159, |
| 1787 | 210, 157, -1, 92, 174, 156, 210, 159, 210, 157, |
| 1788 | -1, 93, 175, 156, 210, 159, 210, 157, -1, 135, |
| 1789 | 156, 210, 159, 210, 157, -1, 136, 156, 210, 159, |
| 1790 | 210, 159, 210, 157, -1, 137, 156, 210, 159, 210, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1791 | 159, 210, 157, -1, 139, 156, 210, 251, 157, -1, |
| 1792 | 140, 156, 210, 159, 210, 251, 157, -1, 212, 159, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1793 | 210, -1, 210, -1, 32, -1, 33, -1, 37, -1, |
| 1794 | -1, 206, 238, -1, 125, 156, 215, 38, 204, 157, |
| 1795 | -1, 217, -1, -1, 218, -1, 217, 218, -1, -1, |
| 1796 | 31, 219, 234, -1, -1, 30, 220, 235, -1, 60, |
| 1797 | 59, 224, -1, 181, 18, 204, -1, 181, 18, 10, |
| 1798 | -1, -1, 183, 187, 214, 213, 210, 180, 221, 201, |
| 1799 | -1, -1, 183, 185, 187, 214, 213, 210, 180, 222, |
| 1800 | 201, -1, -1, 183, 186, 187, 214, 213, 204, 180, |
| 1801 | 223, 201, -1, 183, 187, 35, 190, 215, -1, 52, |
| 1802 | 225, -1, 56, 158, 226, -1, 22, -1, 53, 158, |
| 1803 | 22, -1, 68, 158, 22, -1, 162, 227, 164, -1, |
| 1804 | 227, 159, 22, -1, 22, -1, -1, 228, 159, 204, |
| 1805 | 193, 179, -1, 204, 193, 179, -1, 228, -1, 228, |
| 1806 | 159, 39, -1, 39, -1, -1, 191, 206, 182, 156, |
| 1807 | 229, 157, 195, 200, 197, 196, -1, 28, -1, 167, |
| 1808 | -1, 189, 187, 230, 231, -1, 29, -1, 168, -1, |
| 1809 | 242, 233, -1, 188, 187, 230, -1, -1, 61, -1, |
| 1810 | 3, -1, 4, -1, 9, -1, 26, -1, 27, -1, |
| 1811 | 40, -1, 41, -1, 25, -1, 165, 212, 166, -1, |
| 1812 | 211, -1, 59, 236, 22, 159, 22, -1, 7, -1, |
| 1813 | 8, -1, 178, -1, 182, -1, 238, -1, 237, -1, |
| 1814 | 204, 239, -1, 240, -1, 241, 159, 240, -1, 242, |
| 1815 | 243, -1, 232, 243, -1, 244, 181, 245, -1, 244, |
| 1816 | 247, -1, -1, 21, -1, 69, 241, -1, 69, 10, |
| 1817 | -1, 70, 17, 239, -1, 70, 11, 239, 159, 17, |
| 1818 | 239, 159, 17, 239, -1, 71, 176, 239, 159, 17, |
| 1819 | 239, 162, 246, 164, -1, 71, 176, 239, 159, 17, |
| 1820 | 239, 162, 164, -1, 72, 191, 206, 239, 156, 249, |
| 1821 | 157, 195, 38, 17, 239, 73, 17, 239, -1, 73, |
| 1822 | -1, 74, -1, 246, 176, 237, 159, 17, 239, -1, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1823 | 176, 237, 159, 17, 239, -1, 181, 253, -1, 204, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1824 | 162, 239, 159, 239, 164, -1, 248, 159, 162, 239, |
| 1825 | 159, 239, 164, -1, 204, 193, 239, 193, -1, 17, |
| 1826 | 193, 239, 193, -1, 249, 159, 204, 193, 239, 193, |
| 1827 | -1, 249, 159, 17, 193, 239, 193, -1, -1, -1, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1828 | 250, 159, 240, -1, 159, 4, -1, 251, 159, 4, |
| 1829 | -1, 58, 57, -1, 57, -1, 171, 204, 239, 159, |
| 1830 | 239, -1, 172, 204, 239, 159, 239, -1, 90, 174, |
| 1831 | 204, 239, 159, 239, -1, 91, 175, 204, 239, 159, |
| 1832 | 239, -1, 92, 174, 204, 239, 159, 239, -1, 93, |
| 1833 | 175, 204, 239, 159, 239, -1, 173, 240, 38, 204, |
| 1834 | -1, 133, 240, 159, 240, 159, 240, -1, 134, 240, |
| 1835 | 159, 204, -1, 135, 240, 159, 240, -1, 136, 240, |
| 1836 | 159, 240, 159, 240, -1, 137, 240, 159, 240, 159, |
| 1837 | 240, -1, 132, 248, -1, 252, 191, 206, 239, 156, |
| 1838 | 249, 157, 195, -1, 255, -1, 36, -1, -1, 114, |
| 1839 | 204, 198, -1, 114, 204, 159, 11, 239, 198, -1, |
| 1840 | 115, 204, 198, -1, 115, 204, 159, 11, 239, 198, |
| 1841 | -1, 116, 240, -1, 254, 117, 204, 239, 198, -1, |
| 1842 | 254, 118, 240, 159, 204, 239, 198, -1, 138, 204, |
| 1843 | 239, 159, 4, -1, 119, 204, 239, 250, -1, 139, |
| 1844 | 204, 239, 251, -1, 140, 204, 239, 159, 204, 239, |
| 1845 | 251, -1 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1846 | }; |
| 1847 | |
| 1848 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1849 | static const yytype_uint16 yyrline[] = |
| 1850 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1851 | 0, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 1852 | 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1120, 1120, 1120, |
| 1853 | 1120, 1120, 1120, 1121, 1121, 1121, 1121, 1121, 1121, 1124, |
| 1854 | 1124, 1125, 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1132, |
| 1855 | 1132, 1133, 1133, 1134, 1134, 1135, 1135, 1136, 1136, 1137, |
| 1856 | 1137, 1138, 1138, 1139, 1140, 1145, 1146, 1146, 1146, 1146, |
| 1857 | 1146, 1148, 1148, 1148, 1149, 1149, 1151, 1152, 1156, 1160, |
| 1858 | 1165, 1165, 1167, 1168, 1173, 1179, 1180, 1181, 1182, 1183, |
| 1859 | 1184, 1188, 1189, 1190, 1194, 1195, 1196, 1197, 1201, 1202, |
| 1860 | 1203, 1207, 1208, 1209, 1210, 1211, 1215, 1216, 1217, 1220, |
| 1861 | 1221, 1222, 1223, 1224, 1225, 1226, 1233, 1234, 1235, 1236, |
| 1862 | 1237, 1238, 1239, 1240, 1241, 1242, 1246, 1247, 1252, 1253, |
| 1863 | 1254, 1255, 1256, 1257, 1260, 1261, 1266, 1267, 1274, 1275, |
| 1864 | 1281, 1282, 1291, 1299, 1300, 1305, 1306, 1307, 1312, 1325, |
| 1865 | 1325, 1325, 1325, 1325, 1325, 1325, 1328, 1332, 1336, 1343, |
| 1866 | 1348, 1356, 1385, 1410, 1415, 1425, 1435, 1439, 1449, 1456, |
| 1867 | 1465, 1472, 1477, 1482, 1489, 1490, 1497, 1504, 1512, 1518, |
| 1868 | 1530, 1558, 1574, 1601, 1629, 1655, 1675, 1701, 1721, 1733, |
| 1869 | 1740, 1806, 1816, 1826, 1832, 1842, 1848, 1858, 1864, 1870, |
| 1870 | 1883, 1895, 1916, 1924, 1930, 1941, 1946, 1951, 1956, 1961, |
| 1871 | 1967, 1973, 1979, 1987, 1998, 2002, 2010, 2010, 2013, 2013, |
| 1872 | 2016, 2028, 2049, 2054, 2062, 2063, 2067, 2067, 2071, 2071, |
| 1873 | 2074, 2077, 2101, 2113, 2112, 2124, 2123, 2133, 2132, 2143, |
| 1874 | 2183, 2186, 2192, 2202, 2206, 2211, 2213, 2218, 2223, 2232, |
| 1875 | 2242, 2253, 2257, 2266, 2275, 2280, 2409, 2409, 2411, 2420, |
| 1876 | 2420, 2422, 2427, 2439, 2443, 2448, 2452, 2456, 2460, 2464, |
| 1877 | 2468, 2472, 2476, 2480, 2508, 2512, 2522, 2526, 2530, 2535, |
| 1878 | 2542, 2542, 2548, 2557, 2562, 2567, 2571, 2580, 2589, 2598, |
| 1879 | 2602, 2610, 2617, 2621, 2626, 2637, 2656, 2665, 2751, 2755, |
| 1880 | 2762, 2773, 2786, 2796, 2807, 2817, 2828, 2836, 2846, 2853, |
| 1881 | 2856, 2857, 2865, 2871, 2880, 2884, 2889, 2905, 2922, 2936, |
| 1882 | 2950, 2964, 2978, 2990, 2998, 3005, 3011, 3017, 3023, 3038, |
| 1883 | 3128, 3133, 3137, 3144, 3151, 3161, 3168, 3178, 3186, 3200, |
| 1884 | 3217, 3225, 3240, 3255 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1885 | }; |
| 1886 | #endif |
| 1887 | |
| 1888 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1889 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1890 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1891 | static const char *const yytname[] = |
| 1892 | { |
| 1893 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1894 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1895 | "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE", |
| 1896 | "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT", |
| 1897 | "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK", |
| 1898 | "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", |
| 1899 | "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO", |
| 1900 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1901 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE", |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1902 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", |
| 1903 | "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", |
| 1904 | "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 1905 | "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", |
| 1906 | "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 1907 | "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP", |
| 1908 | "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", |
| 1909 | "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", |
| 1910 | "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", |
| 1911 | "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", |
| 1912 | "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", |
| 1913 | "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1914 | "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT", |
| 1915 | "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", |
| 1916 | "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('", |
| 1917 | "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", |
| 1918 | "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps", |
| 1919 | "IPredicates", "FPredicates", "IntType", "FPType", "LocalName", |
| 1920 | "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName", |
| 1921 | "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", |
| 1922 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1923 | "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr", |
| 1924 | "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", |
| 1925 | "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes", |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1926 | "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", |
| 1927 | "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", |
| 1928 | "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", |
| 1929 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1930 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1931 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1932 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1933 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal", |
| 1934 | "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1935 | "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", |
| 1936 | "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile", |
| 1937 | "MemoryInst", 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1938 | }; |
| 1939 | #endif |
| 1940 | |
| 1941 | # ifdef YYPRINT |
| 1942 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1943 | token YYLEX-NUM. */ |
| 1944 | static const yytype_uint16 yytoknum[] = |
| 1945 | { |
| 1946 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1947 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1948 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1949 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1950 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1951 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1952 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1953 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1954 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1955 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1956 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1957 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1958 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1959 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1960 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1961 | 405, 406, 407, 408, 409, 410, 40, 41, 61, 44, |
| 1962 | 42, 92, 91, 120, 93, 60, 62, 123, 125, 99 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1963 | }; |
| 1964 | # endif |
| 1965 | |
| 1966 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1967 | static const yytype_uint8 yyr1[] = |
| 1968 | { |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1969 | 0, 170, 171, 171, 171, 171, 171, 171, 171, 171, |
| 1970 | 171, 172, 172, 172, 172, 172, 172, 173, 173, 173, |
| 1971 | 173, 173, 173, 173, 173, 173, 173, 173, 173, 174, |
| 1972 | 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, |
| 1973 | 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, |
| 1974 | 175, 175, 175, 175, 175, 176, 177, 177, 177, 177, |
| 1975 | 177, 178, 178, 178, 179, 179, 180, 180, 181, 181, |
| 1976 | 182, 182, 183, 183, 184, 185, 185, 185, 185, 185, |
| 1977 | 185, 186, 186, 186, 187, 187, 187, 187, 188, 188, |
| 1978 | 188, 189, 189, 189, 189, 189, 190, 190, 190, 191, |
| 1979 | 191, 191, 191, 191, 191, 191, 192, 192, 192, 192, |
| 1980 | 192, 192, 192, 192, 192, 192, 193, 193, 194, 194, |
| 1981 | 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, |
| 1982 | 198, 198, 199, 200, 200, 201, 201, 202, 202, 203, |
| 1983 | 203, 203, 203, 203, 203, 203, 204, 204, 204, 204, |
| 1984 | 204, 204, 204, 204, 204, 204, 204, 204, 204, 205, |
| 1985 | 206, 206, 207, 207, 208, 208, 208, 208, 209, 209, |
| 1986 | 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, |
| 1987 | 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, |
| 1988 | 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, |
| 1989 | 211, 211, 211, 211, 212, 212, 213, 213, 214, 214, |
| 1990 | 215, 215, 216, 216, 217, 217, 219, 218, 220, 218, |
| 1991 | 218, 218, 218, 221, 218, 222, 218, 223, 218, 218, |
| 1992 | 218, 218, 224, 225, 225, 226, 227, 227, 227, 228, |
| 1993 | 228, 229, 229, 229, 229, 230, 231, 231, 232, 233, |
| 1994 | 233, 234, 235, 236, 236, 237, 237, 237, 237, 237, |
| 1995 | 237, 237, 237, 237, 237, 237, 238, 238, 238, 238, |
| 1996 | 239, 239, 240, 241, 241, 242, 242, 243, 244, 244, |
| 1997 | 244, 245, 245, 245, 245, 245, 245, 245, 245, 245, |
| 1998 | 246, 246, 247, 248, 248, 249, 249, 249, 249, 249, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 1999 | 250, 250, 251, 251, 252, 252, 253, 253, 253, 253, |
| 2000 | 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, |
| 2001 | 253, 254, 254, 255, 255, 255, 255, 255, 255, 255, |
| 2002 | 255, 255, 255, 255 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2003 | }; |
| 2004 | |
| 2005 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 2006 | static const yytype_uint8 yyr2[] = |
| 2007 | { |
| 2008 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2009 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2010 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2011 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2012 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2013 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2014 | 1, 1, 1, 1, 1, 0, 4, 0, 2, 0, |
| 2015 | 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2016 | 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, |
| 2017 | 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, |
| 2018 | 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, |
| 2019 | 1, 1, 1, 1, 1, 2, 0, 2, 1, 1, |
| 2020 | 1, 1, 1, 1, 0, 2, 0, 2, 0, 2, |
| 2021 | 0, 3, 2, 0, 1, 0, 3, 1, 2, 1, |
| 2022 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, |
| 2023 | 2, 5, 5, 5, 5, 3, 2, 5, 4, 2, |
| 2024 | 1, 1, 1, 3, 1, 3, 1, 0, 1, 3, |
| 2025 | 4, 3, 3, 4, 4, 3, 6, 5, 2, 2, |
| 2026 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 2027 | 6, 5, 8, 6, 6, 7, 7, 7, 7, 6, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2028 | 8, 8, 5, 7, 3, 1, 1, 1, 1, 0, |
| 2029 | 2, 6, 1, 0, 1, 2, 0, 3, 0, 3, |
| 2030 | 3, 3, 3, 0, 8, 0, 9, 0, 9, 5, |
| 2031 | 2, 3, 1, 3, 3, 3, 3, 1, 0, 5, |
| 2032 | 3, 1, 3, 1, 0, 10, 1, 1, 4, 1, |
| 2033 | 1, 2, 3, 0, 1, 1, 1, 1, 1, 1, |
| 2034 | 1, 1, 1, 3, 1, 5, 1, 1, 1, 1, |
| 2035 | 1, 1, 2, 1, 3, 2, 2, 3, 2, 0, |
| 2036 | 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, |
| 2037 | 6, 5, 2, 6, 7, 4, 4, 6, 6, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2038 | 0, 3, 2, 3, 2, 1, 5, 5, 6, 6, |
| 2039 | 6, 6, 4, 6, 4, 4, 6, 6, 2, 8, |
| 2040 | 1, 1, 0, 3, 6, 3, 6, 2, 5, 7, |
| 2041 | 5, 4, 4, 7 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2042 | }; |
| 2043 | |
| 2044 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 2045 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 2046 | means the default is an error. */ |
| 2047 | static const yytype_uint16 yydefact[] = |
| 2048 | { |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2049 | 73, 61, 70, 62, 71, 63, 218, 216, 0, 0, |
| 2050 | 0, 0, 0, 0, 84, 72, 0, 73, 214, 88, |
| 2051 | 91, 0, 0, 230, 0, 0, 68, 0, 74, 75, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2052 | 77, 76, 78, 81, 79, 82, 80, 83, 85, 86, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2053 | 87, 84, 84, 209, 1, 215, 89, 90, 84, 219, |
| 2054 | 92, 93, 94, 95, 84, 279, 217, 279, 0, 0, |
| 2055 | 238, 231, 232, 220, 266, 267, 222, 139, 140, 141, |
| 2056 | 144, 143, 142, 145, 146, 0, 0, 0, 0, 268, |
| 2057 | 269, 147, 221, 149, 209, 209, 96, 208, 0, 99, |
| 2058 | 99, 280, 276, 69, 249, 250, 251, 275, 233, 234, |
| 2059 | 237, 0, 167, 150, 0, 0, 0, 0, 156, 168, |
| 2060 | 0, 0, 167, 0, 0, 0, 98, 97, 0, 206, |
| 2061 | 207, 0, 0, 100, 101, 102, 103, 104, 0, 252, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2062 | 0, 322, 278, 0, 235, 166, 116, 162, 164, 0, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2063 | 0, 0, 0, 0, 0, 155, 0, 0, 148, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2064 | 0, 161, 0, 160, 0, 229, 139, 140, 141, 144, |
| 2065 | 143, 142, 0, 0, 67, 67, 105, 0, 246, 247, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2066 | 248, 321, 305, 0, 0, 0, 0, 99, 288, 289, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2067 | 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, |
| 2068 | 15, 16, 11, 12, 13, 0, 0, 0, 0, 0, |
| 2069 | 0, 0, 0, 17, 18, 19, 20, 21, 22, 23, |
| 2070 | 24, 25, 26, 27, 28, 0, 0, 0, 0, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2071 | 0, 0, 0, 0, 0, 0, 0, 277, 99, 292, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2072 | 0, 320, 236, 159, 0, 124, 67, 67, 158, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2073 | 169, 0, 124, 67, 67, 0, 210, 187, 188, 183, |
| 2074 | 185, 184, 186, 189, 182, 178, 179, 0, 0, 0, |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 2075 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2076 | 0, 0, 0, 0, 0, 181, 180, 223, 0, 304, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2077 | 282, 67, 273, 281, 0, 0, 55, 0, 0, 29, |
| 2078 | 30, 31, 32, 33, 34, 35, 36, 37, 38, 0, |
| 2079 | 53, 54, 49, 50, 51, 52, 39, 40, 41, 42, |
| 2080 | 43, 44, 45, 46, 47, 48, 0, 0, 0, 130, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2081 | 130, 327, 67, 67, 318, 0, 0, 0, 0, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2082 | 67, 67, 67, 67, 67, 0, 0, 0, 0, 0, |
| 2083 | 107, 109, 108, 106, 110, 111, 112, 113, 114, 117, |
| 2084 | 165, 163, 152, 153, 154, 157, 66, 151, 225, 227, |
| 2085 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2086 | 0, 0, 171, 205, 0, 0, 0, 175, 0, 172, |
| 2087 | 0, 0, 0, 135, 244, 255, 256, 257, 262, 258, |
| 2088 | 259, 260, 261, 253, 0, 264, 271, 270, 272, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2089 | 0, 283, 0, 0, 67, 67, 67, 67, 0, 323, |
| 2090 | 0, 325, 300, 0, 0, 0, 0, 0, 0, 0, |
| 2091 | 0, 0, 0, 0, 0, 0, 0, 67, 0, 115, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2092 | 121, 120, 118, 119, 122, 123, 125, 135, 135, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2093 | 0, 0, 0, 0, 300, 0, 0, 0, 0, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2094 | 0, 0, 170, 156, 168, 0, 173, 174, 0, 0, |
| 2095 | 0, 0, 224, 243, 116, 241, 0, 254, 0, 0, |
| 2096 | 274, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2097 | 0, 331, 0, 0, 0, 314, 315, 0, 0, 0, |
| 2098 | 0, 332, 0, 0, 0, 312, 0, 130, 0, 226, |
| 2099 | 228, 67, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2100 | 0, 0, 0, 204, 177, 0, 0, 0, 0, 0, |
| 2101 | 0, 137, 135, 65, 0, 124, 0, 263, 0, 0, |
| 2102 | 299, 0, 0, 0, 0, 130, 131, 130, 0, 0, |
| 2103 | 0, 0, 0, 0, 330, 302, 0, 67, 306, 307, |
| 2104 | 299, 0, 328, 67, 211, 0, 0, 0, 0, 191, |
| 2105 | 0, 0, 0, 0, 202, 0, 176, 0, 0, 67, |
| 2106 | 132, 138, 136, 64, 240, 242, 116, 133, 0, 0, |
| 2107 | 0, 116, 116, 0, 308, 309, 310, 311, 324, 326, |
| 2108 | 301, 0, 0, 313, 316, 317, 303, 0, 0, 130, |
| 2109 | 0, 0, 0, 0, 0, 199, 0, 0, 0, 193, |
| 2110 | 194, 190, 65, 134, 128, 265, 0, 0, 0, 0, |
| 2111 | 124, 0, 293, 0, 333, 124, 329, 195, 196, 197, |
| 2112 | 198, 0, 0, 0, 203, 239, 0, 126, 0, 286, |
| 2113 | 0, 0, 107, 109, 116, 116, 0, 116, 116, 294, |
| 2114 | 319, 192, 200, 201, 129, 0, 245, 284, 0, 285, |
| 2115 | 0, 296, 295, 0, 0, 0, 127, 0, 0, 0, |
| 2116 | 116, 116, 0, 0, 0, 298, 297, 291, 0, 0, |
| 2117 | 290, 0, 287 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2118 | }; |
| 2119 | |
| 2120 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 2121 | static const yytype_int16 yydefgoto[] = |
| 2122 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2123 | -1, 272, 273, 274, 299, 316, 162, 163, 79, 574, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2124 | 113, 12, 80, 14, 15, 41, 42, 43, 48, 54, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2125 | 118, 128, 349, 233, 436, 352, 656, 637, 409, 521, |
| 2126 | 614, 462, 522, 81, 164, 137, 154, 138, 139, 110, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2127 | 373, 395, 374, 121, 88, 155, 16, 17, 18, 20, |
| 2128 | 19, 383, 437, 438, 63, 23, 61, 101, 465, 466, |
| 2129 | 129, 170, 55, 96, 56, 49, 468, 396, 83, 398, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2130 | 282, 283, 57, 92, 93, 227, 641, 132, 324, 583, |
| 2131 | 481, 491, 228, 229, 230, 231 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2132 | }; |
| 2133 | |
| 2134 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2135 | STATE-NUM. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2136 | #define YYPACT_NINF -611 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2137 | static const yytype_int16 yypact[] = |
| 2138 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2139 | 645, -611, -611, -611, -611, -611, -611, -611, -11, -112, |
| 2140 | 3, -74, 83, -41, 26, -611, 111, 692, -611, -17, |
| 2141 | 199, -19, 54, -611, 21, 124, -611, 1670, -611, -611, |
| 2142 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2143 | -611, 17, 17, 72, -611, -611, -611, -611, 17, -611, |
| 2144 | -611, -611, -611, -611, 17, 137, -611, -5, 196, 204, |
| 2145 | 215, -611, -611, -611, -611, -611, 65, -611, -611, -611, |
| 2146 | -611, -611, -611, -611, -611, 262, 265, 2, 322, -611, |
| 2147 | -611, -611, -40, -611, 240, 240, 219, -611, 319, 193, |
| 2148 | 193, -611, -611, 257, -611, -611, -611, -611, -611, -611, |
| 2149 | -611, 52, 1252, -611, 120, 131, 671, 65, -611, -40, |
| 2150 | -101, 132, 1252, 139, 319, 319, -611, -611, 1359, -611, |
| 2151 | -611, 1711, 299, -611, -611, -611, -611, -611, 1772, -611, |
| 2152 | -16, 2051, -611, 287, -611, -611, -40, -611, 154, 160, |
| 2153 | 1831, 1831, 159, -77, 1831, -611, 316, 183, -611, 1711, |
| 2154 | 1831, 65, 175, -40, 278, -611, 248, 334, 338, 356, |
| 2155 | 357, 358, 244, 359, 1310, 314, -611, 36, -611, -611, |
| 2156 | -611, -611, -611, 313, 1872, 34, 360, 193, -611, -611, |
| 2157 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2158 | -611, -611, -611, -611, -611, 324, 522, 324, 522, 1831, |
| 2159 | 1831, 1831, 1831, -611, -611, -611, -611, -611, -611, -611, |
| 2160 | -611, -611, -611, -611, -611, 1831, 1831, 1831, 1831, 1831, |
| 2161 | 1831, 1831, 1831, 1831, 1831, 1831, 1831, -611, 193, -611, |
| 2162 | 236, -611, -611, 174, 1548, -611, -12, -23, -611, 208, |
| 2163 | -40, 218, -611, 314, -22, 1359, -611, -611, -611, -611, |
| 2164 | -611, -611, -611, -611, -611, -611, -611, 324, 522, 324, |
| 2165 | 522, 220, 221, 222, 224, 227, 229, 230, 1589, 1890, |
| 2166 | 931, 366, 241, 251, 252, -611, -611, -611, 253, -611, |
| 2167 | 65, 881, -611, 237, 1025, 1025, -611, 1025, 1772, -611, |
| 2168 | -611, -611, -611, -611, -611, -611, -611, -611, -611, 1831, |
| 2169 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2170 | -611, -611, -611, -611, -611, -611, 1831, 1831, 1831, -6, |
| 2171 | 8, -611, 881, -7, 239, 269, 272, 277, 279, 280, |
| 2172 | 881, 881, 881, 881, 881, 372, 1772, 1831, 1831, 433, |
| 2173 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2174 | -611, -611, -47, -611, -611, -611, -611, -47, -611, 139, |
| 2175 | 403, 286, 288, 289, 290, 1711, 1711, 1711, 1711, 1711, |
| 2176 | 1711, 1711, -611, -611, 58, 972, -54, -611, 46, -611, |
| 2177 | 1711, 1711, 1711, 291, 1611, -611, -611, -611, -611, -611, |
| 2178 | -611, -611, -611, 386, 1711, -611, -611, -611, -611, 1831, |
| 2179 | 292, -611, 293, 1025, 881, 881, 881, 881, 24, -611, |
| 2180 | 25, -611, -611, 1025, 294, 1831, 1831, 1831, 1831, 1831, |
| 2181 | 296, 303, 304, 305, 306, 1831, 1025, 881, 309, -611, |
| 2182 | -611, -611, -611, -611, -611, -611, -611, 291, 291, 1831, |
| 2183 | 1711, 1711, 1711, 1711, -611, 310, 311, 312, 315, 303, |
| 2184 | 320, 1711, -611, 307, 1159, 56, -611, -611, 321, 323, |
| 2185 | 415, 10, -611, -611, -40, 326, 331, -611, 459, -53, |
| 2186 | -611, 474, 477, 339, 337, 340, 341, 342, 1025, 493, |
| 2187 | 1025, 343, 344, 1025, 346, -40, -611, 347, 348, 504, |
| 2188 | 505, 351, 1831, 1025, 1025, -40, 355, 354, 1831, -611, |
| 2189 | -611, 45, 362, 363, 367, 368, -69, 1711, 1711, 1711, |
| 2190 | 1711, 121, 1711, -611, -611, 352, 1711, 1711, 1831, 492, |
| 2191 | 521, -611, 291, 123, 1652, -611, 369, -611, 1025, 1025, |
| 2192 | 1934, 1025, 1025, 1025, 1025, 354, -611, 354, 1831, 1025, |
| 2193 | 370, 1831, 1831, 1831, -611, -611, 531, 881, -611, -611, |
| 2194 | 1934, 482, -611, 881, -611, 1711, 1711, 1711, 1711, -611, |
| 2195 | 378, 381, 382, 387, -611, 303, -611, 393, 398, 53, |
| 2196 | -611, -611, -611, -611, -611, -611, -40, -14, 534, 399, |
| 2197 | 395, 6, -40, 125, -611, -611, -611, -611, -611, -611, |
| 2198 | -611, 396, 1025, -611, -611, -611, -611, 303, 167, 354, |
| 2199 | 402, 404, 405, 406, 1711, -611, 1711, 1711, 191, -611, |
| 2200 | -611, -611, 123, -611, 510, -611, 550, -4, 734, 734, |
| 2201 | -611, 1952, -611, 407, 351, -611, -611, -611, -611, -611, |
| 2202 | -611, 411, 412, 417, -611, -611, 568, 423, 1025, -611, |
| 2203 | 1455, -3, 420, 421, -611, -611, -20, 6, -40, -611, |
| 2204 | -47, -611, -611, -611, -611, 556, -611, -611, 422, -611, |
| 2205 | 1455, 174, 174, 563, 734, 734, -611, 566, 425, 1025, |
| 2206 | -611, -611, 1025, 569, 512, 174, 174, -611, 1025, 570, |
| 2207 | -611, 1025, -611 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2208 | }; |
| 2209 | |
| 2210 | /* YYPGOTO[NTERM-NUM]. */ |
| 2211 | static const yytype_int16 yypgoto[] = |
| 2212 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2213 | -611, 457, 458, 463, -176, -171, -174, -611, 0, -15, |
| 2214 | -146, 503, 11, -611, -611, -611, -611, 12, -611, -611, |
| 2215 | -611, -143, -611, -441, -611, -238, -611, -611, -310, 22, |
| 2216 | -611, -412, -611, -611, -26, 364, -123, -611, 488, 495, |
| 2217 | 35, -161, -256, 242, 276, 361, -611, -611, 585, -611, |
| 2218 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2219 | 513, -611, -611, -611, -611, -611, -611, -610, -99, 127, |
| 2220 | -179, -611, -611, 547, -611, -611, -611, -611, -611, 59, |
| 2221 | 164, -440, -611, -611, -611, -611 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2222 | }; |
| 2223 | |
| 2224 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2225 | positive, shift that token. If negative, reduce the rule which |
| 2226 | number is the opposite. If zero, do what YYDEFACT says. |
| 2227 | If YYTABLE_NINF, syntax error. */ |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2228 | #define YYTABLE_NINF -214 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2229 | static const yytype_int16 yytable[] = |
| 2230 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2231 | 11, 82, 287, 275, 357, 167, 105, 286, 286, 511, |
| 2232 | 411, 13, 168, 376, 378, 111, 91, 11, 663, 277, |
| 2233 | 519, 317, 321, 523, 94, 499, 500, 318, 13, 46, |
| 2234 | 658, 47, 111, 111, 288, 478, 480, 325, 326, 327, |
| 2235 | 328, 329, 21, 111, 519, 284, 24, 335, 111, 111, |
| 2236 | 668, 285, 109, 84, 85, 246, 2, 22, 144, 4, |
| 2237 | 89, -145, 25, 111, 520, 276, 90, 145, 29, 30, |
| 2238 | 31, 32, 33, 34, 35, 36, 136, 37, 479, 479, |
| 2239 | 109, 361, 144, 363, 26, 336, 136, 362, 559, 364, |
| 2240 | 538, 239, 153, 11, 430, 431, 432, 358, 359, 433, |
| 2241 | 111, 27, 153, 434, 435, 451, 451, 86, 111, 87, |
| 2242 | 572, 44, 456, 527, 236, 237, 112, 28, 240, 455, |
| 2243 | -67, 430, 431, 432, 244, 608, 433, 430, 431, 432, |
| 2244 | 434, 435, 433, 112, 112, 612, 434, 435, 469, 58, |
| 2245 | 618, 619, 1, 354, 112, 3, 62, 5, 281, 112, |
| 2246 | 112, 169, 353, 408, -67, 413, 165, 624, 91, 428, |
| 2247 | 639, 659, -145, 95, 112, 403, -145, 410, -67, 106, |
| 2248 | 38, 39, 40, 319, 320, 281, 322, 339, 278, 38, |
| 2249 | 39, 40, 397, 60, 243, 397, 397, 552, 397, 323, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2250 | 281, 281, 281, 281, 281, 330, 331, 332, 333, 334, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2251 | 281, 112, 554, 661, 662, 451, 664, 665, 136, 112, |
| 2252 | 611, 133, 59, 426, 457, 451, 134, 451, 98, 153, |
| 2253 | 470, 102, 452, 397, 515, 588, 99, 589, 339, 675, |
| 2254 | 676, 397, 397, 397, 397, 397, 484, 100, 486, 487, |
| 2255 | 488, 50, 51, 52, 340, 341, 53, 249, 250, 251, |
| 2256 | 252, -55, -55, -55, -55, 122, 123, 124, 125, 126, |
| 2257 | 127, 116, 153, 117, 342, 343, 103, 344, 345, 104, |
| 2258 | 346, 347, 348, 404, 247, 248, 1, 87, 564, 3, |
| 2259 | 546, 5, 620, 140, 621, 64, 65, 577, 146, 626, |
| 2260 | 405, 406, 407, 275, 141, 340, 341, 1, 2, 148, |
| 2261 | 3, 4, 5, 166, 397, 397, 397, 397, 397, 232, |
| 2262 | 153, 427, 281, 234, 397, 342, 343, 235, 344, 345, |
| 2263 | 241, 346, 347, 348, 625, 238, 621, 397, 397, 64, |
| 2264 | 65, 245, 107, 67, 68, 69, 70, 71, 72, 73, |
| 2265 | 242, 1, 2, -56, 3, 4, 5, -57, 634, 454, |
| 2266 | 546, 119, 120, 337, 338, 276, 149, 150, 464, 590, |
| 2267 | 114, 115, 593, 594, 595, -60, -59, -58, 253, 111, |
| 2268 | 279, 286, 74, 281, 355, 356, 365, 366, 367, 397, |
| 2269 | 368, 397, 646, 369, 397, 370, 371, 650, 379, 281, |
| 2270 | 485, 281, 281, 281, 397, 397, 399, 380, 414, 495, |
| 2271 | 444, 445, 446, 447, 448, 449, 450, 381, 382, 384, |
| 2272 | 425, 400, 401, 501, 402, 458, 459, 460, 289, 290, |
| 2273 | 291, 292, 293, 294, 295, 296, 297, 298, 415, 397, |
| 2274 | 397, 416, 397, 397, 397, 397, 417, 429, 418, 419, |
| 2275 | 397, 439, 440, 640, 441, 442, 443, 467, 397, 412, |
| 2276 | 461, 471, 472, 518, 397, 489, 483, 420, 421, 422, |
| 2277 | 423, 424, 490, 492, 493, 494, 547, 660, 498, 507, |
| 2278 | 508, 509, 553, 514, 510, 502, 503, 504, 505, 512, |
| 2279 | 516, 526, 517, 75, 76, 524, 513, 77, 525, 78, |
| 2280 | 108, 528, 569, 397, 529, 530, 531, 536, 576, 532, |
| 2281 | 533, 534, 538, 539, 582, 541, 542, 543, 544, 545, |
| 2282 | 546, 550, 281, 551, 570, 281, 281, 281, 566, 397, |
| 2283 | 397, 555, 556, 573, 582, 571, 557, 558, 578, 592, |
| 2284 | 473, 474, 475, 476, 477, 596, 479, 604, 605, 397, |
| 2285 | 482, 606, 560, 561, 562, 563, 607, 565, 300, 301, |
| 2286 | 609, 567, 568, 496, 497, 610, 615, 617, 616, 627, |
| 2287 | 622, 628, 629, 630, 636, 397, 397, 638, 651, 652, |
| 2288 | 397, 649, 654, 397, 653, 655, -18, -19, 666, 397, |
| 2289 | 669, 667, 397, 672, 673, 679, 678, 681, 224, 225, |
| 2290 | 600, 601, 602, 603, 226, 648, 131, 635, 351, 613, |
| 2291 | 147, 143, 45, 130, 97, 535, 360, 537, 506, 598, |
| 2292 | 540, 0, 573, 0, 0, 0, 0, 0, 0, 0, |
| 2293 | 548, 549, 302, 303, 304, 305, 306, 307, 308, 309, |
| 2294 | 310, 311, 312, 313, 314, 315, 0, 0, 0, 631, |
| 2295 | 0, 632, 633, 0, 0, -213, 0, 0, 0, 0, |
| 2296 | 0, 0, 0, 0, 0, 579, 580, 0, 584, 585, |
| 2297 | 586, 587, 0, -69, 1, 2, 591, 3, 4, 5, |
| 2298 | 0, 0, 0, 0, 597, 6, 7, 0, 64, 65, |
| 2299 | 599, 107, 67, 68, 69, 70, 71, 72, 73, 0, |
| 2300 | 1, 2, -212, 3, 4, 5, 0, 8, 0, 0, |
| 2301 | 0, 9, 0, 0, 0, 10, 0, 0, 0, 0, |
| 2302 | -69, 1, 2, 0, 3, 4, 5, 0, 0, 623, |
| 2303 | 0, 74, 6, 7, 0, 0, 0, 0, 0, 0, |
| 2304 | 0, 0, 0, 0, 0, 0, 0, 385, 386, 0, |
| 2305 | 0, 64, 65, 387, 8, 644, 645, 0, 9, 0, |
| 2306 | 0, 0, 10, 1, 2, 0, 3, 4, 5, 388, |
| 2307 | 389, 390, 0, 0, 0, 657, 0, 0, 0, 0, |
| 2308 | 0, 0, 0, 0, 391, 392, 0, 0, 0, 0, |
| 2309 | 0, 0, 0, 0, 0, 0, 0, 0, 339, 0, |
| 2310 | 0, 670, 671, 393, 0, 0, 674, 0, 0, 677, |
| 2311 | 0, 0, 0, 0, 0, 680, 0, 0, 682, 180, |
| 2312 | 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, |
| 2313 | 191, 192, 193, 194, 257, 258, 259, 260, 0, 0, |
| 2314 | 0, 0, 75, 76, 0, 0, 77, 0, 78, 142, |
| 2315 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2316 | 0, 0, 0, 261, 203, 642, 643, 206, 207, 208, |
| 2317 | 209, 210, 211, 212, 213, 214, 0, 262, 0, 263, |
| 2318 | 264, 265, 0, 266, 267, 342, 343, 0, 344, 345, |
| 2319 | 0, 346, 347, 348, 385, 386, 0, 0, 64, 65, |
| 2320 | 387, 0, 0, 0, 0, 0, 0, 0, 0, 394, |
| 2321 | 1, 2, 0, 3, 4, 5, 388, 389, 390, 0, |
| 2322 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2323 | 0, 391, 392, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2324 | 0, 0, 0, 0, 0, 0, 111, 0, 64, 65, |
| 2325 | 393, 107, 156, 157, 158, 159, 160, 161, 73, 0, |
| 2326 | 1, 2, 0, 3, 4, 5, 180, 181, 182, 183, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2327 | 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2328 | 194, 257, 258, 259, 260, 0, 0, 0, 0, 64, |
| 2329 | 65, 74, 107, 156, 157, 158, 159, 160, 161, 73, |
| 2330 | 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2331 | 261, 203, 204, 205, 206, 207, 208, 209, 210, 211, |
| 2332 | 212, 213, 214, 0, 262, 0, 263, 264, 265, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2333 | 266, 267, 74, 0, 0, 0, 0, 0, 385, 386, |
| 2334 | 0, 0, 64, 65, 387, 0, 0, 112, 0, 0, |
| 2335 | 0, 0, 0, 0, 1, 2, 394, 3, 4, 5, |
| 2336 | 388, 389, 390, 0, 0, 0, 0, 0, 0, 0, |
| 2337 | 0, 0, 0, 0, 0, 391, 392, 0, 0, 0, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2338 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2339 | 0, 0, 0, 0, 393, 0, 0, 0, 0, 0, |
| 2340 | 0, 0, 75, 76, 0, 0, 77, 0, 78, 377, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2341 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
| 2342 | 190, 191, 192, 193, 194, 257, 258, 259, 260, 0, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2343 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2344 | 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, |
| 2345 | 453, 0, 0, 0, 261, 203, 204, 205, 206, 207, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2346 | 208, 209, 210, 211, 212, 213, 214, 0, 262, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2347 | 263, 264, 265, 0, 266, 267, 64, 65, 0, 0, |
| 2348 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, |
| 2349 | 0, 3, 4, 5, 254, 0, 0, 0, 0, 0, |
| 2350 | 394, 0, 0, 0, 0, 0, 0, 0, 0, 255, |
| 2351 | 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2352 | 0, 0, 0, 0, 111, 0, 0, 0, 0, 0, |
| 2353 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2354 | 0, 0, 0, 0, 180, 181, 182, 183, 184, 185, |
| 2355 | 186, 187, 188, 189, 190, 191, 192, 193, 194, 257, |
| 2356 | 258, 259, 260, 0, 0, 0, 0, 0, 0, 64, |
| 2357 | 65, 0, 107, 67, 68, 69, 70, 71, 72, 73, |
| 2358 | 0, 1, 2, 0, 3, 4, 5, 0, 261, 203, |
| 2359 | 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, |
| 2360 | 214, 135, 262, 0, 263, 264, 265, 0, 266, 267, |
| 2361 | 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, |
| 2362 | 0, 0, 0, 0, 0, 112, 0, 64, 65, -67, |
| 2363 | 0, 268, 0, 0, 269, 0, 270, 0, 271, 1, |
| 2364 | 2, 0, 3, 4, 5, 254, 0, 0, 0, 0, |
| 2365 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2366 | 255, 256, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2367 | 0, 0, 0, 0, 0, 111, 64, 65, 0, 151, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2368 | 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2369 | 0, 3, 4, 5, 0, 180, 181, 182, 183, 184, |
| 2370 | 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, |
| 2371 | 257, 258, 259, 260, 0, 0, 0, 0, 0, 74, |
| 2372 | 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, |
| 2373 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 261, |
| 2374 | 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, |
| 2375 | 213, 214, 0, 262, 0, 263, 264, 265, 0, 266, |
| 2376 | 267, 0, 0, 0, 0, 0, 0, 0, 385, 386, |
| 2377 | 0, 0, 0, 0, 387, 0, 112, 0, 0, 0, |
| 2378 | 0, 0, 268, 0, 0, 269, 0, 270, 0, 271, |
| 2379 | 388, 389, 390, 0, 152, 0, 0, 0, 0, 0, |
| 2380 | 0, 0, 0, 0, 0, 391, 392, 0, 0, 0, |
| 2381 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2382 | 0, 0, 0, 0, 393, 0, 0, 0, 0, 0, |
| 2383 | 75, 76, 0, 0, 77, 0, 78, 0, 0, 0, |
| 2384 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
| 2385 | 190, 191, 192, 193, 194, 257, 258, 259, 260, 0, |
| 2386 | 0, 0, 0, 0, 0, 64, 65, 0, 107, 67, |
| 2387 | 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, |
| 2388 | 3, 4, 5, 0, 261, 203, 204, 205, 206, 207, |
| 2389 | 208, 209, 210, 211, 212, 213, 214, 350, 262, 0, |
| 2390 | 263, 264, 265, 0, 266, 267, 64, 65, 74, 107, |
| 2391 | 156, 157, 158, 159, 160, 161, 73, 0, 1, 2, |
| 2392 | 0, 3, 4, 5, 0, 0, 0, 0, 64, 65, |
| 2393 | 394, 107, 67, 68, 69, 70, 71, 72, 73, 0, |
| 2394 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 74, |
| 2395 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2396 | 463, 0, 0, 0, 0, 0, 0, 0, 0, 64, |
| 2397 | 65, 74, 107, 67, 68, 69, 70, 71, 72, 73, |
| 2398 | 0, 1, 2, 0, 3, 4, 5, 64, 65, 0, |
| 2399 | 66, 67, 68, 69, 70, 71, 72, 73, 0, 1, |
| 2400 | 2, 575, 3, 4, 5, 0, 0, 0, 0, 0, |
| 2401 | 0, 0, 74, 0, 0, 0, 0, 0, 0, 75, |
| 2402 | 76, 0, 0, 77, 0, 78, 0, 0, 64, 65, |
| 2403 | 74, 107, 156, 157, 158, 159, 160, 161, 73, 0, |
| 2404 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2405 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2406 | 75, 76, 0, 372, 77, 0, 78, 0, 0, 0, |
| 2407 | 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2408 | 0, 0, 75, 76, 0, 0, 77, 0, 78, 64, |
| 2409 | 65, 0, 151, 67, 68, 69, 70, 71, 72, 73, |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2410 | 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, |
| 2411 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2412 | 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2413 | 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2414 | 0, 75, 76, 0, 0, 77, 0, 78, 64, 65, |
| 2415 | 0, 107, 67, 68, 69, 70, 71, 72, 73, 0, |
| 2416 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2417 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2418 | 0, 0, 75, 76, 0, 0, 77, 0, 78, 64, |
| 2419 | 65, 74, 280, 67, 68, 69, 70, 71, 72, 73, |
| 2420 | 0, 1, 2, 0, 3, 4, 5, 64, 65, 0, |
| 2421 | 107, 156, 157, 158, 159, 160, 161, 73, 0, 1, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2422 | 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2423 | 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, |
| 2424 | 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, |
| 2425 | 74, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
| 2426 | 72, 581, 0, 1, 2, 0, 3, 4, 5, 64, |
| 2427 | 65, 0, 107, 67, 68, 69, 70, 71, 72, 647, |
| 2428 | 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, |
| 2429 | 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, |
| 2430 | 0, 0, 75, 76, 0, 0, 77, 0, 78, 0, |
| 2431 | 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2432 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2433 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2434 | 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2435 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2436 | 0, 75, 76, 0, 0, 77, 0, 375, 0, 0, |
| 2437 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2438 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2439 | 0, 0, 0, 0, 0, 0, 0, 171, 0, 0, |
| 2440 | 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, |
| 2441 | 0, 78, 0, 0, 0, 0, 0, 0, 172, 173, |
| 2442 | 0, 0, 0, 75, 76, 0, 0, 77, 0, 78, |
| 2443 | 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, |
| 2444 | 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, |
| 2445 | 194, 195, 196, 197, 198, 0, 0, 0, 0, 0, |
| 2446 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2447 | 0, 0, 0, 0, 0, 199, 200, 201, 0, 0, |
| 2448 | 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, |
| 2449 | 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, |
| 2450 | 222, 223 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2451 | }; |
| 2452 | |
| 2453 | static const yytype_int16 yycheck[] = |
| 2454 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2455 | 0, 27, 176, 164, 242, 128, 4, 11, 11, 449, |
| 2456 | 320, 0, 28, 269, 270, 55, 21, 17, 38, 165, |
| 2457 | 34, 197, 201, 464, 29, 437, 438, 198, 17, 46, |
| 2458 | 640, 48, 55, 55, 177, 11, 11, 216, 217, 218, |
| 2459 | 219, 220, 53, 55, 34, 11, 158, 226, 55, 55, |
| 2460 | 660, 17, 78, 41, 42, 154, 20, 68, 159, 23, |
| 2461 | 48, 55, 59, 55, 54, 164, 54, 168, 42, 43, |
| 2462 | 44, 45, 46, 47, 48, 49, 102, 51, 54, 54, |
| 2463 | 106, 257, 159, 259, 158, 228, 112, 258, 157, 260, |
| 2464 | 159, 168, 118, 93, 141, 142, 143, 243, 244, 146, |
| 2465 | 55, 18, 128, 150, 151, 159, 159, 35, 55, 37, |
| 2466 | 522, 0, 166, 166, 140, 141, 156, 158, 144, 375, |
| 2467 | 160, 141, 142, 143, 150, 565, 146, 141, 142, 143, |
| 2468 | 150, 151, 146, 156, 156, 576, 150, 151, 394, 158, |
| 2469 | 581, 582, 19, 166, 156, 22, 22, 24, 174, 156, |
| 2470 | 156, 167, 164, 159, 160, 162, 121, 597, 21, 338, |
| 2471 | 164, 164, 156, 168, 156, 288, 160, 159, 160, 167, |
| 2472 | 153, 154, 155, 199, 200, 201, 202, 54, 167, 153, |
| 2473 | 154, 155, 281, 162, 149, 284, 285, 497, 287, 215, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2474 | 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2475 | 226, 156, 157, 644, 645, 159, 647, 648, 234, 156, |
| 2476 | 157, 159, 158, 336, 168, 159, 164, 159, 22, 245, |
| 2477 | 399, 156, 164, 322, 168, 535, 22, 537, 54, 670, |
| 2478 | 671, 330, 331, 332, 333, 334, 415, 22, 417, 418, |
| 2479 | 419, 42, 43, 44, 121, 122, 47, 3, 4, 5, |
| 2480 | 6, 3, 4, 5, 6, 62, 63, 64, 65, 66, |
| 2481 | 67, 42, 288, 44, 141, 142, 4, 144, 145, 4, |
| 2482 | 147, 148, 149, 299, 26, 27, 19, 37, 157, 22, |
| 2483 | 159, 24, 157, 163, 159, 7, 8, 525, 156, 599, |
| 2484 | 316, 317, 318, 454, 163, 121, 122, 19, 20, 160, |
| 2485 | 22, 23, 24, 4, 403, 404, 405, 406, 407, 22, |
| 2486 | 336, 337, 338, 159, 413, 141, 142, 157, 144, 145, |
| 2487 | 4, 147, 148, 149, 157, 166, 159, 426, 427, 7, |
| 2488 | 8, 156, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2489 | 157, 19, 20, 9, 22, 23, 24, 9, 157, 375, |
| 2490 | 159, 32, 33, 117, 118, 454, 114, 115, 384, 538, |
| 2491 | 84, 85, 541, 542, 543, 9, 9, 9, 9, 55, |
| 2492 | 57, 11, 50, 399, 166, 157, 156, 156, 156, 478, |
| 2493 | 156, 480, 620, 156, 483, 156, 156, 625, 22, 415, |
| 2494 | 416, 417, 418, 419, 493, 494, 159, 156, 159, 425, |
| 2495 | 365, 366, 367, 368, 369, 370, 371, 156, 156, 156, |
| 2496 | 38, 284, 285, 439, 287, 380, 381, 382, 94, 95, |
| 2497 | 96, 97, 98, 99, 100, 101, 102, 103, 159, 528, |
| 2498 | 529, 159, 531, 532, 533, 534, 159, 4, 159, 159, |
| 2499 | 539, 38, 156, 617, 156, 156, 156, 61, 547, 322, |
| 2500 | 159, 159, 159, 38, 553, 159, 162, 330, 331, 332, |
| 2501 | 333, 334, 159, 159, 159, 159, 492, 641, 159, 159, |
| 2502 | 159, 159, 498, 166, 159, 440, 441, 442, 443, 159, |
| 2503 | 159, 22, 159, 161, 162, 159, 451, 165, 157, 167, |
| 2504 | 168, 17, 518, 592, 17, 156, 159, 4, 524, 159, |
| 2505 | 159, 159, 159, 159, 530, 159, 159, 159, 4, 4, |
| 2506 | 159, 156, 538, 159, 22, 541, 542, 543, 166, 618, |
| 2507 | 619, 159, 159, 523, 550, 4, 159, 159, 159, 159, |
| 2508 | 403, 404, 405, 406, 407, 4, 54, 159, 157, 638, |
| 2509 | 413, 159, 507, 508, 509, 510, 159, 512, 26, 27, |
| 2510 | 157, 516, 517, 426, 427, 157, 22, 162, 159, 157, |
| 2511 | 164, 157, 157, 157, 54, 664, 665, 17, 157, 157, |
| 2512 | 669, 164, 4, 672, 157, 152, 156, 156, 22, 678, |
| 2513 | 17, 159, 681, 17, 159, 73, 17, 17, 131, 131, |
| 2514 | 555, 556, 557, 558, 131, 621, 93, 612, 234, 577, |
| 2515 | 112, 106, 17, 90, 57, 478, 245, 480, 444, 550, |
| 2516 | 483, -1, 612, -1, -1, -1, -1, -1, -1, -1, |
| 2517 | 493, 494, 100, 101, 102, 103, 104, 105, 106, 107, |
| 2518 | 108, 109, 110, 111, 112, 113, -1, -1, -1, 604, |
| 2519 | -1, 606, 607, -1, -1, 0, -1, -1, -1, -1, |
| 2520 | -1, -1, -1, -1, -1, 528, 529, -1, 531, 532, |
| 2521 | 533, 534, -1, 18, 19, 20, 539, 22, 23, 24, |
| 2522 | -1, -1, -1, -1, 547, 30, 31, -1, 7, 8, |
| 2523 | 553, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2524 | 19, 20, 0, 22, 23, 24, -1, 52, -1, -1, |
| 2525 | -1, 56, -1, -1, -1, 60, -1, -1, -1, -1, |
| 2526 | 18, 19, 20, -1, 22, 23, 24, -1, -1, 592, |
| 2527 | -1, 50, 30, 31, -1, -1, -1, -1, -1, -1, |
| 2528 | -1, -1, -1, -1, -1, -1, -1, 3, 4, -1, |
| 2529 | -1, 7, 8, 9, 52, 618, 619, -1, 56, -1, |
| 2530 | -1, -1, 60, 19, 20, -1, 22, 23, 24, 25, |
| 2531 | 26, 27, -1, -1, -1, 638, -1, -1, -1, -1, |
| 2532 | -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, |
| 2533 | -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, |
| 2534 | -1, 664, 665, 59, -1, -1, 669, -1, -1, 672, |
| 2535 | -1, -1, -1, -1, -1, 678, -1, -1, 681, 75, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2536 | 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, |
| 2537 | 86, 87, 88, 89, 90, 91, 92, 93, -1, -1, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2538 | -1, -1, 161, 162, -1, -1, 165, -1, 167, 168, |
| 2539 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2540 | -1, -1, -1, 119, 120, 121, 122, 123, 124, 125, |
| 2541 | 126, 127, 128, 129, 130, 131, -1, 133, -1, 135, |
| 2542 | 136, 137, -1, 139, 140, 141, 142, -1, 144, 145, |
| 2543 | -1, 147, 148, 149, 3, 4, -1, -1, 7, 8, |
| 2544 | 9, -1, -1, -1, -1, -1, -1, -1, -1, 165, |
| 2545 | 19, 20, -1, 22, 23, 24, 25, 26, 27, -1, |
| 2546 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2547 | -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, |
| 2548 | -1, -1, -1, -1, -1, -1, 55, -1, 7, 8, |
| 2549 | 59, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2550 | 19, 20, -1, 22, 23, 24, 75, 76, 77, 78, |
| 2551 | 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, |
| 2552 | 89, 90, 91, 92, 93, -1, -1, -1, -1, 7, |
| 2553 | 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2554 | -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, |
| 2555 | 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, |
| 2556 | 129, 130, 131, -1, 133, -1, 135, 136, 137, -1, |
| 2557 | 139, 140, 50, -1, -1, -1, -1, -1, 3, 4, |
| 2558 | -1, -1, 7, 8, 9, -1, -1, 156, -1, -1, |
| 2559 | -1, -1, -1, -1, 19, 20, 165, 22, 23, 24, |
| 2560 | 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, |
| 2561 | -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, |
| 2562 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2563 | -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, |
| 2564 | -1, -1, 161, 162, -1, -1, 165, -1, 167, 168, |
| 2565 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 2566 | 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, |
| 2567 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2568 | -1, -1, -1, 161, 162, -1, -1, 165, -1, 167, |
| 2569 | 168, -1, -1, -1, 119, 120, 121, 122, 123, 124, |
| 2570 | 125, 126, 127, 128, 129, 130, 131, -1, 133, -1, |
| 2571 | 135, 136, 137, -1, 139, 140, 7, 8, -1, -1, |
| 2572 | -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, |
| 2573 | -1, 22, 23, 24, 25, -1, -1, -1, -1, -1, |
| 2574 | 165, -1, -1, -1, -1, -1, -1, -1, -1, 40, |
| 2575 | 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2576 | -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, |
| 2577 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2578 | -1, -1, -1, -1, 75, 76, 77, 78, 79, 80, |
| 2579 | 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
| 2580 | 91, 92, 93, -1, -1, -1, -1, -1, -1, 7, |
| 2581 | 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2582 | -1, 19, 20, -1, 22, 23, 24, -1, 119, 120, |
| 2583 | 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, |
| 2584 | 131, 39, 133, -1, 135, 136, 137, -1, 139, 140, |
| 2585 | -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, |
| 2586 | -1, -1, -1, -1, -1, 156, -1, 7, 8, 160, |
| 2587 | -1, 162, -1, -1, 165, -1, 167, -1, 169, 19, |
| 2588 | 20, -1, 22, 23, 24, 25, -1, -1, -1, -1, |
| 2589 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2590 | 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2591 | -1, -1, -1, -1, -1, 55, 7, 8, -1, 10, |
| 2592 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
| 2593 | -1, 22, 23, 24, -1, 75, 76, 77, 78, 79, |
| 2594 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2595 | 90, 91, 92, 93, -1, -1, -1, -1, -1, 50, |
| 2596 | -1, -1, -1, 161, 162, -1, -1, 165, -1, 167, |
| 2597 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, |
| 2598 | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, |
| 2599 | 130, 131, -1, 133, -1, 135, 136, 137, -1, 139, |
| 2600 | 140, -1, -1, -1, -1, -1, -1, -1, 3, 4, |
| 2601 | -1, -1, -1, -1, 9, -1, 156, -1, -1, -1, |
| 2602 | -1, -1, 162, -1, -1, 165, -1, 167, -1, 169, |
| 2603 | 25, 26, 27, -1, 125, -1, -1, -1, -1, -1, |
| 2604 | -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, |
| 2605 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2606 | -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, |
| 2607 | 161, 162, -1, -1, 165, -1, 167, -1, -1, -1, |
| 2608 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 2609 | 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, |
| 2610 | -1, -1, -1, -1, -1, 7, 8, -1, 10, 11, |
| 2611 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2612 | 22, 23, 24, -1, 119, 120, 121, 122, 123, 124, |
| 2613 | 125, 126, 127, 128, 129, 130, 131, 39, 133, -1, |
| 2614 | 135, 136, 137, -1, 139, 140, 7, 8, 50, 10, |
| 2615 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
| 2616 | -1, 22, 23, 24, -1, -1, -1, -1, 7, 8, |
| 2617 | 165, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2618 | 19, 20, -1, 22, 23, 24, -1, -1, -1, 50, |
| 2619 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2620 | 39, -1, -1, -1, -1, -1, -1, -1, -1, 7, |
| 2621 | 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2622 | -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, |
| 2623 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2624 | 20, 39, 22, 23, 24, -1, -1, -1, -1, -1, |
| 2625 | -1, -1, 50, -1, -1, -1, -1, -1, -1, 161, |
| 2626 | 162, -1, -1, 165, -1, 167, -1, -1, 7, 8, |
| 2627 | 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2628 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
| 2629 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2630 | 161, 162, -1, 164, 165, -1, 167, -1, -1, -1, |
| 2631 | -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2632 | -1, -1, 161, 162, -1, -1, 165, -1, 167, 7, |
| 2633 | 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2634 | -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, |
| 2635 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2636 | -1, -1, -1, 161, 162, -1, -1, 165, -1, 167, |
| 2637 | -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, |
| 2638 | -1, 161, 162, -1, -1, 165, -1, 167, 7, 8, |
| 2639 | -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2640 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
| 2641 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2642 | -1, -1, 161, 162, -1, -1, 165, -1, 167, 7, |
| 2643 | 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2644 | -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, |
| 2645 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2646 | 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, |
| 2647 | -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, |
| 2648 | -1, -1, -1, 161, 162, -1, -1, 165, -1, 167, |
| 2649 | 50, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2650 | 16, 17, -1, 19, 20, -1, 22, 23, 24, 7, |
| 2651 | 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2652 | -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, |
| 2653 | -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, |
| 2654 | -1, -1, 161, 162, -1, -1, 165, -1, 167, -1, |
| 2655 | -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, |
| 2656 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2657 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2658 | -1, -1, -1, 161, 162, -1, -1, 165, -1, 167, |
| 2659 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2660 | -1, 161, 162, -1, -1, 165, -1, 167, -1, -1, |
| 2661 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2662 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2663 | -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, |
| 2664 | -1, -1, -1, -1, -1, 161, 162, -1, -1, 165, |
| 2665 | -1, 167, -1, -1, -1, -1, -1, -1, 57, 58, |
| 2666 | -1, -1, -1, 161, 162, -1, -1, 165, -1, 167, |
| 2667 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2668 | 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, |
| 2669 | 89, 90, 91, 92, 93, -1, -1, -1, -1, -1, |
| 2670 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2671 | -1, -1, -1, -1, -1, 114, 115, 116, -1, -1, |
| 2672 | 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, |
| 2673 | 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, |
| 2674 | 139, 140 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2675 | }; |
| 2676 | |
| 2677 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2678 | symbol of state STATE-NUM. */ |
| 2679 | static const yytype_uint8 yystos[] = |
| 2680 | { |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2681 | 0, 19, 20, 22, 23, 24, 30, 31, 52, 56, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2682 | 60, 178, 181, 182, 183, 184, 216, 217, 218, 220, |
| 2683 | 219, 53, 68, 225, 158, 59, 158, 18, 158, 42, |
| 2684 | 43, 44, 45, 46, 47, 48, 49, 51, 153, 154, |
| 2685 | 155, 185, 186, 187, 0, 218, 46, 48, 188, 235, |
| 2686 | 42, 43, 44, 47, 189, 232, 234, 242, 158, 158, |
| 2687 | 162, 226, 22, 224, 7, 8, 10, 11, 12, 13, |
| 2688 | 14, 15, 16, 17, 50, 161, 162, 165, 167, 178, |
| 2689 | 182, 203, 204, 238, 187, 187, 35, 37, 214, 187, |
| 2690 | 187, 21, 243, 244, 29, 168, 233, 243, 22, 22, |
| 2691 | 22, 227, 156, 4, 4, 4, 167, 10, 168, 204, |
| 2692 | 209, 55, 156, 180, 214, 214, 42, 44, 190, 32, |
| 2693 | 33, 213, 62, 63, 64, 65, 66, 67, 191, 230, |
| 2694 | 230, 181, 247, 159, 164, 39, 204, 205, 207, 208, |
| 2695 | 163, 163, 168, 209, 159, 168, 156, 208, 160, 213, |
| 2696 | 213, 10, 125, 204, 206, 215, 11, 12, 13, 14, |
| 2697 | 15, 16, 176, 177, 204, 210, 4, 206, 28, 167, |
| 2698 | 231, 36, 57, 58, 69, 70, 71, 72, 73, 74, |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2699 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2700 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 114, |
| 2701 | 115, 116, 119, 120, 121, 122, 123, 124, 125, 126, |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 2702 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2703 | 137, 138, 139, 140, 171, 172, 173, 245, 252, 253, |
| 2704 | 254, 255, 22, 193, 159, 157, 204, 204, 166, 168, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2705 | 204, 4, 157, 210, 204, 156, 238, 26, 27, 3, |
| 2706 | 4, 5, 6, 9, 25, 40, 41, 90, 91, 92, |
| 2707 | 93, 119, 133, 135, 136, 137, 139, 140, 162, 165, |
| 2708 | 167, 169, 171, 172, 173, 211, 238, 180, 182, 57, |
| 2709 | 10, 204, 240, 241, 11, 17, 11, 176, 191, 94, |
| 2710 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 174, |
| 2711 | 26, 27, 100, 101, 102, 103, 104, 105, 106, 107, |
| 2712 | 108, 109, 110, 111, 112, 113, 175, 174, 175, 204, |
| 2713 | 204, 240, 204, 204, 248, 240, 240, 240, 240, 240, |
| 2714 | 204, 204, 204, 204, 204, 240, 191, 117, 118, 54, |
| 2715 | 121, 122, 141, 142, 144, 145, 147, 148, 149, 192, |
| 2716 | 39, 205, 195, 164, 166, 166, 157, 195, 180, 180, |
| 2717 | 215, 174, 175, 174, 175, 156, 156, 156, 156, 156, |
| 2718 | 156, 156, 164, 210, 212, 167, 212, 168, 212, 22, |
| 2719 | 156, 156, 156, 221, 156, 3, 4, 9, 25, 26, |
| 2720 | 27, 40, 41, 59, 165, 211, 237, 238, 239, 159, |
| 2721 | 239, 239, 239, 206, 204, 204, 204, 204, 159, 198, |
| 2722 | 159, 198, 239, 162, 159, 159, 159, 159, 159, 159, |
| 2723 | 239, 239, 239, 239, 239, 38, 206, 204, 240, 4, |
| 2724 | 141, 142, 143, 146, 150, 151, 194, 222, 223, 38, |
| 2725 | 156, 156, 156, 156, 210, 210, 210, 210, 210, 210, |
| 2726 | 210, 159, 164, 168, 204, 212, 166, 168, 210, 210, |
| 2727 | 210, 159, 201, 39, 204, 228, 229, 61, 236, 212, |
| 2728 | 240, 159, 159, 239, 239, 239, 239, 239, 11, 54, |
| 2729 | 11, 250, 239, 162, 240, 204, 240, 240, 240, 159, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 2730 | 159, 251, 159, 159, 159, 204, 239, 239, 159, 201, |
| 2731 | 201, 204, 210, 210, 210, 210, 250, 159, 159, 159, |
| 2732 | 159, 251, 159, 210, 166, 168, 159, 159, 38, 34, |
| 2733 | 54, 199, 202, 193, 159, 157, 22, 166, 17, 17, |
| 2734 | 156, 159, 159, 159, 159, 239, 4, 239, 159, 159, |
| 2735 | 239, 159, 159, 159, 4, 4, 159, 204, 239, 239, |
| 2736 | 156, 159, 198, 204, 157, 159, 159, 159, 159, 157, |
| 2737 | 210, 210, 210, 210, 157, 210, 166, 210, 210, 204, |
| 2738 | 22, 4, 201, 178, 179, 39, 204, 195, 159, 239, |
| 2739 | 239, 17, 204, 249, 239, 239, 239, 239, 198, 198, |
| 2740 | 240, 239, 159, 240, 240, 240, 4, 239, 249, 239, |
| 2741 | 210, 210, 210, 210, 159, 157, 159, 159, 251, 157, |
| 2742 | 157, 157, 193, 199, 200, 22, 159, 162, 193, 193, |
| 2743 | 157, 159, 164, 239, 251, 157, 198, 157, 157, 157, |
| 2744 | 157, 210, 210, 210, 157, 179, 54, 197, 17, 164, |
| 2745 | 176, 246, 121, 122, 239, 239, 195, 17, 204, 164, |
| 2746 | 195, 157, 157, 157, 4, 152, 196, 239, 237, 164, |
| 2747 | 176, 193, 193, 38, 193, 193, 22, 159, 237, 17, |
| 2748 | 239, 239, 17, 159, 239, 193, 193, 239, 17, 73, |
| 2749 | 239, 17, 239 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2750 | }; |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2751 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2752 | #define yyerrok (yyerrstatus = 0) |
| 2753 | #define yyclearin (yychar = YYEMPTY) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2754 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2755 | #define YYEOF 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2756 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2757 | #define YYACCEPT goto yyacceptlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2758 | #define YYABORT goto yyabortlab |
| 2759 | #define YYERROR goto yyerrorlab |
| 2760 | |
| 2761 | |
| 2762 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2763 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2764 | Once GCC version 2 has supplanted version 1, this can go. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2765 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2766 | #define YYFAIL goto yyerrlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2767 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2768 | #define YYRECOVERING() (!!yyerrstatus) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2769 | |
| 2770 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2771 | do \ |
| 2772 | if (yychar == YYEMPTY && yylen == 1) \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2773 | { \ |
| 2774 | yychar = (Token); \ |
| 2775 | yylval = (Value); \ |
| 2776 | yytoken = YYTRANSLATE (yychar); \ |
| 2777 | YYPOPSTACK (1); \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2778 | goto yybackup; \ |
| 2779 | } \ |
| 2780 | else \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2781 | { \ |
| 2782 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2783 | YYERROR; \ |
| 2784 | } \ |
| 2785 | while (YYID (0)) |
| 2786 | |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2787 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2788 | #define YYTERROR 1 |
| 2789 | #define YYERRCODE 256 |
| 2790 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2791 | |
| 2792 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2793 | If N is 0, then set CURRENT to the empty location which ends |
| 2794 | the previous symbol: RHS[0] (always defined). */ |
| 2795 | |
| 2796 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2797 | #ifndef YYLLOC_DEFAULT |
| 2798 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2799 | do \ |
| 2800 | if (YYID (N)) \ |
| 2801 | { \ |
| 2802 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2803 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2804 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2805 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2806 | } \ |
| 2807 | else \ |
| 2808 | { \ |
| 2809 | (Current).first_line = (Current).last_line = \ |
| 2810 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2811 | (Current).first_column = (Current).last_column = \ |
| 2812 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2813 | } \ |
| 2814 | while (YYID (0)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2815 | #endif |
| 2816 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2817 | |
| 2818 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2819 | This macro was not mandated originally: define only if we know |
| 2820 | we won't break user code: when these are the locations we know. */ |
| 2821 | |
| 2822 | #ifndef YY_LOCATION_PRINT |
| 2823 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
| 2824 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2825 | fprintf (File, "%d.%d-%d.%d", \ |
| 2826 | (Loc).first_line, (Loc).first_column, \ |
| 2827 | (Loc).last_line, (Loc).last_column) |
| 2828 | # else |
| 2829 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2830 | # endif |
| 2831 | #endif |
| 2832 | |
| 2833 | |
| 2834 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2835 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2836 | #ifdef YYLEX_PARAM |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2837 | # define YYLEX yylex (YYLEX_PARAM) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2838 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2839 | # define YYLEX yylex () |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2840 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2841 | |
| 2842 | /* Enable debugging if requested. */ |
| 2843 | #if YYDEBUG |
| 2844 | |
| 2845 | # ifndef YYFPRINTF |
| 2846 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2847 | # define YYFPRINTF fprintf |
| 2848 | # endif |
| 2849 | |
| 2850 | # define YYDPRINTF(Args) \ |
| 2851 | do { \ |
| 2852 | if (yydebug) \ |
| 2853 | YYFPRINTF Args; \ |
| 2854 | } while (YYID (0)) |
| 2855 | |
| 2856 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2857 | do { \ |
| 2858 | if (yydebug) \ |
| 2859 | { \ |
| 2860 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2861 | yy_symbol_print (stderr, \ |
| 2862 | Type, Value); \ |
| 2863 | YYFPRINTF (stderr, "\n"); \ |
| 2864 | } \ |
| 2865 | } while (YYID (0)) |
| 2866 | |
| 2867 | |
| 2868 | /*--------------------------------. |
| 2869 | | Print this symbol on YYOUTPUT. | |
| 2870 | `--------------------------------*/ |
| 2871 | |
| 2872 | /*ARGSUSED*/ |
| 2873 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2874 | || defined __cplusplus || defined _MSC_VER) |
| 2875 | static void |
| 2876 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2877 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2878 | static void |
| 2879 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 2880 | FILE *yyoutput; |
| 2881 | int yytype; |
| 2882 | YYSTYPE const * const yyvaluep; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2883 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2884 | { |
| 2885 | if (!yyvaluep) |
| 2886 | return; |
| 2887 | # ifdef YYPRINT |
| 2888 | if (yytype < YYNTOKENS) |
| 2889 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2890 | # else |
| 2891 | YYUSE (yyoutput); |
| 2892 | # endif |
| 2893 | switch (yytype) |
| 2894 | { |
| 2895 | default: |
| 2896 | break; |
| 2897 | } |
| 2898 | } |
| 2899 | |
| 2900 | |
| 2901 | /*--------------------------------. |
| 2902 | | Print this symbol on YYOUTPUT. | |
| 2903 | `--------------------------------*/ |
| 2904 | |
| 2905 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2906 | || defined __cplusplus || defined _MSC_VER) |
| 2907 | static void |
| 2908 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 2909 | #else |
| 2910 | static void |
| 2911 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 2912 | FILE *yyoutput; |
| 2913 | int yytype; |
| 2914 | YYSTYPE const * const yyvaluep; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2915 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2916 | { |
| 2917 | if (yytype < YYNTOKENS) |
| 2918 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2919 | else |
| 2920 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2921 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2922 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 2923 | YYFPRINTF (yyoutput, ")"); |
| 2924 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2925 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2926 | /*------------------------------------------------------------------. |
| 2927 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2928 | | TOP (included). | |
| 2929 | `------------------------------------------------------------------*/ |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2930 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2931 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2932 | || defined __cplusplus || defined _MSC_VER) |
| 2933 | static void |
| 2934 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
| 2935 | #else |
| 2936 | static void |
| 2937 | yy_stack_print (bottom, top) |
| 2938 | yytype_int16 *bottom; |
| 2939 | yytype_int16 *top; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2940 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2941 | { |
| 2942 | YYFPRINTF (stderr, "Stack now"); |
| 2943 | for (; bottom <= top; ++bottom) |
| 2944 | YYFPRINTF (stderr, " %d", *bottom); |
| 2945 | YYFPRINTF (stderr, "\n"); |
| 2946 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2947 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2948 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2949 | do { \ |
| 2950 | if (yydebug) \ |
| 2951 | yy_stack_print ((Bottom), (Top)); \ |
| 2952 | } while (YYID (0)) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2953 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2954 | |
| 2955 | /*------------------------------------------------. |
| 2956 | | Report that the YYRULE is going to be reduced. | |
| 2957 | `------------------------------------------------*/ |
| 2958 | |
| 2959 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2960 | || defined __cplusplus || defined _MSC_VER) |
| 2961 | static void |
| 2962 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 2963 | #else |
| 2964 | static void |
| 2965 | yy_reduce_print (yyvsp, yyrule) |
| 2966 | YYSTYPE *yyvsp; |
| 2967 | int yyrule; |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 2968 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2969 | { |
| 2970 | int yynrhs = yyr2[yyrule]; |
| 2971 | int yyi; |
| 2972 | unsigned long int yylno = yyrline[yyrule]; |
| 2973 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 2974 | yyrule - 1, yylno); |
| 2975 | /* The symbols being reduced. */ |
| 2976 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 2977 | { |
| 2978 | fprintf (stderr, " $%d = ", yyi + 1); |
| 2979 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 2980 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 2981 | ); |
| 2982 | fprintf (stderr, "\n"); |
| 2983 | } |
| 2984 | } |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2985 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2986 | # define YY_REDUCE_PRINT(Rule) \ |
| 2987 | do { \ |
| 2988 | if (yydebug) \ |
| 2989 | yy_reduce_print (yyvsp, Rule); \ |
| 2990 | } while (YYID (0)) |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2991 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2992 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2993 | multiple parsers can coexist. */ |
| 2994 | int yydebug; |
| 2995 | #else /* !YYDEBUG */ |
| 2996 | # define YYDPRINTF(Args) |
| 2997 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2998 | # define YY_STACK_PRINT(Bottom, Top) |
| 2999 | # define YY_REDUCE_PRINT(Rule) |
| 3000 | #endif /* !YYDEBUG */ |
| 3001 | |
| 3002 | |
| 3003 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3004 | #ifndef YYINITDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3005 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3006 | #endif |
| 3007 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3008 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 3009 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3010 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3011 | Do not make this value too large; the results are undefined if |
| 3012 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 3013 | evaluated with infinite-precision integer arithmetic. */ |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 3014 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3015 | #ifndef YYMAXDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3016 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3017 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3018 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3019 | |
| 3020 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3021 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3022 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3023 | # ifndef yystrlen |
| 3024 | # if defined __GLIBC__ && defined _STRING_H |
| 3025 | # define yystrlen strlen |
| 3026 | # else |
| 3027 | /* Return the length of YYSTR. */ |
| 3028 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3029 | || defined __cplusplus || defined _MSC_VER) |
| 3030 | static YYSIZE_T |
| 3031 | yystrlen (const char *yystr) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3032 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3033 | static YYSIZE_T |
| 3034 | yystrlen (yystr) |
| 3035 | const char *yystr; |
| 3036 | #endif |
| 3037 | { |
| 3038 | YYSIZE_T yylen; |
| 3039 | for (yylen = 0; yystr[yylen]; yylen++) |
| 3040 | continue; |
| 3041 | return yylen; |
| 3042 | } |
| 3043 | # endif |
| 3044 | # endif |
| 3045 | |
| 3046 | # ifndef yystpcpy |
| 3047 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 3048 | # define yystpcpy stpcpy |
| 3049 | # else |
| 3050 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 3051 | YYDEST. */ |
| 3052 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3053 | || defined __cplusplus || defined _MSC_VER) |
| 3054 | static char * |
| 3055 | yystpcpy (char *yydest, const char *yysrc) |
| 3056 | #else |
| 3057 | static char * |
| 3058 | yystpcpy (yydest, yysrc) |
| 3059 | char *yydest; |
| 3060 | const char *yysrc; |
| 3061 | #endif |
| 3062 | { |
| 3063 | char *yyd = yydest; |
| 3064 | const char *yys = yysrc; |
| 3065 | |
| 3066 | while ((*yyd++ = *yys++) != '\0') |
| 3067 | continue; |
| 3068 | |
| 3069 | return yyd - 1; |
| 3070 | } |
| 3071 | # endif |
| 3072 | # endif |
| 3073 | |
| 3074 | # ifndef yytnamerr |
| 3075 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 3076 | quotes and backslashes, so that it's suitable for yyerror. The |
| 3077 | heuristic is that double-quoting is unnecessary unless the string |
| 3078 | contains an apostrophe, a comma, or backslash (other than |
| 3079 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 3080 | null, do not copy; instead, return the length of what the result |
| 3081 | would have been. */ |
| 3082 | static YYSIZE_T |
| 3083 | yytnamerr (char *yyres, const char *yystr) |
| 3084 | { |
| 3085 | if (*yystr == '"') |
| 3086 | { |
| 3087 | YYSIZE_T yyn = 0; |
| 3088 | char const *yyp = yystr; |
| 3089 | |
| 3090 | for (;;) |
| 3091 | switch (*++yyp) |
| 3092 | { |
| 3093 | case '\'': |
| 3094 | case ',': |
| 3095 | goto do_not_strip_quotes; |
| 3096 | |
| 3097 | case '\\': |
| 3098 | if (*++yyp != '\\') |
| 3099 | goto do_not_strip_quotes; |
| 3100 | /* Fall through. */ |
| 3101 | default: |
| 3102 | if (yyres) |
| 3103 | yyres[yyn] = *yyp; |
| 3104 | yyn++; |
| 3105 | break; |
| 3106 | |
| 3107 | case '"': |
| 3108 | if (yyres) |
| 3109 | yyres[yyn] = '\0'; |
| 3110 | return yyn; |
| 3111 | } |
| 3112 | do_not_strip_quotes: ; |
| 3113 | } |
| 3114 | |
| 3115 | if (! yyres) |
| 3116 | return yystrlen (yystr); |
| 3117 | |
| 3118 | return yystpcpy (yyres, yystr) - yyres; |
| 3119 | } |
| 3120 | # endif |
| 3121 | |
| 3122 | /* Copy into YYRESULT an error message about the unexpected token |
| 3123 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 3124 | including the terminating null byte. If YYRESULT is null, do not |
| 3125 | copy anything; just return the number of bytes that would be |
| 3126 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 3127 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 3128 | size calculation. */ |
| 3129 | static YYSIZE_T |
| 3130 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 3131 | { |
| 3132 | int yyn = yypact[yystate]; |
| 3133 | |
| 3134 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 3135 | return 0; |
| 3136 | else |
| 3137 | { |
| 3138 | int yytype = YYTRANSLATE (yychar); |
| 3139 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 3140 | YYSIZE_T yysize = yysize0; |
| 3141 | YYSIZE_T yysize1; |
| 3142 | int yysize_overflow = 0; |
| 3143 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 3144 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 3145 | int yyx; |
| 3146 | |
| 3147 | # if 0 |
| 3148 | /* This is so xgettext sees the translatable formats that are |
| 3149 | constructed on the fly. */ |
| 3150 | YY_("syntax error, unexpected %s"); |
| 3151 | YY_("syntax error, unexpected %s, expecting %s"); |
| 3152 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 3153 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 3154 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 3155 | # endif |
| 3156 | char *yyfmt; |
| 3157 | char const *yyf; |
| 3158 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 3159 | static char const yyexpecting[] = ", expecting %s"; |
| 3160 | static char const yyor[] = " or %s"; |
| 3161 | char yyformat[sizeof yyunexpected |
| 3162 | + sizeof yyexpecting - 1 |
| 3163 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 3164 | * (sizeof yyor - 1))]; |
| 3165 | char const *yyprefix = yyexpecting; |
| 3166 | |
| 3167 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 3168 | YYCHECK. */ |
| 3169 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 3170 | |
| 3171 | /* Stay within bounds of both yycheck and yytname. */ |
| 3172 | int yychecklim = YYLAST - yyn + 1; |
| 3173 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 3174 | int yycount = 1; |
| 3175 | |
| 3176 | yyarg[0] = yytname[yytype]; |
| 3177 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 3178 | |
| 3179 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 3180 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 3181 | { |
| 3182 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 3183 | { |
| 3184 | yycount = 1; |
| 3185 | yysize = yysize0; |
| 3186 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 3187 | break; |
| 3188 | } |
| 3189 | yyarg[yycount++] = yytname[yyx]; |
| 3190 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 3191 | yysize_overflow |= (yysize1 < yysize); |
| 3192 | yysize = yysize1; |
| 3193 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 3194 | yyprefix = yyor; |
| 3195 | } |
| 3196 | |
| 3197 | yyf = YY_(yyformat); |
| 3198 | yysize1 = yysize + yystrlen (yyf); |
| 3199 | yysize_overflow |= (yysize1 < yysize); |
| 3200 | yysize = yysize1; |
| 3201 | |
| 3202 | if (yysize_overflow) |
| 3203 | return YYSIZE_MAXIMUM; |
| 3204 | |
| 3205 | if (yyresult) |
| 3206 | { |
| 3207 | /* Avoid sprintf, as that infringes on the user's name space. |
| 3208 | Don't have undefined behavior even if the translation |
| 3209 | produced a string with the wrong number of "%s"s. */ |
| 3210 | char *yyp = yyresult; |
| 3211 | int yyi = 0; |
| 3212 | while ((*yyp = *yyf) != '\0') |
| 3213 | { |
| 3214 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 3215 | { |
| 3216 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 3217 | yyf += 2; |
| 3218 | } |
| 3219 | else |
| 3220 | { |
| 3221 | yyp++; |
| 3222 | yyf++; |
| 3223 | } |
| 3224 | } |
| 3225 | } |
| 3226 | return yysize; |
| 3227 | } |
| 3228 | } |
| 3229 | #endif /* YYERROR_VERBOSE */ |
| 3230 | |
| 3231 | |
| 3232 | /*-----------------------------------------------. |
| 3233 | | Release the memory associated to this symbol. | |
| 3234 | `-----------------------------------------------*/ |
| 3235 | |
| 3236 | /*ARGSUSED*/ |
| 3237 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3238 | || defined __cplusplus || defined _MSC_VER) |
| 3239 | static void |
| 3240 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 3241 | #else |
| 3242 | static void |
| 3243 | yydestruct (yymsg, yytype, yyvaluep) |
| 3244 | const char *yymsg; |
| 3245 | int yytype; |
| 3246 | YYSTYPE *yyvaluep; |
| 3247 | #endif |
| 3248 | { |
| 3249 | YYUSE (yyvaluep); |
| 3250 | |
| 3251 | if (!yymsg) |
| 3252 | yymsg = "Deleting"; |
| 3253 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 3254 | |
| 3255 | switch (yytype) |
| 3256 | { |
| 3257 | |
| 3258 | default: |
| 3259 | break; |
| 3260 | } |
| 3261 | } |
| 3262 | |
| 3263 | |
| 3264 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 3265 | |
| 3266 | #ifdef YYPARSE_PARAM |
| 3267 | #if defined __STDC__ || defined __cplusplus |
| 3268 | int yyparse (void *YYPARSE_PARAM); |
| 3269 | #else |
| 3270 | int yyparse (); |
| 3271 | #endif |
| 3272 | #else /* ! YYPARSE_PARAM */ |
| 3273 | #if defined __STDC__ || defined __cplusplus |
David Greene | 5fd22a8 | 2007-09-04 18:46:50 +0000 | [diff] [blame] | 3274 | int yyparse (void); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3275 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3276 | int yyparse (); |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3277 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3278 | #endif /* ! YYPARSE_PARAM */ |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3279 | |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3280 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3281 | |
| 3282 | /* The look-ahead symbol. */ |
| 3283 | int yychar; |
| 3284 | |
| 3285 | /* The semantic value of the look-ahead symbol. */ |
| 3286 | YYSTYPE yylval; |
| 3287 | |
| 3288 | /* Number of syntax errors so far. */ |
| 3289 | int yynerrs; |
| 3290 | |
| 3291 | |
| 3292 | |
| 3293 | /*----------. |
| 3294 | | yyparse. | |
| 3295 | `----------*/ |
| 3296 | |
| 3297 | #ifdef YYPARSE_PARAM |
| 3298 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3299 | || defined __cplusplus || defined _MSC_VER) |
| 3300 | int |
| 3301 | yyparse (void *YYPARSE_PARAM) |
| 3302 | #else |
| 3303 | int |
| 3304 | yyparse (YYPARSE_PARAM) |
| 3305 | void *YYPARSE_PARAM; |
| 3306 | #endif |
| 3307 | #else /* ! YYPARSE_PARAM */ |
| 3308 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3309 | || defined __cplusplus || defined _MSC_VER) |
| 3310 | int |
| 3311 | yyparse (void) |
| 3312 | #else |
| 3313 | int |
| 3314 | yyparse () |
| 3315 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3316 | #endif |
| 3317 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3318 | { |
| 3319 | |
| 3320 | int yystate; |
| 3321 | int yyn; |
| 3322 | int yyresult; |
| 3323 | /* Number of tokens to shift before error messages enabled. */ |
| 3324 | int yyerrstatus; |
| 3325 | /* Look-ahead token as an internal (translated) token number. */ |
| 3326 | int yytoken = 0; |
| 3327 | #if YYERROR_VERBOSE |
| 3328 | /* Buffer for error messages, and its allocated size. */ |
| 3329 | char yymsgbuf[128]; |
| 3330 | char *yymsg = yymsgbuf; |
| 3331 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3332 | #endif |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3333 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3334 | /* Three stacks and their tools: |
| 3335 | `yyss': related to states, |
| 3336 | `yyvs': related to semantic values, |
| 3337 | `yyls': related to locations. |
| 3338 | |
| 3339 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3340 | to reallocate them elsewhere. */ |
| 3341 | |
| 3342 | /* The state stack. */ |
| 3343 | yytype_int16 yyssa[YYINITDEPTH]; |
| 3344 | yytype_int16 *yyss = yyssa; |
| 3345 | yytype_int16 *yyssp; |
| 3346 | |
| 3347 | /* The semantic value stack. */ |
| 3348 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3349 | YYSTYPE *yyvs = yyvsa; |
| 3350 | YYSTYPE *yyvsp; |
| 3351 | |
| 3352 | |
| 3353 | |
| 3354 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 3355 | |
| 3356 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 3357 | |
| 3358 | /* The variables used to return semantic value and location from the |
| 3359 | action routines. */ |
| 3360 | YYSTYPE yyval; |
| 3361 | |
| 3362 | |
| 3363 | /* The number of symbols on the RHS of the reduced rule. |
| 3364 | Keep to zero when no symbol should be popped. */ |
| 3365 | int yylen = 0; |
| 3366 | |
| 3367 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 3368 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3369 | yystate = 0; |
| 3370 | yyerrstatus = 0; |
| 3371 | yynerrs = 0; |
| 3372 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3373 | |
| 3374 | /* Initialize stack pointers. |
| 3375 | Waste one element of value and location stack |
| 3376 | so that they stay on the same level as the state stack. |
| 3377 | The wasted elements are never initialized. */ |
| 3378 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3379 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3380 | yyvsp = yyvs; |
| 3381 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3382 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 3383 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3384 | /*------------------------------------------------------------. |
| 3385 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3386 | `------------------------------------------------------------*/ |
| 3387 | yynewstate: |
| 3388 | /* In all cases, when you get here, the value and location stacks |
| 3389 | have just been pushed. So pushing a state here evens the stacks. */ |
| 3390 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3391 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3392 | yysetstate: |
| 3393 | *yyssp = yystate; |
| 3394 | |
| 3395 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3396 | { |
| 3397 | /* Get the current used size of the three stacks, in elements. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3398 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3399 | |
| 3400 | #ifdef yyoverflow |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3401 | { |
| 3402 | /* Give user a chance to reallocate the stack. Use copies of |
| 3403 | these so that the &'s don't force the real ones into |
| 3404 | memory. */ |
| 3405 | YYSTYPE *yyvs1 = yyvs; |
| 3406 | yytype_int16 *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3407 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3408 | |
| 3409 | /* Each stack pointer address is followed by the size of the |
| 3410 | data in use in that stack, in bytes. This used to be a |
| 3411 | conditional around just the two extra args, but that might |
| 3412 | be undefined if yyoverflow is a macro. */ |
| 3413 | yyoverflow (YY_("memory exhausted"), |
| 3414 | &yyss1, yysize * sizeof (*yyssp), |
| 3415 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3416 | |
| 3417 | &yystacksize); |
| 3418 | |
| 3419 | yyss = yyss1; |
| 3420 | yyvs = yyvs1; |
| 3421 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3422 | #else /* no yyoverflow */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3423 | # ifndef YYSTACK_RELOCATE |
| 3424 | goto yyexhaustedlab; |
| 3425 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3426 | /* Extend the stack our own way. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3427 | if (YYMAXDEPTH <= yystacksize) |
| 3428 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3429 | yystacksize *= 2; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3430 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3431 | yystacksize = YYMAXDEPTH; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3432 | |
| 3433 | { |
| 3434 | yytype_int16 *yyss1 = yyss; |
| 3435 | union yyalloc *yyptr = |
| 3436 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3437 | if (! yyptr) |
| 3438 | goto yyexhaustedlab; |
| 3439 | YYSTACK_RELOCATE (yyss); |
| 3440 | YYSTACK_RELOCATE (yyvs); |
| 3441 | |
| 3442 | # undef YYSTACK_RELOCATE |
| 3443 | if (yyss1 != yyssa) |
| 3444 | YYSTACK_FREE (yyss1); |
| 3445 | } |
| 3446 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3447 | #endif /* no yyoverflow */ |
| 3448 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3449 | yyssp = yyss + yysize - 1; |
| 3450 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3451 | |
| 3452 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3453 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3454 | (unsigned long int) yystacksize)); |
| 3455 | |
| 3456 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3457 | YYABORT; |
| 3458 | } |
| 3459 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3460 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3461 | |
| 3462 | goto yybackup; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3463 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3464 | /*-----------. |
| 3465 | | yybackup. | |
| 3466 | `-----------*/ |
| 3467 | yybackup: |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3468 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3469 | /* Do appropriate processing given the current state. Read a |
| 3470 | look-ahead token if we need one and don't already have one. */ |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 3471 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3472 | /* 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] | 3473 | yyn = yypact[yystate]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3474 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3475 | goto yydefault; |
| 3476 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3477 | /* 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] | 3478 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3479 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3480 | if (yychar == YYEMPTY) |
| 3481 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3482 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3483 | yychar = YYLEX; |
| 3484 | } |
| 3485 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3486 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3487 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3488 | yychar = yytoken = YYEOF; |
| 3489 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3490 | } |
| 3491 | else |
| 3492 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3493 | yytoken = YYTRANSLATE (yychar); |
| 3494 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3495 | } |
| 3496 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3497 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3498 | detect an error, take that action. */ |
| 3499 | yyn += yytoken; |
| 3500 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3501 | goto yydefault; |
| 3502 | yyn = yytable[yyn]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3503 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3504 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3505 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3506 | goto yyerrlab; |
| 3507 | yyn = -yyn; |
| 3508 | goto yyreduce; |
| 3509 | } |
| 3510 | |
| 3511 | if (yyn == YYFINAL) |
| 3512 | YYACCEPT; |
| 3513 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3514 | /* Count tokens shifted since error; after three, turn off error |
| 3515 | status. */ |
| 3516 | if (yyerrstatus) |
| 3517 | yyerrstatus--; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 3518 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3519 | /* Shift the look-ahead token. */ |
| 3520 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3521 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3522 | /* Discard the shifted token unless it is eof. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3523 | if (yychar != YYEOF) |
| 3524 | yychar = YYEMPTY; |
| 3525 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3526 | yystate = yyn; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3527 | *++yyvsp = yylval; |
| 3528 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3529 | goto yynewstate; |
| 3530 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3531 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3532 | /*-----------------------------------------------------------. |
| 3533 | | yydefault -- do the default action for the current state. | |
| 3534 | `-----------------------------------------------------------*/ |
| 3535 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3536 | yyn = yydefact[yystate]; |
| 3537 | if (yyn == 0) |
| 3538 | goto yyerrlab; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3539 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3540 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3541 | |
| 3542 | /*-----------------------------. |
| 3543 | | yyreduce -- Do a reduction. | |
| 3544 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3545 | yyreduce: |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3546 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3547 | yylen = yyr2[yyn]; |
| 3548 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3549 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3550 | `$$ = $1'. |
| 3551 | |
| 3552 | Otherwise, the following line sets YYVAL to garbage. |
| 3553 | This behavior is undocumented and Bison |
| 3554 | users should not rely upon it. Assigning to YYVAL |
| 3555 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3556 | GCC warning that YYVAL may be used uninitialized. */ |
| 3557 | yyval = yyvsp[1-yylen]; |
| 3558 | |
| 3559 | |
| 3560 | YY_REDUCE_PRINT (yyn); |
| 3561 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3562 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3563 | case 29: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3564 | #line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3565 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3566 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3567 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3568 | case 30: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3569 | #line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3570 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3571 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3572 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3573 | case 31: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3574 | #line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3575 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3576 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3577 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3578 | case 32: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3579 | #line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3580 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3581 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3582 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3583 | case 33: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3584 | #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3585 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3586 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3587 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3588 | case 34: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3589 | #line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3590 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3591 | break; |
| 3592 | |
| 3593 | case 35: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3594 | #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3595 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3596 | break; |
| 3597 | |
| 3598 | case 36: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3599 | #line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3600 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3601 | break; |
| 3602 | |
| 3603 | case 37: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3604 | #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3605 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3606 | break; |
| 3607 | |
| 3608 | case 38: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3609 | #line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3610 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3611 | break; |
| 3612 | |
| 3613 | case 39: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3614 | #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3615 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3616 | break; |
| 3617 | |
| 3618 | case 40: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3619 | #line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3620 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3621 | break; |
| 3622 | |
| 3623 | case 41: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3624 | #line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3625 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3626 | break; |
| 3627 | |
| 3628 | case 42: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3629 | #line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3630 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3631 | break; |
| 3632 | |
| 3633 | case 43: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3634 | #line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3635 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3636 | break; |
| 3637 | |
| 3638 | case 44: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3639 | #line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3640 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3641 | break; |
| 3642 | |
| 3643 | case 45: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3644 | #line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3645 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3646 | break; |
| 3647 | |
| 3648 | case 46: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3649 | #line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3650 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3651 | break; |
| 3652 | |
| 3653 | case 47: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3654 | #line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3655 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3656 | break; |
| 3657 | |
| 3658 | case 48: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3659 | #line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3660 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3661 | break; |
| 3662 | |
| 3663 | case 49: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3664 | #line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3665 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3666 | break; |
| 3667 | |
| 3668 | case 50: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3669 | #line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3670 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3671 | break; |
| 3672 | |
| 3673 | case 51: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3674 | #line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3675 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3676 | break; |
| 3677 | |
| 3678 | case 52: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3679 | #line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3680 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3681 | break; |
| 3682 | |
| 3683 | case 53: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3684 | #line 1139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3685 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3686 | break; |
| 3687 | |
| 3688 | case 54: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3689 | #line 1140 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3690 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3691 | break; |
| 3692 | |
| 3693 | case 65: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3694 | #line 1149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3695 | { (yyval.StrVal) = 0; ;} |
| 3696 | break; |
| 3697 | |
| 3698 | case 66: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3699 | #line 1151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3700 | { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} |
| 3701 | break; |
| 3702 | |
| 3703 | case 67: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3704 | #line 1152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3705 | { (yyval.UIntVal)=0; ;} |
| 3706 | break; |
| 3707 | |
| 3708 | case 68: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3709 | #line 1156 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3710 | { |
| 3711 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3712 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3713 | ;} |
| 3714 | break; |
| 3715 | |
| 3716 | case 69: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3717 | #line 1160 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3718 | { |
| 3719 | (yyval.StrVal) = 0; |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3720 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3721 | ;} |
| 3722 | break; |
| 3723 | |
| 3724 | case 73: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3725 | #line 1168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3726 | { |
| 3727 | (yyval.StrVal) = 0; |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3728 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3729 | ;} |
| 3730 | break; |
| 3731 | |
| 3732 | case 74: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3733 | #line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3734 | { |
| 3735 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3736 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3737 | ;} |
| 3738 | break; |
| 3739 | |
| 3740 | case 75: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3741 | #line 1179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3742 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3743 | break; |
| 3744 | |
| 3745 | case 76: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3746 | #line 1180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3747 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3748 | break; |
| 3749 | |
| 3750 | case 77: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3751 | #line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3752 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3753 | break; |
| 3754 | |
| 3755 | case 78: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3756 | #line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3757 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3758 | break; |
| 3759 | |
| 3760 | case 79: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3761 | #line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3762 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3763 | break; |
| 3764 | |
| 3765 | case 80: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3766 | #line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3767 | { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3768 | break; |
| 3769 | |
| 3770 | case 81: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3771 | #line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3772 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3773 | break; |
| 3774 | |
| 3775 | case 82: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3776 | #line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3777 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3778 | break; |
| 3779 | |
| 3780 | case 83: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3781 | #line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3782 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3783 | break; |
| 3784 | |
| 3785 | case 84: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3786 | #line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3787 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3788 | break; |
| 3789 | |
| 3790 | case 85: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3791 | #line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3792 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3793 | break; |
| 3794 | |
| 3795 | case 86: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3796 | #line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3797 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3798 | break; |
| 3799 | |
| 3800 | case 87: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3801 | #line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3802 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3803 | break; |
| 3804 | |
| 3805 | case 88: |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 3806 | #line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3807 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3808 | break; |
| 3809 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3810 | case 89: |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 3811 | #line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3812 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3813 | break; |
| 3814 | |
| 3815 | case 90: |
| 3816 | #line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3817 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3818 | break; |
| 3819 | |
| 3820 | case 91: |
| 3821 | #line 1207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3822 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3823 | break; |
| 3824 | |
| 3825 | case 92: |
| 3826 | #line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3827 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3828 | break; |
| 3829 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3830 | case 93: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3831 | #line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3832 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3833 | break; |
| 3834 | |
| 3835 | case 94: |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 3836 | #line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3837 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3838 | break; |
| 3839 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3840 | case 95: |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 3841 | #line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3842 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3843 | break; |
| 3844 | |
| 3845 | case 96: |
| 3846 | #line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3847 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3848 | break; |
| 3849 | |
| 3850 | case 97: |
| 3851 | #line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3852 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3853 | break; |
| 3854 | |
| 3855 | case 98: |
| 3856 | #line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3857 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3858 | break; |
| 3859 | |
| 3860 | case 99: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3861 | #line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3862 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3863 | break; |
| 3864 | |
| 3865 | case 100: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3866 | #line 1221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3867 | { (yyval.UIntVal) = CallingConv::C; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3868 | break; |
| 3869 | |
| 3870 | case 101: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3871 | #line 1222 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3872 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3873 | break; |
| 3874 | |
| 3875 | case 102: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3876 | #line 1223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3877 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3878 | break; |
| 3879 | |
| 3880 | case 103: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3881 | #line 1224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3882 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3883 | break; |
| 3884 | |
| 3885 | case 104: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3886 | #line 1225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3887 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3888 | break; |
| 3889 | |
| 3890 | case 105: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3891 | #line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3892 | { |
| 3893 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3894 | GEN_ERROR("Calling conv too large"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3895 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3896 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3897 | ;} |
| 3898 | break; |
| 3899 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3900 | case 106: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3901 | #line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3902 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3903 | break; |
| 3904 | |
| 3905 | case 107: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3906 | #line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3907 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3908 | break; |
| 3909 | |
| 3910 | case 108: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3911 | #line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3912 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3913 | break; |
| 3914 | |
| 3915 | case 109: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3916 | #line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3917 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3918 | break; |
| 3919 | |
| 3920 | case 110: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3921 | #line 1237 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3922 | { (yyval.ParamAttrs) = ParamAttr::InReg; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3923 | break; |
| 3924 | |
| 3925 | case 111: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3926 | #line 1238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3927 | { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3928 | break; |
| 3929 | |
| 3930 | case 112: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3931 | #line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3932 | { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3933 | break; |
| 3934 | |
| 3935 | case 113: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3936 | #line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3937 | { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3938 | break; |
| 3939 | |
| 3940 | case 114: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3941 | #line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3942 | { (yyval.ParamAttrs) = ParamAttr::Nest; ;} |
| 3943 | break; |
| 3944 | |
| 3945 | case 115: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3946 | #line 1242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3947 | { (yyval.ParamAttrs) = |
| 3948 | ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} |
| 3949 | break; |
| 3950 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3951 | case 116: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3952 | #line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3953 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3954 | break; |
| 3955 | |
| 3956 | case 117: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3957 | #line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3958 | { |
| 3959 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 3960 | ;} |
| 3961 | break; |
| 3962 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3963 | case 118: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3964 | #line 1252 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3965 | { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} |
| 3966 | break; |
| 3967 | |
| 3968 | case 119: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3969 | #line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3970 | { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} |
| 3971 | break; |
| 3972 | |
| 3973 | case 120: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3974 | #line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3975 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3976 | break; |
| 3977 | |
| 3978 | case 121: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3979 | #line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3980 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3981 | break; |
| 3982 | |
| 3983 | case 122: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3984 | #line 1256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3985 | { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} |
| 3986 | break; |
| 3987 | |
| 3988 | case 123: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3989 | #line 1257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3990 | { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} |
| 3991 | break; |
| 3992 | |
| 3993 | case 124: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3994 | #line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3995 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3996 | break; |
| 3997 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3998 | case 125: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 3999 | #line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4000 | { |
| 4001 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 4002 | ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4003 | break; |
| 4004 | |
| 4005 | case 126: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4006 | #line 1266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4007 | { (yyval.StrVal) = 0; ;} |
| 4008 | break; |
| 4009 | |
| 4010 | case 127: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4011 | #line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4012 | { |
| 4013 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
| 4014 | ;} |
| 4015 | break; |
| 4016 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4017 | case 128: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4018 | #line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4019 | { (yyval.UIntVal) = 0; ;} |
| 4020 | break; |
| 4021 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4022 | case 129: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4023 | #line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4024 | { |
| 4025 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
| 4026 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4027 | GEN_ERROR("Alignment must be a power of two"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4028 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4029 | ;} |
| 4030 | break; |
| 4031 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4032 | case 130: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4033 | #line 1281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4034 | { (yyval.UIntVal) = 0; ;} |
| 4035 | break; |
| 4036 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4037 | case 131: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4038 | #line 1282 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4039 | { |
| 4040 | (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); |
| 4041 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4042 | GEN_ERROR("Alignment must be a power of two"); |
| 4043 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4044 | ;} |
| 4045 | break; |
| 4046 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4047 | case 132: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4048 | #line 1291 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4049 | { |
| 4050 | for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) |
| 4051 | if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4052 | GEN_ERROR("Invalid character in section name"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4053 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4054 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4055 | ;} |
| 4056 | break; |
| 4057 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4058 | case 133: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4059 | #line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4060 | { (yyval.StrVal) = 0; ;} |
| 4061 | break; |
| 4062 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4063 | case 134: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4064 | #line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4065 | { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} |
| 4066 | break; |
| 4067 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4068 | case 135: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4069 | #line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4070 | {;} |
| 4071 | break; |
| 4072 | |
| 4073 | case 136: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4074 | #line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4075 | {;} |
| 4076 | break; |
| 4077 | |
| 4078 | case 137: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4079 | #line 1307 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4080 | { |
| 4081 | CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); |
| 4082 | delete (yyvsp[(1) - (1)].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4083 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4084 | ;} |
| 4085 | break; |
| 4086 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4087 | case 138: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4088 | #line 1312 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4089 | { |
| 4090 | if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4091 | GEN_ERROR("Alignment must be a power of two"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4092 | CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4093 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4094 | ;} |
| 4095 | break; |
| 4096 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4097 | case 146: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4098 | #line 1328 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4099 | { |
| 4100 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4101 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4102 | ;} |
| 4103 | break; |
| 4104 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4105 | case 147: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4106 | #line 1332 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4107 | { |
| 4108 | (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4109 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4110 | ;} |
| 4111 | break; |
| 4112 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4113 | case 148: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4114 | #line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4115 | { // Pointer type? |
| 4116 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4117 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4118 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal)))); |
| 4119 | delete (yyvsp[(1) - (3)].TypeVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4120 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4121 | ;} |
| 4122 | break; |
| 4123 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4124 | case 149: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4125 | #line 1343 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4126 | { // Named types are also simple types... |
| 4127 | const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 4128 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4129 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 4130 | ;} |
| 4131 | break; |
| 4132 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4133 | case 150: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4134 | #line 1348 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4135 | { // Type UpReference |
| 4136 | if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4137 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4138 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... |
| 4139 | (yyval.TypeVal) = new PATypeHolder(OT); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4140 | UR_OUT("New Upreference!\n"); |
| 4141 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4142 | ;} |
| 4143 | break; |
| 4144 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4145 | case 151: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4146 | #line 1356 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4147 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4148 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4149 | // FIXME: remove in LLVM 3.0. |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 4150 | const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal); |
| 4151 | if (!FunctionType::isValidReturnType(RetTy)) |
| 4152 | GEN_ERROR("Invalid result type for LLVM function"); |
| 4153 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4154 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4155 | TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4156 | for (; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4157 | const Type *Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4158 | Params.push_back(Ty); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4159 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4160 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4161 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4162 | if (isVarArg) Params.pop_back(); |
| 4163 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4164 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4165 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4166 | GEN_ERROR("Function arguments must be value types!"); |
| 4167 | |
| 4168 | CHECK_FOR_ERROR |
| 4169 | |
Anton Korobeynikov | c36284e | 2007-12-03 19:17:47 +0000 | [diff] [blame] | 4170 | FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4171 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4172 | delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle |
| 4173 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4174 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4175 | ;} |
| 4176 | break; |
| 4177 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4178 | case 152: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4179 | #line 1385 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4180 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4181 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4182 | // FIXME: remove in LLVM 3.0. |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4183 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4184 | TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4185 | for ( ; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4186 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4187 | Params.push_back(Ty); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4188 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4189 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4190 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4191 | if (isVarArg) Params.pop_back(); |
| 4192 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4193 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4194 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4195 | GEN_ERROR("Function arguments must be value types!"); |
| 4196 | |
| 4197 | CHECK_FOR_ERROR |
| 4198 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4199 | FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); |
| 4200 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4201 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4202 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4203 | ;} |
| 4204 | break; |
| 4205 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4206 | case 153: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4207 | #line 1410 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4208 | { // Sized array type? |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4209 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val)))); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4210 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4211 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4212 | ;} |
| 4213 | break; |
| 4214 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4215 | case 154: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4216 | #line 1415 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4217 | { // Vector type? |
| 4218 | const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); |
| 4219 | if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4220 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 4221 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 4222 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4223 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4224 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4225 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4226 | ;} |
| 4227 | break; |
| 4228 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4229 | case 155: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4230 | #line 1425 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4231 | { // Structure type? |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4232 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4233 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), |
| 4234 | E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4235 | Elements.push_back(*I); |
| 4236 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4237 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 4238 | delete (yyvsp[(2) - (3)].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4239 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4240 | ;} |
| 4241 | break; |
| 4242 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4243 | case 156: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4244 | #line 1435 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4245 | { // Empty structure type? |
| 4246 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4247 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4248 | ;} |
| 4249 | break; |
| 4250 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4251 | case 157: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4252 | #line 1439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4253 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4254 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4255 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), |
| 4256 | E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4257 | Elements.push_back(*I); |
| 4258 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4259 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 4260 | delete (yyvsp[(3) - (5)].TypeList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4261 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4262 | ;} |
| 4263 | break; |
| 4264 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4265 | case 158: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4266 | #line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4267 | { // Empty structure type? |
| 4268 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4269 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4270 | ;} |
| 4271 | break; |
| 4272 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4273 | case 159: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4274 | #line 1456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4275 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4276 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4277 | // FIXME: remove in LLVM 3.0. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4278 | (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); |
| 4279 | (yyval.TypeWithAttrs).Attrs = ParamAttr::None; |
| 4280 | ;} |
| 4281 | break; |
| 4282 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4283 | case 160: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4284 | #line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4285 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4286 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4287 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); |
| 4288 | if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4289 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4290 | (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); |
| 4291 | ;} |
| 4292 | break; |
| 4293 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4294 | case 161: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4295 | #line 1472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4296 | { |
| 4297 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 4298 | ;} |
| 4299 | break; |
| 4300 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4301 | case 162: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4302 | #line 1477 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4303 | { |
| 4304 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 4305 | (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4306 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4307 | ;} |
| 4308 | break; |
| 4309 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4310 | case 163: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4311 | #line 1482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4312 | { |
| 4313 | ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4314 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4315 | ;} |
| 4316 | break; |
| 4317 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4318 | case 165: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4319 | #line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4320 | { |
| 4321 | (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 4322 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4323 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4324 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4325 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4326 | ;} |
| 4327 | break; |
| 4328 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4329 | case 166: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4330 | #line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4331 | { |
| 4332 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4333 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 4334 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4335 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4336 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4337 | ;} |
| 4338 | break; |
| 4339 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4340 | case 167: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4341 | #line 1504 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4342 | { |
| 4343 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4344 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4345 | ;} |
| 4346 | break; |
| 4347 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4348 | case 168: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4349 | #line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4350 | { |
| 4351 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 4352 | (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); |
| 4353 | delete (yyvsp[(1) - (1)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4354 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4355 | ;} |
| 4356 | break; |
| 4357 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4358 | case 169: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4359 | #line 1518 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4360 | { |
| 4361 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); |
| 4362 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4363 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4364 | ;} |
| 4365 | break; |
| 4366 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4367 | case 170: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4368 | #line 1530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4369 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4370 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4371 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4372 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4373 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4374 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4375 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4376 | const Type *ETy = ATy->getElementType(); |
| 4377 | int NumElements = ATy->getNumElements(); |
| 4378 | |
| 4379 | // Verify that we have the correct size... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4380 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4381 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4382 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4383 | itostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4384 | |
| 4385 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4386 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4387 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4388 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4389 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4390 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4391 | } |
| 4392 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4393 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4394 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4395 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4396 | ;} |
| 4397 | break; |
| 4398 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4399 | case 171: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4400 | #line 1558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4401 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4402 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4403 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4404 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4405 | if (ATy == 0) |
| 4406 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4407 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4408 | |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4409 | int NumElements = ATy->getNumElements(); |
| 4410 | if (NumElements != -1 && NumElements != 0) |
| 4411 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4412 | " arguments, but has size of " + itostr(NumElements) +""); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4413 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 4414 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4415 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4416 | ;} |
| 4417 | break; |
| 4418 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4419 | case 172: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4420 | #line 1574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4421 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4422 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4423 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4424 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4425 | if (ATy == 0) |
| 4426 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4427 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4428 | |
| 4429 | int NumElements = ATy->getNumElements(); |
| 4430 | const Type *ETy = ATy->getElementType(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4431 | if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4432 | GEN_ERROR("Can't build string constant of size " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4433 | itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4434 | " when array has size " + itostr(NumElements) + ""); |
| 4435 | std::vector<Constant*> Vals; |
| 4436 | if (ETy == Type::Int8Ty) { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4437 | for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) |
| 4438 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4439 | } else { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4440 | delete (yyvsp[(3) - (3)].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4441 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 4442 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4443 | delete (yyvsp[(3) - (3)].StrVal); |
| 4444 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 4445 | delete (yyvsp[(1) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4446 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4447 | ;} |
| 4448 | break; |
| 4449 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4450 | case 173: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4451 | #line 1601 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4452 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4453 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4454 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4455 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4456 | if (PTy == 0) |
| 4457 | GEN_ERROR("Cannot make packed constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4458 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4459 | const Type *ETy = PTy->getElementType(); |
| 4460 | int NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4461 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4462 | // Verify that we have the correct size... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4463 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4464 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4465 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4466 | itostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4467 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4468 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4469 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4470 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4471 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4472 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4473 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4474 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4475 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4476 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4477 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4478 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4479 | ;} |
| 4480 | break; |
| 4481 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4482 | case 174: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4483 | #line 1629 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4484 | { |
| 4485 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4486 | if (STy == 0) |
| 4487 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4488 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4489 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4490 | if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4491 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4492 | |
| 4493 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4494 | for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) |
| 4495 | if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4496 | GEN_ERROR("Expected type '" + |
| 4497 | STy->getElementType(i)->getDescription() + |
| 4498 | "' for element #" + utostr(i) + |
| 4499 | " of structure initializer"); |
| 4500 | |
| 4501 | // Check to ensure that Type is not packed |
| 4502 | if (STy->isPacked()) |
| 4503 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4504 | STy->getDescription() + "'"); |
| 4505 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4506 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4507 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4508 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4509 | ;} |
| 4510 | break; |
| 4511 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4512 | case 175: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4513 | #line 1655 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4514 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4515 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4516 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4517 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4518 | if (STy == 0) |
| 4519 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4520 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4521 | |
| 4522 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4523 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4524 | |
| 4525 | // Check to ensure that Type is not packed |
| 4526 | if (STy->isPacked()) |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4527 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4528 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4529 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4530 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4531 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4532 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4533 | ;} |
| 4534 | break; |
| 4535 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4536 | case 176: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4537 | #line 1675 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4538 | { |
| 4539 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4540 | if (STy == 0) |
| 4541 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4542 | (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4543 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4544 | if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4545 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4546 | |
| 4547 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4548 | for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) |
| 4549 | if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4550 | GEN_ERROR("Expected type '" + |
| 4551 | STy->getElementType(i)->getDescription() + |
| 4552 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4553 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4554 | |
| 4555 | // Check to ensure that Type is packed |
| 4556 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4557 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4558 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4559 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4560 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector)); |
| 4561 | delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4562 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4563 | ;} |
| 4564 | break; |
| 4565 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4566 | case 177: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4567 | #line 1701 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4568 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4569 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4570 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); |
| 4571 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4572 | if (STy == 0) |
| 4573 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4574 | (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4575 | |
| 4576 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4577 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4578 | |
| 4579 | // Check to ensure that Type is packed |
| 4580 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4581 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4582 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4583 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4584 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4585 | delete (yyvsp[(1) - (5)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4586 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4587 | ;} |
| 4588 | break; |
| 4589 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4590 | case 178: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4591 | #line 1721 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4592 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4593 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4594 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4595 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4596 | if (PTy == 0) |
| 4597 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4598 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4599 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4600 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4601 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4602 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4603 | ;} |
| 4604 | break; |
| 4605 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4606 | case 179: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4607 | #line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4608 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4609 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4610 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4611 | (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); |
| 4612 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4613 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4614 | ;} |
| 4615 | break; |
| 4616 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4617 | case 180: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4618 | #line 1740 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4619 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4620 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4621 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4622 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4623 | if (Ty == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4624 | GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4625 | |
| 4626 | // ConstExprs can exist in the body of a function, thus creating |
| 4627 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4628 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4629 | // symbol table instead of the module symbol table for the global symbol, |
| 4630 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4631 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4632 | // |
| 4633 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4634 | CurFun.CurrentFunction = 0; |
| 4635 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4636 | Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4637 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4638 | |
| 4639 | CurFun.CurrentFunction = SavedCurFn; |
| 4640 | |
| 4641 | // If this is an initializer for a constant pointer, which is referencing a |
| 4642 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4643 | // in the future with the right type of variable. |
| 4644 | // |
| 4645 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4646 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4647 | const PointerType *PT = cast<PointerType>(Ty); |
| 4648 | |
| 4649 | // First check to see if the forward references value is already created! |
| 4650 | PerModuleInfo::GlobalRefsType::iterator I = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4651 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4652 | |
| 4653 | if (I != CurModule.GlobalRefs.end()) { |
| 4654 | V = I->second; // Placeholder already exists, use it... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4655 | (yyvsp[(2) - (2)].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4656 | } else { |
| 4657 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4658 | if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName) |
| 4659 | Name = (yyvsp[(2) - (2)].ValIDVal).getName(); |
| 4660 | else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4661 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4662 | |
| 4663 | // Create the forward referenced global. |
| 4664 | GlobalValue *GV; |
| 4665 | if (const FunctionType *FTy = |
| 4666 | dyn_cast<FunctionType>(PT->getElementType())) { |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 4667 | GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name, |
| 4668 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4669 | } else { |
| 4670 | GV = new GlobalVariable(PT->getElementType(), false, |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4671 | GlobalValue::ExternalWeakLinkage, 0, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4672 | Name, CurModule.CurrentModule); |
| 4673 | } |
| 4674 | |
| 4675 | // Keep track of the fact that we have a forward ref to recycle it |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4676 | 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] | 4677 | V = GV; |
| 4678 | } |
| 4679 | } |
| 4680 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4681 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4682 | delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4683 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4684 | ;} |
| 4685 | break; |
| 4686 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4687 | case 181: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4688 | #line 1806 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4689 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4690 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4691 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4692 | if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4693 | GEN_ERROR("Mismatched types for constant expression: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4694 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription()); |
| 4695 | (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); |
| 4696 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4697 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4698 | ;} |
| 4699 | break; |
| 4700 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4701 | case 182: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4702 | #line 1816 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4703 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4704 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4705 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4706 | const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4707 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4708 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4709 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4710 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4711 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4712 | ;} |
| 4713 | break; |
| 4714 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4715 | case 183: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4716 | #line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4717 | { // integral constants |
| 4718 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4719 | GEN_ERROR("Constant value doesn't fit in type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4720 | (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4721 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4722 | ;} |
| 4723 | break; |
| 4724 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4725 | case 184: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4726 | #line 1832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4727 | { // arbitrary precision integer constants |
| 4728 | uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); |
| 4729 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4730 | GEN_ERROR("Constant value does not fit in type"); |
| 4731 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4732 | (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth); |
| 4733 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4734 | delete (yyvsp[(2) - (2)].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4735 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4736 | ;} |
| 4737 | break; |
| 4738 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4739 | case 185: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4740 | #line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4741 | { // integral constants |
| 4742 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4743 | GEN_ERROR("Constant value doesn't fit in type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4744 | (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4745 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4746 | ;} |
| 4747 | break; |
| 4748 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4749 | case 186: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4750 | #line 1848 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4751 | { // arbitrary precision integer constants |
| 4752 | uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); |
| 4753 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4754 | GEN_ERROR("Constant value does not fit in type"); |
| 4755 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4756 | (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth); |
| 4757 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4758 | delete (yyvsp[(2) - (2)].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4759 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4760 | ;} |
| 4761 | break; |
| 4762 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4763 | case 187: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4764 | #line 1858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4765 | { // Boolean constants |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4766 | if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) |
| 4767 | GEN_ERROR("Constant true must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4768 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4769 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4770 | ;} |
| 4771 | break; |
| 4772 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4773 | case 188: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4774 | #line 1864 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4775 | { // Boolean constants |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4776 | if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) |
| 4777 | GEN_ERROR("Constant false must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4778 | (yyval.ConstVal) = ConstantInt::getFalse(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4779 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4780 | ;} |
| 4781 | break; |
| 4782 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4783 | case 189: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4784 | #line 1870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4785 | { // Floating point constants |
| 4786 | if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4787 | GEN_ERROR("Floating point constant invalid for type"); |
Dale Johannesen | c72cd7e | 2007-09-11 18:33:39 +0000 | [diff] [blame] | 4788 | // Lexer has no type info, so builds all float and double FP constants |
| 4789 | // as double. Fix this here. Long double is done right. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4790 | if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy) |
| 4791 | (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 4792 | (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4793 | delete (yyvsp[(2) - (2)].FPVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4794 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4795 | ;} |
| 4796 | break; |
| 4797 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4798 | case 190: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4799 | #line 1883 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4800 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4801 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4802 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); |
| 4803 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 4804 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 4805 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4806 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4807 | Val->getType()->getDescription() + "' to '" + |
| 4808 | DestTy->getDescription() + "'"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4809 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
| 4810 | delete (yyvsp[(5) - (6)].TypeVal); |
| 4811 | ;} |
| 4812 | break; |
| 4813 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4814 | case 191: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4815 | #line 1895 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4816 | { |
| 4817 | if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4818 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4819 | |
| 4820 | const Type *IdxTy = |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 4821 | GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4822 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4823 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4824 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4825 | SmallVector<Constant*, 8> IdxVec; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4826 | for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) |
| 4827 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4828 | IdxVec.push_back(C); |
| 4829 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4830 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4831 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4832 | delete (yyvsp[(4) - (5)].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4833 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4834 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4835 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4836 | ;} |
| 4837 | break; |
| 4838 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4839 | case 192: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4840 | #line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4841 | { |
| 4842 | if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4843 | GEN_ERROR("Select condition must be of boolean type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4844 | if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4845 | GEN_ERROR("Select operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4846 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4847 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4848 | ;} |
| 4849 | break; |
| 4850 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4851 | case 193: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4852 | #line 1924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4853 | { |
| 4854 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4855 | GEN_ERROR("Binary operator types must match"); |
| 4856 | CHECK_FOR_ERROR; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4857 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
| 4858 | ;} |
| 4859 | break; |
| 4860 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4861 | case 194: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4862 | #line 1930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4863 | { |
| 4864 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4865 | GEN_ERROR("Logical operator types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4866 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) { |
| 4867 | if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) || |
| 4868 | !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4869 | GEN_ERROR("Logical operator requires integral operands"); |
| 4870 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4871 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4872 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4873 | ;} |
| 4874 | break; |
| 4875 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4876 | case 195: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4877 | #line 1941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4878 | { |
| 4879 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4880 | GEN_ERROR("icmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4881 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4882 | ;} |
| 4883 | break; |
| 4884 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4885 | case 196: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4886 | #line 1946 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4887 | { |
| 4888 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4889 | GEN_ERROR("fcmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4890 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4891 | ;} |
| 4892 | break; |
| 4893 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4894 | case 197: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4895 | #line 1951 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 4896 | { |
| 4897 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 4898 | GEN_ERROR("vicmp operand types must match"); |
| 4899 | (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4900 | ;} |
| 4901 | break; |
| 4902 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4903 | case 198: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4904 | #line 1956 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 4905 | { |
| 4906 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 4907 | GEN_ERROR("vfcmp operand types must match"); |
| 4908 | (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4909 | ;} |
| 4910 | break; |
| 4911 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4912 | case 199: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4913 | #line 1961 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4914 | { |
| 4915 | if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4916 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4917 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4918 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4919 | ;} |
| 4920 | break; |
| 4921 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4922 | case 200: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4923 | #line 1967 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4924 | { |
| 4925 | if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4926 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4927 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4928 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4929 | ;} |
| 4930 | break; |
| 4931 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4932 | case 201: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4933 | #line 1973 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4934 | { |
| 4935 | if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4936 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4937 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4938 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4939 | ;} |
| 4940 | break; |
| 4941 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4942 | case 202: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4943 | #line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4944 | { |
| 4945 | if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
| 4946 | GEN_ERROR("ExtractValue requires an aggregate operand"); |
| 4947 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4948 | (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size()); |
| 4949 | delete (yyvsp[(4) - (5)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4950 | CHECK_FOR_ERROR |
| 4951 | ;} |
| 4952 | break; |
| 4953 | |
| 4954 | case 203: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4955 | #line 1987 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4956 | { |
| 4957 | if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType())) |
| 4958 | GEN_ERROR("InsertValue requires an aggregate operand"); |
| 4959 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4960 | (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size()); |
| 4961 | delete (yyvsp[(6) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4962 | CHECK_FOR_ERROR |
| 4963 | ;} |
| 4964 | break; |
| 4965 | |
| 4966 | case 204: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4967 | #line 1998 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4968 | { |
| 4969 | ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4970 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4971 | ;} |
| 4972 | break; |
| 4973 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4974 | case 205: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4975 | #line 2002 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4976 | { |
| 4977 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4978 | (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4979 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4980 | ;} |
| 4981 | break; |
| 4982 | |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 4983 | case 206: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4984 | #line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4985 | { (yyval.BoolVal) = false; ;} |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 4986 | break; |
| 4987 | |
| 4988 | case 207: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4989 | #line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4990 | { (yyval.BoolVal) = true; ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4991 | break; |
| 4992 | |
| 4993 | case 208: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4994 | #line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 4995 | { (yyval.BoolVal) = true; ;} |
| 4996 | break; |
| 4997 | |
| 4998 | case 209: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 4999 | #line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5000 | { (yyval.BoolVal) = false; ;} |
| 5001 | break; |
| 5002 | |
| 5003 | case 210: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5004 | #line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5005 | { |
| 5006 | const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); |
| 5007 | Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); |
Chris Lattner | 0275cff | 2007-08-06 21:00:46 +0000 | [diff] [blame] | 5008 | CHECK_FOR_ERROR |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5009 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 5010 | if (!Aliasee) |
| 5011 | GEN_ERROR("Aliases can be created only to global values"); |
| 5012 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5013 | (yyval.ConstVal) = Aliasee; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5014 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5015 | delete (yyvsp[(1) - (2)].TypeVal); |
| 5016 | ;} |
| 5017 | break; |
| 5018 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5019 | case 211: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5020 | #line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5021 | { |
| 5022 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 5023 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 5024 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5025 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5026 | Val->getType()->getDescription() + "' to '" + |
| 5027 | DestTy->getDescription() + "'"); |
| 5028 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5029 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5030 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5031 | delete (yyvsp[(5) - (6)].TypeVal); |
| 5032 | ;} |
| 5033 | break; |
| 5034 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5035 | case 212: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5036 | #line 2049 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5037 | { |
| 5038 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Dale Johannesen | 172f311 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 5039 | CurModule.ModuleDone(); |
| 5040 | CHECK_FOR_ERROR; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5041 | ;} |
| 5042 | break; |
| 5043 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5044 | case 213: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5045 | #line 2054 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 5046 | { |
| 5047 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 5048 | CurModule.ModuleDone(); |
| 5049 | CHECK_FOR_ERROR; |
| 5050 | ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5051 | break; |
| 5052 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5053 | case 216: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5054 | #line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 5055 | { CurFun.isDeclare = false; ;} |
| 5056 | break; |
| 5057 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5058 | case 217: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5059 | #line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5060 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5061 | CurFun.FunctionDone(); |
| 5062 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5063 | ;} |
| 5064 | break; |
| 5065 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5066 | case 218: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5067 | #line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5068 | { CurFun.isDeclare = true; ;} |
| 5069 | break; |
| 5070 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 5071 | case 219: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5072 | #line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5073 | { |
| 5074 | CHECK_FOR_ERROR |
| 5075 | ;} |
| 5076 | break; |
| 5077 | |
| 5078 | case 220: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5079 | #line 2074 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5080 | { |
| 5081 | CHECK_FOR_ERROR |
| 5082 | ;} |
| 5083 | break; |
| 5084 | |
| 5085 | case 221: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5086 | #line 2077 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5087 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5088 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5089 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5090 | // Eagerly resolve types. This is not an optimization, this is a |
| 5091 | // requirement that is due to the fact that we could have this: |
| 5092 | // |
| 5093 | // %list = type { %list * } |
| 5094 | // %list = type { %list * } ; repeated type decl |
| 5095 | // |
| 5096 | // If types are not resolved eagerly, then the two types will not be |
| 5097 | // determined to be the same type! |
| 5098 | // |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5099 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5100 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5101 | if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5102 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5103 | // If this is a named type that is not a redefinition, add it to the slot |
| 5104 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5105 | CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5106 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5107 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5108 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5109 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5110 | ;} |
| 5111 | break; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5112 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5113 | case 222: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5114 | #line 2101 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5115 | { |
| 5116 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); |
| 5117 | |
| 5118 | if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5119 | CHECK_FOR_ERROR |
| 5120 | // If this is a named type that is not a redefinition, add it to the slot |
| 5121 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5122 | CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5123 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5124 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5125 | ;} |
| 5126 | break; |
| 5127 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5128 | case 223: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5129 | #line 2113 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5130 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5131 | /* "Externally Visible" Linkage */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5132 | if ((yyvsp[(5) - (6)].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5133 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5134 | CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage, |
| 5135 | (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5136 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5137 | ;} |
| 5138 | break; |
| 5139 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5140 | case 224: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5141 | #line 2120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5142 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5143 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5144 | ;} |
| 5145 | break; |
| 5146 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5147 | case 225: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5148 | #line 2124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5149 | { |
| 5150 | if ((yyvsp[(6) - (7)].ConstVal) == 0) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5151 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5152 | CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5153 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5154 | ;} |
| 5155 | break; |
| 5156 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5157 | case 226: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5158 | #line 2129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5159 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5160 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5161 | ;} |
| 5162 | break; |
| 5163 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5164 | case 227: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5165 | #line 2133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5166 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5167 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5168 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); |
| 5169 | CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5170 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5171 | delete (yyvsp[(6) - (7)].TypeVal); |
| 5172 | ;} |
| 5173 | break; |
| 5174 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5175 | case 228: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5176 | #line 2139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5177 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5178 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5179 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5180 | ;} |
| 5181 | break; |
| 5182 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5183 | case 229: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5184 | #line 2143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5185 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5186 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5187 | if ((yyvsp[(1) - (5)].StrVal)) { |
| 5188 | Name = *(yyvsp[(1) - (5)].StrVal); |
| 5189 | delete (yyvsp[(1) - (5)].StrVal); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5190 | } |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5191 | if (Name.empty()) |
| 5192 | GEN_ERROR("Alias name cannot be empty"); |
| 5193 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5194 | Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5195 | if (Aliasee == 0) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5196 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5197 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5198 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee, |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5199 | CurModule.CurrentModule); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5200 | GA->setVisibility((yyvsp[(2) - (5)].Visibility)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5201 | InsertValue(GA, CurModule.Values); |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5202 | |
| 5203 | |
| 5204 | // If there was a forward reference of this alias, resolve it now. |
| 5205 | |
| 5206 | ValID ID; |
| 5207 | if (!Name.empty()) |
| 5208 | ID = ValID::createGlobalName(Name); |
| 5209 | else |
| 5210 | ID = ValID::createGlobalID(CurModule.Values.size()-1); |
| 5211 | |
| 5212 | if (GlobalValue *FWGV = |
| 5213 | CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { |
| 5214 | // Replace uses of the fwdref with the actual alias. |
| 5215 | FWGV->replaceAllUsesWith(GA); |
| 5216 | if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV)) |
| 5217 | GV->eraseFromParent(); |
| 5218 | else |
| 5219 | cast<Function>(FWGV)->eraseFromParent(); |
| 5220 | } |
| 5221 | ID.destroy(); |
| 5222 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5223 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5224 | ;} |
| 5225 | break; |
| 5226 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5227 | case 230: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5228 | #line 2183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5229 | { |
Anton Korobeynikov | 77d0f97 | 2007-04-25 14:29:12 +0000 | [diff] [blame] | 5230 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5231 | ;} |
| 5232 | break; |
| 5233 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5234 | case 231: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5235 | #line 2186 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5236 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5237 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5238 | ;} |
| 5239 | break; |
| 5240 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5241 | case 232: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5242 | #line 2192 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5243 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5244 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5245 | if (AsmSoFar.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5246 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5247 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5248 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal)); |
| 5249 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5250 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5251 | ;} |
| 5252 | break; |
| 5253 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5254 | case 233: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5255 | #line 2202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5256 | { |
| 5257 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); |
| 5258 | delete (yyvsp[(3) - (3)].StrVal); |
| 5259 | ;} |
| 5260 | break; |
| 5261 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5262 | case 234: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5263 | #line 2206 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5264 | { |
| 5265 | CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); |
| 5266 | delete (yyvsp[(3) - (3)].StrVal); |
| 5267 | ;} |
| 5268 | break; |
| 5269 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5270 | case 236: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5271 | #line 2213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5272 | { |
| 5273 | CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); |
| 5274 | delete (yyvsp[(3) - (3)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5275 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5276 | ;} |
| 5277 | break; |
| 5278 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5279 | case 237: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5280 | #line 2218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5281 | { |
| 5282 | CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); |
| 5283 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 1013b4d | 2007-07-31 14:41:17 +0000 | [diff] [blame] | 5284 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5285 | ;} |
| 5286 | break; |
| 5287 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5288 | case 238: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5289 | #line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5290 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5291 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5292 | ;} |
| 5293 | break; |
| 5294 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5295 | case 239: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5296 | #line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5297 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5298 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5299 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5300 | if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType()) |
| 5301 | GEN_ERROR("Argument types must be first-class"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5302 | ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal); |
| 5303 | (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList); |
| 5304 | (yyvsp[(1) - (5)].ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5305 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5306 | ;} |
| 5307 | break; |
| 5308 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5309 | case 240: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5310 | #line 2242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5311 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5312 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5313 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5314 | if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType()) |
| 5315 | GEN_ERROR("Argument types must be first-class"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5316 | ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal); |
| 5317 | (yyval.ArgList) = new ArgListType; |
| 5318 | (yyval.ArgList)->push_back(E); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5319 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5320 | ;} |
| 5321 | break; |
| 5322 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5323 | case 241: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5324 | #line 2253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5325 | { |
| 5326 | (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5327 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5328 | ;} |
| 5329 | break; |
| 5330 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5331 | case 242: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5332 | #line 2257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5333 | { |
| 5334 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5335 | struct ArgListEntry E; |
| 5336 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5337 | E.Name = 0; |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 5338 | E.Attrs = ParamAttr::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5339 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5340 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5341 | ;} |
| 5342 | break; |
| 5343 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5344 | case 243: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5345 | #line 2266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5346 | { |
| 5347 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5348 | struct ArgListEntry E; |
| 5349 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5350 | E.Name = 0; |
| 5351 | E.Attrs = ParamAttr::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5352 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5353 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5354 | ;} |
| 5355 | break; |
| 5356 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5357 | case 244: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5358 | #line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5359 | { |
| 5360 | (yyval.ArgList) = 0; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5361 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5362 | ;} |
| 5363 | break; |
| 5364 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5365 | case 245: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5366 | #line 2281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5367 | { |
| 5368 | std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); |
| 5369 | delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5370 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5371 | // Check the function result for abstractness if this is a define. We should |
| 5372 | // have no abstract types at this point |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5373 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal))) |
| 5374 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5375 | |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 5376 | if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal))) |
| 5377 | GEN_ERROR("Invalid result type for LLVM function"); |
| 5378 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5379 | std::vector<const Type*> ParamTypeList; |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5380 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5381 | if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) |
| 5382 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs))); |
| 5383 | if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments... |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5384 | unsigned index = 1; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5385 | for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5386 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5387 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 5388 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5389 | ParamTypeList.push_back(Ty); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5390 | if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None) |
| 5391 | Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5392 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5393 | } |
| 5394 | |
| 5395 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 5396 | if (isVarArg) ParamTypeList.pop_back(); |
| 5397 | |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5398 | PAListPtr PAL; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5399 | if (!Attrs.empty()) |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5400 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5401 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5402 | FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5403 | const PointerType *PFT = PointerType::getUnqual(FT); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5404 | delete (yyvsp[(2) - (10)].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5405 | |
| 5406 | ValID ID; |
| 5407 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5408 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5409 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5410 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5411 | } |
| 5412 | |
| 5413 | Function *Fn = 0; |
| 5414 | // See if this function was forward referenced. If so, recycle the object. |
| 5415 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 5416 | // Move the function to the end of the list, from whereever it was |
| 5417 | // previously inserted. |
| 5418 | Fn = cast<Function>(FWRef); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5419 | assert(Fn->getParamAttrs().isEmpty() && |
| 5420 | "Forward reference has parameter attributes!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5421 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 5422 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 5423 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5424 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5425 | if (Fn->getFunctionType() != FT ) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5426 | // The existing function doesn't have the same type. This is an overload |
| 5427 | // error. |
| 5428 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5429 | } else if (Fn->getParamAttrs() != PAL) { |
| 5430 | // The existing function doesn't have the same parameter attributes. |
| 5431 | // This is an overload error. |
| 5432 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5433 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5434 | // Neither the existing or the current function is a declaration and they |
| 5435 | // have the same name and same type. Clearly this is a redefinition. |
| 5436 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5437 | } else if (Fn->isDeclaration()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5438 | // Make sure to strip off any argument names so we can't get conflicts. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5439 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 5440 | AI != AE; ++AI) |
| 5441 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5442 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5443 | } else { // Not already defined? |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5444 | Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
| 5445 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5446 | InsertValue(Fn, CurModule.Values); |
| 5447 | } |
| 5448 | |
| 5449 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5450 | |
| 5451 | if (CurFun.isDeclare) { |
| 5452 | // If we have declaration, always overwrite linkage. This will allow us to |
| 5453 | // correctly handle cases, when pointer to function is passed as argument to |
| 5454 | // another function. |
| 5455 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 5456 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5457 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5458 | Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal)); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5459 | Fn->setParamAttrs(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5460 | Fn->setAlignment((yyvsp[(9) - (10)].UIntVal)); |
| 5461 | if ((yyvsp[(8) - (10)].StrVal)) { |
| 5462 | Fn->setSection(*(yyvsp[(8) - (10)].StrVal)); |
| 5463 | delete (yyvsp[(8) - (10)].StrVal); |
Gordon Henriksen | 80a75bf | 2007-12-10 03:18:06 +0000 | [diff] [blame] | 5464 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5465 | if ((yyvsp[(10) - (10)].StrVal)) { |
| 5466 | Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str()); |
| 5467 | delete (yyvsp[(10) - (10)].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 5468 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5469 | |
| 5470 | // Add all of the arguments we parsed to the function... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5471 | if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5472 | if (isVarArg) { // Nuke the last entry |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5473 | assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 && |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 5474 | "Not a varargs marker!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5475 | delete (yyvsp[(5) - (10)].ArgList)->back().Ty; |
| 5476 | (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5477 | } |
| 5478 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5479 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5480 | unsigned Idx = 1; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5481 | for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); |
| 5482 | I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5483 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5484 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5485 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5486 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5487 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5488 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5489 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5490 | delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5491 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5492 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5493 | ;} |
| 5494 | break; |
| 5495 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5496 | case 248: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5497 | #line 2411 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5498 | { |
| 5499 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5500 | |
| 5501 | // Make sure that we keep track of the linkage type even if there was a |
| 5502 | // previous "declare". |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5503 | (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); |
| 5504 | (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility)); |
| 5505 | ;} |
| 5506 | break; |
| 5507 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5508 | case 251: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5509 | #line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5510 | { |
| 5511 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5512 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5513 | ;} |
| 5514 | break; |
| 5515 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5516 | case 252: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5517 | #line 2427 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5518 | { |
| 5519 | CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); |
| 5520 | CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); |
| 5521 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5522 | CurFun.FunctionDone(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5523 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5524 | ;} |
| 5525 | break; |
| 5526 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5527 | case 253: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5528 | #line 2439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5529 | { |
| 5530 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5531 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5532 | ;} |
| 5533 | break; |
| 5534 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5535 | case 254: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5536 | #line 2443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5537 | { |
| 5538 | (yyval.BoolVal) = true; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5539 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5540 | ;} |
| 5541 | break; |
| 5542 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5543 | case 255: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5544 | #line 2448 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5545 | { // A reference to a direct constant |
| 5546 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5547 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5548 | ;} |
| 5549 | break; |
| 5550 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5551 | case 256: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5552 | #line 2452 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5553 | { |
| 5554 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5555 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5556 | ;} |
| 5557 | break; |
| 5558 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5559 | case 257: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5560 | #line 2456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5561 | { // Perhaps it's an FP constant? |
| 5562 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5563 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5564 | ;} |
| 5565 | break; |
| 5566 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5567 | case 258: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5568 | #line 2460 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5569 | { |
| 5570 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5571 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5572 | ;} |
| 5573 | break; |
| 5574 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5575 | case 259: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5576 | #line 2464 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5577 | { |
| 5578 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5579 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5580 | ;} |
| 5581 | break; |
| 5582 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5583 | case 260: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5584 | #line 2468 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5585 | { |
| 5586 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5587 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5588 | ;} |
| 5589 | break; |
| 5590 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5591 | case 261: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5592 | #line 2472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5593 | { |
| 5594 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5595 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5596 | ;} |
| 5597 | break; |
| 5598 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5599 | case 262: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5600 | #line 2476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5601 | { // A vector zero constant. |
| 5602 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5603 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5604 | ;} |
| 5605 | break; |
| 5606 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5607 | case 263: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5608 | #line 2480 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5609 | { // Nonempty unsized packed vector |
| 5610 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
| 5611 | int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5612 | |
| 5613 | if (!ETy->isInteger() && !ETy->isFloatingPoint()) |
| 5614 | GEN_ERROR("Invalid vector element type: " + ETy->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5615 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5616 | VectorType* pt = VectorType::get(ETy, NumElements); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5617 | PATypeHolder* PTy = new PATypeHolder( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5618 | HandleUpRefs( |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5619 | VectorType::get( |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5620 | ETy, |
| 5621 | NumElements) |
| 5622 | ) |
| 5623 | ); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5624 | |
| 5625 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5626 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5627 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5628 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5629 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5630 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5631 | } |
| 5632 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5633 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector))); |
| 5634 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5635 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5636 | ;} |
| 5637 | break; |
| 5638 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5639 | case 264: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5640 | #line 2508 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5641 | { |
| 5642 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5643 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5644 | ;} |
| 5645 | break; |
| 5646 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5647 | case 265: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5648 | #line 2512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5649 | { |
| 5650 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); |
| 5651 | delete (yyvsp[(3) - (5)].StrVal); |
| 5652 | delete (yyvsp[(5) - (5)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5653 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5654 | ;} |
| 5655 | break; |
| 5656 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5657 | case 266: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5658 | #line 2522 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5659 | { // Is it an integer reference...? |
| 5660 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5661 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5662 | ;} |
| 5663 | break; |
| 5664 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5665 | case 267: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5666 | #line 2526 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5667 | { |
| 5668 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5669 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5670 | ;} |
| 5671 | break; |
| 5672 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5673 | case 268: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5674 | #line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5675 | { // Is it a named reference...? |
| 5676 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5677 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5678 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5679 | ;} |
| 5680 | break; |
| 5681 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5682 | case 269: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5683 | #line 2535 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5684 | { // Is it a named reference...? |
| 5685 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5686 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5687 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5688 | ;} |
| 5689 | break; |
| 5690 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5691 | case 272: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5692 | #line 2548 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5693 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5694 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5695 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 5696 | (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); |
| 5697 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5698 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5699 | ;} |
| 5700 | break; |
| 5701 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5702 | case 273: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5703 | #line 2557 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5704 | { |
| 5705 | (yyval.ValueList) = new std::vector<Value *>(); |
| 5706 | (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5707 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5708 | ;} |
| 5709 | break; |
| 5710 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5711 | case 274: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5712 | #line 2562 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5713 | { |
| 5714 | ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5715 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5716 | ;} |
| 5717 | break; |
| 5718 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5719 | case 275: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5720 | #line 2567 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5721 | { |
| 5722 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5723 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5724 | ;} |
| 5725 | break; |
| 5726 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5727 | case 276: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5728 | #line 2571 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5729 | { // Do not allow functions with 0 basic blocks |
| 5730 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5731 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5732 | ;} |
| 5733 | break; |
| 5734 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5735 | case 277: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5736 | #line 2580 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5737 | { |
| 5738 | setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5739 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5740 | InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 5741 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 5742 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5743 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5744 | ;} |
| 5745 | break; |
| 5746 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5747 | case 278: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5748 | #line 2589 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5749 | { |
| 5750 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5751 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 5752 | if (CI2->getParent() == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5753 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); |
| 5754 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); |
| 5755 | (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5756 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5757 | ;} |
| 5758 | break; |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5759 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5760 | case 279: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5761 | #line 2598 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5762 | { // Empty space between instruction lists |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5763 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5764 | CHECK_FOR_ERROR |
| 5765 | ;} |
| 5766 | break; |
| 5767 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5768 | case 280: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5769 | #line 2602 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5770 | { // Labelled (named) basic block |
| 5771 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); |
| 5772 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5773 | CHECK_FOR_ERROR |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5774 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5775 | ;} |
| 5776 | break; |
| 5777 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5778 | case 281: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5779 | #line 2610 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5780 | { // Return with a result... |
| 5781 | ValueList &VL = *(yyvsp[(2) - (2)].ValueList); |
| 5782 | assert(!VL.empty() && "Invalid ret operands!"); |
| 5783 | (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size()); |
| 5784 | delete (yyvsp[(2) - (2)].ValueList); |
| 5785 | CHECK_FOR_ERROR |
| 5786 | ;} |
| 5787 | break; |
| 5788 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5789 | case 282: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5790 | #line 2617 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5791 | { // Return with no result... |
| 5792 | (yyval.TermInstVal) = ReturnInst::Create(); |
| 5793 | CHECK_FOR_ERROR |
| 5794 | ;} |
| 5795 | break; |
| 5796 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5797 | case 283: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5798 | #line 2621 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5799 | { // Unconditional Branch... |
| 5800 | BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); |
| 5801 | CHECK_FOR_ERROR |
| 5802 | (yyval.TermInstVal) = BranchInst::Create(tmpBB); |
| 5803 | ;} |
| 5804 | break; |
| 5805 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5806 | case 284: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5807 | #line 2626 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5808 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5809 | if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) |
| 5810 | GEN_ERROR("Branch condition must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5811 | BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 5812 | CHECK_FOR_ERROR |
| 5813 | BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); |
| 5814 | CHECK_FOR_ERROR |
| 5815 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); |
| 5816 | CHECK_FOR_ERROR |
| 5817 | (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal); |
| 5818 | ;} |
| 5819 | break; |
| 5820 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5821 | case 285: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5822 | #line 2637 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5823 | { |
| 5824 | Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); |
| 5825 | CHECK_FOR_ERROR |
| 5826 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 5827 | CHECK_FOR_ERROR |
| 5828 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); |
| 5829 | (yyval.TermInstVal) = S; |
| 5830 | |
| 5831 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), |
| 5832 | E = (yyvsp[(8) - (9)].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5833 | for (; I != E; ++I) { |
| 5834 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5835 | S->addCase(CI, I->second); |
| 5836 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5837 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5838 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5839 | delete (yyvsp[(8) - (9)].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5840 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5841 | ;} |
| 5842 | break; |
| 5843 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5844 | case 286: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5845 | #line 2656 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5846 | { |
| 5847 | Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5848 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5849 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5850 | CHECK_FOR_ERROR |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5851 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5852 | (yyval.TermInstVal) = S; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5853 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5854 | ;} |
| 5855 | break; |
| 5856 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5857 | case 287: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5858 | #line 2666 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5859 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 5860 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5861 | // Handle the short syntax |
| 5862 | const PointerType *PFTy = 0; |
| 5863 | const FunctionType *Ty = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5864 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5865 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5866 | // Pull out the types of all of the arguments... |
| 5867 | std::vector<const Type*> ParamTypes; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5868 | ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5869 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5870 | const Type *Ty = I->Val->getType(); |
| 5871 | if (Ty == Type::VoidTy) |
| 5872 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5873 | ParamTypes.push_back(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5874 | } |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 5875 | |
| 5876 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal))) |
| 5877 | GEN_ERROR("Invalid result type for LLVM function"); |
| 5878 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5879 | Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5880 | PFTy = PointerType::getUnqual(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5881 | } |
| 5882 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5883 | delete (yyvsp[(3) - (14)].TypeVal); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 5884 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5885 | Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5886 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5887 | BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5888 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5889 | BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5890 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5891 | |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5892 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5893 | if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) |
| 5894 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs))); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5895 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5896 | // Check the arguments |
| 5897 | ValueList Args; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5898 | if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5899 | // Make sure no arguments is a good thing! |
| 5900 | if (Ty->getNumParams() != 0) |
| 5901 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5902 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5903 | } else { // Has arguments? |
| 5904 | // Loop through FunctionType's arguments and ensure they are specified |
| 5905 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5906 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5907 | FunctionType::param_iterator E = Ty->param_end(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5908 | ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5909 | unsigned index = 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5910 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5911 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5912 | if (ArgI->Val->getType() != *I) |
| 5913 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5914 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5915 | Args.push_back(ArgI->Val); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5916 | if (ArgI->Attrs != ParamAttr::None) |
| 5917 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5918 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5919 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5920 | if (Ty->isVarArg()) { |
| 5921 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5922 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5923 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5924 | if (ArgI->Attrs != ParamAttr::None) |
| 5925 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5926 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5927 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5928 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5929 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5930 | |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5931 | PAListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5932 | if (!Attrs.empty()) |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5933 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5934 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5935 | // Create the InvokeInst |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 5936 | InvokeInst *II = InvokeInst::Create(V, Normal, Except, |
| 5937 | Args.begin(), Args.end()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5938 | II->setCallingConv((yyvsp[(2) - (14)].UIntVal)); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5939 | II->setParamAttrs(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5940 | (yyval.TermInstVal) = II; |
| 5941 | delete (yyvsp[(6) - (14)].ParamList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5942 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5943 | ;} |
| 5944 | break; |
| 5945 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5946 | case 288: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5947 | #line 2751 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5948 | { |
| 5949 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5950 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5951 | ;} |
| 5952 | break; |
| 5953 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5954 | case 289: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5955 | #line 2755 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5956 | { |
| 5957 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5958 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5959 | ;} |
| 5960 | break; |
| 5961 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5962 | case 290: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5963 | #line 2762 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5964 | { |
| 5965 | (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); |
| 5966 | Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5967 | CHECK_FOR_ERROR |
| 5968 | if (V == 0) |
| 5969 | GEN_ERROR("May only switch on a constant pool value"); |
| 5970 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5971 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5972 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5973 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5974 | ;} |
| 5975 | break; |
| 5976 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5977 | case 291: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5978 | #line 2773 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5979 | { |
| 5980 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5981 | Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5982 | CHECK_FOR_ERROR |
| 5983 | |
| 5984 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5985 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5986 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5987 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5988 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5989 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5990 | ;} |
| 5991 | break; |
| 5992 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5993 | case 292: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 5994 | #line 2786 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5995 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5996 | // Is this definition named?? if so, assign the name... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5997 | setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5998 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5999 | InsertValue((yyvsp[(2) - (2)].InstVal)); |
| 6000 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6001 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6002 | ;} |
| 6003 | break; |
| 6004 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6005 | case 293: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6006 | #line 2796 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6007 | { // Used for PHI nodes |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6008 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6009 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); |
| 6010 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 6011 | Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 6012 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6013 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6014 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6015 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6016 | delete (yyvsp[(1) - (6)].TypeVal); |
| 6017 | ;} |
| 6018 | break; |
| 6019 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6020 | case 294: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6021 | #line 2807 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6022 | { |
| 6023 | (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); |
| 6024 | Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6025 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6026 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6027 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6028 | (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6029 | ;} |
| 6030 | break; |
| 6031 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6032 | case 295: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6033 | #line 2817 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6034 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6035 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6036 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6037 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6038 | // Used for call and invoke instructions |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6039 | (yyval.ParamList) = new ParamList(); |
| 6040 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal)); |
| 6041 | (yyval.ParamList)->push_back(E); |
| 6042 | delete (yyvsp[(1) - (4)].TypeVal); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6043 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6044 | ;} |
| 6045 | break; |
| 6046 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6047 | case 296: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6048 | #line 2828 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6049 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6050 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 6051 | // Labels are only valid in ASMs |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6052 | (yyval.ParamList) = new ParamList(); |
| 6053 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal)); |
| 6054 | (yyval.ParamList)->push_back(E); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6055 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6056 | ;} |
| 6057 | break; |
| 6058 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6059 | case 297: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6060 | #line 2836 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6061 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6062 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6063 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6064 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6065 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 6066 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal)); |
| 6067 | (yyval.ParamList)->push_back(E); |
| 6068 | delete (yyvsp[(3) - (6)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6069 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6070 | ;} |
| 6071 | break; |
| 6072 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6073 | case 298: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6074 | #line 2846 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6075 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6076 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6077 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 6078 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
| 6079 | (yyval.ParamList)->push_back(E); |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 6080 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6081 | ;} |
| 6082 | break; |
| 6083 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6084 | case 299: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6085 | #line 2853 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6086 | { (yyval.ParamList) = new ParamList(); ;} |
| 6087 | break; |
| 6088 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6089 | case 300: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6090 | #line 2856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6091 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 6092 | break; |
| 6093 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6094 | case 301: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6095 | #line 2857 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6096 | { |
| 6097 | (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); |
| 6098 | (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6099 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6100 | ;} |
| 6101 | break; |
| 6102 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6103 | case 302: |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6104 | #line 2865 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
| 6105 | { |
| 6106 | (yyval.ConstantList) = new std::vector<unsigned>(); |
| 6107 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
| 6108 | GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6109 | (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val)); |
| 6110 | ;} |
| 6111 | break; |
| 6112 | |
| 6113 | case 303: |
| 6114 | #line 2871 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
| 6115 | { |
| 6116 | (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); |
| 6117 | if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) |
| 6118 | GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6119 | (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val)); |
| 6120 | CHECK_FOR_ERROR |
| 6121 | ;} |
| 6122 | break; |
| 6123 | |
| 6124 | case 304: |
| 6125 | #line 2880 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6126 | { |
| 6127 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6128 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6129 | ;} |
| 6130 | break; |
| 6131 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6132 | case 305: |
| 6133 | #line 2884 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6134 | { |
| 6135 | (yyval.BoolVal) = false; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6136 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6137 | ;} |
| 6138 | break; |
| 6139 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6140 | case 306: |
| 6141 | #line 2889 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6142 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6143 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6144 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6145 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && |
| 6146 | !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6147 | GEN_ERROR( |
| 6148 | "Arithmetic operator requires integer, FP, or packed operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6149 | Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6150 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6151 | Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6152 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6153 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6154 | if ((yyval.InstVal) == 0) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6155 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6156 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6157 | ;} |
| 6158 | break; |
| 6159 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6160 | case 307: |
| 6161 | #line 2905 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6162 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6163 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6164 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6165 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) { |
| 6166 | if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) || |
| 6167 | !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6168 | GEN_ERROR("Logical operator requires integral operands"); |
| 6169 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6170 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6171 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6172 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6173 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6174 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6175 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6176 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6177 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6178 | ;} |
| 6179 | break; |
| 6180 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6181 | case 308: |
| 6182 | #line 2922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6183 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6184 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6185 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6186 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6187 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6188 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6189 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6190 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6191 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6192 | (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6193 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6194 | GEN_ERROR("icmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6195 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6196 | ;} |
| 6197 | break; |
| 6198 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6199 | case 309: |
| 6200 | #line 2936 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6201 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6202 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6203 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6204 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6205 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6206 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6207 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6208 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6209 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6210 | (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6211 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6212 | GEN_ERROR("fcmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6213 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6214 | ;} |
| 6215 | break; |
| 6216 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6217 | case 310: |
| 6218 | #line 2950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6219 | { |
| 6220 | if (!UpRefs.empty()) |
| 6221 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6222 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6223 | GEN_ERROR("Scalar types not supported by vicmp instruction"); |
| 6224 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6225 | CHECK_FOR_ERROR |
| 6226 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6227 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6228 | (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6229 | if ((yyval.InstVal) == 0) |
| 6230 | GEN_ERROR("icmp operator returned null"); |
| 6231 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6232 | ;} |
| 6233 | break; |
| 6234 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6235 | case 311: |
| 6236 | #line 2964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6237 | { |
| 6238 | if (!UpRefs.empty()) |
| 6239 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6240 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6241 | GEN_ERROR("Scalar types not supported by vfcmp instruction"); |
| 6242 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6243 | CHECK_FOR_ERROR |
| 6244 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6245 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6246 | (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6247 | if ((yyval.InstVal) == 0) |
| 6248 | GEN_ERROR("fcmp operator returned null"); |
| 6249 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6250 | ;} |
| 6251 | break; |
| 6252 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6253 | case 312: |
| 6254 | #line 2978 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6255 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6256 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6257 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6258 | Value* Val = (yyvsp[(2) - (4)].ValueVal); |
| 6259 | const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get(); |
| 6260 | if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6261 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 6262 | Val->getType()->getDescription() + "' to '" + |
| 6263 | DestTy->getDescription() + "'"); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6264 | (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6265 | delete (yyvsp[(4) - (4)].TypeVal); |
| 6266 | ;} |
| 6267 | break; |
| 6268 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6269 | case 313: |
| 6270 | #line 2990 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6271 | { |
| 6272 | if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6273 | GEN_ERROR("select condition must be boolean"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6274 | if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6275 | GEN_ERROR("select value types should match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6276 | (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6277 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6278 | ;} |
| 6279 | break; |
| 6280 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6281 | case 314: |
| 6282 | #line 2998 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6283 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6284 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6285 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6286 | (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); |
| 6287 | delete (yyvsp[(4) - (4)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6288 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6289 | ;} |
| 6290 | break; |
| 6291 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6292 | case 315: |
| 6293 | #line 3005 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6294 | { |
| 6295 | if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6296 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6297 | (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6298 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6299 | ;} |
| 6300 | break; |
| 6301 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6302 | case 316: |
| 6303 | #line 3011 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6304 | { |
| 6305 | if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6306 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6307 | (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6308 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6309 | ;} |
| 6310 | break; |
| 6311 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6312 | case 317: |
| 6313 | #line 3017 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6314 | { |
| 6315 | if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6316 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6317 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6318 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6319 | ;} |
| 6320 | break; |
| 6321 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6322 | case 318: |
| 6323 | #line 3023 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6324 | { |
| 6325 | const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6326 | if (!Ty->isFirstClassType()) |
| 6327 | GEN_ERROR("PHI node operands must be of first class type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6328 | (yyval.InstVal) = PHINode::Create(Ty); |
| 6329 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); |
| 6330 | while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { |
| 6331 | if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6332 | GEN_ERROR("All elements of a PHI node must be of the same type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6333 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); |
| 6334 | (yyvsp[(2) - (2)].PHIList)->pop_front(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6335 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6336 | delete (yyvsp[(2) - (2)].PHIList); // Free the list... |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6337 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6338 | ;} |
| 6339 | break; |
| 6340 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6341 | case 319: |
| 6342 | #line 3039 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6343 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6344 | |
| 6345 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6346 | const PointerType *PFTy = 0; |
| 6347 | const FunctionType *Ty = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6348 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6349 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6350 | // Pull out the types of all of the arguments... |
| 6351 | std::vector<const Type*> ParamTypes; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6352 | ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6353 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6354 | const Type *Ty = I->Val->getType(); |
| 6355 | if (Ty == Type::VoidTy) |
| 6356 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6357 | ParamTypes.push_back(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6358 | } |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6359 | |
| 6360 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal))) |
| 6361 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6362 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6363 | Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6364 | PFTy = PointerType::getUnqual(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6365 | } |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6366 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6367 | Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6368 | CHECK_FOR_ERROR |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6369 | |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6370 | // Check for call to invalid intrinsic to avoid crashing later. |
| 6371 | if (Function *theF = dyn_cast<Function>(V)) { |
Reid Spencer | ed48de2 | 2007-04-16 22:02:23 +0000 | [diff] [blame] | 6372 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
Reid Spencer | 36fdde1 | 2007-04-16 20:35:38 +0000 | [diff] [blame] | 6373 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 6374 | !theF->getIntrinsicID(true)) |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6375 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 6376 | theF->getName() + "'"); |
| 6377 | } |
| 6378 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6379 | // Set up the ParamAttrs for the function |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6380 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6381 | if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) |
| 6382 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs))); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6383 | // Check the arguments |
| 6384 | ValueList Args; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6385 | if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6386 | // Make sure no arguments is a good thing! |
| 6387 | if (Ty->getNumParams() != 0) |
| 6388 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6389 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6390 | } else { // Has arguments? |
| 6391 | // Loop through FunctionType's arguments and ensure they are specified |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6392 | // correctly. Also, gather any parameter attributes. |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6393 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6394 | FunctionType::param_iterator E = Ty->param_end(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6395 | ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6396 | unsigned index = 1; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6397 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6398 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6399 | if (ArgI->Val->getType() != *I) |
| 6400 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6401 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6402 | Args.push_back(ArgI->Val); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6403 | if (ArgI->Attrs != ParamAttr::None) |
| 6404 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6405 | } |
| 6406 | if (Ty->isVarArg()) { |
| 6407 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6408 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6409 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6410 | if (ArgI->Attrs != ParamAttr::None) |
| 6411 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6412 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6413 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6414 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6415 | } |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6416 | |
| 6417 | // Finish off the ParamAttrs and check them |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6418 | PAListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6419 | if (!Attrs.empty()) |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6420 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6421 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6422 | // Create the call node |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6423 | CallInst *CI = CallInst::Create(V, Args.begin(), Args.end()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6424 | CI->setTailCall((yyvsp[(1) - (8)].BoolVal)); |
| 6425 | CI->setCallingConv((yyvsp[(2) - (8)].UIntVal)); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6426 | CI->setParamAttrs(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6427 | (yyval.InstVal) = CI; |
| 6428 | delete (yyvsp[(6) - (8)].ParamList); |
| 6429 | delete (yyvsp[(3) - (8)].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6430 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6431 | ;} |
| 6432 | break; |
| 6433 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6434 | case 320: |
| 6435 | #line 3128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6436 | { |
| 6437 | (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6438 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6439 | ;} |
| 6440 | break; |
| 6441 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6442 | case 321: |
| 6443 | #line 3133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6444 | { |
| 6445 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6446 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6447 | ;} |
| 6448 | break; |
| 6449 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6450 | case 322: |
| 6451 | #line 3137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6452 | { |
| 6453 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6454 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6455 | ;} |
| 6456 | break; |
| 6457 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6458 | case 323: |
| 6459 | #line 3144 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6460 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6461 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6462 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6463 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6464 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6465 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6466 | ;} |
| 6467 | break; |
| 6468 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6469 | case 324: |
| 6470 | #line 3151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6471 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6472 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6473 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6474 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6475 | GEN_ERROR("Malloc array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6476 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6477 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6478 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6479 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6480 | ;} |
| 6481 | break; |
| 6482 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6483 | case 325: |
| 6484 | #line 3161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6485 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6486 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6487 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6488 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6489 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6490 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6491 | ;} |
| 6492 | break; |
| 6493 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6494 | case 326: |
| 6495 | #line 3168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6496 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6497 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6498 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6499 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6500 | GEN_ERROR("Alloca array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6501 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6502 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6503 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6504 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6505 | ;} |
| 6506 | break; |
| 6507 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6508 | case 327: |
| 6509 | #line 3178 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6510 | { |
| 6511 | if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6512 | GEN_ERROR("Trying to free nonpointer type " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6513 | (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + ""); |
| 6514 | (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6515 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6516 | ;} |
| 6517 | break; |
| 6518 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6519 | case 328: |
| 6520 | #line 3186 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6521 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6522 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6523 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6524 | if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6525 | GEN_ERROR("Can't load from nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6526 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6527 | if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6528 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6529 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6530 | Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6531 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6532 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal)); |
| 6533 | delete (yyvsp[(3) - (5)].TypeVal); |
| 6534 | ;} |
| 6535 | break; |
| 6536 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6537 | case 329: |
| 6538 | #line 3200 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6539 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6540 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6541 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
| 6542 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6543 | if (!PT) |
| 6544 | GEN_ERROR("Can't store to a nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6545 | (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6546 | const Type *ElTy = PT->getElementType(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6547 | if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType()) |
| 6548 | GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6549 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 6550 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6551 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6552 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6553 | (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
| 6554 | delete (yyvsp[(5) - (7)].TypeVal); |
| 6555 | ;} |
| 6556 | break; |
| 6557 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6558 | case 330: |
| 6559 | #line 3217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6560 | { |
| 6561 | Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); |
| 6562 | if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) |
Devang Patel | 5a97097 | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6563 | GEN_ERROR("Invalid getresult operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6564 | (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val)); |
| 6565 | delete (yyvsp[(2) - (5)].TypeVal); |
Devang Patel | 5a97097 | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6566 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6567 | ;} |
| 6568 | break; |
| 6569 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6570 | case 331: |
| 6571 | #line 3225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6572 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6573 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6574 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 6575 | if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6576 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6577 | |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 6578 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end())) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6579 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6580 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 6581 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6582 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6583 | (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); |
| 6584 | delete (yyvsp[(2) - (4)].TypeVal); |
| 6585 | delete (yyvsp[(4) - (4)].ValueList); |
| 6586 | ;} |
| 6587 | break; |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6588 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6589 | case 332: |
| 6590 | #line 3240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6591 | { |
| 6592 | if (!UpRefs.empty()) |
| 6593 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 6594 | if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get())) |
| 6595 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 6596 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6597 | if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end())) |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6598 | GEN_ERROR("Invalid extractvalue indices for type '" + |
| 6599 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 6600 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
| 6601 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6602 | (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6603 | delete (yyvsp[(2) - (4)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6604 | delete (yyvsp[(4) - (4)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6605 | ;} |
| 6606 | break; |
| 6607 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6608 | case 333: |
| 6609 | #line 3255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6610 | { |
| 6611 | if (!UpRefs.empty()) |
| 6612 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); |
| 6613 | if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get())) |
| 6614 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 6615 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6616 | if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get()) |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6617 | GEN_ERROR("Invalid insertvalue indices for type '" + |
| 6618 | (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'"); |
| 6619 | Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal)); |
| 6620 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
| 6621 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6622 | (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6623 | delete (yyvsp[(2) - (7)].TypeVal); |
| 6624 | delete (yyvsp[(5) - (7)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6625 | delete (yyvsp[(7) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6626 | ;} |
| 6627 | break; |
| 6628 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6629 | |
| 6630 | /* Line 1267 of yacc.c. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6631 | #line 6632 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6632 | default: break; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6633 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6634 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 6635 | |
| 6636 | YYPOPSTACK (yylen); |
| 6637 | yylen = 0; |
| 6638 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6639 | |
| 6640 | *++yyvsp = yyval; |
| 6641 | |
| 6642 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6643 | /* Now `shift' the result of the reduction. Determine what state |
| 6644 | that goes to, based on the state we popped back to and the rule |
| 6645 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6646 | |
| 6647 | yyn = yyr1[yyn]; |
| 6648 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6649 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 6650 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6651 | yystate = yytable[yystate]; |
| 6652 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6653 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6654 | |
| 6655 | goto yynewstate; |
| 6656 | |
| 6657 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6658 | /*------------------------------------. |
| 6659 | | yyerrlab -- here on detecting error | |
| 6660 | `------------------------------------*/ |
| 6661 | yyerrlab: |
| 6662 | /* If not already recovering from an error, report this error. */ |
| 6663 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6664 | { |
| 6665 | ++yynerrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6666 | #if ! YYERROR_VERBOSE |
| 6667 | yyerror (YY_("syntax error")); |
| 6668 | #else |
| 6669 | { |
| 6670 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 6671 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 6672 | { |
| 6673 | YYSIZE_T yyalloc = 2 * yysize; |
| 6674 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 6675 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 6676 | if (yymsg != yymsgbuf) |
| 6677 | YYSTACK_FREE (yymsg); |
| 6678 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 6679 | if (yymsg) |
| 6680 | yymsg_alloc = yyalloc; |
| 6681 | else |
| 6682 | { |
| 6683 | yymsg = yymsgbuf; |
| 6684 | yymsg_alloc = sizeof yymsgbuf; |
| 6685 | } |
| 6686 | } |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6687 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6688 | if (0 < yysize && yysize <= yymsg_alloc) |
| 6689 | { |
| 6690 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 6691 | yyerror (yymsg); |
| 6692 | } |
| 6693 | else |
| 6694 | { |
| 6695 | yyerror (YY_("syntax error")); |
| 6696 | if (yysize != 0) |
| 6697 | goto yyexhaustedlab; |
| 6698 | } |
| 6699 | } |
| 6700 | #endif |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6701 | } |
| 6702 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6703 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6704 | |
| 6705 | if (yyerrstatus == 3) |
| 6706 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6707 | /* If just tried and failed to reuse look-ahead token after an |
| 6708 | error, discard it. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6709 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6710 | if (yychar <= YYEOF) |
| 6711 | { |
| 6712 | /* Return failure if at end of input. */ |
| 6713 | if (yychar == YYEOF) |
| 6714 | YYABORT; |
| 6715 | } |
| 6716 | else |
| 6717 | { |
| 6718 | yydestruct ("Error: discarding", |
| 6719 | yytoken, &yylval); |
| 6720 | yychar = YYEMPTY; |
| 6721 | } |
| 6722 | } |
| 6723 | |
| 6724 | /* Else will try to reuse look-ahead token after shifting the error |
| 6725 | token. */ |
| 6726 | goto yyerrlab1; |
| 6727 | |
| 6728 | |
| 6729 | /*---------------------------------------------------. |
| 6730 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 6731 | `---------------------------------------------------*/ |
| 6732 | yyerrorlab: |
| 6733 | |
| 6734 | /* Pacify compilers like GCC when the user code never invokes |
| 6735 | YYERROR and the label yyerrorlab therefore never appears in user |
| 6736 | code. */ |
| 6737 | if (/*CONSTCOND*/ 0) |
| 6738 | goto yyerrorlab; |
| 6739 | |
| 6740 | /* Do not reclaim the symbols of the rule which action triggered |
| 6741 | this YYERROR. */ |
| 6742 | YYPOPSTACK (yylen); |
| 6743 | yylen = 0; |
| 6744 | YY_STACK_PRINT (yyss, yyssp); |
| 6745 | yystate = *yyssp; |
| 6746 | goto yyerrlab1; |
| 6747 | |
| 6748 | |
| 6749 | /*-------------------------------------------------------------. |
| 6750 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 6751 | `-------------------------------------------------------------*/ |
| 6752 | yyerrlab1: |
| 6753 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 6754 | |
| 6755 | for (;;) |
| 6756 | { |
| 6757 | yyn = yypact[yystate]; |
| 6758 | if (yyn != YYPACT_NINF) |
| 6759 | { |
| 6760 | yyn += YYTERROR; |
| 6761 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 6762 | { |
| 6763 | yyn = yytable[yyn]; |
| 6764 | if (0 < yyn) |
| 6765 | break; |
| 6766 | } |
| 6767 | } |
| 6768 | |
| 6769 | /* Pop the current state because it cannot handle the error token. */ |
| 6770 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6771 | YYABORT; |
| 6772 | |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6773 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6774 | yydestruct ("Error: popping", |
| 6775 | yystos[yystate], yyvsp); |
| 6776 | YYPOPSTACK (1); |
| 6777 | yystate = *yyssp; |
| 6778 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6779 | } |
| 6780 | |
| 6781 | if (yyn == YYFINAL) |
| 6782 | YYACCEPT; |
| 6783 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6784 | *++yyvsp = yylval; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6785 | |
| 6786 | |
| 6787 | /* Shift the error token. */ |
| 6788 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6789 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6790 | yystate = yyn; |
| 6791 | goto yynewstate; |
| 6792 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6793 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6794 | /*-------------------------------------. |
| 6795 | | yyacceptlab -- YYACCEPT comes here. | |
| 6796 | `-------------------------------------*/ |
| 6797 | yyacceptlab: |
| 6798 | yyresult = 0; |
| 6799 | goto yyreturn; |
| 6800 | |
| 6801 | /*-----------------------------------. |
| 6802 | | yyabortlab -- YYABORT comes here. | |
| 6803 | `-----------------------------------*/ |
| 6804 | yyabortlab: |
| 6805 | yyresult = 1; |
| 6806 | goto yyreturn; |
| 6807 | |
| 6808 | #ifndef yyoverflow |
| 6809 | /*-------------------------------------------------. |
| 6810 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 6811 | `-------------------------------------------------*/ |
| 6812 | yyexhaustedlab: |
| 6813 | yyerror (YY_("memory exhausted")); |
| 6814 | yyresult = 2; |
| 6815 | /* Fall through. */ |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6816 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6817 | |
| 6818 | yyreturn: |
| 6819 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 6820 | yydestruct ("Cleanup: discarding lookahead", |
| 6821 | yytoken, &yylval); |
| 6822 | /* Do not reclaim the symbols of the rule which action triggered |
| 6823 | this YYABORT or YYACCEPT. */ |
| 6824 | YYPOPSTACK (yylen); |
| 6825 | YY_STACK_PRINT (yyss, yyssp); |
| 6826 | while (yyssp != yyss) |
| 6827 | { |
| 6828 | yydestruct ("Cleanup: popping", |
| 6829 | yystos[*yyssp], yyvsp); |
| 6830 | YYPOPSTACK (1); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6831 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6832 | #ifndef yyoverflow |
| 6833 | if (yyss != yyssa) |
| 6834 | YYSTACK_FREE (yyss); |
| 6835 | #endif |
| 6836 | #if YYERROR_VERBOSE |
| 6837 | if (yymsg != yymsgbuf) |
| 6838 | YYSTACK_FREE (yymsg); |
| 6839 | #endif |
| 6840 | /* Make sure YYID is used. */ |
| 6841 | return YYID (yyresult); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6842 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6843 | |
| 6844 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame^] | 6845 | #line 3274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6846 | |
| 6847 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6848 | // common code from the two 'RunVMAsmParser' functions |
| 6849 | static Module* RunParser(Module * M) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6850 | CurModule.CurrentModule = M; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6851 | // Check to make sure the parser succeeded |
| 6852 | if (yyparse()) { |
| 6853 | if (ParserResult) |
| 6854 | delete ParserResult; |
| 6855 | return 0; |
| 6856 | } |
| 6857 | |
Reid Spencer | 0d60b5a | 2007-03-30 01:37:39 +0000 | [diff] [blame] | 6858 | // Emit an error if there are any unresolved types left. |
| 6859 | if (!CurModule.LateResolveTypes.empty()) { |
| 6860 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 6861 | if (DID.Type == ValID::LocalName) { |
| 6862 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 6863 | } else { |
| 6864 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 6865 | } |
| 6866 | if (ParserResult) |
| 6867 | delete ParserResult; |
| 6868 | return 0; |
| 6869 | } |
| 6870 | |
| 6871 | // Emit an error if there are any unresolved values left. |
| 6872 | if (!CurModule.LateResolveValues.empty()) { |
| 6873 | Value *V = CurModule.LateResolveValues.back(); |
| 6874 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 6875 | CurModule.PlaceHolderInfo.find(V); |
| 6876 | |
| 6877 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 6878 | ValID &DID = I->second.first; |
| 6879 | if (DID.Type == ValID::LocalName) { |
| 6880 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 6881 | } else { |
| 6882 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 6883 | } |
| 6884 | if (ParserResult) |
| 6885 | delete ParserResult; |
| 6886 | return 0; |
| 6887 | } |
| 6888 | } |
| 6889 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6890 | // Check to make sure that parsing produced a result |
| 6891 | if (!ParserResult) |
| 6892 | return 0; |
| 6893 | |
| 6894 | // Reset ParserResult variable while saving its value for the result. |
| 6895 | Module *Result = ParserResult; |
| 6896 | ParserResult = 0; |
| 6897 | |
| 6898 | return Result; |
| 6899 | } |
| 6900 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6901 | void llvm::GenerateError(const std::string &message, int LineNo) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6902 | if (LineNo == -1) LineNo = LLLgetLineNo(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6903 | // TODO: column number in exception |
| 6904 | if (TheParseError) |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6905 | TheParseError->setError(LLLgetFilename(), message, LineNo); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6906 | TriggerError = 1; |
| 6907 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6908 | |
| 6909 | int yyerror(const char *ErrorMsg) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6910 | std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 6911 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6912 | if (yychar != YYEMPTY && yychar != 0) { |
| 6913 | errMsg += " while reading token: '"; |
| 6914 | errMsg += std::string(LLLgetTokenStart(), |
| 6915 | LLLgetTokenStart()+LLLgetTokenLength()) + "'"; |
| 6916 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6917 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6918 | return 0; |
| 6919 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6920 | |