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, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 142 | X86_SSECALLCC_TOK = 323, |
| 143 | DATALAYOUT = 324, |
| 144 | RET = 325, |
| 145 | BR = 326, |
| 146 | SWITCH = 327, |
| 147 | INVOKE = 328, |
| 148 | UNWIND = 329, |
| 149 | UNREACHABLE = 330, |
| 150 | ADD = 331, |
| 151 | SUB = 332, |
| 152 | MUL = 333, |
| 153 | UDIV = 334, |
| 154 | SDIV = 335, |
| 155 | FDIV = 336, |
| 156 | UREM = 337, |
| 157 | SREM = 338, |
| 158 | FREM = 339, |
| 159 | AND = 340, |
| 160 | OR = 341, |
| 161 | XOR = 342, |
| 162 | SHL = 343, |
| 163 | LSHR = 344, |
| 164 | ASHR = 345, |
| 165 | ICMP = 346, |
| 166 | FCMP = 347, |
| 167 | VICMP = 348, |
| 168 | VFCMP = 349, |
| 169 | EQ = 350, |
| 170 | NE = 351, |
| 171 | SLT = 352, |
| 172 | SGT = 353, |
| 173 | SLE = 354, |
| 174 | SGE = 355, |
| 175 | ULT = 356, |
| 176 | UGT = 357, |
| 177 | ULE = 358, |
| 178 | UGE = 359, |
| 179 | OEQ = 360, |
| 180 | ONE = 361, |
| 181 | OLT = 362, |
| 182 | OGT = 363, |
| 183 | OLE = 364, |
| 184 | OGE = 365, |
| 185 | ORD = 366, |
| 186 | UNO = 367, |
| 187 | UEQ = 368, |
| 188 | UNE = 369, |
| 189 | MALLOC = 370, |
| 190 | ALLOCA = 371, |
| 191 | FREE = 372, |
| 192 | LOAD = 373, |
| 193 | STORE = 374, |
| 194 | GETELEMENTPTR = 375, |
| 195 | TRUNC = 376, |
| 196 | ZEXT = 377, |
| 197 | SEXT = 378, |
| 198 | FPTRUNC = 379, |
| 199 | FPEXT = 380, |
| 200 | BITCAST = 381, |
| 201 | UITOFP = 382, |
| 202 | SITOFP = 383, |
| 203 | FPTOUI = 384, |
| 204 | FPTOSI = 385, |
| 205 | INTTOPTR = 386, |
| 206 | PTRTOINT = 387, |
| 207 | PHI_TOK = 388, |
| 208 | SELECT = 389, |
| 209 | VAARG = 390, |
| 210 | EXTRACTELEMENT = 391, |
| 211 | INSERTELEMENT = 392, |
| 212 | SHUFFLEVECTOR = 393, |
| 213 | GETRESULT = 394, |
| 214 | EXTRACTVALUE = 395, |
| 215 | INSERTVALUE = 396, |
| 216 | SIGNEXT = 397, |
| 217 | ZEROEXT = 398, |
| 218 | NORETURN = 399, |
| 219 | INREG = 400, |
| 220 | SRET = 401, |
| 221 | NOUNWIND = 402, |
| 222 | NOALIAS = 403, |
| 223 | BYVAL = 404, |
| 224 | NEST = 405, |
| 225 | READNONE = 406, |
| 226 | READONLY = 407, |
| 227 | GC = 408, |
| 228 | DEFAULT = 409, |
| 229 | HIDDEN = 410, |
| 230 | PROTECTED = 411 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 231 | }; |
| 232 | #endif |
| 233 | /* Tokens. */ |
| 234 | #define ESINT64VAL 258 |
| 235 | #define EUINT64VAL 259 |
| 236 | #define ESAPINTVAL 260 |
| 237 | #define EUAPINTVAL 261 |
| 238 | #define LOCALVAL_ID 262 |
| 239 | #define GLOBALVAL_ID 263 |
| 240 | #define FPVAL 264 |
| 241 | #define VOID 265 |
| 242 | #define INTTYPE 266 |
| 243 | #define FLOAT 267 |
| 244 | #define DOUBLE 268 |
| 245 | #define X86_FP80 269 |
| 246 | #define FP128 270 |
| 247 | #define PPC_FP128 271 |
| 248 | #define LABEL 272 |
| 249 | #define TYPE 273 |
| 250 | #define LOCALVAR 274 |
| 251 | #define GLOBALVAR 275 |
| 252 | #define LABELSTR 276 |
| 253 | #define STRINGCONSTANT 277 |
| 254 | #define ATSTRINGCONSTANT 278 |
| 255 | #define PCTSTRINGCONSTANT 279 |
| 256 | #define ZEROINITIALIZER 280 |
| 257 | #define TRUETOK 281 |
| 258 | #define FALSETOK 282 |
| 259 | #define BEGINTOK 283 |
| 260 | #define ENDTOK 284 |
| 261 | #define DECLARE 285 |
| 262 | #define DEFINE 286 |
| 263 | #define GLOBAL 287 |
| 264 | #define CONSTANT 288 |
| 265 | #define SECTION 289 |
| 266 | #define ALIAS 290 |
| 267 | #define VOLATILE 291 |
| 268 | #define THREAD_LOCAL 292 |
| 269 | #define TO 293 |
| 270 | #define DOTDOTDOT 294 |
| 271 | #define NULL_TOK 295 |
| 272 | #define UNDEF 296 |
| 273 | #define INTERNAL 297 |
| 274 | #define LINKONCE 298 |
| 275 | #define WEAK 299 |
| 276 | #define APPENDING 300 |
| 277 | #define DLLIMPORT 301 |
| 278 | #define DLLEXPORT 302 |
| 279 | #define EXTERN_WEAK 303 |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 280 | #define COMMON 304 |
| 281 | #define OPAQUE 305 |
| 282 | #define EXTERNAL 306 |
| 283 | #define TARGET 307 |
| 284 | #define TRIPLE 308 |
| 285 | #define ALIGN 309 |
| 286 | #define ADDRSPACE 310 |
| 287 | #define DEPLIBS 311 |
| 288 | #define CALL 312 |
| 289 | #define TAIL 313 |
| 290 | #define ASM_TOK 314 |
| 291 | #define MODULE 315 |
| 292 | #define SIDEEFFECT 316 |
| 293 | #define CC_TOK 317 |
| 294 | #define CCC_TOK 318 |
| 295 | #define FASTCC_TOK 319 |
| 296 | #define COLDCC_TOK 320 |
| 297 | #define X86_STDCALLCC_TOK 321 |
| 298 | #define X86_FASTCALLCC_TOK 322 |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 299 | #define X86_SSECALLCC_TOK 323 |
| 300 | #define DATALAYOUT 324 |
| 301 | #define RET 325 |
| 302 | #define BR 326 |
| 303 | #define SWITCH 327 |
| 304 | #define INVOKE 328 |
| 305 | #define UNWIND 329 |
| 306 | #define UNREACHABLE 330 |
| 307 | #define ADD 331 |
| 308 | #define SUB 332 |
| 309 | #define MUL 333 |
| 310 | #define UDIV 334 |
| 311 | #define SDIV 335 |
| 312 | #define FDIV 336 |
| 313 | #define UREM 337 |
| 314 | #define SREM 338 |
| 315 | #define FREM 339 |
| 316 | #define AND 340 |
| 317 | #define OR 341 |
| 318 | #define XOR 342 |
| 319 | #define SHL 343 |
| 320 | #define LSHR 344 |
| 321 | #define ASHR 345 |
| 322 | #define ICMP 346 |
| 323 | #define FCMP 347 |
| 324 | #define VICMP 348 |
| 325 | #define VFCMP 349 |
| 326 | #define EQ 350 |
| 327 | #define NE 351 |
| 328 | #define SLT 352 |
| 329 | #define SGT 353 |
| 330 | #define SLE 354 |
| 331 | #define SGE 355 |
| 332 | #define ULT 356 |
| 333 | #define UGT 357 |
| 334 | #define ULE 358 |
| 335 | #define UGE 359 |
| 336 | #define OEQ 360 |
| 337 | #define ONE 361 |
| 338 | #define OLT 362 |
| 339 | #define OGT 363 |
| 340 | #define OLE 364 |
| 341 | #define OGE 365 |
| 342 | #define ORD 366 |
| 343 | #define UNO 367 |
| 344 | #define UEQ 368 |
| 345 | #define UNE 369 |
| 346 | #define MALLOC 370 |
| 347 | #define ALLOCA 371 |
| 348 | #define FREE 372 |
| 349 | #define LOAD 373 |
| 350 | #define STORE 374 |
| 351 | #define GETELEMENTPTR 375 |
| 352 | #define TRUNC 376 |
| 353 | #define ZEXT 377 |
| 354 | #define SEXT 378 |
| 355 | #define FPTRUNC 379 |
| 356 | #define FPEXT 380 |
| 357 | #define BITCAST 381 |
| 358 | #define UITOFP 382 |
| 359 | #define SITOFP 383 |
| 360 | #define FPTOUI 384 |
| 361 | #define FPTOSI 385 |
| 362 | #define INTTOPTR 386 |
| 363 | #define PTRTOINT 387 |
| 364 | #define PHI_TOK 388 |
| 365 | #define SELECT 389 |
| 366 | #define VAARG 390 |
| 367 | #define EXTRACTELEMENT 391 |
| 368 | #define INSERTELEMENT 392 |
| 369 | #define SHUFFLEVECTOR 393 |
| 370 | #define GETRESULT 394 |
| 371 | #define EXTRACTVALUE 395 |
| 372 | #define INSERTVALUE 396 |
| 373 | #define SIGNEXT 397 |
| 374 | #define ZEROEXT 398 |
| 375 | #define NORETURN 399 |
| 376 | #define INREG 400 |
| 377 | #define SRET 401 |
| 378 | #define NOUNWIND 402 |
| 379 | #define NOALIAS 403 |
| 380 | #define BYVAL 404 |
| 381 | #define NEST 405 |
| 382 | #define READNONE 406 |
| 383 | #define READONLY 407 |
| 384 | #define GC 408 |
| 385 | #define DEFAULT 409 |
| 386 | #define HIDDEN 410 |
| 387 | #define PROTECTED 411 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | /* Copy the first part of user declarations. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 393 | #line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 394 | |
| 395 | #include "ParserInternals.h" |
| 396 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 397 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 398 | #include "llvm/Instructions.h" |
| 399 | #include "llvm/Module.h" |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 400 | #include "llvm/ValueSymbolTable.h" |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 401 | #include "llvm/AutoUpgrade.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 402 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 403 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 404 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 405 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 406 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 407 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 408 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 409 | #include <list> |
Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 410 | #include <map> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 411 | #include <utility> |
| 412 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 413 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 414 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 415 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 416 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 417 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 418 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 419 | // GenerateError are made from inside productions and they must simulate the |
| 420 | // previous exception behavior by exiting the production immediately. We have |
| 421 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 422 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 423 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 424 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 425 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 426 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 427 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 428 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 429 | int yylex(); // declaration" of xxx warnings. |
| 430 | int yyparse(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 431 | using namespace llvm; |
| 432 | |
| 433 | static Module *ParserResult; |
| 434 | |
| 435 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 436 | // relating to upreferences in the input stream. |
| 437 | // |
| 438 | //#define DEBUG_UPREFS 1 |
| 439 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 440 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 441 | #else |
| 442 | #define UR_OUT(X) |
| 443 | #endif |
| 444 | |
| 445 | #define YYERROR_VERBOSE 1 |
| 446 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 447 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 448 | |
| 449 | |
| 450 | // This contains info used when building the body of a function. It is |
| 451 | // destroyed when the function is completed. |
| 452 | // |
| 453 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 454 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 455 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 456 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 457 | |
| 458 | static struct PerModuleInfo { |
| 459 | Module *CurrentModule; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 460 | ValueList Values; // Module level numbered definitions |
| 461 | ValueList LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 462 | std::vector<PATypeHolder> Types; |
| 463 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 464 | |
| 465 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 466 | /// 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] | 467 | /// that we can resolve them later and print error messages as appropriate. |
| 468 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 469 | |
| 470 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 471 | // references to global values. Global values may be referenced before they |
| 472 | // are defined, and if so, the temporary object that they represent is held |
| 473 | // here. This is used for forward references of GlobalValues. |
| 474 | // |
| 475 | typedef std::map<std::pair<const PointerType *, |
| 476 | ValID>, GlobalValue*> GlobalRefsType; |
| 477 | GlobalRefsType GlobalRefs; |
| 478 | |
| 479 | void ModuleDone() { |
| 480 | // If we could not resolve some functions at function compilation time |
| 481 | // (calls to functions before they are defined), resolve them now... Types |
| 482 | // are resolved when the constant pool has been completely parsed. |
| 483 | // |
| 484 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 485 | if (TriggerError) |
| 486 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 487 | |
| 488 | // Check to make sure that all global value forward references have been |
| 489 | // resolved! |
| 490 | // |
| 491 | if (!GlobalRefs.empty()) { |
| 492 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 493 | |
| 494 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 495 | I != E; ++I) { |
| 496 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 497 | I->first.second.getName() + "\n"; |
| 498 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 499 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 500 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 501 | } |
| 502 | |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 503 | // Look for intrinsic functions and CallInst that need to be upgraded |
| 504 | for (Module::iterator FI = CurrentModule->begin(), |
| 505 | FE = CurrentModule->end(); FI != FE; ) |
| 506 | UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove |
| 507 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 508 | Values.clear(); // Clear out function local definitions |
| 509 | Types.clear(); |
| 510 | CurrentModule = 0; |
| 511 | } |
| 512 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 513 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 514 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 515 | // If not, just return null. |
| 516 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 517 | // Check to see if there is a forward reference to this global variable... |
| 518 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 519 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 520 | GlobalValue *Ret = 0; |
| 521 | if (I != GlobalRefs.end()) { |
| 522 | Ret = I->second; |
| 523 | GlobalRefs.erase(I); |
| 524 | } |
| 525 | return Ret; |
| 526 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 527 | |
| 528 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 529 | // If it isn't abstract, its resolved |
| 530 | const Type* Ty = PATy->get(); |
| 531 | if (!Ty->isAbstract()) |
| 532 | return false; |
| 533 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 534 | // we don't need to traverse that leg of the type. |
| 535 | std::vector<const Type*> WorkList, SeenList; |
| 536 | WorkList.push_back(Ty); |
| 537 | while (!WorkList.empty()) { |
| 538 | const Type* Ty = WorkList.back(); |
| 539 | SeenList.push_back(Ty); |
| 540 | WorkList.pop_back(); |
| 541 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 542 | // Check to see if this is an unresolved type |
| 543 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 544 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 545 | for ( ; I != E; ++I) { |
| 546 | if (I->second.get() == OpTy) |
| 547 | return true; |
| 548 | } |
| 549 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 550 | const Type* TheTy = SeqTy->getElementType(); |
| 551 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 552 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 553 | E = SeenList.end(); |
| 554 | for ( ; I != E; ++I) |
| 555 | if (*I == TheTy) |
| 556 | break; |
| 557 | if (I == E) |
| 558 | WorkList.push_back(TheTy); |
| 559 | } |
| 560 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 561 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 562 | const Type* TheTy = StrTy->getElementType(i); |
| 563 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 564 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 565 | E = SeenList.end(); |
| 566 | for ( ; I != E; ++I) |
| 567 | if (*I == TheTy) |
| 568 | break; |
| 569 | if (I == E) |
| 570 | WorkList.push_back(TheTy); |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | } |
| 575 | return false; |
| 576 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 577 | } CurModule; |
| 578 | |
| 579 | static struct PerFunctionInfo { |
| 580 | Function *CurrentFunction; // Pointer to current function being created |
| 581 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 582 | ValueList Values; // Keep track of #'d definitions |
| 583 | unsigned NextValNum; |
| 584 | ValueList LateResolveValues; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 585 | bool isDeclare; // Is this function a forward declararation? |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 586 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 587 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 588 | |
| 589 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 590 | /// track of them here. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 591 | std::map<ValID, BasicBlock*> BBForwardRefs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 592 | |
| 593 | inline PerFunctionInfo() { |
| 594 | CurrentFunction = 0; |
| 595 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 596 | Linkage = GlobalValue::ExternalLinkage; |
| 597 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 598 | } |
| 599 | |
| 600 | inline void FunctionStart(Function *M) { |
| 601 | CurrentFunction = M; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 602 | NextValNum = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 603 | } |
| 604 | |
| 605 | void FunctionDone() { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 606 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 607 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 608 | GenerateError("Undefined reference to label " + |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 609 | BBForwardRefs.begin()->second->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 610 | return; |
| 611 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 612 | |
| 613 | // Resolve all forward references now. |
| 614 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 615 | |
| 616 | Values.clear(); // Clear out function local definitions |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 617 | BBForwardRefs.clear(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 618 | CurrentFunction = 0; |
| 619 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 620 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 621 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 622 | } |
| 623 | } CurFun; // Info for the current function... |
| 624 | |
| 625 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 626 | |
| 627 | |
| 628 | //===----------------------------------------------------------------------===// |
| 629 | // Code to handle definitions of all the types |
| 630 | //===----------------------------------------------------------------------===// |
| 631 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 632 | static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
| 633 | // Things that have names or are void typed don't get slot numbers |
| 634 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
| 635 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 636 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 637 | // In the case of function values, we have to allow for the forward reference |
| 638 | // of basic blocks, which are included in the numbering. Consequently, we keep |
| 639 | // track of the next insertion location with NextValNum. When a BB gets |
| 640 | // inserted, it could change the size of the CurFun.Values vector. |
| 641 | if (&ValueTab == &CurFun.Values) { |
| 642 | if (ValueTab.size() <= CurFun.NextValNum) |
| 643 | ValueTab.resize(CurFun.NextValNum+1); |
| 644 | ValueTab[CurFun.NextValNum++] = V; |
| 645 | return; |
| 646 | } |
| 647 | // For all other lists, its okay to just tack it on the back of the vector. |
| 648 | ValueTab.push_back(V); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 649 | } |
| 650 | |
| 651 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 652 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 653 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 654 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 655 | if (D.Num < CurModule.Types.size()) |
| 656 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 657 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 658 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 659 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 660 | D.destroy(); // Free old strdup'd memory... |
| 661 | return N; |
| 662 | } |
| 663 | break; |
| 664 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 665 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 666 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 667 | } |
| 668 | |
| 669 | // If we reached here, we referenced either a symbol that we don't know about |
| 670 | // or an id number that hasn't been read yet. We may be referencing something |
| 671 | // forward, so just create an entry to be resolved later and get to it... |
| 672 | // |
| 673 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 674 | |
| 675 | |
| 676 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 677 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 678 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 679 | return 0; |
| 680 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 681 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 682 | return 0; |
| 683 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 684 | } |
| 685 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 686 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 687 | if (I != CurModule.LateResolveTypes.end()) |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 688 | return I->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 689 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 690 | Type *Typ = OpaqueType::get(); |
| 691 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 692 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 693 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 694 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 695 | // getExistingVal - Look up the value specified by the provided type and |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 696 | // the provided ValID. If the value exists and has already been defined, return |
| 697 | // it. Otherwise return null. |
| 698 | // |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 699 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 700 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 701 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 702 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 703 | return 0; |
| 704 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 705 | |
| 706 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 707 | case ValID::LocalID: { // Is it a numbered definition? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 708 | // Check that the number is within bounds. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 709 | if (D.Num >= CurFun.Values.size()) |
| 710 | return 0; |
| 711 | Value *Result = CurFun.Values[D.Num]; |
| 712 | if (Ty != Result->getType()) { |
| 713 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
| 714 | Result->getType()->getDescription() + "' does not match " |
| 715 | "expected type, '" + Ty->getDescription() + "'"); |
| 716 | return 0; |
| 717 | } |
| 718 | return Result; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 719 | } |
| 720 | case ValID::GlobalID: { // Is it a numbered definition? |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 721 | if (D.Num >= CurModule.Values.size()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 722 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 723 | Value *Result = CurModule.Values[D.Num]; |
| 724 | if (Ty != Result->getType()) { |
| 725 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
| 726 | Result->getType()->getDescription() + "' does not match " |
| 727 | "expected type, '" + Ty->getDescription() + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 728 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 729 | } |
| 730 | return Result; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 731 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 732 | |
| 733 | case ValID::LocalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 734 | if (!inFunctionScope()) |
| 735 | return 0; |
| 736 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 737 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 738 | if (N == 0) |
| 739 | return 0; |
| 740 | if (N->getType() != Ty) |
| 741 | return 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 742 | |
| 743 | D.destroy(); // Free old strdup'd memory... |
| 744 | return N; |
| 745 | } |
| 746 | case ValID::GlobalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 747 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 748 | Value *N = SymTab.lookup(D.getName()); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 749 | if (N == 0) |
| 750 | return 0; |
| 751 | if (N->getType() != Ty) |
| 752 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 753 | |
| 754 | D.destroy(); // Free old strdup'd memory... |
| 755 | return N; |
| 756 | } |
| 757 | |
| 758 | // Check to make sure that "Ty" is an integral type, and that our |
| 759 | // value will fit into the specified type... |
| 760 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 761 | if (!isa<IntegerType>(Ty) || |
| 762 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 763 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 764 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 765 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 766 | return 0; |
| 767 | } |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 768 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 769 | |
| 770 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 771 | if (isa<IntegerType>(Ty) && |
| 772 | ConstantInt::isValueValidForType(Ty, D.UConstPool64)) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 773 | return ConstantInt::get(Ty, D.UConstPool64); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 774 | |
| 775 | if (!isa<IntegerType>(Ty) || |
| 776 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
| 777 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
| 778 | "' is invalid or out of range for type '" + |
| 779 | Ty->getDescription() + "'"); |
| 780 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 781 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 782 | // This is really a signed reference. Transmogrify. |
| 783 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 784 | |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 785 | case ValID::ConstAPInt: // Is it an unsigned const pool reference? |
| 786 | if (!isa<IntegerType>(Ty)) { |
| 787 | GenerateError("Integral constant '" + D.getName() + |
| 788 | "' is invalid or out of range for type '" + |
| 789 | Ty->getDescription() + "'"); |
| 790 | return 0; |
| 791 | } |
| 792 | |
| 793 | { |
| 794 | APSInt Tmp = *D.ConstPoolInt; |
| 795 | Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits()); |
| 796 | return ConstantInt::get(Tmp); |
| 797 | } |
| 798 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 799 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 800 | if (!Ty->isFloatingPoint() || |
| 801 | !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 802 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 803 | return 0; |
| 804 | } |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 805 | // 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] | 806 | // as double. Fix this here. Long double does not need this. |
| 807 | if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && |
| 808 | Ty==Type::FloatTy) |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 809 | D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 810 | return ConstantFP::get(*D.ConstPoolFP); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 811 | |
| 812 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 813 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 814 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 815 | return 0; |
| 816 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 817 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 818 | |
| 819 | case ValID::ConstUndefVal: // Is it an undef value? |
| 820 | return UndefValue::get(Ty); |
| 821 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 822 | case ValID::ConstZeroVal: // Is it a zero value? |
| 823 | return Constant::getNullValue(Ty); |
| 824 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 825 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 826 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 827 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 828 | return 0; |
| 829 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 830 | return D.ConstantValue; |
| 831 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 832 | case ValID::InlineAsmVal: { // Inline asm expression |
| 833 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 834 | const FunctionType *FTy = |
| 835 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 836 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 837 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 838 | return 0; |
| 839 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 840 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 841 | D.IAD->HasSideEffects); |
| 842 | D.destroy(); // Free InlineAsmDescriptor. |
| 843 | return IA; |
| 844 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 845 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 846 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 847 | return 0; |
| 848 | } // End of switch |
| 849 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 850 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 851 | return 0; |
| 852 | } |
| 853 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 854 | // getVal - This function is identical to getExistingVal, except that if a |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 855 | // value is not already defined, it "improvises" by creating a placeholder var |
| 856 | // that looks and acts just like the requested variable. When the value is |
| 857 | // defined later, all uses of the placeholder variable are replaced with the |
| 858 | // real thing. |
| 859 | // |
| 860 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 861 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 862 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 863 | return 0; |
| 864 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 865 | |
| 866 | // See if the value has already been defined. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 867 | Value *V = getExistingVal(Ty, ID); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 868 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 869 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 870 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 871 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 872 | GenerateError("Invalid use of a non-first-class type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 873 | return 0; |
| 874 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 875 | |
| 876 | // If we reached here, we referenced either a symbol that we don't know about |
| 877 | // or an id number that hasn't been read yet. We may be referencing something |
| 878 | // forward, so just create an entry to be resolved later and get to it... |
| 879 | // |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 880 | switch (ID.Type) { |
| 881 | case ValID::GlobalName: |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 882 | case ValID::GlobalID: { |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 883 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 884 | if (!PTy) { |
| 885 | GenerateError("Invalid type for reference to global" ); |
| 886 | return 0; |
| 887 | } |
| 888 | const Type* ElTy = PTy->getElementType(); |
| 889 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 890 | V = Function::Create(FTy, GlobalValue::ExternalLinkage); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 891 | else |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 892 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", |
| 893 | (Module*)0, false, PTy->getAddressSpace()); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 894 | break; |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 895 | } |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 896 | default: |
| 897 | V = new Argument(Ty); |
| 898 | } |
| 899 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 900 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 901 | // to recycle these things?? |
| 902 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 903 | LLLgetLineNo()))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 904 | |
| 905 | if (inFunctionScope()) |
| 906 | InsertValue(V, CurFun.LateResolveValues); |
| 907 | else |
| 908 | InsertValue(V, CurModule.LateResolveValues); |
| 909 | return V; |
| 910 | } |
| 911 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 912 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 913 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 914 | static BasicBlock *defineBBVal(const ValID &ID) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 915 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 916 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 917 | BasicBlock *BB = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 918 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 919 | // First, see if this was forward referenced |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 920 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 921 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 922 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 923 | BB = BBI->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 924 | // The forward declaration could have been inserted anywhere in the |
| 925 | // function: insert it into the correct place now. |
| 926 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 927 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 928 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 929 | // We're about to erase the entry, save the key so we can clean it up. |
| 930 | ValID Tmp = BBI->first; |
| 931 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 932 | // Erase the forward ref from the map as its no longer "forward" |
| 933 | CurFun.BBForwardRefs.erase(ID); |
| 934 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 935 | // The key has been removed from the map but so we don't want to leave |
| 936 | // strdup'd memory around so destroy it too. |
| 937 | Tmp.destroy(); |
| 938 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 939 | // If its a numbered definition, bump the number and set the BB value. |
| 940 | if (ID.Type == ValID::LocalID) { |
| 941 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 942 | InsertValue(BB); |
| 943 | } |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 944 | } else { |
| 945 | // We haven't seen this BB before and its first mention is a definition. |
| 946 | // Just create it and return it. |
| 947 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 948 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 949 | if (ID.Type == ValID::LocalID) { |
| 950 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 951 | InsertValue(BB); |
| 952 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 953 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 954 | |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 955 | ID.destroy(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 956 | return BB; |
| 957 | } |
| 958 | |
| 959 | /// getBBVal - get an existing BB value or create a forward reference for it. |
| 960 | /// |
| 961 | static BasicBlock *getBBVal(const ValID &ID) { |
| 962 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 963 | |
| 964 | BasicBlock *BB = 0; |
| 965 | |
| 966 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 967 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 968 | BB = BBI->second; |
| 969 | } if (ID.Type == ValID::LocalName) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 970 | std::string Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 971 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 972 | if (N) { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 973 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 974 | BB = cast<BasicBlock>(N); |
| 975 | else |
| 976 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 977 | N->getType()->getDescription() + "'"); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 978 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 979 | } else if (ID.Type == ValID::LocalID) { |
| 980 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 981 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 982 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 983 | else |
| 984 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 985 | "' is actually of type '"+ |
| 986 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 987 | } |
| 988 | } else { |
| 989 | GenerateError("Illegal label reference " + ID.getName()); |
| 990 | return 0; |
| 991 | } |
| 992 | |
| 993 | // If its already been defined, return it now. |
| 994 | if (BB) { |
| 995 | ID.destroy(); // Free strdup'd memory. |
| 996 | return BB; |
| 997 | } |
| 998 | |
| 999 | // Otherwise, this block has not been seen before, create it. |
| 1000 | std::string Name; |
| 1001 | if (ID.Type == ValID::LocalName) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1002 | Name = ID.getName(); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 1003 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1004 | |
| 1005 | // Insert it in the forward refs map. |
| 1006 | CurFun.BBForwardRefs[ID] = BB; |
| 1007 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1008 | return BB; |
| 1009 | } |
| 1010 | |
| 1011 | |
| 1012 | //===----------------------------------------------------------------------===// |
| 1013 | // Code to handle forward references in instructions |
| 1014 | //===----------------------------------------------------------------------===// |
| 1015 | // |
| 1016 | // This code handles the late binding needed with statements that reference |
| 1017 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 1018 | // a loop body. |
| 1019 | // |
| 1020 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 1021 | // and back patchs after we are done. |
| 1022 | // |
| 1023 | |
| 1024 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 1025 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 1026 | // defs now... |
| 1027 | // |
| 1028 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1029 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1030 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1031 | while (!LateResolvers.empty()) { |
| 1032 | Value *V = LateResolvers.back(); |
| 1033 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1034 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1035 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 1036 | CurModule.PlaceHolderInfo.find(V); |
| 1037 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1038 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1039 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1040 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1041 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 1042 | if (TriggerError) |
| 1043 | return; |
| 1044 | if (TheRealValue) { |
| 1045 | V->replaceAllUsesWith(TheRealValue); |
| 1046 | delete V; |
| 1047 | CurModule.PlaceHolderInfo.erase(PHI); |
| 1048 | } else if (FutureLateResolvers) { |
| 1049 | // Functions have their unresolved items forwarded to the module late |
| 1050 | // resolver table |
| 1051 | InsertValue(V, *FutureLateResolvers); |
| 1052 | } else { |
| 1053 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 1054 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 1055 | "' of type '" + V->getType()->getDescription() + "'", |
| 1056 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1057 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1058 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1059 | GenerateError("Reference to an invalid definition: #" + |
| 1060 | itostr(DID.Num) + " of type '" + |
| 1061 | V->getType()->getDescription() + "'", |
| 1062 | PHI->second.second); |
| 1063 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1064 | } |
| 1065 | } |
| 1066 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1067 | LateResolvers.clear(); |
| 1068 | } |
| 1069 | |
| 1070 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 1071 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 1072 | // refering to the number can be resolved. Do this now. |
| 1073 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1074 | static void ResolveTypeTo(std::string *Name, const Type *ToTy) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1075 | ValID D; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1076 | if (Name) |
| 1077 | D = ValID::createLocalName(*Name); |
| 1078 | else |
| 1079 | D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1080 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1081 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1082 | CurModule.LateResolveTypes.find(D); |
| 1083 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1084 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1085 | CurModule.LateResolveTypes.erase(I); |
| 1086 | } |
| 1087 | } |
| 1088 | |
| 1089 | // setValueName - Set the specified value to the name given. The name may be |
| 1090 | // null potentially, in which case this is a noop. The string passed in is |
| 1091 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1092 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1093 | static void setValueName(Value *V, std::string *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1094 | if (!NameStr) return; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1095 | std::string Name(*NameStr); // Copy string |
| 1096 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1097 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1098 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1099 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1100 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1101 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1102 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1103 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1104 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1105 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1106 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1107 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1108 | return; |
| 1109 | } |
| 1110 | |
| 1111 | // Set the name. |
| 1112 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1113 | } |
| 1114 | |
| 1115 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1116 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1117 | static GlobalVariable * |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1118 | ParseGlobalVariable(std::string *NameStr, |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1119 | GlobalValue::LinkageTypes Linkage, |
| 1120 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1121 | bool isConstantGlobal, const Type *Ty, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1122 | Constant *Initializer, bool IsThreadLocal, |
| 1123 | unsigned AddressSpace = 0) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1124 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1125 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1126 | return 0; |
| 1127 | } |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1128 | if (Ty == Type::LabelTy) { |
| 1129 | GenerateError("Cannot declare global vars of label type"); |
| 1130 | return 0; |
| 1131 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1132 | |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1133 | const PointerType *PTy = PointerType::get(Ty, AddressSpace); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1134 | |
| 1135 | std::string Name; |
| 1136 | if (NameStr) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1137 | Name = *NameStr; // Copy string |
| 1138 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1139 | } |
| 1140 | |
| 1141 | // See if this global value was forward referenced. If so, recycle the |
| 1142 | // object. |
| 1143 | ValID ID; |
| 1144 | if (!Name.empty()) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1145 | ID = ValID::createGlobalName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1146 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1147 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1148 | } |
| 1149 | |
| 1150 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1151 | // Move the global to the end of the list, from whereever it was |
| 1152 | // previously inserted. |
| 1153 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1154 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1155 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1156 | GV->setInitializer(Initializer); |
| 1157 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1158 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1159 | GV->setConstant(isConstantGlobal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1160 | GV->setThreadLocal(IsThreadLocal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1161 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1162 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1163 | } |
| 1164 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1165 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1166 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1167 | // if the global we're parsing has an initializer (is a definition) and |
| 1168 | // has external linkage. |
| 1169 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1170 | // If there is already a global with external linkage with this name |
| 1171 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1172 | // If we allow this GVar to get created, it will be renamed in the |
| 1173 | // symbol table because it conflicts with an existing GVar. We can't |
| 1174 | // allow redefinition of GVars whose linking indicates that their name |
| 1175 | // must stay the same. Issue the error. |
| 1176 | GenerateError("Redefinition of global variable named '" + Name + |
| 1177 | "' of type '" + Ty->getDescription() + "'"); |
| 1178 | return 0; |
| 1179 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1180 | } |
| 1181 | |
| 1182 | // Otherwise there is no existing GV to use, create one now. |
| 1183 | GlobalVariable *GV = |
| 1184 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1185 | CurModule.CurrentModule, IsThreadLocal, AddressSpace); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1186 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1187 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1188 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1189 | } |
| 1190 | |
| 1191 | // setTypeName - Set the specified type to the name given. The name may be |
| 1192 | // null potentially, in which case this is a noop. The string passed in is |
| 1193 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1194 | // |
| 1195 | // This function returns true if the type has already been defined, but is |
| 1196 | // allowed to be redefined in the specified context. If the name is a new name |
| 1197 | // for the type plane, it is inserted and false is returned. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1198 | static bool setTypeName(const Type *T, std::string *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1199 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1200 | if (NameStr == 0) return false; |
| 1201 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1202 | std::string Name(*NameStr); // Copy string |
| 1203 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1204 | |
| 1205 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1206 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1207 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1208 | return false; |
| 1209 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1210 | |
| 1211 | // Set the type name, checking for conflicts as we do so. |
| 1212 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1213 | |
| 1214 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1215 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1216 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1217 | |
| 1218 | // There is only one case where this is allowed: when we are refining an |
| 1219 | // opaque type. In this case, Existing will be an opaque type. |
| 1220 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1221 | // We ARE replacing an opaque type! |
| 1222 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1223 | return true; |
| 1224 | } |
| 1225 | |
| 1226 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1227 | // the redefinition is identical to the original. This will be so if |
| 1228 | // Existing and T point to the same Type object. In this one case we |
| 1229 | // allow the equivalent redefinition. |
| 1230 | if (Existing == T) return true; // Yes, it's equal. |
| 1231 | |
| 1232 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1233 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1234 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1235 | } |
| 1236 | |
| 1237 | return false; |
| 1238 | } |
| 1239 | |
| 1240 | //===----------------------------------------------------------------------===// |
| 1241 | // Code for handling upreferences in type names... |
| 1242 | // |
| 1243 | |
| 1244 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1245 | // |
| 1246 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1247 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1248 | E) != Ty->subtype_end(); |
| 1249 | } |
| 1250 | |
| 1251 | namespace { |
| 1252 | struct UpRefRecord { |
| 1253 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1254 | // this type is resolved. |
| 1255 | unsigned NestingLevel; |
| 1256 | |
| 1257 | // LastContainedTy - This is the type at the current binding level for the |
| 1258 | // type. Every time we reduce the nesting level, this gets updated. |
| 1259 | const Type *LastContainedTy; |
| 1260 | |
| 1261 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1262 | // represented with. |
| 1263 | OpaqueType *UpRefTy; |
| 1264 | |
| 1265 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1266 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1267 | }; |
| 1268 | } |
| 1269 | |
| 1270 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1271 | static std::vector<UpRefRecord> UpRefs; |
| 1272 | |
| 1273 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1274 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1275 | /// currently active types. For each type, if the up reference is contained in |
| 1276 | /// the newly completed type, we decrement the level count. When the level |
| 1277 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1278 | /// thus we can complete the cycle. |
| 1279 | /// |
| 1280 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1281 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1282 | // nothing to resolve here. |
| 1283 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1284 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1285 | PATypeHolder Ty(ty); |
| 1286 | UR_OUT("Type '" << Ty->getDescription() << |
| 1287 | "' newly formed. Resolving upreferences.\n" << |
| 1288 | UpRefs.size() << " upreferences active!\n"); |
| 1289 | |
| 1290 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1291 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1292 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1293 | // this variable. |
| 1294 | OpaqueType *TypeToResolve = 0; |
| 1295 | |
| 1296 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1297 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1298 | << UpRefs[i].second->getDescription() << ") = " |
| 1299 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1300 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1301 | // Decrement level of upreference |
| 1302 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1303 | UpRefs[i].LastContainedTy = Ty; |
| 1304 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1305 | if (Level == 0) { // Upreference should be resolved! |
| 1306 | if (!TypeToResolve) { |
| 1307 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1308 | } else { |
| 1309 | UR_OUT(" * Resolving upreference for " |
| 1310 | << UpRefs[i].second->getDescription() << "\n"; |
| 1311 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1312 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1313 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1314 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1315 | } |
| 1316 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1317 | --i; // Do not skip the next element... |
| 1318 | } |
| 1319 | } |
| 1320 | } |
| 1321 | |
| 1322 | if (TypeToResolve) { |
| 1323 | UR_OUT(" * Resolving upreference for " |
| 1324 | << UpRefs[i].second->getDescription() << "\n"; |
| 1325 | std::string OldName = TypeToResolve->getDescription()); |
| 1326 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1327 | } |
| 1328 | |
| 1329 | return Ty; |
| 1330 | } |
| 1331 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1332 | //===----------------------------------------------------------------------===// |
| 1333 | // RunVMAsmParser - Define an interface to this parser |
| 1334 | //===----------------------------------------------------------------------===// |
| 1335 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1336 | static Module* RunParser(Module * M); |
| 1337 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 1338 | Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { |
| 1339 | InitLLLexer(MB); |
| 1340 | Module *M = RunParser(new Module(LLLgetFilename())); |
| 1341 | FreeLexer(); |
| 1342 | return M; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1343 | } |
| 1344 | |
| 1345 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1346 | |
| 1347 | /* Enabling traces. */ |
| 1348 | #ifndef YYDEBUG |
| 1349 | # define YYDEBUG 0 |
| 1350 | #endif |
| 1351 | |
| 1352 | /* Enabling verbose error messages. */ |
| 1353 | #ifdef YYERROR_VERBOSE |
| 1354 | # undef YYERROR_VERBOSE |
| 1355 | # define YYERROR_VERBOSE 1 |
| 1356 | #else |
| 1357 | # define YYERROR_VERBOSE 0 |
| 1358 | #endif |
| 1359 | |
| 1360 | /* Enabling the token table. */ |
| 1361 | #ifndef YYTOKEN_TABLE |
| 1362 | # define YYTOKEN_TABLE 0 |
| 1363 | #endif |
| 1364 | |
| 1365 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 1366 | typedef union YYSTYPE |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1367 | #line 967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1368 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1369 | llvm::Module *ModuleVal; |
| 1370 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1371 | llvm::BasicBlock *BasicBlockVal; |
| 1372 | llvm::TerminatorInst *TermInstVal; |
| 1373 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1374 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1375 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1376 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1377 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1378 | llvm::PATypeHolder *TypeVal; |
| 1379 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1380 | std::vector<llvm::Value*> *ValueList; |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1381 | std::vector<unsigned> *ConstantList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1382 | llvm::ArgListType *ArgList; |
| 1383 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1384 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 1385 | llvm::ParamList *ParamList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1386 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1387 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1388 | std::list<std::pair<llvm::Value*, |
| 1389 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1390 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1391 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1392 | |
| 1393 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1394 | llvm::GlobalValue::VisibilityTypes Visibility; |
Dale Johannesen | 222ebf7 | 2008-02-19 21:40:51 +0000 | [diff] [blame] | 1395 | llvm::ParameterAttributes ParamAttrs; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1396 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1397 | int64_t SInt64Val; |
| 1398 | uint64_t UInt64Val; |
| 1399 | int SIntVal; |
| 1400 | unsigned UIntVal; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 1401 | llvm::APFloat *FPVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1402 | bool BoolVal; |
| 1403 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1404 | std::string *StrVal; // This memory must be deleted |
| 1405 | llvm::ValID ValIDVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1406 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1407 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1408 | llvm::Instruction::TermOps TermOpVal; |
| 1409 | llvm::Instruction::MemoryOps MemOpVal; |
| 1410 | llvm::Instruction::CastOps CastOpVal; |
| 1411 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1412 | llvm::ICmpInst::Predicate IPredicate; |
| 1413 | llvm::FCmpInst::Predicate FPredicate; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1414 | } |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 1415 | /* Line 193 of yacc.c. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1416 | #line 1417 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1417 | YYSTYPE; |
| 1418 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1419 | # define YYSTYPE_IS_DECLARED 1 |
| 1420 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1421 | #endif |
| 1422 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1423 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1424 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1425 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1426 | |
| 1427 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1428 | /* Line 216 of yacc.c. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1429 | #line 1430 "llvmAsmParser.tab.c" |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1430 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1431 | #ifdef short |
| 1432 | # undef short |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1433 | #endif |
| 1434 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1435 | #ifdef YYTYPE_UINT8 |
| 1436 | typedef YYTYPE_UINT8 yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1437 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1438 | typedef unsigned char yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1439 | #endif |
| 1440 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1441 | #ifdef YYTYPE_INT8 |
| 1442 | typedef YYTYPE_INT8 yytype_int8; |
| 1443 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 1444 | || defined __cplusplus || defined _MSC_VER) |
| 1445 | typedef signed char yytype_int8; |
| 1446 | #else |
| 1447 | typedef short int yytype_int8; |
| 1448 | #endif |
| 1449 | |
| 1450 | #ifdef YYTYPE_UINT16 |
| 1451 | typedef YYTYPE_UINT16 yytype_uint16; |
| 1452 | #else |
| 1453 | typedef unsigned short int yytype_uint16; |
| 1454 | #endif |
| 1455 | |
| 1456 | #ifdef YYTYPE_INT16 |
| 1457 | typedef YYTYPE_INT16 yytype_int16; |
| 1458 | #else |
| 1459 | typedef short int yytype_int16; |
| 1460 | #endif |
| 1461 | |
| 1462 | #ifndef YYSIZE_T |
| 1463 | # ifdef __SIZE_TYPE__ |
| 1464 | # define YYSIZE_T __SIZE_TYPE__ |
| 1465 | # elif defined size_t |
| 1466 | # define YYSIZE_T size_t |
| 1467 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1468 | || defined __cplusplus || defined _MSC_VER) |
| 1469 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1470 | # define YYSIZE_T size_t |
| 1471 | # else |
| 1472 | # define YYSIZE_T unsigned int |
| 1473 | # endif |
| 1474 | #endif |
| 1475 | |
| 1476 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 1477 | |
| 1478 | #ifndef YY_ |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 1479 | # if defined YYENABLE_NLS && YYENABLE_NLS |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1480 | # if ENABLE_NLS |
| 1481 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1482 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1483 | # endif |
| 1484 | # endif |
| 1485 | # ifndef YY_ |
| 1486 | # define YY_(msgid) msgid |
| 1487 | # endif |
| 1488 | #endif |
| 1489 | |
| 1490 | /* Suppress unused-variable warnings by "using" E. */ |
| 1491 | #if ! defined lint || defined __GNUC__ |
| 1492 | # define YYUSE(e) ((void) (e)) |
| 1493 | #else |
| 1494 | # define YYUSE(e) /* empty */ |
| 1495 | #endif |
| 1496 | |
| 1497 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 1498 | #ifndef lint |
| 1499 | # define YYID(n) (n) |
| 1500 | #else |
| 1501 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1502 | || defined __cplusplus || defined _MSC_VER) |
| 1503 | static int |
| 1504 | YYID (int i) |
| 1505 | #else |
| 1506 | static int |
| 1507 | YYID (i) |
| 1508 | int i; |
| 1509 | #endif |
| 1510 | { |
| 1511 | return i; |
| 1512 | } |
| 1513 | #endif |
| 1514 | |
| 1515 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 1516 | |
| 1517 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1518 | |
| 1519 | # ifdef YYSTACK_USE_ALLOCA |
| 1520 | # if YYSTACK_USE_ALLOCA |
| 1521 | # ifdef __GNUC__ |
| 1522 | # define YYSTACK_ALLOC __builtin_alloca |
| 1523 | # elif defined __BUILTIN_VA_ARG_INCR |
| 1524 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 1525 | # elif defined _AIX |
| 1526 | # define YYSTACK_ALLOC __alloca |
| 1527 | # elif defined _MSC_VER |
| 1528 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 1529 | # define alloca _alloca |
| 1530 | # else |
| 1531 | # define YYSTACK_ALLOC alloca |
| 1532 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1533 | || defined __cplusplus || defined _MSC_VER) |
| 1534 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1535 | # ifndef _STDLIB_H |
| 1536 | # define _STDLIB_H 1 |
| 1537 | # endif |
| 1538 | # endif |
| 1539 | # endif |
| 1540 | # endif |
| 1541 | # endif |
| 1542 | |
| 1543 | # ifdef YYSTACK_ALLOC |
| 1544 | /* Pacify GCC's `empty if-body' warning. */ |
| 1545 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
| 1546 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1547 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1548 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1549 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1550 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1551 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 1552 | # endif |
| 1553 | # else |
| 1554 | # define YYSTACK_ALLOC YYMALLOC |
| 1555 | # define YYSTACK_FREE YYFREE |
| 1556 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1557 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 1558 | # endif |
| 1559 | # if (defined __cplusplus && ! defined _STDLIB_H \ |
| 1560 | && ! ((defined YYMALLOC || defined malloc) \ |
| 1561 | && (defined YYFREE || defined free))) |
| 1562 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1563 | # ifndef _STDLIB_H |
| 1564 | # define _STDLIB_H 1 |
| 1565 | # endif |
| 1566 | # endif |
| 1567 | # ifndef YYMALLOC |
| 1568 | # define YYMALLOC malloc |
| 1569 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1570 | || defined __cplusplus || defined _MSC_VER) |
| 1571 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1572 | # endif |
| 1573 | # endif |
| 1574 | # ifndef YYFREE |
| 1575 | # define YYFREE free |
| 1576 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1577 | || defined __cplusplus || defined _MSC_VER) |
| 1578 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1579 | # endif |
| 1580 | # endif |
| 1581 | # endif |
| 1582 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 1583 | |
| 1584 | |
| 1585 | #if (! defined yyoverflow \ |
| 1586 | && (! defined __cplusplus \ |
| 1587 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 1588 | |
| 1589 | /* A type that is properly aligned for any stack member. */ |
| 1590 | union yyalloc |
| 1591 | { |
| 1592 | yytype_int16 yyss; |
| 1593 | YYSTYPE yyvs; |
| 1594 | }; |
| 1595 | |
| 1596 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1597 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1598 | |
| 1599 | /* The size of an array large to enough to hold all stacks, each with |
| 1600 | N elements. */ |
| 1601 | # define YYSTACK_BYTES(N) \ |
| 1602 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 1603 | + YYSTACK_GAP_MAXIMUM) |
| 1604 | |
| 1605 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1606 | not overlap. */ |
| 1607 | # ifndef YYCOPY |
| 1608 | # if defined __GNUC__ && 1 < __GNUC__ |
| 1609 | # define YYCOPY(To, From, Count) \ |
| 1610 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1611 | # else |
| 1612 | # define YYCOPY(To, From, Count) \ |
| 1613 | do \ |
| 1614 | { \ |
| 1615 | YYSIZE_T yyi; \ |
| 1616 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1617 | (To)[yyi] = (From)[yyi]; \ |
| 1618 | } \ |
| 1619 | while (YYID (0)) |
| 1620 | # endif |
| 1621 | # endif |
| 1622 | |
| 1623 | /* Relocate STACK from its old location to the new one. The |
| 1624 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1625 | elements in the stack, and YYPTR gives the new location of the |
| 1626 | stack. Advance YYPTR to a properly aligned location for the next |
| 1627 | stack. */ |
| 1628 | # define YYSTACK_RELOCATE(Stack) \ |
| 1629 | do \ |
| 1630 | { \ |
| 1631 | YYSIZE_T yynewbytes; \ |
| 1632 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1633 | Stack = &yyptr->Stack; \ |
| 1634 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1635 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1636 | } \ |
| 1637 | while (YYID (0)) |
| 1638 | |
| 1639 | #endif |
| 1640 | |
| 1641 | /* YYFINAL -- State number of the termination state. */ |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1642 | #define YYFINAL 44 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1643 | /* YYLAST -- Last index in YYTABLE. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1644 | #define YYLAST 2381 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1645 | |
| 1646 | /* YYNTOKENS -- Number of terminals. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1647 | #define YYNTOKENS 171 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1648 | /* YYNNTS -- Number of nonterminals. */ |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1649 | #define YYNNTS 86 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1650 | /* YYNRULES -- Number of rules. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1651 | #define YYNRULES 343 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1652 | /* YYNRULES -- Number of states. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1653 | #define YYNSTATES 702 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1654 | |
| 1655 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1656 | #define YYUNDEFTOK 2 |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1657 | #define YYMAXUTOK 411 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1658 | |
| 1659 | #define YYTRANSLATE(YYX) \ |
| 1660 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1661 | |
| 1662 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1663 | static const yytype_uint8 yytranslate[] = |
| 1664 | { |
| 1665 | 0, 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, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1669 | 157, 158, 161, 2, 160, 2, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1670 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1671 | 166, 159, 167, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1672 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1673 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1674 | 2, 163, 162, 165, 2, 2, 2, 2, 2, 170, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1675 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1676 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1677 | 164, 2, 2, 168, 2, 169, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1678 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1679 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1680 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1681 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1682 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1683 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1684 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1685 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1686 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1687 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1688 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1689 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1690 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1691 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1692 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1693 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1694 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1695 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1696 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1697 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1698 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1699 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1700 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1701 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1702 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1703 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1704 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1705 | 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1706 | 155, 156 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1707 | }; |
| 1708 | |
| 1709 | #if YYDEBUG |
| 1710 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1711 | YYRHS. */ |
| 1712 | static const yytype_uint16 yyprhs[] = |
| 1713 | { |
| 1714 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1715 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1716 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1717 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1718 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1719 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1720 | 119, 121, 123, 125, 127, 129, 130, 135, 136, 139, |
| 1721 | 140, 142, 144, 146, 147, 150, 152, 154, 156, 158, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1722 | 160, 162, 164, 166, 168, 169, 171, 173, 175, 176, |
| 1723 | 178, 180, 181, 183, 185, 187, 189, 190, 192, 194, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1724 | 195, 197, 199, 201, 203, 205, 207, 210, 212, 214, |
| 1725 | 216, 218, 220, 222, 224, 226, 228, 231, 232, 235, |
| 1726 | 237, 239, 241, 243, 245, 247, 248, 251, 252, 255, |
| 1727 | 256, 259, 260, 264, 267, 268, 270, 271, 275, 277, |
| 1728 | 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, |
| 1729 | 302, 304, 307, 313, 319, 325, 331, 335, 338, 344, |
| 1730 | 349, 352, 354, 356, 358, 362, 364, 368, 370, 371, |
| 1731 | 373, 377, 382, 386, 390, 395, 400, 404, 411, 417, |
| 1732 | 420, 423, 426, 429, 432, 435, 438, 441, 444, 447, |
| 1733 | 450, 453, 460, 466, 475, 482, 489, 497, 505, 513, |
| 1734 | 521, 528, 537, 546, 552, 560, 564, 566, 568, 570, |
| 1735 | 572, 573, 576, 583, 585, 586, 588, 591, 592, 596, |
| 1736 | 597, 601, 605, 609, 613, 614, 623, 624, 634, 635, |
| 1737 | 645, 651, 654, 658, 660, 664, 668, 672, 676, 678, |
| 1738 | 679, 685, 689, 691, 695, 697, 698, 709, 711, 713, |
| 1739 | 718, 720, 722, 725, 729, 730, 732, 734, 736, 738, |
| 1740 | 740, 742, 744, 746, 748, 750, 752, 756, 760, 763, |
| 1741 | 766, 770, 773, 779, 784, 786, 792, 794, 796, 798, |
| 1742 | 800, 802, 804, 807, 809, 813, 816, 819, 823, 826, |
| 1743 | 827, 829, 832, 835, 839, 849, 859, 868, 883, 885, |
| 1744 | 887, 894, 900, 903, 910, 918, 923, 928, 935, 942, |
| 1745 | 943, 944, 948, 951, 955, 958, 960, 966, 972, 979, |
| 1746 | 986, 993, 1000, 1005, 1012, 1017, 1022, 1029, 1036, 1039, |
| 1747 | 1048, 1050, 1052, 1053, 1057, 1064, 1068, 1075, 1078, 1084, |
| 1748 | 1092, 1098, 1103, 1108 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1749 | }; |
| 1750 | |
| 1751 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1752 | static const yytype_int16 yyrhs[] = |
| 1753 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1754 | 217, 0, -1, 76, -1, 77, -1, 78, -1, 79, |
| 1755 | -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, |
| 1756 | -1, 88, -1, 89, -1, 90, -1, 85, -1, 86, |
| 1757 | -1, 87, -1, 121, -1, 122, -1, 123, -1, 124, |
| 1758 | -1, 125, -1, 126, -1, 127, -1, 128, -1, 129, |
| 1759 | -1, 130, -1, 131, -1, 132, -1, 95, -1, 96, |
| 1760 | -1, 97, -1, 98, -1, 99, -1, 100, -1, 101, |
| 1761 | -1, 102, -1, 103, -1, 104, -1, 105, -1, 106, |
| 1762 | -1, 107, -1, 108, -1, 109, -1, 110, -1, 111, |
| 1763 | -1, 112, -1, 113, -1, 114, -1, 101, -1, 102, |
| 1764 | -1, 103, -1, 104, -1, 26, -1, 27, -1, 11, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1765 | -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1766 | -1, 19, -1, 22, -1, 24, -1, 179, -1, -1, |
| 1767 | 55, 157, 4, 158, -1, -1, 179, 159, -1, -1, |
| 1768 | 20, -1, 23, -1, 185, -1, -1, 183, 159, -1, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1769 | 42, -1, 44, -1, 43, -1, 45, -1, 47, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1770 | 49, -1, 46, -1, 48, -1, 51, -1, -1, 154, |
| 1771 | -1, 155, -1, 156, -1, -1, 46, -1, 48, -1, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1772 | -1, 42, -1, 43, -1, 44, -1, 47, -1, -1, |
| 1773 | 44, -1, 42, -1, -1, 63, -1, 64, -1, 65, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1774 | -1, 66, -1, 67, -1, 68, -1, 62, 4, -1, |
| 1775 | 143, -1, 122, -1, 142, -1, 123, -1, 145, -1, |
| 1776 | 146, -1, 148, -1, 149, -1, 150, -1, 54, 4, |
| 1777 | -1, -1, 194, 193, -1, 144, -1, 147, -1, 143, |
| 1778 | -1, 142, -1, 151, -1, 152, -1, -1, 196, 195, |
| 1779 | -1, -1, 153, 22, -1, -1, 54, 4, -1, -1, |
| 1780 | 160, 54, 4, -1, 34, 22, -1, -1, 200, -1, |
| 1781 | -1, 160, 203, 202, -1, 200, -1, 54, 4, -1, |
| 1782 | 11, -1, 12, -1, 13, -1, 16, -1, 15, -1, |
| 1783 | 14, -1, 17, -1, 50, -1, 204, -1, 205, 181, |
| 1784 | 161, -1, 239, -1, 162, 4, -1, 205, 157, 209, |
| 1785 | 158, 196, -1, 10, 157, 209, 158, 196, -1, 163, |
| 1786 | 4, 164, 205, 165, -1, 166, 4, 164, 205, 167, |
| 1787 | -1, 168, 210, 169, -1, 168, 169, -1, 166, 168, |
| 1788 | 210, 169, 167, -1, 166, 168, 169, 167, -1, 205, |
| 1789 | 194, -1, 205, -1, 10, -1, 206, -1, 208, 160, |
| 1790 | 206, -1, 208, -1, 208, 160, 39, -1, 39, -1, |
| 1791 | -1, 205, -1, 210, 160, 205, -1, 205, 163, 213, |
| 1792 | 165, -1, 205, 163, 165, -1, 205, 170, 22, -1, |
| 1793 | 205, 166, 213, 167, -1, 205, 168, 213, 169, -1, |
| 1794 | 205, 168, 169, -1, 205, 166, 168, 213, 169, 167, |
| 1795 | -1, 205, 166, 168, 169, 167, -1, 205, 40, -1, |
| 1796 | 205, 41, -1, 205, 239, -1, 205, 212, -1, 205, |
| 1797 | 25, -1, 177, 3, -1, 177, 5, -1, 177, 4, |
| 1798 | -1, 177, 6, -1, 11, 26, -1, 11, 27, -1, |
| 1799 | 178, 9, -1, 174, 157, 211, 38, 205, 158, -1, |
| 1800 | 120, 157, 211, 251, 158, -1, 134, 157, 211, 160, |
| 1801 | 211, 160, 211, 158, -1, 172, 157, 211, 160, 211, |
| 1802 | 158, -1, 173, 157, 211, 160, 211, 158, -1, 91, |
| 1803 | 175, 157, 211, 160, 211, 158, -1, 92, 176, 157, |
| 1804 | 211, 160, 211, 158, -1, 93, 175, 157, 211, 160, |
| 1805 | 211, 158, -1, 94, 176, 157, 211, 160, 211, 158, |
| 1806 | -1, 136, 157, 211, 160, 211, 158, -1, 137, 157, |
| 1807 | 211, 160, 211, 160, 211, 158, -1, 138, 157, 211, |
| 1808 | 160, 211, 160, 211, 158, -1, 140, 157, 211, 252, |
| 1809 | 158, -1, 141, 157, 211, 160, 211, 252, 158, -1, |
| 1810 | 213, 160, 211, -1, 211, -1, 32, -1, 33, -1, |
| 1811 | 37, -1, -1, 207, 239, -1, 126, 157, 216, 38, |
| 1812 | 205, 158, -1, 218, -1, -1, 219, -1, 218, 219, |
| 1813 | -1, -1, 31, 220, 235, -1, -1, 30, 221, 236, |
| 1814 | -1, 60, 59, 225, -1, 182, 18, 205, -1, 182, |
| 1815 | 18, 10, -1, -1, 184, 188, 215, 214, 211, 181, |
| 1816 | 222, 202, -1, -1, 184, 186, 188, 215, 214, 211, |
| 1817 | 181, 223, 202, -1, -1, 184, 187, 188, 215, 214, |
| 1818 | 205, 181, 224, 202, -1, 184, 188, 35, 191, 216, |
| 1819 | -1, 52, 226, -1, 56, 159, 227, -1, 22, -1, |
| 1820 | 53, 159, 22, -1, 69, 159, 22, -1, 163, 228, |
| 1821 | 165, -1, 228, 160, 22, -1, 22, -1, -1, 229, |
| 1822 | 160, 205, 194, 180, -1, 205, 194, 180, -1, 229, |
| 1823 | -1, 229, 160, 39, -1, 39, -1, -1, 192, 207, |
| 1824 | 183, 157, 230, 158, 196, 201, 198, 197, -1, 28, |
| 1825 | -1, 168, -1, 190, 188, 231, 232, -1, 29, -1, |
| 1826 | 169, -1, 243, 234, -1, 189, 188, 231, -1, -1, |
| 1827 | 61, -1, 3, -1, 4, -1, 5, -1, 6, -1, |
| 1828 | 9, -1, 26, -1, 27, -1, 40, -1, 41, -1, |
| 1829 | 25, -1, 166, 213, 167, -1, 163, 213, 165, -1, |
| 1830 | 163, 165, -1, 170, 22, -1, 168, 213, 169, -1, |
| 1831 | 168, 169, -1, 166, 168, 213, 169, 167, -1, 166, |
| 1832 | 168, 169, 167, -1, 212, -1, 59, 237, 22, 160, |
| 1833 | 22, -1, 7, -1, 8, -1, 179, -1, 183, -1, |
| 1834 | 239, -1, 238, -1, 205, 240, -1, 241, -1, 242, |
| 1835 | 160, 241, -1, 243, 244, -1, 233, 244, -1, 245, |
| 1836 | 182, 246, -1, 245, 248, -1, -1, 21, -1, 70, |
| 1837 | 242, -1, 70, 10, -1, 71, 17, 240, -1, 71, |
| 1838 | 11, 240, 160, 17, 240, 160, 17, 240, -1, 72, |
| 1839 | 177, 240, 160, 17, 240, 163, 247, 165, -1, 72, |
| 1840 | 177, 240, 160, 17, 240, 163, 165, -1, 73, 192, |
| 1841 | 207, 240, 157, 250, 158, 196, 38, 17, 240, 74, |
| 1842 | 17, 240, -1, 74, -1, 75, -1, 247, 177, 238, |
| 1843 | 160, 17, 240, -1, 177, 238, 160, 17, 240, -1, |
| 1844 | 182, 254, -1, 205, 163, 240, 160, 240, 165, -1, |
| 1845 | 249, 160, 163, 240, 160, 240, 165, -1, 205, 194, |
| 1846 | 240, 194, -1, 17, 194, 240, 194, -1, 250, 160, |
| 1847 | 205, 194, 240, 194, -1, 250, 160, 17, 194, 240, |
| 1848 | 194, -1, -1, -1, 251, 160, 241, -1, 160, 4, |
| 1849 | -1, 252, 160, 4, -1, 58, 57, -1, 57, -1, |
| 1850 | 172, 205, 240, 160, 240, -1, 173, 205, 240, 160, |
| 1851 | 240, -1, 91, 175, 205, 240, 160, 240, -1, 92, |
| 1852 | 176, 205, 240, 160, 240, -1, 93, 175, 205, 240, |
| 1853 | 160, 240, -1, 94, 176, 205, 240, 160, 240, -1, |
| 1854 | 174, 241, 38, 205, -1, 134, 241, 160, 241, 160, |
| 1855 | 241, -1, 135, 241, 160, 205, -1, 136, 241, 160, |
| 1856 | 241, -1, 137, 241, 160, 241, 160, 241, -1, 138, |
| 1857 | 241, 160, 241, 160, 241, -1, 133, 249, -1, 253, |
| 1858 | 192, 207, 240, 157, 250, 158, 196, -1, 256, -1, |
| 1859 | 36, -1, -1, 115, 205, 199, -1, 115, 205, 160, |
| 1860 | 11, 240, 199, -1, 116, 205, 199, -1, 116, 205, |
| 1861 | 160, 11, 240, 199, -1, 117, 241, -1, 255, 118, |
| 1862 | 205, 240, 199, -1, 255, 119, 241, 160, 205, 240, |
| 1863 | 199, -1, 139, 205, 240, 160, 4, -1, 120, 205, |
| 1864 | 240, 251, -1, 140, 205, 240, 252, -1, 141, 205, |
| 1865 | 240, 160, 205, 240, 252, -1 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1866 | }; |
| 1867 | |
| 1868 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1869 | static const yytype_uint16 yyrline[] = |
| 1870 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1871 | 0, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, |
| 1872 | 1133, 1134, 1134, 1134, 1134, 1134, 1134, 1135, 1135, 1135, |
| 1873 | 1135, 1135, 1135, 1136, 1136, 1136, 1136, 1136, 1136, 1139, |
| 1874 | 1139, 1140, 1140, 1141, 1141, 1142, 1142, 1143, 1143, 1147, |
| 1875 | 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1151, 1151, 1152, |
| 1876 | 1152, 1153, 1153, 1154, 1155, 1160, 1161, 1161, 1161, 1161, |
| 1877 | 1161, 1163, 1163, 1163, 1164, 1164, 1166, 1167, 1171, 1175, |
| 1878 | 1180, 1180, 1182, 1183, 1188, 1194, 1195, 1196, 1197, 1198, |
| 1879 | 1199, 1203, 1204, 1205, 1209, 1210, 1211, 1212, 1216, 1217, |
| 1880 | 1218, 1222, 1223, 1224, 1225, 1226, 1230, 1231, 1232, 1235, |
| 1881 | 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1249, 1250, 1251, |
| 1882 | 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1262, 1263, 1268, |
| 1883 | 1269, 1270, 1271, 1272, 1273, 1276, 1277, 1282, 1283, 1290, |
| 1884 | 1291, 1297, 1298, 1307, 1315, 1316, 1321, 1322, 1323, 1328, |
| 1885 | 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1344, 1348, 1352, |
| 1886 | 1359, 1364, 1372, 1401, 1426, 1431, 1441, 1451, 1455, 1465, |
| 1887 | 1472, 1481, 1488, 1493, 1498, 1505, 1506, 1513, 1520, 1528, |
| 1888 | 1534, 1546, 1574, 1590, 1617, 1645, 1671, 1691, 1717, 1737, |
| 1889 | 1749, 1756, 1822, 1832, 1842, 1848, 1858, 1864, 1874, 1880, |
| 1890 | 1886, 1899, 1911, 1932, 1940, 1946, 1957, 1962, 1967, 1972, |
| 1891 | 1977, 1983, 1989, 1995, 2003, 2014, 2018, 2026, 2026, 2029, |
| 1892 | 2029, 2032, 2044, 2065, 2070, 2078, 2079, 2083, 2083, 2087, |
| 1893 | 2087, 2090, 2093, 2117, 2129, 2128, 2140, 2139, 2149, 2148, |
| 1894 | 2159, 2199, 2202, 2208, 2218, 2222, 2227, 2229, 2234, 2239, |
| 1895 | 2248, 2258, 2269, 2273, 2282, 2291, 2296, 2425, 2425, 2427, |
| 1896 | 2436, 2436, 2438, 2443, 2455, 2459, 2464, 2468, 2472, 2477, |
| 1897 | 2482, 2486, 2490, 2494, 2498, 2502, 2506, 2528, 2550, 2556, |
| 1898 | 2569, 2581, 2586, 2598, 2604, 2608, 2618, 2622, 2626, 2631, |
| 1899 | 2638, 2638, 2644, 2653, 2658, 2663, 2667, 2676, 2685, 2694, |
| 1900 | 2698, 2706, 2726, 2730, 2735, 2746, 2765, 2774, 2860, 2864, |
| 1901 | 2871, 2882, 2895, 2905, 2916, 2926, 2937, 2945, 2955, 2962, |
| 1902 | 2965, 2966, 2974, 2980, 2989, 2993, 2998, 3014, 3031, 3045, |
| 1903 | 3059, 3073, 3087, 3099, 3107, 3114, 3120, 3126, 3132, 3147, |
| 1904 | 3237, 3242, 3246, 3253, 3260, 3270, 3277, 3287, 3295, 3309, |
| 1905 | 3326, 3340, 3355, 3370 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1906 | }; |
| 1907 | #endif |
| 1908 | |
| 1909 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1910 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1911 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1912 | static const char *const yytname[] = |
| 1913 | { |
| 1914 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1915 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1916 | "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE", |
| 1917 | "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT", |
| 1918 | "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK", |
| 1919 | "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", |
| 1920 | "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO", |
| 1921 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1922 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE", |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1923 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", |
| 1924 | "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", |
| 1925 | "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1926 | "X86_SSECALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", |
| 1927 | "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", |
| 1928 | "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", |
| 1929 | "ICMP", "FCMP", "VICMP", "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", |
| 1930 | "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", |
| 1931 | "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", |
| 1932 | "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", |
| 1933 | "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", |
| 1934 | "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", |
| 1935 | "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", |
| 1936 | "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", |
| 1937 | "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", |
| 1938 | "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", |
| 1939 | "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", |
| 1940 | "CastOps", "IPredicates", "FPredicates", "IntType", "FPType", |
| 1941 | "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign", |
| 1942 | "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1943 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1944 | "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr", |
| 1945 | "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", |
| 1946 | "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes", |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1947 | "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", |
| 1948 | "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", |
| 1949 | "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", |
| 1950 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1951 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1952 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1953 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1954 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal", |
| 1955 | "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1956 | "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", |
| 1957 | "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile", |
| 1958 | "MemoryInst", 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1959 | }; |
| 1960 | #endif |
| 1961 | |
| 1962 | # ifdef YYPRINT |
| 1963 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1964 | token YYLEX-NUM. */ |
| 1965 | static const yytype_uint16 yytoknum[] = |
| 1966 | { |
| 1967 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1968 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1969 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1970 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1971 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1972 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1973 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1974 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1975 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1976 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1977 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1978 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1979 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1980 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1981 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1982 | 405, 406, 407, 408, 409, 410, 411, 40, 41, 61, |
| 1983 | 44, 42, 92, 91, 120, 93, 60, 62, 123, 125, |
| 1984 | 99 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1985 | }; |
| 1986 | # endif |
| 1987 | |
| 1988 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1989 | static const yytype_uint16 yyr1[] = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1990 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1991 | 0, 171, 172, 172, 172, 172, 172, 172, 172, 172, |
| 1992 | 172, 173, 173, 173, 173, 173, 173, 174, 174, 174, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1993 | 174, 174, 174, 174, 174, 174, 174, 174, 174, 175, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 1994 | 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, |
| 1995 | 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, |
| 1996 | 176, 176, 176, 176, 176, 177, 178, 178, 178, 178, |
| 1997 | 178, 179, 179, 179, 180, 180, 181, 181, 182, 182, |
| 1998 | 183, 183, 184, 184, 185, 186, 186, 186, 186, 186, |
| 1999 | 186, 187, 187, 187, 188, 188, 188, 188, 189, 189, |
| 2000 | 189, 190, 190, 190, 190, 190, 191, 191, 191, 192, |
| 2001 | 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, |
| 2002 | 193, 193, 193, 193, 193, 193, 193, 194, 194, 195, |
| 2003 | 195, 195, 195, 195, 195, 196, 196, 197, 197, 198, |
| 2004 | 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, |
| 2005 | 204, 204, 204, 204, 204, 204, 204, 205, 205, 205, |
| 2006 | 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, |
| 2007 | 206, 207, 207, 208, 208, 209, 209, 209, 209, 210, |
| 2008 | 210, 211, 211, 211, 211, 211, 211, 211, 211, 211, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2009 | 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2010 | 211, 212, 212, 212, 212, 212, 212, 212, 212, 212, |
| 2011 | 212, 212, 212, 212, 212, 213, 213, 214, 214, 215, |
| 2012 | 215, 216, 216, 217, 217, 218, 218, 220, 219, 221, |
| 2013 | 219, 219, 219, 219, 222, 219, 223, 219, 224, 219, |
| 2014 | 219, 219, 219, 225, 226, 226, 227, 228, 228, 228, |
| 2015 | 229, 229, 230, 230, 230, 230, 231, 232, 232, 233, |
| 2016 | 234, 234, 235, 236, 237, 237, 238, 238, 238, 238, |
| 2017 | 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, |
| 2018 | 238, 238, 238, 238, 238, 238, 239, 239, 239, 239, |
| 2019 | 240, 240, 241, 242, 242, 243, 243, 244, 245, 245, |
| 2020 | 245, 246, 246, 246, 246, 246, 246, 246, 246, 246, |
| 2021 | 247, 247, 248, 249, 249, 250, 250, 250, 250, 250, |
| 2022 | 251, 251, 252, 252, 253, 253, 254, 254, 254, 254, |
| 2023 | 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, |
| 2024 | 254, 255, 255, 256, 256, 256, 256, 256, 256, 256, |
| 2025 | 256, 256, 256, 256 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2026 | }; |
| 2027 | |
| 2028 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 2029 | static const yytype_uint8 yyr2[] = |
| 2030 | { |
| 2031 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2032 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2033 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2034 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2035 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2036 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2037 | 1, 1, 1, 1, 1, 0, 4, 0, 2, 0, |
| 2038 | 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2039 | 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, |
| 2040 | 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2041 | 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, |
| 2042 | 1, 1, 1, 1, 1, 1, 2, 0, 2, 1, |
| 2043 | 1, 1, 1, 1, 1, 0, 2, 0, 2, 0, |
| 2044 | 2, 0, 3, 2, 0, 1, 0, 3, 1, 2, |
| 2045 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, |
| 2046 | 1, 2, 5, 5, 5, 5, 3, 2, 5, 4, |
| 2047 | 2, 1, 1, 1, 3, 1, 3, 1, 0, 1, |
| 2048 | 3, 4, 3, 3, 4, 4, 3, 6, 5, 2, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2049 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2050 | 2, 6, 5, 8, 6, 6, 7, 7, 7, 7, |
| 2051 | 6, 8, 8, 5, 7, 3, 1, 1, 1, 1, |
| 2052 | 0, 2, 6, 1, 0, 1, 2, 0, 3, 0, |
| 2053 | 3, 3, 3, 3, 0, 8, 0, 9, 0, 9, |
| 2054 | 5, 2, 3, 1, 3, 3, 3, 3, 1, 0, |
| 2055 | 5, 3, 1, 3, 1, 0, 10, 1, 1, 4, |
| 2056 | 1, 1, 2, 3, 0, 1, 1, 1, 1, 1, |
| 2057 | 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, |
| 2058 | 3, 2, 5, 4, 1, 5, 1, 1, 1, 1, |
| 2059 | 1, 1, 2, 1, 3, 2, 2, 3, 2, 0, |
| 2060 | 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, |
| 2061 | 6, 5, 2, 6, 7, 4, 4, 6, 6, 0, |
| 2062 | 0, 3, 2, 3, 2, 1, 5, 5, 6, 6, |
| 2063 | 6, 6, 4, 6, 4, 4, 6, 6, 2, 8, |
| 2064 | 1, 1, 0, 3, 6, 3, 6, 2, 5, 7, |
| 2065 | 5, 4, 4, 7 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2066 | }; |
| 2067 | |
| 2068 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 2069 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 2070 | means the default is an error. */ |
| 2071 | static const yytype_uint16 yydefact[] = |
| 2072 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2073 | 73, 61, 70, 62, 71, 63, 219, 217, 0, 0, |
| 2074 | 0, 0, 0, 0, 84, 72, 0, 73, 215, 88, |
| 2075 | 91, 0, 0, 231, 0, 0, 68, 0, 74, 75, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2076 | 77, 76, 78, 81, 79, 82, 80, 83, 85, 86, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2077 | 87, 84, 84, 210, 1, 216, 89, 90, 84, 220, |
| 2078 | 92, 93, 94, 95, 84, 289, 218, 289, 0, 0, |
| 2079 | 239, 232, 233, 221, 276, 277, 223, 140, 141, 142, |
| 2080 | 145, 144, 143, 146, 147, 0, 0, 0, 0, 278, |
| 2081 | 279, 148, 222, 150, 210, 210, 96, 209, 0, 99, |
| 2082 | 99, 290, 286, 69, 250, 251, 252, 285, 234, 235, |
| 2083 | 238, 0, 168, 151, 0, 0, 0, 0, 157, 169, |
| 2084 | 0, 0, 168, 0, 0, 0, 98, 97, 0, 207, |
| 2085 | 208, 0, 0, 100, 101, 102, 103, 104, 105, 0, |
| 2086 | 253, 0, 332, 288, 0, 236, 167, 117, 163, 165, |
| 2087 | 0, 0, 0, 0, 0, 0, 156, 0, 0, 149, |
| 2088 | 0, 0, 162, 0, 161, 0, 230, 140, 141, 142, |
| 2089 | 145, 144, 143, 0, 0, 67, 67, 106, 0, 247, |
| 2090 | 248, 249, 331, 315, 0, 0, 0, 0, 99, 298, |
| 2091 | 299, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| 2092 | 14, 15, 16, 11, 12, 13, 0, 0, 0, 0, |
| 2093 | 0, 0, 0, 0, 17, 18, 19, 20, 21, 22, |
| 2094 | 23, 24, 25, 26, 27, 28, 0, 0, 0, 0, |
| 2095 | 0, 0, 0, 0, 0, 0, 0, 0, 287, 99, |
| 2096 | 302, 0, 330, 237, 160, 0, 125, 67, 67, 159, |
| 2097 | 0, 170, 0, 125, 67, 67, 0, 211, 188, 189, |
| 2098 | 184, 186, 185, 187, 190, 183, 179, 180, 0, 0, |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 2099 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2100 | 0, 0, 0, 0, 0, 0, 182, 181, 224, 0, |
| 2101 | 314, 292, 67, 283, 291, 0, 0, 55, 0, 0, |
| 2102 | 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 2103 | 0, 53, 54, 49, 50, 51, 52, 39, 40, 41, |
| 2104 | 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, |
| 2105 | 131, 131, 337, 67, 67, 328, 0, 0, 0, 0, |
| 2106 | 0, 67, 67, 67, 67, 67, 0, 0, 0, 0, |
| 2107 | 0, 108, 110, 109, 107, 111, 112, 113, 114, 115, |
| 2108 | 118, 166, 164, 153, 154, 155, 158, 66, 152, 226, |
| 2109 | 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2110 | 0, 0, 0, 172, 206, 0, 0, 0, 176, 0, |
| 2111 | 173, 0, 0, 0, 136, 245, 256, 257, 258, 259, |
| 2112 | 260, 265, 261, 262, 263, 264, 254, 0, 0, 0, |
| 2113 | 0, 274, 281, 280, 282, 0, 0, 293, 0, 0, |
| 2114 | 67, 67, 67, 67, 0, 333, 0, 335, 310, 0, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2115 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2116 | 0, 0, 0, 67, 0, 116, 122, 121, 119, 120, |
| 2117 | 123, 124, 126, 136, 136, 0, 0, 0, 0, 0, |
| 2118 | 310, 0, 0, 0, 0, 0, 0, 0, 171, 157, |
| 2119 | 169, 0, 174, 175, 0, 0, 0, 0, 225, 244, |
| 2120 | 117, 242, 0, 255, 0, 268, 0, 0, 0, 271, |
| 2121 | 0, 269, 284, 0, 0, 0, 0, 0, 0, 0, |
| 2122 | 0, 0, 0, 341, 0, 0, 0, 324, 325, 0, |
| 2123 | 0, 0, 0, 342, 0, 0, 0, 322, 0, 131, |
| 2124 | 0, 227, 229, 67, 0, 0, 0, 0, 0, 0, |
| 2125 | 0, 0, 0, 0, 0, 205, 178, 0, 0, 0, |
| 2126 | 0, 0, 0, 138, 136, 65, 0, 125, 0, 267, |
| 2127 | 157, 0, 266, 270, 0, 0, 309, 0, 0, 0, |
| 2128 | 0, 131, 132, 131, 0, 0, 0, 0, 0, 0, |
| 2129 | 340, 312, 0, 67, 316, 317, 309, 0, 338, 67, |
| 2130 | 212, 0, 0, 0, 0, 192, 0, 0, 0, 0, |
| 2131 | 203, 0, 177, 0, 0, 67, 133, 139, 137, 64, |
| 2132 | 241, 243, 117, 134, 0, 273, 0, 0, 0, 117, |
| 2133 | 117, 0, 318, 319, 320, 321, 334, 336, 311, 0, |
| 2134 | 0, 323, 326, 327, 313, 0, 0, 131, 0, 0, |
| 2135 | 0, 0, 0, 200, 0, 0, 0, 194, 195, 191, |
| 2136 | 65, 135, 129, 275, 272, 0, 0, 0, 0, 125, |
| 2137 | 0, 303, 0, 343, 125, 339, 196, 197, 198, 199, |
| 2138 | 0, 0, 0, 204, 240, 0, 127, 0, 296, 0, |
| 2139 | 0, 108, 110, 117, 117, 0, 117, 117, 304, 329, |
| 2140 | 193, 201, 202, 130, 0, 246, 294, 0, 295, 0, |
| 2141 | 306, 305, 0, 0, 0, 128, 0, 0, 0, 117, |
| 2142 | 117, 0, 0, 0, 308, 307, 301, 0, 0, 300, |
| 2143 | 0, 297 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2144 | }; |
| 2145 | |
| 2146 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 2147 | static const yytype_int16 yydefgoto[] = |
| 2148 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2149 | -1, 273, 274, 275, 300, 317, 163, 164, 79, 590, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2150 | 113, 12, 80, 14, 15, 41, 42, 43, 48, 54, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2151 | 118, 129, 350, 234, 442, 353, 675, 656, 415, 533, |
| 2152 | 632, 468, 534, 81, 165, 138, 155, 139, 140, 110, |
| 2153 | 374, 401, 375, 121, 88, 156, 16, 17, 18, 20, |
| 2154 | 19, 384, 443, 444, 63, 23, 61, 101, 471, 472, |
| 2155 | 130, 171, 55, 96, 56, 49, 474, 402, 83, 404, |
| 2156 | 283, 284, 57, 92, 93, 228, 660, 133, 325, 601, |
| 2157 | 493, 503, 229, 230, 231, 232 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2158 | }; |
| 2159 | |
| 2160 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2161 | STATE-NUM. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2162 | #define YYPACT_NINF -623 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2163 | static const yytype_int16 yypact[] = |
| 2164 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2165 | 493, -623, -623, -623, -623, -623, -623, -623, 18, -104, |
| 2166 | 15, -100, 70, -57, -3, -623, 148, 542, -623, 191, |
| 2167 | 228, -29, 9, -623, 44, 159, -623, 1927, -623, -623, |
| 2168 | -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, |
| 2169 | -623, 33, 33, 222, -623, -623, -623, -623, 33, -623, |
| 2170 | -623, -623, -623, -623, 33, 196, -623, -10, 201, 208, |
| 2171 | 218, -623, -623, -623, -623, -623, 93, -623, -623, -623, |
| 2172 | -623, -623, -623, -623, -623, 256, 262, 2, 624, -623, |
| 2173 | -623, -623, 10, -623, 250, 250, 235, -623, 78, 310, |
| 2174 | 310, -623, -623, 254, -623, -623, -623, -623, -623, -623, |
| 2175 | -623, -32, 1645, -623, 125, 139, 806, 93, -623, 10, |
| 2176 | -109, 137, 1645, 153, 78, 78, -623, -623, 1686, -623, |
| 2177 | -623, 1945, 314, -623, -623, -623, -623, -623, -623, 1974, |
| 2178 | -623, -12, 2208, -623, 301, -623, -623, 10, -623, 167, |
| 2179 | 177, 1992, 1992, 170, -107, 1992, -623, 334, 193, -623, |
| 2180 | 1945, 1992, 93, 197, 10, 205, -623, 63, 346, 347, |
| 2181 | 348, 349, 355, 243, 357, 1509, 312, -623, 122, -623, |
| 2182 | -623, -623, -623, -623, 324, 2033, 129, 371, 310, -623, |
| 2183 | -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, |
| 2184 | -623, -623, -623, -623, -623, -623, 245, 548, 245, 548, |
| 2185 | 1992, 1992, 1992, 1992, -623, -623, -623, -623, -623, -623, |
| 2186 | -623, -623, -623, -623, -623, -623, 1992, 1992, 1992, 1992, |
| 2187 | 1992, 1992, 1992, 1992, 1992, 1992, 1992, 1992, -623, 310, |
| 2188 | -623, 39, -623, -623, 331, 1704, -623, -31, -28, -623, |
| 2189 | 216, 10, 226, -623, 312, 8, 1686, -623, -623, -623, |
| 2190 | -623, -623, -623, -623, -623, -623, -623, -623, 245, 548, |
| 2191 | 245, 548, 229, 230, 231, 232, 233, 234, 236, 1745, |
| 2192 | 2051, 1126, 370, 237, 246, 247, -623, -623, -623, 251, |
| 2193 | -623, 93, 908, -623, 240, 1076, 1076, -623, 1076, 1974, |
| 2194 | -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, |
| 2195 | 1992, -623, -623, -623, -623, -623, -623, -623, -623, -623, |
| 2196 | -623, -623, -623, -623, -623, -623, -623, 1992, 1992, 1992, |
| 2197 | -40, 22, -623, 908, 6, 242, 249, 253, 257, 258, |
| 2198 | 260, 908, 908, 908, 908, 908, 369, 1974, 1992, 1992, |
| 2199 | 407, -623, -623, -623, -623, -623, -623, -623, -623, -623, |
| 2200 | -623, -623, -623, 158, -623, -623, -623, -623, 158, -623, |
| 2201 | 153, 376, 259, 264, 265, 266, 1945, 1945, 1945, 1945, |
| 2202 | 1945, 1945, 1945, -623, -623, 66, 1170, -111, -623, -88, |
| 2203 | -623, 1945, 1945, 1945, 267, 1764, -623, -623, -623, -623, |
| 2204 | -623, -623, -623, -623, -623, -623, 363, 1808, 2107, 1403, |
| 2205 | 406, -623, -623, -623, -623, 1992, 269, -623, 270, 1076, |
| 2206 | 908, 908, 908, 908, 25, -623, 43, -623, -623, 1076, |
| 2207 | 268, 1992, 1992, 1992, 1992, 1992, 272, 277, 279, 280, |
| 2208 | 281, 1992, 1076, 908, 284, -623, -623, -623, -623, -623, |
| 2209 | -623, -623, -623, 267, 267, 1992, 1945, 1945, 1945, 1945, |
| 2210 | -623, 285, 286, 287, 288, 277, 289, 1945, -623, 283, |
| 2211 | 1357, -87, -623, -623, 292, 295, 418, 16, -623, -623, |
| 2212 | 10, 297, 300, -623, 439, -623, 73, 1449, -59, -623, |
| 2213 | -69, -623, -623, 446, 454, 315, 322, 332, 335, 336, |
| 2214 | 1076, 487, 1076, 338, 339, 1076, 340, 10, -623, 341, |
| 2215 | 342, 490, 499, 354, 1992, 1076, 1076, 10, 361, 359, |
| 2216 | 1992, -623, -623, 3, 362, 365, 366, 367, 130, 1945, |
| 2217 | 1945, 1945, 1945, 146, 1945, -623, -623, 374, 1945, 1945, |
| 2218 | 1992, 507, 517, -623, 267, 119, 1866, -623, 377, -623, |
| 2219 | 379, -65, -623, -623, 1076, 1076, 2154, 1076, 1076, 1076, |
| 2220 | 1076, 359, -623, 359, 1992, 1076, 383, 1992, 1992, 1992, |
| 2221 | -623, -623, 530, 908, -623, -623, 2154, 494, -623, 908, |
| 2222 | -623, 1945, 1945, 1945, 1945, -623, 384, 389, 390, 391, |
| 2223 | -623, 277, -623, 394, 396, 28, -623, -623, -623, -623, |
| 2224 | -623, -623, 10, -20, 533, -623, 392, 403, 393, 23, |
| 2225 | 10, 161, -623, -623, -623, -623, -623, -623, -623, 402, |
| 2226 | 1076, -623, -623, -623, -623, 277, 168, 359, 410, 411, |
| 2227 | 412, 413, 1945, -623, 1945, 1945, 176, -623, -623, -623, |
| 2228 | 119, -623, 522, -623, -623, 561, -1, 756, 756, -623, |
| 2229 | 2213, -623, 414, 354, -623, -623, -623, -623, -623, -623, |
| 2230 | 422, 423, 424, -623, -623, 584, 436, 1076, -623, 1222, |
| 2231 | 1, 433, 434, -623, -623, 173, 23, 10, -623, 158, |
| 2232 | -623, -623, -623, -623, 570, -623, -623, 435, -623, 1222, |
| 2233 | 331, 331, 579, 756, 756, -623, 580, 440, 1076, -623, |
| 2234 | -623, 1076, 582, 527, 331, 331, -623, 1076, 588, -623, |
| 2235 | 1076, -623 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2236 | }; |
| 2237 | |
| 2238 | /* YYPGOTO[NTERM-NUM]. */ |
| 2239 | static const yytype_int16 yypgoto[] = |
| 2240 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2241 | -623, 477, 478, 480, -164, -152, -170, -623, 0, -17, |
| 2242 | -146, 523, 4, -623, -623, -623, -623, 64, -623, -623, |
| 2243 | -623, -145, -623, -445, -623, -238, -623, -623, -295, 26, |
| 2244 | -623, -421, -623, -623, -26, 380, -127, -623, 506, 515, |
| 2245 | -86, -162, -262, 89, 223, 378, -623, -623, 605, -623, |
| 2246 | -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, |
| 2247 | 535, -623, -623, -623, -623, -623, -623, -622, -80, 174, |
| 2248 | -189, -623, -623, 566, -623, -623, -623, -623, -623, 60, |
| 2249 | 178, -437, -623, -623, -623, -623 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2250 | }; |
| 2251 | |
| 2252 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2253 | positive, shift that token. If negative, reduce the rule which |
| 2254 | number is the opposite. If zero, do what YYDEFACT says. |
| 2255 | If YYTABLE_NINF, syntax error. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2256 | #define YYTABLE_NINF -215 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2257 | static const yytype_int16 yytable[] = |
| 2258 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2259 | 11, 82, 168, 276, 13, 358, 105, 288, 377, 379, |
| 2260 | 287, 91, 287, 322, 531, 111, 169, 11, 523, 94, |
| 2261 | 278, 13, 511, 512, 111, 535, 417, 111, 326, 327, |
| 2262 | 328, 329, 330, 289, 318, 166, 490, 677, 336, 29, |
| 2263 | 30, 31, 32, 33, 34, 35, 36, 319, 37, 457, |
| 2264 | 531, 145, 109, 145, 492, 24, 462, 687, 111, 26, |
| 2265 | 146, 111, 240, 111, 244, 111, -55, -55, -55, -55, |
| 2266 | 532, 21, 457, 457, 25, 247, 137, 111, -146, 491, |
| 2267 | 109, 463, 527, 111, 337, 277, 137, 22, 27, 248, |
| 2268 | 249, 457, 154, 11, 362, 457, 364, 491, 359, 360, |
| 2269 | 543, 457, 28, 154, 596, 84, 85, 363, 542, 365, |
| 2270 | 119, 120, 89, 588, 461, 237, 238, 112, 90, 241, |
| 2271 | 414, -67, 436, 437, 438, 245, 112, 439, 134, 112, |
| 2272 | 58, 440, 441, 135, 354, 476, 478, 480, 1, 355, |
| 2273 | 285, 3, 2, 5, 626, 4, 286, 630, 44, 282, |
| 2274 | 434, 38, 39, 40, 637, 638, 170, 338, 339, 95, |
| 2275 | 112, 570, 409, 112, 658, 112, 678, 112, 59, 419, |
| 2276 | 106, -67, 279, 340, 320, 321, 282, 323, 643, 112, |
| 2277 | -146, 62, 416, -67, -146, 112, 629, 38, 39, 40, |
| 2278 | 324, 282, 282, 282, 282, 282, 331, 332, 333, 334, |
| 2279 | 335, 282, 403, 150, 151, 403, 403, 60, 403, 137, |
| 2280 | 432, 682, 64, 65, 568, 541, 482, 91, 680, 681, |
| 2281 | 154, 683, 684, 98, 1, 2, 457, 3, 4, 5, |
| 2282 | 99, 458, 496, 457, 498, 499, 500, 46, 539, 47, |
| 2283 | 100, 341, 342, 403, 694, 695, 250, 251, 252, 253, |
| 2284 | 102, 403, 403, 403, 403, 403, 606, 86, 607, 87, |
| 2285 | 103, 343, 344, 154, 345, 346, 104, 347, 348, 349, |
| 2286 | 50, 51, 52, 1, 410, 53, 3, 116, 5, 117, |
| 2287 | 450, 451, 452, 453, 454, 455, 456, 87, 575, 141, |
| 2288 | 554, 411, 412, 413, 147, 464, 465, 466, 276, 593, |
| 2289 | 436, 437, 438, 142, 580, 439, 562, 114, 115, 440, |
| 2290 | 441, 154, 433, 282, 149, 436, 437, 438, 167, 639, |
| 2291 | 439, 640, 645, 233, 440, 441, 644, 235, 640, 403, |
| 2292 | 403, 403, 403, 403, 653, 236, 562, 239, 242, 403, |
| 2293 | 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, |
| 2294 | 460, 243, 403, 403, 246, -56, -57, -60, -59, 470, |
| 2295 | 514, 515, 516, 517, -58, 608, 254, 111, 611, 612, |
| 2296 | 613, 525, 122, 123, 124, 125, 126, 127, 128, 282, |
| 2297 | 277, 280, 287, 356, 357, 340, 366, 367, 368, 369, |
| 2298 | 370, 371, 380, 372, 381, 282, 497, 282, 282, 282, |
| 2299 | 405, 665, 420, 382, 383, 507, 669, 431, 385, 421, |
| 2300 | 403, 435, 403, 422, 445, 403, 446, 423, 424, 513, |
| 2301 | 425, 447, 448, 449, 473, 403, 403, 467, 481, 483, |
| 2302 | 484, 495, 501, 576, 577, 578, 579, 502, 581, 504, |
| 2303 | 505, 506, 583, 584, 510, 519, 520, 521, 522, 524, |
| 2304 | 526, 460, 528, 341, 342, 529, 530, 536, 537, 406, |
| 2305 | 407, 538, 408, 544, 403, 403, 659, 403, 403, 403, |
| 2306 | 403, 545, 546, 343, 344, 403, 345, 346, 563, 347, |
| 2307 | 348, 349, 547, 403, 569, 618, 619, 620, 621, 403, |
| 2308 | 679, 552, 548, -214, 560, 549, 550, 418, 554, 555, |
| 2309 | 557, 558, 559, 561, 585, 426, 427, 428, 429, 430, |
| 2310 | 592, -69, 1, 2, 562, 3, 4, 5, 566, 567, |
| 2311 | 600, 587, 571, 6, 7, 572, 573, 574, 282, 586, |
| 2312 | 403, 282, 282, 282, 614, 589, 650, 594, 651, 652, |
| 2313 | 600, 582, -213, 610, 622, 8, 595, 623, 491, 9, |
| 2314 | 624, 625, 627, 10, 628, 633, 636, 403, 403, 634, |
| 2315 | -69, 1, 2, 635, 3, 4, 5, 641, 646, 647, |
| 2316 | 648, 649, 6, 7, 301, 302, 655, 403, 657, 668, |
| 2317 | 670, 671, 672, 485, 486, 487, 488, 489, 673, 674, |
| 2318 | -18, -19, 685, 494, 8, 686, 688, 691, 9, 697, |
| 2319 | 692, 698, 10, 403, 403, 700, 508, 509, 403, 225, |
| 2320 | 226, 403, 227, 654, 667, 352, 132, 403, 148, 631, |
| 2321 | 403, 144, 45, 97, 361, 131, 616, 0, 518, 0, |
| 2322 | 589, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
| 2323 | 72, 73, 0, 1, 2, 0, 3, 4, 5, 303, |
| 2324 | 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, |
| 2325 | 314, 315, 316, 0, 551, 0, 553, 0, 0, 556, |
| 2326 | 0, 0, 0, 0, 74, 0, 0, 0, 0, 564, |
| 2327 | 565, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2328 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2329 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2330 | 0, 0, 0, 0, 0, 0, 0, 0, 597, 598, |
| 2331 | 0, 602, 603, 604, 605, 0, 0, 0, 0, 609, |
| 2332 | 0, 0, 0, 0, 0, 0, 0, 615, 0, 0, |
| 2333 | 0, 0, 0, 617, 0, 0, 0, 0, 0, 0, |
| 2334 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 386, |
| 2335 | 387, 388, 389, 64, 65, 390, 0, 0, 0, 0, |
| 2336 | 0, 0, 0, 0, 0, 1, 2, 0, 3, 4, |
| 2337 | 5, 391, 392, 393, 642, 0, 75, 76, 0, 0, |
| 2338 | 77, 0, 78, 108, 0, 0, 394, 395, 0, 0, |
| 2339 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2340 | 340, 663, 664, 64, 65, 396, 107, 67, 68, 69, |
| 2341 | 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, |
| 2342 | 5, 676, 181, 182, 183, 184, 185, 186, 187, 188, |
| 2343 | 189, 190, 191, 192, 193, 194, 195, 258, 259, 260, |
| 2344 | 261, 0, 0, 0, 0, 0, 74, 689, 690, 0, |
| 2345 | 0, 0, 693, 0, 0, 696, 0, 0, 0, 0, |
| 2346 | 0, 699, 0, 0, 701, 0, 262, 204, 661, 662, |
| 2347 | 207, 208, 209, 210, 211, 212, 213, 214, 215, 0, |
| 2348 | 263, 0, 264, 265, 266, 0, 267, 268, 343, 344, |
| 2349 | 0, 345, 346, 0, 347, 348, 349, 0, 0, 0, |
| 2350 | 0, 386, 387, 388, 389, 64, 65, 390, 0, 397, |
| 2351 | 0, 0, 398, 0, 399, 0, 400, 1, 2, 0, |
| 2352 | 3, 4, 5, 391, 392, 393, 0, 0, 0, 0, |
| 2353 | 0, 0, 0, 0, 0, 0, 0, 0, 394, 395, |
| 2354 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2355 | 0, 0, 0, 111, 0, 0, 0, 396, 75, 76, |
| 2356 | 0, 0, 77, 0, 78, 143, 0, 0, 0, 0, |
| 2357 | 0, 0, 0, 0, 181, 182, 183, 184, 185, 186, |
| 2358 | 187, 188, 189, 190, 191, 192, 193, 194, 195, 258, |
| 2359 | 259, 260, 261, 0, 0, 0, 0, 0, 0, 0, |
| 2360 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2361 | 0, 0, 0, 0, 0, 0, 0, 0, 262, 204, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2362 | 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2363 | 215, 0, 263, 0, 264, 265, 266, 0, 267, 268, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2364 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2365 | 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, |
| 2366 | 0, 397, 0, 0, 398, 0, 399, 0, 400, 386, |
| 2367 | 387, 388, 389, 64, 65, 390, 0, 0, 0, 0, |
| 2368 | 0, 0, 0, 0, 0, 1, 2, 0, 3, 4, |
| 2369 | 5, 391, 392, 393, 0, 0, 0, 0, 0, 0, |
| 2370 | 0, 0, 0, 0, 0, 0, 394, 395, 0, 0, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2371 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2372 | 0, 0, 0, 64, 65, 396, 107, 157, 158, 159, |
| 2373 | 160, 161, 162, 73, 0, 1, 2, 0, 3, 4, |
| 2374 | 5, 0, 181, 182, 183, 184, 185, 186, 187, 188, |
| 2375 | 189, 190, 191, 192, 193, 194, 195, 258, 259, 260, |
| 2376 | 261, 0, 0, 0, 0, 0, 74, 64, 65, 0, |
| 2377 | 107, 157, 158, 159, 160, 161, 162, 73, 0, 1, |
| 2378 | 2, 0, 3, 4, 5, 0, 262, 204, 205, 206, |
| 2379 | 207, 208, 209, 210, 211, 212, 213, 214, 215, 0, |
| 2380 | 263, 0, 264, 265, 266, 0, 267, 268, 0, 0, |
| 2381 | 74, 0, 0, 0, 0, 386, 387, 388, 389, 0, |
| 2382 | 0, 390, 0, 0, 0, 0, 0, 0, 0, 397, |
| 2383 | 0, 0, 398, 0, 399, 0, 400, 391, 392, 393, |
| 2384 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2385 | 0, 0, 394, 395, 0, 0, 0, 0, 0, 0, |
| 2386 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2387 | 0, 396, 0, 0, 0, 0, 0, 0, 75, 76, |
| 2388 | 0, 0, 77, 0, 78, 378, 0, 0, 181, 182, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2389 | 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2390 | 193, 194, 195, 258, 259, 260, 261, 0, 0, 0, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2391 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2392 | 0, 0, 75, 76, 0, 0, 77, 0, 78, 459, |
| 2393 | 0, 0, 262, 204, 205, 206, 207, 208, 209, 210, |
| 2394 | 211, 212, 213, 214, 215, 0, 263, 0, 264, 265, |
| 2395 | 266, 0, 267, 268, 64, 65, 0, 0, 0, 0, |
| 2396 | 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, |
| 2397 | 4, 5, 255, 0, 0, 397, 0, 0, 398, 0, |
| 2398 | 399, 0, 400, 0, 0, 0, 0, 256, 257, 0, |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2399 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2400 | 64, 65, 111, 107, 157, 158, 159, 160, 161, 162, |
| 2401 | 73, 0, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2402 | 0, 0, 0, 181, 182, 183, 184, 185, 186, 187, |
| 2403 | 188, 189, 190, 191, 192, 193, 194, 195, 258, 259, |
| 2404 | 260, 261, 0, 74, 0, 0, 64, 65, 0, 107, |
| 2405 | 157, 158, 159, 160, 161, 162, 73, 0, 1, 2, |
| 2406 | 0, 3, 4, 5, 0, 0, 0, 262, 204, 205, |
| 2407 | 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, |
| 2408 | 0, 263, 0, 264, 265, 266, 0, 267, 268, 74, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 2409 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2410 | 0, 0, 0, 0, 112, 0, 64, 65, -67, 0, |
| 2411 | 269, 0, 0, 270, 0, 271, 0, 272, 1, 2, |
| 2412 | 0, 3, 4, 5, 255, 0, 0, 0, 0, 0, |
| 2413 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 256, |
| 2414 | 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2415 | 0, 0, 0, 0, 111, 75, 76, 0, 0, 77, |
| 2416 | 0, 78, 479, 0, 0, 0, 0, 0, 0, 0, |
| 2417 | 0, 0, 0, 0, 0, 181, 182, 183, 184, 185, |
| 2418 | 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, |
| 2419 | 258, 259, 260, 261, 0, 0, 0, 0, 0, 0, |
| 2420 | 0, 75, 76, 0, 0, 77, 0, 78, 540, 0, |
| 2421 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 262, |
| 2422 | 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, |
| 2423 | 214, 215, 0, 263, 0, 264, 265, 266, 0, 267, |
| 2424 | 268, 0, 64, 65, 0, 107, 67, 68, 69, 70, |
| 2425 | 71, 72, 73, 0, 1, 2, 112, 3, 4, 5, |
| 2426 | 0, 0, 269, 0, 0, 270, 0, 271, 0, 272, |
| 2427 | 0, 0, 0, 0, 136, 0, 0, 0, 0, 0, |
| 2428 | 0, 0, 0, 64, 65, 74, 152, 67, 68, 69, |
| 2429 | 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, |
| 2430 | 5, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
| 2431 | 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, |
| 2432 | 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, |
| 2433 | 0, 0, 0, 351, 0, 0, 0, 0, 0, 0, |
| 2434 | 0, 0, 64, 65, 74, 107, 157, 158, 159, 160, |
| 2435 | 161, 162, 73, 0, 1, 2, 0, 3, 4, 5, |
| 2436 | 0, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
| 2437 | 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, |
| 2438 | 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, |
| 2439 | 0, 0, 0, 469, 0, 0, 0, 75, 76, 0, |
| 2440 | 0, 77, 153, 78, 74, 64, 65, 0, 107, 157, |
| 2441 | 158, 159, 160, 161, 162, 73, 0, 1, 2, 0, |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 2442 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 2443 | 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2444 | 0, 0, 77, 0, 78, 0, 0, 0, 74, 0, |
| 2445 | 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, |
| 2446 | 77, 0, 78, 64, 65, 0, 107, 67, 68, 69, |
| 2447 | 70, 71, 72, 73, 0, 1, 2, 0, 3, 4, |
| 2448 | 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2449 | 0, 0, 0, 0, 0, 591, 0, 75, 76, 0, |
| 2450 | 373, 77, 0, 78, 0, 0, 74, 0, 0, 0, |
| 2451 | 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, |
| 2452 | 77, 0, 78, 0, 64, 65, 0, 66, 67, 68, |
| 2453 | 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, |
| 2454 | 4, 5, 64, 65, 0, 107, 157, 158, 159, 160, |
| 2455 | 161, 162, 73, 0, 1, 2, 0, 3, 4, 5, |
| 2456 | 75, 76, 0, 475, 77, 0, 78, 74, 0, 0, |
| 2457 | 0, 64, 65, 0, 152, 67, 68, 69, 70, 71, |
| 2458 | 72, 73, 0, 1, 2, 74, 3, 4, 5, 64, |
| 2459 | 65, 0, 107, 67, 68, 69, 70, 71, 72, 73, |
| 2460 | 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, |
| 2461 | 0, 0, 0, 0, 74, 0, 0, 0, 75, 76, |
| 2462 | 0, 0, 77, 0, 78, 0, 0, 0, 0, 0, |
| 2463 | 64, 65, 74, 281, 67, 68, 69, 70, 71, 72, |
| 2464 | 73, 0, 1, 2, 0, 3, 4, 5, 64, 65, |
| 2465 | 0, 107, 157, 158, 159, 160, 161, 162, 73, 0, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2466 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2467 | 0, 0, 0, 74, 0, 0, 0, 0, 0, 75, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2468 | 76, 0, 0, 77, 0, 78, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2469 | 0, 74, 0, 0, 0, 0, 0, 75, 76, 0, |
| 2470 | 0, 77, 0, 78, 64, 65, 0, 107, 157, 158, |
| 2471 | 159, 160, 161, 162, 73, 0, 1, 2, 0, 3, |
| 2472 | 4, 5, 0, 0, 0, 0, 75, 76, 0, 0, |
| 2473 | 77, 0, 78, 0, 0, 0, 0, 0, 0, 0, |
| 2474 | 0, 0, 0, 0, 75, 76, 0, 74, 77, 0, |
| 2475 | 78, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
| 2476 | 72, 599, 0, 1, 2, 0, 3, 4, 5, 0, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2477 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2478 | 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, |
| 2479 | 0, 78, 0, 0, 74, 0, 0, 0, 0, 0, |
| 2480 | 0, 0, 0, 75, 76, 0, 0, 77, 0, 376, |
| 2481 | 64, 65, 0, 107, 67, 68, 69, 70, 71, 72, |
| 2482 | 666, 0, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2483 | 0, 0, 0, 0, 172, 0, 0, 0, 0, 0, |
| 2484 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2485 | 0, 0, 0, 74, 0, 173, 174, 0, 0, 75, |
| 2486 | 76, 0, 0, 77, 0, 477, 0, 0, 175, 176, |
| 2487 | 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, |
| 2488 | 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, |
| 2489 | 197, 198, 199, 0, 0, 0, 0, 0, 0, 0, |
| 2490 | 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, |
| 2491 | 77, 0, 78, 200, 201, 202, 0, 0, 203, 204, |
| 2492 | 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, |
| 2493 | 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, |
| 2494 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2495 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2496 | 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, |
| 2497 | 0, 78 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2498 | }; |
| 2499 | |
| 2500 | static const yytype_int16 yycheck[] = |
| 2501 | { |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2502 | 0, 27, 129, 165, 0, 243, 4, 177, 270, 271, |
| 2503 | 11, 21, 11, 202, 34, 55, 28, 17, 455, 29, |
| 2504 | 166, 17, 443, 444, 55, 470, 321, 55, 217, 218, |
| 2505 | 219, 220, 221, 178, 198, 121, 11, 659, 227, 42, |
| 2506 | 43, 44, 45, 46, 47, 48, 49, 199, 51, 160, |
| 2507 | 34, 160, 78, 160, 11, 159, 167, 679, 55, 159, |
| 2508 | 169, 55, 169, 55, 150, 55, 3, 4, 5, 6, |
| 2509 | 54, 53, 160, 160, 59, 155, 102, 55, 55, 54, |
| 2510 | 106, 169, 169, 55, 229, 165, 112, 69, 18, 26, |
| 2511 | 27, 160, 118, 93, 258, 160, 260, 54, 244, 245, |
| 2512 | 169, 160, 159, 129, 169, 41, 42, 259, 167, 261, |
| 2513 | 32, 33, 48, 534, 376, 141, 142, 157, 54, 145, |
| 2514 | 160, 161, 142, 143, 144, 151, 157, 147, 160, 157, |
| 2515 | 159, 151, 152, 165, 165, 397, 398, 399, 19, 167, |
| 2516 | 11, 22, 20, 24, 581, 23, 17, 592, 0, 175, |
| 2517 | 339, 154, 155, 156, 599, 600, 168, 118, 119, 169, |
| 2518 | 157, 158, 289, 157, 165, 157, 165, 157, 159, 163, |
| 2519 | 168, 161, 168, 54, 200, 201, 202, 203, 615, 157, |
| 2520 | 157, 22, 160, 161, 161, 157, 158, 154, 155, 156, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 2521 | 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2522 | 226, 227, 282, 114, 115, 285, 286, 163, 288, 235, |
| 2523 | 337, 38, 7, 8, 509, 477, 405, 21, 663, 664, |
| 2524 | 246, 666, 667, 22, 19, 20, 160, 22, 23, 24, |
| 2525 | 22, 165, 421, 160, 423, 424, 425, 46, 165, 48, |
| 2526 | 22, 122, 123, 323, 689, 690, 3, 4, 5, 6, |
| 2527 | 157, 331, 332, 333, 334, 335, 551, 35, 553, 37, |
| 2528 | 4, 142, 143, 289, 145, 146, 4, 148, 149, 150, |
| 2529 | 42, 43, 44, 19, 300, 47, 22, 42, 24, 44, |
| 2530 | 366, 367, 368, 369, 370, 371, 372, 37, 158, 164, |
| 2531 | 160, 317, 318, 319, 157, 381, 382, 383, 460, 537, |
| 2532 | 142, 143, 144, 164, 158, 147, 160, 84, 85, 151, |
| 2533 | 152, 337, 338, 339, 161, 142, 143, 144, 4, 158, |
| 2534 | 147, 160, 617, 22, 151, 152, 158, 160, 160, 409, |
| 2535 | 410, 411, 412, 413, 158, 158, 160, 167, 4, 419, |
| 2536 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 2537 | 376, 158, 432, 433, 157, 9, 9, 9, 9, 385, |
| 2538 | 446, 447, 448, 449, 9, 554, 9, 55, 557, 558, |
| 2539 | 559, 457, 62, 63, 64, 65, 66, 67, 68, 405, |
| 2540 | 460, 57, 11, 167, 158, 54, 157, 157, 157, 157, |
| 2541 | 157, 157, 22, 157, 157, 421, 422, 423, 424, 425, |
| 2542 | 160, 639, 160, 157, 157, 431, 644, 38, 157, 160, |
| 2543 | 490, 4, 492, 160, 38, 495, 157, 160, 160, 445, |
| 2544 | 160, 157, 157, 157, 61, 505, 506, 160, 22, 160, |
| 2545 | 160, 163, 160, 519, 520, 521, 522, 160, 524, 160, |
| 2546 | 160, 160, 528, 529, 160, 160, 160, 160, 160, 160, |
| 2547 | 167, 477, 160, 122, 123, 160, 38, 160, 158, 285, |
| 2548 | 286, 22, 288, 17, 544, 545, 636, 547, 548, 549, |
| 2549 | 550, 17, 157, 142, 143, 555, 145, 146, 504, 148, |
| 2550 | 149, 150, 160, 563, 510, 571, 572, 573, 574, 569, |
| 2551 | 660, 4, 160, 0, 4, 160, 160, 323, 160, 160, |
| 2552 | 160, 160, 160, 4, 530, 331, 332, 333, 334, 335, |
| 2553 | 536, 18, 19, 20, 160, 22, 23, 24, 157, 160, |
| 2554 | 546, 4, 160, 30, 31, 160, 160, 160, 554, 22, |
| 2555 | 610, 557, 558, 559, 4, 535, 622, 160, 624, 625, |
| 2556 | 566, 167, 0, 160, 160, 52, 167, 158, 54, 56, |
| 2557 | 160, 160, 158, 60, 158, 22, 163, 637, 638, 167, |
| 2558 | 18, 19, 20, 160, 22, 23, 24, 165, 158, 158, |
| 2559 | 158, 158, 30, 31, 26, 27, 54, 657, 17, 165, |
| 2560 | 158, 158, 158, 409, 410, 411, 412, 413, 4, 153, |
| 2561 | 157, 157, 22, 419, 52, 160, 17, 17, 56, 17, |
| 2562 | 160, 74, 60, 683, 684, 17, 432, 433, 688, 132, |
| 2563 | 132, 691, 132, 630, 640, 235, 93, 697, 112, 593, |
| 2564 | 700, 106, 17, 57, 246, 90, 566, -1, 450, -1, |
| 2565 | 630, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2566 | 16, 17, -1, 19, 20, -1, 22, 23, 24, 101, |
| 2567 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 2568 | 112, 113, 114, -1, 490, -1, 492, -1, -1, 495, |
| 2569 | -1, -1, -1, -1, 50, -1, -1, -1, -1, 505, |
| 2570 | 506, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2571 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2572 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2573 | -1, -1, -1, -1, -1, -1, -1, -1, 544, 545, |
| 2574 | -1, 547, 548, 549, 550, -1, -1, -1, -1, 555, |
| 2575 | -1, -1, -1, -1, -1, -1, -1, 563, -1, -1, |
| 2576 | -1, -1, -1, 569, -1, -1, -1, -1, -1, -1, |
| 2577 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, |
| 2578 | 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, |
| 2579 | -1, -1, -1, -1, -1, 19, 20, -1, 22, 23, |
| 2580 | 24, 25, 26, 27, 610, -1, 162, 163, -1, -1, |
| 2581 | 166, -1, 168, 169, -1, -1, 40, 41, -1, -1, |
| 2582 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2583 | 54, 637, 638, 7, 8, 59, 10, 11, 12, 13, |
| 2584 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
| 2585 | 24, 657, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2586 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2587 | 94, -1, -1, -1, -1, -1, 50, 683, 684, -1, |
| 2588 | -1, -1, 688, -1, -1, 691, -1, -1, -1, -1, |
| 2589 | -1, 697, -1, -1, 700, -1, 120, 121, 122, 123, |
| 2590 | 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, |
| 2591 | 134, -1, 136, 137, 138, -1, 140, 141, 142, 143, |
| 2592 | -1, 145, 146, -1, 148, 149, 150, -1, -1, -1, |
| 2593 | -1, 3, 4, 5, 6, 7, 8, 9, -1, 163, |
| 2594 | -1, -1, 166, -1, 168, -1, 170, 19, 20, -1, |
| 2595 | 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, |
| 2596 | -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, |
| 2597 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2598 | -1, -1, -1, 55, -1, -1, -1, 59, 162, 163, |
| 2599 | -1, -1, 166, -1, 168, 169, -1, -1, -1, -1, |
| 2600 | -1, -1, -1, -1, 76, 77, 78, 79, 80, 81, |
| 2601 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2602 | 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, |
| 2603 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2604 | -1, -1, -1, -1, -1, -1, -1, -1, 120, 121, |
| 2605 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, |
| 2606 | 132, -1, 134, -1, 136, 137, 138, -1, 140, 141, |
| 2607 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2608 | -1, -1, -1, -1, -1, 157, -1, -1, -1, -1, |
| 2609 | -1, 163, -1, -1, 166, -1, 168, -1, 170, 3, |
| 2610 | 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, |
| 2611 | -1, -1, -1, -1, -1, 19, 20, -1, 22, 23, |
| 2612 | 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, |
| 2613 | -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, |
| 2614 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2615 | -1, -1, -1, 7, 8, 59, 10, 11, 12, 13, |
| 2616 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
| 2617 | 24, -1, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2618 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2619 | 94, -1, -1, -1, -1, -1, 50, 7, 8, -1, |
| 2620 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2621 | 20, -1, 22, 23, 24, -1, 120, 121, 122, 123, |
| 2622 | 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, |
| 2623 | 134, -1, 136, 137, 138, -1, 140, 141, -1, -1, |
| 2624 | 50, -1, -1, -1, -1, 3, 4, 5, 6, -1, |
| 2625 | -1, 9, -1, -1, -1, -1, -1, -1, -1, 163, |
| 2626 | -1, -1, 166, -1, 168, -1, 170, 25, 26, 27, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2627 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2628 | -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2629 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2630 | -1, 59, -1, -1, -1, -1, -1, -1, 162, 163, |
| 2631 | -1, -1, 166, -1, 168, 169, -1, -1, 76, 77, |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 2632 | 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2633 | 88, 89, 90, 91, 92, 93, 94, -1, -1, -1, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2634 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2635 | -1, -1, 162, 163, -1, -1, 166, -1, 168, 169, |
| 2636 | -1, -1, 120, 121, 122, 123, 124, 125, 126, 127, |
| 2637 | 128, 129, 130, 131, 132, -1, 134, -1, 136, 137, |
| 2638 | 138, -1, 140, 141, 7, 8, -1, -1, -1, -1, |
| 2639 | -1, -1, -1, -1, -1, -1, 19, 20, -1, 22, |
| 2640 | 23, 24, 25, -1, -1, 163, -1, -1, 166, -1, |
| 2641 | 168, -1, 170, -1, -1, -1, -1, 40, 41, -1, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 2642 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2643 | 7, 8, 55, 10, 11, 12, 13, 14, 15, 16, |
| 2644 | 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, |
| 2645 | -1, -1, -1, 76, 77, 78, 79, 80, 81, 82, |
| 2646 | 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, |
| 2647 | 93, 94, -1, 50, -1, -1, 7, 8, -1, 10, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2648 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2649 | -1, 22, 23, 24, -1, -1, -1, 120, 121, 122, |
| 2650 | 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, |
| 2651 | -1, 134, -1, 136, 137, 138, -1, 140, 141, 50, |
| 2652 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2653 | -1, -1, -1, -1, 157, -1, 7, 8, 161, -1, |
| 2654 | 163, -1, -1, 166, -1, 168, -1, 170, 19, 20, |
| 2655 | -1, 22, 23, 24, 25, -1, -1, -1, -1, -1, |
| 2656 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, |
| 2657 | 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2658 | -1, -1, -1, -1, 55, 162, 163, -1, -1, 166, |
| 2659 | -1, 168, 169, -1, -1, -1, -1, -1, -1, -1, |
| 2660 | -1, -1, -1, -1, -1, 76, 77, 78, 79, 80, |
| 2661 | 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
| 2662 | 91, 92, 93, 94, -1, -1, -1, -1, -1, -1, |
| 2663 | -1, 162, 163, -1, -1, 166, -1, 168, 169, -1, |
| 2664 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, |
| 2665 | 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, |
| 2666 | 131, 132, -1, 134, -1, 136, 137, 138, -1, 140, |
| 2667 | 141, -1, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2668 | 15, 16, 17, -1, 19, 20, 157, 22, 23, 24, |
| 2669 | -1, -1, 163, -1, -1, 166, -1, 168, -1, 170, |
| 2670 | -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, |
| 2671 | -1, -1, -1, 7, 8, 50, 10, 11, 12, 13, |
| 2672 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
| 2673 | 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2674 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
| 2675 | -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, |
| 2676 | -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, |
| 2677 | -1, -1, 7, 8, 50, 10, 11, 12, 13, 14, |
| 2678 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2679 | -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2680 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
| 2681 | -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, |
| 2682 | -1, -1, -1, 39, -1, -1, -1, 162, 163, -1, |
| 2683 | -1, 166, 126, 168, 50, 7, 8, -1, 10, 11, |
| 2684 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 2685 | 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2686 | -1, -1, -1, -1, -1, -1, -1, -1, 162, 163, |
| 2687 | -1, -1, 166, -1, 168, -1, -1, -1, 50, -1, |
| 2688 | -1, -1, -1, -1, -1, -1, 162, 163, -1, -1, |
| 2689 | 166, -1, 168, 7, 8, -1, 10, 11, 12, 13, |
| 2690 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
| 2691 | 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2692 | -1, -1, -1, -1, -1, 39, -1, 162, 163, -1, |
| 2693 | 165, 166, -1, 168, -1, -1, 50, -1, -1, -1, |
| 2694 | -1, -1, -1, -1, -1, -1, 162, 163, -1, -1, |
| 2695 | 166, -1, 168, -1, 7, 8, -1, 10, 11, 12, |
| 2696 | 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, |
| 2697 | 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2698 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2699 | 162, 163, -1, 165, 166, -1, 168, 50, -1, -1, |
| 2700 | -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2701 | 16, 17, -1, 19, 20, 50, 22, 23, 24, 7, |
| 2702 | 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2703 | -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, |
| 2704 | -1, -1, -1, -1, 50, -1, -1, -1, 162, 163, |
| 2705 | -1, -1, 166, -1, 168, -1, -1, -1, -1, -1, |
| 2706 | 7, 8, 50, 10, 11, 12, 13, 14, 15, 16, |
| 2707 | 17, -1, 19, 20, -1, 22, 23, 24, 7, 8, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2708 | -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2709 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2710 | -1, -1, -1, 50, -1, -1, -1, -1, -1, 162, |
| 2711 | 163, -1, -1, 166, -1, 168, -1, -1, -1, -1, |
| 2712 | -1, 50, -1, -1, -1, -1, -1, 162, 163, -1, |
| 2713 | -1, 166, -1, 168, 7, 8, -1, 10, 11, 12, |
| 2714 | 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, |
| 2715 | 23, 24, -1, -1, -1, -1, 162, 163, -1, -1, |
| 2716 | 166, -1, 168, -1, -1, -1, -1, -1, -1, -1, |
| 2717 | -1, -1, -1, -1, 162, 163, -1, 50, 166, -1, |
| 2718 | 168, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2719 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
| 2720 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2721 | -1, -1, -1, -1, -1, 162, 163, -1, -1, 166, |
| 2722 | -1, 168, -1, -1, 50, -1, -1, -1, -1, -1, |
| 2723 | -1, -1, -1, 162, 163, -1, -1, 166, -1, 168, |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 2724 | 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2725 | 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, |
| 2726 | -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 2727 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2728 | -1, -1, -1, 50, -1, 57, 58, -1, -1, 162, |
| 2729 | 163, -1, -1, 166, -1, 168, -1, -1, 70, 71, |
| 2730 | 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, |
| 2731 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2732 | 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, |
| 2733 | -1, -1, -1, -1, -1, -1, 162, 163, -1, -1, |
| 2734 | 166, -1, 168, 115, 116, 117, -1, -1, 120, 121, |
| 2735 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, |
| 2736 | 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 2737 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2738 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2739 | -1, -1, -1, -1, -1, 162, 163, -1, -1, 166, |
| 2740 | -1, 168 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2741 | }; |
| 2742 | |
| 2743 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2744 | symbol of state STATE-NUM. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2745 | static const yytype_uint16 yystos[] = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2746 | { |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2747 | 0, 19, 20, 22, 23, 24, 30, 31, 52, 56, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2748 | 60, 179, 182, 183, 184, 185, 217, 218, 219, 221, |
| 2749 | 220, 53, 69, 226, 159, 59, 159, 18, 159, 42, |
| 2750 | 43, 44, 45, 46, 47, 48, 49, 51, 154, 155, |
| 2751 | 156, 186, 187, 188, 0, 219, 46, 48, 189, 236, |
| 2752 | 42, 43, 44, 47, 190, 233, 235, 243, 159, 159, |
| 2753 | 163, 227, 22, 225, 7, 8, 10, 11, 12, 13, |
| 2754 | 14, 15, 16, 17, 50, 162, 163, 166, 168, 179, |
| 2755 | 183, 204, 205, 239, 188, 188, 35, 37, 215, 188, |
| 2756 | 188, 21, 244, 245, 29, 169, 234, 244, 22, 22, |
| 2757 | 22, 228, 157, 4, 4, 4, 168, 10, 169, 205, |
| 2758 | 210, 55, 157, 181, 215, 215, 42, 44, 191, 32, |
| 2759 | 33, 214, 62, 63, 64, 65, 66, 67, 68, 192, |
| 2760 | 231, 231, 182, 248, 160, 165, 39, 205, 206, 208, |
| 2761 | 209, 164, 164, 169, 210, 160, 169, 157, 209, 161, |
| 2762 | 214, 214, 10, 126, 205, 207, 216, 11, 12, 13, |
| 2763 | 14, 15, 16, 177, 178, 205, 211, 4, 207, 28, |
| 2764 | 168, 232, 36, 57, 58, 70, 71, 72, 73, 74, |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2765 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2766 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 2767 | 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 2768 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 2769 | 137, 138, 139, 140, 141, 172, 173, 174, 246, 253, |
| 2770 | 254, 255, 256, 22, 194, 160, 158, 205, 205, 167, |
| 2771 | 169, 205, 4, 158, 211, 205, 157, 239, 26, 27, |
| 2772 | 3, 4, 5, 6, 9, 25, 40, 41, 91, 92, |
| 2773 | 93, 94, 120, 134, 136, 137, 138, 140, 141, 163, |
| 2774 | 166, 168, 170, 172, 173, 174, 212, 239, 181, 183, |
| 2775 | 57, 10, 205, 241, 242, 11, 17, 11, 177, 192, |
| 2776 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 2777 | 175, 26, 27, 101, 102, 103, 104, 105, 106, 107, |
| 2778 | 108, 109, 110, 111, 112, 113, 114, 176, 175, 176, |
| 2779 | 205, 205, 241, 205, 205, 249, 241, 241, 241, 241, |
| 2780 | 241, 205, 205, 205, 205, 205, 241, 192, 118, 119, |
| 2781 | 54, 122, 123, 142, 143, 145, 146, 148, 149, 150, |
| 2782 | 193, 39, 206, 196, 165, 167, 167, 158, 196, 181, |
| 2783 | 181, 216, 175, 176, 175, 176, 157, 157, 157, 157, |
| 2784 | 157, 157, 157, 165, 211, 213, 168, 213, 169, 213, |
| 2785 | 22, 157, 157, 157, 222, 157, 3, 4, 5, 6, |
| 2786 | 9, 25, 26, 27, 40, 41, 59, 163, 166, 168, |
| 2787 | 170, 212, 238, 239, 240, 160, 240, 240, 240, 207, |
| 2788 | 205, 205, 205, 205, 160, 199, 160, 199, 240, 163, |
| 2789 | 160, 160, 160, 160, 160, 160, 240, 240, 240, 240, |
| 2790 | 240, 38, 207, 205, 241, 4, 142, 143, 144, 147, |
| 2791 | 151, 152, 195, 223, 224, 38, 157, 157, 157, 157, |
| 2792 | 211, 211, 211, 211, 211, 211, 211, 160, 165, 169, |
| 2793 | 205, 213, 167, 169, 211, 211, 211, 160, 202, 39, |
| 2794 | 205, 229, 230, 61, 237, 165, 213, 168, 213, 169, |
| 2795 | 213, 22, 241, 160, 160, 240, 240, 240, 240, 240, |
| 2796 | 11, 54, 11, 251, 240, 163, 241, 205, 241, 241, |
| 2797 | 241, 160, 160, 252, 160, 160, 160, 205, 240, 240, |
| 2798 | 160, 202, 202, 205, 211, 211, 211, 211, 251, 160, |
| 2799 | 160, 160, 160, 252, 160, 211, 167, 169, 160, 160, |
| 2800 | 38, 34, 54, 200, 203, 194, 160, 158, 22, 165, |
| 2801 | 169, 213, 167, 169, 17, 17, 157, 160, 160, 160, |
| 2802 | 160, 240, 4, 240, 160, 160, 240, 160, 160, 160, |
| 2803 | 4, 4, 160, 205, 240, 240, 157, 160, 199, 205, |
| 2804 | 158, 160, 160, 160, 160, 158, 211, 211, 211, 211, |
| 2805 | 158, 211, 167, 211, 211, 205, 22, 4, 202, 179, |
| 2806 | 180, 39, 205, 196, 160, 167, 169, 240, 240, 17, |
| 2807 | 205, 250, 240, 240, 240, 240, 199, 199, 241, 240, |
| 2808 | 160, 241, 241, 241, 4, 240, 250, 240, 211, 211, |
| 2809 | 211, 211, 160, 158, 160, 160, 252, 158, 158, 158, |
| 2810 | 194, 200, 201, 22, 167, 160, 163, 194, 194, 158, |
| 2811 | 160, 165, 240, 252, 158, 199, 158, 158, 158, 158, |
| 2812 | 211, 211, 211, 158, 180, 54, 198, 17, 165, 177, |
| 2813 | 247, 122, 123, 240, 240, 196, 17, 205, 165, 196, |
| 2814 | 158, 158, 158, 4, 153, 197, 240, 238, 165, 177, |
| 2815 | 194, 194, 38, 194, 194, 22, 160, 238, 17, 240, |
| 2816 | 240, 17, 160, 240, 194, 194, 240, 17, 74, 240, |
| 2817 | 17, 240 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2818 | }; |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2819 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2820 | #define yyerrok (yyerrstatus = 0) |
| 2821 | #define yyclearin (yychar = YYEMPTY) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2822 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2823 | #define YYEOF 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2824 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2825 | #define YYACCEPT goto yyacceptlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2826 | #define YYABORT goto yyabortlab |
| 2827 | #define YYERROR goto yyerrorlab |
| 2828 | |
| 2829 | |
| 2830 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2831 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2832 | Once GCC version 2 has supplanted version 1, this can go. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2833 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2834 | #define YYFAIL goto yyerrlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2835 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2836 | #define YYRECOVERING() (!!yyerrstatus) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2837 | |
| 2838 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2839 | do \ |
| 2840 | if (yychar == YYEMPTY && yylen == 1) \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2841 | { \ |
| 2842 | yychar = (Token); \ |
| 2843 | yylval = (Value); \ |
| 2844 | yytoken = YYTRANSLATE (yychar); \ |
| 2845 | YYPOPSTACK (1); \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2846 | goto yybackup; \ |
| 2847 | } \ |
| 2848 | else \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2849 | { \ |
| 2850 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2851 | YYERROR; \ |
| 2852 | } \ |
| 2853 | while (YYID (0)) |
| 2854 | |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2855 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2856 | #define YYTERROR 1 |
| 2857 | #define YYERRCODE 256 |
| 2858 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2859 | |
| 2860 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2861 | If N is 0, then set CURRENT to the empty location which ends |
| 2862 | the previous symbol: RHS[0] (always defined). */ |
| 2863 | |
| 2864 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2865 | #ifndef YYLLOC_DEFAULT |
| 2866 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2867 | do \ |
| 2868 | if (YYID (N)) \ |
| 2869 | { \ |
| 2870 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2871 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2872 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2873 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2874 | } \ |
| 2875 | else \ |
| 2876 | { \ |
| 2877 | (Current).first_line = (Current).last_line = \ |
| 2878 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2879 | (Current).first_column = (Current).last_column = \ |
| 2880 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2881 | } \ |
| 2882 | while (YYID (0)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2883 | #endif |
| 2884 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2885 | |
| 2886 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2887 | This macro was not mandated originally: define only if we know |
| 2888 | we won't break user code: when these are the locations we know. */ |
| 2889 | |
| 2890 | #ifndef YY_LOCATION_PRINT |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 2891 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2892 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2893 | fprintf (File, "%d.%d-%d.%d", \ |
| 2894 | (Loc).first_line, (Loc).first_column, \ |
| 2895 | (Loc).last_line, (Loc).last_column) |
| 2896 | # else |
| 2897 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2898 | # endif |
| 2899 | #endif |
| 2900 | |
| 2901 | |
| 2902 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2903 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2904 | #ifdef YYLEX_PARAM |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2905 | # define YYLEX yylex (YYLEX_PARAM) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2906 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2907 | # define YYLEX yylex () |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2908 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2909 | |
| 2910 | /* Enable debugging if requested. */ |
| 2911 | #if YYDEBUG |
| 2912 | |
| 2913 | # ifndef YYFPRINTF |
| 2914 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2915 | # define YYFPRINTF fprintf |
| 2916 | # endif |
| 2917 | |
| 2918 | # define YYDPRINTF(Args) \ |
| 2919 | do { \ |
| 2920 | if (yydebug) \ |
| 2921 | YYFPRINTF Args; \ |
| 2922 | } while (YYID (0)) |
| 2923 | |
| 2924 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2925 | do { \ |
| 2926 | if (yydebug) \ |
| 2927 | { \ |
| 2928 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2929 | yy_symbol_print (stderr, \ |
| 2930 | Type, Value); \ |
| 2931 | YYFPRINTF (stderr, "\n"); \ |
| 2932 | } \ |
| 2933 | } while (YYID (0)) |
| 2934 | |
| 2935 | |
| 2936 | /*--------------------------------. |
| 2937 | | Print this symbol on YYOUTPUT. | |
| 2938 | `--------------------------------*/ |
| 2939 | |
| 2940 | /*ARGSUSED*/ |
| 2941 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2942 | || defined __cplusplus || defined _MSC_VER) |
| 2943 | static void |
| 2944 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2945 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2946 | static void |
| 2947 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 2948 | FILE *yyoutput; |
| 2949 | int yytype; |
| 2950 | YYSTYPE const * const yyvaluep; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2951 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2952 | { |
| 2953 | if (!yyvaluep) |
| 2954 | return; |
| 2955 | # ifdef YYPRINT |
| 2956 | if (yytype < YYNTOKENS) |
| 2957 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2958 | # else |
| 2959 | YYUSE (yyoutput); |
| 2960 | # endif |
| 2961 | switch (yytype) |
| 2962 | { |
| 2963 | default: |
| 2964 | break; |
| 2965 | } |
| 2966 | } |
| 2967 | |
| 2968 | |
| 2969 | /*--------------------------------. |
| 2970 | | Print this symbol on YYOUTPUT. | |
| 2971 | `--------------------------------*/ |
| 2972 | |
| 2973 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2974 | || defined __cplusplus || defined _MSC_VER) |
| 2975 | static void |
| 2976 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 2977 | #else |
| 2978 | static void |
| 2979 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 2980 | FILE *yyoutput; |
| 2981 | int yytype; |
| 2982 | YYSTYPE const * const yyvaluep; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2983 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2984 | { |
| 2985 | if (yytype < YYNTOKENS) |
| 2986 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2987 | else |
| 2988 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2989 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2990 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 2991 | YYFPRINTF (yyoutput, ")"); |
| 2992 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2993 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2994 | /*------------------------------------------------------------------. |
| 2995 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2996 | | TOP (included). | |
| 2997 | `------------------------------------------------------------------*/ |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2998 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2999 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3000 | || defined __cplusplus || defined _MSC_VER) |
| 3001 | static void |
| 3002 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
| 3003 | #else |
| 3004 | static void |
| 3005 | yy_stack_print (bottom, top) |
| 3006 | yytype_int16 *bottom; |
| 3007 | yytype_int16 *top; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3008 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3009 | { |
| 3010 | YYFPRINTF (stderr, "Stack now"); |
| 3011 | for (; bottom <= top; ++bottom) |
| 3012 | YYFPRINTF (stderr, " %d", *bottom); |
| 3013 | YYFPRINTF (stderr, "\n"); |
| 3014 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3015 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3016 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 3017 | do { \ |
| 3018 | if (yydebug) \ |
| 3019 | yy_stack_print ((Bottom), (Top)); \ |
| 3020 | } while (YYID (0)) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3021 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3022 | |
| 3023 | /*------------------------------------------------. |
| 3024 | | Report that the YYRULE is going to be reduced. | |
| 3025 | `------------------------------------------------*/ |
| 3026 | |
| 3027 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3028 | || defined __cplusplus || defined _MSC_VER) |
| 3029 | static void |
| 3030 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 3031 | #else |
| 3032 | static void |
| 3033 | yy_reduce_print (yyvsp, yyrule) |
| 3034 | YYSTYPE *yyvsp; |
| 3035 | int yyrule; |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 3036 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3037 | { |
| 3038 | int yynrhs = yyr2[yyrule]; |
| 3039 | int yyi; |
| 3040 | unsigned long int yylno = yyrline[yyrule]; |
| 3041 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 3042 | yyrule - 1, yylno); |
| 3043 | /* The symbols being reduced. */ |
| 3044 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 3045 | { |
| 3046 | fprintf (stderr, " $%d = ", yyi + 1); |
| 3047 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 3048 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 3049 | ); |
| 3050 | fprintf (stderr, "\n"); |
| 3051 | } |
| 3052 | } |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3053 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3054 | # define YY_REDUCE_PRINT(Rule) \ |
| 3055 | do { \ |
| 3056 | if (yydebug) \ |
| 3057 | yy_reduce_print (yyvsp, Rule); \ |
| 3058 | } while (YYID (0)) |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3059 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3060 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 3061 | multiple parsers can coexist. */ |
| 3062 | int yydebug; |
| 3063 | #else /* !YYDEBUG */ |
| 3064 | # define YYDPRINTF(Args) |
| 3065 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 3066 | # define YY_STACK_PRINT(Bottom, Top) |
| 3067 | # define YY_REDUCE_PRINT(Rule) |
| 3068 | #endif /* !YYDEBUG */ |
| 3069 | |
| 3070 | |
| 3071 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3072 | #ifndef YYINITDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3073 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3074 | #endif |
| 3075 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3076 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 3077 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3078 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3079 | Do not make this value too large; the results are undefined if |
| 3080 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 3081 | evaluated with infinite-precision integer arithmetic. */ |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 3082 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3083 | #ifndef YYMAXDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3084 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3085 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3086 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3087 | |
| 3088 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3089 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3090 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3091 | # ifndef yystrlen |
| 3092 | # if defined __GLIBC__ && defined _STRING_H |
| 3093 | # define yystrlen strlen |
| 3094 | # else |
| 3095 | /* Return the length of YYSTR. */ |
| 3096 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3097 | || defined __cplusplus || defined _MSC_VER) |
| 3098 | static YYSIZE_T |
| 3099 | yystrlen (const char *yystr) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3100 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3101 | static YYSIZE_T |
| 3102 | yystrlen (yystr) |
| 3103 | const char *yystr; |
| 3104 | #endif |
| 3105 | { |
| 3106 | YYSIZE_T yylen; |
| 3107 | for (yylen = 0; yystr[yylen]; yylen++) |
| 3108 | continue; |
| 3109 | return yylen; |
| 3110 | } |
| 3111 | # endif |
| 3112 | # endif |
| 3113 | |
| 3114 | # ifndef yystpcpy |
| 3115 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 3116 | # define yystpcpy stpcpy |
| 3117 | # else |
| 3118 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 3119 | YYDEST. */ |
| 3120 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3121 | || defined __cplusplus || defined _MSC_VER) |
| 3122 | static char * |
| 3123 | yystpcpy (char *yydest, const char *yysrc) |
| 3124 | #else |
| 3125 | static char * |
| 3126 | yystpcpy (yydest, yysrc) |
| 3127 | char *yydest; |
| 3128 | const char *yysrc; |
| 3129 | #endif |
| 3130 | { |
| 3131 | char *yyd = yydest; |
| 3132 | const char *yys = yysrc; |
| 3133 | |
| 3134 | while ((*yyd++ = *yys++) != '\0') |
| 3135 | continue; |
| 3136 | |
| 3137 | return yyd - 1; |
| 3138 | } |
| 3139 | # endif |
| 3140 | # endif |
| 3141 | |
| 3142 | # ifndef yytnamerr |
| 3143 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 3144 | quotes and backslashes, so that it's suitable for yyerror. The |
| 3145 | heuristic is that double-quoting is unnecessary unless the string |
| 3146 | contains an apostrophe, a comma, or backslash (other than |
| 3147 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 3148 | null, do not copy; instead, return the length of what the result |
| 3149 | would have been. */ |
| 3150 | static YYSIZE_T |
| 3151 | yytnamerr (char *yyres, const char *yystr) |
| 3152 | { |
| 3153 | if (*yystr == '"') |
| 3154 | { |
| 3155 | YYSIZE_T yyn = 0; |
| 3156 | char const *yyp = yystr; |
| 3157 | |
| 3158 | for (;;) |
| 3159 | switch (*++yyp) |
| 3160 | { |
| 3161 | case '\'': |
| 3162 | case ',': |
| 3163 | goto do_not_strip_quotes; |
| 3164 | |
| 3165 | case '\\': |
| 3166 | if (*++yyp != '\\') |
| 3167 | goto do_not_strip_quotes; |
| 3168 | /* Fall through. */ |
| 3169 | default: |
| 3170 | if (yyres) |
| 3171 | yyres[yyn] = *yyp; |
| 3172 | yyn++; |
| 3173 | break; |
| 3174 | |
| 3175 | case '"': |
| 3176 | if (yyres) |
| 3177 | yyres[yyn] = '\0'; |
| 3178 | return yyn; |
| 3179 | } |
| 3180 | do_not_strip_quotes: ; |
| 3181 | } |
| 3182 | |
| 3183 | if (! yyres) |
| 3184 | return yystrlen (yystr); |
| 3185 | |
| 3186 | return yystpcpy (yyres, yystr) - yyres; |
| 3187 | } |
| 3188 | # endif |
| 3189 | |
| 3190 | /* Copy into YYRESULT an error message about the unexpected token |
| 3191 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 3192 | including the terminating null byte. If YYRESULT is null, do not |
| 3193 | copy anything; just return the number of bytes that would be |
| 3194 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 3195 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 3196 | size calculation. */ |
| 3197 | static YYSIZE_T |
| 3198 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 3199 | { |
| 3200 | int yyn = yypact[yystate]; |
| 3201 | |
| 3202 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 3203 | return 0; |
| 3204 | else |
| 3205 | { |
| 3206 | int yytype = YYTRANSLATE (yychar); |
| 3207 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 3208 | YYSIZE_T yysize = yysize0; |
| 3209 | YYSIZE_T yysize1; |
| 3210 | int yysize_overflow = 0; |
| 3211 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 3212 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 3213 | int yyx; |
| 3214 | |
| 3215 | # if 0 |
| 3216 | /* This is so xgettext sees the translatable formats that are |
| 3217 | constructed on the fly. */ |
| 3218 | YY_("syntax error, unexpected %s"); |
| 3219 | YY_("syntax error, unexpected %s, expecting %s"); |
| 3220 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 3221 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 3222 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 3223 | # endif |
| 3224 | char *yyfmt; |
| 3225 | char const *yyf; |
| 3226 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 3227 | static char const yyexpecting[] = ", expecting %s"; |
| 3228 | static char const yyor[] = " or %s"; |
| 3229 | char yyformat[sizeof yyunexpected |
| 3230 | + sizeof yyexpecting - 1 |
| 3231 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 3232 | * (sizeof yyor - 1))]; |
| 3233 | char const *yyprefix = yyexpecting; |
| 3234 | |
| 3235 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 3236 | YYCHECK. */ |
| 3237 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 3238 | |
| 3239 | /* Stay within bounds of both yycheck and yytname. */ |
| 3240 | int yychecklim = YYLAST - yyn + 1; |
| 3241 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 3242 | int yycount = 1; |
| 3243 | |
| 3244 | yyarg[0] = yytname[yytype]; |
| 3245 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 3246 | |
| 3247 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 3248 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 3249 | { |
| 3250 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 3251 | { |
| 3252 | yycount = 1; |
| 3253 | yysize = yysize0; |
| 3254 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 3255 | break; |
| 3256 | } |
| 3257 | yyarg[yycount++] = yytname[yyx]; |
| 3258 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 3259 | yysize_overflow |= (yysize1 < yysize); |
| 3260 | yysize = yysize1; |
| 3261 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 3262 | yyprefix = yyor; |
| 3263 | } |
| 3264 | |
| 3265 | yyf = YY_(yyformat); |
| 3266 | yysize1 = yysize + yystrlen (yyf); |
| 3267 | yysize_overflow |= (yysize1 < yysize); |
| 3268 | yysize = yysize1; |
| 3269 | |
| 3270 | if (yysize_overflow) |
| 3271 | return YYSIZE_MAXIMUM; |
| 3272 | |
| 3273 | if (yyresult) |
| 3274 | { |
| 3275 | /* Avoid sprintf, as that infringes on the user's name space. |
| 3276 | Don't have undefined behavior even if the translation |
| 3277 | produced a string with the wrong number of "%s"s. */ |
| 3278 | char *yyp = yyresult; |
| 3279 | int yyi = 0; |
| 3280 | while ((*yyp = *yyf) != '\0') |
| 3281 | { |
| 3282 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 3283 | { |
| 3284 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 3285 | yyf += 2; |
| 3286 | } |
| 3287 | else |
| 3288 | { |
| 3289 | yyp++; |
| 3290 | yyf++; |
| 3291 | } |
| 3292 | } |
| 3293 | } |
| 3294 | return yysize; |
| 3295 | } |
| 3296 | } |
| 3297 | #endif /* YYERROR_VERBOSE */ |
| 3298 | |
| 3299 | |
| 3300 | /*-----------------------------------------------. |
| 3301 | | Release the memory associated to this symbol. | |
| 3302 | `-----------------------------------------------*/ |
| 3303 | |
| 3304 | /*ARGSUSED*/ |
| 3305 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3306 | || defined __cplusplus || defined _MSC_VER) |
| 3307 | static void |
| 3308 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 3309 | #else |
| 3310 | static void |
| 3311 | yydestruct (yymsg, yytype, yyvaluep) |
| 3312 | const char *yymsg; |
| 3313 | int yytype; |
| 3314 | YYSTYPE *yyvaluep; |
| 3315 | #endif |
| 3316 | { |
| 3317 | YYUSE (yyvaluep); |
| 3318 | |
| 3319 | if (!yymsg) |
| 3320 | yymsg = "Deleting"; |
| 3321 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 3322 | |
| 3323 | switch (yytype) |
| 3324 | { |
| 3325 | |
| 3326 | default: |
| 3327 | break; |
| 3328 | } |
| 3329 | } |
| 3330 | |
| 3331 | |
| 3332 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 3333 | |
| 3334 | #ifdef YYPARSE_PARAM |
| 3335 | #if defined __STDC__ || defined __cplusplus |
| 3336 | int yyparse (void *YYPARSE_PARAM); |
| 3337 | #else |
| 3338 | int yyparse (); |
| 3339 | #endif |
| 3340 | #else /* ! YYPARSE_PARAM */ |
| 3341 | #if defined __STDC__ || defined __cplusplus |
David Greene | 5fd22a8 | 2007-09-04 18:46:50 +0000 | [diff] [blame] | 3342 | int yyparse (void); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3343 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3344 | int yyparse (); |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3345 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3346 | #endif /* ! YYPARSE_PARAM */ |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3347 | |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3348 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3349 | |
| 3350 | /* The look-ahead symbol. */ |
| 3351 | int yychar; |
| 3352 | |
| 3353 | /* The semantic value of the look-ahead symbol. */ |
| 3354 | YYSTYPE yylval; |
| 3355 | |
| 3356 | /* Number of syntax errors so far. */ |
| 3357 | int yynerrs; |
| 3358 | |
| 3359 | |
| 3360 | |
| 3361 | /*----------. |
| 3362 | | yyparse. | |
| 3363 | `----------*/ |
| 3364 | |
| 3365 | #ifdef YYPARSE_PARAM |
| 3366 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3367 | || defined __cplusplus || defined _MSC_VER) |
| 3368 | int |
| 3369 | yyparse (void *YYPARSE_PARAM) |
| 3370 | #else |
| 3371 | int |
| 3372 | yyparse (YYPARSE_PARAM) |
| 3373 | void *YYPARSE_PARAM; |
| 3374 | #endif |
| 3375 | #else /* ! YYPARSE_PARAM */ |
| 3376 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3377 | || defined __cplusplus || defined _MSC_VER) |
| 3378 | int |
| 3379 | yyparse (void) |
| 3380 | #else |
| 3381 | int |
| 3382 | yyparse () |
| 3383 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3384 | #endif |
| 3385 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3386 | { |
| 3387 | |
| 3388 | int yystate; |
| 3389 | int yyn; |
| 3390 | int yyresult; |
| 3391 | /* Number of tokens to shift before error messages enabled. */ |
| 3392 | int yyerrstatus; |
| 3393 | /* Look-ahead token as an internal (translated) token number. */ |
| 3394 | int yytoken = 0; |
| 3395 | #if YYERROR_VERBOSE |
| 3396 | /* Buffer for error messages, and its allocated size. */ |
| 3397 | char yymsgbuf[128]; |
| 3398 | char *yymsg = yymsgbuf; |
| 3399 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3400 | #endif |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3401 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3402 | /* Three stacks and their tools: |
| 3403 | `yyss': related to states, |
| 3404 | `yyvs': related to semantic values, |
| 3405 | `yyls': related to locations. |
| 3406 | |
| 3407 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3408 | to reallocate them elsewhere. */ |
| 3409 | |
| 3410 | /* The state stack. */ |
| 3411 | yytype_int16 yyssa[YYINITDEPTH]; |
| 3412 | yytype_int16 *yyss = yyssa; |
| 3413 | yytype_int16 *yyssp; |
| 3414 | |
| 3415 | /* The semantic value stack. */ |
| 3416 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3417 | YYSTYPE *yyvs = yyvsa; |
| 3418 | YYSTYPE *yyvsp; |
| 3419 | |
| 3420 | |
| 3421 | |
| 3422 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 3423 | |
| 3424 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 3425 | |
| 3426 | /* The variables used to return semantic value and location from the |
| 3427 | action routines. */ |
| 3428 | YYSTYPE yyval; |
| 3429 | |
| 3430 | |
| 3431 | /* The number of symbols on the RHS of the reduced rule. |
| 3432 | Keep to zero when no symbol should be popped. */ |
| 3433 | int yylen = 0; |
| 3434 | |
| 3435 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 3436 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3437 | yystate = 0; |
| 3438 | yyerrstatus = 0; |
| 3439 | yynerrs = 0; |
| 3440 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3441 | |
| 3442 | /* Initialize stack pointers. |
| 3443 | Waste one element of value and location stack |
| 3444 | so that they stay on the same level as the state stack. |
| 3445 | The wasted elements are never initialized. */ |
| 3446 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3447 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3448 | yyvsp = yyvs; |
| 3449 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3450 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 3451 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3452 | /*------------------------------------------------------------. |
| 3453 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3454 | `------------------------------------------------------------*/ |
| 3455 | yynewstate: |
| 3456 | /* In all cases, when you get here, the value and location stacks |
| 3457 | have just been pushed. So pushing a state here evens the stacks. */ |
| 3458 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3459 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3460 | yysetstate: |
| 3461 | *yyssp = yystate; |
| 3462 | |
| 3463 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3464 | { |
| 3465 | /* Get the current used size of the three stacks, in elements. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3466 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3467 | |
| 3468 | #ifdef yyoverflow |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3469 | { |
| 3470 | /* Give user a chance to reallocate the stack. Use copies of |
| 3471 | these so that the &'s don't force the real ones into |
| 3472 | memory. */ |
| 3473 | YYSTYPE *yyvs1 = yyvs; |
| 3474 | yytype_int16 *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3475 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3476 | |
| 3477 | /* Each stack pointer address is followed by the size of the |
| 3478 | data in use in that stack, in bytes. This used to be a |
| 3479 | conditional around just the two extra args, but that might |
| 3480 | be undefined if yyoverflow is a macro. */ |
| 3481 | yyoverflow (YY_("memory exhausted"), |
| 3482 | &yyss1, yysize * sizeof (*yyssp), |
| 3483 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3484 | |
| 3485 | &yystacksize); |
| 3486 | |
| 3487 | yyss = yyss1; |
| 3488 | yyvs = yyvs1; |
| 3489 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3490 | #else /* no yyoverflow */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3491 | # ifndef YYSTACK_RELOCATE |
| 3492 | goto yyexhaustedlab; |
| 3493 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3494 | /* Extend the stack our own way. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3495 | if (YYMAXDEPTH <= yystacksize) |
| 3496 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3497 | yystacksize *= 2; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3498 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3499 | yystacksize = YYMAXDEPTH; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3500 | |
| 3501 | { |
| 3502 | yytype_int16 *yyss1 = yyss; |
| 3503 | union yyalloc *yyptr = |
| 3504 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3505 | if (! yyptr) |
| 3506 | goto yyexhaustedlab; |
| 3507 | YYSTACK_RELOCATE (yyss); |
| 3508 | YYSTACK_RELOCATE (yyvs); |
| 3509 | |
| 3510 | # undef YYSTACK_RELOCATE |
| 3511 | if (yyss1 != yyssa) |
| 3512 | YYSTACK_FREE (yyss1); |
| 3513 | } |
| 3514 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3515 | #endif /* no yyoverflow */ |
| 3516 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3517 | yyssp = yyss + yysize - 1; |
| 3518 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3519 | |
| 3520 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3521 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3522 | (unsigned long int) yystacksize)); |
| 3523 | |
| 3524 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3525 | YYABORT; |
| 3526 | } |
| 3527 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3528 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3529 | |
| 3530 | goto yybackup; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3531 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3532 | /*-----------. |
| 3533 | | yybackup. | |
| 3534 | `-----------*/ |
| 3535 | yybackup: |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3536 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3537 | /* Do appropriate processing given the current state. Read a |
| 3538 | 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] | 3539 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3540 | /* 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] | 3541 | yyn = yypact[yystate]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3542 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3543 | goto yydefault; |
| 3544 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3545 | /* 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] | 3546 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3547 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3548 | if (yychar == YYEMPTY) |
| 3549 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3550 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3551 | yychar = YYLEX; |
| 3552 | } |
| 3553 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3554 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3555 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3556 | yychar = yytoken = YYEOF; |
| 3557 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3558 | } |
| 3559 | else |
| 3560 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3561 | yytoken = YYTRANSLATE (yychar); |
| 3562 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3563 | } |
| 3564 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3565 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3566 | detect an error, take that action. */ |
| 3567 | yyn += yytoken; |
| 3568 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3569 | goto yydefault; |
| 3570 | yyn = yytable[yyn]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3571 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3572 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3573 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3574 | goto yyerrlab; |
| 3575 | yyn = -yyn; |
| 3576 | goto yyreduce; |
| 3577 | } |
| 3578 | |
| 3579 | if (yyn == YYFINAL) |
| 3580 | YYACCEPT; |
| 3581 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3582 | /* Count tokens shifted since error; after three, turn off error |
| 3583 | status. */ |
| 3584 | if (yyerrstatus) |
| 3585 | yyerrstatus--; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 3586 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3587 | /* Shift the look-ahead token. */ |
| 3588 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3589 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3590 | /* Discard the shifted token unless it is eof. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3591 | if (yychar != YYEOF) |
| 3592 | yychar = YYEMPTY; |
| 3593 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3594 | yystate = yyn; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3595 | *++yyvsp = yylval; |
| 3596 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3597 | goto yynewstate; |
| 3598 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3599 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3600 | /*-----------------------------------------------------------. |
| 3601 | | yydefault -- do the default action for the current state. | |
| 3602 | `-----------------------------------------------------------*/ |
| 3603 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3604 | yyn = yydefact[yystate]; |
| 3605 | if (yyn == 0) |
| 3606 | goto yyerrlab; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3607 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3608 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3609 | |
| 3610 | /*-----------------------------. |
| 3611 | | yyreduce -- Do a reduction. | |
| 3612 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3613 | yyreduce: |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3614 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3615 | yylen = yyr2[yyn]; |
| 3616 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3617 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3618 | `$$ = $1'. |
| 3619 | |
| 3620 | Otherwise, the following line sets YYVAL to garbage. |
| 3621 | This behavior is undocumented and Bison |
| 3622 | users should not rely upon it. Assigning to YYVAL |
| 3623 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3624 | GCC warning that YYVAL may be used uninitialized. */ |
| 3625 | yyval = yyvsp[1-yylen]; |
| 3626 | |
| 3627 | |
| 3628 | YY_REDUCE_PRINT (yyn); |
| 3629 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3630 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3631 | case 29: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3632 | #line 1139 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3633 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3634 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3635 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3636 | case 30: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3637 | #line 1139 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3638 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3639 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3640 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3641 | case 31: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3642 | #line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3643 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3644 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3645 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3646 | case 32: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3647 | #line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3648 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3649 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3650 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3651 | case 33: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3652 | #line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3653 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3654 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3655 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3656 | case 34: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3657 | #line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3658 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3659 | break; |
| 3660 | |
| 3661 | case 35: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3662 | #line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3663 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3664 | break; |
| 3665 | |
| 3666 | case 36: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3667 | #line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3668 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3669 | break; |
| 3670 | |
| 3671 | case 37: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3672 | #line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3673 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3674 | break; |
| 3675 | |
| 3676 | case 38: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3677 | #line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3678 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3679 | break; |
| 3680 | |
| 3681 | case 39: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3682 | #line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3683 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3684 | break; |
| 3685 | |
| 3686 | case 40: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3687 | #line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3688 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3689 | break; |
| 3690 | |
| 3691 | case 41: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3692 | #line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3693 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3694 | break; |
| 3695 | |
| 3696 | case 42: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3697 | #line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3698 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3699 | break; |
| 3700 | |
| 3701 | case 43: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3702 | #line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3703 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3704 | break; |
| 3705 | |
| 3706 | case 44: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3707 | #line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3708 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3709 | break; |
| 3710 | |
| 3711 | case 45: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3712 | #line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3713 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3714 | break; |
| 3715 | |
| 3716 | case 46: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3717 | #line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3718 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3719 | break; |
| 3720 | |
| 3721 | case 47: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3722 | #line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3723 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3724 | break; |
| 3725 | |
| 3726 | case 48: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3727 | #line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3728 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3729 | break; |
| 3730 | |
| 3731 | case 49: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3732 | #line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3733 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3734 | break; |
| 3735 | |
| 3736 | case 50: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3737 | #line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3738 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3739 | break; |
| 3740 | |
| 3741 | case 51: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3742 | #line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3743 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3744 | break; |
| 3745 | |
| 3746 | case 52: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3747 | #line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3748 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3749 | break; |
| 3750 | |
| 3751 | case 53: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3752 | #line 1154 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3753 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3754 | break; |
| 3755 | |
| 3756 | case 54: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3757 | #line 1155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3758 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3759 | break; |
| 3760 | |
| 3761 | case 65: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3762 | #line 1164 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3763 | { (yyval.StrVal) = 0; ;} |
| 3764 | break; |
| 3765 | |
| 3766 | case 66: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3767 | #line 1166 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3768 | { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} |
| 3769 | break; |
| 3770 | |
| 3771 | case 67: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3772 | #line 1167 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3773 | { (yyval.UIntVal)=0; ;} |
| 3774 | break; |
| 3775 | |
| 3776 | case 68: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3777 | #line 1171 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3778 | { |
| 3779 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3780 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3781 | ;} |
| 3782 | break; |
| 3783 | |
| 3784 | case 69: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3785 | #line 1175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3786 | { |
| 3787 | (yyval.StrVal) = 0; |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3788 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3789 | ;} |
| 3790 | break; |
| 3791 | |
| 3792 | case 73: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3793 | #line 1183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3794 | { |
| 3795 | (yyval.StrVal) = 0; |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3796 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3797 | ;} |
| 3798 | break; |
| 3799 | |
| 3800 | case 74: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3801 | #line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3802 | { |
| 3803 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3804 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3805 | ;} |
| 3806 | break; |
| 3807 | |
| 3808 | case 75: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3809 | #line 1194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3810 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3811 | break; |
| 3812 | |
| 3813 | case 76: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3814 | #line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3815 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3816 | break; |
| 3817 | |
| 3818 | case 77: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3819 | #line 1196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3820 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3821 | break; |
| 3822 | |
| 3823 | case 78: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3824 | #line 1197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3825 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3826 | break; |
| 3827 | |
| 3828 | case 79: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3829 | #line 1198 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3830 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3831 | break; |
| 3832 | |
| 3833 | case 80: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3834 | #line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3835 | { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3836 | break; |
| 3837 | |
| 3838 | case 81: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3839 | #line 1203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3840 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3841 | break; |
| 3842 | |
| 3843 | case 82: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3844 | #line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3845 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3846 | break; |
| 3847 | |
| 3848 | case 83: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3849 | #line 1205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3850 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3851 | break; |
| 3852 | |
| 3853 | case 84: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3854 | #line 1209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3855 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3856 | break; |
| 3857 | |
| 3858 | case 85: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3859 | #line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3860 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3861 | break; |
| 3862 | |
| 3863 | case 86: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3864 | #line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3865 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3866 | break; |
| 3867 | |
| 3868 | case 87: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3869 | #line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3870 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3871 | break; |
| 3872 | |
| 3873 | case 88: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3874 | #line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3875 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3876 | break; |
| 3877 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3878 | case 89: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3879 | #line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3880 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3881 | break; |
| 3882 | |
| 3883 | case 90: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3884 | #line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3885 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3886 | break; |
| 3887 | |
| 3888 | case 91: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3889 | #line 1222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3890 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3891 | break; |
| 3892 | |
| 3893 | case 92: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3894 | #line 1223 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3895 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3896 | break; |
| 3897 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3898 | case 93: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3899 | #line 1224 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3900 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3901 | break; |
| 3902 | |
| 3903 | case 94: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3904 | #line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3905 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3906 | break; |
| 3907 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3908 | case 95: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3909 | #line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3910 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3911 | break; |
| 3912 | |
| 3913 | case 96: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3914 | #line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3915 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3916 | break; |
| 3917 | |
| 3918 | case 97: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3919 | #line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3920 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3921 | break; |
| 3922 | |
| 3923 | case 98: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3924 | #line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3925 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3926 | break; |
| 3927 | |
| 3928 | case 99: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3929 | #line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3930 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3931 | break; |
| 3932 | |
| 3933 | case 100: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3934 | #line 1236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3935 | { (yyval.UIntVal) = CallingConv::C; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3936 | break; |
| 3937 | |
| 3938 | case 101: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3939 | #line 1237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3940 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3941 | break; |
| 3942 | |
| 3943 | case 102: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3944 | #line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3945 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3946 | break; |
| 3947 | |
| 3948 | case 103: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3949 | #line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3950 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3951 | break; |
| 3952 | |
| 3953 | case 104: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3954 | #line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3955 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3956 | break; |
| 3957 | |
| 3958 | case 105: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3959 | #line 1241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3960 | { (yyval.UIntVal) = CallingConv::X86_SSECall; ;} |
| 3961 | break; |
| 3962 | |
| 3963 | case 106: |
| 3964 | #line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3965 | { |
| 3966 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3967 | GEN_ERROR("Calling conv too large"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3968 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3969 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3970 | ;} |
| 3971 | break; |
| 3972 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3973 | case 107: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3974 | #line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3975 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3976 | break; |
| 3977 | |
| 3978 | case 108: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3979 | #line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3980 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3981 | break; |
| 3982 | |
| 3983 | case 109: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3984 | #line 1251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3985 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3986 | break; |
| 3987 | |
| 3988 | case 110: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3989 | #line 1252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3990 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3991 | break; |
| 3992 | |
| 3993 | case 111: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3994 | #line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 3995 | { (yyval.ParamAttrs) = ParamAttr::InReg; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3996 | break; |
| 3997 | |
| 3998 | case 112: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 3999 | #line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4000 | { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4001 | break; |
| 4002 | |
| 4003 | case 113: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4004 | #line 1255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4005 | { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4006 | break; |
| 4007 | |
| 4008 | case 114: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4009 | #line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4010 | { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4011 | break; |
| 4012 | |
| 4013 | case 115: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4014 | #line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4015 | { (yyval.ParamAttrs) = ParamAttr::Nest; ;} |
| 4016 | break; |
| 4017 | |
| 4018 | case 116: |
| 4019 | #line 1258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4020 | { (yyval.ParamAttrs) = |
| 4021 | ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} |
| 4022 | break; |
| 4023 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4024 | case 117: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4025 | #line 1262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4026 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4027 | break; |
| 4028 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4029 | case 118: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4030 | #line 1263 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4031 | { |
| 4032 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 4033 | ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4034 | break; |
| 4035 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4036 | case 119: |
| 4037 | #line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4038 | { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} |
| 4039 | break; |
| 4040 | |
| 4041 | case 120: |
| 4042 | #line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4043 | { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} |
| 4044 | break; |
| 4045 | |
| 4046 | case 121: |
| 4047 | #line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4048 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 4049 | break; |
| 4050 | |
| 4051 | case 122: |
| 4052 | #line 1271 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4053 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 4054 | break; |
| 4055 | |
| 4056 | case 123: |
| 4057 | #line 1272 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4058 | { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} |
| 4059 | break; |
| 4060 | |
| 4061 | case 124: |
| 4062 | #line 1273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4063 | { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} |
| 4064 | break; |
| 4065 | |
| 4066 | case 125: |
| 4067 | #line 1276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4068 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 4069 | break; |
| 4070 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4071 | case 126: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4072 | #line 1277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4073 | { |
| 4074 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 4075 | ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4076 | break; |
| 4077 | |
| 4078 | case 127: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4079 | #line 1282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4080 | { (yyval.StrVal) = 0; ;} |
| 4081 | break; |
| 4082 | |
| 4083 | case 128: |
| 4084 | #line 1283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4085 | { |
| 4086 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
| 4087 | ;} |
| 4088 | break; |
| 4089 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4090 | case 129: |
| 4091 | #line 1290 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4092 | { (yyval.UIntVal) = 0; ;} |
| 4093 | break; |
| 4094 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4095 | case 130: |
| 4096 | #line 1291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4097 | { |
| 4098 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
| 4099 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4100 | GEN_ERROR("Alignment must be a power of two"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +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 | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4105 | case 131: |
| 4106 | #line 1297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4107 | { (yyval.UIntVal) = 0; ;} |
| 4108 | break; |
| 4109 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4110 | case 132: |
| 4111 | #line 1298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4112 | { |
| 4113 | (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); |
| 4114 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4115 | GEN_ERROR("Alignment must be a power of two"); |
| 4116 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4117 | ;} |
| 4118 | break; |
| 4119 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4120 | case 133: |
| 4121 | #line 1307 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4122 | { |
| 4123 | for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) |
| 4124 | if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4125 | GEN_ERROR("Invalid character in section name"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4126 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4127 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4128 | ;} |
| 4129 | break; |
| 4130 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4131 | case 134: |
| 4132 | #line 1315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4133 | { (yyval.StrVal) = 0; ;} |
| 4134 | break; |
| 4135 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4136 | case 135: |
| 4137 | #line 1316 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4138 | { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} |
| 4139 | break; |
| 4140 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4141 | case 136: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4142 | #line 1321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4143 | {;} |
| 4144 | break; |
| 4145 | |
| 4146 | case 137: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4147 | #line 1322 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4148 | {;} |
| 4149 | break; |
| 4150 | |
| 4151 | case 138: |
| 4152 | #line 1323 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4153 | { |
| 4154 | CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); |
| 4155 | delete (yyvsp[(1) - (1)].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4156 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4157 | ;} |
| 4158 | break; |
| 4159 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4160 | case 139: |
| 4161 | #line 1328 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4162 | { |
| 4163 | if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4164 | GEN_ERROR("Alignment must be a power of two"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4165 | CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4166 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4167 | ;} |
| 4168 | break; |
| 4169 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4170 | case 147: |
| 4171 | #line 1344 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4172 | { |
| 4173 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +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 | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4178 | case 148: |
| 4179 | #line 1348 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4180 | { |
| 4181 | (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4182 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4183 | ;} |
| 4184 | break; |
| 4185 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4186 | case 149: |
| 4187 | #line 1352 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4188 | { // Pointer type? |
| 4189 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4190 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4191 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal)))); |
| 4192 | delete (yyvsp[(1) - (3)].TypeVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4193 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4194 | ;} |
| 4195 | break; |
| 4196 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4197 | case 150: |
| 4198 | #line 1359 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4199 | { // Named types are also simple types... |
| 4200 | const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 4201 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4202 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 4203 | ;} |
| 4204 | break; |
| 4205 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4206 | case 151: |
| 4207 | #line 1364 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4208 | { // Type UpReference |
| 4209 | 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] | 4210 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4211 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... |
| 4212 | (yyval.TypeVal) = new PATypeHolder(OT); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4213 | UR_OUT("New Upreference!\n"); |
| 4214 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4215 | ;} |
| 4216 | break; |
| 4217 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4218 | case 152: |
| 4219 | #line 1372 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4220 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4221 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4222 | // FIXME: remove in LLVM 3.0. |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 4223 | const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal); |
| 4224 | if (!FunctionType::isValidReturnType(RetTy)) |
| 4225 | GEN_ERROR("Invalid result type for LLVM function"); |
| 4226 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4227 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4228 | 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] | 4229 | for (; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4230 | const Type *Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4231 | Params.push_back(Ty); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4232 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4233 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4234 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4235 | if (isVarArg) Params.pop_back(); |
| 4236 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4237 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4238 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4239 | GEN_ERROR("Function arguments must be value types!"); |
| 4240 | |
| 4241 | CHECK_FOR_ERROR |
| 4242 | |
Anton Korobeynikov | c36284e | 2007-12-03 19:17:47 +0000 | [diff] [blame] | 4243 | FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4244 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4245 | delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle |
| 4246 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +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 | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4251 | case 153: |
| 4252 | #line 1401 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4253 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4254 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4255 | // FIXME: remove in LLVM 3.0. |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4256 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4257 | 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] | 4258 | for ( ; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4259 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4260 | Params.push_back(Ty); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4261 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4262 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4263 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4264 | if (isVarArg) Params.pop_back(); |
| 4265 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4266 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4267 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4268 | GEN_ERROR("Function arguments must be value types!"); |
| 4269 | |
| 4270 | CHECK_FOR_ERROR |
| 4271 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4272 | FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); |
| 4273 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4274 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4275 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4276 | ;} |
| 4277 | break; |
| 4278 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4279 | case 154: |
| 4280 | #line 1426 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4281 | { // Sized array type? |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 4282 | (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] | 4283 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4284 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4285 | ;} |
| 4286 | break; |
| 4287 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4288 | case 155: |
| 4289 | #line 1431 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4290 | { // Vector type? |
| 4291 | const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); |
| 4292 | if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4293 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 4294 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 4295 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4296 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4297 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4298 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4299 | ;} |
| 4300 | break; |
| 4301 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4302 | case 156: |
| 4303 | #line 1441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4304 | { // Structure type? |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4305 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4306 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), |
| 4307 | E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4308 | Elements.push_back(*I); |
| 4309 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4310 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 4311 | delete (yyvsp[(2) - (3)].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4312 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4313 | ;} |
| 4314 | break; |
| 4315 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4316 | case 157: |
| 4317 | #line 1451 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4318 | { // Empty structure type? |
| 4319 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4320 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4321 | ;} |
| 4322 | break; |
| 4323 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4324 | case 158: |
| 4325 | #line 1455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4326 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4327 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4328 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), |
| 4329 | E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4330 | Elements.push_back(*I); |
| 4331 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4332 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 4333 | delete (yyvsp[(3) - (5)].TypeList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4334 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4335 | ;} |
| 4336 | break; |
| 4337 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4338 | case 159: |
| 4339 | #line 1465 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4340 | { // Empty structure type? |
| 4341 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4342 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4343 | ;} |
| 4344 | break; |
| 4345 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4346 | case 160: |
| 4347 | #line 1472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4348 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4349 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4350 | // FIXME: remove in LLVM 3.0. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4351 | (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); |
| 4352 | (yyval.TypeWithAttrs).Attrs = ParamAttr::None; |
| 4353 | ;} |
| 4354 | break; |
| 4355 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4356 | case 161: |
| 4357 | #line 1481 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4358 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4359 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4360 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); |
| 4361 | 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] | 4362 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4363 | (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); |
| 4364 | ;} |
| 4365 | break; |
| 4366 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4367 | case 162: |
| 4368 | #line 1488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4369 | { |
| 4370 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 4371 | ;} |
| 4372 | break; |
| 4373 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4374 | case 163: |
| 4375 | #line 1493 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4376 | { |
| 4377 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 4378 | (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4379 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4380 | ;} |
| 4381 | break; |
| 4382 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4383 | case 164: |
| 4384 | #line 1498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4385 | { |
| 4386 | ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4387 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4388 | ;} |
| 4389 | break; |
| 4390 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4391 | case 166: |
| 4392 | #line 1506 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4393 | { |
| 4394 | (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 4395 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4396 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4397 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4398 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4399 | ;} |
| 4400 | break; |
| 4401 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4402 | case 167: |
| 4403 | #line 1513 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4404 | { |
| 4405 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4406 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 4407 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4408 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4409 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4410 | ;} |
| 4411 | break; |
| 4412 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4413 | case 168: |
| 4414 | #line 1520 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4415 | { |
| 4416 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4417 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4418 | ;} |
| 4419 | break; |
| 4420 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4421 | case 169: |
| 4422 | #line 1528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4423 | { |
| 4424 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 4425 | (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); |
| 4426 | delete (yyvsp[(1) - (1)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4427 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4428 | ;} |
| 4429 | break; |
| 4430 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4431 | case 170: |
| 4432 | #line 1534 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4433 | { |
| 4434 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); |
| 4435 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4436 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4437 | ;} |
| 4438 | break; |
| 4439 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4440 | case 171: |
| 4441 | #line 1546 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4442 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4443 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4444 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4445 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4446 | if (ATy == 0) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4447 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4448 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4449 | const Type *ETy = ATy->getElementType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4450 | uint64_t NumElements = ATy->getNumElements(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4451 | |
| 4452 | // Verify that we have the correct size... |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4453 | if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4454 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4455 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4456 | utostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4457 | |
| 4458 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4459 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4460 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4461 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4462 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4463 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4464 | } |
| 4465 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4466 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4467 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4468 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4469 | ;} |
| 4470 | break; |
| 4471 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4472 | case 172: |
| 4473 | #line 1574 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4474 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4475 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4476 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4477 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4478 | if (ATy == 0) |
| 4479 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4480 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4481 | |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4482 | uint64_t NumElements = ATy->getNumElements(); |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4483 | if (NumElements != uint64_t(-1) && NumElements != 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4484 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4485 | " arguments, but has size of " + utostr(NumElements) +""); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4486 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 4487 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4488 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4489 | ;} |
| 4490 | break; |
| 4491 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4492 | case 173: |
| 4493 | #line 1590 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4494 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4495 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4496 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4497 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4498 | if (ATy == 0) |
| 4499 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4500 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4501 | |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4502 | uint64_t NumElements = ATy->getNumElements(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4503 | const Type *ETy = ATy->getElementType(); |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4504 | if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4505 | GEN_ERROR("Can't build string constant of size " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4506 | utostr((yyvsp[(3) - (3)].StrVal)->length()) + |
| 4507 | " when array has size " + utostr(NumElements) + ""); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4508 | std::vector<Constant*> Vals; |
| 4509 | if (ETy == Type::Int8Ty) { |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4510 | for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4511 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4512 | } else { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4513 | delete (yyvsp[(3) - (3)].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4514 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 4515 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4516 | delete (yyvsp[(3) - (3)].StrVal); |
| 4517 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 4518 | delete (yyvsp[(1) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4519 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4520 | ;} |
| 4521 | break; |
| 4522 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4523 | case 174: |
| 4524 | #line 1617 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4525 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4526 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4527 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4528 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4529 | if (PTy == 0) |
| 4530 | GEN_ERROR("Cannot make packed constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4531 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4532 | const Type *ETy = PTy->getElementType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4533 | unsigned NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4534 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4535 | // Verify that we have the correct size... |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4536 | if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4537 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4538 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4539 | utostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4540 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4541 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4542 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4543 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4544 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4545 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4546 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4547 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4548 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4549 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4550 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4551 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4552 | ;} |
| 4553 | break; |
| 4554 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4555 | case 175: |
| 4556 | #line 1645 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4557 | { |
| 4558 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4559 | if (STy == 0) |
| 4560 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4561 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4562 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4563 | if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4564 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4565 | |
| 4566 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4567 | for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) |
| 4568 | if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4569 | GEN_ERROR("Expected type '" + |
| 4570 | STy->getElementType(i)->getDescription() + |
| 4571 | "' for element #" + utostr(i) + |
| 4572 | " of structure initializer"); |
| 4573 | |
| 4574 | // Check to ensure that Type is not packed |
| 4575 | if (STy->isPacked()) |
| 4576 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4577 | STy->getDescription() + "'"); |
| 4578 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4579 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4580 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4581 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4582 | ;} |
| 4583 | break; |
| 4584 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4585 | case 176: |
| 4586 | #line 1671 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4587 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4588 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4589 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4590 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4591 | if (STy == 0) |
| 4592 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4593 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4594 | |
| 4595 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4596 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4597 | |
| 4598 | // Check to ensure that Type is not packed |
| 4599 | if (STy->isPacked()) |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4600 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4601 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4602 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4603 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4604 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4605 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4606 | ;} |
| 4607 | break; |
| 4608 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4609 | case 177: |
| 4610 | #line 1691 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4611 | { |
| 4612 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4613 | if (STy == 0) |
| 4614 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4615 | (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4616 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4617 | if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4618 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4619 | |
| 4620 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4621 | for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) |
| 4622 | if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4623 | GEN_ERROR("Expected type '" + |
| 4624 | STy->getElementType(i)->getDescription() + |
| 4625 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4626 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4627 | |
| 4628 | // Check to ensure that Type is packed |
| 4629 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4630 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4631 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4632 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4633 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector)); |
| 4634 | delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4635 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4636 | ;} |
| 4637 | break; |
| 4638 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4639 | case 178: |
| 4640 | #line 1717 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4641 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4642 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4643 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); |
| 4644 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4645 | if (STy == 0) |
| 4646 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4647 | (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4648 | |
| 4649 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4650 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4651 | |
| 4652 | // Check to ensure that Type is packed |
| 4653 | if (!STy->isPacked()) |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4654 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4655 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4656 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4657 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4658 | delete (yyvsp[(1) - (5)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4659 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4660 | ;} |
| 4661 | break; |
| 4662 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4663 | case 179: |
| 4664 | #line 1737 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4665 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4666 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4667 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4668 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4669 | if (PTy == 0) |
| 4670 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4671 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4672 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4673 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4674 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4675 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4676 | ;} |
| 4677 | break; |
| 4678 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4679 | case 180: |
| 4680 | #line 1749 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4681 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4682 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4683 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4684 | (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); |
| 4685 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4686 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4687 | ;} |
| 4688 | break; |
| 4689 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4690 | case 181: |
| 4691 | #line 1756 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4692 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4693 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4694 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4695 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4696 | if (Ty == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4697 | 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] | 4698 | |
| 4699 | // ConstExprs can exist in the body of a function, thus creating |
| 4700 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4701 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4702 | // symbol table instead of the module symbol table for the global symbol, |
| 4703 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4704 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4705 | // |
| 4706 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4707 | CurFun.CurrentFunction = 0; |
| 4708 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4709 | Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4710 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4711 | |
| 4712 | CurFun.CurrentFunction = SavedCurFn; |
| 4713 | |
| 4714 | // If this is an initializer for a constant pointer, which is referencing a |
| 4715 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4716 | // in the future with the right type of variable. |
| 4717 | // |
| 4718 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4719 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4720 | const PointerType *PT = cast<PointerType>(Ty); |
| 4721 | |
| 4722 | // First check to see if the forward references value is already created! |
| 4723 | PerModuleInfo::GlobalRefsType::iterator I = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4724 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4725 | |
| 4726 | if (I != CurModule.GlobalRefs.end()) { |
| 4727 | V = I->second; // Placeholder already exists, use it... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4728 | (yyvsp[(2) - (2)].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4729 | } else { |
| 4730 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4731 | if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName) |
| 4732 | Name = (yyvsp[(2) - (2)].ValIDVal).getName(); |
| 4733 | else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4734 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4735 | |
| 4736 | // Create the forward referenced global. |
| 4737 | GlobalValue *GV; |
| 4738 | if (const FunctionType *FTy = |
| 4739 | dyn_cast<FunctionType>(PT->getElementType())) { |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 4740 | GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name, |
| 4741 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4742 | } else { |
| 4743 | GV = new GlobalVariable(PT->getElementType(), false, |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4744 | GlobalValue::ExternalWeakLinkage, 0, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4745 | Name, CurModule.CurrentModule); |
| 4746 | } |
| 4747 | |
| 4748 | // 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] | 4749 | 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] | 4750 | V = GV; |
| 4751 | } |
| 4752 | } |
| 4753 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4754 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4755 | delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4756 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4757 | ;} |
| 4758 | break; |
| 4759 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4760 | case 182: |
| 4761 | #line 1822 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4762 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4763 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4764 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4765 | if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4766 | GEN_ERROR("Mismatched types for constant expression: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4767 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription()); |
| 4768 | (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); |
| 4769 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4770 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4771 | ;} |
| 4772 | break; |
| 4773 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4774 | case 183: |
| 4775 | #line 1832 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4776 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4777 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4778 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4779 | const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4780 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4781 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4782 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4783 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4784 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4785 | ;} |
| 4786 | break; |
| 4787 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4788 | case 184: |
| 4789 | #line 1842 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4790 | { // integral constants |
| 4791 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4792 | GEN_ERROR("Constant value doesn't fit in type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4793 | (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] | 4794 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4795 | ;} |
| 4796 | break; |
| 4797 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4798 | case 185: |
| 4799 | #line 1848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4800 | { // arbitrary precision integer constants |
| 4801 | uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); |
| 4802 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4803 | GEN_ERROR("Constant value does not fit in type"); |
| 4804 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4805 | (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth); |
| 4806 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4807 | delete (yyvsp[(2) - (2)].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4808 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4809 | ;} |
| 4810 | break; |
| 4811 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4812 | case 186: |
| 4813 | #line 1858 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4814 | { // integral constants |
| 4815 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4816 | GEN_ERROR("Constant value doesn't fit in type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4817 | (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] | 4818 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4819 | ;} |
| 4820 | break; |
| 4821 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4822 | case 187: |
| 4823 | #line 1864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4824 | { // arbitrary precision integer constants |
| 4825 | uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); |
| 4826 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4827 | GEN_ERROR("Constant value does not fit in type"); |
| 4828 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4829 | (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth); |
| 4830 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4831 | delete (yyvsp[(2) - (2)].APIntVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4832 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4833 | ;} |
| 4834 | break; |
| 4835 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4836 | case 188: |
| 4837 | #line 1874 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4838 | { // Boolean constants |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 4839 | if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) |
| 4840 | GEN_ERROR("Constant true must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4841 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4842 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4843 | ;} |
| 4844 | break; |
| 4845 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4846 | case 189: |
| 4847 | #line 1880 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4848 | { // Boolean constants |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 4849 | if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1) |
| 4850 | GEN_ERROR("Constant false must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4851 | (yyval.ConstVal) = ConstantInt::getFalse(); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 4852 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4853 | ;} |
| 4854 | break; |
| 4855 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4856 | case 190: |
| 4857 | #line 1886 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4858 | { // Floating point constants |
| 4859 | if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4860 | GEN_ERROR("Floating point constant invalid for type"); |
Dale Johannesen | c72cd7e | 2007-09-11 18:33:39 +0000 | [diff] [blame] | 4861 | // Lexer has no type info, so builds all float and double FP constants |
| 4862 | // as double. Fix this here. Long double is done right. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4863 | if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy) |
| 4864 | (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 4865 | (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4866 | delete (yyvsp[(2) - (2)].FPVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4867 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4868 | ;} |
| 4869 | break; |
| 4870 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4871 | case 191: |
| 4872 | #line 1899 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4873 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4874 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4875 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); |
| 4876 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 4877 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 4878 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4879 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4880 | Val->getType()->getDescription() + "' to '" + |
| 4881 | DestTy->getDescription() + "'"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4882 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
| 4883 | delete (yyvsp[(5) - (6)].TypeVal); |
| 4884 | ;} |
| 4885 | break; |
| 4886 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4887 | case 192: |
| 4888 | #line 1911 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4889 | { |
| 4890 | if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4891 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4892 | |
| 4893 | const Type *IdxTy = |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 4894 | 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] | 4895 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4896 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4897 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 4898 | SmallVector<Constant*, 8> IdxVec; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4899 | for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) |
| 4900 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4901 | IdxVec.push_back(C); |
| 4902 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4903 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4904 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4905 | delete (yyvsp[(4) - (5)].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4906 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4907 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4908 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4909 | ;} |
| 4910 | break; |
| 4911 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4912 | case 193: |
| 4913 | #line 1932 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4914 | { |
| 4915 | if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4916 | GEN_ERROR("Select condition must be of boolean type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4917 | if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4918 | GEN_ERROR("Select operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4919 | (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] | 4920 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4921 | ;} |
| 4922 | break; |
| 4923 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4924 | case 194: |
| 4925 | #line 1940 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4926 | { |
| 4927 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4928 | GEN_ERROR("Binary operator types must match"); |
| 4929 | CHECK_FOR_ERROR; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4930 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
| 4931 | ;} |
| 4932 | break; |
| 4933 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4934 | case 195: |
| 4935 | #line 1946 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4936 | { |
| 4937 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4938 | GEN_ERROR("Logical operator types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4939 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) { |
Nate Begeman | 5bc1ea0 | 2008-07-29 15:49:41 +0000 | [diff] [blame] | 4940 | if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) || |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4941 | !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4942 | GEN_ERROR("Logical operator requires integral operands"); |
| 4943 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4944 | (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] | 4945 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4946 | ;} |
| 4947 | break; |
| 4948 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4949 | case 196: |
| 4950 | #line 1957 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4951 | { |
| 4952 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4953 | GEN_ERROR("icmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4954 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4955 | ;} |
| 4956 | break; |
| 4957 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4958 | case 197: |
| 4959 | #line 1962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4960 | { |
| 4961 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4962 | GEN_ERROR("fcmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4963 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4964 | ;} |
| 4965 | break; |
| 4966 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4967 | case 198: |
| 4968 | #line 1967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 4969 | { |
| 4970 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 4971 | GEN_ERROR("vicmp operand types must match"); |
| 4972 | (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4973 | ;} |
| 4974 | break; |
| 4975 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4976 | case 199: |
| 4977 | #line 1972 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 4978 | { |
| 4979 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 4980 | GEN_ERROR("vfcmp operand types must match"); |
| 4981 | (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4982 | ;} |
| 4983 | break; |
| 4984 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4985 | case 200: |
| 4986 | #line 1977 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4987 | { |
| 4988 | if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4989 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4990 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4991 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4992 | ;} |
| 4993 | break; |
| 4994 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 4995 | case 201: |
| 4996 | #line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4997 | { |
| 4998 | 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] | 4999 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5000 | (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] | 5001 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5002 | ;} |
| 5003 | break; |
| 5004 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5005 | case 202: |
| 5006 | #line 1989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5007 | { |
| 5008 | 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] | 5009 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5010 | (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] | 5011 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5012 | ;} |
| 5013 | break; |
| 5014 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5015 | case 203: |
| 5016 | #line 1995 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5017 | { |
| 5018 | if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
| 5019 | GEN_ERROR("ExtractValue requires an aggregate operand"); |
| 5020 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5021 | (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size()); |
| 5022 | delete (yyvsp[(4) - (5)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5023 | CHECK_FOR_ERROR |
| 5024 | ;} |
| 5025 | break; |
| 5026 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5027 | case 204: |
| 5028 | #line 2003 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5029 | { |
| 5030 | if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType())) |
| 5031 | GEN_ERROR("InsertValue requires an aggregate operand"); |
| 5032 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5033 | (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size()); |
| 5034 | delete (yyvsp[(6) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5035 | CHECK_FOR_ERROR |
| 5036 | ;} |
| 5037 | break; |
| 5038 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5039 | case 205: |
| 5040 | #line 2014 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5041 | { |
| 5042 | ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5043 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5044 | ;} |
| 5045 | break; |
| 5046 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5047 | case 206: |
| 5048 | #line 2018 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5049 | { |
| 5050 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 5051 | (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5052 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5053 | ;} |
| 5054 | break; |
| 5055 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5056 | case 207: |
| 5057 | #line 2026 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5058 | { (yyval.BoolVal) = false; ;} |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 5059 | break; |
| 5060 | |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 5061 | case 208: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5062 | #line 2026 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5063 | { (yyval.BoolVal) = true; ;} |
| 5064 | break; |
| 5065 | |
| 5066 | case 209: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5067 | #line 2029 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5068 | { (yyval.BoolVal) = true; ;} |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5069 | break; |
| 5070 | |
| 5071 | case 210: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5072 | #line 2029 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5073 | { (yyval.BoolVal) = false; ;} |
| 5074 | break; |
| 5075 | |
| 5076 | case 211: |
| 5077 | #line 2032 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5078 | { |
| 5079 | const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); |
| 5080 | Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); |
Chris Lattner | 0275cff | 2007-08-06 21:00:46 +0000 | [diff] [blame] | 5081 | CHECK_FOR_ERROR |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5082 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 5083 | if (!Aliasee) |
| 5084 | GEN_ERROR("Aliases can be created only to global values"); |
| 5085 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5086 | (yyval.ConstVal) = Aliasee; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5087 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5088 | delete (yyvsp[(1) - (2)].TypeVal); |
| 5089 | ;} |
| 5090 | break; |
| 5091 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5092 | case 212: |
| 5093 | #line 2044 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5094 | { |
| 5095 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 5096 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 5097 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5098 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5099 | Val->getType()->getDescription() + "' to '" + |
| 5100 | DestTy->getDescription() + "'"); |
| 5101 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5102 | (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] | 5103 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5104 | delete (yyvsp[(5) - (6)].TypeVal); |
| 5105 | ;} |
| 5106 | break; |
| 5107 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5108 | case 213: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5109 | #line 2065 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 5110 | { |
| 5111 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 5112 | CurModule.ModuleDone(); |
| 5113 | CHECK_FOR_ERROR; |
| 5114 | ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5115 | break; |
| 5116 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5117 | case 214: |
| 5118 | #line 2070 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5119 | { |
| 5120 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 5121 | CurModule.ModuleDone(); |
| 5122 | CHECK_FOR_ERROR; |
| 5123 | ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 5124 | break; |
| 5125 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5126 | case 217: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5127 | #line 2083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5128 | { CurFun.isDeclare = false; ;} |
| 5129 | break; |
| 5130 | |
| 5131 | case 218: |
| 5132 | #line 2083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5133 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5134 | CurFun.FunctionDone(); |
| 5135 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5136 | ;} |
| 5137 | break; |
| 5138 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5139 | case 219: |
| 5140 | #line 2087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5141 | { CurFun.isDeclare = true; ;} |
| 5142 | break; |
| 5143 | |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5144 | case 220: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5145 | #line 2087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5146 | { |
| 5147 | CHECK_FOR_ERROR |
| 5148 | ;} |
| 5149 | break; |
| 5150 | |
| 5151 | case 221: |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5152 | #line 2090 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
| 5153 | { |
| 5154 | CHECK_FOR_ERROR |
| 5155 | ;} |
| 5156 | break; |
| 5157 | |
| 5158 | case 222: |
| 5159 | #line 2093 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5160 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5161 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5162 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5163 | // Eagerly resolve types. This is not an optimization, this is a |
| 5164 | // requirement that is due to the fact that we could have this: |
| 5165 | // |
| 5166 | // %list = type { %list * } |
| 5167 | // %list = type { %list * } ; repeated type decl |
| 5168 | // |
| 5169 | // If types are not resolved eagerly, then the two types will not be |
| 5170 | // determined to be the same type! |
| 5171 | // |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5172 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5173 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5174 | 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] | 5175 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5176 | // If this is a named type that is not a redefinition, add it to the slot |
| 5177 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5178 | CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5179 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5180 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5181 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5182 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5183 | ;} |
| 5184 | break; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5185 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5186 | case 223: |
| 5187 | #line 2117 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5188 | { |
| 5189 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); |
| 5190 | |
| 5191 | 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] | 5192 | CHECK_FOR_ERROR |
| 5193 | // If this is a named type that is not a redefinition, add it to the slot |
| 5194 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5195 | CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5196 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5197 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5198 | ;} |
| 5199 | break; |
| 5200 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5201 | case 224: |
| 5202 | #line 2129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5203 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5204 | /* "Externally Visible" Linkage */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5205 | if ((yyvsp[(5) - (6)].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5206 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5207 | CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage, |
| 5208 | (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] | 5209 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5210 | ;} |
| 5211 | break; |
| 5212 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5213 | case 225: |
| 5214 | #line 2136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5215 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5216 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5217 | ;} |
| 5218 | break; |
| 5219 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5220 | case 226: |
| 5221 | #line 2140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5222 | { |
| 5223 | if ((yyvsp[(6) - (7)].ConstVal) == 0) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5224 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5225 | 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] | 5226 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5227 | ;} |
| 5228 | break; |
| 5229 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5230 | case 227: |
| 5231 | #line 2145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5232 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5233 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5234 | ;} |
| 5235 | break; |
| 5236 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5237 | case 228: |
| 5238 | #line 2149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5239 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5240 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5241 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); |
| 5242 | 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] | 5243 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5244 | delete (yyvsp[(6) - (7)].TypeVal); |
| 5245 | ;} |
| 5246 | break; |
| 5247 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5248 | case 229: |
| 5249 | #line 2155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5250 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5251 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5252 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5253 | ;} |
| 5254 | break; |
| 5255 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5256 | case 230: |
| 5257 | #line 2159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5258 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5259 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5260 | if ((yyvsp[(1) - (5)].StrVal)) { |
| 5261 | Name = *(yyvsp[(1) - (5)].StrVal); |
| 5262 | delete (yyvsp[(1) - (5)].StrVal); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5263 | } |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5264 | if (Name.empty()) |
| 5265 | GEN_ERROR("Alias name cannot be empty"); |
| 5266 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5267 | Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5268 | if (Aliasee == 0) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5269 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5270 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5271 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee, |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5272 | CurModule.CurrentModule); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5273 | GA->setVisibility((yyvsp[(2) - (5)].Visibility)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5274 | InsertValue(GA, CurModule.Values); |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5275 | |
| 5276 | |
| 5277 | // If there was a forward reference of this alias, resolve it now. |
| 5278 | |
| 5279 | ValID ID; |
| 5280 | if (!Name.empty()) |
| 5281 | ID = ValID::createGlobalName(Name); |
| 5282 | else |
| 5283 | ID = ValID::createGlobalID(CurModule.Values.size()-1); |
| 5284 | |
| 5285 | if (GlobalValue *FWGV = |
| 5286 | CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { |
| 5287 | // Replace uses of the fwdref with the actual alias. |
| 5288 | FWGV->replaceAllUsesWith(GA); |
| 5289 | if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV)) |
| 5290 | GV->eraseFromParent(); |
| 5291 | else |
| 5292 | cast<Function>(FWGV)->eraseFromParent(); |
| 5293 | } |
| 5294 | ID.destroy(); |
| 5295 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5296 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5297 | ;} |
| 5298 | break; |
| 5299 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5300 | case 231: |
| 5301 | #line 2199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5302 | { |
Anton Korobeynikov | 77d0f97 | 2007-04-25 14:29:12 +0000 | [diff] [blame] | 5303 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5304 | ;} |
| 5305 | break; |
| 5306 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5307 | case 232: |
| 5308 | #line 2202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5309 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5310 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5311 | ;} |
| 5312 | break; |
| 5313 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5314 | case 233: |
| 5315 | #line 2208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5316 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5317 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5318 | if (AsmSoFar.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5319 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5320 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5321 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal)); |
| 5322 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5323 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5324 | ;} |
| 5325 | break; |
| 5326 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5327 | case 234: |
| 5328 | #line 2218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5329 | { |
| 5330 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); |
| 5331 | delete (yyvsp[(3) - (3)].StrVal); |
| 5332 | ;} |
| 5333 | break; |
| 5334 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5335 | case 235: |
| 5336 | #line 2222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5337 | { |
| 5338 | CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); |
| 5339 | delete (yyvsp[(3) - (3)].StrVal); |
| 5340 | ;} |
| 5341 | break; |
| 5342 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5343 | case 237: |
| 5344 | #line 2229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5345 | { |
| 5346 | CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); |
| 5347 | delete (yyvsp[(3) - (3)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5348 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5349 | ;} |
| 5350 | break; |
| 5351 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5352 | case 238: |
| 5353 | #line 2234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5354 | { |
| 5355 | CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); |
| 5356 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 1013b4d | 2007-07-31 14:41:17 +0000 | [diff] [blame] | 5357 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5358 | ;} |
| 5359 | break; |
| 5360 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5361 | case 239: |
| 5362 | #line 2239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5363 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5364 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5365 | ;} |
| 5366 | break; |
| 5367 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5368 | case 240: |
| 5369 | #line 2248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5370 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5371 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5372 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5373 | if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType()) |
| 5374 | GEN_ERROR("Argument types must be first-class"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5375 | ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal); |
| 5376 | (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList); |
| 5377 | (yyvsp[(1) - (5)].ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5378 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5379 | ;} |
| 5380 | break; |
| 5381 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5382 | case 241: |
| 5383 | #line 2258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5384 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5385 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5386 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5387 | if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType()) |
| 5388 | GEN_ERROR("Argument types must be first-class"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5389 | ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal); |
| 5390 | (yyval.ArgList) = new ArgListType; |
| 5391 | (yyval.ArgList)->push_back(E); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5392 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5393 | ;} |
| 5394 | break; |
| 5395 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5396 | case 242: |
| 5397 | #line 2269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5398 | { |
| 5399 | (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5400 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5401 | ;} |
| 5402 | break; |
| 5403 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5404 | case 243: |
| 5405 | #line 2273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5406 | { |
| 5407 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5408 | struct ArgListEntry E; |
| 5409 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5410 | E.Name = 0; |
Reid Spencer | 18da072 | 2007-04-11 02:44:20 +0000 | [diff] [blame] | 5411 | E.Attrs = ParamAttr::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5412 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5413 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5414 | ;} |
| 5415 | break; |
| 5416 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5417 | case 244: |
| 5418 | #line 2282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5419 | { |
| 5420 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5421 | struct ArgListEntry E; |
| 5422 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5423 | E.Name = 0; |
| 5424 | E.Attrs = ParamAttr::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5425 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5426 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5427 | ;} |
| 5428 | break; |
| 5429 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5430 | case 245: |
| 5431 | #line 2291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5432 | { |
| 5433 | (yyval.ArgList) = 0; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5434 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5435 | ;} |
| 5436 | break; |
| 5437 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5438 | case 246: |
| 5439 | #line 2297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5440 | { |
| 5441 | std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); |
| 5442 | delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5443 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5444 | // Check the function result for abstractness if this is a define. We should |
| 5445 | // have no abstract types at this point |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5446 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal))) |
| 5447 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5448 | |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 5449 | if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal))) |
| 5450 | GEN_ERROR("Invalid result type for LLVM function"); |
| 5451 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5452 | std::vector<const Type*> ParamTypeList; |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5453 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5454 | if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) |
| 5455 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs))); |
| 5456 | if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments... |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5457 | unsigned index = 1; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5458 | 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] | 5459 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5460 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 5461 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5462 | ParamTypeList.push_back(Ty); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5463 | if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None) |
| 5464 | Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5465 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5466 | } |
| 5467 | |
| 5468 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 5469 | if (isVarArg) ParamTypeList.pop_back(); |
| 5470 | |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5471 | PAListPtr PAL; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5472 | if (!Attrs.empty()) |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5473 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5474 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5475 | FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5476 | const PointerType *PFT = PointerType::getUnqual(FT); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5477 | delete (yyvsp[(2) - (10)].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5478 | |
| 5479 | ValID ID; |
| 5480 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5481 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5482 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5483 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5484 | } |
| 5485 | |
| 5486 | Function *Fn = 0; |
| 5487 | // See if this function was forward referenced. If so, recycle the object. |
| 5488 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 5489 | // Move the function to the end of the list, from whereever it was |
| 5490 | // previously inserted. |
| 5491 | Fn = cast<Function>(FWRef); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5492 | assert(Fn->getParamAttrs().isEmpty() && |
| 5493 | "Forward reference has parameter attributes!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5494 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 5495 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 5496 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5497 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5498 | if (Fn->getFunctionType() != FT ) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5499 | // The existing function doesn't have the same type. This is an overload |
| 5500 | // error. |
| 5501 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5502 | } else if (Fn->getParamAttrs() != PAL) { |
| 5503 | // The existing function doesn't have the same parameter attributes. |
| 5504 | // This is an overload error. |
| 5505 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5506 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5507 | // Neither the existing or the current function is a declaration and they |
| 5508 | // have the same name and same type. Clearly this is a redefinition. |
| 5509 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5510 | } else if (Fn->isDeclaration()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5511 | // 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] | 5512 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 5513 | AI != AE; ++AI) |
| 5514 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5515 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5516 | } else { // Not already defined? |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5517 | Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
| 5518 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5519 | InsertValue(Fn, CurModule.Values); |
| 5520 | } |
| 5521 | |
| 5522 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5523 | |
| 5524 | if (CurFun.isDeclare) { |
| 5525 | // If we have declaration, always overwrite linkage. This will allow us to |
| 5526 | // correctly handle cases, when pointer to function is passed as argument to |
| 5527 | // another function. |
| 5528 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 5529 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5530 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5531 | Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal)); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5532 | Fn->setParamAttrs(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5533 | Fn->setAlignment((yyvsp[(9) - (10)].UIntVal)); |
| 5534 | if ((yyvsp[(8) - (10)].StrVal)) { |
| 5535 | Fn->setSection(*(yyvsp[(8) - (10)].StrVal)); |
| 5536 | delete (yyvsp[(8) - (10)].StrVal); |
Gordon Henriksen | 80a75bf | 2007-12-10 03:18:06 +0000 | [diff] [blame] | 5537 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5538 | if ((yyvsp[(10) - (10)].StrVal)) { |
| 5539 | Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str()); |
| 5540 | delete (yyvsp[(10) - (10)].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 5541 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5542 | |
| 5543 | // Add all of the arguments we parsed to the function... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5544 | if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5545 | if (isVarArg) { // Nuke the last entry |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5546 | 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] | 5547 | "Not a varargs marker!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5548 | delete (yyvsp[(5) - (10)].ArgList)->back().Ty; |
| 5549 | (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5550 | } |
| 5551 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5552 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5553 | unsigned Idx = 1; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5554 | for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); |
| 5555 | I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5556 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5557 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5558 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5559 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5560 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5561 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5562 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5563 | 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] | 5564 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5565 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5566 | ;} |
| 5567 | break; |
| 5568 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5569 | case 249: |
| 5570 | #line 2427 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5571 | { |
| 5572 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5573 | |
| 5574 | // Make sure that we keep track of the linkage type even if there was a |
| 5575 | // previous "declare". |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5576 | (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); |
| 5577 | (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility)); |
| 5578 | ;} |
| 5579 | break; |
| 5580 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5581 | case 252: |
| 5582 | #line 2438 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5583 | { |
| 5584 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5585 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5586 | ;} |
| 5587 | break; |
| 5588 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5589 | case 253: |
| 5590 | #line 2443 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5591 | { |
| 5592 | CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); |
| 5593 | CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); |
| 5594 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5595 | CurFun.FunctionDone(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5596 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5597 | ;} |
| 5598 | break; |
| 5599 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5600 | case 254: |
| 5601 | #line 2455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5602 | { |
| 5603 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5604 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5605 | ;} |
| 5606 | break; |
| 5607 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5608 | case 255: |
| 5609 | #line 2459 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5610 | { |
| 5611 | (yyval.BoolVal) = true; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5612 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5613 | ;} |
| 5614 | break; |
| 5615 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5616 | case 256: |
| 5617 | #line 2464 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5618 | { // A reference to a direct constant |
| 5619 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5620 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5621 | ;} |
| 5622 | break; |
| 5623 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5624 | case 257: |
| 5625 | #line 2468 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5626 | { |
| 5627 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5628 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5629 | ;} |
| 5630 | break; |
| 5631 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5632 | case 258: |
| 5633 | #line 2472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 5634 | { // arbitrary precision integer constants |
| 5635 | (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true); |
| 5636 | delete (yyvsp[(1) - (1)].APIntVal); |
| 5637 | CHECK_FOR_ERROR |
| 5638 | ;} |
| 5639 | break; |
| 5640 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5641 | case 259: |
| 5642 | #line 2477 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 5643 | { // arbitrary precision integer constants |
| 5644 | (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false); |
| 5645 | delete (yyvsp[(1) - (1)].APIntVal); |
| 5646 | CHECK_FOR_ERROR |
| 5647 | ;} |
| 5648 | break; |
| 5649 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5650 | case 260: |
| 5651 | #line 2482 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5652 | { // Perhaps it's an FP constant? |
| 5653 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5654 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5655 | ;} |
| 5656 | break; |
| 5657 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5658 | case 261: |
| 5659 | #line 2486 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5660 | { |
| 5661 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5662 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5663 | ;} |
| 5664 | break; |
| 5665 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5666 | case 262: |
| 5667 | #line 2490 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5668 | { |
| 5669 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5670 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5671 | ;} |
| 5672 | break; |
| 5673 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5674 | case 263: |
| 5675 | #line 2494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5676 | { |
| 5677 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5678 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5679 | ;} |
| 5680 | break; |
| 5681 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5682 | case 264: |
| 5683 | #line 2498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5684 | { |
| 5685 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5686 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5687 | ;} |
| 5688 | break; |
| 5689 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5690 | case 265: |
| 5691 | #line 2502 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5692 | { // A vector zero constant. |
| 5693 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5694 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5695 | ;} |
| 5696 | break; |
| 5697 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5698 | case 266: |
| 5699 | #line 2506 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5700 | { // Nonempty unsized packed vector |
| 5701 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5702 | unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5703 | |
| 5704 | if (!ETy->isInteger() && !ETy->isFloatingPoint()) |
| 5705 | GEN_ERROR("Invalid vector element type: " + ETy->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5706 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5707 | VectorType* pt = VectorType::get(ETy, NumElements); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5708 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5709 | |
| 5710 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5711 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5712 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5713 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5714 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5715 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5716 | } |
| 5717 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5718 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector))); |
| 5719 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5720 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5721 | ;} |
| 5722 | break; |
| 5723 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5724 | case 267: |
| 5725 | #line 2528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5726 | { // Nonempty unsized arr |
| 5727 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5728 | uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5729 | |
| 5730 | if (!ETy->isFirstClassType()) |
| 5731 | GEN_ERROR("Invalid array element type: " + ETy->getDescription()); |
| 5732 | |
| 5733 | ArrayType *ATy = ArrayType::get(ETy, NumElements); |
| 5734 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy)); |
| 5735 | |
| 5736 | // Verify all elements are correct type! |
| 5737 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5738 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
| 5739 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 5740 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
| 5741 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
| 5742 | } |
| 5743 | |
| 5744 | (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector))); |
| 5745 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
| 5746 | CHECK_FOR_ERROR |
| 5747 | ;} |
| 5748 | break; |
| 5749 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5750 | case 268: |
| 5751 | #line 2550 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5752 | { |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5753 | // Use undef instead of an array because it's inconvenient to determine |
| 5754 | // the element type at this point, there being no elements to examine. |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5755 | (yyval.ValIDVal) = ValID::createUndef(); |
| 5756 | CHECK_FOR_ERROR |
| 5757 | ;} |
| 5758 | break; |
| 5759 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5760 | case 269: |
| 5761 | #line 2556 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5762 | { |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5763 | uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5764 | const Type *ETy = Type::Int8Ty; |
| 5765 | |
| 5766 | ArrayType *ATy = ArrayType::get(ETy, NumElements); |
| 5767 | |
| 5768 | std::vector<Constant*> Vals; |
| 5769 | for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i) |
| 5770 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i])); |
| 5771 | delete (yyvsp[(2) - (2)].StrVal); |
| 5772 | (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals)); |
| 5773 | CHECK_FOR_ERROR |
| 5774 | ;} |
| 5775 | break; |
| 5776 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5777 | case 270: |
| 5778 | #line 2569 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5779 | { |
| 5780 | std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size()); |
| 5781 | for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i) |
| 5782 | Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType(); |
| 5783 | |
| 5784 | const StructType *STy = StructType::get(Elements); |
| 5785 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy)); |
| 5786 | |
| 5787 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector))); |
| 5788 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
| 5789 | CHECK_FOR_ERROR |
| 5790 | ;} |
| 5791 | break; |
| 5792 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5793 | case 271: |
| 5794 | #line 2581 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5795 | { |
| 5796 | const StructType *STy = StructType::get(std::vector<const Type*>()); |
| 5797 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>())); |
| 5798 | CHECK_FOR_ERROR |
| 5799 | ;} |
| 5800 | break; |
| 5801 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5802 | case 272: |
| 5803 | #line 2586 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5804 | { |
| 5805 | std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size()); |
| 5806 | for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i) |
| 5807 | Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType(); |
| 5808 | |
| 5809 | const StructType *STy = StructType::get(Elements, /*isPacked=*/true); |
| 5810 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy)); |
| 5811 | |
| 5812 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector))); |
| 5813 | delete PTy; delete (yyvsp[(3) - (5)].ConstVector); |
| 5814 | CHECK_FOR_ERROR |
| 5815 | ;} |
| 5816 | break; |
| 5817 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5818 | case 273: |
| 5819 | #line 2598 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5820 | { |
| 5821 | const StructType *STy = StructType::get(std::vector<const Type*>(), |
| 5822 | /*isPacked=*/true); |
| 5823 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>())); |
| 5824 | CHECK_FOR_ERROR |
| 5825 | ;} |
| 5826 | break; |
| 5827 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5828 | case 274: |
| 5829 | #line 2604 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5830 | { |
| 5831 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5832 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5833 | ;} |
| 5834 | break; |
| 5835 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5836 | case 275: |
| 5837 | #line 2608 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5838 | { |
| 5839 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); |
| 5840 | delete (yyvsp[(3) - (5)].StrVal); |
| 5841 | delete (yyvsp[(5) - (5)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5842 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5843 | ;} |
| 5844 | break; |
| 5845 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5846 | case 276: |
| 5847 | #line 2618 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5848 | { // Is it an integer reference...? |
| 5849 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5850 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5851 | ;} |
| 5852 | break; |
| 5853 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5854 | case 277: |
| 5855 | #line 2622 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5856 | { |
| 5857 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5858 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5859 | ;} |
| 5860 | break; |
| 5861 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5862 | case 278: |
| 5863 | #line 2626 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5864 | { // Is it a named reference...? |
| 5865 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5866 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5867 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5868 | ;} |
| 5869 | break; |
| 5870 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5871 | case 279: |
| 5872 | #line 2631 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5873 | { // Is it a named reference...? |
| 5874 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5875 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5876 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5877 | ;} |
| 5878 | break; |
| 5879 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5880 | case 282: |
| 5881 | #line 2644 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5882 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5883 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5884 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 5885 | (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); |
| 5886 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5887 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5888 | ;} |
| 5889 | break; |
| 5890 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5891 | case 283: |
| 5892 | #line 2653 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5893 | { |
| 5894 | (yyval.ValueList) = new std::vector<Value *>(); |
| 5895 | (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5896 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5897 | ;} |
| 5898 | break; |
| 5899 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5900 | case 284: |
| 5901 | #line 2658 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5902 | { |
| 5903 | ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5904 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5905 | ;} |
| 5906 | break; |
| 5907 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5908 | case 285: |
| 5909 | #line 2663 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5910 | { |
| 5911 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5912 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5913 | ;} |
| 5914 | break; |
| 5915 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5916 | case 286: |
| 5917 | #line 2667 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5918 | { // Do not allow functions with 0 basic blocks |
| 5919 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5920 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5921 | ;} |
| 5922 | break; |
| 5923 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5924 | case 287: |
| 5925 | #line 2676 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5926 | { |
| 5927 | setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5928 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5929 | InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 5930 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 5931 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5932 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5933 | ;} |
| 5934 | break; |
| 5935 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5936 | case 288: |
| 5937 | #line 2685 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5938 | { |
| 5939 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5940 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 5941 | if (CI2->getParent() == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5942 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); |
| 5943 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); |
| 5944 | (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5945 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5946 | ;} |
| 5947 | break; |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5948 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5949 | case 289: |
| 5950 | #line 2694 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5951 | { // Empty space between instruction lists |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5952 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5953 | CHECK_FOR_ERROR |
| 5954 | ;} |
| 5955 | break; |
| 5956 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5957 | case 290: |
| 5958 | #line 2698 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5959 | { // Labelled (named) basic block |
| 5960 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); |
| 5961 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5962 | CHECK_FOR_ERROR |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5963 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5964 | ;} |
| 5965 | break; |
| 5966 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5967 | case 291: |
| 5968 | #line 2706 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5969 | { // Return with a result... |
| 5970 | ValueList &VL = *(yyvsp[(2) - (2)].ValueList); |
| 5971 | assert(!VL.empty() && "Invalid ret operands!"); |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 5972 | const Type *ReturnType = CurFun.CurrentFunction->getReturnType(); |
| 5973 | if (VL.size() > 1 || |
| 5974 | (isa<StructType>(ReturnType) && |
| 5975 | (VL.empty() || VL[0]->getType() != ReturnType))) { |
| 5976 | Value *RV = UndefValue::get(ReturnType); |
| 5977 | for (unsigned i = 0, e = VL.size(); i != e; ++i) { |
| 5978 | Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv"); |
| 5979 | ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I); |
| 5980 | RV = I; |
| 5981 | } |
| 5982 | (yyval.TermInstVal) = ReturnInst::Create(RV); |
| 5983 | } else { |
| 5984 | (yyval.TermInstVal) = ReturnInst::Create(VL[0]); |
| 5985 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5986 | delete (yyvsp[(2) - (2)].ValueList); |
| 5987 | CHECK_FOR_ERROR |
| 5988 | ;} |
| 5989 | break; |
| 5990 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5991 | case 292: |
| 5992 | #line 2726 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5993 | { // Return with no result... |
| 5994 | (yyval.TermInstVal) = ReturnInst::Create(); |
| 5995 | CHECK_FOR_ERROR |
| 5996 | ;} |
| 5997 | break; |
| 5998 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 5999 | case 293: |
| 6000 | #line 2730 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6001 | { // Unconditional Branch... |
| 6002 | BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); |
| 6003 | CHECK_FOR_ERROR |
| 6004 | (yyval.TermInstVal) = BranchInst::Create(tmpBB); |
| 6005 | ;} |
| 6006 | break; |
| 6007 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6008 | case 294: |
| 6009 | #line 2735 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6010 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6011 | if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) |
| 6012 | GEN_ERROR("Branch condition must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6013 | BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 6014 | CHECK_FOR_ERROR |
| 6015 | BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); |
| 6016 | CHECK_FOR_ERROR |
| 6017 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); |
| 6018 | CHECK_FOR_ERROR |
| 6019 | (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal); |
| 6020 | ;} |
| 6021 | break; |
| 6022 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6023 | case 295: |
| 6024 | #line 2746 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6025 | { |
| 6026 | Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); |
| 6027 | CHECK_FOR_ERROR |
| 6028 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 6029 | CHECK_FOR_ERROR |
| 6030 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); |
| 6031 | (yyval.TermInstVal) = S; |
| 6032 | |
| 6033 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), |
| 6034 | E = (yyvsp[(8) - (9)].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6035 | for (; I != E; ++I) { |
| 6036 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 6037 | S->addCase(CI, I->second); |
| 6038 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6039 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6040 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6041 | delete (yyvsp[(8) - (9)].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6042 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6043 | ;} |
| 6044 | break; |
| 6045 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6046 | case 296: |
| 6047 | #line 2765 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6048 | { |
| 6049 | Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6050 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6051 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6052 | CHECK_FOR_ERROR |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6053 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6054 | (yyval.TermInstVal) = S; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6055 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6056 | ;} |
| 6057 | break; |
| 6058 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6059 | case 297: |
| 6060 | #line 2775 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6061 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 6062 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6063 | // Handle the short syntax |
| 6064 | const PointerType *PFTy = 0; |
| 6065 | const FunctionType *Ty = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6066 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6067 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6068 | // Pull out the types of all of the arguments... |
| 6069 | std::vector<const Type*> ParamTypes; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6070 | 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] | 6071 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6072 | const Type *Ty = I->Val->getType(); |
| 6073 | if (Ty == Type::VoidTy) |
| 6074 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6075 | ParamTypes.push_back(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6076 | } |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6077 | |
| 6078 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal))) |
| 6079 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6080 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6081 | Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6082 | PFTy = PointerType::getUnqual(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6083 | } |
| 6084 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6085 | delete (yyvsp[(3) - (14)].TypeVal); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 6086 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6087 | 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] | 6088 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6089 | BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6090 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6091 | BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 6092 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6093 | |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6094 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6095 | if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) |
| 6096 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs))); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6097 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6098 | // Check the arguments |
| 6099 | ValueList Args; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6100 | if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6101 | // Make sure no arguments is a good thing! |
| 6102 | if (Ty->getNumParams() != 0) |
| 6103 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6104 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6105 | } else { // Has arguments? |
| 6106 | // Loop through FunctionType's arguments and ensure they are specified |
| 6107 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6108 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6109 | FunctionType::param_iterator E = Ty->param_end(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6110 | 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] | 6111 | unsigned index = 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6112 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6113 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6114 | if (ArgI->Val->getType() != *I) |
| 6115 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6116 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6117 | Args.push_back(ArgI->Val); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6118 | if (ArgI->Attrs != ParamAttr::None) |
| 6119 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6120 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6121 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6122 | if (Ty->isVarArg()) { |
| 6123 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6124 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6125 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6126 | if (ArgI->Attrs != ParamAttr::None) |
| 6127 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6128 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6129 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6130 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6131 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6132 | |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6133 | PAListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6134 | if (!Attrs.empty()) |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6135 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6136 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6137 | // Create the InvokeInst |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 6138 | InvokeInst *II = InvokeInst::Create(V, Normal, Except, |
| 6139 | Args.begin(), Args.end()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6140 | II->setCallingConv((yyvsp[(2) - (14)].UIntVal)); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6141 | II->setParamAttrs(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6142 | (yyval.TermInstVal) = II; |
| 6143 | delete (yyvsp[(6) - (14)].ParamList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6144 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6145 | ;} |
| 6146 | break; |
| 6147 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6148 | case 298: |
| 6149 | #line 2860 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6150 | { |
| 6151 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6152 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6153 | ;} |
| 6154 | break; |
| 6155 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6156 | case 299: |
| 6157 | #line 2864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6158 | { |
| 6159 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6160 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6161 | ;} |
| 6162 | break; |
| 6163 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6164 | case 300: |
| 6165 | #line 2871 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6166 | { |
| 6167 | (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); |
| 6168 | 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] | 6169 | CHECK_FOR_ERROR |
| 6170 | if (V == 0) |
| 6171 | GEN_ERROR("May only switch on a constant pool value"); |
| 6172 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6173 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6174 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6175 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 6176 | ;} |
| 6177 | break; |
| 6178 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6179 | case 301: |
| 6180 | #line 2882 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6181 | { |
| 6182 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 6183 | 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] | 6184 | CHECK_FOR_ERROR |
| 6185 | |
| 6186 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6187 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6188 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6189 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6190 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6191 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 6192 | ;} |
| 6193 | break; |
| 6194 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6195 | case 302: |
| 6196 | #line 2895 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6197 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6198 | // Is this definition named?? if so, assign the name... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6199 | setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6200 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6201 | InsertValue((yyvsp[(2) - (2)].InstVal)); |
| 6202 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6203 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6204 | ;} |
| 6205 | break; |
| 6206 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6207 | case 303: |
| 6208 | #line 2905 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6209 | { // Used for PHI nodes |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6210 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6211 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); |
| 6212 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 6213 | Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 6214 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6215 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6216 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6217 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6218 | delete (yyvsp[(1) - (6)].TypeVal); |
| 6219 | ;} |
| 6220 | break; |
| 6221 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6222 | case 304: |
| 6223 | #line 2916 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6224 | { |
| 6225 | (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); |
| 6226 | 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] | 6227 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6228 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6229 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6230 | (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6231 | ;} |
| 6232 | break; |
| 6233 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6234 | case 305: |
| 6235 | #line 2926 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6236 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6237 | // 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] | 6238 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6239 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6240 | // Used for call and invoke instructions |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6241 | (yyval.ParamList) = new ParamList(); |
| 6242 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal)); |
| 6243 | (yyval.ParamList)->push_back(E); |
| 6244 | delete (yyvsp[(1) - (4)].TypeVal); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6245 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6246 | ;} |
| 6247 | break; |
| 6248 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6249 | case 306: |
| 6250 | #line 2937 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6251 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6252 | // 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] | 6253 | // Labels are only valid in ASMs |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6254 | (yyval.ParamList) = new ParamList(); |
| 6255 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal)); |
| 6256 | (yyval.ParamList)->push_back(E); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6257 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6258 | ;} |
| 6259 | break; |
| 6260 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6261 | case 307: |
| 6262 | #line 2945 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6263 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6264 | // 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] | 6265 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6266 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6267 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 6268 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal)); |
| 6269 | (yyval.ParamList)->push_back(E); |
| 6270 | delete (yyvsp[(3) - (6)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6271 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6272 | ;} |
| 6273 | break; |
| 6274 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6275 | case 308: |
| 6276 | #line 2955 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6277 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6278 | // 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] | 6279 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 6280 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
| 6281 | (yyval.ParamList)->push_back(E); |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 6282 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6283 | ;} |
| 6284 | break; |
| 6285 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6286 | case 309: |
| 6287 | #line 2962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6288 | { (yyval.ParamList) = new ParamList(); ;} |
| 6289 | break; |
| 6290 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6291 | case 310: |
| 6292 | #line 2965 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6293 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 6294 | break; |
| 6295 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6296 | case 311: |
| 6297 | #line 2966 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6298 | { |
| 6299 | (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); |
| 6300 | (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6301 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6302 | ;} |
| 6303 | break; |
| 6304 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6305 | case 312: |
| 6306 | #line 2974 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6307 | { |
| 6308 | (yyval.ConstantList) = new std::vector<unsigned>(); |
| 6309 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
| 6310 | GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6311 | (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val)); |
| 6312 | ;} |
| 6313 | break; |
| 6314 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6315 | case 313: |
| 6316 | #line 2980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6317 | { |
| 6318 | (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); |
| 6319 | if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) |
| 6320 | GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6321 | (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val)); |
| 6322 | CHECK_FOR_ERROR |
| 6323 | ;} |
| 6324 | break; |
| 6325 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6326 | case 314: |
| 6327 | #line 2989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6328 | { |
| 6329 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6330 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6331 | ;} |
| 6332 | break; |
| 6333 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6334 | case 315: |
| 6335 | #line 2993 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6336 | { |
| 6337 | (yyval.BoolVal) = false; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6338 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6339 | ;} |
| 6340 | break; |
| 6341 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6342 | case 316: |
| 6343 | #line 2998 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6344 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6345 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6346 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6347 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && |
| 6348 | !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6349 | GEN_ERROR( |
| 6350 | "Arithmetic operator requires integer, FP, or packed operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6351 | Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6352 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6353 | Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6354 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6355 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6356 | if ((yyval.InstVal) == 0) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6357 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6358 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6359 | ;} |
| 6360 | break; |
| 6361 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6362 | case 317: |
| 6363 | #line 3014 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6364 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6365 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6366 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6367 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) { |
Nate Begeman | 5bc1ea0 | 2008-07-29 15:49:41 +0000 | [diff] [blame] | 6368 | if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) || |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6369 | !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6370 | GEN_ERROR("Logical operator requires integral operands"); |
| 6371 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6372 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6373 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6374 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6375 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6376 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6377 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6378 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6379 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6380 | ;} |
| 6381 | break; |
| 6382 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6383 | case 318: |
| 6384 | #line 3031 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6385 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6386 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6387 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6388 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6389 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6390 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6391 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6392 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6393 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6394 | (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] | 6395 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6396 | GEN_ERROR("icmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6397 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6398 | ;} |
| 6399 | break; |
| 6400 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6401 | case 319: |
| 6402 | #line 3045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6403 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6404 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6405 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6406 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6407 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6408 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6409 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6410 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6411 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6412 | (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] | 6413 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6414 | GEN_ERROR("fcmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6415 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6416 | ;} |
| 6417 | break; |
| 6418 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6419 | case 320: |
| 6420 | #line 3059 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6421 | { |
| 6422 | if (!UpRefs.empty()) |
| 6423 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6424 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6425 | GEN_ERROR("Scalar types not supported by vicmp instruction"); |
| 6426 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6427 | CHECK_FOR_ERROR |
| 6428 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6429 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6430 | (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] | 6431 | if ((yyval.InstVal) == 0) |
| 6432 | GEN_ERROR("icmp operator returned null"); |
| 6433 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6434 | ;} |
| 6435 | break; |
| 6436 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6437 | case 321: |
| 6438 | #line 3073 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6439 | { |
| 6440 | if (!UpRefs.empty()) |
| 6441 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6442 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6443 | GEN_ERROR("Scalar types not supported by vfcmp instruction"); |
| 6444 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6445 | CHECK_FOR_ERROR |
| 6446 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6447 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6448 | (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] | 6449 | if ((yyval.InstVal) == 0) |
| 6450 | GEN_ERROR("fcmp operator returned null"); |
| 6451 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6452 | ;} |
| 6453 | break; |
| 6454 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6455 | case 322: |
| 6456 | #line 3087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6457 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6458 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6459 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6460 | Value* Val = (yyvsp[(2) - (4)].ValueVal); |
| 6461 | const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get(); |
| 6462 | if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6463 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 6464 | Val->getType()->getDescription() + "' to '" + |
| 6465 | DestTy->getDescription() + "'"); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6466 | (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6467 | delete (yyvsp[(4) - (4)].TypeVal); |
| 6468 | ;} |
| 6469 | break; |
| 6470 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6471 | case 323: |
| 6472 | #line 3099 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6473 | { |
| 6474 | if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6475 | GEN_ERROR("select condition must be boolean"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6476 | if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6477 | GEN_ERROR("select value types should match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6478 | (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] | 6479 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6480 | ;} |
| 6481 | break; |
| 6482 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6483 | case 324: |
| 6484 | #line 3107 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6485 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +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[(4) - (4)].TypeVal))->getDescription()); |
| 6488 | (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); |
| 6489 | delete (yyvsp[(4) - (4)].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 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6494 | case 325: |
| 6495 | #line 3114 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6496 | { |
| 6497 | if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6498 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6499 | (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6500 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6501 | ;} |
| 6502 | break; |
| 6503 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6504 | case 326: |
| 6505 | #line 3120 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6506 | { |
| 6507 | 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] | 6508 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6509 | (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] | 6510 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6511 | ;} |
| 6512 | break; |
| 6513 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6514 | case 327: |
| 6515 | #line 3126 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6516 | { |
| 6517 | 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] | 6518 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6519 | (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] | 6520 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6521 | ;} |
| 6522 | break; |
| 6523 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6524 | case 328: |
| 6525 | #line 3132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6526 | { |
| 6527 | const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6528 | if (!Ty->isFirstClassType()) |
| 6529 | GEN_ERROR("PHI node operands must be of first class type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6530 | (yyval.InstVal) = PHINode::Create(Ty); |
| 6531 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); |
| 6532 | while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { |
| 6533 | if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6534 | 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] | 6535 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); |
| 6536 | (yyvsp[(2) - (2)].PHIList)->pop_front(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6537 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6538 | delete (yyvsp[(2) - (2)].PHIList); // Free the list... |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6539 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6540 | ;} |
| 6541 | break; |
| 6542 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6543 | case 329: |
| 6544 | #line 3148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6545 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6546 | |
| 6547 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6548 | const PointerType *PFTy = 0; |
| 6549 | const FunctionType *Ty = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6550 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6551 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6552 | // Pull out the types of all of the arguments... |
| 6553 | std::vector<const Type*> ParamTypes; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6554 | 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] | 6555 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6556 | const Type *Ty = I->Val->getType(); |
| 6557 | if (Ty == Type::VoidTy) |
| 6558 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6559 | ParamTypes.push_back(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6560 | } |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6561 | |
| 6562 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal))) |
| 6563 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6564 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6565 | Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6566 | PFTy = PointerType::getUnqual(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6567 | } |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6568 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6569 | 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] | 6570 | CHECK_FOR_ERROR |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6571 | |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6572 | // Check for call to invalid intrinsic to avoid crashing later. |
| 6573 | if (Function *theF = dyn_cast<Function>(V)) { |
Reid Spencer | ed48de2 | 2007-04-16 22:02:23 +0000 | [diff] [blame] | 6574 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
Reid Spencer | 36fdde1 | 2007-04-16 20:35:38 +0000 | [diff] [blame] | 6575 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 6576 | !theF->getIntrinsicID(true)) |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6577 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 6578 | theF->getName() + "'"); |
| 6579 | } |
| 6580 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6581 | // Set up the ParamAttrs for the function |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6582 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6583 | if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) |
| 6584 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs))); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6585 | // Check the arguments |
| 6586 | ValueList Args; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6587 | if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6588 | // Make sure no arguments is a good thing! |
| 6589 | if (Ty->getNumParams() != 0) |
| 6590 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6591 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6592 | } else { // Has arguments? |
| 6593 | // Loop through FunctionType's arguments and ensure they are specified |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6594 | // correctly. Also, gather any parameter attributes. |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6595 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6596 | FunctionType::param_iterator E = Ty->param_end(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6597 | 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] | 6598 | unsigned index = 1; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6599 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6600 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6601 | if (ArgI->Val->getType() != *I) |
| 6602 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6603 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6604 | Args.push_back(ArgI->Val); |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6605 | if (ArgI->Attrs != ParamAttr::None) |
| 6606 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6607 | } |
| 6608 | if (Ty->isVarArg()) { |
| 6609 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6610 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6611 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6612 | if (ArgI->Attrs != ParamAttr::None) |
| 6613 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6614 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6615 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6616 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6617 | } |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6618 | |
| 6619 | // Finish off the ParamAttrs and check them |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6620 | PAListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6621 | if (!Attrs.empty()) |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6622 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6623 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6624 | // Create the call node |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6625 | CallInst *CI = CallInst::Create(V, Args.begin(), Args.end()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6626 | CI->setTailCall((yyvsp[(1) - (8)].BoolVal)); |
| 6627 | CI->setCallingConv((yyvsp[(2) - (8)].UIntVal)); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6628 | CI->setParamAttrs(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6629 | (yyval.InstVal) = CI; |
| 6630 | delete (yyvsp[(6) - (8)].ParamList); |
| 6631 | delete (yyvsp[(3) - (8)].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6632 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6633 | ;} |
| 6634 | break; |
| 6635 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6636 | case 330: |
| 6637 | #line 3237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6638 | { |
| 6639 | (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6640 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6641 | ;} |
| 6642 | break; |
| 6643 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6644 | case 331: |
| 6645 | #line 3242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6646 | { |
| 6647 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6648 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6649 | ;} |
| 6650 | break; |
| 6651 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6652 | case 332: |
| 6653 | #line 3246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6654 | { |
| 6655 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6656 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6657 | ;} |
| 6658 | break; |
| 6659 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6660 | case 333: |
| 6661 | #line 3253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6662 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6663 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6664 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6665 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6666 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6667 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6668 | ;} |
| 6669 | break; |
| 6670 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6671 | case 334: |
| 6672 | #line 3260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6673 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6674 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6675 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6676 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6677 | GEN_ERROR("Malloc array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6678 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6679 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6680 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6681 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6682 | ;} |
| 6683 | break; |
| 6684 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6685 | case 335: |
| 6686 | #line 3270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6687 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6688 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6689 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6690 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6691 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6692 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6693 | ;} |
| 6694 | break; |
| 6695 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6696 | case 336: |
| 6697 | #line 3277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6698 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6699 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6700 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6701 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6702 | GEN_ERROR("Alloca array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6703 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6704 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6705 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6706 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6707 | ;} |
| 6708 | break; |
| 6709 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6710 | case 337: |
| 6711 | #line 3287 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6712 | { |
| 6713 | if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6714 | GEN_ERROR("Trying to free nonpointer type " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6715 | (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + ""); |
| 6716 | (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6717 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6718 | ;} |
| 6719 | break; |
| 6720 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6721 | case 338: |
| 6722 | #line 3295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6723 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6724 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6725 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6726 | if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6727 | GEN_ERROR("Can't load from nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6728 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6729 | if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6730 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6731 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6732 | Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6733 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6734 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal)); |
| 6735 | delete (yyvsp[(3) - (5)].TypeVal); |
| 6736 | ;} |
| 6737 | break; |
| 6738 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6739 | case 339: |
| 6740 | #line 3309 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6741 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6742 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6743 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
| 6744 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6745 | if (!PT) |
| 6746 | GEN_ERROR("Can't store to a nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6747 | (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6748 | const Type *ElTy = PT->getElementType(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6749 | if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType()) |
| 6750 | GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6751 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 6752 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6753 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6754 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6755 | (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
| 6756 | delete (yyvsp[(5) - (7)].TypeVal); |
| 6757 | ;} |
| 6758 | break; |
| 6759 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6760 | case 340: |
| 6761 | #line 3326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6762 | { |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 6763 | if (!UpRefs.empty()) |
| 6764 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6765 | if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get())) |
| 6766 | GEN_ERROR("getresult insn requires an aggregate operand"); |
| 6767 | if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val))) |
| 6768 | GEN_ERROR("Invalid getresult index for type '" + |
| 6769 | (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'"); |
| 6770 | |
| 6771 | Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Devang Patel | 5a97097 | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6772 | CHECK_FOR_ERROR |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 6773 | (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val)); |
| 6774 | delete (yyvsp[(2) - (5)].TypeVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6775 | ;} |
| 6776 | break; |
| 6777 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6778 | case 341: |
| 6779 | #line 3340 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6780 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6781 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6782 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 6783 | if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6784 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6785 | |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 6786 | 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] | 6787 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6788 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 6789 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6790 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6791 | (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); |
| 6792 | delete (yyvsp[(2) - (4)].TypeVal); |
| 6793 | delete (yyvsp[(4) - (4)].ValueList); |
| 6794 | ;} |
| 6795 | break; |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6796 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6797 | case 342: |
| 6798 | #line 3355 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6799 | { |
| 6800 | if (!UpRefs.empty()) |
| 6801 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 6802 | if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get())) |
| 6803 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 6804 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6805 | 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] | 6806 | GEN_ERROR("Invalid extractvalue indices for type '" + |
| 6807 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 6808 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
| 6809 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6810 | (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] | 6811 | delete (yyvsp[(2) - (4)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6812 | delete (yyvsp[(4) - (4)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6813 | ;} |
| 6814 | break; |
| 6815 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6816 | case 343: |
| 6817 | #line 3370 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6818 | { |
| 6819 | if (!UpRefs.empty()) |
| 6820 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); |
| 6821 | if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get())) |
| 6822 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 6823 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6824 | 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] | 6825 | GEN_ERROR("Invalid insertvalue indices for type '" + |
| 6826 | (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'"); |
| 6827 | Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal)); |
| 6828 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
| 6829 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6830 | (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] | 6831 | delete (yyvsp[(2) - (7)].TypeVal); |
| 6832 | delete (yyvsp[(5) - (7)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6833 | delete (yyvsp[(7) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6834 | ;} |
| 6835 | break; |
| 6836 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6837 | |
| 6838 | /* Line 1267 of yacc.c. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 6839 | #line 6840 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6840 | default: break; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6841 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6842 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 6843 | |
| 6844 | YYPOPSTACK (yylen); |
| 6845 | yylen = 0; |
| 6846 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6847 | |
| 6848 | *++yyvsp = yyval; |
| 6849 | |
| 6850 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6851 | /* Now `shift' the result of the reduction. Determine what state |
| 6852 | that goes to, based on the state we popped back to and the rule |
| 6853 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6854 | |
| 6855 | yyn = yyr1[yyn]; |
| 6856 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6857 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 6858 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6859 | yystate = yytable[yystate]; |
| 6860 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6861 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6862 | |
| 6863 | goto yynewstate; |
| 6864 | |
| 6865 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6866 | /*------------------------------------. |
| 6867 | | yyerrlab -- here on detecting error | |
| 6868 | `------------------------------------*/ |
| 6869 | yyerrlab: |
| 6870 | /* If not already recovering from an error, report this error. */ |
| 6871 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6872 | { |
| 6873 | ++yynerrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6874 | #if ! YYERROR_VERBOSE |
| 6875 | yyerror (YY_("syntax error")); |
| 6876 | #else |
| 6877 | { |
| 6878 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 6879 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 6880 | { |
| 6881 | YYSIZE_T yyalloc = 2 * yysize; |
| 6882 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 6883 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 6884 | if (yymsg != yymsgbuf) |
| 6885 | YYSTACK_FREE (yymsg); |
| 6886 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 6887 | if (yymsg) |
| 6888 | yymsg_alloc = yyalloc; |
| 6889 | else |
| 6890 | { |
| 6891 | yymsg = yymsgbuf; |
| 6892 | yymsg_alloc = sizeof yymsgbuf; |
| 6893 | } |
| 6894 | } |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6895 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6896 | if (0 < yysize && yysize <= yymsg_alloc) |
| 6897 | { |
| 6898 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 6899 | yyerror (yymsg); |
| 6900 | } |
| 6901 | else |
| 6902 | { |
| 6903 | yyerror (YY_("syntax error")); |
| 6904 | if (yysize != 0) |
| 6905 | goto yyexhaustedlab; |
| 6906 | } |
| 6907 | } |
| 6908 | #endif |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6909 | } |
| 6910 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6911 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6912 | |
| 6913 | if (yyerrstatus == 3) |
| 6914 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6915 | /* If just tried and failed to reuse look-ahead token after an |
| 6916 | error, discard it. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6917 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6918 | if (yychar <= YYEOF) |
| 6919 | { |
| 6920 | /* Return failure if at end of input. */ |
| 6921 | if (yychar == YYEOF) |
| 6922 | YYABORT; |
| 6923 | } |
| 6924 | else |
| 6925 | { |
| 6926 | yydestruct ("Error: discarding", |
| 6927 | yytoken, &yylval); |
| 6928 | yychar = YYEMPTY; |
| 6929 | } |
| 6930 | } |
| 6931 | |
| 6932 | /* Else will try to reuse look-ahead token after shifting the error |
| 6933 | token. */ |
| 6934 | goto yyerrlab1; |
| 6935 | |
| 6936 | |
| 6937 | /*---------------------------------------------------. |
| 6938 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 6939 | `---------------------------------------------------*/ |
| 6940 | yyerrorlab: |
| 6941 | |
| 6942 | /* Pacify compilers like GCC when the user code never invokes |
| 6943 | YYERROR and the label yyerrorlab therefore never appears in user |
| 6944 | code. */ |
| 6945 | if (/*CONSTCOND*/ 0) |
| 6946 | goto yyerrorlab; |
| 6947 | |
| 6948 | /* Do not reclaim the symbols of the rule which action triggered |
| 6949 | this YYERROR. */ |
| 6950 | YYPOPSTACK (yylen); |
| 6951 | yylen = 0; |
| 6952 | YY_STACK_PRINT (yyss, yyssp); |
| 6953 | yystate = *yyssp; |
| 6954 | goto yyerrlab1; |
| 6955 | |
| 6956 | |
| 6957 | /*-------------------------------------------------------------. |
| 6958 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 6959 | `-------------------------------------------------------------*/ |
| 6960 | yyerrlab1: |
| 6961 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 6962 | |
| 6963 | for (;;) |
| 6964 | { |
| 6965 | yyn = yypact[yystate]; |
| 6966 | if (yyn != YYPACT_NINF) |
| 6967 | { |
| 6968 | yyn += YYTERROR; |
| 6969 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 6970 | { |
| 6971 | yyn = yytable[yyn]; |
| 6972 | if (0 < yyn) |
| 6973 | break; |
| 6974 | } |
| 6975 | } |
| 6976 | |
| 6977 | /* Pop the current state because it cannot handle the error token. */ |
| 6978 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6979 | YYABORT; |
| 6980 | |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6981 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6982 | yydestruct ("Error: popping", |
| 6983 | yystos[yystate], yyvsp); |
| 6984 | YYPOPSTACK (1); |
| 6985 | yystate = *yyssp; |
| 6986 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6987 | } |
| 6988 | |
| 6989 | if (yyn == YYFINAL) |
| 6990 | YYACCEPT; |
| 6991 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6992 | *++yyvsp = yylval; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6993 | |
| 6994 | |
| 6995 | /* Shift the error token. */ |
| 6996 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6997 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6998 | yystate = yyn; |
| 6999 | goto yynewstate; |
| 7000 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 7001 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7002 | /*-------------------------------------. |
| 7003 | | yyacceptlab -- YYACCEPT comes here. | |
| 7004 | `-------------------------------------*/ |
| 7005 | yyacceptlab: |
| 7006 | yyresult = 0; |
| 7007 | goto yyreturn; |
| 7008 | |
| 7009 | /*-----------------------------------. |
| 7010 | | yyabortlab -- YYABORT comes here. | |
| 7011 | `-----------------------------------*/ |
| 7012 | yyabortlab: |
| 7013 | yyresult = 1; |
| 7014 | goto yyreturn; |
| 7015 | |
| 7016 | #ifndef yyoverflow |
| 7017 | /*-------------------------------------------------. |
| 7018 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 7019 | `-------------------------------------------------*/ |
| 7020 | yyexhaustedlab: |
| 7021 | yyerror (YY_("memory exhausted")); |
| 7022 | yyresult = 2; |
| 7023 | /* Fall through. */ |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 7024 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7025 | |
| 7026 | yyreturn: |
| 7027 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 7028 | yydestruct ("Cleanup: discarding lookahead", |
| 7029 | yytoken, &yylval); |
| 7030 | /* Do not reclaim the symbols of the rule which action triggered |
| 7031 | this YYABORT or YYACCEPT. */ |
| 7032 | YYPOPSTACK (yylen); |
| 7033 | YY_STACK_PRINT (yyss, yyssp); |
| 7034 | while (yyssp != yyss) |
| 7035 | { |
| 7036 | yydestruct ("Cleanup: popping", |
| 7037 | yystos[*yyssp], yyvsp); |
| 7038 | YYPOPSTACK (1); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 7039 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7040 | #ifndef yyoverflow |
| 7041 | if (yyss != yyssa) |
| 7042 | YYSTACK_FREE (yyss); |
| 7043 | #endif |
| 7044 | #if YYERROR_VERBOSE |
| 7045 | if (yymsg != yymsgbuf) |
| 7046 | YYSTACK_FREE (yymsg); |
| 7047 | #endif |
| 7048 | /* Make sure YYID is used. */ |
| 7049 | return YYID (yyresult); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7050 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7051 | |
| 7052 | |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame^] | 7053 | #line 3389 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7054 | |
| 7055 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7056 | // common code from the two 'RunVMAsmParser' functions |
| 7057 | static Module* RunParser(Module * M) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7058 | CurModule.CurrentModule = M; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7059 | // Check to make sure the parser succeeded |
| 7060 | if (yyparse()) { |
| 7061 | if (ParserResult) |
| 7062 | delete ParserResult; |
| 7063 | return 0; |
| 7064 | } |
| 7065 | |
Reid Spencer | 0d60b5a | 2007-03-30 01:37:39 +0000 | [diff] [blame] | 7066 | // Emit an error if there are any unresolved types left. |
| 7067 | if (!CurModule.LateResolveTypes.empty()) { |
| 7068 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 7069 | if (DID.Type == ValID::LocalName) { |
| 7070 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 7071 | } else { |
| 7072 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 7073 | } |
| 7074 | if (ParserResult) |
| 7075 | delete ParserResult; |
| 7076 | return 0; |
| 7077 | } |
| 7078 | |
| 7079 | // Emit an error if there are any unresolved values left. |
| 7080 | if (!CurModule.LateResolveValues.empty()) { |
| 7081 | Value *V = CurModule.LateResolveValues.back(); |
| 7082 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 7083 | CurModule.PlaceHolderInfo.find(V); |
| 7084 | |
| 7085 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 7086 | ValID &DID = I->second.first; |
| 7087 | if (DID.Type == ValID::LocalName) { |
| 7088 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 7089 | } else { |
| 7090 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 7091 | } |
| 7092 | if (ParserResult) |
| 7093 | delete ParserResult; |
| 7094 | return 0; |
| 7095 | } |
| 7096 | } |
| 7097 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7098 | // Check to make sure that parsing produced a result |
| 7099 | if (!ParserResult) |
| 7100 | return 0; |
| 7101 | |
| 7102 | // Reset ParserResult variable while saving its value for the result. |
| 7103 | Module *Result = ParserResult; |
| 7104 | ParserResult = 0; |
| 7105 | |
| 7106 | return Result; |
| 7107 | } |
| 7108 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7109 | void llvm::GenerateError(const std::string &message, int LineNo) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7110 | if (LineNo == -1) LineNo = LLLgetLineNo(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7111 | // TODO: column number in exception |
| 7112 | if (TheParseError) |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7113 | TheParseError->setError(LLLgetFilename(), message, LineNo); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7114 | TriggerError = 1; |
| 7115 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7116 | |
| 7117 | int yyerror(const char *ErrorMsg) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7118 | std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 7119 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7120 | if (yychar != YYEMPTY && yychar != 0) { |
| 7121 | errMsg += " while reading token: '"; |
| 7122 | errMsg += std::string(LLLgetTokenStart(), |
| 7123 | LLLgetTokenStart()+LLLgetTokenLength()) + "'"; |
| 7124 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7125 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7126 | return 0; |
| 7127 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7128 | |