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 | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 142 | DATALAYOUT = 323, |
| 143 | RET = 324, |
| 144 | BR = 325, |
| 145 | SWITCH = 326, |
| 146 | INVOKE = 327, |
| 147 | UNWIND = 328, |
| 148 | UNREACHABLE = 329, |
| 149 | ADD = 330, |
| 150 | SUB = 331, |
| 151 | MUL = 332, |
| 152 | UDIV = 333, |
| 153 | SDIV = 334, |
| 154 | FDIV = 335, |
| 155 | UREM = 336, |
| 156 | SREM = 337, |
| 157 | FREM = 338, |
| 158 | AND = 339, |
| 159 | OR = 340, |
| 160 | XOR = 341, |
| 161 | SHL = 342, |
| 162 | LSHR = 343, |
| 163 | ASHR = 344, |
| 164 | ICMP = 345, |
| 165 | FCMP = 346, |
| 166 | VICMP = 347, |
| 167 | VFCMP = 348, |
| 168 | EQ = 349, |
| 169 | NE = 350, |
| 170 | SLT = 351, |
| 171 | SGT = 352, |
| 172 | SLE = 353, |
| 173 | SGE = 354, |
| 174 | ULT = 355, |
| 175 | UGT = 356, |
| 176 | ULE = 357, |
| 177 | UGE = 358, |
| 178 | OEQ = 359, |
| 179 | ONE = 360, |
| 180 | OLT = 361, |
| 181 | OGT = 362, |
| 182 | OLE = 363, |
| 183 | OGE = 364, |
| 184 | ORD = 365, |
| 185 | UNO = 366, |
| 186 | UEQ = 367, |
| 187 | UNE = 368, |
| 188 | MALLOC = 369, |
| 189 | ALLOCA = 370, |
| 190 | FREE = 371, |
| 191 | LOAD = 372, |
| 192 | STORE = 373, |
| 193 | GETELEMENTPTR = 374, |
| 194 | TRUNC = 375, |
| 195 | ZEXT = 376, |
| 196 | SEXT = 377, |
| 197 | FPTRUNC = 378, |
| 198 | FPEXT = 379, |
| 199 | BITCAST = 380, |
| 200 | UITOFP = 381, |
| 201 | SITOFP = 382, |
| 202 | FPTOUI = 383, |
| 203 | FPTOSI = 384, |
| 204 | INTTOPTR = 385, |
| 205 | PTRTOINT = 386, |
| 206 | PHI_TOK = 387, |
| 207 | SELECT = 388, |
| 208 | VAARG = 389, |
| 209 | EXTRACTELEMENT = 390, |
| 210 | INSERTELEMENT = 391, |
| 211 | SHUFFLEVECTOR = 392, |
| 212 | GETRESULT = 393, |
| 213 | EXTRACTVALUE = 394, |
| 214 | INSERTVALUE = 395, |
| 215 | SIGNEXT = 396, |
| 216 | ZEROEXT = 397, |
| 217 | NORETURN = 398, |
| 218 | INREG = 399, |
| 219 | SRET = 400, |
| 220 | NOUNWIND = 401, |
| 221 | NOALIAS = 402, |
| 222 | BYVAL = 403, |
| 223 | NEST = 404, |
| 224 | READNONE = 405, |
| 225 | READONLY = 406, |
| 226 | GC = 407, |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 227 | OPTSIZE = 408, |
| 228 | NOINLINE = 409, |
| 229 | ALWAYSINLINE = 410, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 230 | SSP = 411, |
| 231 | SSPREQ = 412, |
| 232 | DEFAULT = 413, |
| 233 | HIDDEN = 414, |
| 234 | PROTECTED = 415 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 235 | }; |
| 236 | #endif |
| 237 | /* Tokens. */ |
| 238 | #define ESINT64VAL 258 |
| 239 | #define EUINT64VAL 259 |
| 240 | #define ESAPINTVAL 260 |
| 241 | #define EUAPINTVAL 261 |
| 242 | #define LOCALVAL_ID 262 |
| 243 | #define GLOBALVAL_ID 263 |
| 244 | #define FPVAL 264 |
| 245 | #define VOID 265 |
| 246 | #define INTTYPE 266 |
| 247 | #define FLOAT 267 |
| 248 | #define DOUBLE 268 |
| 249 | #define X86_FP80 269 |
| 250 | #define FP128 270 |
| 251 | #define PPC_FP128 271 |
| 252 | #define LABEL 272 |
| 253 | #define TYPE 273 |
| 254 | #define LOCALVAR 274 |
| 255 | #define GLOBALVAR 275 |
| 256 | #define LABELSTR 276 |
| 257 | #define STRINGCONSTANT 277 |
| 258 | #define ATSTRINGCONSTANT 278 |
| 259 | #define PCTSTRINGCONSTANT 279 |
| 260 | #define ZEROINITIALIZER 280 |
| 261 | #define TRUETOK 281 |
| 262 | #define FALSETOK 282 |
| 263 | #define BEGINTOK 283 |
| 264 | #define ENDTOK 284 |
| 265 | #define DECLARE 285 |
| 266 | #define DEFINE 286 |
| 267 | #define GLOBAL 287 |
| 268 | #define CONSTANT 288 |
| 269 | #define SECTION 289 |
| 270 | #define ALIAS 290 |
| 271 | #define VOLATILE 291 |
| 272 | #define THREAD_LOCAL 292 |
| 273 | #define TO 293 |
| 274 | #define DOTDOTDOT 294 |
| 275 | #define NULL_TOK 295 |
| 276 | #define UNDEF 296 |
| 277 | #define INTERNAL 297 |
| 278 | #define LINKONCE 298 |
| 279 | #define WEAK 299 |
| 280 | #define APPENDING 300 |
| 281 | #define DLLIMPORT 301 |
| 282 | #define DLLEXPORT 302 |
| 283 | #define EXTERN_WEAK 303 |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 284 | #define COMMON 304 |
| 285 | #define OPAQUE 305 |
| 286 | #define EXTERNAL 306 |
| 287 | #define TARGET 307 |
| 288 | #define TRIPLE 308 |
| 289 | #define ALIGN 309 |
| 290 | #define ADDRSPACE 310 |
| 291 | #define DEPLIBS 311 |
| 292 | #define CALL 312 |
| 293 | #define TAIL 313 |
| 294 | #define ASM_TOK 314 |
| 295 | #define MODULE 315 |
| 296 | #define SIDEEFFECT 316 |
| 297 | #define CC_TOK 317 |
| 298 | #define CCC_TOK 318 |
| 299 | #define FASTCC_TOK 319 |
| 300 | #define COLDCC_TOK 320 |
| 301 | #define X86_STDCALLCC_TOK 321 |
| 302 | #define X86_FASTCALLCC_TOK 322 |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 303 | #define DATALAYOUT 323 |
| 304 | #define RET 324 |
| 305 | #define BR 325 |
| 306 | #define SWITCH 326 |
| 307 | #define INVOKE 327 |
| 308 | #define UNWIND 328 |
| 309 | #define UNREACHABLE 329 |
| 310 | #define ADD 330 |
| 311 | #define SUB 331 |
| 312 | #define MUL 332 |
| 313 | #define UDIV 333 |
| 314 | #define SDIV 334 |
| 315 | #define FDIV 335 |
| 316 | #define UREM 336 |
| 317 | #define SREM 337 |
| 318 | #define FREM 338 |
| 319 | #define AND 339 |
| 320 | #define OR 340 |
| 321 | #define XOR 341 |
| 322 | #define SHL 342 |
| 323 | #define LSHR 343 |
| 324 | #define ASHR 344 |
| 325 | #define ICMP 345 |
| 326 | #define FCMP 346 |
| 327 | #define VICMP 347 |
| 328 | #define VFCMP 348 |
| 329 | #define EQ 349 |
| 330 | #define NE 350 |
| 331 | #define SLT 351 |
| 332 | #define SGT 352 |
| 333 | #define SLE 353 |
| 334 | #define SGE 354 |
| 335 | #define ULT 355 |
| 336 | #define UGT 356 |
| 337 | #define ULE 357 |
| 338 | #define UGE 358 |
| 339 | #define OEQ 359 |
| 340 | #define ONE 360 |
| 341 | #define OLT 361 |
| 342 | #define OGT 362 |
| 343 | #define OLE 363 |
| 344 | #define OGE 364 |
| 345 | #define ORD 365 |
| 346 | #define UNO 366 |
| 347 | #define UEQ 367 |
| 348 | #define UNE 368 |
| 349 | #define MALLOC 369 |
| 350 | #define ALLOCA 370 |
| 351 | #define FREE 371 |
| 352 | #define LOAD 372 |
| 353 | #define STORE 373 |
| 354 | #define GETELEMENTPTR 374 |
| 355 | #define TRUNC 375 |
| 356 | #define ZEXT 376 |
| 357 | #define SEXT 377 |
| 358 | #define FPTRUNC 378 |
| 359 | #define FPEXT 379 |
| 360 | #define BITCAST 380 |
| 361 | #define UITOFP 381 |
| 362 | #define SITOFP 382 |
| 363 | #define FPTOUI 383 |
| 364 | #define FPTOSI 384 |
| 365 | #define INTTOPTR 385 |
| 366 | #define PTRTOINT 386 |
| 367 | #define PHI_TOK 387 |
| 368 | #define SELECT 388 |
| 369 | #define VAARG 389 |
| 370 | #define EXTRACTELEMENT 390 |
| 371 | #define INSERTELEMENT 391 |
| 372 | #define SHUFFLEVECTOR 392 |
| 373 | #define GETRESULT 393 |
| 374 | #define EXTRACTVALUE 394 |
| 375 | #define INSERTVALUE 395 |
| 376 | #define SIGNEXT 396 |
| 377 | #define ZEROEXT 397 |
| 378 | #define NORETURN 398 |
| 379 | #define INREG 399 |
| 380 | #define SRET 400 |
| 381 | #define NOUNWIND 401 |
| 382 | #define NOALIAS 402 |
| 383 | #define BYVAL 403 |
| 384 | #define NEST 404 |
| 385 | #define READNONE 405 |
| 386 | #define READONLY 406 |
| 387 | #define GC 407 |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 388 | #define OPTSIZE 408 |
| 389 | #define NOINLINE 409 |
| 390 | #define ALWAYSINLINE 410 |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 391 | #define SSP 411 |
| 392 | #define SSPREQ 412 |
| 393 | #define DEFAULT 413 |
| 394 | #define HIDDEN 414 |
| 395 | #define PROTECTED 415 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | /* Copy the first part of user declarations. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 401 | #line 14 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 402 | |
| 403 | #include "ParserInternals.h" |
| 404 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 405 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 406 | #include "llvm/Instructions.h" |
| 407 | #include "llvm/Module.h" |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 408 | #include "llvm/ValueSymbolTable.h" |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 409 | #include "llvm/AutoUpgrade.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 410 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 411 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 412 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 413 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 414 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 415 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 416 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 417 | #include <list> |
Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 418 | #include <map> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 419 | #include <utility> |
| 420 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 421 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 422 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 423 | // an error situation. So, whenever we want an error to occur, the GenerateError |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 424 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 425 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 426 | // (a goto) to put YACC in error state. Furthermore, several calls to |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 427 | // GenerateError are made from inside productions and they must simulate the |
| 428 | // previous exception behavior by exiting the production immediately. We have |
| 429 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 430 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 431 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 432 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 433 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 434 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 435 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 436 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 437 | int yylex(); // declaration" of xxx warnings. |
| 438 | int yyparse(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 439 | using namespace llvm; |
| 440 | |
| 441 | static Module *ParserResult; |
| 442 | |
| 443 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 444 | // relating to upreferences in the input stream. |
| 445 | // |
| 446 | //#define DEBUG_UPREFS 1 |
| 447 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 448 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 449 | #else |
| 450 | #define UR_OUT(X) |
| 451 | #endif |
| 452 | |
| 453 | #define YYERROR_VERBOSE 1 |
| 454 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 455 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 456 | |
| 457 | |
| 458 | // This contains info used when building the body of a function. It is |
| 459 | // destroyed when the function is completed. |
| 460 | // |
| 461 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 462 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 463 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 464 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 465 | |
| 466 | static struct PerModuleInfo { |
| 467 | Module *CurrentModule; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 468 | ValueList Values; // Module level numbered definitions |
| 469 | ValueList LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 470 | std::vector<PATypeHolder> Types; |
| 471 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 472 | |
| 473 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 474 | /// 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] | 475 | /// that we can resolve them later and print error messages as appropriate. |
| 476 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 477 | |
| 478 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 479 | // references to global values. Global values may be referenced before they |
| 480 | // are defined, and if so, the temporary object that they represent is held |
| 481 | // here. This is used for forward references of GlobalValues. |
| 482 | // |
| 483 | typedef std::map<std::pair<const PointerType *, |
| 484 | ValID>, GlobalValue*> GlobalRefsType; |
| 485 | GlobalRefsType GlobalRefs; |
| 486 | |
| 487 | void ModuleDone() { |
| 488 | // If we could not resolve some functions at function compilation time |
| 489 | // (calls to functions before they are defined), resolve them now... Types |
| 490 | // are resolved when the constant pool has been completely parsed. |
| 491 | // |
| 492 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 493 | if (TriggerError) |
| 494 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 495 | |
| 496 | // Check to make sure that all global value forward references have been |
| 497 | // resolved! |
| 498 | // |
| 499 | if (!GlobalRefs.empty()) { |
| 500 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 501 | |
| 502 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 503 | I != E; ++I) { |
| 504 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 505 | I->first.second.getName() + "\n"; |
| 506 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 507 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 508 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 509 | } |
| 510 | |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 511 | // Look for intrinsic functions and CallInst that need to be upgraded |
| 512 | for (Module::iterator FI = CurrentModule->begin(), |
| 513 | FE = CurrentModule->end(); FI != FE; ) |
| 514 | UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove |
| 515 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 516 | Values.clear(); // Clear out function local definitions |
| 517 | Types.clear(); |
| 518 | CurrentModule = 0; |
| 519 | } |
| 520 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 521 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 522 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 523 | // If not, just return null. |
| 524 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 525 | // Check to see if there is a forward reference to this global variable... |
| 526 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 527 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 528 | GlobalValue *Ret = 0; |
| 529 | if (I != GlobalRefs.end()) { |
| 530 | Ret = I->second; |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 531 | I->first.second.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 532 | GlobalRefs.erase(I); |
| 533 | } |
| 534 | return Ret; |
| 535 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 536 | |
| 537 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 538 | // If it isn't abstract, its resolved |
| 539 | const Type* Ty = PATy->get(); |
| 540 | if (!Ty->isAbstract()) |
| 541 | return false; |
| 542 | // Traverse the type looking for abstract types. If it isn't abstract then |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 543 | // we don't need to traverse that leg of the type. |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 544 | std::vector<const Type*> WorkList, SeenList; |
| 545 | WorkList.push_back(Ty); |
| 546 | while (!WorkList.empty()) { |
| 547 | const Type* Ty = WorkList.back(); |
| 548 | SeenList.push_back(Ty); |
| 549 | WorkList.pop_back(); |
| 550 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 551 | // Check to see if this is an unresolved type |
| 552 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 553 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 554 | for ( ; I != E; ++I) { |
| 555 | if (I->second.get() == OpTy) |
| 556 | return true; |
| 557 | } |
| 558 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 559 | const Type* TheTy = SeqTy->getElementType(); |
| 560 | if (TheTy->isAbstract() && TheTy != Ty) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 561 | std::vector<const Type*>::iterator I = SeenList.begin(), |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 562 | E = SeenList.end(); |
| 563 | for ( ; I != E; ++I) |
| 564 | if (*I == TheTy) |
| 565 | break; |
| 566 | if (I == E) |
| 567 | WorkList.push_back(TheTy); |
| 568 | } |
| 569 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 570 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 571 | const Type* TheTy = StrTy->getElementType(i); |
| 572 | if (TheTy->isAbstract() && TheTy != Ty) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 573 | std::vector<const Type*>::iterator I = SeenList.begin(), |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 574 | E = SeenList.end(); |
| 575 | for ( ; I != E; ++I) |
| 576 | if (*I == TheTy) |
| 577 | break; |
| 578 | if (I == E) |
| 579 | WorkList.push_back(TheTy); |
| 580 | } |
| 581 | } |
| 582 | } |
| 583 | } |
| 584 | return false; |
| 585 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 586 | } CurModule; |
| 587 | |
| 588 | static struct PerFunctionInfo { |
| 589 | Function *CurrentFunction; // Pointer to current function being created |
| 590 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 591 | ValueList Values; // Keep track of #'d definitions |
| 592 | unsigned NextValNum; |
| 593 | ValueList LateResolveValues; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 594 | bool isDeclare; // Is this function a forward declararation? |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 595 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 596 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 597 | |
| 598 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 599 | /// track of them here. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 600 | std::map<ValID, BasicBlock*> BBForwardRefs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 601 | |
| 602 | inline PerFunctionInfo() { |
| 603 | CurrentFunction = 0; |
| 604 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 605 | Linkage = GlobalValue::ExternalLinkage; |
| 606 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | inline void FunctionStart(Function *M) { |
| 610 | CurrentFunction = M; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 611 | NextValNum = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | void FunctionDone() { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 615 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 616 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 617 | GenerateError("Undefined reference to label " + |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 618 | BBForwardRefs.begin()->second->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 619 | return; |
| 620 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 621 | |
| 622 | // Resolve all forward references now. |
| 623 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 624 | |
| 625 | Values.clear(); // Clear out function local definitions |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 626 | BBForwardRefs.clear(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 627 | CurrentFunction = 0; |
| 628 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 629 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 630 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 631 | } |
| 632 | } CurFun; // Info for the current function... |
| 633 | |
| 634 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 635 | |
| 636 | |
| 637 | //===----------------------------------------------------------------------===// |
| 638 | // Code to handle definitions of all the types |
| 639 | //===----------------------------------------------------------------------===// |
| 640 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 641 | /// InsertValue - Insert a value into the value table. If it is named, this |
| 642 | /// returns -1, otherwise it returns the slot number for the value. |
| 643 | static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 644 | // Things that have names or are void typed don't get slot numbers |
| 645 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 646 | return -1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 647 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 648 | // In the case of function values, we have to allow for the forward reference |
| 649 | // of basic blocks, which are included in the numbering. Consequently, we keep |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 650 | // track of the next insertion location with NextValNum. When a BB gets |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 651 | // inserted, it could change the size of the CurFun.Values vector. |
| 652 | if (&ValueTab == &CurFun.Values) { |
| 653 | if (ValueTab.size() <= CurFun.NextValNum) |
| 654 | ValueTab.resize(CurFun.NextValNum+1); |
| 655 | ValueTab[CurFun.NextValNum++] = V; |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 656 | return CurFun.NextValNum-1; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 657 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 658 | // For all other lists, its okay to just tack it on the back of the vector. |
| 659 | ValueTab.push_back(V); |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 660 | return ValueTab.size()-1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 661 | } |
| 662 | |
| 663 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 664 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 665 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 666 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 667 | if (D.Num < CurModule.Types.size()) |
| 668 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 669 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 670 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 671 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 672 | D.destroy(); // Free old strdup'd memory... |
| 673 | return N; |
| 674 | } |
| 675 | break; |
| 676 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 677 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 678 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | // If we reached here, we referenced either a symbol that we don't know about |
| 682 | // or an id number that hasn't been read yet. We may be referencing something |
| 683 | // forward, so just create an entry to be resolved later and get to it... |
| 684 | // |
| 685 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 686 | |
| 687 | |
| 688 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 689 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 690 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 691 | return 0; |
| 692 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 693 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 694 | return 0; |
| 695 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 696 | } |
| 697 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 698 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Nuno Lopes | f05ff66 | 2008-10-15 11:20:21 +0000 | [diff] [blame] | 699 | if (I != CurModule.LateResolveTypes.end()) { |
| 700 | D.destroy(); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 701 | return I->second; |
Nuno Lopes | f05ff66 | 2008-10-15 11:20:21 +0000 | [diff] [blame] | 702 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 703 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 704 | Type *Typ = OpaqueType::get(); |
| 705 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 706 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 707 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 708 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 709 | // getExistingVal - Look up the value specified by the provided type and |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 710 | // the provided ValID. If the value exists and has already been defined, return |
| 711 | // it. Otherwise return null. |
| 712 | // |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 713 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 714 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 715 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 716 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 717 | return 0; |
| 718 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 719 | |
| 720 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 721 | case ValID::LocalID: { // Is it a numbered definition? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 722 | // Check that the number is within bounds. |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 723 | if (D.Num >= CurFun.Values.size()) |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 724 | return 0; |
| 725 | Value *Result = CurFun.Values[D.Num]; |
| 726 | if (Ty != Result->getType()) { |
| 727 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 728 | Result->getType()->getDescription() + "' does not match " |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 729 | "expected type, '" + Ty->getDescription() + "'"); |
| 730 | return 0; |
| 731 | } |
| 732 | return Result; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 733 | } |
| 734 | case ValID::GlobalID: { // Is it a numbered definition? |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 735 | if (D.Num >= CurModule.Values.size()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 736 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 737 | Value *Result = CurModule.Values[D.Num]; |
| 738 | if (Ty != Result->getType()) { |
| 739 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 740 | Result->getType()->getDescription() + "' does not match " |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 741 | "expected type, '" + Ty->getDescription() + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 742 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 743 | } |
| 744 | return Result; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 745 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 746 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 747 | case ValID::LocalName: { // Is it a named definition? |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 748 | if (!inFunctionScope()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 749 | return 0; |
| 750 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 751 | Value *N = SymTab.lookup(D.getName()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 752 | if (N == 0) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 753 | return 0; |
| 754 | if (N->getType() != Ty) |
| 755 | return 0; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 756 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 757 | D.destroy(); // Free old strdup'd memory... |
| 758 | return N; |
| 759 | } |
| 760 | case ValID::GlobalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 761 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 762 | Value *N = SymTab.lookup(D.getName()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 763 | if (N == 0) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 764 | return 0; |
| 765 | if (N->getType() != Ty) |
| 766 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 767 | |
| 768 | D.destroy(); // Free old strdup'd memory... |
| 769 | return N; |
| 770 | } |
| 771 | |
| 772 | // Check to make sure that "Ty" is an integral type, and that our |
| 773 | // value will fit into the specified type... |
| 774 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 775 | if (!isa<IntegerType>(Ty) || |
| 776 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 777 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 778 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 779 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 780 | return 0; |
| 781 | } |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 782 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 783 | |
| 784 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 785 | if (isa<IntegerType>(Ty) && |
| 786 | ConstantInt::isValueValidForType(Ty, D.UConstPool64)) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 787 | return ConstantInt::get(Ty, D.UConstPool64); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 788 | |
| 789 | if (!isa<IntegerType>(Ty) || |
| 790 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
| 791 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
| 792 | "' is invalid or out of range for type '" + |
| 793 | Ty->getDescription() + "'"); |
| 794 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 795 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 796 | // This is really a signed reference. Transmogrify. |
| 797 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 798 | |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 799 | case ValID::ConstAPInt: // Is it an unsigned const pool reference? |
| 800 | if (!isa<IntegerType>(Ty)) { |
| 801 | GenerateError("Integral constant '" + D.getName() + |
| 802 | "' is invalid or out of range for type '" + |
| 803 | Ty->getDescription() + "'"); |
| 804 | return 0; |
| 805 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 806 | |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 807 | { |
| 808 | APSInt Tmp = *D.ConstPoolInt; |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 809 | D.destroy(); |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 810 | Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits()); |
| 811 | return ConstantInt::get(Tmp); |
| 812 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 813 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 814 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 815 | if (!Ty->isFloatingPoint() || |
| 816 | !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 817 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 818 | return 0; |
| 819 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 820 | // 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] | 821 | // as double. Fix this here. Long double does not need this. |
| 822 | if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && |
Dale Johannesen | 236bbd4 | 2008-10-09 23:01:34 +0000 | [diff] [blame] | 823 | Ty==Type::FloatTy) { |
| 824 | bool ignored; |
| 825 | D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, |
| 826 | &ignored); |
| 827 | } |
Nuno Lopes | aa386d0 | 2008-11-04 14:43:20 +0000 | [diff] [blame] | 828 | { |
| 829 | ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP); |
| 830 | D.destroy(); |
| 831 | return tmp; |
| 832 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 833 | |
| 834 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 835 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 836 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 837 | return 0; |
| 838 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 839 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 840 | |
| 841 | case ValID::ConstUndefVal: // Is it an undef value? |
| 842 | return UndefValue::get(Ty); |
| 843 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 844 | case ValID::ConstZeroVal: // Is it a zero value? |
| 845 | return Constant::getNullValue(Ty); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 846 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 847 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 848 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 849 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 850 | return 0; |
| 851 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 852 | return D.ConstantValue; |
| 853 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 854 | case ValID::InlineAsmVal: { // Inline asm expression |
| 855 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 856 | const FunctionType *FTy = |
| 857 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 858 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 859 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 860 | return 0; |
| 861 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 862 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 863 | D.IAD->HasSideEffects); |
| 864 | D.destroy(); // Free InlineAsmDescriptor. |
| 865 | return IA; |
| 866 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 867 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 868 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 869 | return 0; |
| 870 | } // End of switch |
| 871 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 872 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 873 | return 0; |
| 874 | } |
| 875 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 876 | // getVal - This function is identical to getExistingVal, except that if a |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 877 | // value is not already defined, it "improvises" by creating a placeholder var |
| 878 | // that looks and acts just like the requested variable. When the value is |
| 879 | // defined later, all uses of the placeholder variable are replaced with the |
| 880 | // real thing. |
| 881 | // |
| 882 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 883 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 884 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 885 | return 0; |
| 886 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 887 | |
| 888 | // See if the value has already been defined. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 889 | Value *V = getExistingVal(Ty, ID); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 890 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 891 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 892 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 893 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 894 | GenerateError("Invalid use of a non-first-class type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 895 | return 0; |
| 896 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 897 | |
| 898 | // If we reached here, we referenced either a symbol that we don't know about |
| 899 | // or an id number that hasn't been read yet. We may be referencing something |
| 900 | // forward, so just create an entry to be resolved later and get to it... |
| 901 | // |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 902 | switch (ID.Type) { |
| 903 | case ValID::GlobalName: |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 904 | case ValID::GlobalID: { |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 905 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 906 | if (!PTy) { |
| 907 | GenerateError("Invalid type for reference to global" ); |
| 908 | return 0; |
| 909 | } |
| 910 | const Type* ElTy = PTy->getElementType(); |
| 911 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 912 | V = Function::Create(FTy, GlobalValue::ExternalLinkage); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 913 | else |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 914 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", |
| 915 | (Module*)0, false, PTy->getAddressSpace()); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 916 | break; |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 917 | } |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 918 | default: |
| 919 | V = new Argument(Ty); |
| 920 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 921 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 922 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 923 | // to recycle these things?? |
| 924 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 925 | LLLgetLineNo()))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 926 | |
| 927 | if (inFunctionScope()) |
| 928 | InsertValue(V, CurFun.LateResolveValues); |
| 929 | else |
| 930 | InsertValue(V, CurModule.LateResolveValues); |
| 931 | return V; |
| 932 | } |
| 933 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 934 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 935 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 936 | static BasicBlock *defineBBVal(const ValID &ID) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 937 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 938 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 939 | BasicBlock *BB = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 940 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 941 | // First, see if this was forward referenced |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 942 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 943 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 944 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 945 | BB = BBI->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 946 | // The forward declaration could have been inserted anywhere in the |
| 947 | // function: insert it into the correct place now. |
| 948 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 949 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 950 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 951 | // We're about to erase the entry, save the key so we can clean it up. |
| 952 | ValID Tmp = BBI->first; |
| 953 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 954 | // Erase the forward ref from the map as its no longer "forward" |
| 955 | CurFun.BBForwardRefs.erase(ID); |
| 956 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 957 | // The key has been removed from the map but so we don't want to leave |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 958 | // strdup'd memory around so destroy it too. |
| 959 | Tmp.destroy(); |
| 960 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 961 | // If its a numbered definition, bump the number and set the BB value. |
| 962 | if (ID.Type == ValID::LocalID) { |
| 963 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 964 | InsertValue(BB); |
| 965 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 966 | } else { |
| 967 | // We haven't seen this BB before and its first mention is a definition. |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 968 | // Just create it and return it. |
| 969 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 970 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 971 | if (ID.Type == ValID::LocalID) { |
| 972 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 973 | InsertValue(BB); |
| 974 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 975 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 976 | |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 977 | ID.destroy(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 978 | return BB; |
| 979 | } |
| 980 | |
| 981 | /// getBBVal - get an existing BB value or create a forward reference for it. |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 982 | /// |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 983 | static BasicBlock *getBBVal(const ValID &ID) { |
| 984 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 985 | |
| 986 | BasicBlock *BB = 0; |
| 987 | |
| 988 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 989 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 990 | BB = BBI->second; |
| 991 | } if (ID.Type == ValID::LocalName) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 992 | std::string Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 993 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 994 | if (N) { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 995 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 996 | BB = cast<BasicBlock>(N); |
| 997 | else |
| 998 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 999 | N->getType()->getDescription() + "'"); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 1000 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1001 | } else if (ID.Type == ValID::LocalID) { |
| 1002 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 1003 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 1004 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 1005 | else |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1006 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 1007 | "' is actually of type '"+ |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1008 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 1009 | } |
| 1010 | } else { |
| 1011 | GenerateError("Illegal label reference " + ID.getName()); |
| 1012 | return 0; |
| 1013 | } |
| 1014 | |
| 1015 | // If its already been defined, return it now. |
| 1016 | if (BB) { |
| 1017 | ID.destroy(); // Free strdup'd memory. |
| 1018 | return BB; |
| 1019 | } |
| 1020 | |
| 1021 | // Otherwise, this block has not been seen before, create it. |
| 1022 | std::string Name; |
| 1023 | if (ID.Type == ValID::LocalName) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1024 | Name = ID.getName(); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 1025 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1026 | |
| 1027 | // Insert it in the forward refs map. |
| 1028 | CurFun.BBForwardRefs[ID] = BB; |
| 1029 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1030 | return BB; |
| 1031 | } |
| 1032 | |
| 1033 | |
| 1034 | //===----------------------------------------------------------------------===// |
| 1035 | // Code to handle forward references in instructions |
| 1036 | //===----------------------------------------------------------------------===// |
| 1037 | // |
| 1038 | // This code handles the late binding needed with statements that reference |
| 1039 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 1040 | // a loop body. |
| 1041 | // |
| 1042 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 1043 | // and back patchs after we are done. |
| 1044 | // |
| 1045 | |
| 1046 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 1047 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 1048 | // defs now... |
| 1049 | // |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1050 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1051 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1052 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1053 | while (!LateResolvers.empty()) { |
| 1054 | Value *V = LateResolvers.back(); |
| 1055 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1056 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1057 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 1058 | CurModule.PlaceHolderInfo.find(V); |
| 1059 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1060 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1061 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1062 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1063 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 1064 | if (TriggerError) |
| 1065 | return; |
| 1066 | if (TheRealValue) { |
| 1067 | V->replaceAllUsesWith(TheRealValue); |
| 1068 | delete V; |
| 1069 | CurModule.PlaceHolderInfo.erase(PHI); |
| 1070 | } else if (FutureLateResolvers) { |
| 1071 | // Functions have their unresolved items forwarded to the module late |
| 1072 | // resolver table |
| 1073 | InsertValue(V, *FutureLateResolvers); |
| 1074 | } else { |
| 1075 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 1076 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 1077 | "' of type '" + V->getType()->getDescription() + "'", |
| 1078 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1079 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1080 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1081 | GenerateError("Reference to an invalid definition: #" + |
| 1082 | itostr(DID.Num) + " of type '" + |
| 1083 | V->getType()->getDescription() + "'", |
| 1084 | PHI->second.second); |
| 1085 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1086 | } |
| 1087 | } |
| 1088 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1089 | LateResolvers.clear(); |
| 1090 | } |
| 1091 | |
| 1092 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 1093 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 1094 | // refering to the number can be resolved. Do this now. |
| 1095 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1096 | static void ResolveTypeTo(std::string *Name, const Type *ToTy) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1097 | ValID D; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1098 | if (Name) |
| 1099 | D = ValID::createLocalName(*Name); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1100 | else |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1101 | D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1102 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1103 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1104 | CurModule.LateResolveTypes.find(D); |
| 1105 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1106 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Nuno Lopes | 6ec8a25 | 2008-10-15 11:11:12 +0000 | [diff] [blame] | 1107 | I->first.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1108 | CurModule.LateResolveTypes.erase(I); |
| 1109 | } |
Nuno Lopes | 191dfb9 | 2008-10-03 15:52:39 +0000 | [diff] [blame] | 1110 | D.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1111 | } |
| 1112 | |
| 1113 | // setValueName - Set the specified value to the name given. The name may be |
| 1114 | // null potentially, in which case this is a noop. The string passed in is |
| 1115 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1116 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1117 | static void setValueName(Value *V, std::string *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1118 | if (!NameStr) return; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1119 | std::string Name(*NameStr); // Copy string |
| 1120 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1121 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1122 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1123 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1124 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1125 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1126 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1127 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1128 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1129 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1130 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1131 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1132 | return; |
| 1133 | } |
| 1134 | |
| 1135 | // Set the name. |
| 1136 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1137 | } |
| 1138 | |
| 1139 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1140 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1141 | static GlobalVariable * |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1142 | ParseGlobalVariable(std::string *NameStr, |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1143 | GlobalValue::LinkageTypes Linkage, |
| 1144 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1145 | bool isConstantGlobal, const Type *Ty, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1146 | Constant *Initializer, bool IsThreadLocal, |
| 1147 | unsigned AddressSpace = 0) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1148 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1149 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1150 | return 0; |
| 1151 | } |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1152 | if (Ty == Type::LabelTy) { |
| 1153 | GenerateError("Cannot declare global vars of label type"); |
| 1154 | return 0; |
| 1155 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1156 | |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1157 | const PointerType *PTy = PointerType::get(Ty, AddressSpace); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1158 | |
| 1159 | std::string Name; |
| 1160 | if (NameStr) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1161 | Name = *NameStr; // Copy string |
| 1162 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1163 | } |
| 1164 | |
| 1165 | // See if this global value was forward referenced. If so, recycle the |
| 1166 | // object. |
| 1167 | ValID ID; |
| 1168 | if (!Name.empty()) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1169 | ID = ValID::createGlobalName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1170 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1171 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1172 | } |
| 1173 | |
| 1174 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1175 | // Move the global to the end of the list, from whereever it was |
| 1176 | // previously inserted. |
| 1177 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1178 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1179 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1180 | GV->setInitializer(Initializer); |
| 1181 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1182 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1183 | GV->setConstant(isConstantGlobal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1184 | GV->setThreadLocal(IsThreadLocal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1185 | InsertValue(GV, CurModule.Values); |
Nuno Lopes | 191dfb9 | 2008-10-03 15:52:39 +0000 | [diff] [blame] | 1186 | ID.destroy(); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1187 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1188 | } |
| 1189 | |
Nuno Lopes | 191dfb9 | 2008-10-03 15:52:39 +0000 | [diff] [blame] | 1190 | ID.destroy(); |
| 1191 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1192 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1193 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1194 | // if the global we're parsing has an initializer (is a definition) and |
| 1195 | // has external linkage. |
| 1196 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1197 | // If there is already a global with external linkage with this name |
| 1198 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1199 | // If we allow this GVar to get created, it will be renamed in the |
| 1200 | // symbol table because it conflicts with an existing GVar. We can't |
| 1201 | // allow redefinition of GVars whose linking indicates that their name |
| 1202 | // must stay the same. Issue the error. |
| 1203 | GenerateError("Redefinition of global variable named '" + Name + |
| 1204 | "' of type '" + Ty->getDescription() + "'"); |
| 1205 | return 0; |
| 1206 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1207 | } |
| 1208 | |
| 1209 | // Otherwise there is no existing GV to use, create one now. |
| 1210 | GlobalVariable *GV = |
| 1211 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1212 | CurModule.CurrentModule, IsThreadLocal, AddressSpace); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1213 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1214 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1215 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1216 | } |
| 1217 | |
| 1218 | // setTypeName - Set the specified type to the name given. The name may be |
| 1219 | // null potentially, in which case this is a noop. The string passed in is |
| 1220 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1221 | // |
| 1222 | // This function returns true if the type has already been defined, but is |
| 1223 | // allowed to be redefined in the specified context. If the name is a new name |
| 1224 | // for the type plane, it is inserted and false is returned. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1225 | static bool setTypeName(const Type *T, std::string *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1226 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1227 | if (NameStr == 0) return false; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1228 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1229 | std::string Name(*NameStr); // Copy string |
| 1230 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1231 | |
| 1232 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1233 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1234 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1235 | return false; |
| 1236 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1237 | |
| 1238 | // Set the type name, checking for conflicts as we do so. |
| 1239 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1240 | |
| 1241 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1242 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1243 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1244 | |
| 1245 | // There is only one case where this is allowed: when we are refining an |
| 1246 | // opaque type. In this case, Existing will be an opaque type. |
| 1247 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1248 | // We ARE replacing an opaque type! |
| 1249 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1250 | return true; |
| 1251 | } |
| 1252 | |
| 1253 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1254 | // the redefinition is identical to the original. This will be so if |
| 1255 | // Existing and T point to the same Type object. In this one case we |
| 1256 | // allow the equivalent redefinition. |
| 1257 | if (Existing == T) return true; // Yes, it's equal. |
| 1258 | |
| 1259 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1260 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1261 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1262 | } |
| 1263 | |
| 1264 | return false; |
| 1265 | } |
| 1266 | |
| 1267 | //===----------------------------------------------------------------------===// |
| 1268 | // Code for handling upreferences in type names... |
| 1269 | // |
| 1270 | |
| 1271 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1272 | // |
| 1273 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1274 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1275 | E) != Ty->subtype_end(); |
| 1276 | } |
| 1277 | |
| 1278 | namespace { |
| 1279 | struct UpRefRecord { |
| 1280 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1281 | // this type is resolved. |
| 1282 | unsigned NestingLevel; |
| 1283 | |
| 1284 | // LastContainedTy - This is the type at the current binding level for the |
| 1285 | // type. Every time we reduce the nesting level, this gets updated. |
| 1286 | const Type *LastContainedTy; |
| 1287 | |
| 1288 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1289 | // represented with. |
| 1290 | OpaqueType *UpRefTy; |
| 1291 | |
| 1292 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1293 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1294 | }; |
| 1295 | } |
| 1296 | |
| 1297 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1298 | static std::vector<UpRefRecord> UpRefs; |
| 1299 | |
| 1300 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1301 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1302 | /// currently active types. For each type, if the up reference is contained in |
| 1303 | /// the newly completed type, we decrement the level count. When the level |
| 1304 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1305 | /// thus we can complete the cycle. |
| 1306 | /// |
| 1307 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1308 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1309 | // nothing to resolve here. |
| 1310 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1311 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1312 | PATypeHolder Ty(ty); |
| 1313 | UR_OUT("Type '" << Ty->getDescription() << |
| 1314 | "' newly formed. Resolving upreferences.\n" << |
| 1315 | UpRefs.size() << " upreferences active!\n"); |
| 1316 | |
| 1317 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1318 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1319 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1320 | // this variable. |
| 1321 | OpaqueType *TypeToResolve = 0; |
| 1322 | |
| 1323 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1324 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1325 | << UpRefs[i].second->getDescription() << ") = " |
| 1326 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1327 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1328 | // Decrement level of upreference |
| 1329 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1330 | UpRefs[i].LastContainedTy = Ty; |
| 1331 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1332 | if (Level == 0) { // Upreference should be resolved! |
| 1333 | if (!TypeToResolve) { |
| 1334 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1335 | } else { |
| 1336 | UR_OUT(" * Resolving upreference for " |
| 1337 | << UpRefs[i].second->getDescription() << "\n"; |
| 1338 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1339 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1340 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1341 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1342 | } |
| 1343 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1344 | --i; // Do not skip the next element... |
| 1345 | } |
| 1346 | } |
| 1347 | } |
| 1348 | |
| 1349 | if (TypeToResolve) { |
| 1350 | UR_OUT(" * Resolving upreference for " |
| 1351 | << UpRefs[i].second->getDescription() << "\n"; |
| 1352 | std::string OldName = TypeToResolve->getDescription()); |
| 1353 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1354 | } |
| 1355 | |
| 1356 | return Ty; |
| 1357 | } |
| 1358 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1359 | //===----------------------------------------------------------------------===// |
| 1360 | // RunVMAsmParser - Define an interface to this parser |
| 1361 | //===----------------------------------------------------------------------===// |
| 1362 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1363 | static Module* RunParser(Module * M); |
| 1364 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 1365 | Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { |
| 1366 | InitLLLexer(MB); |
| 1367 | Module *M = RunParser(new Module(LLLgetFilename())); |
| 1368 | FreeLexer(); |
| 1369 | return M; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1370 | } |
| 1371 | |
| 1372 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1373 | |
| 1374 | /* Enabling traces. */ |
| 1375 | #ifndef YYDEBUG |
| 1376 | # define YYDEBUG 0 |
| 1377 | #endif |
| 1378 | |
| 1379 | /* Enabling verbose error messages. */ |
| 1380 | #ifdef YYERROR_VERBOSE |
| 1381 | # undef YYERROR_VERBOSE |
| 1382 | # define YYERROR_VERBOSE 1 |
| 1383 | #else |
| 1384 | # define YYERROR_VERBOSE 0 |
| 1385 | #endif |
| 1386 | |
| 1387 | /* Enabling the token table. */ |
| 1388 | #ifndef YYTOKEN_TABLE |
| 1389 | # define YYTOKEN_TABLE 0 |
| 1390 | #endif |
| 1391 | |
| 1392 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 1393 | typedef union YYSTYPE |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1394 | #line 986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1395 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1396 | llvm::Module *ModuleVal; |
| 1397 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1398 | llvm::BasicBlock *BasicBlockVal; |
| 1399 | llvm::TerminatorInst *TermInstVal; |
| 1400 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1401 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1402 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1403 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1404 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1405 | llvm::PATypeHolder *TypeVal; |
| 1406 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1407 | std::vector<llvm::Value*> *ValueList; |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1408 | std::vector<unsigned> *ConstantList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1409 | llvm::ArgListType *ArgList; |
| 1410 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1411 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 1412 | llvm::ParamList *ParamList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1413 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1414 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1415 | std::list<std::pair<llvm::Value*, |
| 1416 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1417 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1418 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1419 | |
| 1420 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1421 | llvm::GlobalValue::VisibilityTypes Visibility; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 1422 | llvm::Attributes Attributes; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1423 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1424 | int64_t SInt64Val; |
| 1425 | uint64_t UInt64Val; |
| 1426 | int SIntVal; |
| 1427 | unsigned UIntVal; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 1428 | llvm::APFloat *FPVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1429 | bool BoolVal; |
| 1430 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1431 | std::string *StrVal; // This memory must be deleted |
| 1432 | llvm::ValID ValIDVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1433 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1434 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1435 | llvm::Instruction::TermOps TermOpVal; |
| 1436 | llvm::Instruction::MemoryOps MemOpVal; |
| 1437 | llvm::Instruction::CastOps CastOpVal; |
| 1438 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1439 | llvm::ICmpInst::Predicate IPredicate; |
| 1440 | llvm::FCmpInst::Predicate FPredicate; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1441 | } |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1442 | /* Line 187 of yacc.c. */ |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1443 | #line 1444 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1444 | YYSTYPE; |
| 1445 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1446 | # define YYSTYPE_IS_DECLARED 1 |
| 1447 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1448 | #endif |
| 1449 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1450 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1451 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1452 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1453 | |
| 1454 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1455 | /* Line 216 of yacc.c. */ |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1456 | #line 1457 "llvmAsmParser.tab.c" |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1457 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1458 | #ifdef short |
| 1459 | # undef short |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1460 | #endif |
| 1461 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1462 | #ifdef YYTYPE_UINT8 |
| 1463 | typedef YYTYPE_UINT8 yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1464 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1465 | typedef unsigned char yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1466 | #endif |
| 1467 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1468 | #ifdef YYTYPE_INT8 |
| 1469 | typedef YYTYPE_INT8 yytype_int8; |
| 1470 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 1471 | || defined __cplusplus || defined _MSC_VER) |
| 1472 | typedef signed char yytype_int8; |
| 1473 | #else |
| 1474 | typedef short int yytype_int8; |
| 1475 | #endif |
| 1476 | |
| 1477 | #ifdef YYTYPE_UINT16 |
| 1478 | typedef YYTYPE_UINT16 yytype_uint16; |
| 1479 | #else |
| 1480 | typedef unsigned short int yytype_uint16; |
| 1481 | #endif |
| 1482 | |
| 1483 | #ifdef YYTYPE_INT16 |
| 1484 | typedef YYTYPE_INT16 yytype_int16; |
| 1485 | #else |
| 1486 | typedef short int yytype_int16; |
| 1487 | #endif |
| 1488 | |
| 1489 | #ifndef YYSIZE_T |
| 1490 | # ifdef __SIZE_TYPE__ |
| 1491 | # define YYSIZE_T __SIZE_TYPE__ |
| 1492 | # elif defined size_t |
| 1493 | # define YYSIZE_T size_t |
| 1494 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1495 | || defined __cplusplus || defined _MSC_VER) |
| 1496 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1497 | # define YYSIZE_T size_t |
| 1498 | # else |
| 1499 | # define YYSIZE_T unsigned int |
| 1500 | # endif |
| 1501 | #endif |
| 1502 | |
| 1503 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 1504 | |
| 1505 | #ifndef YY_ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1506 | # if YYENABLE_NLS |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1507 | # if ENABLE_NLS |
| 1508 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1509 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1510 | # endif |
| 1511 | # endif |
| 1512 | # ifndef YY_ |
| 1513 | # define YY_(msgid) msgid |
| 1514 | # endif |
| 1515 | #endif |
| 1516 | |
| 1517 | /* Suppress unused-variable warnings by "using" E. */ |
| 1518 | #if ! defined lint || defined __GNUC__ |
| 1519 | # define YYUSE(e) ((void) (e)) |
| 1520 | #else |
| 1521 | # define YYUSE(e) /* empty */ |
| 1522 | #endif |
| 1523 | |
| 1524 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 1525 | #ifndef lint |
| 1526 | # define YYID(n) (n) |
| 1527 | #else |
| 1528 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1529 | || defined __cplusplus || defined _MSC_VER) |
| 1530 | static int |
| 1531 | YYID (int i) |
| 1532 | #else |
| 1533 | static int |
| 1534 | YYID (i) |
| 1535 | int i; |
| 1536 | #endif |
| 1537 | { |
| 1538 | return i; |
| 1539 | } |
| 1540 | #endif |
| 1541 | |
| 1542 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 1543 | |
| 1544 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1545 | |
| 1546 | # ifdef YYSTACK_USE_ALLOCA |
| 1547 | # if YYSTACK_USE_ALLOCA |
| 1548 | # ifdef __GNUC__ |
| 1549 | # define YYSTACK_ALLOC __builtin_alloca |
| 1550 | # elif defined __BUILTIN_VA_ARG_INCR |
| 1551 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 1552 | # elif defined _AIX |
| 1553 | # define YYSTACK_ALLOC __alloca |
| 1554 | # elif defined _MSC_VER |
| 1555 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 1556 | # define alloca _alloca |
| 1557 | # else |
| 1558 | # define YYSTACK_ALLOC alloca |
| 1559 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1560 | || defined __cplusplus || defined _MSC_VER) |
| 1561 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1562 | # ifndef _STDLIB_H |
| 1563 | # define _STDLIB_H 1 |
| 1564 | # endif |
| 1565 | # endif |
| 1566 | # endif |
| 1567 | # endif |
| 1568 | # endif |
| 1569 | |
| 1570 | # ifdef YYSTACK_ALLOC |
| 1571 | /* Pacify GCC's `empty if-body' warning. */ |
| 1572 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
| 1573 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1574 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1575 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1576 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1577 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1578 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 1579 | # endif |
| 1580 | # else |
| 1581 | # define YYSTACK_ALLOC YYMALLOC |
| 1582 | # define YYSTACK_FREE YYFREE |
| 1583 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1584 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 1585 | # endif |
| 1586 | # if (defined __cplusplus && ! defined _STDLIB_H \ |
| 1587 | && ! ((defined YYMALLOC || defined malloc) \ |
| 1588 | && (defined YYFREE || defined free))) |
| 1589 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1590 | # ifndef _STDLIB_H |
| 1591 | # define _STDLIB_H 1 |
| 1592 | # endif |
| 1593 | # endif |
| 1594 | # ifndef YYMALLOC |
| 1595 | # define YYMALLOC malloc |
| 1596 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1597 | || defined __cplusplus || defined _MSC_VER) |
| 1598 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1599 | # endif |
| 1600 | # endif |
| 1601 | # ifndef YYFREE |
| 1602 | # define YYFREE free |
| 1603 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1604 | || defined __cplusplus || defined _MSC_VER) |
| 1605 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1606 | # endif |
| 1607 | # endif |
| 1608 | # endif |
| 1609 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 1610 | |
| 1611 | |
| 1612 | #if (! defined yyoverflow \ |
| 1613 | && (! defined __cplusplus \ |
| 1614 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 1615 | |
| 1616 | /* A type that is properly aligned for any stack member. */ |
| 1617 | union yyalloc |
| 1618 | { |
| 1619 | yytype_int16 yyss; |
| 1620 | YYSTYPE yyvs; |
| 1621 | }; |
| 1622 | |
| 1623 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1624 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1625 | |
| 1626 | /* The size of an array large to enough to hold all stacks, each with |
| 1627 | N elements. */ |
| 1628 | # define YYSTACK_BYTES(N) \ |
| 1629 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 1630 | + YYSTACK_GAP_MAXIMUM) |
| 1631 | |
| 1632 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1633 | not overlap. */ |
| 1634 | # ifndef YYCOPY |
| 1635 | # if defined __GNUC__ && 1 < __GNUC__ |
| 1636 | # define YYCOPY(To, From, Count) \ |
| 1637 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1638 | # else |
| 1639 | # define YYCOPY(To, From, Count) \ |
| 1640 | do \ |
| 1641 | { \ |
| 1642 | YYSIZE_T yyi; \ |
| 1643 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1644 | (To)[yyi] = (From)[yyi]; \ |
| 1645 | } \ |
| 1646 | while (YYID (0)) |
| 1647 | # endif |
| 1648 | # endif |
| 1649 | |
| 1650 | /* Relocate STACK from its old location to the new one. The |
| 1651 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1652 | elements in the stack, and YYPTR gives the new location of the |
| 1653 | stack. Advance YYPTR to a properly aligned location for the next |
| 1654 | stack. */ |
| 1655 | # define YYSTACK_RELOCATE(Stack) \ |
| 1656 | do \ |
| 1657 | { \ |
| 1658 | YYSIZE_T yynewbytes; \ |
| 1659 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1660 | Stack = &yyptr->Stack; \ |
| 1661 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1662 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1663 | } \ |
| 1664 | while (YYID (0)) |
| 1665 | |
| 1666 | #endif |
| 1667 | |
| 1668 | /* YYFINAL -- State number of the termination state. */ |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1669 | #define YYFINAL 44 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1670 | /* YYLAST -- Last index in YYTABLE. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1671 | #define YYLAST 2434 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1672 | |
| 1673 | /* YYNTOKENS -- Number of terminals. */ |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1674 | #define YYNTOKENS 175 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1675 | /* YYNNTS -- Number of nonterminals. */ |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 1676 | #define YYNNTS 87 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1677 | /* YYNRULES -- Number of rules. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1678 | #define YYNRULES 351 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1679 | /* YYNRULES -- Number of states. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1680 | #define YYNSTATES 711 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1681 | |
| 1682 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1683 | #define YYUNDEFTOK 2 |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1684 | #define YYMAXUTOK 415 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1685 | |
| 1686 | #define YYTRANSLATE(YYX) \ |
| 1687 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1688 | |
| 1689 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1690 | static const yytype_uint8 yytranslate[] = |
| 1691 | { |
| 1692 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1693 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1694 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1695 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1696 | 161, 162, 165, 2, 164, 2, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1697 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1698 | 170, 163, 171, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1699 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1700 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1701 | 2, 167, 166, 169, 2, 2, 2, 2, 2, 174, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1702 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1703 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1704 | 168, 2, 2, 172, 2, 173, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1705 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1706 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1707 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1708 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1709 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1710 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1711 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1712 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1713 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1714 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1715 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1716 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1717 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1718 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1719 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1720 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1721 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1722 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1723 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1724 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1725 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1726 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1727 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1728 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1729 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1730 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1731 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1732 | 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1733 | 155, 156, 157, 158, 159, 160 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1734 | }; |
| 1735 | |
| 1736 | #if YYDEBUG |
| 1737 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1738 | YYRHS. */ |
| 1739 | static const yytype_uint16 yyprhs[] = |
| 1740 | { |
| 1741 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1742 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1743 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1744 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1745 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1746 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 1747 | 118, 123, 124, 127, 128, 131, 133, 135, 137, 138, |
| 1748 | 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, |
| 1749 | 160, 162, 164, 166, 167, 169, 171, 172, 174, 176, |
| 1750 | 178, 180, 181, 183, 185, 186, 188, 190, 192, 194, |
| 1751 | 196, 199, 201, 203, 205, 207, 209, 211, 213, 215, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1752 | 217, 220, 221, 224, 226, 228, 230, 232, 233, 236, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1753 | 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1754 | 258, 260, 261, 264, 265, 268, 269, 272, 273, 277, |
| 1755 | 280, 281, 283, 284, 288, 290, 293, 295, 297, 299, |
| 1756 | 301, 303, 305, 307, 309, 311, 315, 317, 320, 326, |
| 1757 | 332, 338, 344, 348, 351, 357, 362, 365, 367, 369, |
| 1758 | 371, 375, 377, 381, 383, 384, 386, 390, 395, 399, |
| 1759 | 403, 408, 413, 417, 424, 430, 433, 436, 439, 442, |
| 1760 | 445, 448, 451, 454, 457, 460, 463, 466, 473, 479, |
| 1761 | 488, 495, 502, 510, 518, 526, 534, 541, 550, 559, |
| 1762 | 565, 573, 577, 579, 581, 583, 585, 586, 589, 596, |
| 1763 | 598, 599, 601, 604, 605, 609, 610, 614, 618, 622, |
| 1764 | 626, 627, 636, 637, 647, 648, 658, 664, 667, 671, |
| 1765 | 673, 677, 681, 685, 689, 691, 692, 698, 702, 704, |
| 1766 | 708, 710, 711, 723, 725, 727, 732, 734, 736, 739, |
| 1767 | 743, 744, 746, 748, 750, 752, 754, 756, 758, 760, |
| 1768 | 762, 764, 766, 770, 774, 777, 780, 784, 787, 793, |
| 1769 | 798, 800, 806, 808, 810, 812, 814, 816, 818, 821, |
| 1770 | 823, 827, 830, 833, 837, 841, 844, 845, 847, 850, |
| 1771 | 853, 857, 867, 877, 886, 902, 904, 906, 913, 919, |
| 1772 | 922, 925, 932, 940, 945, 950, 957, 964, 965, 966, |
| 1773 | 970, 973, 977, 980, 982, 988, 994, 1001, 1008, 1015, |
| 1774 | 1022, 1027, 1034, 1039, 1044, 1051, 1058, 1061, 1071, 1073, |
| 1775 | 1075, 1076, 1080, 1087, 1091, 1098, 1101, 1107, 1115, 1121, |
| 1776 | 1126, 1131 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1777 | }; |
| 1778 | |
| 1779 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1780 | static const yytype_int16 yyrhs[] = |
| 1781 | { |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1782 | 222, 0, -1, 75, -1, 76, -1, 77, -1, 78, |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 1783 | -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, |
| 1784 | -1, 87, -1, 88, -1, 89, -1, 84, -1, 85, |
| 1785 | -1, 86, -1, 120, -1, 121, -1, 122, -1, 123, |
| 1786 | -1, 124, -1, 125, -1, 126, -1, 127, -1, 128, |
| 1787 | -1, 129, -1, 130, -1, 131, -1, 94, -1, 95, |
| 1788 | -1, 96, -1, 97, -1, 98, -1, 99, -1, 100, |
| 1789 | -1, 101, -1, 102, -1, 103, -1, 104, -1, 105, |
| 1790 | -1, 106, -1, 107, -1, 108, -1, 109, -1, 110, |
| 1791 | -1, 111, -1, 112, -1, 113, -1, 100, -1, 101, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 1792 | -1, 102, -1, 103, -1, 26, -1, 27, -1, 19, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1793 | -1, 22, -1, 24, -1, 181, -1, -1, 55, 161, |
| 1794 | 4, 162, -1, -1, 181, 163, -1, -1, 7, 163, |
| 1795 | -1, 20, -1, 23, -1, 188, -1, -1, 186, 163, |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 1796 | -1, 42, -1, 44, -1, 43, -1, 45, -1, 47, |
| 1797 | -1, 49, -1, 46, -1, 48, -1, 51, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1798 | 158, -1, 159, -1, 160, -1, -1, 46, -1, 48, |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 1799 | -1, -1, 42, -1, 43, -1, 44, -1, 47, -1, |
| 1800 | -1, 44, -1, 42, -1, -1, 63, -1, 64, -1, |
| 1801 | 65, -1, 66, -1, 67, -1, 62, 4, -1, 142, |
| 1802 | -1, 121, -1, 141, -1, 122, -1, 144, -1, 145, |
| 1803 | -1, 147, -1, 148, -1, 149, -1, 54, 4, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1804 | -1, 197, 196, -1, 144, -1, 142, -1, 141, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1805 | 147, -1, -1, 199, 198, -1, 143, -1, 146, -1, |
| 1806 | 144, -1, 142, -1, 141, -1, 150, -1, 151, -1, |
| 1807 | 154, -1, 155, -1, 153, -1, 156, -1, 157, -1, |
| 1808 | -1, 201, 200, -1, -1, 152, 22, -1, -1, 54, |
| 1809 | 4, -1, -1, 164, 54, 4, -1, 34, 22, -1, |
| 1810 | -1, 205, -1, -1, 164, 208, 207, -1, 205, -1, |
| 1811 | 54, 4, -1, 11, -1, 12, -1, 13, -1, 16, |
| 1812 | -1, 15, -1, 14, -1, 17, -1, 50, -1, 209, |
| 1813 | -1, 210, 183, 165, -1, 244, -1, 166, 4, -1, |
| 1814 | 210, 161, 214, 162, 201, -1, 10, 161, 214, 162, |
| 1815 | 201, -1, 167, 4, 168, 210, 169, -1, 170, 4, |
| 1816 | 168, 210, 171, -1, 172, 215, 173, -1, 172, 173, |
| 1817 | -1, 170, 172, 215, 173, 171, -1, 170, 172, 173, |
| 1818 | 171, -1, 210, 197, -1, 210, -1, 10, -1, 211, |
| 1819 | -1, 213, 164, 211, -1, 213, -1, 213, 164, 39, |
| 1820 | -1, 39, -1, -1, 210, -1, 215, 164, 210, -1, |
| 1821 | 210, 167, 218, 169, -1, 210, 167, 169, -1, 210, |
| 1822 | 174, 22, -1, 210, 170, 218, 171, -1, 210, 172, |
| 1823 | 218, 173, -1, 210, 172, 173, -1, 210, 170, 172, |
| 1824 | 218, 173, 171, -1, 210, 170, 172, 173, 171, -1, |
| 1825 | 210, 40, -1, 210, 41, -1, 210, 244, -1, 210, |
| 1826 | 217, -1, 210, 25, -1, 210, 3, -1, 210, 5, |
| 1827 | -1, 210, 4, -1, 210, 6, -1, 210, 26, -1, |
| 1828 | 210, 27, -1, 210, 9, -1, 178, 161, 216, 38, |
| 1829 | 210, 162, -1, 119, 161, 216, 256, 162, -1, 133, |
| 1830 | 161, 216, 164, 216, 164, 216, 162, -1, 176, 161, |
| 1831 | 216, 164, 216, 162, -1, 177, 161, 216, 164, 216, |
| 1832 | 162, -1, 90, 179, 161, 216, 164, 216, 162, -1, |
| 1833 | 91, 180, 161, 216, 164, 216, 162, -1, 92, 179, |
| 1834 | 161, 216, 164, 216, 162, -1, 93, 180, 161, 216, |
| 1835 | 164, 216, 162, -1, 135, 161, 216, 164, 216, 162, |
| 1836 | -1, 136, 161, 216, 164, 216, 164, 216, 162, -1, |
| 1837 | 137, 161, 216, 164, 216, 164, 216, 162, -1, 139, |
| 1838 | 161, 216, 257, 162, -1, 140, 161, 216, 164, 216, |
| 1839 | 257, 162, -1, 218, 164, 216, -1, 216, -1, 32, |
| 1840 | -1, 33, -1, 37, -1, -1, 212, 244, -1, 125, |
| 1841 | 161, 221, 38, 210, 162, -1, 223, -1, -1, 224, |
| 1842 | -1, 223, 224, -1, -1, 31, 225, 240, -1, -1, |
| 1843 | 30, 226, 241, -1, 60, 59, 230, -1, 184, 18, |
| 1844 | 210, -1, 184, 18, 10, -1, -1, 187, 191, 220, |
| 1845 | 219, 216, 183, 227, 207, -1, -1, 187, 189, 191, |
| 1846 | 220, 219, 216, 183, 228, 207, -1, -1, 187, 190, |
| 1847 | 191, 220, 219, 210, 183, 229, 207, -1, 187, 191, |
| 1848 | 35, 194, 221, -1, 52, 231, -1, 56, 163, 232, |
| 1849 | -1, 22, -1, 53, 163, 22, -1, 68, 163, 22, |
| 1850 | -1, 167, 233, 169, -1, 233, 164, 22, -1, 22, |
| 1851 | -1, -1, 234, 164, 210, 197, 182, -1, 210, 197, |
| 1852 | 182, -1, 234, -1, 234, 164, 39, -1, 39, -1, |
| 1853 | -1, 195, 199, 212, 186, 161, 235, 162, 201, 206, |
| 1854 | 203, 202, -1, 28, -1, 172, -1, 193, 191, 236, |
| 1855 | 237, -1, 29, -1, 173, -1, 248, 239, -1, 192, |
| 1856 | 191, 236, -1, -1, 61, -1, 3, -1, 4, -1, |
| 1857 | 5, -1, 6, -1, 9, -1, 26, -1, 27, -1, |
| 1858 | 40, -1, 41, -1, 25, -1, 170, 218, 171, -1, |
| 1859 | 167, 218, 169, -1, 167, 169, -1, 174, 22, -1, |
| 1860 | 172, 218, 173, -1, 172, 173, -1, 170, 172, 218, |
| 1861 | 173, 171, -1, 170, 172, 173, 171, -1, 217, -1, |
| 1862 | 59, 242, 22, 164, 22, -1, 7, -1, 8, -1, |
| 1863 | 181, -1, 186, -1, 244, -1, 243, -1, 210, 245, |
| 1864 | -1, 246, -1, 247, 164, 246, -1, 248, 249, -1, |
| 1865 | 238, 249, -1, 250, 184, 251, -1, 250, 185, 251, |
| 1866 | -1, 250, 253, -1, -1, 21, -1, 69, 247, -1, |
| 1867 | 69, 10, -1, 70, 17, 245, -1, 70, 11, 245, |
| 1868 | 164, 17, 245, 164, 17, 245, -1, 71, 11, 245, |
| 1869 | 164, 17, 245, 167, 252, 169, -1, 71, 11, 245, |
| 1870 | 164, 17, 245, 167, 169, -1, 72, 195, 199, 212, |
| 1871 | 245, 161, 255, 162, 201, 38, 17, 245, 73, 17, |
| 1872 | 245, -1, 73, -1, 74, -1, 252, 11, 243, 164, |
| 1873 | 17, 245, -1, 11, 243, 164, 17, 245, -1, 184, |
| 1874 | 259, -1, 185, 259, -1, 210, 167, 245, 164, 245, |
| 1875 | 169, -1, 254, 164, 167, 245, 164, 245, 169, -1, |
| 1876 | 210, 197, 245, 197, -1, 17, 197, 245, 197, -1, |
| 1877 | 255, 164, 210, 197, 245, 197, -1, 255, 164, 17, |
| 1878 | 197, 245, 197, -1, -1, -1, 256, 164, 246, -1, |
| 1879 | 164, 4, -1, 257, 164, 4, -1, 58, 57, -1, |
| 1880 | 57, -1, 176, 210, 245, 164, 245, -1, 177, 210, |
| 1881 | 245, 164, 245, -1, 90, 179, 210, 245, 164, 245, |
| 1882 | -1, 91, 180, 210, 245, 164, 245, -1, 92, 179, |
| 1883 | 210, 245, 164, 245, -1, 93, 180, 210, 245, 164, |
| 1884 | 245, -1, 178, 246, 38, 210, -1, 133, 246, 164, |
| 1885 | 246, 164, 246, -1, 134, 246, 164, 210, -1, 135, |
| 1886 | 246, 164, 246, -1, 136, 246, 164, 246, 164, 246, |
| 1887 | -1, 137, 246, 164, 246, 164, 246, -1, 132, 254, |
| 1888 | -1, 258, 195, 199, 212, 245, 161, 255, 162, 201, |
| 1889 | -1, 261, -1, 36, -1, -1, 114, 210, 204, -1, |
| 1890 | 114, 210, 164, 11, 245, 204, -1, 115, 210, 204, |
| 1891 | -1, 115, 210, 164, 11, 245, 204, -1, 116, 246, |
| 1892 | -1, 260, 117, 210, 245, 204, -1, 260, 118, 246, |
| 1893 | 164, 210, 245, 204, -1, 138, 210, 245, 164, 4, |
| 1894 | -1, 119, 210, 245, 256, -1, 139, 210, 245, 257, |
| 1895 | -1, 140, 210, 245, 164, 210, 245, 257, -1 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1896 | }; |
| 1897 | |
| 1898 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1899 | static const yytype_uint16 yyrline[] = |
| 1900 | { |
Nuno Lopes | aa386d0 | 2008-11-04 14:43:20 +0000 | [diff] [blame] | 1901 | 0, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, |
| 1902 | 1152, 1153, 1153, 1153, 1153, 1153, 1153, 1154, 1154, 1154, |
| 1903 | 1154, 1154, 1154, 1155, 1155, 1155, 1155, 1155, 1155, 1158, |
| 1904 | 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162, 1162, 1166, |
| 1905 | 1166, 1167, 1167, 1168, 1168, 1169, 1169, 1170, 1170, 1171, |
| 1906 | 1171, 1172, 1172, 1173, 1174, 1177, 1177, 1177, 1178, 1178, |
| 1907 | 1180, 1181, 1185, 1189, 1194, 1200, 1200, 1202, 1203, 1208, |
| 1908 | 1214, 1215, 1216, 1217, 1218, 1219, 1223, 1224, 1225, 1229, |
| 1909 | 1230, 1231, 1232, 1236, 1237, 1238, 1242, 1243, 1244, 1245, |
| 1910 | 1246, 1250, 1251, 1252, 1255, 1256, 1257, 1258, 1259, 1260, |
| 1911 | 1261, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1912 | 1277, 1281, 1282, 1287, 1288, 1289, 1290, 1293, 1294, 1300, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1913 | 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 1914 | 1311, 1314, 1315, 1321, 1322, 1329, 1330, 1336, 1337, 1346, |
| 1915 | 1354, 1355, 1360, 1361, 1362, 1367, 1380, 1380, 1380, 1380, |
| 1916 | 1380, 1380, 1380, 1383, 1387, 1391, 1398, 1403, 1411, 1446, |
| 1917 | 1477, 1482, 1492, 1502, 1506, 1516, 1523, 1532, 1539, 1544, |
| 1918 | 1549, 1556, 1557, 1564, 1571, 1579, 1585, 1597, 1625, 1641, |
| 1919 | 1668, 1696, 1722, 1742, 1768, 1788, 1800, 1807, 1873, 1883, |
| 1920 | 1893, 1904, 1917, 1928, 1942, 1949, 1956, 1974, 1986, 2007, |
| 1921 | 2015, 2021, 2032, 2037, 2042, 2047, 2052, 2058, 2064, 2070, |
| 1922 | 2078, 2089, 2093, 2101, 2101, 2104, 2104, 2107, 2119, 2140, |
| 1923 | 2145, 2153, 2154, 2158, 2158, 2162, 2162, 2165, 2168, 2192, |
| 1924 | 2204, 2203, 2215, 2214, 2224, 2223, 2234, 2274, 2277, 2283, |
| 1925 | 2293, 2297, 2302, 2304, 2309, 2314, 2323, 2333, 2344, 2348, |
| 1926 | 2357, 2366, 2371, 2520, 2520, 2522, 2531, 2531, 2533, 2538, |
| 1927 | 2550, 2554, 2559, 2563, 2567, 2572, 2577, 2581, 2585, 2589, |
| 1928 | 2593, 2597, 2601, 2623, 2645, 2651, 2664, 2676, 2681, 2693, |
| 1929 | 2699, 2703, 2713, 2717, 2721, 2726, 2733, 2733, 2739, 2748, |
| 1930 | 2753, 2758, 2762, 2771, 2780, 2793, 2802, 2806, 2814, 2834, |
| 1931 | 2838, 2843, 2854, 2873, 2882, 2986, 2990, 2997, 3008, 3021, |
| 1932 | 3030, 3043, 3054, 3064, 3075, 3083, 3093, 3100, 3103, 3104, |
| 1933 | 3112, 3118, 3127, 3131, 3136, 3152, 3169, 3181, 3193, 3207, |
| 1934 | 3221, 3233, 3254, 3261, 3267, 3273, 3279, 3294, 3404, 3409, |
| 1935 | 3413, 3420, 3427, 3437, 3444, 3454, 3462, 3476, 3493, 3507, |
| 1936 | 3522, 3537 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1937 | }; |
| 1938 | #endif |
| 1939 | |
| 1940 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1941 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1942 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1943 | static const char *const yytname[] = |
| 1944 | { |
| 1945 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1946 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1947 | "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE", |
| 1948 | "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT", |
| 1949 | "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK", |
| 1950 | "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", |
| 1951 | "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO", |
| 1952 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1953 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE", |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1954 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", |
| 1955 | "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", |
| 1956 | "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 1957 | "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", |
| 1958 | "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", |
| 1959 | "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP", |
| 1960 | "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", |
| 1961 | "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", |
| 1962 | "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", |
| 1963 | "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", |
| 1964 | "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", |
| 1965 | "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
| 1966 | "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT", |
| 1967 | "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 1968 | "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE", |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1969 | "SSP", "SSPREQ", "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", |
| 1970 | "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", |
| 1971 | "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps", |
| 1972 | "IPredicates", "FPredicates", "LocalName", "OptLocalName", |
| 1973 | "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName", |
| 1974 | "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", |
| 1975 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1976 | "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute", |
| 1977 | "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs", |
| 1978 | "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection", |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 1979 | "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", |
| 1980 | "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI", |
| 1981 | "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal", |
| 1982 | "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3", |
| 1983 | "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition", |
| 1984 | "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", |
| 1985 | "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect", |
| 1986 | "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", |
| 1987 | "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList", |
| 1988 | "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList", |
| 1989 | "IndexList", "ConstantIndexList", "OptTailCall", "InstVal", |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 1990 | "OptVolatile", "MemoryInst", 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1991 | }; |
| 1992 | #endif |
| 1993 | |
| 1994 | # ifdef YYPRINT |
| 1995 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1996 | token YYLEX-NUM. */ |
| 1997 | static const yytype_uint16 yytoknum[] = |
| 1998 | { |
| 1999 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 2000 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 2001 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 2002 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 2003 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 2004 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 2005 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 2006 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 2007 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 2008 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 2009 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 2010 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 2011 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 2012 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 2013 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2014 | 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, |
| 2015 | 415, 40, 41, 61, 44, 42, 92, 91, 120, 93, |
| 2016 | 60, 62, 123, 125, 99 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2017 | }; |
| 2018 | # endif |
| 2019 | |
| 2020 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 2021 | static const yytype_uint16 yyr1[] = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2022 | { |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2023 | 0, 175, 176, 176, 176, 176, 176, 176, 176, 176, |
| 2024 | 176, 177, 177, 177, 177, 177, 177, 178, 178, 178, |
| 2025 | 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, |
| 2026 | 179, 179, 179, 179, 179, 179, 179, 179, 179, 180, |
| 2027 | 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, |
| 2028 | 180, 180, 180, 180, 180, 181, 181, 181, 182, 182, |
| 2029 | 183, 183, 184, 184, 185, 186, 186, 187, 187, 188, |
| 2030 | 189, 189, 189, 189, 189, 189, 190, 190, 190, 191, |
| 2031 | 191, 191, 191, 192, 192, 192, 193, 193, 193, 193, |
| 2032 | 193, 194, 194, 194, 195, 195, 195, 195, 195, 195, |
| 2033 | 195, 196, 196, 196, 196, 196, 196, 196, 196, 196, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2034 | 196, 197, 197, 198, 198, 198, 198, 199, 199, 200, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2035 | 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2036 | 200, 201, 201, 202, 202, 203, 203, 204, 204, 205, |
| 2037 | 206, 206, 207, 207, 208, 208, 209, 209, 209, 209, |
| 2038 | 209, 209, 209, 210, 210, 210, 210, 210, 210, 210, |
| 2039 | 210, 210, 210, 210, 210, 210, 211, 212, 212, 213, |
| 2040 | 213, 214, 214, 214, 214, 215, 215, 216, 216, 216, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2041 | 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2042 | 216, 216, 216, 216, 216, 216, 216, 217, 217, 217, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2043 | 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2044 | 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, |
| 2045 | 222, 223, 223, 225, 224, 226, 224, 224, 224, 224, |
| 2046 | 227, 224, 228, 224, 229, 224, 224, 224, 224, 230, |
| 2047 | 231, 231, 232, 233, 233, 233, 234, 234, 235, 235, |
| 2048 | 235, 235, 236, 237, 237, 238, 239, 239, 240, 241, |
| 2049 | 242, 242, 243, 243, 243, 243, 243, 243, 243, 243, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2050 | 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2051 | 243, 243, 244, 244, 244, 244, 245, 245, 246, 247, |
| 2052 | 247, 248, 248, 249, 249, 250, 250, 250, 251, 251, |
| 2053 | 251, 251, 251, 251, 251, 251, 251, 252, 252, 253, |
| 2054 | 253, 254, 254, 255, 255, 255, 255, 255, 256, 256, |
| 2055 | 257, 257, 258, 258, 259, 259, 259, 259, 259, 259, |
| 2056 | 259, 259, 259, 259, 259, 259, 259, 259, 259, 260, |
| 2057 | 260, 261, 261, 261, 261, 261, 261, 261, 261, 261, |
| 2058 | 261, 261 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2059 | }; |
| 2060 | |
| 2061 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 2062 | static const yytype_uint8 yyr2[] = |
| 2063 | { |
| 2064 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2065 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2066 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2067 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2068 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2069 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, |
| 2070 | 4, 0, 2, 0, 2, 1, 1, 1, 0, 2, |
| 2071 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, |
| 2072 | 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, |
| 2073 | 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, |
| 2074 | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2075 | 2, 0, 2, 1, 1, 1, 1, 0, 2, 1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2076 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2077 | 1, 0, 2, 0, 2, 0, 2, 0, 3, 2, |
| 2078 | 0, 1, 0, 3, 1, 2, 1, 1, 1, 1, |
| 2079 | 1, 1, 1, 1, 1, 3, 1, 2, 5, 5, |
| 2080 | 5, 5, 3, 2, 5, 4, 2, 1, 1, 1, |
| 2081 | 3, 1, 3, 1, 0, 1, 3, 4, 3, 3, |
| 2082 | 4, 4, 3, 6, 5, 2, 2, 2, 2, 2, |
| 2083 | 2, 2, 2, 2, 2, 2, 2, 6, 5, 8, |
| 2084 | 6, 6, 7, 7, 7, 7, 6, 8, 8, 5, |
| 2085 | 7, 3, 1, 1, 1, 1, 0, 2, 6, 1, |
| 2086 | 0, 1, 2, 0, 3, 0, 3, 3, 3, 3, |
| 2087 | 0, 8, 0, 9, 0, 9, 5, 2, 3, 1, |
| 2088 | 3, 3, 3, 3, 1, 0, 5, 3, 1, 3, |
| 2089 | 1, 0, 11, 1, 1, 4, 1, 1, 2, 3, |
| 2090 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2091 | 1, 1, 3, 3, 2, 2, 3, 2, 5, 4, |
| 2092 | 1, 5, 1, 1, 1, 1, 1, 1, 2, 1, |
| 2093 | 3, 2, 2, 3, 3, 2, 0, 1, 2, 2, |
| 2094 | 3, 9, 9, 8, 15, 1, 1, 6, 5, 2, |
| 2095 | 2, 6, 7, 4, 4, 6, 6, 0, 0, 3, |
| 2096 | 2, 3, 2, 1, 5, 5, 6, 6, 6, 6, |
| 2097 | 4, 6, 4, 4, 6, 6, 2, 9, 1, 1, |
| 2098 | 0, 3, 6, 3, 6, 2, 5, 7, 5, 4, |
| 2099 | 4, 7 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2100 | }; |
| 2101 | |
| 2102 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 2103 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 2104 | means the default is an error. */ |
| 2105 | static const yytype_uint16 yydefact[] = |
| 2106 | { |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2107 | 68, 55, 65, 56, 66, 57, 225, 223, 0, 0, |
| 2108 | 0, 0, 0, 0, 79, 67, 0, 68, 221, 83, |
| 2109 | 86, 0, 0, 237, 0, 0, 62, 0, 69, 70, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2110 | 72, 71, 73, 76, 74, 77, 75, 78, 80, 81, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2111 | 82, 79, 79, 216, 1, 222, 84, 85, 79, 226, |
| 2112 | 87, 88, 89, 90, 79, 296, 224, 296, 0, 0, |
| 2113 | 245, 238, 239, 227, 282, 283, 229, 146, 147, 148, |
| 2114 | 151, 150, 149, 152, 153, 0, 0, 0, 0, 284, |
| 2115 | 285, 154, 228, 156, 216, 216, 91, 215, 0, 94, |
| 2116 | 94, 297, 292, 63, 256, 257, 258, 291, 240, 241, |
| 2117 | 244, 0, 174, 157, 0, 0, 0, 0, 163, 175, |
| 2118 | 0, 0, 174, 0, 0, 0, 93, 92, 0, 213, |
| 2119 | 214, 0, 0, 95, 96, 97, 98, 99, 117, 259, |
| 2120 | 0, 0, 340, 340, 295, 0, 242, 173, 111, 169, |
| 2121 | 171, 0, 0, 0, 0, 0, 0, 162, 0, 0, |
| 2122 | 155, 0, 0, 168, 0, 167, 0, 236, 61, 61, |
| 2123 | 100, 0, 253, 254, 255, 64, 339, 323, 0, 0, |
| 2124 | 0, 0, 94, 305, 306, 2, 3, 4, 5, 6, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2125 | 7, 8, 9, 10, 14, 15, 16, 11, 12, 13, |
| 2126 | 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, |
| 2127 | 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 2128 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2129 | 0, 0, 293, 94, 309, 0, 338, 294, 310, 243, |
| 2130 | 166, 0, 131, 61, 61, 165, 0, 176, 0, 131, |
| 2131 | 61, 61, 0, 217, 190, 192, 191, 193, 196, 189, |
| 2132 | 194, 195, 185, 186, 0, 0, 0, 0, 0, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2133 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2134 | 0, 0, 188, 187, 230, 115, 114, 113, 116, 118, |
| 2135 | 0, 322, 299, 61, 289, 298, 0, 0, 0, 117, |
| 2136 | 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 2137 | 0, 53, 54, 49, 50, 51, 52, 39, 40, 41, |
| 2138 | 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, |
| 2139 | 137, 137, 345, 61, 61, 336, 0, 0, 0, 0, |
| 2140 | 0, 61, 61, 61, 61, 61, 0, 117, 0, 0, |
| 2141 | 0, 102, 104, 103, 101, 105, 106, 107, 108, 109, |
| 2142 | 112, 172, 170, 159, 160, 161, 164, 60, 158, 232, |
| 2143 | 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2144 | 0, 0, 0, 178, 212, 0, 0, 0, 182, 0, |
| 2145 | 179, 0, 0, 0, 142, 0, 262, 263, 264, 265, |
| 2146 | 266, 271, 267, 268, 269, 270, 260, 0, 0, 0, |
| 2147 | 0, 280, 287, 286, 288, 0, 0, 300, 0, 0, |
| 2148 | 61, 61, 61, 61, 0, 341, 0, 343, 318, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2149 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2150 | 0, 0, 0, 61, 0, 110, 123, 122, 119, 121, |
| 2151 | 120, 124, 125, 128, 126, 127, 129, 130, 132, 142, |
| 2152 | 142, 0, 0, 0, 0, 0, 318, 0, 0, 0, |
| 2153 | 0, 0, 0, 0, 177, 163, 175, 0, 180, 181, |
| 2154 | 0, 0, 0, 0, 231, 251, 261, 0, 274, 0, |
| 2155 | 0, 0, 277, 0, 275, 290, 0, 0, 0, 0, |
| 2156 | 0, 0, 0, 0, 0, 0, 349, 0, 0, 0, |
| 2157 | 332, 333, 0, 0, 0, 0, 350, 0, 0, 0, |
| 2158 | 330, 0, 137, 0, 233, 235, 61, 0, 0, 0, |
| 2159 | 0, 0, 0, 0, 0, 0, 0, 0, 211, 184, |
| 2160 | 0, 0, 0, 0, 0, 0, 144, 142, 250, 111, |
| 2161 | 248, 0, 0, 273, 163, 0, 272, 276, 0, 0, |
| 2162 | 0, 0, 0, 0, 0, 137, 138, 137, 0, 0, |
| 2163 | 0, 0, 0, 0, 348, 320, 0, 61, 324, 325, |
| 2164 | 0, 0, 346, 61, 218, 0, 0, 0, 0, 198, |
| 2165 | 0, 0, 0, 0, 209, 0, 183, 0, 0, 61, |
| 2166 | 139, 145, 143, 59, 0, 131, 0, 279, 0, 0, |
| 2167 | 0, 317, 326, 327, 328, 329, 342, 344, 319, 0, |
| 2168 | 0, 331, 334, 335, 321, 0, 317, 137, 0, 0, |
| 2169 | 0, 0, 0, 206, 0, 0, 0, 200, 201, 197, |
| 2170 | 58, 247, 249, 111, 140, 281, 278, 0, 0, 111, |
| 2171 | 111, 0, 311, 0, 351, 0, 347, 202, 203, 204, |
| 2172 | 205, 0, 0, 0, 210, 59, 141, 135, 0, 0, |
| 2173 | 303, 0, 0, 0, 131, 0, 312, 131, 199, 207, |
| 2174 | 208, 246, 0, 133, 301, 0, 0, 302, 102, 104, |
| 2175 | 111, 111, 0, 111, 111, 337, 136, 0, 252, 0, |
| 2176 | 0, 314, 313, 0, 0, 0, 134, 0, 0, 0, |
| 2177 | 111, 111, 308, 0, 0, 316, 315, 307, 0, 0, |
| 2178 | 304 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2179 | }; |
| 2180 | |
| 2181 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 2182 | static const yytype_int16 yydefgoto[] = |
| 2183 | { |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2184 | -1, 269, 270, 271, 300, 317, 79, 631, 113, 12, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2185 | 133, 80, 14, 15, 41, 42, 43, 48, 54, 118, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2186 | 128, 350, 230, 279, 161, 448, 353, 688, 673, 415, |
| 2187 | 536, 657, 474, 537, 81, 158, 139, 156, 140, 141, |
| 2188 | 110, 374, 401, 375, 121, 88, 157, 16, 17, 18, |
| 2189 | 20, 19, 384, 449, 450, 63, 23, 61, 101, 540, |
| 2190 | 541, 129, 164, 55, 96, 56, 49, 477, 402, 83, |
| 2191 | 404, 284, 285, 57, 92, 93, 222, 661, 134, 325, |
| 2192 | 641, 496, 506, 223, 224, 225, 226 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2193 | }; |
| 2194 | |
| 2195 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2196 | STATE-NUM. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2197 | #define YYPACT_NINF -619 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2198 | static const yytype_int16 yypact[] = |
| 2199 | { |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2200 | 790, -619, -619, -619, -619, -619, -619, -619, 10, -86, |
| 2201 | 53, -45, 136, 38, 62, -619, 49, 1492, -619, 117, |
| 2202 | 167, 39, 43, -619, 45, 151, -619, 1999, -619, -619, |
| 2203 | -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2204 | -619, -27, -27, 146, -619, -619, -619, -619, -27, -619, |
| 2205 | -619, -619, -619, -619, -27, 197, -619, 9, 216, 224, |
| 2206 | 228, -619, -619, -619, -619, -619, 105, -619, -619, -619, |
| 2207 | -619, -619, -619, -619, -619, 266, 269, 2, 481, -619, |
| 2208 | -619, -619, -37, -619, 244, 244, 156, -619, 69, 213, |
| 2209 | 213, -619, -619, 40, -619, -619, -619, -619, -619, -619, |
| 2210 | -619, -70, 1724, -619, 118, 119, 550, 105, -619, -37, |
| 2211 | -118, 124, 1724, 125, 69, 69, -619, -619, 1768, -619, |
| 2212 | -619, 2024, 285, -619, -619, -619, -619, -619, -619, -619, |
| 2213 | -16, 131, 2294, 2294, -619, 273, -619, -619, -37, -619, |
| 2214 | 132, 135, 2024, 2024, 127, -83, 2024, -619, 295, 138, |
| 2215 | -619, 2024, 2024, 105, 145, -37, 46, -619, 1278, 252, |
| 2216 | -619, 1679, -619, -619, -619, -619, -619, -619, 251, 2065, |
| 2217 | 78, 298, 213, -619, -619, -619, -619, -619, -619, -619, |
| 2218 | -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2219 | 630, 660, 630, 660, 2024, 2024, 2024, 2024, -619, -619, |
| 2220 | -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2221 | 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, |
| 2222 | 2024, 2024, -619, 213, -619, 59, -619, -619, -619, -619, |
| 2223 | 335, 1817, -619, -39, -42, -619, 147, -37, 158, -619, |
| 2224 | 252, -10, 1768, -619, -619, -619, -619, -619, -619, -619, |
| 2225 | -619, -619, -619, -619, 630, 660, 630, 660, 160, 161, |
| 2226 | 170, 171, 172, 174, 175, 1858, 2124, 984, 312, 176, |
| 2227 | 181, 182, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2228 | 64, -619, 105, 934, -619, 180, 1450, 1450, 1450, -619, |
| 2229 | -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2230 | 2024, -619, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2231 | -619, -619, -619, -619, -619, -619, -619, 2024, 2024, 2024, |
| 2232 | -24, -19, -619, 934, -40, 183, 184, 187, 188, 189, |
| 2233 | 190, 934, 934, 934, 934, 934, 307, -619, 2024, 2024, |
| 2234 | 342, -619, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2235 | -619, -619, -619, 557, -619, -619, -619, -619, 557, -619, |
| 2236 | 125, 317, 195, 196, 200, 201, 2024, 2024, 2024, 2024, |
| 2237 | 2024, 2024, 2024, -619, -619, -9, 1155, -120, -619, -76, |
| 2238 | -619, 2024, 2024, 2024, 203, 202, -619, -619, -619, -619, |
| 2239 | -619, -619, -619, -619, -619, -619, 299, 1899, 2165, 1327, |
| 2240 | 343, -619, -619, -619, -619, 2024, 204, -619, 208, 1679, |
| 2241 | 934, 934, 934, 934, 17, -619, 28, -619, -619, 1450, |
| 2242 | 206, 2024, 2024, 2024, 2024, 2024, 210, 211, 212, 214, |
| 2243 | 217, 2024, 1679, 934, 218, -619, -619, -619, -619, -619, |
| 2244 | -619, -619, -619, -619, -619, -619, -619, -619, -619, 203, |
| 2245 | 203, 2024, 2024, 2024, 2024, 2024, -619, 220, 222, 227, |
| 2246 | 229, 211, 230, 2024, -619, 193, 1106, -73, -619, -619, |
| 2247 | 238, 240, 339, 6, -619, 1940, -619, 366, -619, -3, |
| 2248 | 1638, -97, -619, -11, -619, -619, 375, 390, 1450, 248, |
| 2249 | 250, 255, 256, 1450, 411, 1450, 257, 258, 1450, 259, |
| 2250 | -37, -619, 260, 262, 412, 423, 265, 2024, 1450, 1450, |
| 2251 | -37, 1450, 268, 2024, -619, -619, -23, 270, 271, 272, |
| 2252 | 274, 55, 2024, 2024, 2024, 2024, 66, 2024, -619, -619, |
| 2253 | 276, 2024, 2024, 2024, 408, 429, -619, 203, -619, -37, |
| 2254 | 275, 280, 284, -619, 279, 35, -619, -619, 1450, 1450, |
| 2255 | 291, 1450, 1450, 1450, 1450, 268, -619, 268, 2024, 1450, |
| 2256 | 289, 2024, 2024, 2024, -619, -619, 433, 934, -619, -619, |
| 2257 | 294, 404, -619, 934, -619, 2024, 2024, 2024, 2024, -619, |
| 2258 | 296, 304, 303, 305, -619, 211, -619, 306, 308, -12, |
| 2259 | -619, -619, -619, 522, 1958, -619, 449, -619, 314, 311, |
| 2260 | 319, 2190, -619, -619, -619, -619, -619, -619, -619, 309, |
| 2261 | 1450, -619, -619, -619, -619, 211, 2190, 268, 328, 337, |
| 2262 | 344, 351, 2024, -619, 2024, 2024, 72, -619, -619, -619, |
| 2263 | -619, -619, -619, -37, 173, -619, -619, 497, -2, -13, |
| 2264 | -37, 73, -619, 346, 265, 87, -619, -619, -619, -619, |
| 2265 | -619, 354, 360, 361, -619, 522, -619, 470, 1450, 1588, |
| 2266 | -619, 3, 778, 778, -619, 2231, -619, -619, -619, -619, |
| 2267 | -619, -619, 521, 374, -619, 363, 1588, -619, 367, 368, |
| 2268 | -619, -619, 474, -13, -37, 557, -619, 508, -619, 516, |
| 2269 | 370, 335, 335, 523, 778, 778, -619, 1450, 525, 1450, |
| 2270 | -619, -619, -619, 1450, 465, 335, 335, -619, 526, 1450, |
| 2271 | -619 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2272 | }; |
| 2273 | |
| 2274 | /* YYPGOTO[NTERM-NUM]. */ |
| 2275 | static const yytype_int16 yypgoto[] = |
| 2276 | { |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2277 | -619, 110, 128, 130, -158, -132, 0, -116, -126, 452, |
| 2278 | -619, 8, -619, -619, -619, -619, 31, -619, -619, -619, |
| 2279 | -148, -619, -436, -619, -254, -619, -236, -619, -619, -316, |
| 2280 | -87, -619, -393, -619, -619, -26, 318, -150, -619, 436, |
| 2281 | 445, -114, -156, -240, 157, 199, 310, -619, -619, 536, |
| 2282 | -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, |
| 2283 | -619, 466, -619, -619, -619, -619, -619, -619, -618, -108, |
| 2284 | 186, -192, -619, -619, 502, -619, 438, -619, -619, -619, |
| 2285 | -38, 121, -451, -619, 446, -619, -619 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2286 | }; |
| 2287 | |
| 2288 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2289 | positive, shift that token. If negative, reduce the rule which |
| 2290 | number is the opposite. If zero, do what YYDEFACT says. |
| 2291 | If YYTABLE_NINF, syntax error. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2292 | #define YYTABLE_NINF -221 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2293 | static const yytype_int16 yytable[] = |
| 2294 | { |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2295 | 11, 82, 272, 358, 322, 417, 105, 159, 13, 659, |
| 2296 | 526, 280, 162, 111, 676, 111, 111, 11, 111, 326, |
| 2297 | 327, 328, 329, 330, 289, 13, 377, 379, 493, 336, |
| 2298 | 91, 111, 111, 274, 318, 409, 111, 240, 94, 495, |
| 2299 | 534, 675, -152, 111, 463, 111, 146, 131, 243, 44, |
| 2300 | 273, 468, 109, 64, 65, 147, 514, 515, 690, 1, |
| 2301 | 535, 319, 3, 21, 5, 1, 2, 463, 3, 4, |
| 2302 | 5, 494, 84, 85, 546, 337, 138, 24, 22, 89, |
| 2303 | 109, 146, 494, 432, 2, 90, 138, 4, 463, 286, |
| 2304 | 236, 463, 155, 11, 135, 287, 362, 469, 364, 136, |
| 2305 | 530, 119, 120, 593, 29, 30, 31, 32, 33, 34, |
| 2306 | 35, 36, 25, 37, 359, 360, 233, 234, 26, 112, |
| 2307 | 237, 112, 112, 363, 112, 365, 241, 419, -61, 355, |
| 2308 | 354, 38, 39, 40, 626, 155, 467, 112, 112, 574, |
| 2309 | 414, -61, 112, 283, 592, 416, -61, 434, -152, 112, |
| 2310 | 629, 112, -152, 463, 27, 463, 163, 479, 481, 483, |
| 2311 | 464, 463, 547, 46, 644, 47, 543, 660, 320, 321, |
| 2312 | 283, 323, 677, 62, 106, 403, 338, 339, 403, 403, |
| 2313 | 403, 86, 95, 87, 324, 283, 283, 283, 283, 283, |
| 2314 | 331, 332, 333, 334, 335, 283, 572, 655, 116, 463, |
| 2315 | 117, 28, 58, 662, 663, 138, 59, 534, 598, 50, |
| 2316 | 51, 52, 60, 485, 53, 403, 155, 579, 91, 558, |
| 2317 | 38, 39, 40, 403, 403, 403, 403, 403, 584, 499, |
| 2318 | 566, 501, 502, 503, 654, 664, 566, 665, 98, 606, |
| 2319 | 545, 607, 219, 219, 691, 692, 99, 694, 695, 667, |
| 2320 | 100, 665, 456, 457, 458, 459, 460, 461, 462, 488, |
| 2321 | 220, 220, 221, 221, 705, 706, 102, 470, 471, 472, |
| 2322 | 103, 151, 152, 104, 410, 122, 123, 124, 125, 126, |
| 2323 | 127, 87, 511, 114, 115, 148, 142, 143, 385, 160, |
| 2324 | 150, 411, 412, 413, 165, 229, 231, 232, 235, 238, |
| 2325 | 239, 646, 403, 403, 403, 403, 242, 111, 281, 288, |
| 2326 | 272, 403, 433, 283, 436, 437, 438, 439, 356, 440, |
| 2327 | 357, 366, 367, 441, 442, 403, 443, 444, 445, 446, |
| 2328 | 447, 368, 369, 370, 380, 371, 372, 381, 517, 518, |
| 2329 | 519, 520, 382, 383, 405, 431, 435, 420, 421, 528, |
| 2330 | 466, 422, 423, 424, 425, 451, 452, 453, 273, 634, |
| 2331 | 476, 454, 455, 475, 529, 484, 608, 473, 486, 611, |
| 2332 | 612, 613, 487, 498, 504, 505, 507, 533, 508, 283, |
| 2333 | 403, 509, 513, 155, 522, 403, 523, 403, 542, 340, |
| 2334 | 403, 524, 548, 525, 527, 283, 500, 283, 283, 283, |
| 2335 | 403, 403, 531, 403, 532, 510, 155, 549, 580, 581, |
| 2336 | 582, 583, 551, 585, 552, 556, 564, 587, 588, 553, |
| 2337 | 554, 558, 559, 561, 562, 516, 563, 565, 682, 566, |
| 2338 | 590, 685, 571, 591, 575, 576, 577, 614, 578, 594, |
| 2339 | 403, 403, 595, 403, 403, 403, 403, 586, 596, 539, |
| 2340 | 597, 403, 601, 610, 466, 616, 341, 342, 494, 403, |
| 2341 | 622, 618, 619, 620, 621, 403, 623, 624, 627, 625, |
| 2342 | 628, 635, 406, 407, 408, 637, 343, 344, 642, 345, |
| 2343 | 346, 567, 347, 348, 349, 636, 638, 573, 64, 65, |
| 2344 | 647, 107, 67, 68, 69, 70, 71, 72, 73, 648, |
| 2345 | 1, 2, 403, 3, 4, 5, 649, 589, 651, 418, |
| 2346 | 652, 653, 693, 650, 658, 666, 668, 426, 427, 428, |
| 2347 | 429, 430, 669, 670, 672, 686, 687, 689, -18, -19, |
| 2348 | 696, 74, 283, 697, 698, 283, 283, 283, 708, 671, |
| 2349 | 699, 1, 703, 709, 3, 132, 5, 656, 149, 352, |
| 2350 | 403, 145, 361, 45, 403, 403, 130, 64, 65, 97, |
| 2351 | 107, 67, 68, 69, 70, 71, 72, 73, 633, 1, |
| 2352 | 2, 227, 3, 4, 5, 640, 340, 521, 645, 228, |
| 2353 | 0, 0, 0, 0, 0, 0, 403, 403, 0, 403, |
| 2354 | 640, 403, 0, 630, 0, 403, 489, 490, 491, 492, |
| 2355 | 74, 403, 0, 0, 0, 497, 0, 0, 0, 0, |
| 2356 | 0, 0, 0, 0, 0, 436, 437, 438, 439, 512, |
| 2357 | 440, 0, 0, 0, 441, 442, 0, 443, 444, 445, |
| 2358 | 446, 447, 0, 0, 0, 0, 0, 0, 0, 684, |
| 2359 | 0, 0, 0, 341, 342, 0, 0, 75, 76, 0, |
| 2360 | 0, 77, 0, 78, 108, 630, 0, 0, 0, 0, |
| 2361 | 0, 0, 0, 343, 344, 0, 345, 346, 0, 347, |
| 2362 | 348, 349, 0, 0, 550, 0, 0, 0, 0, 555, |
| 2363 | 0, 557, 0, 0, 560, 0, 301, 302, 0, 0, |
| 2364 | 0, 0, 0, 0, 568, 569, 0, 570, 436, 437, |
| 2365 | 438, 439, 0, 440, 0, 0, 0, 441, 442, 0, |
| 2366 | 443, 444, 445, 446, 447, 0, 75, 76, 0, 0, |
| 2367 | 77, 0, 78, 144, 290, 291, 292, 293, 294, 295, |
| 2368 | 296, 297, 298, 299, 599, 600, 0, 602, 603, 604, |
| 2369 | 605, 0, 0, 0, 0, 609, 0, 0, 0, 0, |
| 2370 | 0, 0, 0, 615, 0, 0, 0, 0, 0, 617, |
| 2371 | 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, |
| 2372 | 313, 314, 315, 316, 0, 0, 0, 0, 0, 0, |
| 2373 | 0, 386, 387, 388, 389, 64, 65, 390, 0, 0, |
| 2374 | -220, 0, 0, 0, 0, 0, 643, 1, 2, 0, |
| 2375 | 3, 4, 5, 391, 392, 393, 0, 0, -63, 1, |
| 2376 | 2, 0, 3, 4, 5, 0, 0, 0, 394, 395, |
| 2377 | 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2378 | 0, 0, 340, 0, 0, 0, 0, 396, 0, 0, |
| 2379 | 0, 0, 8, 0, 674, 0, 9, 0, 680, 681, |
| 2380 | 10, 0, 0, 175, 176, 177, 178, 179, 180, 181, |
| 2381 | 182, 183, 184, 185, 186, 187, 188, 189, 254, 255, |
| 2382 | 256, 257, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2383 | 700, 701, 0, 702, 0, 704, 0, 0, 0, 707, |
| 2384 | 0, 0, 0, 0, 0, 710, 0, 258, 198, 678, |
| 2385 | 679, 201, 202, 203, 204, 205, 206, 207, 208, 209, |
| 2386 | 0, 259, 0, 260, 261, 262, 0, 263, 264, 343, |
| 2387 | 344, 0, 345, 346, 0, 347, 348, 349, 0, 0, |
| 2388 | 0, 0, 0, 0, 0, 0, 0, 386, 387, 388, |
| 2389 | 389, 64, 65, 390, 0, 397, 0, 0, 398, 0, |
| 2390 | 399, 0, 400, 1, 2, 0, 3, 4, 5, 391, |
| 2391 | 392, 393, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2392 | 0, 0, 0, 0, 394, 395, 0, 0, 0, 0, |
| 2393 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, |
| 2394 | 0, 64, 65, 396, 107, 67, 68, 69, 70, 71, |
| 2395 | 72, 73, 0, 1, 2, 0, 3, 4, 5, 175, |
| 2396 | 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, |
| 2397 | 186, 187, 188, 189, 254, 255, 256, 257, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2398 | 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, |
| 2399 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2400 | 0, 0, 0, 258, 198, 199, 200, 201, 202, 203, |
| 2401 | 204, 205, 206, 207, 208, 209, 0, 259, 0, 260, |
| 2402 | 261, 262, 0, 263, 264, 0, 0, 0, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2403 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2404 | 0, 0, 0, 0, 0, 112, 0, 0, 0, 0, |
| 2405 | 0, 397, 0, 0, 398, 0, 399, 0, 400, 244, |
| 2406 | 245, 246, 247, 64, 65, 248, 0, 0, 0, 0, |
| 2407 | 0, 0, 0, 0, 0, 1, 2, 0, 3, 4, |
| 2408 | 5, 249, 250, 251, 0, 0, 0, 0, 0, 0, |
| 2409 | 0, 0, 0, 0, 0, 0, 252, 253, 0, 0, |
| 2410 | 75, 76, 0, 0, 77, 0, 78, 378, 0, 0, |
| 2411 | 0, 111, 64, 65, 0, 107, 67, 68, 69, 70, |
| 2412 | 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, |
| 2413 | 0, 175, 176, 177, 178, 179, 180, 181, 182, 183, |
| 2414 | 184, 185, 186, 187, 188, 189, 254, 255, 256, 257, |
| 2415 | 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, |
Chris Lattner | ccef6b5 | 2008-09-23 21:18:31 +0000 | [diff] [blame] | 2416 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2417 | 0, 0, 0, 0, 0, 258, 198, 199, 200, 201, |
| 2418 | 202, 203, 204, 205, 206, 207, 208, 209, 0, 259, |
| 2419 | 0, 260, 261, 262, 0, 263, 264, 0, 0, 0, |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 2420 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2421 | 0, 0, 0, 0, 0, 0, 0, 112, 0, 0, |
| 2422 | 0, -61, 0, 265, 0, 0, 266, 0, 267, 0, |
| 2423 | 268, 244, 245, 246, 247, 64, 65, 248, 0, 0, |
| 2424 | 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, |
| 2425 | 3, 4, 5, 249, 250, 251, 0, 0, 0, 0, |
| 2426 | 0, 0, 0, 0, 0, 0, 0, 0, 252, 253, |
| 2427 | 0, 75, 76, 0, 0, 77, 0, 78, 465, 0, |
| 2428 | 0, 0, 0, 111, 64, 65, 0, 107, 67, 68, |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 2429 | 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2430 | 4, 5, 0, 175, 176, 177, 178, 179, 180, 181, |
| 2431 | 182, 183, 184, 185, 186, 187, 188, 189, 254, 255, |
| 2432 | 256, 257, 0, 0, 0, 0, 0, 74, 0, 0, |
| 2433 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2434 | 0, 0, 0, 0, 0, 0, 0, 258, 198, 199, |
| 2435 | 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, |
| 2436 | 0, 259, 0, 260, 261, 262, 0, 263, 264, 0, |
| 2437 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2438 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, |
| 2439 | 0, 0, 0, 0, 0, 265, 0, 0, 266, 0, |
| 2440 | 267, 0, 268, 386, 387, 388, 389, 64, 65, 390, |
| 2441 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, |
| 2442 | 2, 0, 3, 4, 5, 391, 392, 393, 0, 0, |
| 2443 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2444 | 394, 395, -219, 75, 76, 0, 0, 77, 0, 78, |
| 2445 | 482, 0, 0, 0, 0, 0, 0, 0, 0, 396, |
| 2446 | -63, 1, 2, 0, 3, 4, 5, 0, 0, 0, |
| 2447 | 0, 0, 6, 7, 0, 175, 176, 177, 178, 179, |
| 2448 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
| 2449 | 254, 255, 256, 257, 8, 0, 0, 0, 9, 0, |
| 2450 | 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, |
| 2451 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 258, |
| 2452 | 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, |
| 2453 | 208, 209, 0, 259, 0, 260, 261, 262, 0, 263, |
| 2454 | 264, 386, 387, 388, 389, 0, 0, 390, 0, 0, |
| 2455 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2456 | 0, 0, 0, 391, 392, 393, 0, 397, 0, 0, |
| 2457 | 398, 0, 399, 0, 400, 0, 0, 0, 394, 395, |
| 2458 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2459 | 0, 0, 0, 0, 0, 64, 65, 396, 107, 67, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2460 | 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2461 | 3, 4, 5, 175, 176, 177, 178, 179, 180, 181, |
| 2462 | 182, 183, 184, 185, 186, 187, 188, 189, 254, 255, |
| 2463 | 256, 257, 0, 0, 0, 0, 64, 65, 74, 153, |
| 2464 | 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, |
| 2465 | 0, 3, 4, 5, 0, 0, 0, 258, 198, 199, |
| 2466 | 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, |
| 2467 | 0, 259, 0, 260, 261, 262, 0, 263, 264, 74, |
| 2468 | 0, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
| 2469 | 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, |
| 2470 | 0, 0, 0, 0, 0, 397, 0, 0, 398, 0, |
| 2471 | 399, 0, 400, 137, 0, 0, 0, 0, 0, 0, |
| 2472 | 0, 0, 0, 0, 74, 64, 65, 0, 153, 67, |
| 2473 | 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, |
| 2474 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
| 2475 | 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, |
| 2476 | 78, 544, 0, 0, 0, 0, 0, 0, 74, 0, |
| 2477 | 275, 276, 0, 277, 64, 65, 278, 107, 67, 68, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2478 | 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2479 | 4, 5, 0, 0, 0, 75, 76, 0, 0, 77, |
| 2480 | 0, 78, 0, 0, 0, 0, 351, 0, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2481 | 0, 0, 0, 0, 0, 64, 65, 74, 107, 67, |
| 2482 | 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, |
| 2483 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2484 | 75, 76, 0, 154, 77, 0, 78, 0, 0, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2485 | 0, 0, 0, 0, 0, 0, 64, 65, 74, 107, |
| 2486 | 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2487 | 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, |
| 2488 | 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, |
| 2489 | 78, 0, 0, 0, 0, 0, 0, 64, 65, 74, |
| 2490 | 107, 67, 68, 69, 70, 71, 72, 73, 0, 1, |
| 2491 | 2, 0, 3, 4, 5, 64, 65, 0, 107, 67, |
| 2492 | 68, 69, 70, 71, 72, 73, 0, 1, 2, 538, |
| 2493 | 3, 4, 5, 75, 76, 0, 0, 77, 0, 78, |
| 2494 | 74, 0, 0, 0, 0, 0, 0, 632, 0, 0, |
| 2495 | 0, 0, 0, 0, 0, 0, 64, 65, 74, 66, |
| 2496 | 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, |
| 2497 | 0, 3, 4, 5, 75, 76, 0, 373, 77, 0, |
| 2498 | 78, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
| 2499 | 72, 73, 0, 1, 2, 0, 3, 4, 5, 74, |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 2500 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2501 | 0, 0, 0, 0, 0, 75, 76, 0, 478, 77, |
| 2502 | 0, 78, 64, 65, 74, 282, 67, 68, 69, 70, |
| 2503 | 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, |
| 2504 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2505 | 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, |
| 2506 | 77, 0, 78, 0, 0, 74, 0, 0, 0, 0, |
| 2507 | 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, |
| 2508 | 78, 64, 65, 0, 107, 67, 68, 69, 70, 71, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2509 | 72, 73, 0, 1, 2, 0, 3, 4, 5, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2510 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2511 | 0, 0, 0, 0, 0, 75, 76, 0, 0, 77, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2512 | 0, 78, 64, 65, 74, 107, 67, 68, 69, 70, |
| 2513 | 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, |
| 2514 | 75, 76, 0, 0, 77, 0, 78, 64, 65, 0, |
| 2515 | 107, 67, 68, 69, 70, 71, 72, 639, 0, 1, |
| 2516 | 2, 0, 3, 4, 5, 74, 0, 0, 0, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2517 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2518 | 0, 75, 76, 0, 0, 77, 0, 78, 64, 65, |
| 2519 | 74, 107, 67, 68, 69, 70, 71, 72, 683, 0, |
| 2520 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2521 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2522 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2523 | 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2524 | 75, 76, 0, 0, 77, 0, 376, 0, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2525 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2526 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2527 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2528 | 166, 75, 76, 0, 0, 77, 0, 480, 0, 0, |
| 2529 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2530 | 0, 167, 168, 0, 0, 0, 75, 76, 0, 0, |
| 2531 | 77, 0, 78, 169, 170, 171, 172, 173, 174, 175, |
| 2532 | 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, |
| 2533 | 186, 187, 188, 189, 190, 191, 192, 193, 0, 0, |
| 2534 | 0, 0, 0, 0, 0, 0, 0, 75, 76, 0, |
| 2535 | 0, 77, 0, 78, 0, 0, 0, 0, 194, 195, |
| 2536 | 196, 0, 0, 197, 198, 199, 200, 201, 202, 203, |
| 2537 | 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, |
| 2538 | 214, 215, 216, 217, 218 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2539 | }; |
| 2540 | |
| 2541 | static const yytype_int16 yycheck[] = |
| 2542 | { |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2543 | 0, 27, 158, 239, 196, 321, 4, 121, 0, 11, |
| 2544 | 461, 161, 28, 55, 11, 55, 55, 17, 55, 211, |
| 2545 | 212, 213, 214, 215, 172, 17, 266, 267, 11, 221, |
| 2546 | 21, 55, 55, 159, 192, 289, 55, 151, 29, 11, |
| 2547 | 34, 659, 55, 55, 164, 55, 164, 7, 156, 0, |
| 2548 | 158, 171, 78, 7, 8, 173, 449, 450, 676, 19, |
| 2549 | 54, 193, 22, 53, 24, 19, 20, 164, 22, 23, |
| 2550 | 24, 54, 41, 42, 171, 223, 102, 163, 68, 48, |
| 2551 | 106, 164, 54, 337, 20, 54, 112, 23, 164, 11, |
| 2552 | 173, 164, 118, 93, 164, 17, 254, 173, 256, 169, |
| 2553 | 173, 32, 33, 539, 42, 43, 44, 45, 46, 47, |
| 2554 | 48, 49, 59, 51, 240, 241, 142, 143, 163, 161, |
| 2555 | 146, 161, 161, 255, 161, 257, 152, 167, 165, 171, |
| 2556 | 169, 158, 159, 160, 585, 161, 376, 161, 161, 162, |
| 2557 | 164, 165, 161, 169, 537, 164, 165, 339, 161, 161, |
| 2558 | 162, 161, 165, 164, 18, 164, 172, 397, 398, 399, |
| 2559 | 169, 164, 173, 46, 615, 48, 169, 169, 194, 195, |
| 2560 | 196, 197, 169, 22, 172, 283, 117, 118, 286, 287, |
| 2561 | 288, 35, 173, 37, 210, 211, 212, 213, 214, 215, |
| 2562 | 216, 217, 218, 219, 220, 221, 512, 633, 42, 164, |
| 2563 | 44, 163, 163, 639, 640, 231, 163, 34, 173, 42, |
| 2564 | 43, 44, 167, 405, 47, 323, 242, 162, 21, 164, |
| 2565 | 158, 159, 160, 331, 332, 333, 334, 335, 162, 421, |
| 2566 | 164, 423, 424, 425, 162, 162, 164, 164, 22, 555, |
| 2567 | 480, 557, 132, 133, 680, 681, 22, 683, 684, 162, |
| 2568 | 22, 164, 366, 367, 368, 369, 370, 371, 372, 409, |
| 2569 | 132, 133, 132, 133, 700, 701, 161, 381, 382, 383, |
| 2570 | 4, 114, 115, 4, 300, 62, 63, 64, 65, 66, |
| 2571 | 67, 37, 432, 84, 85, 161, 168, 168, 280, 4, |
| 2572 | 165, 317, 318, 319, 163, 22, 164, 162, 171, 4, |
| 2573 | 162, 617, 410, 411, 412, 413, 161, 55, 57, 11, |
| 2574 | 466, 419, 338, 339, 141, 142, 143, 144, 171, 146, |
| 2575 | 162, 161, 161, 150, 151, 433, 153, 154, 155, 156, |
| 2576 | 157, 161, 161, 161, 22, 161, 161, 161, 452, 453, |
| 2577 | 454, 455, 161, 161, 164, 38, 4, 164, 164, 463, |
| 2578 | 376, 164, 164, 164, 164, 38, 161, 161, 466, 595, |
| 2579 | 61, 161, 161, 161, 171, 22, 558, 164, 164, 561, |
| 2580 | 562, 563, 164, 167, 164, 164, 164, 38, 164, 405, |
| 2581 | 488, 164, 164, 409, 164, 493, 164, 495, 22, 54, |
| 2582 | 498, 164, 17, 164, 164, 421, 422, 423, 424, 425, |
| 2583 | 508, 509, 164, 511, 164, 431, 432, 17, 522, 523, |
| 2584 | 524, 525, 164, 527, 164, 4, 4, 531, 532, 164, |
| 2585 | 164, 164, 164, 164, 164, 451, 164, 4, 664, 164, |
| 2586 | 22, 667, 164, 4, 164, 164, 164, 4, 164, 164, |
| 2587 | 548, 549, 162, 551, 552, 553, 554, 171, 164, 475, |
| 2588 | 171, 559, 161, 164, 480, 161, 121, 122, 54, 567, |
| 2589 | 164, 575, 576, 577, 578, 573, 162, 164, 162, 164, |
| 2590 | 162, 22, 286, 287, 288, 164, 141, 142, 169, 144, |
| 2591 | 145, 507, 147, 148, 149, 171, 167, 513, 7, 8, |
| 2592 | 162, 10, 11, 12, 13, 14, 15, 16, 17, 162, |
| 2593 | 19, 20, 610, 22, 23, 24, 162, 533, 622, 323, |
| 2594 | 624, 625, 38, 162, 17, 169, 162, 331, 332, 333, |
| 2595 | 334, 335, 162, 162, 54, 4, 152, 164, 161, 161, |
| 2596 | 22, 50, 558, 17, 164, 561, 562, 563, 73, 655, |
| 2597 | 17, 19, 17, 17, 22, 93, 24, 634, 112, 231, |
| 2598 | 658, 106, 242, 17, 662, 663, 90, 7, 8, 57, |
| 2599 | 10, 11, 12, 13, 14, 15, 16, 17, 594, 19, |
| 2600 | 20, 133, 22, 23, 24, 601, 54, 456, 616, 133, |
| 2601 | -1, -1, -1, -1, -1, -1, 694, 695, -1, 697, |
| 2602 | 616, 699, -1, 593, -1, 703, 410, 411, 412, 413, |
| 2603 | 50, 709, -1, -1, -1, 419, -1, -1, -1, -1, |
| 2604 | -1, -1, -1, -1, -1, 141, 142, 143, 144, 433, |
| 2605 | 146, -1, -1, -1, 150, 151, -1, 153, 154, 155, |
| 2606 | 156, 157, -1, -1, -1, -1, -1, -1, -1, 665, |
| 2607 | -1, -1, -1, 121, 122, -1, -1, 166, 167, -1, |
| 2608 | -1, 170, -1, 172, 173, 655, -1, -1, -1, -1, |
| 2609 | -1, -1, -1, 141, 142, -1, 144, 145, -1, 147, |
| 2610 | 148, 149, -1, -1, 488, -1, -1, -1, -1, 493, |
| 2611 | -1, 495, -1, -1, 498, -1, 26, 27, -1, -1, |
| 2612 | -1, -1, -1, -1, 508, 509, -1, 511, 141, 142, |
| 2613 | 143, 144, -1, 146, -1, -1, -1, 150, 151, -1, |
| 2614 | 153, 154, 155, 156, 157, -1, 166, 167, -1, -1, |
| 2615 | 170, -1, 172, 173, 94, 95, 96, 97, 98, 99, |
| 2616 | 100, 101, 102, 103, 548, 549, -1, 551, 552, 553, |
| 2617 | 554, -1, -1, -1, -1, 559, -1, -1, -1, -1, |
| 2618 | -1, -1, -1, 567, -1, -1, -1, -1, -1, 573, |
| 2619 | 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 2620 | 110, 111, 112, 113, -1, -1, -1, -1, -1, -1, |
| 2621 | -1, 3, 4, 5, 6, 7, 8, 9, -1, -1, |
| 2622 | 0, -1, -1, -1, -1, -1, 610, 19, 20, -1, |
| 2623 | 22, 23, 24, 25, 26, 27, -1, -1, 18, 19, |
| 2624 | 20, -1, 22, 23, 24, -1, -1, -1, 40, 41, |
| 2625 | 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2626 | -1, -1, 54, -1, -1, -1, -1, 59, -1, -1, |
| 2627 | -1, -1, 52, -1, 658, -1, 56, -1, 662, 663, |
| 2628 | 60, -1, -1, 75, 76, 77, 78, 79, 80, 81, |
| 2629 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2630 | 92, 93, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2631 | 694, 695, -1, 697, -1, 699, -1, -1, -1, 703, |
| 2632 | -1, -1, -1, -1, -1, 709, -1, 119, 120, 121, |
| 2633 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, |
| 2634 | -1, 133, -1, 135, 136, 137, -1, 139, 140, 141, |
| 2635 | 142, -1, 144, 145, -1, 147, 148, 149, -1, -1, |
| 2636 | -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, |
| 2637 | 6, 7, 8, 9, -1, 167, -1, -1, 170, -1, |
| 2638 | 172, -1, 174, 19, 20, -1, 22, 23, 24, 25, |
| 2639 | 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2640 | -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, |
| 2641 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, |
| 2642 | -1, 7, 8, 59, 10, 11, 12, 13, 14, 15, |
| 2643 | 16, 17, -1, 19, 20, -1, 22, 23, 24, 75, |
| 2644 | 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, |
| 2645 | 86, 87, 88, 89, 90, 91, 92, 93, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2646 | -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, |
| 2647 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2648 | -1, -1, -1, 119, 120, 121, 122, 123, 124, 125, |
| 2649 | 126, 127, 128, 129, 130, 131, -1, 133, -1, 135, |
| 2650 | 136, 137, -1, 139, 140, -1, -1, -1, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2651 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2652 | -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, |
| 2653 | -1, 167, -1, -1, 170, -1, 172, -1, 174, 3, |
| 2654 | 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, |
| 2655 | -1, -1, -1, -1, -1, 19, 20, -1, 22, 23, |
| 2656 | 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, |
| 2657 | -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2658 | 166, 167, -1, -1, 170, -1, 172, 173, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2659 | -1, 55, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2660 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2661 | -1, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2662 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2663 | -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2664 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2665 | -1, -1, -1, -1, -1, 119, 120, 121, 122, 123, |
| 2666 | 124, 125, 126, 127, 128, 129, 130, 131, -1, 133, |
| 2667 | -1, 135, 136, 137, -1, 139, 140, -1, -1, -1, |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 2668 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2669 | -1, -1, -1, -1, -1, -1, -1, 161, -1, -1, |
| 2670 | -1, 165, -1, 167, -1, -1, 170, -1, 172, -1, |
| 2671 | 174, 3, 4, 5, 6, 7, 8, 9, -1, -1, |
| 2672 | -1, -1, -1, -1, -1, -1, -1, 19, 20, -1, |
| 2673 | 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, |
| 2674 | -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, |
| 2675 | -1, 166, 167, -1, -1, 170, -1, 172, 173, -1, |
| 2676 | -1, -1, -1, 55, 7, 8, -1, 10, 11, 12, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2677 | 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2678 | 23, 24, -1, 75, 76, 77, 78, 79, 80, 81, |
| 2679 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2680 | 92, 93, -1, -1, -1, -1, -1, 50, -1, -1, |
| 2681 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2682 | -1, -1, -1, -1, -1, -1, -1, 119, 120, 121, |
| 2683 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, |
| 2684 | -1, 133, -1, 135, 136, 137, -1, 139, 140, -1, |
| 2685 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2686 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, |
| 2687 | -1, -1, -1, -1, -1, 167, -1, -1, 170, -1, |
| 2688 | 172, -1, 174, 3, 4, 5, 6, 7, 8, 9, |
| 2689 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, |
| 2690 | 20, -1, 22, 23, 24, 25, 26, 27, -1, -1, |
| 2691 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2692 | 40, 41, 0, 166, 167, -1, -1, 170, -1, 172, |
| 2693 | 173, -1, -1, -1, -1, -1, -1, -1, -1, 59, |
| 2694 | 18, 19, 20, -1, 22, 23, 24, -1, -1, -1, |
| 2695 | -1, -1, 30, 31, -1, 75, 76, 77, 78, 79, |
| 2696 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2697 | 90, 91, 92, 93, 52, -1, -1, -1, 56, -1, |
| 2698 | -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, |
| 2699 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, |
| 2700 | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, |
| 2701 | 130, 131, -1, 133, -1, 135, 136, 137, -1, 139, |
| 2702 | 140, 3, 4, 5, 6, -1, -1, 9, -1, -1, |
| 2703 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2704 | -1, -1, -1, 25, 26, 27, -1, 167, -1, -1, |
| 2705 | 170, -1, 172, -1, 174, -1, -1, -1, 40, 41, |
| 2706 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2707 | -1, -1, -1, -1, -1, 7, 8, 59, 10, 11, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2708 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2709 | 22, 23, 24, 75, 76, 77, 78, 79, 80, 81, |
| 2710 | 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, |
| 2711 | 92, 93, -1, -1, -1, -1, 7, 8, 50, 10, |
| 2712 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
| 2713 | -1, 22, 23, 24, -1, -1, -1, 119, 120, 121, |
| 2714 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, |
| 2715 | -1, 133, -1, 135, 136, 137, -1, 139, 140, 50, |
| 2716 | -1, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2717 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
| 2718 | -1, -1, -1, -1, -1, 167, -1, -1, 170, -1, |
| 2719 | 172, -1, 174, 39, -1, -1, -1, -1, -1, -1, |
| 2720 | -1, -1, -1, -1, 50, 7, 8, -1, 10, 11, |
| 2721 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2722 | 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2723 | -1, -1, -1, -1, 166, 167, -1, -1, 170, -1, |
| 2724 | 172, 173, -1, -1, -1, -1, -1, -1, 50, -1, |
| 2725 | 141, 142, -1, 144, 7, 8, 147, 10, 11, 12, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2726 | 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2727 | 23, 24, -1, -1, -1, 166, 167, -1, -1, 170, |
| 2728 | -1, 172, -1, -1, -1, -1, 39, -1, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2729 | -1, -1, -1, -1, -1, 7, 8, 50, 10, 11, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2730 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2731 | 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2732 | 166, 167, -1, 125, 170, -1, 172, -1, -1, -1, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2733 | -1, -1, -1, -1, -1, -1, 7, 8, 50, 10, |
| 2734 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2735 | -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, |
| 2736 | -1, -1, -1, -1, 166, 167, -1, -1, 170, -1, |
| 2737 | 172, -1, -1, -1, -1, -1, -1, 7, 8, 50, |
| 2738 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2739 | 20, -1, 22, 23, 24, 7, 8, -1, 10, 11, |
| 2740 | 12, 13, 14, 15, 16, 17, -1, 19, 20, 39, |
| 2741 | 22, 23, 24, 166, 167, -1, -1, 170, -1, 172, |
| 2742 | 50, -1, -1, -1, -1, -1, -1, 39, -1, -1, |
| 2743 | -1, -1, -1, -1, -1, -1, 7, 8, 50, 10, |
| 2744 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
| 2745 | -1, 22, 23, 24, 166, 167, -1, 169, 170, -1, |
| 2746 | 172, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2747 | 16, 17, -1, 19, 20, -1, 22, 23, 24, 50, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2748 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2749 | -1, -1, -1, -1, -1, 166, 167, -1, 169, 170, |
| 2750 | -1, 172, 7, 8, 50, 10, 11, 12, 13, 14, |
| 2751 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2752 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2753 | -1, -1, -1, -1, -1, -1, 166, 167, -1, -1, |
| 2754 | 170, -1, 172, -1, -1, 50, -1, -1, -1, -1, |
| 2755 | -1, -1, -1, -1, 166, 167, -1, -1, 170, -1, |
| 2756 | 172, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2757 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2758 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2759 | -1, -1, -1, -1, -1, 166, 167, -1, -1, 170, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2760 | -1, 172, 7, 8, 50, 10, 11, 12, 13, 14, |
| 2761 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2762 | 166, 167, -1, -1, 170, -1, 172, 7, 8, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2763 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2764 | 20, -1, 22, 23, 24, 50, -1, -1, -1, -1, |
| 2765 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2766 | -1, 166, 167, -1, -1, 170, -1, 172, 7, 8, |
| 2767 | 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2768 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2769 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2770 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2771 | -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2772 | 166, 167, -1, -1, 170, -1, 172, -1, -1, -1, |
| 2773 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2774 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2775 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2776 | 36, 166, 167, -1, -1, 170, -1, 172, -1, -1, |
| 2777 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2778 | -1, 57, 58, -1, -1, -1, 166, 167, -1, -1, |
| 2779 | 170, -1, 172, 69, 70, 71, 72, 73, 74, 75, |
| 2780 | 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, |
| 2781 | 86, 87, 88, 89, 90, 91, 92, 93, -1, -1, |
| 2782 | -1, -1, -1, -1, -1, -1, -1, 166, 167, -1, |
| 2783 | -1, 170, -1, 172, -1, -1, -1, -1, 114, 115, |
| 2784 | 116, -1, -1, 119, 120, 121, 122, 123, 124, 125, |
| 2785 | 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, |
| 2786 | 136, 137, 138, 139, 140 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2787 | }; |
| 2788 | |
| 2789 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2790 | symbol of state STATE-NUM. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 2791 | static const yytype_uint16 yystos[] = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2792 | { |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2793 | 0, 19, 20, 22, 23, 24, 30, 31, 52, 56, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2794 | 60, 181, 184, 186, 187, 188, 222, 223, 224, 226, |
| 2795 | 225, 53, 68, 231, 163, 59, 163, 18, 163, 42, |
| 2796 | 43, 44, 45, 46, 47, 48, 49, 51, 158, 159, |
| 2797 | 160, 189, 190, 191, 0, 224, 46, 48, 192, 241, |
| 2798 | 42, 43, 44, 47, 193, 238, 240, 248, 163, 163, |
| 2799 | 167, 232, 22, 230, 7, 8, 10, 11, 12, 13, |
| 2800 | 14, 15, 16, 17, 50, 166, 167, 170, 172, 181, |
| 2801 | 186, 209, 210, 244, 191, 191, 35, 37, 220, 191, |
| 2802 | 191, 21, 249, 250, 29, 173, 239, 249, 22, 22, |
| 2803 | 22, 233, 161, 4, 4, 4, 172, 10, 173, 210, |
| 2804 | 215, 55, 161, 183, 220, 220, 42, 44, 194, 32, |
| 2805 | 33, 219, 62, 63, 64, 65, 66, 67, 195, 236, |
| 2806 | 236, 7, 184, 185, 253, 164, 169, 39, 210, 211, |
| 2807 | 213, 214, 168, 168, 173, 215, 164, 173, 161, 214, |
| 2808 | 165, 219, 219, 10, 125, 210, 212, 221, 210, 216, |
| 2809 | 4, 199, 28, 172, 237, 163, 36, 57, 58, 69, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2810 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2811 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2812 | 90, 91, 92, 93, 114, 115, 116, 119, 120, 121, |
| 2813 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2814 | 132, 133, 134, 135, 136, 137, 138, 139, 140, 176, |
| 2815 | 177, 178, 251, 258, 259, 260, 261, 251, 259, 22, |
| 2816 | 197, 164, 162, 210, 210, 171, 173, 210, 4, 162, |
| 2817 | 216, 210, 161, 244, 3, 4, 5, 6, 9, 25, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2818 | 26, 27, 40, 41, 90, 91, 92, 93, 119, 133, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2819 | 135, 136, 137, 139, 140, 167, 170, 172, 174, 176, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2820 | 177, 178, 217, 244, 183, 141, 142, 144, 147, 198, |
| 2821 | 212, 57, 10, 210, 246, 247, 11, 17, 11, 195, |
| 2822 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
| 2823 | 179, 26, 27, 100, 101, 102, 103, 104, 105, 106, |
| 2824 | 107, 108, 109, 110, 111, 112, 113, 180, 179, 180, |
| 2825 | 210, 210, 246, 210, 210, 254, 246, 246, 246, 246, |
| 2826 | 246, 210, 210, 210, 210, 210, 246, 195, 117, 118, |
| 2827 | 54, 121, 122, 141, 142, 144, 145, 147, 148, 149, |
| 2828 | 196, 39, 211, 201, 169, 171, 171, 162, 201, 183, |
| 2829 | 183, 221, 179, 180, 179, 180, 161, 161, 161, 161, |
| 2830 | 161, 161, 161, 169, 216, 218, 172, 218, 173, 218, |
| 2831 | 22, 161, 161, 161, 227, 186, 3, 4, 5, 6, |
| 2832 | 9, 25, 26, 27, 40, 41, 59, 167, 170, 172, |
| 2833 | 174, 217, 243, 244, 245, 164, 245, 245, 245, 199, |
| 2834 | 210, 210, 210, 210, 164, 204, 164, 204, 245, 167, |
| 2835 | 164, 164, 164, 164, 164, 164, 245, 245, 245, 245, |
| 2836 | 245, 38, 199, 210, 246, 4, 141, 142, 143, 144, |
| 2837 | 146, 150, 151, 153, 154, 155, 156, 157, 200, 228, |
| 2838 | 229, 38, 161, 161, 161, 161, 216, 216, 216, 216, |
| 2839 | 216, 216, 216, 164, 169, 173, 210, 218, 171, 173, |
| 2840 | 216, 216, 216, 164, 207, 161, 61, 242, 169, 218, |
| 2841 | 172, 218, 173, 218, 22, 246, 164, 164, 212, 245, |
| 2842 | 245, 245, 245, 11, 54, 11, 256, 245, 167, 246, |
| 2843 | 210, 246, 246, 246, 164, 164, 257, 164, 164, 164, |
| 2844 | 210, 212, 245, 164, 207, 207, 210, 216, 216, 216, |
| 2845 | 216, 256, 164, 164, 164, 164, 257, 164, 216, 171, |
| 2846 | 173, 164, 164, 38, 34, 54, 205, 208, 39, 210, |
| 2847 | 234, 235, 22, 169, 173, 218, 171, 173, 17, 17, |
| 2848 | 245, 164, 164, 164, 164, 245, 4, 245, 164, 164, |
| 2849 | 245, 164, 164, 164, 4, 4, 164, 210, 245, 245, |
| 2850 | 245, 164, 204, 210, 162, 164, 164, 164, 164, 162, |
| 2851 | 216, 216, 216, 216, 162, 216, 171, 216, 216, 210, |
| 2852 | 22, 4, 207, 197, 164, 162, 164, 171, 173, 245, |
| 2853 | 245, 161, 245, 245, 245, 245, 204, 204, 246, 245, |
| 2854 | 164, 246, 246, 246, 4, 245, 161, 245, 216, 216, |
| 2855 | 216, 216, 164, 162, 164, 164, 257, 162, 162, 162, |
| 2856 | 181, 182, 39, 210, 201, 22, 171, 164, 167, 17, |
| 2857 | 210, 255, 169, 245, 257, 255, 204, 162, 162, 162, |
| 2858 | 162, 216, 216, 216, 162, 197, 205, 206, 17, 11, |
| 2859 | 169, 252, 197, 197, 162, 164, 169, 162, 162, 162, |
| 2860 | 162, 182, 54, 203, 245, 243, 11, 169, 121, 122, |
| 2861 | 245, 245, 201, 17, 210, 201, 4, 152, 202, 164, |
| 2862 | 243, 197, 197, 38, 197, 197, 22, 17, 164, 17, |
| 2863 | 245, 245, 245, 17, 245, 197, 197, 245, 73, 17, |
| 2864 | 245 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2865 | }; |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2866 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2867 | #define yyerrok (yyerrstatus = 0) |
| 2868 | #define yyclearin (yychar = YYEMPTY) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2869 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2870 | #define YYEOF 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2871 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2872 | #define YYACCEPT goto yyacceptlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2873 | #define YYABORT goto yyabortlab |
| 2874 | #define YYERROR goto yyerrorlab |
| 2875 | |
| 2876 | |
| 2877 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2878 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2879 | Once GCC version 2 has supplanted version 1, this can go. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2880 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2881 | #define YYFAIL goto yyerrlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2882 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2883 | #define YYRECOVERING() (!!yyerrstatus) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2884 | |
| 2885 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2886 | do \ |
| 2887 | if (yychar == YYEMPTY && yylen == 1) \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2888 | { \ |
| 2889 | yychar = (Token); \ |
| 2890 | yylval = (Value); \ |
| 2891 | yytoken = YYTRANSLATE (yychar); \ |
| 2892 | YYPOPSTACK (1); \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2893 | goto yybackup; \ |
| 2894 | } \ |
| 2895 | else \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2896 | { \ |
| 2897 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2898 | YYERROR; \ |
| 2899 | } \ |
| 2900 | while (YYID (0)) |
| 2901 | |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2902 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2903 | #define YYTERROR 1 |
| 2904 | #define YYERRCODE 256 |
| 2905 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2906 | |
| 2907 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2908 | If N is 0, then set CURRENT to the empty location which ends |
| 2909 | the previous symbol: RHS[0] (always defined). */ |
| 2910 | |
| 2911 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2912 | #ifndef YYLLOC_DEFAULT |
| 2913 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2914 | do \ |
| 2915 | if (YYID (N)) \ |
| 2916 | { \ |
| 2917 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2918 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2919 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2920 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2921 | } \ |
| 2922 | else \ |
| 2923 | { \ |
| 2924 | (Current).first_line = (Current).last_line = \ |
| 2925 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2926 | (Current).first_column = (Current).last_column = \ |
| 2927 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2928 | } \ |
| 2929 | while (YYID (0)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2930 | #endif |
| 2931 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2932 | |
| 2933 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2934 | This macro was not mandated originally: define only if we know |
| 2935 | we won't break user code: when these are the locations we know. */ |
| 2936 | |
| 2937 | #ifndef YY_LOCATION_PRINT |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 2938 | # if YYLTYPE_IS_TRIVIAL |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2939 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2940 | fprintf (File, "%d.%d-%d.%d", \ |
| 2941 | (Loc).first_line, (Loc).first_column, \ |
| 2942 | (Loc).last_line, (Loc).last_column) |
| 2943 | # else |
| 2944 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2945 | # endif |
| 2946 | #endif |
| 2947 | |
| 2948 | |
| 2949 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2950 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2951 | #ifdef YYLEX_PARAM |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2952 | # define YYLEX yylex (YYLEX_PARAM) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2953 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2954 | # define YYLEX yylex () |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2955 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2956 | |
| 2957 | /* Enable debugging if requested. */ |
| 2958 | #if YYDEBUG |
| 2959 | |
| 2960 | # ifndef YYFPRINTF |
| 2961 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2962 | # define YYFPRINTF fprintf |
| 2963 | # endif |
| 2964 | |
| 2965 | # define YYDPRINTF(Args) \ |
| 2966 | do { \ |
| 2967 | if (yydebug) \ |
| 2968 | YYFPRINTF Args; \ |
| 2969 | } while (YYID (0)) |
| 2970 | |
| 2971 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2972 | do { \ |
| 2973 | if (yydebug) \ |
| 2974 | { \ |
| 2975 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2976 | yy_symbol_print (stderr, \ |
| 2977 | Type, Value); \ |
| 2978 | YYFPRINTF (stderr, "\n"); \ |
| 2979 | } \ |
| 2980 | } while (YYID (0)) |
| 2981 | |
| 2982 | |
| 2983 | /*--------------------------------. |
| 2984 | | Print this symbol on YYOUTPUT. | |
| 2985 | `--------------------------------*/ |
| 2986 | |
| 2987 | /*ARGSUSED*/ |
| 2988 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2989 | || defined __cplusplus || defined _MSC_VER) |
| 2990 | static void |
| 2991 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2992 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2993 | static void |
| 2994 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 2995 | FILE *yyoutput; |
| 2996 | int yytype; |
| 2997 | YYSTYPE const * const yyvaluep; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2998 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2999 | { |
| 3000 | if (!yyvaluep) |
| 3001 | return; |
| 3002 | # ifdef YYPRINT |
| 3003 | if (yytype < YYNTOKENS) |
| 3004 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 3005 | # else |
| 3006 | YYUSE (yyoutput); |
| 3007 | # endif |
| 3008 | switch (yytype) |
| 3009 | { |
| 3010 | default: |
| 3011 | break; |
| 3012 | } |
| 3013 | } |
| 3014 | |
| 3015 | |
| 3016 | /*--------------------------------. |
| 3017 | | Print this symbol on YYOUTPUT. | |
| 3018 | `--------------------------------*/ |
| 3019 | |
| 3020 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3021 | || defined __cplusplus || defined _MSC_VER) |
| 3022 | static void |
| 3023 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 3024 | #else |
| 3025 | static void |
| 3026 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 3027 | FILE *yyoutput; |
| 3028 | int yytype; |
| 3029 | YYSTYPE const * const yyvaluep; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3030 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3031 | { |
| 3032 | if (yytype < YYNTOKENS) |
| 3033 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 3034 | else |
| 3035 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3036 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3037 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 3038 | YYFPRINTF (yyoutput, ")"); |
| 3039 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3040 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3041 | /*------------------------------------------------------------------. |
| 3042 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 3043 | | TOP (included). | |
| 3044 | `------------------------------------------------------------------*/ |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3045 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3046 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3047 | || defined __cplusplus || defined _MSC_VER) |
| 3048 | static void |
| 3049 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
| 3050 | #else |
| 3051 | static void |
| 3052 | yy_stack_print (bottom, top) |
| 3053 | yytype_int16 *bottom; |
| 3054 | yytype_int16 *top; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3055 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3056 | { |
| 3057 | YYFPRINTF (stderr, "Stack now"); |
| 3058 | for (; bottom <= top; ++bottom) |
| 3059 | YYFPRINTF (stderr, " %d", *bottom); |
| 3060 | YYFPRINTF (stderr, "\n"); |
| 3061 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3062 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3063 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 3064 | do { \ |
| 3065 | if (yydebug) \ |
| 3066 | yy_stack_print ((Bottom), (Top)); \ |
| 3067 | } while (YYID (0)) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3068 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3069 | |
| 3070 | /*------------------------------------------------. |
| 3071 | | Report that the YYRULE is going to be reduced. | |
| 3072 | `------------------------------------------------*/ |
| 3073 | |
| 3074 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3075 | || defined __cplusplus || defined _MSC_VER) |
| 3076 | static void |
| 3077 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 3078 | #else |
| 3079 | static void |
| 3080 | yy_reduce_print (yyvsp, yyrule) |
| 3081 | YYSTYPE *yyvsp; |
| 3082 | int yyrule; |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 3083 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3084 | { |
| 3085 | int yynrhs = yyr2[yyrule]; |
| 3086 | int yyi; |
| 3087 | unsigned long int yylno = yyrline[yyrule]; |
| 3088 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 3089 | yyrule - 1, yylno); |
| 3090 | /* The symbols being reduced. */ |
| 3091 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 3092 | { |
| 3093 | fprintf (stderr, " $%d = ", yyi + 1); |
| 3094 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 3095 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 3096 | ); |
| 3097 | fprintf (stderr, "\n"); |
| 3098 | } |
| 3099 | } |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3100 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3101 | # define YY_REDUCE_PRINT(Rule) \ |
| 3102 | do { \ |
| 3103 | if (yydebug) \ |
| 3104 | yy_reduce_print (yyvsp, Rule); \ |
| 3105 | } while (YYID (0)) |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3106 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3107 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 3108 | multiple parsers can coexist. */ |
| 3109 | int yydebug; |
| 3110 | #else /* !YYDEBUG */ |
| 3111 | # define YYDPRINTF(Args) |
| 3112 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 3113 | # define YY_STACK_PRINT(Bottom, Top) |
| 3114 | # define YY_REDUCE_PRINT(Rule) |
| 3115 | #endif /* !YYDEBUG */ |
| 3116 | |
| 3117 | |
| 3118 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3119 | #ifndef YYINITDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3120 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3121 | #endif |
| 3122 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3123 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 3124 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3125 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3126 | Do not make this value too large; the results are undefined if |
| 3127 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 3128 | evaluated with infinite-precision integer arithmetic. */ |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 3129 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3130 | #ifndef YYMAXDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3131 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3132 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3133 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3134 | |
| 3135 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3136 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3137 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3138 | # ifndef yystrlen |
| 3139 | # if defined __GLIBC__ && defined _STRING_H |
| 3140 | # define yystrlen strlen |
| 3141 | # else |
| 3142 | /* Return the length of YYSTR. */ |
| 3143 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3144 | || defined __cplusplus || defined _MSC_VER) |
| 3145 | static YYSIZE_T |
| 3146 | yystrlen (const char *yystr) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3147 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3148 | static YYSIZE_T |
| 3149 | yystrlen (yystr) |
| 3150 | const char *yystr; |
| 3151 | #endif |
| 3152 | { |
| 3153 | YYSIZE_T yylen; |
| 3154 | for (yylen = 0; yystr[yylen]; yylen++) |
| 3155 | continue; |
| 3156 | return yylen; |
| 3157 | } |
| 3158 | # endif |
| 3159 | # endif |
| 3160 | |
| 3161 | # ifndef yystpcpy |
| 3162 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 3163 | # define yystpcpy stpcpy |
| 3164 | # else |
| 3165 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 3166 | YYDEST. */ |
| 3167 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3168 | || defined __cplusplus || defined _MSC_VER) |
| 3169 | static char * |
| 3170 | yystpcpy (char *yydest, const char *yysrc) |
| 3171 | #else |
| 3172 | static char * |
| 3173 | yystpcpy (yydest, yysrc) |
| 3174 | char *yydest; |
| 3175 | const char *yysrc; |
| 3176 | #endif |
| 3177 | { |
| 3178 | char *yyd = yydest; |
| 3179 | const char *yys = yysrc; |
| 3180 | |
| 3181 | while ((*yyd++ = *yys++) != '\0') |
| 3182 | continue; |
| 3183 | |
| 3184 | return yyd - 1; |
| 3185 | } |
| 3186 | # endif |
| 3187 | # endif |
| 3188 | |
| 3189 | # ifndef yytnamerr |
| 3190 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 3191 | quotes and backslashes, so that it's suitable for yyerror. The |
| 3192 | heuristic is that double-quoting is unnecessary unless the string |
| 3193 | contains an apostrophe, a comma, or backslash (other than |
| 3194 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 3195 | null, do not copy; instead, return the length of what the result |
| 3196 | would have been. */ |
| 3197 | static YYSIZE_T |
| 3198 | yytnamerr (char *yyres, const char *yystr) |
| 3199 | { |
| 3200 | if (*yystr == '"') |
| 3201 | { |
| 3202 | YYSIZE_T yyn = 0; |
| 3203 | char const *yyp = yystr; |
| 3204 | |
| 3205 | for (;;) |
| 3206 | switch (*++yyp) |
| 3207 | { |
| 3208 | case '\'': |
| 3209 | case ',': |
| 3210 | goto do_not_strip_quotes; |
| 3211 | |
| 3212 | case '\\': |
| 3213 | if (*++yyp != '\\') |
| 3214 | goto do_not_strip_quotes; |
| 3215 | /* Fall through. */ |
| 3216 | default: |
| 3217 | if (yyres) |
| 3218 | yyres[yyn] = *yyp; |
| 3219 | yyn++; |
| 3220 | break; |
| 3221 | |
| 3222 | case '"': |
| 3223 | if (yyres) |
| 3224 | yyres[yyn] = '\0'; |
| 3225 | return yyn; |
| 3226 | } |
| 3227 | do_not_strip_quotes: ; |
| 3228 | } |
| 3229 | |
| 3230 | if (! yyres) |
| 3231 | return yystrlen (yystr); |
| 3232 | |
| 3233 | return yystpcpy (yyres, yystr) - yyres; |
| 3234 | } |
| 3235 | # endif |
| 3236 | |
| 3237 | /* Copy into YYRESULT an error message about the unexpected token |
| 3238 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 3239 | including the terminating null byte. If YYRESULT is null, do not |
| 3240 | copy anything; just return the number of bytes that would be |
| 3241 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 3242 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 3243 | size calculation. */ |
| 3244 | static YYSIZE_T |
| 3245 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 3246 | { |
| 3247 | int yyn = yypact[yystate]; |
| 3248 | |
| 3249 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 3250 | return 0; |
| 3251 | else |
| 3252 | { |
| 3253 | int yytype = YYTRANSLATE (yychar); |
| 3254 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 3255 | YYSIZE_T yysize = yysize0; |
| 3256 | YYSIZE_T yysize1; |
| 3257 | int yysize_overflow = 0; |
| 3258 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 3259 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 3260 | int yyx; |
| 3261 | |
| 3262 | # if 0 |
| 3263 | /* This is so xgettext sees the translatable formats that are |
| 3264 | constructed on the fly. */ |
| 3265 | YY_("syntax error, unexpected %s"); |
| 3266 | YY_("syntax error, unexpected %s, expecting %s"); |
| 3267 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 3268 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 3269 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 3270 | # endif |
| 3271 | char *yyfmt; |
| 3272 | char const *yyf; |
| 3273 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 3274 | static char const yyexpecting[] = ", expecting %s"; |
| 3275 | static char const yyor[] = " or %s"; |
| 3276 | char yyformat[sizeof yyunexpected |
| 3277 | + sizeof yyexpecting - 1 |
| 3278 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 3279 | * (sizeof yyor - 1))]; |
| 3280 | char const *yyprefix = yyexpecting; |
| 3281 | |
| 3282 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 3283 | YYCHECK. */ |
| 3284 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 3285 | |
| 3286 | /* Stay within bounds of both yycheck and yytname. */ |
| 3287 | int yychecklim = YYLAST - yyn + 1; |
| 3288 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 3289 | int yycount = 1; |
| 3290 | |
| 3291 | yyarg[0] = yytname[yytype]; |
| 3292 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 3293 | |
| 3294 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 3295 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 3296 | { |
| 3297 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 3298 | { |
| 3299 | yycount = 1; |
| 3300 | yysize = yysize0; |
| 3301 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 3302 | break; |
| 3303 | } |
| 3304 | yyarg[yycount++] = yytname[yyx]; |
| 3305 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 3306 | yysize_overflow |= (yysize1 < yysize); |
| 3307 | yysize = yysize1; |
| 3308 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 3309 | yyprefix = yyor; |
| 3310 | } |
| 3311 | |
| 3312 | yyf = YY_(yyformat); |
| 3313 | yysize1 = yysize + yystrlen (yyf); |
| 3314 | yysize_overflow |= (yysize1 < yysize); |
| 3315 | yysize = yysize1; |
| 3316 | |
| 3317 | if (yysize_overflow) |
| 3318 | return YYSIZE_MAXIMUM; |
| 3319 | |
| 3320 | if (yyresult) |
| 3321 | { |
| 3322 | /* Avoid sprintf, as that infringes on the user's name space. |
| 3323 | Don't have undefined behavior even if the translation |
| 3324 | produced a string with the wrong number of "%s"s. */ |
| 3325 | char *yyp = yyresult; |
| 3326 | int yyi = 0; |
| 3327 | while ((*yyp = *yyf) != '\0') |
| 3328 | { |
| 3329 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 3330 | { |
| 3331 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 3332 | yyf += 2; |
| 3333 | } |
| 3334 | else |
| 3335 | { |
| 3336 | yyp++; |
| 3337 | yyf++; |
| 3338 | } |
| 3339 | } |
| 3340 | } |
| 3341 | return yysize; |
| 3342 | } |
| 3343 | } |
| 3344 | #endif /* YYERROR_VERBOSE */ |
| 3345 | |
| 3346 | |
| 3347 | /*-----------------------------------------------. |
| 3348 | | Release the memory associated to this symbol. | |
| 3349 | `-----------------------------------------------*/ |
| 3350 | |
| 3351 | /*ARGSUSED*/ |
| 3352 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3353 | || defined __cplusplus || defined _MSC_VER) |
| 3354 | static void |
| 3355 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 3356 | #else |
| 3357 | static void |
| 3358 | yydestruct (yymsg, yytype, yyvaluep) |
| 3359 | const char *yymsg; |
| 3360 | int yytype; |
| 3361 | YYSTYPE *yyvaluep; |
| 3362 | #endif |
| 3363 | { |
| 3364 | YYUSE (yyvaluep); |
| 3365 | |
| 3366 | if (!yymsg) |
| 3367 | yymsg = "Deleting"; |
| 3368 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 3369 | |
| 3370 | switch (yytype) |
| 3371 | { |
| 3372 | |
| 3373 | default: |
| 3374 | break; |
| 3375 | } |
| 3376 | } |
| 3377 | |
| 3378 | |
| 3379 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 3380 | |
| 3381 | #ifdef YYPARSE_PARAM |
| 3382 | #if defined __STDC__ || defined __cplusplus |
| 3383 | int yyparse (void *YYPARSE_PARAM); |
| 3384 | #else |
| 3385 | int yyparse (); |
| 3386 | #endif |
| 3387 | #else /* ! YYPARSE_PARAM */ |
| 3388 | #if defined __STDC__ || defined __cplusplus |
David Greene | 5fd22a8 | 2007-09-04 18:46:50 +0000 | [diff] [blame] | 3389 | int yyparse (void); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3390 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3391 | int yyparse (); |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3392 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3393 | #endif /* ! YYPARSE_PARAM */ |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3394 | |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3395 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3396 | |
| 3397 | /* The look-ahead symbol. */ |
| 3398 | int yychar; |
| 3399 | |
| 3400 | /* The semantic value of the look-ahead symbol. */ |
| 3401 | YYSTYPE yylval; |
| 3402 | |
| 3403 | /* Number of syntax errors so far. */ |
| 3404 | int yynerrs; |
| 3405 | |
| 3406 | |
| 3407 | |
| 3408 | /*----------. |
| 3409 | | yyparse. | |
| 3410 | `----------*/ |
| 3411 | |
| 3412 | #ifdef YYPARSE_PARAM |
| 3413 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3414 | || defined __cplusplus || defined _MSC_VER) |
| 3415 | int |
| 3416 | yyparse (void *YYPARSE_PARAM) |
| 3417 | #else |
| 3418 | int |
| 3419 | yyparse (YYPARSE_PARAM) |
| 3420 | void *YYPARSE_PARAM; |
| 3421 | #endif |
| 3422 | #else /* ! YYPARSE_PARAM */ |
| 3423 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3424 | || defined __cplusplus || defined _MSC_VER) |
| 3425 | int |
| 3426 | yyparse (void) |
| 3427 | #else |
| 3428 | int |
| 3429 | yyparse () |
| 3430 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3431 | #endif |
| 3432 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3433 | { |
| 3434 | |
| 3435 | int yystate; |
| 3436 | int yyn; |
| 3437 | int yyresult; |
| 3438 | /* Number of tokens to shift before error messages enabled. */ |
| 3439 | int yyerrstatus; |
| 3440 | /* Look-ahead token as an internal (translated) token number. */ |
| 3441 | int yytoken = 0; |
| 3442 | #if YYERROR_VERBOSE |
| 3443 | /* Buffer for error messages, and its allocated size. */ |
| 3444 | char yymsgbuf[128]; |
| 3445 | char *yymsg = yymsgbuf; |
| 3446 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3447 | #endif |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3448 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3449 | /* Three stacks and their tools: |
| 3450 | `yyss': related to states, |
| 3451 | `yyvs': related to semantic values, |
| 3452 | `yyls': related to locations. |
| 3453 | |
| 3454 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3455 | to reallocate them elsewhere. */ |
| 3456 | |
| 3457 | /* The state stack. */ |
| 3458 | yytype_int16 yyssa[YYINITDEPTH]; |
| 3459 | yytype_int16 *yyss = yyssa; |
| 3460 | yytype_int16 *yyssp; |
| 3461 | |
| 3462 | /* The semantic value stack. */ |
| 3463 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3464 | YYSTYPE *yyvs = yyvsa; |
| 3465 | YYSTYPE *yyvsp; |
| 3466 | |
| 3467 | |
| 3468 | |
| 3469 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 3470 | |
| 3471 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 3472 | |
| 3473 | /* The variables used to return semantic value and location from the |
| 3474 | action routines. */ |
| 3475 | YYSTYPE yyval; |
| 3476 | |
| 3477 | |
| 3478 | /* The number of symbols on the RHS of the reduced rule. |
| 3479 | Keep to zero when no symbol should be popped. */ |
| 3480 | int yylen = 0; |
| 3481 | |
| 3482 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 3483 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3484 | yystate = 0; |
| 3485 | yyerrstatus = 0; |
| 3486 | yynerrs = 0; |
| 3487 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3488 | |
| 3489 | /* Initialize stack pointers. |
| 3490 | Waste one element of value and location stack |
| 3491 | so that they stay on the same level as the state stack. |
| 3492 | The wasted elements are never initialized. */ |
| 3493 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3494 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3495 | yyvsp = yyvs; |
| 3496 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3497 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 3498 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3499 | /*------------------------------------------------------------. |
| 3500 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3501 | `------------------------------------------------------------*/ |
| 3502 | yynewstate: |
| 3503 | /* In all cases, when you get here, the value and location stacks |
| 3504 | have just been pushed. So pushing a state here evens the stacks. */ |
| 3505 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3506 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3507 | yysetstate: |
| 3508 | *yyssp = yystate; |
| 3509 | |
| 3510 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3511 | { |
| 3512 | /* Get the current used size of the three stacks, in elements. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3513 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3514 | |
| 3515 | #ifdef yyoverflow |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3516 | { |
| 3517 | /* Give user a chance to reallocate the stack. Use copies of |
| 3518 | these so that the &'s don't force the real ones into |
| 3519 | memory. */ |
| 3520 | YYSTYPE *yyvs1 = yyvs; |
| 3521 | yytype_int16 *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3522 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3523 | |
| 3524 | /* Each stack pointer address is followed by the size of the |
| 3525 | data in use in that stack, in bytes. This used to be a |
| 3526 | conditional around just the two extra args, but that might |
| 3527 | be undefined if yyoverflow is a macro. */ |
| 3528 | yyoverflow (YY_("memory exhausted"), |
| 3529 | &yyss1, yysize * sizeof (*yyssp), |
| 3530 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3531 | |
| 3532 | &yystacksize); |
| 3533 | |
| 3534 | yyss = yyss1; |
| 3535 | yyvs = yyvs1; |
| 3536 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3537 | #else /* no yyoverflow */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3538 | # ifndef YYSTACK_RELOCATE |
| 3539 | goto yyexhaustedlab; |
| 3540 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3541 | /* Extend the stack our own way. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3542 | if (YYMAXDEPTH <= yystacksize) |
| 3543 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3544 | yystacksize *= 2; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3545 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3546 | yystacksize = YYMAXDEPTH; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3547 | |
| 3548 | { |
| 3549 | yytype_int16 *yyss1 = yyss; |
| 3550 | union yyalloc *yyptr = |
| 3551 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3552 | if (! yyptr) |
| 3553 | goto yyexhaustedlab; |
| 3554 | YYSTACK_RELOCATE (yyss); |
| 3555 | YYSTACK_RELOCATE (yyvs); |
| 3556 | |
| 3557 | # undef YYSTACK_RELOCATE |
| 3558 | if (yyss1 != yyssa) |
| 3559 | YYSTACK_FREE (yyss1); |
| 3560 | } |
| 3561 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3562 | #endif /* no yyoverflow */ |
| 3563 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3564 | yyssp = yyss + yysize - 1; |
| 3565 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3566 | |
| 3567 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3568 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3569 | (unsigned long int) yystacksize)); |
| 3570 | |
| 3571 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3572 | YYABORT; |
| 3573 | } |
| 3574 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3575 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3576 | |
| 3577 | goto yybackup; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3578 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3579 | /*-----------. |
| 3580 | | yybackup. | |
| 3581 | `-----------*/ |
| 3582 | yybackup: |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3583 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3584 | /* Do appropriate processing given the current state. Read a |
| 3585 | 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] | 3586 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3587 | /* 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] | 3588 | yyn = yypact[yystate]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3589 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3590 | goto yydefault; |
| 3591 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3592 | /* 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] | 3593 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3594 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3595 | if (yychar == YYEMPTY) |
| 3596 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3597 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3598 | yychar = YYLEX; |
| 3599 | } |
| 3600 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3601 | if (yychar <= YYEOF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3602 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3603 | yychar = yytoken = YYEOF; |
| 3604 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3605 | } |
| 3606 | else |
| 3607 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3608 | yytoken = YYTRANSLATE (yychar); |
| 3609 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3610 | } |
| 3611 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3612 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3613 | detect an error, take that action. */ |
| 3614 | yyn += yytoken; |
| 3615 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3616 | goto yydefault; |
| 3617 | yyn = yytable[yyn]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3618 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3619 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3620 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3621 | goto yyerrlab; |
| 3622 | yyn = -yyn; |
| 3623 | goto yyreduce; |
| 3624 | } |
| 3625 | |
| 3626 | if (yyn == YYFINAL) |
| 3627 | YYACCEPT; |
| 3628 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3629 | /* Count tokens shifted since error; after three, turn off error |
| 3630 | status. */ |
| 3631 | if (yyerrstatus) |
| 3632 | yyerrstatus--; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 3633 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3634 | /* Shift the look-ahead token. */ |
| 3635 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3636 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3637 | /* Discard the shifted token unless it is eof. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3638 | if (yychar != YYEOF) |
| 3639 | yychar = YYEMPTY; |
| 3640 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3641 | yystate = yyn; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3642 | *++yyvsp = yylval; |
| 3643 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3644 | goto yynewstate; |
| 3645 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3646 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3647 | /*-----------------------------------------------------------. |
| 3648 | | yydefault -- do the default action for the current state. | |
| 3649 | `-----------------------------------------------------------*/ |
| 3650 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3651 | yyn = yydefact[yystate]; |
| 3652 | if (yyn == 0) |
| 3653 | goto yyerrlab; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3654 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3655 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3656 | |
| 3657 | /*-----------------------------. |
| 3658 | | yyreduce -- Do a reduction. | |
| 3659 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3660 | yyreduce: |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3661 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3662 | yylen = yyr2[yyn]; |
| 3663 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3664 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3665 | `$$ = $1'. |
| 3666 | |
| 3667 | Otherwise, the following line sets YYVAL to garbage. |
| 3668 | This behavior is undocumented and Bison |
| 3669 | users should not rely upon it. Assigning to YYVAL |
| 3670 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3671 | GCC warning that YYVAL may be used uninitialized. */ |
| 3672 | yyval = yyvsp[1-yylen]; |
| 3673 | |
| 3674 | |
| 3675 | YY_REDUCE_PRINT (yyn); |
| 3676 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3677 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3678 | case 29: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3679 | #line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3680 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3681 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3682 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3683 | case 30: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3684 | #line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3685 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3686 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3687 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3688 | case 31: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3689 | #line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3690 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3691 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3692 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3693 | case 32: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3694 | #line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3695 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3696 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3697 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3698 | case 33: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3699 | #line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3700 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3701 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3702 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3703 | case 34: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3704 | #line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3705 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3706 | break; |
| 3707 | |
| 3708 | case 35: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3709 | #line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3710 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3711 | break; |
| 3712 | |
| 3713 | case 36: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3714 | #line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3715 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3716 | break; |
| 3717 | |
| 3718 | case 37: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3719 | #line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3720 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3721 | break; |
| 3722 | |
| 3723 | case 38: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3724 | #line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3725 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3726 | break; |
| 3727 | |
| 3728 | case 39: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3729 | #line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3730 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3731 | break; |
| 3732 | |
| 3733 | case 40: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3734 | #line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3735 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3736 | break; |
| 3737 | |
| 3738 | case 41: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3739 | #line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3740 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3741 | break; |
| 3742 | |
| 3743 | case 42: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3744 | #line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3745 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3746 | break; |
| 3747 | |
| 3748 | case 43: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3749 | #line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3750 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3751 | break; |
| 3752 | |
| 3753 | case 44: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3754 | #line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3755 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3756 | break; |
| 3757 | |
| 3758 | case 45: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3759 | #line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3760 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3761 | break; |
| 3762 | |
| 3763 | case 46: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3764 | #line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3765 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3766 | break; |
| 3767 | |
| 3768 | case 47: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3769 | #line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3770 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3771 | break; |
| 3772 | |
| 3773 | case 48: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3774 | #line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3775 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3776 | break; |
| 3777 | |
| 3778 | case 49: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3779 | #line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3780 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3781 | break; |
| 3782 | |
| 3783 | case 50: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3784 | #line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3785 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3786 | break; |
| 3787 | |
| 3788 | case 51: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3789 | #line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3790 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3791 | break; |
| 3792 | |
| 3793 | case 52: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3794 | #line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3795 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3796 | break; |
| 3797 | |
| 3798 | case 53: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3799 | #line 1173 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3800 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3801 | break; |
| 3802 | |
| 3803 | case 54: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3804 | #line 1174 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3805 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3806 | break; |
| 3807 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3808 | case 59: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3809 | #line 1178 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3810 | { (yyval.StrVal) = 0; ;} |
| 3811 | break; |
| 3812 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3813 | case 60: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3814 | #line 1180 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3815 | { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} |
| 3816 | break; |
| 3817 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3818 | case 61: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3819 | #line 1181 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3820 | { (yyval.UIntVal)=0; ;} |
| 3821 | break; |
| 3822 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3823 | case 62: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3824 | #line 1185 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3825 | { |
| 3826 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3827 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3828 | ;} |
| 3829 | break; |
| 3830 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3831 | case 63: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3832 | #line 1189 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3833 | { |
| 3834 | (yyval.StrVal) = 0; |
| 3835 | CHECK_FOR_ERROR |
| 3836 | ;} |
| 3837 | break; |
| 3838 | |
| 3839 | case 64: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3840 | #line 1194 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3841 | { |
| 3842 | (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal); |
| 3843 | CHECK_FOR_ERROR |
| 3844 | ;} |
| 3845 | break; |
| 3846 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3847 | case 68: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3848 | #line 1203 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3849 | { |
| 3850 | (yyval.StrVal) = 0; |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3851 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3852 | ;} |
| 3853 | break; |
| 3854 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3855 | case 69: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3856 | #line 1208 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3857 | { |
| 3858 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3859 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3860 | ;} |
| 3861 | break; |
| 3862 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3863 | case 70: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3864 | #line 1214 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3865 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3866 | break; |
| 3867 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3868 | case 71: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3869 | #line 1215 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3870 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3871 | break; |
| 3872 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3873 | case 72: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3874 | #line 1216 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3875 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3876 | break; |
| 3877 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3878 | case 73: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3879 | #line 1217 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3880 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3881 | break; |
| 3882 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3883 | case 74: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3884 | #line 1218 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3885 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3886 | break; |
| 3887 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3888 | case 75: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3889 | #line 1219 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3890 | { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3891 | break; |
| 3892 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3893 | case 76: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3894 | #line 1223 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3895 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3896 | break; |
| 3897 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3898 | case 77: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3899 | #line 1224 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3900 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3901 | break; |
| 3902 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3903 | case 78: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3904 | #line 1225 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3905 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3906 | break; |
| 3907 | |
| 3908 | case 79: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3909 | #line 1229 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 3910 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3911 | break; |
| 3912 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3913 | case 80: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3914 | #line 1230 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3915 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3916 | break; |
| 3917 | |
| 3918 | case 81: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3919 | #line 1231 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3920 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3921 | break; |
| 3922 | |
| 3923 | case 82: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3924 | #line 1232 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3925 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
| 3926 | break; |
| 3927 | |
| 3928 | case 83: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3929 | #line 1236 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3930 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3931 | break; |
| 3932 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3933 | case 84: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3934 | #line 1237 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3935 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3936 | break; |
| 3937 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3938 | case 85: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3939 | #line 1238 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3940 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3941 | break; |
| 3942 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3943 | case 86: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3944 | #line 1242 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3945 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3946 | break; |
| 3947 | |
| 3948 | case 87: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3949 | #line 1243 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3950 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3951 | break; |
| 3952 | |
| 3953 | case 88: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3954 | #line 1244 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3955 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3956 | break; |
| 3957 | |
| 3958 | case 89: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3959 | #line 1245 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3960 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3961 | break; |
| 3962 | |
| 3963 | case 90: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3964 | #line 1246 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3965 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3966 | break; |
| 3967 | |
| 3968 | case 91: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3969 | #line 1250 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3970 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3971 | break; |
| 3972 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3973 | case 92: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3974 | #line 1251 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3975 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3976 | break; |
| 3977 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3978 | case 93: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3979 | #line 1252 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3980 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3981 | break; |
| 3982 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3983 | case 94: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3984 | #line 1255 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 3985 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3986 | break; |
| 3987 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3988 | case 95: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3989 | #line 1256 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3990 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3991 | break; |
| 3992 | |
| 3993 | case 96: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3994 | #line 1257 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3995 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3996 | break; |
| 3997 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3998 | case 97: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 3999 | #line 1258 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4000 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4001 | break; |
| 4002 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4003 | case 98: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4004 | #line 1259 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4005 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4006 | break; |
| 4007 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4008 | case 99: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4009 | #line 1260 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4010 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 4011 | break; |
| 4012 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4013 | case 100: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4014 | #line 1261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4015 | { |
| 4016 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4017 | GEN_ERROR("Calling conv too large"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4018 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4019 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4020 | ;} |
| 4021 | break; |
| 4022 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4023 | case 101: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4024 | #line 1268 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 4025 | { (yyval.Attributes) = Attribute::ZExt; ;} |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4026 | break; |
| 4027 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4028 | case 102: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4029 | #line 1269 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4030 | { (yyval.Attributes) = Attribute::ZExt; ;} |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4031 | break; |
| 4032 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4033 | case 103: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4034 | #line 1270 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 4035 | { (yyval.Attributes) = Attribute::SExt; ;} |
| 4036 | break; |
| 4037 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4038 | case 104: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4039 | #line 1271 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4040 | { (yyval.Attributes) = Attribute::SExt; ;} |
| 4041 | break; |
| 4042 | |
| 4043 | case 105: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4044 | #line 1272 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4045 | { (yyval.Attributes) = Attribute::InReg; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4046 | break; |
| 4047 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4048 | case 106: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4049 | #line 1273 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4050 | { (yyval.Attributes) = Attribute::StructRet; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4051 | break; |
| 4052 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4053 | case 107: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4054 | #line 1274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4055 | { (yyval.Attributes) = Attribute::NoAlias; ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4056 | break; |
| 4057 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4058 | case 108: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4059 | #line 1275 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4060 | { (yyval.Attributes) = Attribute::ByVal; ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 4061 | break; |
| 4062 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4063 | case 109: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4064 | #line 1276 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4065 | { (yyval.Attributes) = Attribute::Nest; ;} |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4066 | break; |
| 4067 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4068 | case 110: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4069 | #line 1277 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4070 | { (yyval.Attributes) = |
| 4071 | Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4072 | break; |
| 4073 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4074 | case 111: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4075 | #line 1281 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4076 | { (yyval.Attributes) = Attribute::None; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4077 | break; |
| 4078 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4079 | case 112: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4080 | #line 1282 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 4081 | { |
| 4082 | (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); |
| 4083 | ;} |
| 4084 | break; |
| 4085 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4086 | case 113: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4087 | #line 1287 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4088 | { (yyval.Attributes) = Attribute::InReg; ;} |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4089 | break; |
| 4090 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4091 | case 114: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4092 | #line 1288 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4093 | { (yyval.Attributes) = Attribute::ZExt; ;} |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4094 | break; |
| 4095 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4096 | case 115: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4097 | #line 1289 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4098 | { (yyval.Attributes) = Attribute::SExt; ;} |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4099 | break; |
| 4100 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4101 | case 116: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4102 | #line 1290 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4103 | { (yyval.Attributes) = Attribute::NoAlias; ;} |
Chris Lattner | ccef6b5 | 2008-09-23 21:18:31 +0000 | [diff] [blame] | 4104 | break; |
| 4105 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4106 | case 117: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4107 | #line 1293 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4108 | { (yyval.Attributes) = Attribute::None; ;} |
| 4109 | break; |
| 4110 | |
| 4111 | case 118: |
| 4112 | #line 1294 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4113 | { |
| 4114 | (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); |
| 4115 | ;} |
| 4116 | break; |
| 4117 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4118 | case 119: |
| 4119 | #line 1300 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4120 | { (yyval.Attributes) = Attribute::NoReturn; ;} |
| 4121 | break; |
| 4122 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4123 | case 120: |
| 4124 | #line 1301 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4125 | { (yyval.Attributes) = Attribute::NoUnwind; ;} |
| 4126 | break; |
| 4127 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4128 | case 121: |
| 4129 | #line 1302 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4130 | { (yyval.Attributes) = Attribute::InReg; ;} |
| 4131 | break; |
| 4132 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4133 | case 122: |
| 4134 | #line 1303 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4135 | { (yyval.Attributes) = Attribute::ZExt; ;} |
| 4136 | break; |
| 4137 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4138 | case 123: |
| 4139 | #line 1304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4140 | { (yyval.Attributes) = Attribute::SExt; ;} |
| 4141 | break; |
| 4142 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4143 | case 124: |
| 4144 | #line 1305 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4145 | { (yyval.Attributes) = Attribute::ReadNone; ;} |
| 4146 | break; |
| 4147 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4148 | case 125: |
| 4149 | #line 1306 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4150 | { (yyval.Attributes) = Attribute::ReadOnly; ;} |
| 4151 | break; |
| 4152 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4153 | case 126: |
| 4154 | #line 1307 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 9fc4da4 | 2008-10-08 06:44:45 +0000 | [diff] [blame] | 4155 | { (yyval.Attributes) = Attribute::NoInline; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4156 | break; |
| 4157 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4158 | case 127: |
| 4159 | #line 1308 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 9fc4da4 | 2008-10-08 06:44:45 +0000 | [diff] [blame] | 4160 | { (yyval.Attributes) = Attribute::AlwaysInline; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4161 | break; |
| 4162 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4163 | case 128: |
| 4164 | #line 1309 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 9fc4da4 | 2008-10-08 06:44:45 +0000 | [diff] [blame] | 4165 | { (yyval.Attributes) = Attribute::OptimizeForSize; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4166 | break; |
| 4167 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4168 | case 129: |
| 4169 | #line 1310 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4170 | { (yyval.Attributes) = Attribute::StackProtect; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4171 | break; |
| 4172 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4173 | case 130: |
| 4174 | #line 1311 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4175 | { (yyval.Attributes) = Attribute::StackProtectReq; ;} |
| 4176 | break; |
| 4177 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4178 | case 131: |
| 4179 | #line 1314 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4180 | { (yyval.Attributes) = Attribute::None; ;} |
| 4181 | break; |
| 4182 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4183 | case 132: |
| 4184 | #line 1315 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4185 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4186 | (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4187 | ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 4188 | break; |
| 4189 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4190 | case 133: |
| 4191 | #line 1321 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | d498081 | 2008-09-02 20:52:40 +0000 | [diff] [blame] | 4192 | { (yyval.StrVal) = 0; ;} |
| 4193 | break; |
| 4194 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4195 | case 134: |
| 4196 | #line 1322 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4197 | { |
| 4198 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
| 4199 | ;} |
| 4200 | break; |
| 4201 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4202 | case 135: |
| 4203 | #line 1329 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4204 | { (yyval.UIntVal) = 0; ;} |
| 4205 | break; |
| 4206 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4207 | case 136: |
| 4208 | #line 1330 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4209 | { |
| 4210 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
| 4211 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4212 | GEN_ERROR("Alignment must be a power of two"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4213 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4214 | ;} |
| 4215 | break; |
| 4216 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4217 | case 137: |
| 4218 | #line 1336 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4219 | { (yyval.UIntVal) = 0; ;} |
| 4220 | break; |
| 4221 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4222 | case 138: |
| 4223 | #line 1337 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4224 | { |
| 4225 | (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); |
| 4226 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4227 | GEN_ERROR("Alignment must be a power of two"); |
| 4228 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4229 | ;} |
| 4230 | break; |
| 4231 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4232 | case 139: |
| 4233 | #line 1346 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4234 | { |
| 4235 | for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) |
| 4236 | if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4237 | GEN_ERROR("Invalid character in section name"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4238 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4239 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4240 | ;} |
| 4241 | break; |
| 4242 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4243 | case 140: |
| 4244 | #line 1354 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4245 | { (yyval.StrVal) = 0; ;} |
| 4246 | break; |
| 4247 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4248 | case 141: |
| 4249 | #line 1355 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4250 | { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} |
| 4251 | break; |
| 4252 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4253 | case 142: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4254 | #line 1360 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4255 | {;} |
| 4256 | break; |
| 4257 | |
| 4258 | case 143: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4259 | #line 1361 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4260 | {;} |
| 4261 | break; |
| 4262 | |
| 4263 | case 144: |
| 4264 | #line 1362 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4265 | { |
| 4266 | CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); |
| 4267 | delete (yyvsp[(1) - (1)].StrVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4268 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4269 | ;} |
| 4270 | break; |
| 4271 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4272 | case 145: |
| 4273 | #line 1367 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4274 | { |
| 4275 | if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4276 | GEN_ERROR("Alignment must be a power of two"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4277 | CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4278 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4279 | ;} |
| 4280 | break; |
| 4281 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4282 | case 153: |
| 4283 | #line 1383 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4284 | { |
| 4285 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4286 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4287 | ;} |
| 4288 | break; |
| 4289 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4290 | case 154: |
| 4291 | #line 1387 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4292 | { |
| 4293 | (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4294 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4295 | ;} |
| 4296 | break; |
| 4297 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4298 | case 155: |
| 4299 | #line 1391 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4300 | { // Pointer type? |
| 4301 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4302 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4303 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal)))); |
| 4304 | delete (yyvsp[(1) - (3)].TypeVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4305 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4306 | ;} |
| 4307 | break; |
| 4308 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4309 | case 156: |
| 4310 | #line 1398 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4311 | { // Named types are also simple types... |
| 4312 | const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 4313 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4314 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 4315 | ;} |
| 4316 | break; |
| 4317 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4318 | case 157: |
| 4319 | #line 1403 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4320 | { // Type UpReference |
| 4321 | 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] | 4322 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4323 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... |
| 4324 | (yyval.TypeVal) = new PATypeHolder(OT); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4325 | UR_OUT("New Upreference!\n"); |
| 4326 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4327 | ;} |
| 4328 | break; |
| 4329 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4330 | case 158: |
| 4331 | #line 1411 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4332 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4333 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4334 | // FIXME: remove in LLVM 3.0. |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 4335 | const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal); |
| 4336 | if (!FunctionType::isValidReturnType(RetTy)) |
| 4337 | GEN_ERROR("Invalid result type for LLVM function"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4338 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4339 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4340 | 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] | 4341 | for (; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4342 | const Type *Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4343 | Params.push_back(Ty); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4344 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4345 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4346 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4347 | if (isVarArg) Params.pop_back(); |
| 4348 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4349 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4350 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4351 | GEN_ERROR("Function arguments must be value types!"); |
| 4352 | |
| 4353 | CHECK_FOR_ERROR |
| 4354 | |
Anton Korobeynikov | c36284e | 2007-12-03 19:17:47 +0000 | [diff] [blame] | 4355 | FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4356 | delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4357 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Nuno Lopes | 8a88a37 | 2008-10-05 16:49:34 +0000 | [diff] [blame] | 4358 | |
| 4359 | // Delete the argument list |
| 4360 | for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) { |
| 4361 | delete I->Ty; |
| 4362 | } |
| 4363 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); |
| 4364 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4365 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4366 | ;} |
| 4367 | break; |
| 4368 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4369 | case 159: |
| 4370 | #line 1446 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4371 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4372 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4373 | // FIXME: remove in LLVM 3.0. |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4374 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4375 | 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] | 4376 | for ( ; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4377 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4378 | Params.push_back(Ty); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4379 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4380 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4381 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4382 | if (isVarArg) Params.pop_back(); |
| 4383 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4384 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4385 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4386 | GEN_ERROR("Function arguments must be value types!"); |
| 4387 | |
| 4388 | CHECK_FOR_ERROR |
| 4389 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4390 | FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4391 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Nuno Lopes | 8a88a37 | 2008-10-05 16:49:34 +0000 | [diff] [blame] | 4392 | |
| 4393 | // Delete the argument list |
| 4394 | for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) { |
| 4395 | delete I->Ty; |
| 4396 | } |
| 4397 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); |
| 4398 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4399 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4400 | ;} |
| 4401 | break; |
| 4402 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4403 | case 160: |
| 4404 | #line 1477 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4405 | { // Sized array type? |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 4406 | (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] | 4407 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4408 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4409 | ;} |
| 4410 | break; |
| 4411 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4412 | case 161: |
| 4413 | #line 1482 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4414 | { // Vector type? |
| 4415 | const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); |
| 4416 | if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4417 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 4418 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 4419 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4420 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4421 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4422 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4423 | ;} |
| 4424 | break; |
| 4425 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4426 | case 162: |
| 4427 | #line 1492 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4428 | { // Structure type? |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4429 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4430 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), |
| 4431 | E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4432 | Elements.push_back(*I); |
| 4433 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4434 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 4435 | delete (yyvsp[(2) - (3)].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4436 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4437 | ;} |
| 4438 | break; |
| 4439 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4440 | case 163: |
| 4441 | #line 1502 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4442 | { // Empty structure type? |
| 4443 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4444 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4445 | ;} |
| 4446 | break; |
| 4447 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4448 | case 164: |
| 4449 | #line 1506 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4450 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4451 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4452 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), |
| 4453 | E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4454 | Elements.push_back(*I); |
| 4455 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4456 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 4457 | delete (yyvsp[(3) - (5)].TypeList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4458 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4459 | ;} |
| 4460 | break; |
| 4461 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4462 | case 165: |
| 4463 | #line 1516 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4464 | { // Empty structure type? |
| 4465 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4466 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4467 | ;} |
| 4468 | break; |
| 4469 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4470 | case 166: |
| 4471 | #line 1523 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4472 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4473 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4474 | // FIXME: remove in LLVM 3.0. |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4475 | (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4476 | (yyval.TypeWithAttrs).Attrs = Attribute::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4477 | ;} |
| 4478 | break; |
| 4479 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4480 | case 167: |
| 4481 | #line 1532 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4482 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4483 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4484 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); |
| 4485 | 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] | 4486 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4487 | (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); |
| 4488 | ;} |
| 4489 | break; |
| 4490 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4491 | case 168: |
| 4492 | #line 1539 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4493 | { |
| 4494 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 4495 | ;} |
| 4496 | break; |
| 4497 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4498 | case 169: |
| 4499 | #line 1544 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4500 | { |
| 4501 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 4502 | (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4503 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4504 | ;} |
| 4505 | break; |
| 4506 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4507 | case 170: |
| 4508 | #line 1549 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4509 | { |
| 4510 | ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4511 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4512 | ;} |
| 4513 | break; |
| 4514 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4515 | case 172: |
| 4516 | #line 1557 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4517 | { |
| 4518 | (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4519 | TypeWithAttrs TWA; TWA.Attrs = Attribute::None; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4520 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4521 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4522 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4523 | ;} |
| 4524 | break; |
| 4525 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4526 | case 173: |
| 4527 | #line 1564 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4528 | { |
| 4529 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4530 | TypeWithAttrs TWA; TWA.Attrs = Attribute::None; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4531 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4532 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4533 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4534 | ;} |
| 4535 | break; |
| 4536 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4537 | case 174: |
| 4538 | #line 1571 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4539 | { |
| 4540 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4541 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4542 | ;} |
| 4543 | break; |
| 4544 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4545 | case 175: |
| 4546 | #line 1579 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4547 | { |
| 4548 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4549 | (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4550 | delete (yyvsp[(1) - (1)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4551 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4552 | ;} |
| 4553 | break; |
| 4554 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4555 | case 176: |
| 4556 | #line 1585 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4557 | { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4558 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4559 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4560 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4561 | ;} |
| 4562 | break; |
| 4563 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4564 | case 177: |
| 4565 | #line 1597 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4566 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4567 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4568 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4569 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4570 | if (ATy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4571 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4572 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4573 | const Type *ETy = ATy->getElementType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4574 | uint64_t NumElements = ATy->getNumElements(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4575 | |
| 4576 | // Verify that we have the correct size... |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4577 | if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4578 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4579 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4580 | utostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4581 | |
| 4582 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4583 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4584 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4585 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4586 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4587 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4588 | } |
| 4589 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4590 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4591 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4592 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4593 | ;} |
| 4594 | break; |
| 4595 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4596 | case 178: |
| 4597 | #line 1625 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4598 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4599 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4600 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4601 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4602 | if (ATy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4603 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4604 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4605 | |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4606 | uint64_t NumElements = ATy->getNumElements(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4607 | if (NumElements != uint64_t(-1) && NumElements != 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4608 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4609 | " arguments, but has size of " + utostr(NumElements) +""); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4610 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 4611 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4612 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4613 | ;} |
| 4614 | break; |
| 4615 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4616 | case 179: |
| 4617 | #line 1641 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4618 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4619 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4620 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4621 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4622 | if (ATy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4623 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4624 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4625 | |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4626 | uint64_t NumElements = ATy->getNumElements(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4627 | const Type *ETy = ATy->getElementType(); |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4628 | if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4629 | GEN_ERROR("Can't build string constant of size " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4630 | utostr((yyvsp[(3) - (3)].StrVal)->length()) + |
| 4631 | " when array has size " + utostr(NumElements) + ""); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4632 | std::vector<Constant*> Vals; |
| 4633 | if (ETy == Type::Int8Ty) { |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4634 | for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4635 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4636 | } else { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4637 | delete (yyvsp[(3) - (3)].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4638 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 4639 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4640 | delete (yyvsp[(3) - (3)].StrVal); |
| 4641 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 4642 | delete (yyvsp[(1) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4643 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4644 | ;} |
| 4645 | break; |
| 4646 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4647 | case 180: |
| 4648 | #line 1668 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4649 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4650 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4651 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4652 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4653 | if (PTy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4654 | GEN_ERROR("Cannot make packed constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4655 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4656 | const Type *ETy = PTy->getElementType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4657 | unsigned NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4658 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4659 | // Verify that we have the correct size... |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4660 | if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4661 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4662 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4663 | utostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4664 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4665 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4666 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4667 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4668 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4669 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4670 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4671 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4672 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4673 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4674 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4675 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4676 | ;} |
| 4677 | break; |
| 4678 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4679 | case 181: |
| 4680 | #line 1696 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4681 | { |
| 4682 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4683 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4684 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4685 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4686 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4687 | if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4688 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4689 | |
| 4690 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4691 | for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) |
| 4692 | if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4693 | GEN_ERROR("Expected type '" + |
| 4694 | STy->getElementType(i)->getDescription() + |
| 4695 | "' for element #" + utostr(i) + |
| 4696 | " of structure initializer"); |
| 4697 | |
| 4698 | // Check to ensure that Type is not packed |
| 4699 | if (STy->isPacked()) |
| 4700 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4701 | STy->getDescription() + "'"); |
| 4702 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4703 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4704 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4705 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4706 | ;} |
| 4707 | break; |
| 4708 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4709 | case 182: |
| 4710 | #line 1722 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4711 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4712 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4713 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4714 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4715 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4716 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4717 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4718 | |
| 4719 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4720 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4721 | |
| 4722 | // Check to ensure that Type is not packed |
| 4723 | if (STy->isPacked()) |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4724 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4725 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4726 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4727 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4728 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4729 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4730 | ;} |
| 4731 | break; |
| 4732 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4733 | case 183: |
| 4734 | #line 1742 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4735 | { |
| 4736 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4737 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4738 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4739 | (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4740 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4741 | if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4742 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4743 | |
| 4744 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4745 | for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) |
| 4746 | if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4747 | GEN_ERROR("Expected type '" + |
| 4748 | STy->getElementType(i)->getDescription() + |
| 4749 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4750 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4751 | |
| 4752 | // Check to ensure that Type is packed |
| 4753 | if (!STy->isPacked()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4754 | GEN_ERROR("Vector initializer to non-vector type '" + |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4755 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4756 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4757 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector)); |
| 4758 | delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4759 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4760 | ;} |
| 4761 | break; |
| 4762 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4763 | case 184: |
| 4764 | #line 1768 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4765 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4766 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4767 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); |
| 4768 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4769 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4770 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4771 | (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4772 | |
| 4773 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4774 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4775 | |
| 4776 | // Check to ensure that Type is packed |
| 4777 | if (!STy->isPacked()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4778 | GEN_ERROR("Vector initializer to non-vector type '" + |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4779 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4780 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4781 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4782 | delete (yyvsp[(1) - (5)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4783 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4784 | ;} |
| 4785 | break; |
| 4786 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4787 | case 185: |
| 4788 | #line 1788 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4789 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4790 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4791 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4792 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4793 | if (PTy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4794 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4795 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4796 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4797 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4798 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4799 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4800 | ;} |
| 4801 | break; |
| 4802 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4803 | case 186: |
| 4804 | #line 1800 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4805 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4806 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4807 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4808 | (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); |
| 4809 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4810 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4811 | ;} |
| 4812 | break; |
| 4813 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4814 | case 187: |
| 4815 | #line 1807 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4816 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4817 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4818 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4819 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4820 | if (Ty == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4821 | 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] | 4822 | |
| 4823 | // ConstExprs can exist in the body of a function, thus creating |
| 4824 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4825 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4826 | // symbol table instead of the module symbol table for the global symbol, |
| 4827 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4828 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4829 | // |
| 4830 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4831 | CurFun.CurrentFunction = 0; |
| 4832 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4833 | Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4834 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4835 | |
| 4836 | CurFun.CurrentFunction = SavedCurFn; |
| 4837 | |
| 4838 | // If this is an initializer for a constant pointer, which is referencing a |
| 4839 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4840 | // in the future with the right type of variable. |
| 4841 | // |
| 4842 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4843 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4844 | const PointerType *PT = cast<PointerType>(Ty); |
| 4845 | |
| 4846 | // First check to see if the forward references value is already created! |
| 4847 | PerModuleInfo::GlobalRefsType::iterator I = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4848 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4849 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4850 | if (I != CurModule.GlobalRefs.end()) { |
| 4851 | V = I->second; // Placeholder already exists, use it... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4852 | (yyvsp[(2) - (2)].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4853 | } else { |
| 4854 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4855 | if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName) |
| 4856 | Name = (yyvsp[(2) - (2)].ValIDVal).getName(); |
| 4857 | else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4858 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4859 | |
| 4860 | // Create the forward referenced global. |
| 4861 | GlobalValue *GV; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4862 | if (const FunctionType *FTy = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4863 | dyn_cast<FunctionType>(PT->getElementType())) { |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 4864 | GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name, |
| 4865 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4866 | } else { |
| 4867 | GV = new GlobalVariable(PT->getElementType(), false, |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4868 | GlobalValue::ExternalWeakLinkage, 0, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4869 | Name, CurModule.CurrentModule); |
| 4870 | } |
| 4871 | |
| 4872 | // 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] | 4873 | 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] | 4874 | V = GV; |
| 4875 | } |
| 4876 | } |
| 4877 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4878 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4879 | delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4880 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4881 | ;} |
| 4882 | break; |
| 4883 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4884 | case 188: |
| 4885 | #line 1873 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4886 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4887 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4888 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4889 | if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4890 | GEN_ERROR("Mismatched types for constant expression: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4891 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription()); |
| 4892 | (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); |
| 4893 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4894 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4895 | ;} |
| 4896 | break; |
| 4897 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4898 | case 189: |
| 4899 | #line 1883 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4900 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4901 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4902 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4903 | const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4904 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4905 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4906 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4907 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4908 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4909 | ;} |
| 4910 | break; |
| 4911 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4912 | case 190: |
| 4913 | #line 1893 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4914 | { // integral constants |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4915 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4916 | if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].SInt64Val))) |
| 4917 | GEN_ERROR("Constant value doesn't fit in type"); |
| 4918 | (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].SInt64Val), true); |
| 4919 | } else { |
| 4920 | GEN_ERROR("integer constant must have integer type"); |
| 4921 | } |
| 4922 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4923 | CHECK_FOR_ERROR |
| 4924 | ;} |
| 4925 | break; |
| 4926 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4927 | case 191: |
| 4928 | #line 1904 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4929 | { // arbitrary precision integer constants |
| 4930 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4931 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth()) |
| 4932 | GEN_ERROR("Constant value does not fit in type"); |
| 4933 | (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(IT->getBitWidth()); |
| 4934 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4935 | } else { |
| 4936 | GEN_ERROR("integer constant must have integer type"); |
| 4937 | } |
| 4938 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4939 | delete (yyvsp[(2) - (2)].APIntVal); |
| 4940 | CHECK_FOR_ERROR |
| 4941 | ;} |
| 4942 | break; |
| 4943 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4944 | case 192: |
| 4945 | #line 1917 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4946 | { // integral constants |
| 4947 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4948 | if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].UInt64Val))) |
| 4949 | GEN_ERROR("Constant value doesn't fit in type"); |
| 4950 | (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].UInt64Val), false); |
| 4951 | } else { |
| 4952 | GEN_ERROR("integer constant must have integer type"); |
| 4953 | } |
| 4954 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4955 | CHECK_FOR_ERROR |
| 4956 | ;} |
| 4957 | break; |
| 4958 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4959 | case 193: |
| 4960 | #line 1928 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4961 | { // arbitrary precision integer constants |
| 4962 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4963 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth()) |
| 4964 | GEN_ERROR("Constant value does not fit in type"); |
| 4965 | (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(IT->getBitWidth()); |
| 4966 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4967 | } else { |
| 4968 | GEN_ERROR("integer constant must have integer type"); |
| 4969 | } |
| 4970 | |
| 4971 | delete (yyvsp[(2) - (2)].APIntVal); |
| 4972 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4973 | CHECK_FOR_ERROR |
| 4974 | ;} |
| 4975 | break; |
| 4976 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4977 | case 194: |
| 4978 | #line 1942 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4979 | { // Boolean constants |
| 4980 | if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty) |
| 4981 | GEN_ERROR("Constant true must have type i1"); |
| 4982 | (yyval.ConstVal) = ConstantInt::getTrue(); |
| 4983 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4984 | CHECK_FOR_ERROR |
| 4985 | ;} |
| 4986 | break; |
| 4987 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4988 | case 195: |
| 4989 | #line 1949 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4990 | { // Boolean constants |
| 4991 | if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty) |
| 4992 | GEN_ERROR("Constant false must have type i1"); |
| 4993 | (yyval.ConstVal) = ConstantInt::getFalse(); |
| 4994 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4995 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4996 | ;} |
| 4997 | break; |
| 4998 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 4999 | case 196: |
| 5000 | #line 1956 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5001 | { // Floating point constants |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5002 | if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].TypeVal)->get(), *(yyvsp[(2) - (2)].FPVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5003 | GEN_ERROR("Floating point constant invalid for type"); |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5004 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5005 | // 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] | 5006 | // as double. Fix this here. Long double is done right. |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5007 | if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].TypeVal)->get()==Type::FloatTy) { |
Dale Johannesen | 236bbd4 | 2008-10-09 23:01:34 +0000 | [diff] [blame] | 5008 | bool ignored; |
| 5009 | (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, |
| 5010 | &ignored); |
| 5011 | } |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 5012 | (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal)); |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5013 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5014 | delete (yyvsp[(2) - (2)].FPVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5015 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5016 | ;} |
| 5017 | break; |
| 5018 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5019 | case 197: |
| 5020 | #line 1974 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5021 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5022 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5023 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); |
| 5024 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 5025 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 5026 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5027 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5028 | Val->getType()->getDescription() + "' to '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5029 | DestTy->getDescription() + "'"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5030 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
| 5031 | delete (yyvsp[(5) - (6)].TypeVal); |
| 5032 | ;} |
| 5033 | break; |
| 5034 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5035 | case 198: |
| 5036 | #line 1986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5037 | { |
| 5038 | if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5039 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5040 | |
| 5041 | const Type *IdxTy = |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 5042 | 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] | 5043 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5044 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5045 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 5046 | SmallVector<Constant*, 8> IdxVec; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5047 | for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) |
| 5048 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5049 | IdxVec.push_back(C); |
| 5050 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5051 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5052 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5053 | delete (yyvsp[(4) - (5)].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5054 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5055 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5056 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5057 | ;} |
| 5058 | break; |
| 5059 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5060 | case 199: |
| 5061 | #line 2007 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5062 | { |
| 5063 | if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5064 | GEN_ERROR("Select condition must be of boolean type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5065 | if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5066 | GEN_ERROR("Select operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5067 | (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] | 5068 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5069 | ;} |
| 5070 | break; |
| 5071 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5072 | case 200: |
| 5073 | #line 2015 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5074 | { |
| 5075 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5076 | GEN_ERROR("Binary operator types must match"); |
| 5077 | CHECK_FOR_ERROR; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5078 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
| 5079 | ;} |
| 5080 | break; |
| 5081 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5082 | case 201: |
| 5083 | #line 2021 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5084 | { |
| 5085 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5086 | GEN_ERROR("Logical operator types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5087 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5088 | if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) || |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5089 | !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5090 | GEN_ERROR("Logical operator requires integral operands"); |
| 5091 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5092 | (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] | 5093 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5094 | ;} |
| 5095 | break; |
| 5096 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5097 | case 202: |
| 5098 | #line 2032 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5099 | { |
| 5100 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5101 | GEN_ERROR("icmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5102 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5103 | ;} |
| 5104 | break; |
| 5105 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5106 | case 203: |
| 5107 | #line 2037 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5108 | { |
| 5109 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5110 | GEN_ERROR("fcmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5111 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5112 | ;} |
| 5113 | break; |
| 5114 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5115 | case 204: |
| 5116 | #line 2042 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 5117 | { |
| 5118 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 5119 | GEN_ERROR("vicmp operand types must match"); |
| 5120 | (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5121 | ;} |
| 5122 | break; |
| 5123 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5124 | case 205: |
| 5125 | #line 2047 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 5126 | { |
| 5127 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 5128 | GEN_ERROR("vfcmp operand types must match"); |
| 5129 | (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5130 | ;} |
| 5131 | break; |
| 5132 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5133 | case 206: |
| 5134 | #line 2052 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5135 | { |
| 5136 | if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5137 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5138 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5139 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5140 | ;} |
| 5141 | break; |
| 5142 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5143 | case 207: |
| 5144 | #line 2058 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5145 | { |
| 5146 | 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] | 5147 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5148 | (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] | 5149 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5150 | ;} |
| 5151 | break; |
| 5152 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5153 | case 208: |
| 5154 | #line 2064 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5155 | { |
| 5156 | 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] | 5157 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5158 | (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] | 5159 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5160 | ;} |
| 5161 | break; |
| 5162 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5163 | case 209: |
| 5164 | #line 2070 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5165 | { |
| 5166 | if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
| 5167 | GEN_ERROR("ExtractValue requires an aggregate operand"); |
| 5168 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5169 | (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size()); |
| 5170 | delete (yyvsp[(4) - (5)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5171 | CHECK_FOR_ERROR |
| 5172 | ;} |
| 5173 | break; |
| 5174 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5175 | case 210: |
| 5176 | #line 2078 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5177 | { |
| 5178 | if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType())) |
| 5179 | GEN_ERROR("InsertValue requires an aggregate operand"); |
| 5180 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5181 | (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size()); |
| 5182 | delete (yyvsp[(6) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5183 | CHECK_FOR_ERROR |
| 5184 | ;} |
| 5185 | break; |
| 5186 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5187 | case 211: |
| 5188 | #line 2089 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5189 | { |
| 5190 | ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5191 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5192 | ;} |
| 5193 | break; |
| 5194 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5195 | case 212: |
| 5196 | #line 2093 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5197 | { |
| 5198 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 5199 | (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5200 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5201 | ;} |
| 5202 | break; |
| 5203 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5204 | case 213: |
| 5205 | #line 2101 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5206 | { (yyval.BoolVal) = false; ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 5207 | break; |
| 5208 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5209 | case 214: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5210 | #line 2101 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5211 | { (yyval.BoolVal) = true; ;} |
| 5212 | break; |
| 5213 | |
| 5214 | case 215: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5215 | #line 2104 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5216 | { (yyval.BoolVal) = true; ;} |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5217 | break; |
| 5218 | |
| 5219 | case 216: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5220 | #line 2104 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5221 | { (yyval.BoolVal) = false; ;} |
| 5222 | break; |
| 5223 | |
| 5224 | case 217: |
| 5225 | #line 2107 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5226 | { |
| 5227 | const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); |
| 5228 | Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); |
Chris Lattner | 0275cff | 2007-08-06 21:00:46 +0000 | [diff] [blame] | 5229 | CHECK_FOR_ERROR |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5230 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 5231 | if (!Aliasee) |
| 5232 | GEN_ERROR("Aliases can be created only to global values"); |
| 5233 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5234 | (yyval.ConstVal) = Aliasee; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5235 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5236 | delete (yyvsp[(1) - (2)].TypeVal); |
| 5237 | ;} |
| 5238 | break; |
| 5239 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5240 | case 218: |
| 5241 | #line 2119 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5242 | { |
| 5243 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 5244 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 5245 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5246 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5247 | Val->getType()->getDescription() + "' to '" + |
| 5248 | DestTy->getDescription() + "'"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5249 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5250 | (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] | 5251 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5252 | delete (yyvsp[(5) - (6)].TypeVal); |
| 5253 | ;} |
| 5254 | break; |
| 5255 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5256 | case 219: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5257 | #line 2140 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 5258 | { |
| 5259 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 5260 | CurModule.ModuleDone(); |
| 5261 | CHECK_FOR_ERROR; |
| 5262 | ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 5263 | break; |
| 5264 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5265 | case 220: |
| 5266 | #line 2145 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5267 | { |
| 5268 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 5269 | CurModule.ModuleDone(); |
| 5270 | CHECK_FOR_ERROR; |
| 5271 | ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5272 | break; |
| 5273 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5274 | case 223: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5275 | #line 2158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5276 | { CurFun.isDeclare = false; ;} |
| 5277 | break; |
| 5278 | |
| 5279 | case 224: |
| 5280 | #line 2158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5281 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5282 | CurFun.FunctionDone(); |
| 5283 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5284 | ;} |
| 5285 | break; |
| 5286 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5287 | case 225: |
| 5288 | #line 2162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5289 | { CurFun.isDeclare = true; ;} |
| 5290 | break; |
| 5291 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5292 | case 226: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5293 | #line 2162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5294 | { |
| 5295 | CHECK_FOR_ERROR |
| 5296 | ;} |
| 5297 | break; |
| 5298 | |
| 5299 | case 227: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5300 | #line 2165 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5301 | { |
| 5302 | CHECK_FOR_ERROR |
| 5303 | ;} |
| 5304 | break; |
| 5305 | |
| 5306 | case 228: |
| 5307 | #line 2168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5308 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5309 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5310 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5311 | // Eagerly resolve types. This is not an optimization, this is a |
| 5312 | // requirement that is due to the fact that we could have this: |
| 5313 | // |
| 5314 | // %list = type { %list * } |
| 5315 | // %list = type { %list * } ; repeated type decl |
| 5316 | // |
| 5317 | // If types are not resolved eagerly, then the two types will not be |
| 5318 | // determined to be the same type! |
| 5319 | // |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5320 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5321 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5322 | 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] | 5323 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5324 | // If this is a named type that is not a redefinition, add it to the slot |
| 5325 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5326 | CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5327 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5328 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5329 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5330 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5331 | ;} |
| 5332 | break; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5333 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5334 | case 229: |
| 5335 | #line 2192 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5336 | { |
| 5337 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); |
| 5338 | |
| 5339 | 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] | 5340 | CHECK_FOR_ERROR |
| 5341 | // If this is a named type that is not a redefinition, add it to the slot |
| 5342 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5343 | CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5344 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5345 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5346 | ;} |
| 5347 | break; |
| 5348 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5349 | case 230: |
| 5350 | #line 2204 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5351 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5352 | /* "Externally Visible" Linkage */ |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5353 | if ((yyvsp[(5) - (6)].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5354 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5355 | CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage, |
| 5356 | (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] | 5357 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5358 | ;} |
| 5359 | break; |
| 5360 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5361 | case 231: |
| 5362 | #line 2211 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5363 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5364 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5365 | ;} |
| 5366 | break; |
| 5367 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5368 | case 232: |
| 5369 | #line 2215 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5370 | { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5371 | if ((yyvsp[(6) - (7)].ConstVal) == 0) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5372 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5373 | 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] | 5374 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5375 | ;} |
| 5376 | break; |
| 5377 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5378 | case 233: |
| 5379 | #line 2220 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5380 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5381 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5382 | ;} |
| 5383 | break; |
| 5384 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5385 | case 234: |
| 5386 | #line 2224 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5387 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5388 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5389 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); |
| 5390 | 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] | 5391 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5392 | delete (yyvsp[(6) - (7)].TypeVal); |
| 5393 | ;} |
| 5394 | break; |
| 5395 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5396 | case 235: |
| 5397 | #line 2230 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5398 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5399 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5400 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5401 | ;} |
| 5402 | break; |
| 5403 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5404 | case 236: |
| 5405 | #line 2234 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5406 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5407 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5408 | if ((yyvsp[(1) - (5)].StrVal)) { |
| 5409 | Name = *(yyvsp[(1) - (5)].StrVal); |
| 5410 | delete (yyvsp[(1) - (5)].StrVal); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5411 | } |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5412 | if (Name.empty()) |
| 5413 | GEN_ERROR("Alias name cannot be empty"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5414 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5415 | Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5416 | if (Aliasee == 0) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5417 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5418 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5419 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee, |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5420 | CurModule.CurrentModule); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5421 | GA->setVisibility((yyvsp[(2) - (5)].Visibility)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5422 | InsertValue(GA, CurModule.Values); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5423 | |
| 5424 | |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5425 | // If there was a forward reference of this alias, resolve it now. |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5426 | |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5427 | ValID ID; |
| 5428 | if (!Name.empty()) |
| 5429 | ID = ValID::createGlobalName(Name); |
| 5430 | else |
| 5431 | ID = ValID::createGlobalID(CurModule.Values.size()-1); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5432 | |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5433 | if (GlobalValue *FWGV = |
| 5434 | CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { |
| 5435 | // Replace uses of the fwdref with the actual alias. |
| 5436 | FWGV->replaceAllUsesWith(GA); |
| 5437 | if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV)) |
| 5438 | GV->eraseFromParent(); |
| 5439 | else |
| 5440 | cast<Function>(FWGV)->eraseFromParent(); |
| 5441 | } |
| 5442 | ID.destroy(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5443 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5444 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5445 | ;} |
| 5446 | break; |
| 5447 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5448 | case 237: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5449 | #line 2274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5450 | { |
| 5451 | CHECK_FOR_ERROR |
| 5452 | ;} |
| 5453 | break; |
| 5454 | |
| 5455 | case 238: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5456 | #line 2277 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5457 | { |
| 5458 | CHECK_FOR_ERROR |
| 5459 | ;} |
| 5460 | break; |
| 5461 | |
| 5462 | case 239: |
| 5463 | #line 2283 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5464 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5465 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5466 | if (AsmSoFar.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5467 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5468 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5469 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal)); |
| 5470 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5471 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5472 | ;} |
| 5473 | break; |
| 5474 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5475 | case 240: |
| 5476 | #line 2293 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5477 | { |
| 5478 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); |
| 5479 | delete (yyvsp[(3) - (3)].StrVal); |
| 5480 | ;} |
| 5481 | break; |
| 5482 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5483 | case 241: |
| 5484 | #line 2297 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5485 | { |
| 5486 | CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); |
| 5487 | delete (yyvsp[(3) - (3)].StrVal); |
| 5488 | ;} |
| 5489 | break; |
| 5490 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5491 | case 243: |
| 5492 | #line 2304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5493 | { |
| 5494 | CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); |
| 5495 | delete (yyvsp[(3) - (3)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5496 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5497 | ;} |
| 5498 | break; |
| 5499 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5500 | case 244: |
| 5501 | #line 2309 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5502 | { |
| 5503 | CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); |
| 5504 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 1013b4d | 2007-07-31 14:41:17 +0000 | [diff] [blame] | 5505 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5506 | ;} |
| 5507 | break; |
| 5508 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5509 | case 245: |
| 5510 | #line 2314 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5511 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5512 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5513 | ;} |
| 5514 | break; |
| 5515 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5516 | case 246: |
| 5517 | #line 2323 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5518 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5519 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5520 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5521 | if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType()) |
| 5522 | GEN_ERROR("Argument types must be first-class"); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5523 | ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].Attributes); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5524 | (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList); |
| 5525 | (yyvsp[(1) - (5)].ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5526 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5527 | ;} |
| 5528 | break; |
| 5529 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5530 | case 247: |
| 5531 | #line 2333 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5532 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5533 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5534 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5535 | if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType()) |
| 5536 | GEN_ERROR("Argument types must be first-class"); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5537 | ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].Attributes); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5538 | (yyval.ArgList) = new ArgListType; |
| 5539 | (yyval.ArgList)->push_back(E); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5540 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5541 | ;} |
| 5542 | break; |
| 5543 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5544 | case 248: |
| 5545 | #line 2344 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5546 | { |
| 5547 | (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5548 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5549 | ;} |
| 5550 | break; |
| 5551 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5552 | case 249: |
| 5553 | #line 2348 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5554 | { |
| 5555 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5556 | struct ArgListEntry E; |
| 5557 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5558 | E.Name = 0; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5559 | E.Attrs = Attribute::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5560 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5561 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5562 | ;} |
| 5563 | break; |
| 5564 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5565 | case 250: |
| 5566 | #line 2357 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5567 | { |
| 5568 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5569 | struct ArgListEntry E; |
| 5570 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5571 | E.Name = 0; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5572 | E.Attrs = Attribute::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5573 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5574 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5575 | ;} |
| 5576 | break; |
| 5577 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5578 | case 251: |
| 5579 | #line 2366 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5580 | { |
| 5581 | (yyval.ArgList) = 0; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5582 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5583 | ;} |
| 5584 | break; |
| 5585 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5586 | case 252: |
| 5587 | #line 2372 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5588 | { |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5589 | std::string FunctionName(*(yyvsp[(4) - (11)].StrVal)); |
| 5590 | delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory! |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5591 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5592 | // Check the function result for abstractness if this is a define. We should |
| 5593 | // have no abstract types at this point |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5594 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal))) |
| 5595 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5596 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5597 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal))) |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 5598 | GEN_ERROR("Invalid result type for LLVM function"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5599 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5600 | std::vector<const Type*> ParamTypeList; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5601 | SmallVector<AttributeWithIndex, 8> Attrs; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5602 | //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function |
| 5603 | //attributes. |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5604 | Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes); |
| 5605 | if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) { |
| 5606 | if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5607 | RetAttrs = RetAttrs | Attribute::ZExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5608 | (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5609 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5610 | if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5611 | RetAttrs = RetAttrs | Attribute::SExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5612 | (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5613 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5614 | if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5615 | RetAttrs = RetAttrs | Attribute::InReg; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5616 | (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5617 | } |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5618 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5619 | if (RetAttrs != Attribute::None) |
| 5620 | Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); |
| 5621 | if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments... |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5622 | unsigned index = 1; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5623 | for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5624 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5625 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 5626 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5627 | ParamTypeList.push_back(Ty); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5628 | if (Ty != Type::VoidTy && I->Attrs != Attribute::None) |
| 5629 | Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5630 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5631 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5632 | if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) |
| 5633 | Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5634 | |
| 5635 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 5636 | if (isVarArg) ParamTypeList.pop_back(); |
| 5637 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5638 | AttrListPtr PAL; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5639 | if (!Attrs.empty()) |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5640 | PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5641 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5642 | FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5643 | const PointerType *PFT = PointerType::getUnqual(FT); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5644 | delete (yyvsp[(3) - (11)].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5645 | |
| 5646 | ValID ID; |
| 5647 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5648 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5649 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5650 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5651 | } |
| 5652 | |
| 5653 | Function *Fn = 0; |
| 5654 | // See if this function was forward referenced. If so, recycle the object. |
| 5655 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5656 | // Move the function to the end of the list, from whereever it was |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5657 | // previously inserted. |
| 5658 | Fn = cast<Function>(FWRef); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5659 | assert(Fn->getAttributes().isEmpty() && |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5660 | "Forward reference has parameter attributes!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5661 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 5662 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 5663 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5664 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5665 | if (Fn->getFunctionType() != FT ) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5666 | // The existing function doesn't have the same type. This is an overload |
| 5667 | // error. |
| 5668 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5669 | } else if (Fn->getAttributes() != PAL) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5670 | // The existing function doesn't have the same parameter attributes. |
| 5671 | // This is an overload error. |
| 5672 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5673 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5674 | // Neither the existing or the current function is a declaration and they |
| 5675 | // have the same name and same type. Clearly this is a redefinition. |
| 5676 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5677 | } else if (Fn->isDeclaration()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5678 | // 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] | 5679 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 5680 | AI != AE; ++AI) |
| 5681 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5682 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5683 | } else { // Not already defined? |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5684 | Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
| 5685 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5686 | InsertValue(Fn, CurModule.Values); |
| 5687 | } |
| 5688 | |
Nuno Lopes | 9e9631d | 2008-10-03 15:45:58 +0000 | [diff] [blame] | 5689 | ID.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5690 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5691 | |
| 5692 | if (CurFun.isDeclare) { |
| 5693 | // If we have declaration, always overwrite linkage. This will allow us to |
| 5694 | // correctly handle cases, when pointer to function is passed as argument to |
| 5695 | // another function. |
| 5696 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 5697 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5698 | } |
Devang Patel | d498081 | 2008-09-02 20:52:40 +0000 | [diff] [blame] | 5699 | Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal)); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5700 | Fn->setAttributes(PAL); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5701 | Fn->setAlignment((yyvsp[(10) - (11)].UIntVal)); |
| 5702 | if ((yyvsp[(9) - (11)].StrVal)) { |
| 5703 | Fn->setSection(*(yyvsp[(9) - (11)].StrVal)); |
| 5704 | delete (yyvsp[(9) - (11)].StrVal); |
Gordon Henriksen | 80a75bf | 2007-12-10 03:18:06 +0000 | [diff] [blame] | 5705 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5706 | if ((yyvsp[(11) - (11)].StrVal)) { |
| 5707 | Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str()); |
| 5708 | delete (yyvsp[(11) - (11)].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 5709 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5710 | |
| 5711 | // Add all of the arguments we parsed to the function... |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5712 | if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5713 | if (isVarArg) { // Nuke the last entry |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5714 | assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 && |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 5715 | "Not a varargs marker!"); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5716 | delete (yyvsp[(6) - (11)].ArgList)->back().Ty; |
| 5717 | (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5718 | } |
| 5719 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5720 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5721 | unsigned Idx = 1; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5722 | for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); |
| 5723 | I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5724 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5725 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5726 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5727 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5728 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5729 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5730 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5731 | delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5732 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5733 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5734 | ;} |
| 5735 | break; |
| 5736 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5737 | case 255: |
| 5738 | #line 2522 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5739 | { |
| 5740 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5741 | |
| 5742 | // Make sure that we keep track of the linkage type even if there was a |
| 5743 | // previous "declare". |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5744 | (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); |
| 5745 | (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility)); |
| 5746 | ;} |
| 5747 | break; |
| 5748 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5749 | case 258: |
| 5750 | #line 2533 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5751 | { |
| 5752 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5753 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5754 | ;} |
| 5755 | break; |
| 5756 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5757 | case 259: |
| 5758 | #line 2538 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5759 | { |
| 5760 | CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); |
| 5761 | CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); |
| 5762 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5763 | CurFun.FunctionDone(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5764 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5765 | ;} |
| 5766 | break; |
| 5767 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5768 | case 260: |
| 5769 | #line 2550 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5770 | { |
| 5771 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5772 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5773 | ;} |
| 5774 | break; |
| 5775 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5776 | case 261: |
| 5777 | #line 2554 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5778 | { |
| 5779 | (yyval.BoolVal) = true; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5780 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5781 | ;} |
| 5782 | break; |
| 5783 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5784 | case 262: |
| 5785 | #line 2559 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5786 | { // A reference to a direct constant |
| 5787 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5788 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5789 | ;} |
| 5790 | break; |
| 5791 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5792 | case 263: |
| 5793 | #line 2563 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5794 | { |
| 5795 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5796 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5797 | ;} |
| 5798 | break; |
| 5799 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5800 | case 264: |
| 5801 | #line 2567 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 5802 | { // arbitrary precision integer constants |
| 5803 | (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true); |
| 5804 | delete (yyvsp[(1) - (1)].APIntVal); |
| 5805 | CHECK_FOR_ERROR |
| 5806 | ;} |
| 5807 | break; |
| 5808 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5809 | case 265: |
| 5810 | #line 2572 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 5811 | { // arbitrary precision integer constants |
| 5812 | (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false); |
| 5813 | delete (yyvsp[(1) - (1)].APIntVal); |
| 5814 | CHECK_FOR_ERROR |
| 5815 | ;} |
| 5816 | break; |
| 5817 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5818 | case 266: |
| 5819 | #line 2577 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5820 | { // Perhaps it's an FP constant? |
| 5821 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5822 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5823 | ;} |
| 5824 | break; |
| 5825 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5826 | case 267: |
| 5827 | #line 2581 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5828 | { |
| 5829 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5830 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5831 | ;} |
| 5832 | break; |
| 5833 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5834 | case 268: |
| 5835 | #line 2585 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5836 | { |
| 5837 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5838 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5839 | ;} |
| 5840 | break; |
| 5841 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5842 | case 269: |
| 5843 | #line 2589 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5844 | { |
| 5845 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5846 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5847 | ;} |
| 5848 | break; |
| 5849 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5850 | case 270: |
| 5851 | #line 2593 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5852 | { |
| 5853 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5854 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5855 | ;} |
| 5856 | break; |
| 5857 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5858 | case 271: |
| 5859 | #line 2597 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5860 | { // A vector zero constant. |
| 5861 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5862 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5863 | ;} |
| 5864 | break; |
| 5865 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5866 | case 272: |
| 5867 | #line 2601 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5868 | { // Nonempty unsized packed vector |
| 5869 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5870 | unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5871 | |
| 5872 | if (!ETy->isInteger() && !ETy->isFloatingPoint()) |
| 5873 | GEN_ERROR("Invalid vector element type: " + ETy->getDescription()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5874 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5875 | VectorType* pt = VectorType::get(ETy, NumElements); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5876 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt)); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5877 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5878 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5879 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5880 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5881 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5882 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5883 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5884 | } |
| 5885 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5886 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector))); |
| 5887 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5888 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5889 | ;} |
| 5890 | break; |
| 5891 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5892 | case 273: |
| 5893 | #line 2623 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5894 | { // Nonempty unsized arr |
| 5895 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5896 | uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5897 | |
| 5898 | if (!ETy->isFirstClassType()) |
| 5899 | GEN_ERROR("Invalid array element type: " + ETy->getDescription()); |
| 5900 | |
| 5901 | ArrayType *ATy = ArrayType::get(ETy, NumElements); |
| 5902 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy)); |
| 5903 | |
| 5904 | // Verify all elements are correct type! |
| 5905 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5906 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5907 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5908 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
| 5909 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
| 5910 | } |
| 5911 | |
| 5912 | (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector))); |
| 5913 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
| 5914 | CHECK_FOR_ERROR |
| 5915 | ;} |
| 5916 | break; |
| 5917 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5918 | case 274: |
| 5919 | #line 2645 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5920 | { |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5921 | // Use undef instead of an array because it's inconvenient to determine |
| 5922 | // the element type at this point, there being no elements to examine. |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5923 | (yyval.ValIDVal) = ValID::createUndef(); |
| 5924 | CHECK_FOR_ERROR |
| 5925 | ;} |
| 5926 | break; |
| 5927 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5928 | case 275: |
| 5929 | #line 2651 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5930 | { |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5931 | uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5932 | const Type *ETy = Type::Int8Ty; |
| 5933 | |
| 5934 | ArrayType *ATy = ArrayType::get(ETy, NumElements); |
| 5935 | |
| 5936 | std::vector<Constant*> Vals; |
| 5937 | for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i) |
| 5938 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i])); |
| 5939 | delete (yyvsp[(2) - (2)].StrVal); |
| 5940 | (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals)); |
| 5941 | CHECK_FOR_ERROR |
| 5942 | ;} |
| 5943 | break; |
| 5944 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5945 | case 276: |
| 5946 | #line 2664 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5947 | { |
| 5948 | std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size()); |
| 5949 | for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i) |
| 5950 | Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType(); |
| 5951 | |
| 5952 | const StructType *STy = StructType::get(Elements); |
| 5953 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy)); |
| 5954 | |
| 5955 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector))); |
| 5956 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
| 5957 | CHECK_FOR_ERROR |
| 5958 | ;} |
| 5959 | break; |
| 5960 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5961 | case 277: |
| 5962 | #line 2676 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5963 | { |
| 5964 | const StructType *STy = StructType::get(std::vector<const Type*>()); |
| 5965 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>())); |
| 5966 | CHECK_FOR_ERROR |
| 5967 | ;} |
| 5968 | break; |
| 5969 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5970 | case 278: |
| 5971 | #line 2681 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5972 | { |
| 5973 | std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size()); |
| 5974 | for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i) |
| 5975 | Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType(); |
| 5976 | |
| 5977 | const StructType *STy = StructType::get(Elements, /*isPacked=*/true); |
| 5978 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy)); |
| 5979 | |
| 5980 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector))); |
| 5981 | delete PTy; delete (yyvsp[(3) - (5)].ConstVector); |
| 5982 | CHECK_FOR_ERROR |
| 5983 | ;} |
| 5984 | break; |
| 5985 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5986 | case 279: |
| 5987 | #line 2693 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5988 | { |
| 5989 | const StructType *STy = StructType::get(std::vector<const Type*>(), |
| 5990 | /*isPacked=*/true); |
| 5991 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>())); |
| 5992 | CHECK_FOR_ERROR |
| 5993 | ;} |
| 5994 | break; |
| 5995 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 5996 | case 280: |
| 5997 | #line 2699 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5998 | { |
| 5999 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6000 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6001 | ;} |
| 6002 | break; |
| 6003 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6004 | case 281: |
| 6005 | #line 2703 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6006 | { |
| 6007 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); |
| 6008 | delete (yyvsp[(3) - (5)].StrVal); |
| 6009 | delete (yyvsp[(5) - (5)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6010 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6011 | ;} |
| 6012 | break; |
| 6013 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6014 | case 282: |
| 6015 | #line 2713 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6016 | { // Is it an integer reference...? |
| 6017 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6018 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6019 | ;} |
| 6020 | break; |
| 6021 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6022 | case 283: |
| 6023 | #line 2717 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6024 | { |
| 6025 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6026 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6027 | ;} |
| 6028 | break; |
| 6029 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6030 | case 284: |
| 6031 | #line 2721 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6032 | { // Is it a named reference...? |
| 6033 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); |
| 6034 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6035 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6036 | ;} |
| 6037 | break; |
| 6038 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6039 | case 285: |
| 6040 | #line 2726 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6041 | { // Is it a named reference...? |
| 6042 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); |
| 6043 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6044 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6045 | ;} |
| 6046 | break; |
| 6047 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6048 | case 288: |
| 6049 | #line 2739 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6050 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6051 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6052 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6053 | (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6054 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6055 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6056 | ;} |
| 6057 | break; |
| 6058 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6059 | case 289: |
| 6060 | #line 2748 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6061 | { |
| 6062 | (yyval.ValueList) = new std::vector<Value *>(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6063 | (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6064 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6065 | ;} |
| 6066 | break; |
| 6067 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6068 | case 290: |
| 6069 | #line 2753 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6070 | { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6071 | ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6072 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6073 | ;} |
| 6074 | break; |
| 6075 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6076 | case 291: |
| 6077 | #line 2758 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6078 | { |
| 6079 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6080 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6081 | ;} |
| 6082 | break; |
| 6083 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6084 | case 292: |
| 6085 | #line 2762 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6086 | { // Do not allow functions with 0 basic blocks |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6087 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6088 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6089 | ;} |
| 6090 | break; |
| 6091 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6092 | case 293: |
| 6093 | #line 2771 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6094 | { |
| 6095 | setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6096 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6097 | InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 6098 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 6099 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6100 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6101 | ;} |
| 6102 | break; |
| 6103 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6104 | case 294: |
| 6105 | #line 2780 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6106 | { |
| 6107 | CHECK_FOR_ERROR |
| 6108 | int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 6109 | if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal)) |
| 6110 | GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) + |
| 6111 | " is incorrect, expected %" + utostr((unsigned)ValNum)); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6112 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6113 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 6114 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
| 6115 | CHECK_FOR_ERROR |
| 6116 | ;} |
| 6117 | break; |
| 6118 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6119 | case 295: |
| 6120 | #line 2793 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6121 | { |
| 6122 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6123 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 6124 | if (CI2->getParent() == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6125 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); |
| 6126 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); |
| 6127 | (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 6128 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6129 | ;} |
| 6130 | break; |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6131 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6132 | case 296: |
| 6133 | #line 2802 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6134 | { // Empty space between instruction lists |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 6135 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6136 | CHECK_FOR_ERROR |
| 6137 | ;} |
| 6138 | break; |
| 6139 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6140 | case 297: |
| 6141 | #line 2806 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 6142 | { // Labelled (named) basic block |
| 6143 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); |
| 6144 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6145 | CHECK_FOR_ERROR |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 6146 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6147 | ;} |
| 6148 | break; |
| 6149 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6150 | case 298: |
| 6151 | #line 2814 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6152 | { // Return with a result... |
| 6153 | ValueList &VL = *(yyvsp[(2) - (2)].ValueList); |
| 6154 | assert(!VL.empty() && "Invalid ret operands!"); |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 6155 | const Type *ReturnType = CurFun.CurrentFunction->getReturnType(); |
| 6156 | if (VL.size() > 1 || |
| 6157 | (isa<StructType>(ReturnType) && |
| 6158 | (VL.empty() || VL[0]->getType() != ReturnType))) { |
| 6159 | Value *RV = UndefValue::get(ReturnType); |
| 6160 | for (unsigned i = 0, e = VL.size(); i != e; ++i) { |
| 6161 | Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv"); |
| 6162 | ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I); |
| 6163 | RV = I; |
| 6164 | } |
| 6165 | (yyval.TermInstVal) = ReturnInst::Create(RV); |
| 6166 | } else { |
| 6167 | (yyval.TermInstVal) = ReturnInst::Create(VL[0]); |
| 6168 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6169 | delete (yyvsp[(2) - (2)].ValueList); |
| 6170 | CHECK_FOR_ERROR |
| 6171 | ;} |
| 6172 | break; |
| 6173 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6174 | case 299: |
| 6175 | #line 2834 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6176 | { // Return with no result... |
| 6177 | (yyval.TermInstVal) = ReturnInst::Create(); |
| 6178 | CHECK_FOR_ERROR |
| 6179 | ;} |
| 6180 | break; |
| 6181 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6182 | case 300: |
| 6183 | #line 2838 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6184 | { // Unconditional Branch... |
| 6185 | BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); |
| 6186 | CHECK_FOR_ERROR |
| 6187 | (yyval.TermInstVal) = BranchInst::Create(tmpBB); |
| 6188 | ;} |
| 6189 | break; |
| 6190 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6191 | case 301: |
| 6192 | #line 2843 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6193 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6194 | if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) |
| 6195 | GEN_ERROR("Branch condition must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6196 | BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 6197 | CHECK_FOR_ERROR |
| 6198 | BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); |
| 6199 | CHECK_FOR_ERROR |
| 6200 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); |
| 6201 | CHECK_FOR_ERROR |
| 6202 | (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal); |
| 6203 | ;} |
| 6204 | break; |
| 6205 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6206 | case 302: |
| 6207 | #line 2854 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6208 | { |
| 6209 | Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); |
| 6210 | CHECK_FOR_ERROR |
| 6211 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 6212 | CHECK_FOR_ERROR |
| 6213 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); |
| 6214 | (yyval.TermInstVal) = S; |
| 6215 | |
| 6216 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), |
| 6217 | E = (yyvsp[(8) - (9)].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6218 | for (; I != E; ++I) { |
| 6219 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 6220 | S->addCase(CI, I->second); |
| 6221 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6222 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6223 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6224 | delete (yyvsp[(8) - (9)].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6225 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6226 | ;} |
| 6227 | break; |
| 6228 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6229 | case 303: |
| 6230 | #line 2873 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6231 | { |
| 6232 | Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6233 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6234 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6235 | CHECK_FOR_ERROR |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6236 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6237 | (yyval.TermInstVal) = S; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6238 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6239 | ;} |
| 6240 | break; |
| 6241 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6242 | case 304: |
| 6243 | #line 2883 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6244 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 6245 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6246 | // Handle the short syntax |
| 6247 | const PointerType *PFTy = 0; |
| 6248 | const FunctionType *Ty = 0; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6249 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6250 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6251 | // Pull out the types of all of the arguments... |
| 6252 | std::vector<const Type*> ParamTypes; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6253 | ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6254 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6255 | const Type *Ty = I->Val->getType(); |
| 6256 | if (Ty == Type::VoidTy) |
| 6257 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6258 | ParamTypes.push_back(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6259 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6260 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6261 | if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal))) |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6262 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6263 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6264 | Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6265 | PFTy = PointerType::getUnqual(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6266 | } |
| 6267 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6268 | delete (yyvsp[(4) - (15)].TypeVal); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 6269 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6270 | Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6271 | CHECK_FOR_ERROR |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6272 | BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6273 | CHECK_FOR_ERROR |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6274 | BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 6275 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6276 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6277 | SmallVector<AttributeWithIndex, 8> Attrs; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6278 | //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function |
| 6279 | //attributes. |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6280 | Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes); |
| 6281 | if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) { |
| 6282 | if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6283 | RetAttrs = RetAttrs | Attribute::ZExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6284 | (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6285 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6286 | if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6287 | RetAttrs = RetAttrs | Attribute::SExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6288 | (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6289 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6290 | if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6291 | RetAttrs = RetAttrs | Attribute::InReg; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6292 | (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6293 | } |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6294 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6295 | if (RetAttrs != Attribute::None) |
| 6296 | Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6297 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6298 | // Check the arguments |
| 6299 | ValueList Args; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6300 | if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6301 | // Make sure no arguments is a good thing! |
| 6302 | if (Ty->getNumParams() != 0) |
| 6303 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6304 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6305 | } else { // Has arguments? |
| 6306 | // Loop through FunctionType's arguments and ensure they are specified |
| 6307 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6308 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6309 | FunctionType::param_iterator E = Ty->param_end(); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6310 | ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6311 | unsigned index = 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6312 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6313 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6314 | if (ArgI->Val->getType() != *I) |
| 6315 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6316 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6317 | Args.push_back(ArgI->Val); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6318 | if (ArgI->Attrs != Attribute::None) |
| 6319 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6320 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6321 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6322 | if (Ty->isVarArg()) { |
| 6323 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6324 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6325 | Args.push_back(ArgI->Val); // push the remaining varargs |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6326 | if (ArgI->Attrs != Attribute::None) |
| 6327 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6328 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6329 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6330 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6331 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6332 | if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) |
| 6333 | Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes))); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6334 | AttrListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6335 | if (!Attrs.empty()) |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6336 | PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6337 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6338 | // Create the InvokeInst |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 6339 | InvokeInst *II = InvokeInst::Create(V, Normal, Except, |
| 6340 | Args.begin(), Args.end()); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6341 | II->setCallingConv((yyvsp[(2) - (15)].UIntVal)); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6342 | II->setAttributes(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6343 | (yyval.TermInstVal) = II; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6344 | delete (yyvsp[(7) - (15)].ParamList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6345 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6346 | ;} |
| 6347 | break; |
| 6348 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6349 | case 305: |
| 6350 | #line 2986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6351 | { |
| 6352 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6353 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6354 | ;} |
| 6355 | break; |
| 6356 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6357 | case 306: |
| 6358 | #line 2990 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6359 | { |
| 6360 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6361 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6362 | ;} |
| 6363 | break; |
| 6364 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6365 | case 307: |
| 6366 | #line 2997 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6367 | { |
| 6368 | (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); |
| 6369 | 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] | 6370 | CHECK_FOR_ERROR |
| 6371 | if (V == 0) |
| 6372 | GEN_ERROR("May only switch on a constant pool value"); |
| 6373 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6374 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6375 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6376 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 6377 | ;} |
| 6378 | break; |
| 6379 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6380 | case 308: |
| 6381 | #line 3008 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6382 | { |
| 6383 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 6384 | 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] | 6385 | CHECK_FOR_ERROR |
| 6386 | |
| 6387 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6388 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6389 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6390 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6391 | CHECK_FOR_ERROR |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6392 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6393 | ;} |
| 6394 | break; |
| 6395 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6396 | case 309: |
| 6397 | #line 3021 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6398 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6399 | // Is this definition named?? if so, assign the name... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6400 | setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6401 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6402 | InsertValue((yyvsp[(2) - (2)].InstVal)); |
| 6403 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6404 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6405 | ;} |
| 6406 | break; |
| 6407 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6408 | case 310: |
| 6409 | #line 3030 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6410 | { |
| 6411 | CHECK_FOR_ERROR |
| 6412 | int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal)); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6413 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6414 | if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal)) |
| 6415 | GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) + |
| 6416 | " is incorrect, expected %" + utostr((unsigned)ValNum)); |
| 6417 | |
| 6418 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
| 6419 | CHECK_FOR_ERROR |
| 6420 | ;} |
| 6421 | break; |
| 6422 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6423 | case 311: |
| 6424 | #line 3043 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6425 | { // Used for PHI nodes |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6426 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6427 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); |
| 6428 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 6429 | Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 6430 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6431 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6432 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6433 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6434 | delete (yyvsp[(1) - (6)].TypeVal); |
| 6435 | ;} |
| 6436 | break; |
| 6437 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6438 | case 312: |
| 6439 | #line 3054 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6440 | { |
| 6441 | (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); |
| 6442 | 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] | 6443 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6444 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6445 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6446 | (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6447 | ;} |
| 6448 | break; |
| 6449 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6450 | case 313: |
| 6451 | #line 3064 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6452 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6453 | // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6454 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6455 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6456 | // Used for call and invoke instructions |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6457 | (yyval.ParamList) = new ParamList(); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6458 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6459 | (yyval.ParamList)->push_back(E); |
| 6460 | delete (yyvsp[(1) - (4)].TypeVal); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6461 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6462 | ;} |
| 6463 | break; |
| 6464 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6465 | case 314: |
| 6466 | #line 3075 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6467 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6468 | // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 6469 | // Labels are only valid in ASMs |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6470 | (yyval.ParamList) = new ParamList(); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6471 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6472 | (yyval.ParamList)->push_back(E); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6473 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6474 | ;} |
| 6475 | break; |
| 6476 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6477 | case 315: |
| 6478 | #line 3083 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6479 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6480 | // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6481 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6482 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6483 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6484 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6485 | (yyval.ParamList)->push_back(E); |
| 6486 | delete (yyvsp[(3) - (6)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6487 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6488 | ;} |
| 6489 | break; |
| 6490 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6491 | case 316: |
| 6492 | #line 3093 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6493 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6494 | // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6495 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6496 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6497 | (yyval.ParamList)->push_back(E); |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 6498 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6499 | ;} |
| 6500 | break; |
| 6501 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6502 | case 317: |
| 6503 | #line 3100 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6504 | { (yyval.ParamList) = new ParamList(); ;} |
| 6505 | break; |
| 6506 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6507 | case 318: |
| 6508 | #line 3103 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6509 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 6510 | break; |
| 6511 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6512 | case 319: |
| 6513 | #line 3104 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6514 | { |
| 6515 | (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); |
| 6516 | (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6517 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6518 | ;} |
| 6519 | break; |
| 6520 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6521 | case 320: |
| 6522 | #line 3112 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6523 | { |
| 6524 | (yyval.ConstantList) = new std::vector<unsigned>(); |
| 6525 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
| 6526 | GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6527 | (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val)); |
| 6528 | ;} |
| 6529 | break; |
| 6530 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6531 | case 321: |
| 6532 | #line 3118 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6533 | { |
| 6534 | (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); |
| 6535 | if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) |
| 6536 | GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6537 | (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val)); |
| 6538 | CHECK_FOR_ERROR |
| 6539 | ;} |
| 6540 | break; |
| 6541 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6542 | case 322: |
| 6543 | #line 3127 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6544 | { |
| 6545 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6546 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6547 | ;} |
| 6548 | break; |
| 6549 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6550 | case 323: |
| 6551 | #line 3131 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6552 | { |
| 6553 | (yyval.BoolVal) = false; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6554 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6555 | ;} |
| 6556 | break; |
| 6557 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6558 | case 324: |
| 6559 | #line 3136 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6560 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6561 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6562 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6563 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6564 | !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6565 | GEN_ERROR( |
| 6566 | "Arithmetic operator requires integer, FP, or packed operands"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6567 | Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6568 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6569 | Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6570 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6571 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6572 | if ((yyval.InstVal) == 0) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6573 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6574 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6575 | ;} |
| 6576 | break; |
| 6577 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6578 | case 325: |
| 6579 | #line 3152 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6580 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6581 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6582 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6583 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) { |
Nate Begeman | 5bc1ea0 | 2008-07-29 15:49:41 +0000 | [diff] [blame] | 6584 | if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) || |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6585 | !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6586 | GEN_ERROR("Logical operator requires integral operands"); |
| 6587 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6588 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6589 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6590 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6591 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6592 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6593 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6594 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6595 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6596 | ;} |
| 6597 | break; |
| 6598 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6599 | case 326: |
| 6600 | #line 3169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6601 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6602 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6603 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6604 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6605 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6606 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6607 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6608 | (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] | 6609 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6610 | GEN_ERROR("icmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6611 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6612 | ;} |
| 6613 | break; |
| 6614 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6615 | case 327: |
| 6616 | #line 3181 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6617 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6618 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6619 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6620 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6621 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6622 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6623 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6624 | (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] | 6625 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6626 | GEN_ERROR("fcmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6627 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6628 | ;} |
| 6629 | break; |
| 6630 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6631 | case 328: |
| 6632 | #line 3193 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6633 | { |
| 6634 | if (!UpRefs.empty()) |
| 6635 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6636 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6637 | GEN_ERROR("Scalar types not supported by vicmp instruction"); |
| 6638 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6639 | CHECK_FOR_ERROR |
| 6640 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6641 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6642 | (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] | 6643 | if ((yyval.InstVal) == 0) |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6644 | GEN_ERROR("vicmp operator returned null"); |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6645 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6646 | ;} |
| 6647 | break; |
| 6648 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6649 | case 329: |
| 6650 | #line 3207 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6651 | { |
| 6652 | if (!UpRefs.empty()) |
| 6653 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6654 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6655 | GEN_ERROR("Scalar types not supported by vfcmp instruction"); |
| 6656 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6657 | CHECK_FOR_ERROR |
| 6658 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6659 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6660 | (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] | 6661 | if ((yyval.InstVal) == 0) |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6662 | GEN_ERROR("vfcmp operator returned null"); |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6663 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6664 | ;} |
| 6665 | break; |
| 6666 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6667 | case 330: |
| 6668 | #line 3221 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6669 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6670 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6671 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6672 | Value* Val = (yyvsp[(2) - (4)].ValueVal); |
| 6673 | const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get(); |
| 6674 | if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6675 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 6676 | Val->getType()->getDescription() + "' to '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6677 | DestTy->getDescription() + "'"); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6678 | (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6679 | delete (yyvsp[(4) - (4)].TypeVal); |
| 6680 | ;} |
| 6681 | break; |
| 6682 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6683 | case 331: |
| 6684 | #line 3233 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6685 | { |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6686 | if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) { |
| 6687 | // vector select |
| 6688 | if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType()) |
| 6689 | || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) ) |
| 6690 | GEN_ERROR("vector select value types must be vector types"); |
| 6691 | const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType()); |
| 6692 | const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType()); |
| 6693 | if (cond_type->getElementType() != Type::Int1Ty) |
| 6694 | GEN_ERROR("vector select condition element type must be boolean"); |
| 6695 | if (cond_type->getNumElements() != select_type->getNumElements()) |
| 6696 | GEN_ERROR("vector select number of elements must be the same"); |
| 6697 | } else { |
| 6698 | if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) |
| 6699 | GEN_ERROR("select condition must be boolean"); |
| 6700 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6701 | if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6702 | GEN_ERROR("select value types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6703 | (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] | 6704 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6705 | ;} |
| 6706 | break; |
| 6707 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6708 | case 332: |
| 6709 | #line 3254 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6710 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6711 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6712 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6713 | (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); |
| 6714 | delete (yyvsp[(4) - (4)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6715 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6716 | ;} |
| 6717 | break; |
| 6718 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6719 | case 333: |
| 6720 | #line 3261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6721 | { |
| 6722 | if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6723 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6724 | (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6725 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6726 | ;} |
| 6727 | break; |
| 6728 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6729 | case 334: |
| 6730 | #line 3267 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6731 | { |
| 6732 | 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] | 6733 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6734 | (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] | 6735 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6736 | ;} |
| 6737 | break; |
| 6738 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6739 | case 335: |
| 6740 | #line 3273 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6741 | { |
| 6742 | 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] | 6743 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6744 | (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] | 6745 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6746 | ;} |
| 6747 | break; |
| 6748 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6749 | case 336: |
| 6750 | #line 3279 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6751 | { |
| 6752 | const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6753 | if (!Ty->isFirstClassType()) |
| 6754 | GEN_ERROR("PHI node operands must be of first class type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6755 | (yyval.InstVal) = PHINode::Create(Ty); |
| 6756 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); |
| 6757 | while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6758 | if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6759 | 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] | 6760 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); |
| 6761 | (yyvsp[(2) - (2)].PHIList)->pop_front(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6762 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6763 | delete (yyvsp[(2) - (2)].PHIList); // Free the list... |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6764 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6765 | ;} |
| 6766 | break; |
| 6767 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6768 | case 337: |
| 6769 | #line 3295 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6770 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6771 | |
| 6772 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6773 | const PointerType *PFTy = 0; |
| 6774 | const FunctionType *Ty = 0; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6775 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6776 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6777 | // Pull out the types of all of the arguments... |
| 6778 | std::vector<const Type*> ParamTypes; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6779 | ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6780 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6781 | const Type *Ty = I->Val->getType(); |
| 6782 | if (Ty == Type::VoidTy) |
| 6783 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6784 | ParamTypes.push_back(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6785 | } |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6786 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6787 | if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal))) |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6788 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6789 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6790 | Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6791 | PFTy = PointerType::getUnqual(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6792 | } |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6793 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6794 | Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling... |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6795 | CHECK_FOR_ERROR |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6796 | |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6797 | // Check for call to invalid intrinsic to avoid crashing later. |
| 6798 | if (Function *theF = dyn_cast<Function>(V)) { |
Reid Spencer | ed48de2 | 2007-04-16 22:02:23 +0000 | [diff] [blame] | 6799 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
Reid Spencer | 36fdde1 | 2007-04-16 20:35:38 +0000 | [diff] [blame] | 6800 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 6801 | !theF->getIntrinsicID(true)) |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6802 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 6803 | theF->getName() + "'"); |
| 6804 | } |
| 6805 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6806 | // Set up the Attributes for the function |
| 6807 | SmallVector<AttributeWithIndex, 8> Attrs; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6808 | //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function |
| 6809 | //attributes. |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6810 | Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes); |
| 6811 | if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) { |
| 6812 | if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6813 | RetAttrs = RetAttrs | Attribute::ZExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6814 | (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6815 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6816 | if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6817 | RetAttrs = RetAttrs | Attribute::SExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6818 | (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6819 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6820 | if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6821 | RetAttrs = RetAttrs | Attribute::InReg; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6822 | (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6823 | } |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6824 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6825 | if (RetAttrs != Attribute::None) |
| 6826 | Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6827 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6828 | // Check the arguments |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6829 | ValueList Args; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6830 | if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6831 | // Make sure no arguments is a good thing! |
| 6832 | if (Ty->getNumParams() != 0) |
| 6833 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6834 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6835 | } else { // Has arguments? |
| 6836 | // Loop through FunctionType's arguments and ensure they are specified |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6837 | // correctly. Also, gather any parameter attributes. |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6838 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6839 | FunctionType::param_iterator E = Ty->param_end(); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6840 | ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end(); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6841 | unsigned index = 1; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6842 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6843 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6844 | if (ArgI->Val->getType() != *I) |
| 6845 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6846 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6847 | Args.push_back(ArgI->Val); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6848 | if (ArgI->Attrs != Attribute::None) |
| 6849 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6850 | } |
| 6851 | if (Ty->isVarArg()) { |
| 6852 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6853 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6854 | Args.push_back(ArgI->Val); // push the remaining varargs |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6855 | if (ArgI->Attrs != Attribute::None) |
| 6856 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6857 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6858 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6859 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6860 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6861 | if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) |
| 6862 | Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes))); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6863 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6864 | // Finish off the Attributes and check them |
| 6865 | AttrListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6866 | if (!Attrs.empty()) |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6867 | PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6868 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6869 | // Create the call node |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6870 | CallInst *CI = CallInst::Create(V, Args.begin(), Args.end()); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6871 | CI->setTailCall((yyvsp[(1) - (9)].BoolVal)); |
| 6872 | CI->setCallingConv((yyvsp[(2) - (9)].UIntVal)); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6873 | CI->setAttributes(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6874 | (yyval.InstVal) = CI; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6875 | delete (yyvsp[(7) - (9)].ParamList); |
| 6876 | delete (yyvsp[(4) - (9)].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6877 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6878 | ;} |
| 6879 | break; |
| 6880 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6881 | case 338: |
| 6882 | #line 3404 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6883 | { |
| 6884 | (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6885 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6886 | ;} |
| 6887 | break; |
| 6888 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6889 | case 339: |
| 6890 | #line 3409 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6891 | { |
| 6892 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6893 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6894 | ;} |
| 6895 | break; |
| 6896 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6897 | case 340: |
| 6898 | #line 3413 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6899 | { |
| 6900 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6901 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6902 | ;} |
| 6903 | break; |
| 6904 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6905 | case 341: |
| 6906 | #line 3420 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6907 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6908 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6909 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6910 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6911 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6912 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6913 | ;} |
| 6914 | break; |
| 6915 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6916 | case 342: |
| 6917 | #line 3427 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6918 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6919 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6920 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6921 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6922 | GEN_ERROR("Malloc array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6923 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6924 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6925 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6926 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6927 | ;} |
| 6928 | break; |
| 6929 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6930 | case 343: |
| 6931 | #line 3437 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6932 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6933 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6934 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6935 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6936 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6937 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6938 | ;} |
| 6939 | break; |
| 6940 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6941 | case 344: |
| 6942 | #line 3444 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6943 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6944 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6945 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6946 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6947 | GEN_ERROR("Alloca array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6948 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6949 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6950 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6951 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6952 | ;} |
| 6953 | break; |
| 6954 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6955 | case 345: |
| 6956 | #line 3454 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6957 | { |
| 6958 | if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6959 | GEN_ERROR("Trying to free nonpointer type " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6960 | (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + ""); |
| 6961 | (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6962 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6963 | ;} |
| 6964 | break; |
| 6965 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6966 | case 346: |
| 6967 | #line 3462 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6968 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6969 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6970 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6971 | if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6972 | GEN_ERROR("Can't load from nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6973 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6974 | if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6975 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6976 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6977 | Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6978 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6979 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal)); |
| 6980 | delete (yyvsp[(3) - (5)].TypeVal); |
| 6981 | ;} |
| 6982 | break; |
| 6983 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 6984 | case 347: |
| 6985 | #line 3476 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6986 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6987 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6988 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
| 6989 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6990 | if (!PT) |
| 6991 | GEN_ERROR("Can't store to a nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6992 | (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6993 | const Type *ElTy = PT->getElementType(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6994 | if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType()) |
| 6995 | GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6996 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 6997 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6998 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6999 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7000 | (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
| 7001 | delete (yyvsp[(5) - (7)].TypeVal); |
| 7002 | ;} |
| 7003 | break; |
| 7004 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 7005 | case 348: |
| 7006 | #line 3493 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7007 | { |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 7008 | if (!UpRefs.empty()) |
| 7009 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 7010 | if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get())) |
| 7011 | GEN_ERROR("getresult insn requires an aggregate operand"); |
| 7012 | if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val))) |
| 7013 | GEN_ERROR("Invalid getresult index for type '" + |
| 7014 | (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'"); |
| 7015 | |
| 7016 | Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Devang Patel | 5a97097 | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 7017 | CHECK_FOR_ERROR |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 7018 | (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val)); |
| 7019 | delete (yyvsp[(2) - (5)].TypeVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7020 | ;} |
| 7021 | break; |
| 7022 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 7023 | case 349: |
| 7024 | #line 3507 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7025 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7026 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7027 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 7028 | if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 7029 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7030 | |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 7031 | 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] | 7032 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7033 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 7034 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7035 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7036 | (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 7037 | delete (yyvsp[(2) - (4)].TypeVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7038 | delete (yyvsp[(4) - (4)].ValueList); |
| 7039 | ;} |
| 7040 | break; |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 7041 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 7042 | case 350: |
| 7043 | #line 3522 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7044 | { |
| 7045 | if (!UpRefs.empty()) |
| 7046 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 7047 | if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get())) |
| 7048 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 7049 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7050 | 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] | 7051 | GEN_ERROR("Invalid extractvalue indices for type '" + |
| 7052 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 7053 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
| 7054 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7055 | (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 7056 | delete (yyvsp[(2) - (4)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7057 | delete (yyvsp[(4) - (4)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7058 | ;} |
| 7059 | break; |
| 7060 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 7061 | case 351: |
| 7062 | #line 3537 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7063 | { |
| 7064 | if (!UpRefs.empty()) |
| 7065 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); |
| 7066 | if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get())) |
| 7067 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 7068 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7069 | 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] | 7070 | GEN_ERROR("Invalid insertvalue indices for type '" + |
| 7071 | (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'"); |
| 7072 | Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal)); |
| 7073 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
| 7074 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7075 | (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 7076 | delete (yyvsp[(2) - (7)].TypeVal); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7077 | delete (yyvsp[(5) - (7)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7078 | delete (yyvsp[(7) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7079 | ;} |
| 7080 | break; |
| 7081 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7082 | |
| 7083 | /* Line 1267 of yacc.c. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 7084 | #line 7085 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7085 | default: break; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 7086 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7087 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 7088 | |
| 7089 | YYPOPSTACK (yylen); |
| 7090 | yylen = 0; |
| 7091 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7092 | |
| 7093 | *++yyvsp = yyval; |
| 7094 | |
| 7095 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7096 | /* Now `shift' the result of the reduction. Determine what state |
| 7097 | that goes to, based on the state we popped back to and the rule |
| 7098 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7099 | |
| 7100 | yyn = yyr1[yyn]; |
| 7101 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7102 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 7103 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7104 | yystate = yytable[yystate]; |
| 7105 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7106 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7107 | |
| 7108 | goto yynewstate; |
| 7109 | |
| 7110 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7111 | /*------------------------------------. |
| 7112 | | yyerrlab -- here on detecting error | |
| 7113 | `------------------------------------*/ |
| 7114 | yyerrlab: |
| 7115 | /* If not already recovering from an error, report this error. */ |
| 7116 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7117 | { |
| 7118 | ++yynerrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7119 | #if ! YYERROR_VERBOSE |
| 7120 | yyerror (YY_("syntax error")); |
| 7121 | #else |
| 7122 | { |
| 7123 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 7124 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 7125 | { |
| 7126 | YYSIZE_T yyalloc = 2 * yysize; |
| 7127 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 7128 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 7129 | if (yymsg != yymsgbuf) |
| 7130 | YYSTACK_FREE (yymsg); |
| 7131 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 7132 | if (yymsg) |
| 7133 | yymsg_alloc = yyalloc; |
| 7134 | else |
| 7135 | { |
| 7136 | yymsg = yymsgbuf; |
| 7137 | yymsg_alloc = sizeof yymsgbuf; |
| 7138 | } |
| 7139 | } |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 7140 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7141 | if (0 < yysize && yysize <= yymsg_alloc) |
| 7142 | { |
| 7143 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 7144 | yyerror (yymsg); |
| 7145 | } |
| 7146 | else |
| 7147 | { |
| 7148 | yyerror (YY_("syntax error")); |
| 7149 | if (yysize != 0) |
| 7150 | goto yyexhaustedlab; |
| 7151 | } |
| 7152 | } |
| 7153 | #endif |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7154 | } |
| 7155 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7156 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7157 | |
| 7158 | if (yyerrstatus == 3) |
| 7159 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7160 | /* If just tried and failed to reuse look-ahead token after an |
| 7161 | error, discard it. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7162 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7163 | if (yychar <= YYEOF) |
| 7164 | { |
| 7165 | /* Return failure if at end of input. */ |
| 7166 | if (yychar == YYEOF) |
| 7167 | YYABORT; |
| 7168 | } |
| 7169 | else |
| 7170 | { |
| 7171 | yydestruct ("Error: discarding", |
| 7172 | yytoken, &yylval); |
| 7173 | yychar = YYEMPTY; |
| 7174 | } |
| 7175 | } |
| 7176 | |
| 7177 | /* Else will try to reuse look-ahead token after shifting the error |
| 7178 | token. */ |
| 7179 | goto yyerrlab1; |
| 7180 | |
| 7181 | |
| 7182 | /*---------------------------------------------------. |
| 7183 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 7184 | `---------------------------------------------------*/ |
| 7185 | yyerrorlab: |
| 7186 | |
| 7187 | /* Pacify compilers like GCC when the user code never invokes |
| 7188 | YYERROR and the label yyerrorlab therefore never appears in user |
| 7189 | code. */ |
| 7190 | if (/*CONSTCOND*/ 0) |
| 7191 | goto yyerrorlab; |
| 7192 | |
| 7193 | /* Do not reclaim the symbols of the rule which action triggered |
| 7194 | this YYERROR. */ |
| 7195 | YYPOPSTACK (yylen); |
| 7196 | yylen = 0; |
| 7197 | YY_STACK_PRINT (yyss, yyssp); |
| 7198 | yystate = *yyssp; |
| 7199 | goto yyerrlab1; |
| 7200 | |
| 7201 | |
| 7202 | /*-------------------------------------------------------------. |
| 7203 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 7204 | `-------------------------------------------------------------*/ |
| 7205 | yyerrlab1: |
| 7206 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 7207 | |
| 7208 | for (;;) |
| 7209 | { |
| 7210 | yyn = yypact[yystate]; |
| 7211 | if (yyn != YYPACT_NINF) |
| 7212 | { |
| 7213 | yyn += YYTERROR; |
| 7214 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 7215 | { |
| 7216 | yyn = yytable[yyn]; |
| 7217 | if (0 < yyn) |
| 7218 | break; |
| 7219 | } |
| 7220 | } |
| 7221 | |
| 7222 | /* Pop the current state because it cannot handle the error token. */ |
| 7223 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7224 | YYABORT; |
| 7225 | |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 7226 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7227 | yydestruct ("Error: popping", |
| 7228 | yystos[yystate], yyvsp); |
| 7229 | YYPOPSTACK (1); |
| 7230 | yystate = *yyssp; |
| 7231 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7232 | } |
| 7233 | |
| 7234 | if (yyn == YYFINAL) |
| 7235 | YYACCEPT; |
| 7236 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7237 | *++yyvsp = yylval; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7238 | |
| 7239 | |
| 7240 | /* Shift the error token. */ |
| 7241 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 7242 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7243 | yystate = yyn; |
| 7244 | goto yynewstate; |
| 7245 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 7246 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7247 | /*-------------------------------------. |
| 7248 | | yyacceptlab -- YYACCEPT comes here. | |
| 7249 | `-------------------------------------*/ |
| 7250 | yyacceptlab: |
| 7251 | yyresult = 0; |
| 7252 | goto yyreturn; |
| 7253 | |
| 7254 | /*-----------------------------------. |
| 7255 | | yyabortlab -- YYABORT comes here. | |
| 7256 | `-----------------------------------*/ |
| 7257 | yyabortlab: |
| 7258 | yyresult = 1; |
| 7259 | goto yyreturn; |
| 7260 | |
| 7261 | #ifndef yyoverflow |
| 7262 | /*-------------------------------------------------. |
| 7263 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 7264 | `-------------------------------------------------*/ |
| 7265 | yyexhaustedlab: |
| 7266 | yyerror (YY_("memory exhausted")); |
| 7267 | yyresult = 2; |
| 7268 | /* Fall through. */ |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 7269 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7270 | |
| 7271 | yyreturn: |
| 7272 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 7273 | yydestruct ("Cleanup: discarding lookahead", |
| 7274 | yytoken, &yylval); |
| 7275 | /* Do not reclaim the symbols of the rule which action triggered |
| 7276 | this YYABORT or YYACCEPT. */ |
| 7277 | YYPOPSTACK (yylen); |
| 7278 | YY_STACK_PRINT (yyss, yyssp); |
| 7279 | while (yyssp != yyss) |
| 7280 | { |
| 7281 | yydestruct ("Cleanup: popping", |
| 7282 | yystos[*yyssp], yyvsp); |
| 7283 | YYPOPSTACK (1); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 7284 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7285 | #ifndef yyoverflow |
| 7286 | if (yyss != yyssa) |
| 7287 | YYSTACK_FREE (yyss); |
| 7288 | #endif |
| 7289 | #if YYERROR_VERBOSE |
| 7290 | if (yymsg != yymsgbuf) |
| 7291 | YYSTACK_FREE (yymsg); |
| 7292 | #endif |
| 7293 | /* Make sure YYID is used. */ |
| 7294 | return YYID (yyresult); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7295 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7296 | |
| 7297 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame^] | 7298 | #line 3556 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7299 | |
| 7300 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7301 | // common code from the two 'RunVMAsmParser' functions |
| 7302 | static Module* RunParser(Module * M) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7303 | CurModule.CurrentModule = M; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7304 | // Check to make sure the parser succeeded |
| 7305 | if (yyparse()) { |
| 7306 | if (ParserResult) |
| 7307 | delete ParserResult; |
| 7308 | return 0; |
| 7309 | } |
| 7310 | |
Reid Spencer | 0d60b5a | 2007-03-30 01:37:39 +0000 | [diff] [blame] | 7311 | // Emit an error if there are any unresolved types left. |
| 7312 | if (!CurModule.LateResolveTypes.empty()) { |
| 7313 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 7314 | if (DID.Type == ValID::LocalName) { |
| 7315 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 7316 | } else { |
| 7317 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 7318 | } |
| 7319 | if (ParserResult) |
| 7320 | delete ParserResult; |
| 7321 | return 0; |
| 7322 | } |
| 7323 | |
| 7324 | // Emit an error if there are any unresolved values left. |
| 7325 | if (!CurModule.LateResolveValues.empty()) { |
| 7326 | Value *V = CurModule.LateResolveValues.back(); |
| 7327 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 7328 | CurModule.PlaceHolderInfo.find(V); |
| 7329 | |
| 7330 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 7331 | ValID &DID = I->second.first; |
| 7332 | if (DID.Type == ValID::LocalName) { |
| 7333 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 7334 | } else { |
| 7335 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 7336 | } |
| 7337 | if (ParserResult) |
| 7338 | delete ParserResult; |
| 7339 | return 0; |
| 7340 | } |
| 7341 | } |
| 7342 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7343 | // Check to make sure that parsing produced a result |
| 7344 | if (!ParserResult) |
| 7345 | return 0; |
| 7346 | |
| 7347 | // Reset ParserResult variable while saving its value for the result. |
| 7348 | Module *Result = ParserResult; |
| 7349 | ParserResult = 0; |
| 7350 | |
| 7351 | return Result; |
| 7352 | } |
| 7353 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7354 | void llvm::GenerateError(const std::string &message, int LineNo) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7355 | if (LineNo == -1) LineNo = LLLgetLineNo(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7356 | // TODO: column number in exception |
| 7357 | if (TheParseError) |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7358 | TheParseError->setError(LLLgetFilename(), message, LineNo); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7359 | TriggerError = 1; |
| 7360 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7361 | |
| 7362 | int yyerror(const char *ErrorMsg) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7363 | std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 7364 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7365 | if (yychar != YYEMPTY && yychar != 0) { |
| 7366 | errMsg += " while reading token: '"; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 7367 | errMsg += std::string(LLLgetTokenStart(), |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7368 | LLLgetTokenStart()+LLLgetTokenLength()) + "'"; |
| 7369 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7370 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7371 | return 0; |
| 7372 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7373 | |