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, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 222 | NOCAPTURE = 403, |
| 223 | BYVAL = 404, |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 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, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 232 | NEST = 413, |
| 233 | DEFAULT = 414, |
| 234 | HIDDEN = 415, |
| 235 | PROTECTED = 416 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 236 | }; |
| 237 | #endif |
| 238 | /* Tokens. */ |
| 239 | #define ESINT64VAL 258 |
| 240 | #define EUINT64VAL 259 |
| 241 | #define ESAPINTVAL 260 |
| 242 | #define EUAPINTVAL 261 |
| 243 | #define LOCALVAL_ID 262 |
| 244 | #define GLOBALVAL_ID 263 |
| 245 | #define FPVAL 264 |
| 246 | #define VOID 265 |
| 247 | #define INTTYPE 266 |
| 248 | #define FLOAT 267 |
| 249 | #define DOUBLE 268 |
| 250 | #define X86_FP80 269 |
| 251 | #define FP128 270 |
| 252 | #define PPC_FP128 271 |
| 253 | #define LABEL 272 |
| 254 | #define TYPE 273 |
| 255 | #define LOCALVAR 274 |
| 256 | #define GLOBALVAR 275 |
| 257 | #define LABELSTR 276 |
| 258 | #define STRINGCONSTANT 277 |
| 259 | #define ATSTRINGCONSTANT 278 |
| 260 | #define PCTSTRINGCONSTANT 279 |
| 261 | #define ZEROINITIALIZER 280 |
| 262 | #define TRUETOK 281 |
| 263 | #define FALSETOK 282 |
| 264 | #define BEGINTOK 283 |
| 265 | #define ENDTOK 284 |
| 266 | #define DECLARE 285 |
| 267 | #define DEFINE 286 |
| 268 | #define GLOBAL 287 |
| 269 | #define CONSTANT 288 |
| 270 | #define SECTION 289 |
| 271 | #define ALIAS 290 |
| 272 | #define VOLATILE 291 |
| 273 | #define THREAD_LOCAL 292 |
| 274 | #define TO 293 |
| 275 | #define DOTDOTDOT 294 |
| 276 | #define NULL_TOK 295 |
| 277 | #define UNDEF 296 |
| 278 | #define INTERNAL 297 |
| 279 | #define LINKONCE 298 |
| 280 | #define WEAK 299 |
| 281 | #define APPENDING 300 |
| 282 | #define DLLIMPORT 301 |
| 283 | #define DLLEXPORT 302 |
| 284 | #define EXTERN_WEAK 303 |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 285 | #define COMMON 304 |
| 286 | #define OPAQUE 305 |
| 287 | #define EXTERNAL 306 |
| 288 | #define TARGET 307 |
| 289 | #define TRIPLE 308 |
| 290 | #define ALIGN 309 |
| 291 | #define ADDRSPACE 310 |
| 292 | #define DEPLIBS 311 |
| 293 | #define CALL 312 |
| 294 | #define TAIL 313 |
| 295 | #define ASM_TOK 314 |
| 296 | #define MODULE 315 |
| 297 | #define SIDEEFFECT 316 |
| 298 | #define CC_TOK 317 |
| 299 | #define CCC_TOK 318 |
| 300 | #define FASTCC_TOK 319 |
| 301 | #define COLDCC_TOK 320 |
| 302 | #define X86_STDCALLCC_TOK 321 |
| 303 | #define X86_FASTCALLCC_TOK 322 |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 304 | #define DATALAYOUT 323 |
| 305 | #define RET 324 |
| 306 | #define BR 325 |
| 307 | #define SWITCH 326 |
| 308 | #define INVOKE 327 |
| 309 | #define UNWIND 328 |
| 310 | #define UNREACHABLE 329 |
| 311 | #define ADD 330 |
| 312 | #define SUB 331 |
| 313 | #define MUL 332 |
| 314 | #define UDIV 333 |
| 315 | #define SDIV 334 |
| 316 | #define FDIV 335 |
| 317 | #define UREM 336 |
| 318 | #define SREM 337 |
| 319 | #define FREM 338 |
| 320 | #define AND 339 |
| 321 | #define OR 340 |
| 322 | #define XOR 341 |
| 323 | #define SHL 342 |
| 324 | #define LSHR 343 |
| 325 | #define ASHR 344 |
| 326 | #define ICMP 345 |
| 327 | #define FCMP 346 |
| 328 | #define VICMP 347 |
| 329 | #define VFCMP 348 |
| 330 | #define EQ 349 |
| 331 | #define NE 350 |
| 332 | #define SLT 351 |
| 333 | #define SGT 352 |
| 334 | #define SLE 353 |
| 335 | #define SGE 354 |
| 336 | #define ULT 355 |
| 337 | #define UGT 356 |
| 338 | #define ULE 357 |
| 339 | #define UGE 358 |
| 340 | #define OEQ 359 |
| 341 | #define ONE 360 |
| 342 | #define OLT 361 |
| 343 | #define OGT 362 |
| 344 | #define OLE 363 |
| 345 | #define OGE 364 |
| 346 | #define ORD 365 |
| 347 | #define UNO 366 |
| 348 | #define UEQ 367 |
| 349 | #define UNE 368 |
| 350 | #define MALLOC 369 |
| 351 | #define ALLOCA 370 |
| 352 | #define FREE 371 |
| 353 | #define LOAD 372 |
| 354 | #define STORE 373 |
| 355 | #define GETELEMENTPTR 374 |
| 356 | #define TRUNC 375 |
| 357 | #define ZEXT 376 |
| 358 | #define SEXT 377 |
| 359 | #define FPTRUNC 378 |
| 360 | #define FPEXT 379 |
| 361 | #define BITCAST 380 |
| 362 | #define UITOFP 381 |
| 363 | #define SITOFP 382 |
| 364 | #define FPTOUI 383 |
| 365 | #define FPTOSI 384 |
| 366 | #define INTTOPTR 385 |
| 367 | #define PTRTOINT 386 |
| 368 | #define PHI_TOK 387 |
| 369 | #define SELECT 388 |
| 370 | #define VAARG 389 |
| 371 | #define EXTRACTELEMENT 390 |
| 372 | #define INSERTELEMENT 391 |
| 373 | #define SHUFFLEVECTOR 392 |
| 374 | #define GETRESULT 393 |
| 375 | #define EXTRACTVALUE 394 |
| 376 | #define INSERTVALUE 395 |
| 377 | #define SIGNEXT 396 |
| 378 | #define ZEROEXT 397 |
| 379 | #define NORETURN 398 |
| 380 | #define INREG 399 |
| 381 | #define SRET 400 |
| 382 | #define NOUNWIND 401 |
| 383 | #define NOALIAS 402 |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 384 | #define NOCAPTURE 403 |
| 385 | #define BYVAL 404 |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 386 | #define READNONE 405 |
| 387 | #define READONLY 406 |
| 388 | #define GC 407 |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 389 | #define OPTSIZE 408 |
| 390 | #define NOINLINE 409 |
| 391 | #define ALWAYSINLINE 410 |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 392 | #define SSP 411 |
| 393 | #define SSPREQ 412 |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 394 | #define NEST 413 |
| 395 | #define DEFAULT 414 |
| 396 | #define HIDDEN 415 |
| 397 | #define PROTECTED 416 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | /* Copy the first part of user declarations. */ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 403 | #line 14 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 404 | |
| 405 | #include "ParserInternals.h" |
| 406 | #include "llvm/CallingConv.h" |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 407 | #include "llvm/InlineAsm.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 408 | #include "llvm/Instructions.h" |
| 409 | #include "llvm/Module.h" |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 410 | #include "llvm/ValueSymbolTable.h" |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 411 | #include "llvm/AutoUpgrade.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 412 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 413 | #include "llvm/Support/CommandLine.h" |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 414 | #include "llvm/ADT/SmallVector.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 415 | #include "llvm/ADT/STLExtras.h" |
Chris Lattner | 0019bbe | 2005-11-06 06:46:53 +0000 | [diff] [blame] | 416 | #include "llvm/Support/MathExtras.h" |
Reid Spencer | 481169e | 2006-12-01 00:33:46 +0000 | [diff] [blame] | 417 | #include "llvm/Support/Streams.h" |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 418 | #include <algorithm> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 419 | #include <list> |
Chris Lattner | 8adde28 | 2007-02-11 21:40:10 +0000 | [diff] [blame] | 420 | #include <map> |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 421 | #include <utility> |
| 422 | |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 423 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 424 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 425 | // 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] | 426 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 427 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 428 | // (a goto) to put YACC in error state. Furthermore, several calls to |
Reid Spencer | e4f4759 | 2006-08-18 17:32:55 +0000 | [diff] [blame] | 429 | // GenerateError are made from inside productions and they must simulate the |
| 430 | // previous exception behavior by exiting the production immediately. We have |
| 431 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 432 | // 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] | 433 | // recursive descent parser. |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 434 | static bool TriggerError = false; |
Reid Spencer | f63697d | 2006-10-09 17:36:59 +0000 | [diff] [blame] | 435 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 436 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 437 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 438 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 439 | int yylex(); // declaration" of xxx warnings. |
| 440 | int yyparse(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 441 | using namespace llvm; |
| 442 | |
| 443 | static Module *ParserResult; |
| 444 | |
| 445 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 446 | // relating to upreferences in the input stream. |
| 447 | // |
| 448 | //#define DEBUG_UPREFS 1 |
| 449 | #ifdef DEBUG_UPREFS |
Bill Wendling | e815619 | 2006-12-07 01:30:32 +0000 | [diff] [blame] | 450 | #define UR_OUT(X) cerr << X |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 451 | #else |
| 452 | #define UR_OUT(X) |
| 453 | #endif |
| 454 | |
| 455 | #define YYERROR_VERBOSE 1 |
| 456 | |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 457 | static GlobalVariable *CurGV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 458 | |
| 459 | |
| 460 | // This contains info used when building the body of a function. It is |
| 461 | // destroyed when the function is completed. |
| 462 | // |
| 463 | typedef std::vector<Value *> ValueList; // Numbered defs |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 464 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 465 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 466 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 467 | |
| 468 | static struct PerModuleInfo { |
| 469 | Module *CurrentModule; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 470 | ValueList Values; // Module level numbered definitions |
| 471 | ValueList LateResolveValues; |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 472 | std::vector<PATypeHolder> Types; |
| 473 | std::map<ValID, PATypeHolder> LateResolveTypes; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 474 | |
| 475 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
Chris Lattner | 0ad1970 | 2006-06-21 16:53:00 +0000 | [diff] [blame] | 476 | /// 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] | 477 | /// that we can resolve them later and print error messages as appropriate. |
| 478 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 479 | |
| 480 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 481 | // references to global values. Global values may be referenced before they |
| 482 | // are defined, and if so, the temporary object that they represent is held |
| 483 | // here. This is used for forward references of GlobalValues. |
| 484 | // |
| 485 | typedef std::map<std::pair<const PointerType *, |
| 486 | ValID>, GlobalValue*> GlobalRefsType; |
| 487 | GlobalRefsType GlobalRefs; |
| 488 | |
| 489 | void ModuleDone() { |
| 490 | // If we could not resolve some functions at function compilation time |
| 491 | // (calls to functions before they are defined), resolve them now... Types |
| 492 | // are resolved when the constant pool has been completely parsed. |
| 493 | // |
| 494 | ResolveDefinitions(LateResolveValues); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 495 | if (TriggerError) |
| 496 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 497 | |
| 498 | // Check to make sure that all global value forward references have been |
| 499 | // resolved! |
| 500 | // |
| 501 | if (!GlobalRefs.empty()) { |
| 502 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 503 | |
| 504 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 505 | I != E; ++I) { |
| 506 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 507 | I->first.second.getName() + "\n"; |
| 508 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 509 | GenerateError(UndefinedReferences); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 510 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 511 | } |
| 512 | |
Chandler Carruth | 0220219 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 513 | // Look for intrinsic functions and CallInst that need to be upgraded |
| 514 | for (Module::iterator FI = CurrentModule->begin(), |
| 515 | FE = CurrentModule->end(); FI != FE; ) |
| 516 | UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove |
| 517 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 518 | Values.clear(); // Clear out function local definitions |
| 519 | Types.clear(); |
| 520 | CurrentModule = 0; |
| 521 | } |
| 522 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 523 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 524 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 525 | // If not, just return null. |
| 526 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 527 | // Check to see if there is a forward reference to this global variable... |
| 528 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 529 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 530 | GlobalValue *Ret = 0; |
| 531 | if (I != GlobalRefs.end()) { |
| 532 | Ret = I->second; |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 533 | I->first.second.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 534 | GlobalRefs.erase(I); |
| 535 | } |
| 536 | return Ret; |
| 537 | } |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 538 | |
| 539 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 540 | // If it isn't abstract, its resolved |
| 541 | const Type* Ty = PATy->get(); |
| 542 | if (!Ty->isAbstract()) |
| 543 | return false; |
| 544 | // 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] | 545 | // we don't need to traverse that leg of the type. |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 546 | std::vector<const Type*> WorkList, SeenList; |
| 547 | WorkList.push_back(Ty); |
| 548 | while (!WorkList.empty()) { |
| 549 | const Type* Ty = WorkList.back(); |
| 550 | SeenList.push_back(Ty); |
| 551 | WorkList.pop_back(); |
| 552 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 553 | // Check to see if this is an unresolved type |
| 554 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 555 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 556 | for ( ; I != E; ++I) { |
| 557 | if (I->second.get() == OpTy) |
| 558 | return true; |
| 559 | } |
| 560 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 561 | const Type* TheTy = SeqTy->getElementType(); |
| 562 | if (TheTy->isAbstract() && TheTy != Ty) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 563 | std::vector<const Type*>::iterator I = SeenList.begin(), |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 564 | E = SeenList.end(); |
| 565 | for ( ; I != E; ++I) |
| 566 | if (*I == TheTy) |
| 567 | break; |
| 568 | if (I == E) |
| 569 | WorkList.push_back(TheTy); |
| 570 | } |
| 571 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 572 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 573 | const Type* TheTy = StrTy->getElementType(i); |
| 574 | if (TheTy->isAbstract() && TheTy != Ty) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 575 | std::vector<const Type*>::iterator I = SeenList.begin(), |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 576 | E = SeenList.end(); |
| 577 | for ( ; I != E; ++I) |
| 578 | if (*I == TheTy) |
| 579 | break; |
| 580 | if (I == E) |
| 581 | WorkList.push_back(TheTy); |
| 582 | } |
| 583 | } |
| 584 | } |
| 585 | } |
| 586 | return false; |
| 587 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 588 | } CurModule; |
| 589 | |
| 590 | static struct PerFunctionInfo { |
| 591 | Function *CurrentFunction; // Pointer to current function being created |
| 592 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 593 | ValueList Values; // Keep track of #'d definitions |
| 594 | unsigned NextValNum; |
| 595 | ValueList LateResolveValues; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 596 | bool isDeclare; // Is this function a forward declararation? |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 597 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 598 | GlobalValue::VisibilityTypes Visibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 599 | |
| 600 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 601 | /// track of them here. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 602 | std::map<ValID, BasicBlock*> BBForwardRefs; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 603 | |
| 604 | inline PerFunctionInfo() { |
| 605 | CurrentFunction = 0; |
| 606 | isDeclare = false; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 607 | Linkage = GlobalValue::ExternalLinkage; |
| 608 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 609 | } |
| 610 | |
| 611 | inline void FunctionStart(Function *M) { |
| 612 | CurrentFunction = M; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 613 | NextValNum = 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 614 | } |
| 615 | |
| 616 | void FunctionDone() { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 617 | // Any forward referenced blocks left? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 618 | if (!BBForwardRefs.empty()) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 619 | GenerateError("Undefined reference to label " + |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 620 | BBForwardRefs.begin()->second->getName()); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 621 | return; |
| 622 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 623 | |
| 624 | // Resolve all forward references now. |
| 625 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 626 | |
| 627 | Values.clear(); // Clear out function local definitions |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 628 | BBForwardRefs.clear(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 629 | CurrentFunction = 0; |
| 630 | isDeclare = false; |
Anton Korobeynikov | 43e3aad | 2006-09-14 18:25:26 +0000 | [diff] [blame] | 631 | Linkage = GlobalValue::ExternalLinkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 632 | Visibility = GlobalValue::DefaultVisibility; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 633 | } |
| 634 | } CurFun; // Info for the current function... |
| 635 | |
| 636 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 637 | |
| 638 | |
| 639 | //===----------------------------------------------------------------------===// |
| 640 | // Code to handle definitions of all the types |
| 641 | //===----------------------------------------------------------------------===// |
| 642 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 643 | /// InsertValue - Insert a value into the value table. If it is named, this |
| 644 | /// returns -1, otherwise it returns the slot number for the value. |
| 645 | static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 646 | // Things that have names or are void typed don't get slot numbers |
| 647 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 648 | return -1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 649 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 650 | // In the case of function values, we have to allow for the forward reference |
| 651 | // of basic blocks, which are included in the numbering. Consequently, we keep |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 652 | // track of the next insertion location with NextValNum. When a BB gets |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 653 | // inserted, it could change the size of the CurFun.Values vector. |
| 654 | if (&ValueTab == &CurFun.Values) { |
| 655 | if (ValueTab.size() <= CurFun.NextValNum) |
| 656 | ValueTab.resize(CurFun.NextValNum+1); |
| 657 | ValueTab[CurFun.NextValNum++] = V; |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 658 | return CurFun.NextValNum-1; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 659 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 660 | // For all other lists, its okay to just tack it on the back of the vector. |
| 661 | ValueTab.push_back(V); |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 662 | return ValueTab.size()-1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 666 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 667 | case ValID::LocalID: // Is it a numbered definition? |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 668 | // Module constants occupy the lowest numbered slots... |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 669 | if (D.Num < CurModule.Types.size()) |
| 670 | return CurModule.Types[D.Num]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 671 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 672 | case ValID::LocalName: // Is it a named definition? |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 673 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 674 | D.destroy(); // Free old strdup'd memory... |
| 675 | return N; |
| 676 | } |
| 677 | break; |
| 678 | default: |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 679 | GenerateError("Internal parser error: Invalid symbol type reference"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 680 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | // If we reached here, we referenced either a symbol that we don't know about |
| 684 | // or an id number that hasn't been read yet. We may be referencing something |
| 685 | // forward, so just create an entry to be resolved later and get to it... |
| 686 | // |
| 687 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 688 | |
| 689 | |
| 690 | if (inFunctionScope()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 691 | if (D.Type == ValID::LocalName) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 692 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 693 | return 0; |
| 694 | } else { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 695 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 696 | return 0; |
| 697 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 698 | } |
| 699 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 700 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
Nuno Lopes | f05ff66 | 2008-10-15 11:20:21 +0000 | [diff] [blame] | 701 | if (I != CurModule.LateResolveTypes.end()) { |
| 702 | D.destroy(); |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 703 | return I->second; |
Nuno Lopes | f05ff66 | 2008-10-15 11:20:21 +0000 | [diff] [blame] | 704 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 705 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 706 | Type *Typ = OpaqueType::get(); |
| 707 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 708 | return Typ; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 709 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 710 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 711 | // getExistingVal - Look up the value specified by the provided type and |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 712 | // the provided ValID. If the value exists and has already been defined, return |
| 713 | // it. Otherwise return null. |
| 714 | // |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 715 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 716 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 717 | GenerateError("Functions are not values and " |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 718 | "must be referenced as pointers"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 719 | return 0; |
| 720 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 721 | |
| 722 | switch (D.Type) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 723 | case ValID::LocalID: { // Is it a numbered definition? |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 724 | // Check that the number is within bounds. |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 725 | if (D.Num >= CurFun.Values.size()) |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 726 | return 0; |
| 727 | Value *Result = CurFun.Values[D.Num]; |
| 728 | if (Ty != Result->getType()) { |
| 729 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 730 | Result->getType()->getDescription() + "' does not match " |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 731 | "expected type, '" + Ty->getDescription() + "'"); |
| 732 | return 0; |
| 733 | } |
| 734 | return Result; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 735 | } |
| 736 | case ValID::GlobalID: { // Is it a numbered definition? |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 737 | if (D.Num >= CurModule.Values.size()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 738 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 739 | Value *Result = CurModule.Values[D.Num]; |
| 740 | if (Ty != Result->getType()) { |
| 741 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 742 | Result->getType()->getDescription() + "' does not match " |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 743 | "expected type, '" + Ty->getDescription() + "'"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 744 | return 0; |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 745 | } |
| 746 | return Result; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 747 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 748 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 749 | case ValID::LocalName: { // Is it a named definition? |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 750 | if (!inFunctionScope()) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 751 | return 0; |
| 752 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 753 | Value *N = SymTab.lookup(D.getName()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 754 | if (N == 0) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 755 | return 0; |
| 756 | if (N->getType() != Ty) |
| 757 | return 0; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 758 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 759 | D.destroy(); // Free old strdup'd memory... |
| 760 | return N; |
| 761 | } |
| 762 | case ValID::GlobalName: { // Is it a named definition? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 763 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 764 | Value *N = SymTab.lookup(D.getName()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 765 | if (N == 0) |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 766 | return 0; |
| 767 | if (N->getType() != Ty) |
| 768 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 769 | |
| 770 | D.destroy(); // Free old strdup'd memory... |
| 771 | return N; |
| 772 | } |
| 773 | |
| 774 | // Check to make sure that "Ty" is an integral type, and that our |
| 775 | // value will fit into the specified type... |
| 776 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 777 | if (!isa<IntegerType>(Ty) || |
| 778 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 779 | GenerateError("Signed integral constant '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 780 | itostr(D.ConstPool64) + "' is invalid for type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 781 | Ty->getDescription() + "'"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 782 | return 0; |
| 783 | } |
Reid Spencer | 49d273e | 2007-03-19 20:40:51 +0000 | [diff] [blame] | 784 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 785 | |
| 786 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 787 | if (isa<IntegerType>(Ty) && |
| 788 | ConstantInt::isValueValidForType(Ty, D.UConstPool64)) |
Reid Spencer | b83eb64 | 2006-10-20 07:07:24 +0000 | [diff] [blame] | 789 | return ConstantInt::get(Ty, D.UConstPool64); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 790 | |
| 791 | if (!isa<IntegerType>(Ty) || |
| 792 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
| 793 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
| 794 | "' is invalid or out of range for type '" + |
| 795 | Ty->getDescription() + "'"); |
| 796 | return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 797 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 798 | // This is really a signed reference. Transmogrify. |
| 799 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 800 | |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 801 | case ValID::ConstAPInt: // Is it an unsigned const pool reference? |
| 802 | if (!isa<IntegerType>(Ty)) { |
| 803 | GenerateError("Integral constant '" + D.getName() + |
| 804 | "' is invalid or out of range for type '" + |
| 805 | Ty->getDescription() + "'"); |
| 806 | return 0; |
| 807 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 808 | |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 809 | { |
| 810 | APSInt Tmp = *D.ConstPoolInt; |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 811 | D.destroy(); |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 812 | Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits()); |
| 813 | return ConstantInt::get(Tmp); |
| 814 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 815 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 816 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 817 | if (!Ty->isFloatingPoint() || |
| 818 | !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 819 | GenerateError("FP constant invalid for type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 820 | return 0; |
| 821 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 822 | // 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] | 823 | // as double. Fix this here. Long double does not need this. |
| 824 | if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && |
Dale Johannesen | 236bbd4 | 2008-10-09 23:01:34 +0000 | [diff] [blame] | 825 | Ty==Type::FloatTy) { |
| 826 | bool ignored; |
| 827 | D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, |
| 828 | &ignored); |
| 829 | } |
Nuno Lopes | aa386d0 | 2008-11-04 14:43:20 +0000 | [diff] [blame] | 830 | { |
| 831 | ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP); |
| 832 | D.destroy(); |
| 833 | return tmp; |
| 834 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 835 | |
| 836 | case ValID::ConstNullVal: // Is it a null value? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 837 | if (!isa<PointerType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 838 | GenerateError("Cannot create a a non pointer null"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 839 | return 0; |
| 840 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 841 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 842 | |
| 843 | case ValID::ConstUndefVal: // Is it an undef value? |
| 844 | return UndefValue::get(Ty); |
| 845 | |
Chris Lattner | 7aa6189 | 2005-12-21 17:53:23 +0000 | [diff] [blame] | 846 | case ValID::ConstZeroVal: // Is it a zero value? |
| 847 | return Constant::getNullValue(Ty); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 848 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 849 | case ValID::ConstantVal: // Fully resolved constant? |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 850 | if (D.ConstantValue->getType() != Ty) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 851 | GenerateError("Constant expression type different from required type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 852 | return 0; |
| 853 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 854 | return D.ConstantValue; |
| 855 | |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 856 | case ValID::InlineAsmVal: { // Inline asm expression |
| 857 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 858 | const FunctionType *FTy = |
| 859 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 860 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 861 | GenerateError("Invalid type for asm constraint string"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 862 | return 0; |
| 863 | } |
Chris Lattner | 0e9c376 | 2006-01-25 22:27:16 +0000 | [diff] [blame] | 864 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 865 | D.IAD->HasSideEffects); |
| 866 | D.destroy(); // Free InlineAsmDescriptor. |
| 867 | return IA; |
| 868 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 869 | default: |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 870 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 871 | return 0; |
| 872 | } // End of switch |
| 873 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 874 | assert(0 && "Unhandled case!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 875 | return 0; |
| 876 | } |
| 877 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 878 | // getVal - This function is identical to getExistingVal, except that if a |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 879 | // value is not already defined, it "improvises" by creating a placeholder var |
| 880 | // that looks and acts just like the requested variable. When the value is |
| 881 | // defined later, all uses of the placeholder variable are replaced with the |
| 882 | // real thing. |
| 883 | // |
| 884 | static Value *getVal(const Type *Ty, const ValID &ID) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 885 | if (Ty == Type::LabelTy) { |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 886 | GenerateError("Cannot use a basic block here"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 887 | return 0; |
| 888 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 889 | |
| 890 | // See if the value has already been defined. |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 891 | Value *V = getExistingVal(Ty, ID); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 892 | if (V) return V; |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 893 | if (TriggerError) return 0; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 894 | |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 895 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 896 | GenerateError("Invalid use of a non-first-class type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 897 | return 0; |
| 898 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 899 | |
| 900 | // If we reached here, we referenced either a symbol that we don't know about |
| 901 | // or an id number that hasn't been read yet. We may be referencing something |
| 902 | // forward, so just create an entry to be resolved later and get to it... |
| 903 | // |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 904 | switch (ID.Type) { |
| 905 | case ValID::GlobalName: |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 906 | case ValID::GlobalID: { |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 907 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 908 | if (!PTy) { |
| 909 | GenerateError("Invalid type for reference to global" ); |
| 910 | return 0; |
| 911 | } |
| 912 | const Type* ElTy = PTy->getElementType(); |
| 913 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 914 | V = Function::Create(FTy, GlobalValue::ExternalLinkage); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 915 | else |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 916 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", |
| 917 | (Module*)0, false, PTy->getAddressSpace()); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 918 | break; |
Reid Spencer | 9c9b63a | 2007-04-28 16:07:31 +0000 | [diff] [blame] | 919 | } |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 920 | default: |
| 921 | V = new Argument(Ty); |
| 922 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 923 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 924 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 925 | // to recycle these things?? |
| 926 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 927 | LLLgetLineNo()))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 928 | |
| 929 | if (inFunctionScope()) |
| 930 | InsertValue(V, CurFun.LateResolveValues); |
| 931 | else |
| 932 | InsertValue(V, CurModule.LateResolveValues); |
| 933 | return V; |
| 934 | } |
| 935 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 936 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 937 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 938 | static BasicBlock *defineBBVal(const ValID &ID) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 939 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 940 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 941 | BasicBlock *BB = 0; |
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 | // First, see if this was forward referenced |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 944 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 945 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 946 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 947 | BB = BBI->second; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 948 | // The forward declaration could have been inserted anywhere in the |
| 949 | // function: insert it into the correct place now. |
| 950 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 951 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 952 | |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 953 | // We're about to erase the entry, save the key so we can clean it up. |
| 954 | ValID Tmp = BBI->first; |
| 955 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 956 | // Erase the forward ref from the map as its no longer "forward" |
| 957 | CurFun.BBForwardRefs.erase(ID); |
| 958 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 959 | // 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] | 960 | // strdup'd memory around so destroy it too. |
| 961 | Tmp.destroy(); |
| 962 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 963 | // If its a numbered definition, bump the number and set the BB value. |
| 964 | if (ID.Type == ValID::LocalID) { |
| 965 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 966 | InsertValue(BB); |
| 967 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 968 | } else { |
| 969 | // 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] | 970 | // Just create it and return it. |
| 971 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 972 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 973 | if (ID.Type == ValID::LocalID) { |
| 974 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 975 | InsertValue(BB); |
| 976 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 977 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 978 | |
Devang Patel | 6790943 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 979 | ID.destroy(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 980 | return BB; |
| 981 | } |
| 982 | |
| 983 | /// 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] | 984 | /// |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 985 | static BasicBlock *getBBVal(const ValID &ID) { |
| 986 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 987 | |
| 988 | BasicBlock *BB = 0; |
| 989 | |
| 990 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 991 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 992 | BB = BBI->second; |
| 993 | } if (ID.Type == ValID::LocalName) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 994 | std::string Name = ID.getName(); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 995 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 996 | if (N) { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 997 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 998 | BB = cast<BasicBlock>(N); |
| 999 | else |
| 1000 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 1001 | N->getType()->getDescription() + "'"); |
Anton Korobeynikov | c70d773 | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 1002 | } |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1003 | } else if (ID.Type == ValID::LocalID) { |
| 1004 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 1005 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 1006 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 1007 | else |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1008 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 1009 | "' is actually of type '"+ |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1010 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 1011 | } |
| 1012 | } else { |
| 1013 | GenerateError("Illegal label reference " + ID.getName()); |
| 1014 | return 0; |
| 1015 | } |
| 1016 | |
| 1017 | // If its already been defined, return it now. |
| 1018 | if (BB) { |
| 1019 | ID.destroy(); // Free strdup'd memory. |
| 1020 | return BB; |
| 1021 | } |
| 1022 | |
| 1023 | // Otherwise, this block has not been seen before, create it. |
| 1024 | std::string Name; |
| 1025 | if (ID.Type == ValID::LocalName) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1026 | Name = ID.getName(); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 1027 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1028 | |
| 1029 | // Insert it in the forward refs map. |
| 1030 | CurFun.BBForwardRefs[ID] = BB; |
| 1031 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1032 | return BB; |
| 1033 | } |
| 1034 | |
| 1035 | |
| 1036 | //===----------------------------------------------------------------------===// |
| 1037 | // Code to handle forward references in instructions |
| 1038 | //===----------------------------------------------------------------------===// |
| 1039 | // |
| 1040 | // This code handles the late binding needed with statements that reference |
| 1041 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 1042 | // a loop body. |
| 1043 | // |
| 1044 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 1045 | // and back patchs after we are done. |
| 1046 | // |
| 1047 | |
| 1048 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 1049 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 1050 | // defs now... |
| 1051 | // |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1052 | static void |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1053 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1054 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1055 | while (!LateResolvers.empty()) { |
| 1056 | Value *V = LateResolvers.back(); |
| 1057 | LateResolvers.pop_back(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1058 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1059 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 1060 | CurModule.PlaceHolderInfo.find(V); |
| 1061 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
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 | ValID &DID = PHI->second.first; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1064 | |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1065 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 1066 | if (TriggerError) |
| 1067 | return; |
| 1068 | if (TheRealValue) { |
| 1069 | V->replaceAllUsesWith(TheRealValue); |
| 1070 | delete V; |
| 1071 | CurModule.PlaceHolderInfo.erase(PHI); |
| 1072 | } else if (FutureLateResolvers) { |
| 1073 | // Functions have their unresolved items forwarded to the module late |
| 1074 | // resolver table |
| 1075 | InsertValue(V, *FutureLateResolvers); |
| 1076 | } else { |
| 1077 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 1078 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 1079 | "' of type '" + V->getType()->getDescription() + "'", |
| 1080 | PHI->second.second); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1081 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1082 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1083 | GenerateError("Reference to an invalid definition: #" + |
| 1084 | itostr(DID.Num) + " of type '" + |
| 1085 | V->getType()->getDescription() + "'", |
| 1086 | PHI->second.second); |
| 1087 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1088 | } |
| 1089 | } |
| 1090 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1091 | LateResolvers.clear(); |
| 1092 | } |
| 1093 | |
| 1094 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 1095 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 1096 | // refering to the number can be resolved. Do this now. |
| 1097 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1098 | static void ResolveTypeTo(std::string *Name, const Type *ToTy) { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1099 | ValID D; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1100 | if (Name) |
| 1101 | D = ValID::createLocalName(*Name); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1102 | else |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1103 | D = ValID::createLocalID(CurModule.Types.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1104 | |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1105 | std::map<ValID, PATypeHolder>::iterator I = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1106 | CurModule.LateResolveTypes.find(D); |
| 1107 | if (I != CurModule.LateResolveTypes.end()) { |
Reid Spencer | 861d9d6 | 2006-11-28 07:29:44 +0000 | [diff] [blame] | 1108 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
Nuno Lopes | 6ec8a25 | 2008-10-15 11:11:12 +0000 | [diff] [blame] | 1109 | I->first.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1110 | CurModule.LateResolveTypes.erase(I); |
| 1111 | } |
Nuno Lopes | 191dfb9 | 2008-10-03 15:52:39 +0000 | [diff] [blame] | 1112 | D.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1113 | } |
| 1114 | |
| 1115 | // setValueName - Set the specified value to the name given. The name may be |
| 1116 | // null potentially, in which case this is a noop. The string passed in is |
| 1117 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1118 | // |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1119 | static void setValueName(Value *V, std::string *NameStr) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1120 | if (!NameStr) return; |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1121 | std::string Name(*NameStr); // Copy string |
| 1122 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1123 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1124 | if (V->getType() == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1125 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1126 | return; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1127 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1128 | |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1129 | assert(inFunctionScope() && "Must be in function scope!"); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1130 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1131 | if (ST.lookup(Name)) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1132 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1133 | V->getType()->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 1134 | return; |
| 1135 | } |
| 1136 | |
| 1137 | // Set the name. |
| 1138 | V->setName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1139 | } |
| 1140 | |
| 1141 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1142 | /// this is a declaration, otherwise it is a definition. |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1143 | static GlobalVariable * |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1144 | ParseGlobalVariable(std::string *NameStr, |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1145 | GlobalValue::LinkageTypes Linkage, |
| 1146 | GlobalValue::VisibilityTypes Visibility, |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1147 | bool isConstantGlobal, const Type *Ty, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1148 | Constant *Initializer, bool IsThreadLocal, |
| 1149 | unsigned AddressSpace = 0) { |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1150 | if (isa<FunctionType>(Ty)) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1151 | GenerateError("Cannot declare global vars of function type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1152 | return 0; |
| 1153 | } |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1154 | if (Ty == Type::LabelTy) { |
| 1155 | GenerateError("Cannot declare global vars of label type"); |
| 1156 | return 0; |
| 1157 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1158 | |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1159 | const PointerType *PTy = PointerType::get(Ty, AddressSpace); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1160 | |
| 1161 | std::string Name; |
| 1162 | if (NameStr) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1163 | Name = *NameStr; // Copy string |
| 1164 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1165 | } |
| 1166 | |
| 1167 | // See if this global value was forward referenced. If so, recycle the |
| 1168 | // object. |
| 1169 | ValID ID; |
| 1170 | if (!Name.empty()) { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1171 | ID = ValID::createGlobalName(Name); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1172 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 1173 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1174 | } |
| 1175 | |
| 1176 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1177 | // Move the global to the end of the list, from whereever it was |
| 1178 | // previously inserted. |
| 1179 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1180 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1181 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1182 | GV->setInitializer(Initializer); |
| 1183 | GV->setLinkage(Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1184 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1185 | GV->setConstant(isConstantGlobal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 1186 | GV->setThreadLocal(IsThreadLocal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1187 | InsertValue(GV, CurModule.Values); |
Nuno Lopes | 191dfb9 | 2008-10-03 15:52:39 +0000 | [diff] [blame] | 1188 | ID.destroy(); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1189 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1190 | } |
| 1191 | |
Nuno Lopes | 191dfb9 | 2008-10-03 15:52:39 +0000 | [diff] [blame] | 1192 | ID.destroy(); |
| 1193 | |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1194 | // If this global has a name |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1195 | if (!Name.empty()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 1196 | // if the global we're parsing has an initializer (is a definition) and |
| 1197 | // has external linkage. |
| 1198 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1199 | // If there is already a global with external linkage with this name |
| 1200 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1201 | // If we allow this GVar to get created, it will be renamed in the |
| 1202 | // symbol table because it conflicts with an existing GVar. We can't |
| 1203 | // allow redefinition of GVars whose linking indicates that their name |
| 1204 | // must stay the same. Issue the error. |
| 1205 | GenerateError("Redefinition of global variable named '" + Name + |
| 1206 | "' of type '" + Ty->getDescription() + "'"); |
| 1207 | return 0; |
| 1208 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1209 | } |
| 1210 | |
| 1211 | // Otherwise there is no existing GV to use, create one now. |
| 1212 | GlobalVariable *GV = |
| 1213 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1214 | CurModule.CurrentModule, IsThreadLocal, AddressSpace); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1215 | GV->setVisibility(Visibility); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1216 | InsertValue(GV, CurModule.Values); |
Chris Lattner | b475c42 | 2005-11-12 18:22:38 +0000 | [diff] [blame] | 1217 | return GV; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1218 | } |
| 1219 | |
| 1220 | // setTypeName - Set the specified type to the name given. The name may be |
| 1221 | // null potentially, in which case this is a noop. The string passed in is |
| 1222 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1223 | // |
| 1224 | // This function returns true if the type has already been defined, but is |
| 1225 | // allowed to be redefined in the specified context. If the name is a new name |
| 1226 | // for the type plane, it is inserted and false is returned. |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1227 | static bool setTypeName(const Type *T, std::string *NameStr) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1228 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1229 | if (NameStr == 0) return false; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1230 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1231 | std::string Name(*NameStr); // Copy string |
| 1232 | delete NameStr; // Free old string |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1233 | |
| 1234 | // We don't allow assigning names to void type |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1235 | if (T == Type::VoidTy) { |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1236 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 1237 | return false; |
| 1238 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1239 | |
| 1240 | // Set the type name, checking for conflicts as we do so. |
| 1241 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1242 | |
| 1243 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1244 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 1245 | assert(Existing && "Conflict but no matching type?!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1246 | |
| 1247 | // There is only one case where this is allowed: when we are refining an |
| 1248 | // opaque type. In this case, Existing will be an opaque type. |
| 1249 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1250 | // We ARE replacing an opaque type! |
| 1251 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1252 | return true; |
| 1253 | } |
| 1254 | |
| 1255 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1256 | // the redefinition is identical to the original. This will be so if |
| 1257 | // Existing and T point to the same Type object. In this one case we |
| 1258 | // allow the equivalent redefinition. |
| 1259 | if (Existing == T) return true; // Yes, it's equal. |
| 1260 | |
| 1261 | // Any other kind of (non-equivalent) redefinition is an error. |
Reid Spencer | 63c3445 | 2007-01-05 21:51:07 +0000 | [diff] [blame] | 1262 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 1263 | T->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1264 | } |
| 1265 | |
| 1266 | return false; |
| 1267 | } |
| 1268 | |
| 1269 | //===----------------------------------------------------------------------===// |
| 1270 | // Code for handling upreferences in type names... |
| 1271 | // |
| 1272 | |
| 1273 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1274 | // |
| 1275 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1276 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1277 | E) != Ty->subtype_end(); |
| 1278 | } |
| 1279 | |
| 1280 | namespace { |
| 1281 | struct UpRefRecord { |
| 1282 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1283 | // this type is resolved. |
| 1284 | unsigned NestingLevel; |
| 1285 | |
| 1286 | // LastContainedTy - This is the type at the current binding level for the |
| 1287 | // type. Every time we reduce the nesting level, this gets updated. |
| 1288 | const Type *LastContainedTy; |
| 1289 | |
| 1290 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1291 | // represented with. |
| 1292 | OpaqueType *UpRefTy; |
| 1293 | |
| 1294 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1295 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1296 | }; |
| 1297 | } |
| 1298 | |
| 1299 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1300 | static std::vector<UpRefRecord> UpRefs; |
| 1301 | |
| 1302 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1303 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1304 | /// currently active types. For each type, if the up reference is contained in |
| 1305 | /// the newly completed type, we decrement the level count. When the level |
| 1306 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1307 | /// thus we can complete the cycle. |
| 1308 | /// |
| 1309 | static PATypeHolder HandleUpRefs(const Type *ty) { |
Chris Lattner | 224f84f | 2006-08-18 17:34:45 +0000 | [diff] [blame] | 1310 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1311 | // nothing to resolve here. |
| 1312 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 1313 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1314 | PATypeHolder Ty(ty); |
| 1315 | UR_OUT("Type '" << Ty->getDescription() << |
| 1316 | "' newly formed. Resolving upreferences.\n" << |
| 1317 | UpRefs.size() << " upreferences active!\n"); |
| 1318 | |
| 1319 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1320 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1321 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1322 | // this variable. |
| 1323 | OpaqueType *TypeToResolve = 0; |
| 1324 | |
| 1325 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1326 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1327 | << UpRefs[i].second->getDescription() << ") = " |
| 1328 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1329 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1330 | // Decrement level of upreference |
| 1331 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1332 | UpRefs[i].LastContainedTy = Ty; |
| 1333 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1334 | if (Level == 0) { // Upreference should be resolved! |
| 1335 | if (!TypeToResolve) { |
| 1336 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1337 | } else { |
| 1338 | UR_OUT(" * Resolving upreference for " |
| 1339 | << UpRefs[i].second->getDescription() << "\n"; |
| 1340 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1341 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1342 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1343 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1344 | } |
| 1345 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1346 | --i; // Do not skip the next element... |
| 1347 | } |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | if (TypeToResolve) { |
| 1352 | UR_OUT(" * Resolving upreference for " |
| 1353 | << UpRefs[i].second->getDescription() << "\n"; |
| 1354 | std::string OldName = TypeToResolve->getDescription()); |
| 1355 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1356 | } |
| 1357 | |
| 1358 | return Ty; |
| 1359 | } |
| 1360 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1361 | //===----------------------------------------------------------------------===// |
| 1362 | // RunVMAsmParser - Define an interface to this parser |
| 1363 | //===----------------------------------------------------------------------===// |
| 1364 | // |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1365 | static Module* RunParser(Module * M); |
| 1366 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 1367 | Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { |
| 1368 | InitLLLexer(MB); |
| 1369 | Module *M = RunParser(new Module(LLLgetFilename())); |
| 1370 | FreeLexer(); |
| 1371 | return M; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1372 | } |
| 1373 | |
| 1374 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1375 | |
| 1376 | /* Enabling traces. */ |
| 1377 | #ifndef YYDEBUG |
| 1378 | # define YYDEBUG 0 |
| 1379 | #endif |
| 1380 | |
| 1381 | /* Enabling verbose error messages. */ |
| 1382 | #ifdef YYERROR_VERBOSE |
| 1383 | # undef YYERROR_VERBOSE |
| 1384 | # define YYERROR_VERBOSE 1 |
| 1385 | #else |
| 1386 | # define YYERROR_VERBOSE 0 |
| 1387 | #endif |
| 1388 | |
| 1389 | /* Enabling the token table. */ |
| 1390 | #ifndef YYTOKEN_TABLE |
| 1391 | # define YYTOKEN_TABLE 0 |
| 1392 | #endif |
| 1393 | |
| 1394 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 1395 | typedef union YYSTYPE |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 1396 | #line 986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1397 | { |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1398 | llvm::Module *ModuleVal; |
| 1399 | llvm::Function *FunctionVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1400 | llvm::BasicBlock *BasicBlockVal; |
| 1401 | llvm::TerminatorInst *TermInstVal; |
| 1402 | llvm::Instruction *InstVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1403 | llvm::Constant *ConstVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1404 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1405 | const llvm::Type *PrimType; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1406 | std::list<llvm::PATypeHolder> *TypeList; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1407 | llvm::PATypeHolder *TypeVal; |
| 1408 | llvm::Value *ValueVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1409 | std::vector<llvm::Value*> *ValueList; |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 1410 | std::vector<unsigned> *ConstantList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1411 | llvm::ArgListType *ArgList; |
| 1412 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1413 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 1414 | llvm::ParamList *ParamList; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 1415 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1416 | // Represent the RHS of PHI node |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1417 | std::list<std::pair<llvm::Value*, |
| 1418 | llvm::BasicBlock*> > *PHIList; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1419 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1420 | std::vector<llvm::Constant*> *ConstVector; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1421 | |
| 1422 | llvm::GlobalValue::LinkageTypes Linkage; |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 1423 | llvm::GlobalValue::VisibilityTypes Visibility; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 1424 | llvm::Attributes Attributes; |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 1425 | llvm::APInt *APIntVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1426 | int64_t SInt64Val; |
| 1427 | uint64_t UInt64Val; |
| 1428 | int SIntVal; |
| 1429 | unsigned UIntVal; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 1430 | llvm::APFloat *FPVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1431 | bool BoolVal; |
| 1432 | |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 1433 | std::string *StrVal; // This memory must be deleted |
| 1434 | llvm::ValID ValIDVal; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1435 | |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1436 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1437 | llvm::Instruction::TermOps TermOpVal; |
| 1438 | llvm::Instruction::MemoryOps MemOpVal; |
| 1439 | llvm::Instruction::CastOps CastOpVal; |
| 1440 | llvm::Instruction::OtherOps OtherOpVal; |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 1441 | llvm::ICmpInst::Predicate IPredicate; |
| 1442 | llvm::FCmpInst::Predicate FPredicate; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1443 | } |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 1444 | /* Line 187 of yacc.c. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1445 | #line 1446 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1446 | YYSTYPE; |
| 1447 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1448 | # define YYSTYPE_IS_DECLARED 1 |
| 1449 | # define YYSTYPE_IS_TRIVIAL 1 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1450 | #endif |
| 1451 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1452 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1453 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1454 | /* Copy the second part of user declarations. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 1455 | |
| 1456 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1457 | /* Line 216 of yacc.c. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1458 | #line 1459 "llvmAsmParser.tab.c" |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1459 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1460 | #ifdef short |
| 1461 | # undef short |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1462 | #endif |
| 1463 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1464 | #ifdef YYTYPE_UINT8 |
| 1465 | typedef YYTYPE_UINT8 yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1466 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1467 | typedef unsigned char yytype_uint8; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 1468 | #endif |
| 1469 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1470 | #ifdef YYTYPE_INT8 |
| 1471 | typedef YYTYPE_INT8 yytype_int8; |
| 1472 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 1473 | || defined __cplusplus || defined _MSC_VER) |
| 1474 | typedef signed char yytype_int8; |
| 1475 | #else |
| 1476 | typedef short int yytype_int8; |
| 1477 | #endif |
| 1478 | |
| 1479 | #ifdef YYTYPE_UINT16 |
| 1480 | typedef YYTYPE_UINT16 yytype_uint16; |
| 1481 | #else |
| 1482 | typedef unsigned short int yytype_uint16; |
| 1483 | #endif |
| 1484 | |
| 1485 | #ifdef YYTYPE_INT16 |
| 1486 | typedef YYTYPE_INT16 yytype_int16; |
| 1487 | #else |
| 1488 | typedef short int yytype_int16; |
| 1489 | #endif |
| 1490 | |
| 1491 | #ifndef YYSIZE_T |
| 1492 | # ifdef __SIZE_TYPE__ |
| 1493 | # define YYSIZE_T __SIZE_TYPE__ |
| 1494 | # elif defined size_t |
| 1495 | # define YYSIZE_T size_t |
| 1496 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1497 | || defined __cplusplus || defined _MSC_VER) |
| 1498 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1499 | # define YYSIZE_T size_t |
| 1500 | # else |
| 1501 | # define YYSIZE_T unsigned int |
| 1502 | # endif |
| 1503 | #endif |
| 1504 | |
| 1505 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 1506 | |
| 1507 | #ifndef YY_ |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 1508 | # if YYENABLE_NLS |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1509 | # if ENABLE_NLS |
| 1510 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1511 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1512 | # endif |
| 1513 | # endif |
| 1514 | # ifndef YY_ |
| 1515 | # define YY_(msgid) msgid |
| 1516 | # endif |
| 1517 | #endif |
| 1518 | |
| 1519 | /* Suppress unused-variable warnings by "using" E. */ |
| 1520 | #if ! defined lint || defined __GNUC__ |
| 1521 | # define YYUSE(e) ((void) (e)) |
| 1522 | #else |
| 1523 | # define YYUSE(e) /* empty */ |
| 1524 | #endif |
| 1525 | |
| 1526 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 1527 | #ifndef lint |
| 1528 | # define YYID(n) (n) |
| 1529 | #else |
| 1530 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1531 | || defined __cplusplus || defined _MSC_VER) |
| 1532 | static int |
| 1533 | YYID (int i) |
| 1534 | #else |
| 1535 | static int |
| 1536 | YYID (i) |
| 1537 | int i; |
| 1538 | #endif |
| 1539 | { |
| 1540 | return i; |
| 1541 | } |
| 1542 | #endif |
| 1543 | |
| 1544 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 1545 | |
| 1546 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1547 | |
| 1548 | # ifdef YYSTACK_USE_ALLOCA |
| 1549 | # if YYSTACK_USE_ALLOCA |
| 1550 | # ifdef __GNUC__ |
| 1551 | # define YYSTACK_ALLOC __builtin_alloca |
| 1552 | # elif defined __BUILTIN_VA_ARG_INCR |
| 1553 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 1554 | # elif defined _AIX |
| 1555 | # define YYSTACK_ALLOC __alloca |
| 1556 | # elif defined _MSC_VER |
| 1557 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 1558 | # define alloca _alloca |
| 1559 | # else |
| 1560 | # define YYSTACK_ALLOC alloca |
| 1561 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1562 | || defined __cplusplus || defined _MSC_VER) |
| 1563 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1564 | # ifndef _STDLIB_H |
| 1565 | # define _STDLIB_H 1 |
| 1566 | # endif |
| 1567 | # endif |
| 1568 | # endif |
| 1569 | # endif |
| 1570 | # endif |
| 1571 | |
| 1572 | # ifdef YYSTACK_ALLOC |
| 1573 | /* Pacify GCC's `empty if-body' warning. */ |
| 1574 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
| 1575 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1576 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1577 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1578 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1579 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1580 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 1581 | # endif |
| 1582 | # else |
| 1583 | # define YYSTACK_ALLOC YYMALLOC |
| 1584 | # define YYSTACK_FREE YYFREE |
| 1585 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1586 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 1587 | # endif |
| 1588 | # if (defined __cplusplus && ! defined _STDLIB_H \ |
| 1589 | && ! ((defined YYMALLOC || defined malloc) \ |
| 1590 | && (defined YYFREE || defined free))) |
| 1591 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1592 | # ifndef _STDLIB_H |
| 1593 | # define _STDLIB_H 1 |
| 1594 | # endif |
| 1595 | # endif |
| 1596 | # ifndef YYMALLOC |
| 1597 | # define YYMALLOC malloc |
| 1598 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1599 | || defined __cplusplus || defined _MSC_VER) |
| 1600 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1601 | # endif |
| 1602 | # endif |
| 1603 | # ifndef YYFREE |
| 1604 | # define YYFREE free |
| 1605 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1606 | || defined __cplusplus || defined _MSC_VER) |
| 1607 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1608 | # endif |
| 1609 | # endif |
| 1610 | # endif |
| 1611 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 1612 | |
| 1613 | |
| 1614 | #if (! defined yyoverflow \ |
| 1615 | && (! defined __cplusplus \ |
| 1616 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 1617 | |
| 1618 | /* A type that is properly aligned for any stack member. */ |
| 1619 | union yyalloc |
| 1620 | { |
| 1621 | yytype_int16 yyss; |
| 1622 | YYSTYPE yyvs; |
| 1623 | }; |
| 1624 | |
| 1625 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1626 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1627 | |
| 1628 | /* The size of an array large to enough to hold all stacks, each with |
| 1629 | N elements. */ |
| 1630 | # define YYSTACK_BYTES(N) \ |
| 1631 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 1632 | + YYSTACK_GAP_MAXIMUM) |
| 1633 | |
| 1634 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1635 | not overlap. */ |
| 1636 | # ifndef YYCOPY |
| 1637 | # if defined __GNUC__ && 1 < __GNUC__ |
| 1638 | # define YYCOPY(To, From, Count) \ |
| 1639 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1640 | # else |
| 1641 | # define YYCOPY(To, From, Count) \ |
| 1642 | do \ |
| 1643 | { \ |
| 1644 | YYSIZE_T yyi; \ |
| 1645 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1646 | (To)[yyi] = (From)[yyi]; \ |
| 1647 | } \ |
| 1648 | while (YYID (0)) |
| 1649 | # endif |
| 1650 | # endif |
| 1651 | |
| 1652 | /* Relocate STACK from its old location to the new one. The |
| 1653 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1654 | elements in the stack, and YYPTR gives the new location of the |
| 1655 | stack. Advance YYPTR to a properly aligned location for the next |
| 1656 | stack. */ |
| 1657 | # define YYSTACK_RELOCATE(Stack) \ |
| 1658 | do \ |
| 1659 | { \ |
| 1660 | YYSIZE_T yynewbytes; \ |
| 1661 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1662 | Stack = &yyptr->Stack; \ |
| 1663 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1664 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1665 | } \ |
| 1666 | while (YYID (0)) |
| 1667 | |
| 1668 | #endif |
| 1669 | |
| 1670 | /* YYFINAL -- State number of the termination state. */ |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1671 | #define YYFINAL 44 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1672 | /* YYLAST -- Last index in YYTABLE. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1673 | #define YYLAST 2372 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1674 | |
| 1675 | /* YYNTOKENS -- Number of terminals. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1676 | #define YYNTOKENS 176 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1677 | /* YYNNTS -- Number of nonterminals. */ |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 1678 | #define YYNNTS 87 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1679 | /* YYNRULES -- Number of rules. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1680 | #define YYNRULES 352 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1681 | /* YYNRULES -- Number of states. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1682 | #define YYNSTATES 712 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1683 | |
| 1684 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1685 | #define YYUNDEFTOK 2 |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1686 | #define YYMAXUTOK 416 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1687 | |
| 1688 | #define YYTRANSLATE(YYX) \ |
| 1689 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1690 | |
| 1691 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1692 | static const yytype_uint8 yytranslate[] = |
| 1693 | { |
| 1694 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1695 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1696 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1697 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1698 | 162, 163, 166, 2, 165, 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, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1700 | 171, 164, 172, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1701 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1702 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1703 | 2, 168, 167, 170, 2, 2, 2, 2, 2, 175, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1704 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1705 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1706 | 169, 2, 2, 173, 2, 174, 2, 2, 2, 2, |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 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, 2, 2, 2, 2, |
| 1718 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1719 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1720 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1721 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1722 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1723 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1724 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1725 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1726 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1727 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1728 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1729 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1730 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1731 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1732 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1733 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 1734 | 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1735 | 155, 156, 157, 158, 159, 160, 161 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1736 | }; |
| 1737 | |
| 1738 | #if YYDEBUG |
| 1739 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1740 | YYRHS. */ |
| 1741 | static const yytype_uint16 yyprhs[] = |
| 1742 | { |
| 1743 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1744 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1745 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1746 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1747 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1748 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 1749 | 118, 123, 124, 127, 128, 131, 133, 135, 137, 138, |
| 1750 | 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, |
| 1751 | 160, 162, 164, 166, 167, 169, 171, 172, 174, 176, |
| 1752 | 178, 180, 181, 183, 185, 186, 188, 190, 192, 194, |
| 1753 | 196, 199, 201, 203, 205, 207, 209, 211, 213, 215, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1754 | 217, 219, 222, 223, 226, 228, 230, 232, 234, 235, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1755 | 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1756 | 258, 260, 262, 263, 266, 267, 270, 271, 274, 275, |
| 1757 | 279, 282, 283, 285, 286, 290, 292, 295, 297, 299, |
| 1758 | 301, 303, 305, 307, 309, 311, 313, 317, 319, 322, |
| 1759 | 328, 334, 340, 346, 350, 353, 359, 364, 367, 369, |
| 1760 | 371, 373, 377, 379, 383, 385, 386, 388, 392, 397, |
| 1761 | 401, 405, 410, 415, 419, 426, 432, 435, 438, 441, |
| 1762 | 444, 447, 450, 453, 456, 459, 462, 465, 468, 475, |
| 1763 | 481, 490, 497, 504, 512, 520, 528, 536, 543, 552, |
| 1764 | 561, 567, 575, 579, 581, 583, 585, 587, 588, 591, |
| 1765 | 598, 600, 601, 603, 606, 607, 611, 612, 616, 620, |
| 1766 | 624, 628, 629, 638, 639, 649, 650, 660, 666, 669, |
| 1767 | 673, 675, 679, 683, 687, 691, 693, 694, 700, 704, |
| 1768 | 706, 710, 712, 713, 725, 727, 729, 734, 736, 738, |
| 1769 | 741, 745, 746, 748, 750, 752, 754, 756, 758, 760, |
| 1770 | 762, 764, 766, 768, 772, 776, 779, 782, 786, 789, |
| 1771 | 795, 800, 802, 808, 810, 812, 814, 816, 818, 820, |
| 1772 | 823, 825, 829, 832, 835, 839, 843, 846, 847, 849, |
| 1773 | 852, 855, 859, 869, 879, 888, 904, 906, 908, 915, |
| 1774 | 921, 924, 927, 934, 942, 947, 952, 959, 966, 967, |
| 1775 | 968, 972, 975, 979, 982, 984, 990, 996, 1003, 1010, |
| 1776 | 1017, 1024, 1029, 1036, 1041, 1046, 1053, 1060, 1063, 1073, |
| 1777 | 1075, 1077, 1078, 1082, 1089, 1093, 1100, 1103, 1109, 1117, |
| 1778 | 1123, 1128, 1133 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1779 | }; |
| 1780 | |
| 1781 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1782 | static const yytype_int16 yyrhs[] = |
| 1783 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1784 | 223, 0, -1, 75, -1, 76, -1, 77, -1, 78, |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 1785 | -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, |
| 1786 | -1, 87, -1, 88, -1, 89, -1, 84, -1, 85, |
| 1787 | -1, 86, -1, 120, -1, 121, -1, 122, -1, 123, |
| 1788 | -1, 124, -1, 125, -1, 126, -1, 127, -1, 128, |
| 1789 | -1, 129, -1, 130, -1, 131, -1, 94, -1, 95, |
| 1790 | -1, 96, -1, 97, -1, 98, -1, 99, -1, 100, |
| 1791 | -1, 101, -1, 102, -1, 103, -1, 104, -1, 105, |
| 1792 | -1, 106, -1, 107, -1, 108, -1, 109, -1, 110, |
| 1793 | -1, 111, -1, 112, -1, 113, -1, 100, -1, 101, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 1794 | -1, 102, -1, 103, -1, 26, -1, 27, -1, 19, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1795 | -1, 22, -1, 24, -1, 182, -1, -1, 55, 162, |
| 1796 | 4, 163, -1, -1, 182, 164, -1, -1, 7, 164, |
| 1797 | -1, 20, -1, 23, -1, 189, -1, -1, 187, 164, |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 1798 | -1, 42, -1, 44, -1, 43, -1, 45, -1, 47, |
| 1799 | -1, 49, -1, 46, -1, 48, -1, 51, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1800 | 159, -1, 160, -1, 161, -1, -1, 46, -1, 48, |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 1801 | -1, -1, 42, -1, 43, -1, 44, -1, 47, -1, |
| 1802 | -1, 44, -1, 42, -1, -1, 63, -1, 64, -1, |
| 1803 | 65, -1, 66, -1, 67, -1, 62, 4, -1, 142, |
| 1804 | -1, 121, -1, 141, -1, 122, -1, 144, -1, 145, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1805 | -1, 147, -1, 148, -1, 149, -1, 158, -1, 54, |
| 1806 | 4, -1, -1, 198, 197, -1, 144, -1, 142, -1, |
| 1807 | 141, -1, 147, -1, -1, 200, 199, -1, 143, -1, |
| 1808 | 146, -1, 144, -1, 142, -1, 141, -1, 150, -1, |
| 1809 | 151, -1, 154, -1, 155, -1, 153, -1, 156, -1, |
| 1810 | 157, -1, -1, 202, 201, -1, -1, 152, 22, -1, |
| 1811 | -1, 54, 4, -1, -1, 165, 54, 4, -1, 34, |
| 1812 | 22, -1, -1, 206, -1, -1, 165, 209, 208, -1, |
| 1813 | 206, -1, 54, 4, -1, 11, -1, 12, -1, 13, |
| 1814 | -1, 16, -1, 15, -1, 14, -1, 17, -1, 50, |
| 1815 | -1, 210, -1, 211, 184, 166, -1, 245, -1, 167, |
| 1816 | 4, -1, 211, 162, 215, 163, 202, -1, 10, 162, |
| 1817 | 215, 163, 202, -1, 168, 4, 169, 211, 170, -1, |
| 1818 | 171, 4, 169, 211, 172, -1, 173, 216, 174, -1, |
| 1819 | 173, 174, -1, 171, 173, 216, 174, 172, -1, 171, |
| 1820 | 173, 174, 172, -1, 211, 198, -1, 211, -1, 10, |
| 1821 | -1, 212, -1, 214, 165, 212, -1, 214, -1, 214, |
| 1822 | 165, 39, -1, 39, -1, -1, 211, -1, 216, 165, |
| 1823 | 211, -1, 211, 168, 219, 170, -1, 211, 168, 170, |
| 1824 | -1, 211, 175, 22, -1, 211, 171, 219, 172, -1, |
| 1825 | 211, 173, 219, 174, -1, 211, 173, 174, -1, 211, |
| 1826 | 171, 173, 219, 174, 172, -1, 211, 171, 173, 174, |
| 1827 | 172, -1, 211, 40, -1, 211, 41, -1, 211, 245, |
| 1828 | -1, 211, 218, -1, 211, 25, -1, 211, 3, -1, |
| 1829 | 211, 5, -1, 211, 4, -1, 211, 6, -1, 211, |
| 1830 | 26, -1, 211, 27, -1, 211, 9, -1, 179, 162, |
| 1831 | 217, 38, 211, 163, -1, 119, 162, 217, 257, 163, |
| 1832 | -1, 133, 162, 217, 165, 217, 165, 217, 163, -1, |
| 1833 | 177, 162, 217, 165, 217, 163, -1, 178, 162, 217, |
| 1834 | 165, 217, 163, -1, 90, 180, 162, 217, 165, 217, |
| 1835 | 163, -1, 91, 181, 162, 217, 165, 217, 163, -1, |
| 1836 | 92, 180, 162, 217, 165, 217, 163, -1, 93, 181, |
| 1837 | 162, 217, 165, 217, 163, -1, 135, 162, 217, 165, |
| 1838 | 217, 163, -1, 136, 162, 217, 165, 217, 165, 217, |
| 1839 | 163, -1, 137, 162, 217, 165, 217, 165, 217, 163, |
| 1840 | -1, 139, 162, 217, 258, 163, -1, 140, 162, 217, |
| 1841 | 165, 217, 258, 163, -1, 219, 165, 217, -1, 217, |
| 1842 | -1, 32, -1, 33, -1, 37, -1, -1, 213, 245, |
| 1843 | -1, 125, 162, 222, 38, 211, 163, -1, 224, -1, |
| 1844 | -1, 225, -1, 224, 225, -1, -1, 31, 226, 241, |
| 1845 | -1, -1, 30, 227, 242, -1, 60, 59, 231, -1, |
| 1846 | 185, 18, 211, -1, 185, 18, 10, -1, -1, 188, |
| 1847 | 192, 221, 220, 217, 184, 228, 208, -1, -1, 188, |
| 1848 | 190, 192, 221, 220, 217, 184, 229, 208, -1, -1, |
| 1849 | 188, 191, 192, 221, 220, 211, 184, 230, 208, -1, |
| 1850 | 188, 192, 35, 195, 222, -1, 52, 232, -1, 56, |
| 1851 | 164, 233, -1, 22, -1, 53, 164, 22, -1, 68, |
| 1852 | 164, 22, -1, 168, 234, 170, -1, 234, 165, 22, |
| 1853 | -1, 22, -1, -1, 235, 165, 211, 198, 183, -1, |
| 1854 | 211, 198, 183, -1, 235, -1, 235, 165, 39, -1, |
| 1855 | 39, -1, -1, 196, 200, 213, 187, 162, 236, 163, |
| 1856 | 202, 207, 204, 203, -1, 28, -1, 173, -1, 194, |
| 1857 | 192, 237, 238, -1, 29, -1, 174, -1, 249, 240, |
| 1858 | -1, 193, 192, 237, -1, -1, 61, -1, 3, -1, |
| 1859 | 4, -1, 5, -1, 6, -1, 9, -1, 26, -1, |
| 1860 | 27, -1, 40, -1, 41, -1, 25, -1, 171, 219, |
| 1861 | 172, -1, 168, 219, 170, -1, 168, 170, -1, 175, |
| 1862 | 22, -1, 173, 219, 174, -1, 173, 174, -1, 171, |
| 1863 | 173, 219, 174, 172, -1, 171, 173, 174, 172, -1, |
| 1864 | 218, -1, 59, 243, 22, 165, 22, -1, 7, -1, |
| 1865 | 8, -1, 182, -1, 187, -1, 245, -1, 244, -1, |
| 1866 | 211, 246, -1, 247, -1, 248, 165, 247, -1, 249, |
| 1867 | 250, -1, 239, 250, -1, 251, 185, 252, -1, 251, |
| 1868 | 186, 252, -1, 251, 254, -1, -1, 21, -1, 69, |
| 1869 | 248, -1, 69, 10, -1, 70, 17, 246, -1, 70, |
| 1870 | 11, 246, 165, 17, 246, 165, 17, 246, -1, 71, |
| 1871 | 11, 246, 165, 17, 246, 168, 253, 170, -1, 71, |
| 1872 | 11, 246, 165, 17, 246, 168, 170, -1, 72, 196, |
| 1873 | 200, 213, 246, 162, 256, 163, 202, 38, 17, 246, |
| 1874 | 73, 17, 246, -1, 73, -1, 74, -1, 253, 11, |
| 1875 | 244, 165, 17, 246, -1, 11, 244, 165, 17, 246, |
| 1876 | -1, 185, 260, -1, 186, 260, -1, 211, 168, 246, |
| 1877 | 165, 246, 170, -1, 255, 165, 168, 246, 165, 246, |
| 1878 | 170, -1, 211, 198, 246, 198, -1, 17, 198, 246, |
| 1879 | 198, -1, 256, 165, 211, 198, 246, 198, -1, 256, |
| 1880 | 165, 17, 198, 246, 198, -1, -1, -1, 257, 165, |
| 1881 | 247, -1, 165, 4, -1, 258, 165, 4, -1, 58, |
| 1882 | 57, -1, 57, -1, 177, 211, 246, 165, 246, -1, |
| 1883 | 178, 211, 246, 165, 246, -1, 90, 180, 211, 246, |
| 1884 | 165, 246, -1, 91, 181, 211, 246, 165, 246, -1, |
| 1885 | 92, 180, 211, 246, 165, 246, -1, 93, 181, 211, |
| 1886 | 246, 165, 246, -1, 179, 247, 38, 211, -1, 133, |
| 1887 | 247, 165, 247, 165, 247, -1, 134, 247, 165, 211, |
| 1888 | -1, 135, 247, 165, 247, -1, 136, 247, 165, 247, |
| 1889 | 165, 247, -1, 137, 247, 165, 247, 165, 247, -1, |
| 1890 | 132, 255, -1, 259, 196, 200, 213, 246, 162, 256, |
| 1891 | 163, 202, -1, 262, -1, 36, -1, -1, 114, 211, |
| 1892 | 205, -1, 114, 211, 165, 11, 246, 205, -1, 115, |
| 1893 | 211, 205, -1, 115, 211, 165, 11, 246, 205, -1, |
| 1894 | 116, 247, -1, 261, 117, 211, 246, 205, -1, 261, |
| 1895 | 118, 247, 165, 211, 246, 205, -1, 138, 211, 246, |
| 1896 | 165, 4, -1, 119, 211, 246, 257, -1, 139, 211, |
| 1897 | 246, 258, -1, 140, 211, 246, 165, 211, 246, 258, |
| 1898 | -1 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1899 | }; |
| 1900 | |
| 1901 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1902 | static const yytype_uint16 yyrline[] = |
| 1903 | { |
Nuno Lopes | aa386d0 | 2008-11-04 14:43:20 +0000 | [diff] [blame] | 1904 | 0, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, |
| 1905 | 1152, 1153, 1153, 1153, 1153, 1153, 1153, 1154, 1154, 1154, |
| 1906 | 1154, 1154, 1154, 1155, 1155, 1155, 1155, 1155, 1155, 1158, |
| 1907 | 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162, 1162, 1166, |
| 1908 | 1166, 1167, 1167, 1168, 1168, 1169, 1169, 1170, 1170, 1171, |
| 1909 | 1171, 1172, 1172, 1173, 1174, 1177, 1177, 1177, 1178, 1178, |
| 1910 | 1180, 1181, 1185, 1189, 1194, 1200, 1200, 1202, 1203, 1208, |
| 1911 | 1214, 1215, 1216, 1217, 1218, 1219, 1223, 1224, 1225, 1229, |
| 1912 | 1230, 1231, 1232, 1236, 1237, 1238, 1242, 1243, 1244, 1245, |
| 1913 | 1246, 1250, 1251, 1252, 1255, 1256, 1257, 1258, 1259, 1260, |
| 1914 | 1261, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1915 | 1277, 1278, 1282, 1283, 1288, 1289, 1290, 1291, 1294, 1295, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1916 | 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1917 | 1311, 1312, 1315, 1316, 1322, 1323, 1330, 1331, 1339, 1340, |
| 1918 | 1351, 1359, 1360, 1365, 1366, 1367, 1372, 1387, 1387, 1387, |
| 1919 | 1387, 1387, 1387, 1387, 1390, 1394, 1398, 1405, 1410, 1418, |
| 1920 | 1453, 1484, 1489, 1499, 1509, 1513, 1523, 1530, 1539, 1546, |
| 1921 | 1551, 1556, 1563, 1564, 1571, 1578, 1586, 1592, 1604, 1632, |
| 1922 | 1648, 1675, 1703, 1729, 1749, 1775, 1795, 1807, 1814, 1880, |
| 1923 | 1890, 1900, 1911, 1924, 1935, 1949, 1956, 1963, 1981, 1993, |
| 1924 | 2014, 2022, 2028, 2039, 2044, 2049, 2054, 2059, 2065, 2071, |
| 1925 | 2077, 2085, 2096, 2100, 2108, 2108, 2111, 2111, 2114, 2126, |
| 1926 | 2147, 2152, 2160, 2161, 2165, 2165, 2169, 2169, 2172, 2175, |
| 1927 | 2199, 2211, 2210, 2222, 2221, 2231, 2230, 2241, 2281, 2284, |
| 1928 | 2290, 2300, 2304, 2309, 2311, 2316, 2321, 2330, 2340, 2351, |
| 1929 | 2355, 2364, 2373, 2378, 2527, 2527, 2529, 2538, 2538, 2540, |
| 1930 | 2545, 2557, 2561, 2566, 2570, 2574, 2579, 2584, 2588, 2592, |
| 1931 | 2596, 2600, 2604, 2608, 2630, 2652, 2658, 2671, 2683, 2688, |
| 1932 | 2700, 2706, 2710, 2720, 2724, 2728, 2733, 2740, 2740, 2746, |
| 1933 | 2755, 2760, 2765, 2769, 2778, 2787, 2800, 2809, 2813, 2821, |
| 1934 | 2841, 2845, 2850, 2861, 2880, 2889, 2993, 2997, 3004, 3015, |
| 1935 | 3028, 3037, 3050, 3061, 3071, 3082, 3090, 3100, 3107, 3110, |
| 1936 | 3111, 3119, 3125, 3134, 3138, 3143, 3159, 3176, 3188, 3200, |
| 1937 | 3214, 3228, 3240, 3261, 3268, 3274, 3280, 3286, 3301, 3411, |
| 1938 | 3416, 3420, 3427, 3434, 3444, 3451, 3461, 3469, 3483, 3500, |
| 1939 | 3514, 3529, 3544 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1940 | }; |
| 1941 | #endif |
| 1942 | |
| 1943 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1944 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1945 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1946 | static const char *const yytname[] = |
| 1947 | { |
| 1948 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1949 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1950 | "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE", |
| 1951 | "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT", |
| 1952 | "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK", |
| 1953 | "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", |
| 1954 | "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO", |
| 1955 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 1956 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE", |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1957 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", |
| 1958 | "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", |
| 1959 | "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 1960 | "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", |
| 1961 | "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", |
| 1962 | "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP", |
| 1963 | "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", |
| 1964 | "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", |
| 1965 | "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", |
| 1966 | "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", |
| 1967 | "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", |
| 1968 | "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
| 1969 | "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT", |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1970 | "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "NOCAPTURE", "BYVAL", |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 1971 | "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE", |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 1972 | "SSP", "SSPREQ", "NEST", "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", |
| 1973 | "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", |
| 1974 | "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps", |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 1975 | "IPredicates", "FPredicates", "LocalName", "OptLocalName", |
| 1976 | "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName", |
| 1977 | "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage", |
| 1978 | "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage", |
| 1979 | "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute", |
| 1980 | "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs", |
| 1981 | "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection", |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 1982 | "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types", |
| 1983 | "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI", |
| 1984 | "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal", |
| 1985 | "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3", |
| 1986 | "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition", |
| 1987 | "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", |
| 1988 | "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect", |
| 1989 | "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal", |
| 1990 | "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList", |
| 1991 | "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList", |
| 1992 | "IndexList", "ConstantIndexList", "OptTailCall", "InstVal", |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 1993 | "OptVolatile", "MemoryInst", 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1994 | }; |
| 1995 | #endif |
| 1996 | |
| 1997 | # ifdef YYPRINT |
| 1998 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1999 | token YYLEX-NUM. */ |
| 2000 | static const yytype_uint16 yytoknum[] = |
| 2001 | { |
| 2002 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 2003 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 2004 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 2005 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 2006 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 2007 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 2008 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 2009 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 2010 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 2011 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 2012 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 2013 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 2014 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 2015 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 2016 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2017 | 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2018 | 415, 416, 40, 41, 61, 44, 42, 92, 91, 120, |
| 2019 | 93, 60, 62, 123, 125, 99 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2020 | }; |
| 2021 | # endif |
| 2022 | |
| 2023 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 2024 | static const yytype_uint16 yyr1[] = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2025 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2026 | 0, 176, 177, 177, 177, 177, 177, 177, 177, 177, |
| 2027 | 177, 178, 178, 178, 178, 178, 178, 179, 179, 179, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2028 | 179, 179, 179, 179, 179, 179, 179, 179, 179, 180, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2029 | 180, 180, 180, 180, 180, 180, 180, 180, 180, 181, |
| 2030 | 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, |
| 2031 | 181, 181, 181, 181, 181, 182, 182, 182, 183, 183, |
| 2032 | 184, 184, 185, 185, 186, 187, 187, 188, 188, 189, |
| 2033 | 190, 190, 190, 190, 190, 190, 191, 191, 191, 192, |
| 2034 | 192, 192, 192, 193, 193, 193, 194, 194, 194, 194, |
| 2035 | 194, 195, 195, 195, 196, 196, 196, 196, 196, 196, |
| 2036 | 196, 197, 197, 197, 197, 197, 197, 197, 197, 197, |
| 2037 | 197, 197, 198, 198, 199, 199, 199, 199, 200, 200, |
| 2038 | 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, |
| 2039 | 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, |
| 2040 | 206, 207, 207, 208, 208, 209, 209, 210, 210, 210, |
| 2041 | 210, 210, 210, 210, 211, 211, 211, 211, 211, 211, |
| 2042 | 211, 211, 211, 211, 211, 211, 211, 212, 213, 213, |
| 2043 | 214, 214, 215, 215, 215, 215, 216, 216, 217, 217, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2044 | 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2045 | 217, 217, 217, 217, 217, 217, 217, 217, 218, 218, |
| 2046 | 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, |
| 2047 | 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, |
| 2048 | 223, 223, 224, 224, 226, 225, 227, 225, 225, 225, |
| 2049 | 225, 228, 225, 229, 225, 230, 225, 225, 225, 225, |
| 2050 | 231, 232, 232, 233, 234, 234, 234, 235, 235, 236, |
| 2051 | 236, 236, 236, 237, 238, 238, 239, 240, 240, 241, |
| 2052 | 242, 243, 243, 244, 244, 244, 244, 244, 244, 244, |
| 2053 | 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, |
| 2054 | 244, 244, 244, 245, 245, 245, 245, 246, 246, 247, |
| 2055 | 248, 248, 249, 249, 250, 250, 251, 251, 251, 252, |
| 2056 | 252, 252, 252, 252, 252, 252, 252, 252, 253, 253, |
| 2057 | 254, 254, 255, 255, 256, 256, 256, 256, 256, 257, |
| 2058 | 257, 258, 258, 259, 259, 260, 260, 260, 260, 260, |
| 2059 | 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, |
| 2060 | 261, 261, 262, 262, 262, 262, 262, 262, 262, 262, |
| 2061 | 262, 262, 262 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2062 | }; |
| 2063 | |
| 2064 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 2065 | static const yytype_uint8 yyr2[] = |
| 2066 | { |
| 2067 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2068 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2069 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2070 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2071 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2072 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, |
| 2073 | 4, 0, 2, 0, 2, 1, 1, 1, 0, 2, |
| 2074 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, |
| 2075 | 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, |
| 2076 | 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, |
| 2077 | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2078 | 1, 2, 0, 2, 1, 1, 1, 1, 0, 2, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2079 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2080 | 1, 1, 0, 2, 0, 2, 0, 2, 0, 3, |
| 2081 | 2, 0, 1, 0, 3, 1, 2, 1, 1, 1, |
| 2082 | 1, 1, 1, 1, 1, 1, 3, 1, 2, 5, |
| 2083 | 5, 5, 5, 3, 2, 5, 4, 2, 1, 1, |
| 2084 | 1, 3, 1, 3, 1, 0, 1, 3, 4, 3, |
| 2085 | 3, 4, 4, 3, 6, 5, 2, 2, 2, 2, |
| 2086 | 2, 2, 2, 2, 2, 2, 2, 2, 6, 5, |
| 2087 | 8, 6, 6, 7, 7, 7, 7, 6, 8, 8, |
| 2088 | 5, 7, 3, 1, 1, 1, 1, 0, 2, 6, |
| 2089 | 1, 0, 1, 2, 0, 3, 0, 3, 3, 3, |
| 2090 | 3, 0, 8, 0, 9, 0, 9, 5, 2, 3, |
| 2091 | 1, 3, 3, 3, 3, 1, 0, 5, 3, 1, |
| 2092 | 3, 1, 0, 11, 1, 1, 4, 1, 1, 2, |
| 2093 | 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2094 | 1, 1, 1, 3, 3, 2, 2, 3, 2, 5, |
| 2095 | 4, 1, 5, 1, 1, 1, 1, 1, 1, 2, |
| 2096 | 1, 3, 2, 2, 3, 3, 2, 0, 1, 2, |
| 2097 | 2, 3, 9, 9, 8, 15, 1, 1, 6, 5, |
| 2098 | 2, 2, 6, 7, 4, 4, 6, 6, 0, 0, |
| 2099 | 3, 2, 3, 2, 1, 5, 5, 6, 6, 6, |
| 2100 | 6, 4, 6, 4, 4, 6, 6, 2, 9, 1, |
| 2101 | 1, 0, 3, 6, 3, 6, 2, 5, 7, 5, |
| 2102 | 4, 4, 7 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2103 | }; |
| 2104 | |
| 2105 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 2106 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 2107 | means the default is an error. */ |
| 2108 | static const yytype_uint16 yydefact[] = |
| 2109 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2110 | 68, 55, 65, 56, 66, 57, 226, 224, 0, 0, |
| 2111 | 0, 0, 0, 0, 79, 67, 0, 68, 222, 83, |
| 2112 | 86, 0, 0, 238, 0, 0, 62, 0, 69, 70, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2113 | 72, 71, 73, 76, 74, 77, 75, 78, 80, 81, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2114 | 82, 79, 79, 217, 1, 223, 84, 85, 79, 227, |
| 2115 | 87, 88, 89, 90, 79, 297, 225, 297, 0, 0, |
| 2116 | 246, 239, 240, 228, 283, 284, 230, 147, 148, 149, |
| 2117 | 152, 151, 150, 153, 154, 0, 0, 0, 0, 285, |
| 2118 | 286, 155, 229, 157, 217, 217, 91, 216, 0, 94, |
| 2119 | 94, 298, 293, 63, 257, 258, 259, 292, 241, 242, |
| 2120 | 245, 0, 175, 158, 0, 0, 0, 0, 164, 176, |
| 2121 | 0, 0, 175, 0, 0, 0, 93, 92, 0, 214, |
| 2122 | 215, 0, 0, 95, 96, 97, 98, 99, 118, 260, |
| 2123 | 0, 0, 341, 341, 296, 0, 243, 174, 112, 170, |
| 2124 | 172, 0, 0, 0, 0, 0, 0, 163, 0, 0, |
| 2125 | 156, 0, 0, 169, 0, 168, 0, 237, 61, 61, |
| 2126 | 100, 0, 254, 255, 256, 64, 340, 324, 0, 0, |
| 2127 | 0, 0, 94, 306, 307, 2, 3, 4, 5, 6, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2128 | 7, 8, 9, 10, 14, 15, 16, 11, 12, 13, |
| 2129 | 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, |
| 2130 | 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 2131 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2132 | 0, 0, 294, 94, 310, 0, 339, 295, 311, 244, |
| 2133 | 167, 0, 132, 61, 61, 166, 0, 177, 0, 132, |
| 2134 | 61, 61, 0, 218, 191, 193, 192, 194, 197, 190, |
| 2135 | 195, 196, 186, 187, 0, 0, 0, 0, 0, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2136 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2137 | 0, 0, 189, 188, 231, 116, 115, 114, 117, 119, |
| 2138 | 0, 323, 300, 61, 290, 299, 0, 0, 0, 118, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2139 | 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 2140 | 0, 53, 54, 49, 50, 51, 52, 39, 40, 41, |
| 2141 | 42, 43, 44, 45, 46, 47, 48, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2142 | 138, 138, 346, 61, 61, 337, 0, 0, 0, 0, |
| 2143 | 0, 61, 61, 61, 61, 61, 0, 118, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2144 | 0, 102, 104, 103, 101, 105, 106, 107, 108, 109, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2145 | 110, 113, 173, 171, 160, 161, 162, 165, 60, 159, |
| 2146 | 233, 235, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2147 | 0, 0, 0, 0, 179, 213, 0, 0, 0, 183, |
| 2148 | 0, 180, 0, 0, 0, 143, 0, 263, 264, 265, |
| 2149 | 266, 267, 272, 268, 269, 270, 271, 261, 0, 0, |
| 2150 | 0, 0, 281, 288, 287, 289, 0, 0, 301, 0, |
| 2151 | 0, 61, 61, 61, 61, 0, 342, 0, 344, 319, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2152 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2153 | 0, 0, 0, 0, 61, 0, 111, 124, 123, 120, |
| 2154 | 122, 121, 125, 126, 129, 127, 128, 130, 131, 133, |
| 2155 | 143, 143, 0, 0, 0, 0, 0, 319, 0, 0, |
| 2156 | 0, 0, 0, 0, 0, 178, 164, 176, 0, 181, |
| 2157 | 182, 0, 0, 0, 0, 232, 252, 262, 0, 275, |
| 2158 | 0, 0, 0, 278, 0, 276, 291, 0, 0, 0, |
| 2159 | 0, 0, 0, 0, 0, 0, 0, 350, 0, 0, |
| 2160 | 0, 333, 334, 0, 0, 0, 0, 351, 0, 0, |
| 2161 | 0, 331, 0, 138, 0, 234, 236, 61, 0, 0, |
| 2162 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 212, |
| 2163 | 185, 0, 0, 0, 0, 0, 0, 145, 143, 251, |
| 2164 | 112, 249, 0, 0, 274, 164, 0, 273, 277, 0, |
| 2165 | 0, 0, 0, 0, 0, 0, 138, 139, 138, 0, |
| 2166 | 0, 0, 0, 0, 0, 349, 321, 0, 61, 325, |
| 2167 | 326, 0, 0, 347, 61, 219, 0, 0, 0, 0, |
| 2168 | 199, 0, 0, 0, 0, 210, 0, 184, 0, 0, |
| 2169 | 61, 140, 146, 144, 59, 0, 132, 0, 280, 0, |
| 2170 | 0, 0, 318, 327, 328, 329, 330, 343, 345, 320, |
| 2171 | 0, 0, 332, 335, 336, 322, 0, 318, 138, 0, |
| 2172 | 0, 0, 0, 0, 207, 0, 0, 0, 201, 202, |
| 2173 | 198, 58, 248, 250, 112, 141, 282, 279, 0, 0, |
| 2174 | 112, 112, 0, 312, 0, 352, 0, 348, 203, 204, |
| 2175 | 205, 206, 0, 0, 0, 211, 59, 142, 136, 0, |
| 2176 | 0, 304, 0, 0, 0, 132, 0, 313, 132, 200, |
| 2177 | 208, 209, 247, 0, 134, 302, 0, 0, 303, 102, |
| 2178 | 104, 112, 112, 0, 112, 112, 338, 137, 0, 253, |
| 2179 | 0, 0, 315, 314, 0, 0, 0, 135, 0, 0, |
| 2180 | 0, 112, 112, 309, 0, 0, 317, 316, 308, 0, |
| 2181 | 0, 305 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2182 | }; |
| 2183 | |
| 2184 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 2185 | static const yytype_int16 yydefgoto[] = |
| 2186 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2187 | -1, 269, 270, 271, 300, 317, 79, 632, 113, 12, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2188 | 133, 80, 14, 15, 41, 42, 43, 48, 54, 118, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2189 | 128, 351, 230, 279, 161, 449, 354, 689, 674, 416, |
| 2190 | 537, 658, 475, 538, 81, 158, 139, 156, 140, 141, |
| 2191 | 110, 375, 402, 376, 121, 88, 157, 16, 17, 18, |
| 2192 | 20, 19, 385, 450, 451, 63, 23, 61, 101, 541, |
| 2193 | 542, 129, 164, 55, 96, 56, 49, 478, 403, 83, |
| 2194 | 405, 284, 285, 57, 92, 93, 222, 662, 134, 325, |
| 2195 | 642, 497, 507, 223, 224, 225, 226 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2196 | }; |
| 2197 | |
| 2198 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2199 | STATE-NUM. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2200 | #define YYPACT_NINF -611 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2201 | static const yytype_int16 yypact[] = |
| 2202 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2203 | 828, -611, -611, -611, -611, -611, -611, -611, -5, -90, |
| 2204 | 68, -25, 113, -20, -9, -611, 153, 1107, -611, 173, |
| 2205 | 15, 36, 48, -611, -3, 196, -611, 1950, -611, -611, |
| 2206 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2207 | -611, 137, 137, 190, -611, -611, -611, -611, 137, -611, |
| 2208 | -611, -611, -611, -611, 137, 203, -611, 3, 212, 215, |
| 2209 | 229, -611, -611, -611, -611, -611, 83, -611, -611, -611, |
| 2210 | -611, -611, -611, -611, -611, 252, 268, 7, 87, -611, |
| 2211 | -611, -611, 73, -611, 238, 238, 186, -611, 22, 200, |
| 2212 | 200, -611, -611, 42, -611, -611, -611, -611, -611, -611, |
| 2213 | -611, 8, 1765, -611, 110, 121, 573, 83, -611, 73, |
| 2214 | -114, 138, 1765, 142, 22, 22, -611, -611, 1368, -611, |
| 2215 | -611, 1991, 298, -611, -611, -611, -611, -611, -611, -611, |
| 2216 | -16, 168, 2181, 2181, -611, 311, -611, -611, 73, -611, |
| 2217 | 169, 174, 1991, 1991, 164, -95, 1991, -611, 334, 178, |
| 2218 | -611, 1991, 1991, 83, 182, 73, 287, -611, 1319, 293, |
| 2219 | -611, 1680, -611, -611, -611, -611, -611, -611, 295, 2032, |
| 2220 | 119, 339, 200, -611, -611, -611, -611, -611, -611, -611, |
| 2221 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2222 | 465, 412, 465, 412, 1991, 1991, 1991, 1991, -611, -611, |
| 2223 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2224 | 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, |
| 2225 | 1991, 1991, -611, 200, -611, -33, -611, -611, -611, -611, |
| 2226 | 271, 1818, -611, -8, -39, -611, 181, 73, 191, -611, |
| 2227 | 293, -2, 1368, -611, -611, -611, -611, -611, -611, -611, |
| 2228 | -611, -611, -611, -611, 465, 412, 465, 412, 193, 195, |
| 2229 | 199, 201, 202, 205, 206, 1721, 2061, 659, 336, 210, |
| 2230 | 211, 213, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2231 | 187, -611, 83, 973, -611, 197, 1492, 1492, 1492, -611, |
| 2232 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2233 | 1991, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2234 | -611, -611, -611, -611, -611, -611, -611, 1991, 1991, 1991, |
| 2235 | 1, 17, -611, 973, -30, 214, 216, 218, 220, 221, |
| 2236 | 224, 973, 973, 973, 973, 973, 322, -611, 1991, 1991, |
| 2237 | 361, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2238 | -611, -611, -611, -611, 657, -611, -611, -611, -611, 657, |
| 2239 | -611, 142, 338, 226, 228, 232, 233, 1991, 1991, 1991, |
| 2240 | 1991, 1991, 1991, 1991, -611, -611, 41, 743, 32, -611, |
| 2241 | -83, -611, 1991, 1991, 1991, 236, 240, -611, -611, -611, |
| 2242 | -611, -611, -611, -611, -611, -611, -611, 313, 1859, 2117, |
| 2243 | 1023, 355, -611, -611, -611, -611, 1991, 243, -611, 245, |
| 2244 | 1680, 973, 973, 973, 973, 33, -611, 35, -611, -611, |
| 2245 | 1492, 235, 1991, 1991, 1991, 1991, 1991, 256, 257, 258, |
| 2246 | 265, 267, 1991, 1680, 973, 269, -611, -611, -611, -611, |
| 2247 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2248 | 236, 236, 1991, 1991, 1991, 1991, 1991, -611, 270, 272, |
| 2249 | 275, 276, 257, 284, 1991, -611, 219, 1146, -69, -611, |
| 2250 | -611, 286, 288, 340, 11, -611, 1891, -611, 383, -611, |
| 2251 | 44, 1195, 43, -611, -53, -611, -611, 400, 416, 1492, |
| 2252 | 289, 291, 296, 297, 1492, 432, 1492, 301, 306, 1492, |
| 2253 | 307, 73, -611, 308, 309, 448, 456, 312, 1991, 1492, |
| 2254 | 1492, 73, 1492, 314, 1991, -611, -611, -14, 315, 316, |
| 2255 | 319, 320, 78, 1991, 1991, 1991, 1991, 94, 1991, -611, |
| 2256 | -611, 304, 1991, 1991, 1991, 441, 474, -611, 236, -611, |
| 2257 | 73, 321, 324, 329, -611, 325, -52, -611, -611, 1492, |
| 2258 | 1492, 345, 1492, 1492, 1492, 1492, 314, -611, 314, 1991, |
| 2259 | 1492, 331, 1991, 1991, 1991, -611, -611, 494, 973, -611, |
| 2260 | -611, 365, 447, -611, 973, -611, 1991, 1991, 1991, 1991, |
| 2261 | -611, 367, 371, 370, 375, -611, 257, -611, 378, 379, |
| 2262 | 126, -611, -611, -611, 198, 1932, -611, 521, -611, 372, |
| 2263 | 380, 381, 2158, -611, -611, -611, -611, -611, -611, -611, |
| 2264 | 377, 1492, -611, -611, -611, -611, 257, 2158, 314, 385, |
| 2265 | 387, 388, 389, 1991, -611, 1991, 1991, 122, -611, -611, |
| 2266 | -611, -611, -611, -611, 73, 127, -611, -611, 536, 2, |
| 2267 | 74, 73, 136, -611, 401, 312, 140, -611, -611, -611, |
| 2268 | -611, -611, 407, 409, 410, -611, 198, -611, 523, 1492, |
| 2269 | 1630, -611, 4, 816, 816, -611, 2199, -611, -611, -611, |
| 2270 | -611, -611, -611, 571, 430, -611, 437, 1630, -611, 442, |
| 2271 | 443, -611, -611, 349, 74, 73, 657, -611, 584, -611, |
| 2272 | 592, 449, 271, 271, 595, 816, 816, -611, 1492, 599, |
| 2273 | 1492, -611, -611, -611, 1492, 544, 271, 271, -611, 601, |
| 2274 | 1492, -611 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2275 | }; |
| 2276 | |
| 2277 | /* YYPGOTO[NTERM-NUM]. */ |
| 2278 | static const yytype_int16 yypgoto[] = |
| 2279 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2280 | -611, 183, 185, 189, -166, -110, 0, -36, -116, 528, |
| 2281 | -611, 6, -611, -611, -611, -611, 27, -611, -611, -611, |
| 2282 | -145, -611, -526, -611, -260, -611, -237, -611, -611, -314, |
| 2283 | -13, -611, -420, -611, -611, -26, 393, -157, -611, 514, |
| 2284 | 522, 75, -153, -258, 209, 246, 390, -611, -611, 610, |
| 2285 | -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, |
| 2286 | -611, 539, -611, -611, -611, -611, -611, -611, -610, -85, |
| 2287 | 223, -193, -611, -611, 574, -611, 497, -611, -611, -611, |
| 2288 | 16, 184, -452, -611, 505, -611, -611 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2289 | }; |
| 2290 | |
| 2291 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2292 | positive, shift that token. If negative, reduce the rule which |
| 2293 | number is the opposite. If zero, do what YYDEFACT says. |
| 2294 | If YYTABLE_NINF, syntax error. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2295 | #define YYTABLE_NINF -222 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2296 | static const yytype_int16 yytable[] = |
| 2297 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2298 | 11, 82, 359, 322, 280, 272, 13, 418, 378, 380, |
| 2299 | 527, 105, 162, 660, 594, 677, 111, 11, 326, 327, |
| 2300 | 328, 329, 330, 13, 91, 111, 318, 289, 336, 410, |
| 2301 | 515, 516, 94, 29, 30, 31, 32, 33, 34, 35, |
| 2302 | 36, 111, 37, 274, 494, 535, 496, 111, 21, 131, |
| 2303 | 676, 146, 109, 111, 119, 120, 111, 50, 51, 52, |
| 2304 | 147, 1, 53, 22, 3, 536, 5, 691, 84, 85, |
| 2305 | 146, 243, 111, 273, 24, 89, 138, 433, 337, 236, |
| 2306 | 109, 90, 464, 319, 338, 339, 138, 495, 363, 495, |
| 2307 | 365, 470, 155, 11, 64, 65, 464, 107, 67, 68, |
| 2308 | 69, 70, 71, 72, 73, 531, 1, 2, 656, 3, |
| 2309 | 4, 5, 464, 464, 663, 664, 233, 234, 593, 468, |
| 2310 | 237, 548, 599, 112, 360, 361, 241, 25, 111, -153, |
| 2311 | 286, 27, 112, 356, 627, 155, 287, 74, 420, 26, |
| 2312 | 480, 482, 484, 283, 28, 364, 435, 366, 112, 575, |
| 2313 | 38, 39, 40, 44, 112, 692, 693, 163, 695, 696, |
| 2314 | 112, 535, 355, 112, 645, 60, 415, -61, 320, 321, |
| 2315 | 283, 323, 661, 135, 678, 706, 707, 95, 136, 112, |
| 2316 | 106, 111, 417, -61, 324, 283, 283, 283, 283, 283, |
| 2317 | 331, 332, 333, 334, 335, 283, 159, 464, 404, 573, |
| 2318 | 58, 404, 404, 404, 469, 138, 464, 2, 464, 464, |
| 2319 | 4, 465, 59, 486, 544, 547, 155, 1, 62, 46, |
| 2320 | 3, 47, 5, 546, 91, 86, 240, 87, 116, 500, |
| 2321 | 117, 502, 503, 504, 98, 112, -153, 99, 404, -61, |
| 2322 | -153, 580, 607, 559, 608, 102, 404, 404, 404, 404, |
| 2323 | 404, 100, 340, 489, 75, 76, 103, 585, 77, 567, |
| 2324 | 78, 108, 122, 123, 124, 125, 126, 127, 437, 438, |
| 2325 | 439, 440, 104, 441, 411, 87, 512, 442, 443, 142, |
| 2326 | 444, 445, 446, 447, 448, 655, 386, 567, 112, 630, |
| 2327 | 143, 412, 413, 414, 64, 65, 38, 39, 40, 665, |
| 2328 | 148, 666, 160, 668, 647, 666, 1, 2, 150, 3, |
| 2329 | 4, 5, 434, 283, 272, 219, 219, 220, 220, 341, |
| 2330 | 342, 221, 221, 151, 152, 340, 404, 404, 404, 404, |
| 2331 | 114, 115, 165, 229, 231, 404, 235, 232, 238, 343, |
| 2332 | 344, 239, 345, 346, 242, 347, 348, 349, 111, 404, |
| 2333 | 288, 467, 281, 357, 358, 367, 350, 368, 381, 635, |
| 2334 | 432, 369, 406, 370, 371, 436, 609, 372, 373, 612, |
| 2335 | 613, 614, 382, 383, 477, 384, 452, 485, 534, 421, |
| 2336 | 283, 422, 273, 423, 155, 424, 425, 694, 453, 426, |
| 2337 | 454, 530, 341, 342, 455, 456, 283, 501, 283, 283, |
| 2338 | 283, 474, 476, 499, 404, 543, 511, 155, 487, 404, |
| 2339 | 488, 404, 343, 344, 404, 345, 346, 549, 347, 348, |
| 2340 | 349, 505, 506, 508, 404, 404, 517, 404, 683, 350, |
| 2341 | 509, 686, 510, 550, 514, 523, 557, 524, 301, 302, |
| 2342 | 525, 526, 457, 458, 459, 460, 461, 462, 463, 528, |
| 2343 | 540, 532, 565, 533, 552, 467, 553, 471, 472, 473, |
| 2344 | 566, 554, 555, 591, 404, 404, 559, 404, 404, 404, |
| 2345 | 404, 560, 562, 563, 564, 404, 587, 567, 592, 572, |
| 2346 | 576, 577, 568, 404, 578, 579, 595, 596, 574, 404, |
| 2347 | 437, 438, 439, 440, 597, 441, 611, 598, 615, 442, |
| 2348 | 443, 495, 444, 445, 446, 447, 448, 602, 590, 407, |
| 2349 | 408, 409, 303, 304, 305, 306, 307, 308, 309, 310, |
| 2350 | 311, 312, 313, 314, 315, 316, 404, 617, 518, 519, |
| 2351 | 520, 521, 623, 283, 624, 625, 283, 283, 283, 529, |
| 2352 | 626, 628, 629, 636, 637, 638, 419, 643, 648, 639, |
| 2353 | 649, 650, 651, 659, 427, 428, 429, 430, 431, 290, |
| 2354 | 291, 292, 293, 294, 295, 296, 297, 298, 299, 634, |
| 2355 | 669, 667, 670, 671, 404, 687, 641, 673, 404, 404, |
| 2356 | 64, 65, 688, 107, 67, 68, 69, 70, 71, 72, |
| 2357 | 73, 641, 1, 2, 631, 3, 4, 5, 581, 582, |
| 2358 | 583, 584, 690, 586, -18, -19, 697, 588, 589, 698, |
| 2359 | 404, 404, 700, 404, 699, 404, 704, 709, 710, 404, |
| 2360 | 672, 132, 657, 74, 353, 404, 149, 45, 145, 130, |
| 2361 | 227, 97, 362, 646, 490, 491, 492, 493, 228, 0, |
| 2362 | 685, 522, 0, 498, 0, 0, 0, 0, 0, 0, |
| 2363 | 0, 619, 620, 621, 622, 0, 631, 513, 0, 0, |
| 2364 | 0, 0, 0, 0, 0, 0, 64, 65, 0, 107, |
| 2365 | 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, |
| 2366 | 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, |
| 2367 | 0, 0, 0, 0, 0, 0, 0, 0, 652, 0, |
| 2368 | 653, 654, 0, 0, 0, 0, 0, 0, 0, 74, |
| 2369 | 0, 0, 551, 0, 0, 0, 0, 556, 0, 558, |
| 2370 | 0, 0, 561, 0, 0, 0, 0, 0, 0, 0, |
| 2371 | 0, 0, 569, 570, 0, 571, 0, 0, 0, 0, |
| 2372 | 75, 76, 0, 0, 77, 0, 78, 144, 0, 0, |
| 2373 | 64, 65, 0, 107, 67, 68, 69, 70, 71, 72, |
| 2374 | 73, 0, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2375 | 0, 0, 600, 601, 0, 603, 604, 605, 606, 0, |
| 2376 | 0, 0, 0, 610, 0, 0, 0, 0, 0, 0, |
| 2377 | 0, 616, 0, 74, 0, 0, 0, 618, 437, 438, |
| 2378 | 439, 440, 0, 441, 0, 0, 0, 442, 443, 0, |
| 2379 | 444, 445, 446, 447, 448, 0, 0, 0, 0, 387, |
| 2380 | 388, 389, 390, 64, 65, 391, 75, 76, -221, 0, |
| 2381 | 77, 0, 78, 379, 644, 1, 2, 0, 3, 4, |
| 2382 | 5, 392, 393, 394, 0, 0, -63, 1, 2, 0, |
| 2383 | 3, 4, 5, 0, 0, 0, 395, 396, 6, 7, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2384 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2385 | 340, 0, 0, 0, 0, 397, 0, 0, 0, 0, |
| 2386 | 8, 0, 675, 0, 9, 0, 681, 682, 10, 0, |
| 2387 | 0, 175, 176, 177, 178, 179, 180, 181, 182, 183, |
| 2388 | 184, 185, 186, 187, 188, 189, 254, 255, 256, 257, |
| 2389 | 75, 76, 0, 0, 77, 0, 78, 466, 701, 702, |
| 2390 | 0, 703, 0, 705, 0, 0, 0, 708, 0, 0, |
| 2391 | 0, 0, 0, 711, 0, 258, 198, 679, 680, 201, |
| 2392 | 202, 203, 204, 205, 206, 207, 208, 209, 0, 259, |
| 2393 | 0, 260, 261, 262, 0, 263, 264, 343, 344, 0, |
| 2394 | 345, 346, 0, 347, 348, 349, 0, 0, 0, 0, |
| 2395 | 0, 0, 0, 0, 350, 0, 387, 388, 389, 390, |
| 2396 | 64, 65, 391, 0, 398, 0, 0, 399, 0, 400, |
| 2397 | 0, 401, 1, 2, 0, 3, 4, 5, 392, 393, |
| 2398 | 394, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2399 | 0, 0, 0, 395, 396, 0, 0, 0, 0, 0, |
| 2400 | 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, |
| 2401 | 64, 65, 397, 107, 67, 68, 69, 70, 71, 72, |
| 2402 | 73, 0, 1, 2, 0, 3, 4, 5, 175, 176, |
| 2403 | 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, |
| 2404 | 187, 188, 189, 254, 255, 256, 257, 0, 0, 0, |
| 2405 | 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2406 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2407 | 0, 0, 258, 198, 199, 200, 201, 202, 203, 204, |
| 2408 | 205, 206, 207, 208, 209, 0, 259, -220, 260, 261, |
| 2409 | 262, 0, 263, 264, 0, 0, 0, 0, 0, 0, |
| 2410 | 0, 0, 0, 0, 0, -63, 1, 2, 0, 3, |
| 2411 | 4, 5, 0, 0, 0, 112, 0, 6, 7, 0, |
| 2412 | 0, 398, 0, 0, 399, 0, 400, 0, 401, 244, |
| 2413 | 245, 246, 247, 64, 65, 248, 0, 0, 0, 8, |
| 2414 | 0, 0, 0, 9, 0, 1, 2, 10, 3, 4, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2415 | 5, 249, 250, 251, 0, 0, 0, 0, 0, 0, |
| 2416 | 0, 0, 0, 0, 0, 0, 252, 253, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2417 | 75, 76, 0, 0, 77, 0, 78, 483, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2418 | 0, 111, 64, 65, 0, 107, 67, 68, 69, 70, |
| 2419 | 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, |
| 2420 | 0, 175, 176, 177, 178, 179, 180, 181, 182, 183, |
| 2421 | 184, 185, 186, 187, 188, 189, 254, 255, 256, 257, |
| 2422 | 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, |
Chris Lattner | ccef6b5 | 2008-09-23 21:18:31 +0000 | [diff] [blame] | 2423 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2424 | 0, 0, 0, 0, 0, 258, 198, 199, 200, 201, |
| 2425 | 202, 203, 204, 205, 206, 207, 208, 209, 0, 259, |
| 2426 | 0, 260, 261, 262, 0, 263, 264, 0, 0, 0, |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 2427 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2428 | 0, 0, 0, 0, 0, 0, 0, 0, 112, 0, |
| 2429 | 0, 0, -61, 0, 265, 0, 0, 266, 0, 267, |
| 2430 | 0, 268, 244, 245, 246, 247, 64, 65, 248, 0, |
| 2431 | 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, |
| 2432 | 0, 3, 4, 5, 249, 250, 251, 0, 0, 0, |
| 2433 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, |
| 2434 | 253, 0, 75, 76, 0, 0, 77, 0, 78, 545, |
| 2435 | 0, 0, 0, 0, 111, 64, 65, 0, 153, 67, |
| 2436 | 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, |
| 2437 | 3, 4, 5, 0, 175, 176, 177, 178, 179, 180, |
| 2438 | 181, 182, 183, 184, 185, 186, 187, 188, 189, 254, |
| 2439 | 255, 256, 257, 0, 0, 0, 0, 0, 74, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2440 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2441 | 0, 0, 0, 0, 0, 0, 0, 0, 258, 198, |
| 2442 | 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, |
| 2443 | 209, 0, 259, 0, 260, 261, 262, 0, 263, 264, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2444 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2445 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2446 | 0, 112, 0, 0, 0, 0, 0, 265, 0, 0, |
| 2447 | 266, 0, 267, 154, 268, 387, 388, 389, 390, 64, |
| 2448 | 65, 391, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2449 | 0, 1, 2, 0, 3, 4, 5, 392, 393, 394, |
| 2450 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2451 | 0, 0, 395, 396, 0, 75, 76, 0, 0, 77, |
| 2452 | 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2453 | 0, 397, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2454 | 0, 0, 0, 0, 0, 0, 0, 175, 176, 177, |
| 2455 | 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, |
| 2456 | 188, 189, 254, 255, 256, 257, 0, 0, 0, 0, |
| 2457 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2458 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2459 | 0, 258, 198, 199, 200, 201, 202, 203, 204, 205, |
| 2460 | 206, 207, 208, 209, 0, 259, 0, 260, 261, 262, |
| 2461 | 0, 263, 264, 387, 388, 389, 390, 0, 0, 391, |
| 2462 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2463 | 0, 0, 0, 0, 0, 392, 393, 394, 0, 0, |
| 2464 | 398, 0, 0, 399, 0, 400, 0, 401, 0, 0, |
| 2465 | 395, 396, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2466 | 0, 0, 0, 0, 0, 0, 0, 64, 65, 397, |
| 2467 | 153, 67, 68, 69, 70, 71, 72, 73, 0, 1, |
| 2468 | 2, 0, 3, 4, 5, 175, 176, 177, 178, 179, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2469 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2470 | 254, 255, 256, 257, 0, 0, 0, 0, 64, 65, |
| 2471 | 74, 107, 67, 68, 69, 70, 71, 72, 73, 0, |
| 2472 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 258, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2473 | 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, |
| 2474 | 208, 209, 0, 259, 0, 260, 261, 262, 0, 263, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2475 | 264, 74, 64, 65, 0, 107, 67, 68, 69, 70, |
| 2476 | 71, 72, 73, 0, 1, 2, 0, 3, 4, 5, |
| 2477 | 0, 0, 0, 0, 0, 0, 0, 0, 398, 0, |
| 2478 | 0, 399, 0, 400, 137, 401, 0, 0, 0, 0, |
| 2479 | 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, |
| 2480 | 0, 275, 276, 0, 277, 64, 65, 278, 107, 67, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2481 | 68, 69, 70, 71, 72, 73, 0, 1, 2, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2482 | 3, 4, 5, 0, 0, 0, 0, 75, 76, 0, |
| 2483 | 0, 77, 0, 78, 0, 0, 0, 352, 0, 0, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2484 | 0, 0, 0, 0, 0, 0, 64, 65, 74, 107, |
| 2485 | 67, 68, 69, 70, 71, 72, 73, 0, 1, 2, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2486 | 0, 3, 4, 5, 0, 0, 0, 0, 75, 76, |
| 2487 | 0, 374, 77, 0, 78, 0, 0, 0, 64, 65, |
| 2488 | 0, 107, 67, 68, 69, 70, 71, 72, 73, 74, |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 2489 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2490 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2491 | 539, 0, 75, 76, 0, 0, 77, 0, 78, 64, |
| 2492 | 65, 74, 107, 67, 68, 69, 70, 71, 72, 73, |
| 2493 | 0, 1, 2, 0, 3, 4, 5, 64, 65, 0, |
| 2494 | 66, 67, 68, 69, 70, 71, 72, 73, 0, 1, |
| 2495 | 2, 633, 3, 4, 5, 0, 0, 0, 0, 0, |
| 2496 | 0, 0, 74, 0, 0, 75, 76, 0, 0, 77, |
| 2497 | 0, 78, 0, 0, 0, 0, 0, 0, 64, 65, |
| 2498 | 74, 107, 67, 68, 69, 70, 71, 72, 73, 0, |
| 2499 | 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, |
| 2500 | 0, 0, 0, 0, 0, 0, 75, 76, 0, 479, |
| 2501 | 77, 0, 78, 0, 0, 0, 0, 0, 0, 64, |
| 2502 | 65, 74, 282, 67, 68, 69, 70, 71, 72, 73, |
| 2503 | 0, 1, 2, 0, 3, 4, 5, 0, 75, 76, |
| 2504 | 0, 0, 77, 0, 78, 0, 0, 0, 64, 65, |
| 2505 | 0, 107, 67, 68, 69, 70, 71, 72, 73, 0, |
| 2506 | 1, 2, 74, 3, 4, 5, 0, 0, 0, 0, |
| 2507 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, |
| 2508 | 76, 0, 0, 77, 0, 78, 0, 0, 0, 0, |
| 2509 | 0, 74, 0, 0, 0, 0, 0, 75, 76, 0, |
| 2510 | 0, 77, 0, 78, 64, 65, 0, 107, 67, 68, |
| 2511 | 69, 70, 71, 72, 73, 0, 1, 2, 0, 3, |
| 2512 | 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2513 | 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, |
| 2514 | 0, 0, 77, 0, 78, 64, 65, 74, 107, 67, |
| 2515 | 68, 69, 70, 71, 72, 640, 0, 1, 2, 0, |
| 2516 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
| 2517 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, |
| 2518 | 76, 0, 0, 77, 0, 78, 64, 65, 74, 107, |
| 2519 | 67, 68, 69, 70, 71, 72, 684, 166, 1, 2, |
| 2520 | 0, 3, 4, 5, 0, 0, 0, 0, 75, 76, |
| 2521 | 0, 0, 77, 0, 377, 0, 0, 0, 167, 168, |
| 2522 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, |
| 2523 | 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, |
| 2524 | 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, |
| 2525 | 189, 190, 191, 192, 193, 0, 0, 0, 0, 0, |
| 2526 | 0, 0, 0, 0, 75, 76, 0, 0, 77, 0, |
| 2527 | 481, 0, 0, 0, 0, 194, 195, 196, 0, 0, |
| 2528 | 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, |
| 2529 | 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, |
| 2530 | 217, 218, 0, 0, 0, 75, 76, 0, 0, 77, |
| 2531 | 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 2532 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2533 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2534 | 0, 0, 0, 0, 0, 0, 75, 76, 0, 0, |
| 2535 | 77, 0, 78 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2536 | }; |
| 2537 | |
| 2538 | static const yytype_int16 yycheck[] = |
| 2539 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2540 | 0, 27, 239, 196, 161, 158, 0, 321, 266, 267, |
| 2541 | 462, 4, 28, 11, 540, 11, 55, 17, 211, 212, |
| 2542 | 213, 214, 215, 17, 21, 55, 192, 172, 221, 289, |
| 2543 | 450, 451, 29, 42, 43, 44, 45, 46, 47, 48, |
| 2544 | 49, 55, 51, 159, 11, 34, 11, 55, 53, 7, |
| 2545 | 660, 165, 78, 55, 32, 33, 55, 42, 43, 44, |
| 2546 | 174, 19, 47, 68, 22, 54, 24, 677, 41, 42, |
| 2547 | 165, 156, 55, 158, 164, 48, 102, 337, 223, 174, |
| 2548 | 106, 54, 165, 193, 117, 118, 112, 54, 254, 54, |
| 2549 | 256, 174, 118, 93, 7, 8, 165, 10, 11, 12, |
| 2550 | 13, 14, 15, 16, 17, 174, 19, 20, 634, 22, |
| 2551 | 23, 24, 165, 165, 640, 641, 142, 143, 538, 377, |
| 2552 | 146, 174, 174, 162, 240, 241, 152, 59, 55, 55, |
| 2553 | 11, 18, 162, 172, 586, 161, 17, 50, 168, 164, |
| 2554 | 398, 399, 400, 169, 164, 255, 339, 257, 162, 163, |
| 2555 | 159, 160, 161, 0, 162, 681, 682, 173, 684, 685, |
| 2556 | 162, 34, 170, 162, 616, 168, 165, 166, 194, 195, |
| 2557 | 196, 197, 170, 165, 170, 701, 702, 174, 170, 162, |
| 2558 | 173, 55, 165, 166, 210, 211, 212, 213, 214, 215, |
| 2559 | 216, 217, 218, 219, 220, 221, 121, 165, 283, 513, |
| 2560 | 164, 286, 287, 288, 172, 231, 165, 20, 165, 165, |
| 2561 | 23, 170, 164, 406, 170, 172, 242, 19, 22, 46, |
| 2562 | 22, 48, 24, 481, 21, 35, 151, 37, 42, 422, |
| 2563 | 44, 424, 425, 426, 22, 162, 162, 22, 323, 166, |
| 2564 | 166, 163, 556, 165, 558, 162, 331, 332, 333, 334, |
| 2565 | 335, 22, 54, 410, 167, 168, 4, 163, 171, 165, |
| 2566 | 173, 174, 62, 63, 64, 65, 66, 67, 141, 142, |
| 2567 | 143, 144, 4, 146, 300, 37, 433, 150, 151, 169, |
| 2568 | 153, 154, 155, 156, 157, 163, 280, 165, 162, 163, |
| 2569 | 169, 317, 318, 319, 7, 8, 159, 160, 161, 163, |
| 2570 | 162, 165, 4, 163, 618, 165, 19, 20, 166, 22, |
| 2571 | 23, 24, 338, 339, 467, 132, 133, 132, 133, 121, |
| 2572 | 122, 132, 133, 114, 115, 54, 411, 412, 413, 414, |
| 2573 | 84, 85, 164, 22, 165, 420, 172, 163, 4, 141, |
| 2574 | 142, 163, 144, 145, 162, 147, 148, 149, 55, 434, |
| 2575 | 11, 377, 57, 172, 163, 162, 158, 162, 22, 596, |
| 2576 | 38, 162, 165, 162, 162, 4, 559, 162, 162, 562, |
| 2577 | 563, 564, 162, 162, 61, 162, 38, 22, 38, 165, |
| 2578 | 406, 165, 467, 165, 410, 165, 165, 38, 162, 165, |
| 2579 | 162, 172, 121, 122, 162, 162, 422, 423, 424, 425, |
| 2580 | 426, 165, 162, 168, 489, 22, 432, 433, 165, 494, |
| 2581 | 165, 496, 141, 142, 499, 144, 145, 17, 147, 148, |
| 2582 | 149, 165, 165, 165, 509, 510, 452, 512, 665, 158, |
| 2583 | 165, 668, 165, 17, 165, 165, 4, 165, 26, 27, |
| 2584 | 165, 165, 367, 368, 369, 370, 371, 372, 373, 165, |
| 2585 | 476, 165, 4, 165, 165, 481, 165, 382, 383, 384, |
| 2586 | 4, 165, 165, 22, 549, 550, 165, 552, 553, 554, |
| 2587 | 555, 165, 165, 165, 165, 560, 172, 165, 4, 165, |
| 2588 | 165, 165, 508, 568, 165, 165, 165, 163, 514, 574, |
| 2589 | 141, 142, 143, 144, 165, 146, 165, 172, 4, 150, |
| 2590 | 151, 54, 153, 154, 155, 156, 157, 162, 534, 286, |
| 2591 | 287, 288, 100, 101, 102, 103, 104, 105, 106, 107, |
| 2592 | 108, 109, 110, 111, 112, 113, 611, 162, 453, 454, |
| 2593 | 455, 456, 165, 559, 163, 165, 562, 563, 564, 464, |
| 2594 | 165, 163, 163, 22, 172, 165, 323, 170, 163, 168, |
| 2595 | 163, 163, 163, 17, 331, 332, 333, 334, 335, 94, |
| 2596 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 595, |
| 2597 | 163, 170, 163, 163, 659, 4, 602, 54, 663, 664, |
| 2598 | 7, 8, 152, 10, 11, 12, 13, 14, 15, 16, |
| 2599 | 17, 617, 19, 20, 594, 22, 23, 24, 523, 524, |
| 2600 | 525, 526, 165, 528, 162, 162, 22, 532, 533, 17, |
| 2601 | 695, 696, 17, 698, 165, 700, 17, 73, 17, 704, |
| 2602 | 656, 93, 635, 50, 231, 710, 112, 17, 106, 90, |
| 2603 | 133, 57, 242, 617, 411, 412, 413, 414, 133, -1, |
| 2604 | 666, 457, -1, 420, -1, -1, -1, -1, -1, -1, |
| 2605 | -1, 576, 577, 578, 579, -1, 656, 434, -1, -1, |
| 2606 | -1, -1, -1, -1, -1, -1, 7, 8, -1, 10, |
| 2607 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
| 2608 | -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, |
| 2609 | -1, -1, -1, -1, -1, -1, -1, -1, 623, -1, |
| 2610 | 625, 626, -1, -1, -1, -1, -1, -1, -1, 50, |
| 2611 | -1, -1, 489, -1, -1, -1, -1, 494, -1, 496, |
| 2612 | -1, -1, 499, -1, -1, -1, -1, -1, -1, -1, |
| 2613 | -1, -1, 509, 510, -1, 512, -1, -1, -1, -1, |
| 2614 | 167, 168, -1, -1, 171, -1, 173, 174, -1, -1, |
| 2615 | 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, |
| 2616 | 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, |
| 2617 | -1, -1, 549, 550, -1, 552, 553, 554, 555, -1, |
| 2618 | -1, -1, -1, 560, -1, -1, -1, -1, -1, -1, |
| 2619 | -1, 568, -1, 50, -1, -1, -1, 574, 141, 142, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2620 | 143, 144, -1, 146, -1, -1, -1, 150, 151, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2621 | 153, 154, 155, 156, 157, -1, -1, -1, -1, 3, |
| 2622 | 4, 5, 6, 7, 8, 9, 167, 168, 0, -1, |
| 2623 | 171, -1, 173, 174, 611, 19, 20, -1, 22, 23, |
| 2624 | 24, 25, 26, 27, -1, -1, 18, 19, 20, -1, |
| 2625 | 22, 23, 24, -1, -1, -1, 40, 41, 30, 31, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2626 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2627 | 54, -1, -1, -1, -1, 59, -1, -1, -1, -1, |
| 2628 | 52, -1, 659, -1, 56, -1, 663, 664, 60, -1, |
| 2629 | -1, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2630 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2631 | 167, 168, -1, -1, 171, -1, 173, 174, 695, 696, |
| 2632 | -1, 698, -1, 700, -1, -1, -1, 704, -1, -1, |
| 2633 | -1, -1, -1, 710, -1, 119, 120, 121, 122, 123, |
| 2634 | 124, 125, 126, 127, 128, 129, 130, 131, -1, 133, |
| 2635 | -1, 135, 136, 137, -1, 139, 140, 141, 142, -1, |
| 2636 | 144, 145, -1, 147, 148, 149, -1, -1, -1, -1, |
| 2637 | -1, -1, -1, -1, 158, -1, 3, 4, 5, 6, |
| 2638 | 7, 8, 9, -1, 168, -1, -1, 171, -1, 173, |
| 2639 | -1, 175, 19, 20, -1, 22, 23, 24, 25, 26, |
| 2640 | 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2641 | -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, |
| 2642 | -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, |
| 2643 | 7, 8, 59, 10, 11, 12, 13, 14, 15, 16, |
| 2644 | 17, -1, 19, 20, -1, 22, 23, 24, 75, 76, |
| 2645 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2646 | 87, 88, 89, 90, 91, 92, 93, -1, -1, -1, |
| 2647 | -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2648 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2649 | -1, -1, 119, 120, 121, 122, 123, 124, 125, 126, |
| 2650 | 127, 128, 129, 130, 131, -1, 133, 0, 135, 136, |
| 2651 | 137, -1, 139, 140, -1, -1, -1, -1, -1, -1, |
| 2652 | -1, -1, -1, -1, -1, 18, 19, 20, -1, 22, |
| 2653 | 23, 24, -1, -1, -1, 162, -1, 30, 31, -1, |
| 2654 | -1, 168, -1, -1, 171, -1, 173, -1, 175, 3, |
| 2655 | 4, 5, 6, 7, 8, 9, -1, -1, -1, 52, |
| 2656 | -1, -1, -1, 56, -1, 19, 20, 60, 22, 23, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2657 | 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, |
| 2658 | -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2659 | 167, 168, -1, -1, 171, -1, 173, 174, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2660 | -1, 55, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2661 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2662 | -1, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2663 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, |
| 2664 | -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2665 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2666 | -1, -1, -1, -1, -1, 119, 120, 121, 122, 123, |
| 2667 | 124, 125, 126, 127, 128, 129, 130, 131, -1, 133, |
| 2668 | -1, 135, 136, 137, -1, 139, 140, -1, -1, -1, |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 2669 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2670 | -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, |
| 2671 | -1, -1, 166, -1, 168, -1, -1, 171, -1, 173, |
| 2672 | -1, 175, 3, 4, 5, 6, 7, 8, 9, -1, |
| 2673 | -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, |
| 2674 | -1, 22, 23, 24, 25, 26, 27, -1, -1, -1, |
| 2675 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, |
| 2676 | 41, -1, 167, 168, -1, -1, 171, -1, 173, 174, |
| 2677 | -1, -1, -1, -1, 55, 7, 8, -1, 10, 11, |
| 2678 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2679 | 22, 23, 24, -1, 75, 76, 77, 78, 79, 80, |
| 2680 | 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
| 2681 | 91, 92, 93, -1, -1, -1, -1, -1, 50, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2682 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2683 | -1, -1, -1, -1, -1, -1, -1, -1, 119, 120, |
| 2684 | 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, |
| 2685 | 131, -1, 133, -1, 135, 136, 137, -1, 139, 140, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2686 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2687 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2688 | -1, 162, -1, -1, -1, -1, -1, 168, -1, -1, |
| 2689 | 171, -1, 173, 125, 175, 3, 4, 5, 6, 7, |
| 2690 | 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2691 | -1, 19, 20, -1, 22, 23, 24, 25, 26, 27, |
| 2692 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2693 | -1, -1, 40, 41, -1, 167, 168, -1, -1, 171, |
| 2694 | -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2695 | -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2696 | -1, -1, -1, -1, -1, -1, -1, 75, 76, 77, |
| 2697 | 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, |
| 2698 | 88, 89, 90, 91, 92, 93, -1, -1, -1, -1, |
| 2699 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2700 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2701 | -1, 119, 120, 121, 122, 123, 124, 125, 126, 127, |
| 2702 | 128, 129, 130, 131, -1, 133, -1, 135, 136, 137, |
| 2703 | -1, 139, 140, 3, 4, 5, 6, -1, -1, 9, |
| 2704 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2705 | -1, -1, -1, -1, -1, 25, 26, 27, -1, -1, |
| 2706 | 168, -1, -1, 171, -1, 173, -1, 175, -1, -1, |
| 2707 | 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2708 | -1, -1, -1, -1, -1, -1, -1, 7, 8, 59, |
| 2709 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2710 | 20, -1, 22, 23, 24, 75, 76, 77, 78, 79, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2711 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2712 | 90, 91, 92, 93, -1, -1, -1, -1, 7, 8, |
| 2713 | 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2714 | 19, 20, -1, 22, 23, 24, -1, -1, -1, 119, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2715 | 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, |
| 2716 | 130, 131, -1, 133, -1, 135, 136, 137, -1, 139, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2717 | 140, 50, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2718 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2719 | -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, |
| 2720 | -1, 171, -1, 173, 39, 175, -1, -1, -1, -1, |
| 2721 | -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, |
| 2722 | -1, 141, 142, -1, 144, 7, 8, 147, 10, 11, |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 2723 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2724 | 22, 23, 24, -1, -1, -1, -1, 167, 168, -1, |
| 2725 | -1, 171, -1, 173, -1, -1, -1, 39, -1, -1, |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 2726 | -1, -1, -1, -1, -1, -1, 7, 8, 50, 10, |
| 2727 | 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2728 | -1, 22, 23, 24, -1, -1, -1, -1, 167, 168, |
| 2729 | -1, 170, 171, -1, 173, -1, -1, -1, 7, 8, |
| 2730 | -1, 10, 11, 12, 13, 14, 15, 16, 17, 50, |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 2731 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 2732 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2733 | 39, -1, 167, 168, -1, -1, 171, -1, 173, 7, |
| 2734 | 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2735 | -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, |
| 2736 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2737 | 20, 39, 22, 23, 24, -1, -1, -1, -1, -1, |
| 2738 | -1, -1, 50, -1, -1, 167, 168, -1, -1, 171, |
| 2739 | -1, 173, -1, -1, -1, -1, -1, -1, 7, 8, |
| 2740 | 50, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2741 | 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, |
| 2742 | -1, -1, -1, -1, -1, -1, 167, 168, -1, 170, |
| 2743 | 171, -1, 173, -1, -1, -1, -1, -1, -1, 7, |
| 2744 | 8, 50, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2745 | -1, 19, 20, -1, 22, 23, 24, -1, 167, 168, |
| 2746 | -1, -1, 171, -1, 173, -1, -1, -1, 7, 8, |
| 2747 | -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2748 | 19, 20, 50, 22, 23, 24, -1, -1, -1, -1, |
| 2749 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, |
| 2750 | 168, -1, -1, 171, -1, 173, -1, -1, -1, -1, |
| 2751 | -1, 50, -1, -1, -1, -1, -1, 167, 168, -1, |
| 2752 | -1, 171, -1, 173, 7, 8, -1, 10, 11, 12, |
| 2753 | 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, |
| 2754 | 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2755 | -1, -1, -1, -1, -1, -1, -1, -1, 167, 168, |
| 2756 | -1, -1, 171, -1, 173, 7, 8, 50, 10, 11, |
| 2757 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2758 | 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2759 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, |
| 2760 | 168, -1, -1, 171, -1, 173, 7, 8, 50, 10, |
| 2761 | 11, 12, 13, 14, 15, 16, 17, 36, 19, 20, |
| 2762 | -1, 22, 23, 24, -1, -1, -1, -1, 167, 168, |
| 2763 | -1, -1, 171, -1, 173, -1, -1, -1, 57, 58, |
| 2764 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, |
| 2765 | 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, |
| 2766 | 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, |
| 2767 | 89, 90, 91, 92, 93, -1, -1, -1, -1, -1, |
| 2768 | -1, -1, -1, -1, 167, 168, -1, -1, 171, -1, |
| 2769 | 173, -1, -1, -1, -1, 114, 115, 116, -1, -1, |
| 2770 | 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, |
| 2771 | 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, |
| 2772 | 139, 140, -1, -1, -1, 167, 168, -1, -1, 171, |
| 2773 | -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +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, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2776 | -1, -1, -1, -1, -1, -1, 167, 168, -1, -1, |
| 2777 | 171, -1, 173 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2778 | }; |
| 2779 | |
| 2780 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2781 | symbol of state STATE-NUM. */ |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 2782 | static const yytype_uint16 yystos[] = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2783 | { |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 2784 | 0, 19, 20, 22, 23, 24, 30, 31, 52, 56, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2785 | 60, 182, 185, 187, 188, 189, 223, 224, 225, 227, |
| 2786 | 226, 53, 68, 232, 164, 59, 164, 18, 164, 42, |
| 2787 | 43, 44, 45, 46, 47, 48, 49, 51, 159, 160, |
| 2788 | 161, 190, 191, 192, 0, 225, 46, 48, 193, 242, |
| 2789 | 42, 43, 44, 47, 194, 239, 241, 249, 164, 164, |
| 2790 | 168, 233, 22, 231, 7, 8, 10, 11, 12, 13, |
| 2791 | 14, 15, 16, 17, 50, 167, 168, 171, 173, 182, |
| 2792 | 187, 210, 211, 245, 192, 192, 35, 37, 221, 192, |
| 2793 | 192, 21, 250, 251, 29, 174, 240, 250, 22, 22, |
| 2794 | 22, 234, 162, 4, 4, 4, 173, 10, 174, 211, |
| 2795 | 216, 55, 162, 184, 221, 221, 42, 44, 195, 32, |
| 2796 | 33, 220, 62, 63, 64, 65, 66, 67, 196, 237, |
| 2797 | 237, 7, 185, 186, 254, 165, 170, 39, 211, 212, |
| 2798 | 214, 215, 169, 169, 174, 216, 165, 174, 162, 215, |
| 2799 | 166, 220, 220, 10, 125, 211, 213, 222, 211, 217, |
| 2800 | 4, 200, 28, 173, 238, 164, 36, 57, 58, 69, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2801 | 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
| 2802 | 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 2803 | 90, 91, 92, 93, 114, 115, 116, 119, 120, 121, |
| 2804 | 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2805 | 132, 133, 134, 135, 136, 137, 138, 139, 140, 177, |
| 2806 | 178, 179, 252, 259, 260, 261, 262, 252, 260, 22, |
| 2807 | 198, 165, 163, 211, 211, 172, 174, 211, 4, 163, |
| 2808 | 217, 211, 162, 245, 3, 4, 5, 6, 9, 25, |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 2809 | 26, 27, 40, 41, 90, 91, 92, 93, 119, 133, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2810 | 135, 136, 137, 139, 140, 168, 171, 173, 175, 177, |
| 2811 | 178, 179, 218, 245, 184, 141, 142, 144, 147, 199, |
| 2812 | 213, 57, 10, 211, 247, 248, 11, 17, 11, 196, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2813 | 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2814 | 180, 26, 27, 100, 101, 102, 103, 104, 105, 106, |
| 2815 | 107, 108, 109, 110, 111, 112, 113, 181, 180, 181, |
| 2816 | 211, 211, 247, 211, 211, 255, 247, 247, 247, 247, |
| 2817 | 247, 211, 211, 211, 211, 211, 247, 196, 117, 118, |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2818 | 54, 121, 122, 141, 142, 144, 145, 147, 148, 149, |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 2819 | 158, 197, 39, 212, 202, 170, 172, 172, 163, 202, |
| 2820 | 184, 184, 222, 180, 181, 180, 181, 162, 162, 162, |
| 2821 | 162, 162, 162, 162, 170, 217, 219, 173, 219, 174, |
| 2822 | 219, 22, 162, 162, 162, 228, 187, 3, 4, 5, |
| 2823 | 6, 9, 25, 26, 27, 40, 41, 59, 168, 171, |
| 2824 | 173, 175, 218, 244, 245, 246, 165, 246, 246, 246, |
| 2825 | 200, 211, 211, 211, 211, 165, 205, 165, 205, 246, |
| 2826 | 168, 165, 165, 165, 165, 165, 165, 246, 246, 246, |
| 2827 | 246, 246, 38, 200, 211, 247, 4, 141, 142, 143, |
| 2828 | 144, 146, 150, 151, 153, 154, 155, 156, 157, 201, |
| 2829 | 229, 230, 38, 162, 162, 162, 162, 217, 217, 217, |
| 2830 | 217, 217, 217, 217, 165, 170, 174, 211, 219, 172, |
| 2831 | 174, 217, 217, 217, 165, 208, 162, 61, 243, 170, |
| 2832 | 219, 173, 219, 174, 219, 22, 247, 165, 165, 213, |
| 2833 | 246, 246, 246, 246, 11, 54, 11, 257, 246, 168, |
| 2834 | 247, 211, 247, 247, 247, 165, 165, 258, 165, 165, |
| 2835 | 165, 211, 213, 246, 165, 208, 208, 211, 217, 217, |
| 2836 | 217, 217, 257, 165, 165, 165, 165, 258, 165, 217, |
| 2837 | 172, 174, 165, 165, 38, 34, 54, 206, 209, 39, |
| 2838 | 211, 235, 236, 22, 170, 174, 219, 172, 174, 17, |
| 2839 | 17, 246, 165, 165, 165, 165, 246, 4, 246, 165, |
| 2840 | 165, 246, 165, 165, 165, 4, 4, 165, 211, 246, |
| 2841 | 246, 246, 165, 205, 211, 163, 165, 165, 165, 165, |
| 2842 | 163, 217, 217, 217, 217, 163, 217, 172, 217, 217, |
| 2843 | 211, 22, 4, 208, 198, 165, 163, 165, 172, 174, |
| 2844 | 246, 246, 162, 246, 246, 246, 246, 205, 205, 247, |
| 2845 | 246, 165, 247, 247, 247, 4, 246, 162, 246, 217, |
| 2846 | 217, 217, 217, 165, 163, 165, 165, 258, 163, 163, |
| 2847 | 163, 182, 183, 39, 211, 202, 22, 172, 165, 168, |
| 2848 | 17, 211, 256, 170, 246, 258, 256, 205, 163, 163, |
| 2849 | 163, 163, 217, 217, 217, 163, 198, 206, 207, 17, |
| 2850 | 11, 170, 253, 198, 198, 163, 165, 170, 163, 163, |
| 2851 | 163, 163, 183, 54, 204, 246, 244, 11, 170, 121, |
| 2852 | 122, 246, 246, 202, 17, 211, 202, 4, 152, 203, |
| 2853 | 165, 244, 198, 198, 38, 198, 198, 22, 17, 165, |
| 2854 | 17, 246, 246, 246, 17, 246, 198, 198, 246, 73, |
| 2855 | 17, 246 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2856 | }; |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2857 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2858 | #define yyerrok (yyerrstatus = 0) |
| 2859 | #define yyclearin (yychar = YYEMPTY) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2860 | #define YYEMPTY (-2) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2861 | #define YYEOF 0 |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2862 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2863 | #define YYACCEPT goto yyacceptlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2864 | #define YYABORT goto yyabortlab |
| 2865 | #define YYERROR goto yyerrorlab |
| 2866 | |
| 2867 | |
| 2868 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2869 | to ease the transition to the new meaning of YYERROR, for GCC. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2870 | Once GCC version 2 has supplanted version 1, this can go. */ |
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 YYFAIL goto yyerrlab |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2873 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2874 | #define YYRECOVERING() (!!yyerrstatus) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2875 | |
| 2876 | #define YYBACKUP(Token, Value) \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2877 | do \ |
| 2878 | if (yychar == YYEMPTY && yylen == 1) \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2879 | { \ |
| 2880 | yychar = (Token); \ |
| 2881 | yylval = (Value); \ |
| 2882 | yytoken = YYTRANSLATE (yychar); \ |
| 2883 | YYPOPSTACK (1); \ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2884 | goto yybackup; \ |
| 2885 | } \ |
| 2886 | else \ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2887 | { \ |
| 2888 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2889 | YYERROR; \ |
| 2890 | } \ |
| 2891 | while (YYID (0)) |
| 2892 | |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 2893 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2894 | #define YYTERROR 1 |
| 2895 | #define YYERRCODE 256 |
| 2896 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2897 | |
| 2898 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2899 | If N is 0, then set CURRENT to the empty location which ends |
| 2900 | the previous symbol: RHS[0] (always defined). */ |
| 2901 | |
| 2902 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2903 | #ifndef YYLLOC_DEFAULT |
| 2904 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2905 | do \ |
| 2906 | if (YYID (N)) \ |
| 2907 | { \ |
| 2908 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2909 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2910 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2911 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2912 | } \ |
| 2913 | else \ |
| 2914 | { \ |
| 2915 | (Current).first_line = (Current).last_line = \ |
| 2916 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2917 | (Current).first_column = (Current).last_column = \ |
| 2918 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2919 | } \ |
| 2920 | while (YYID (0)) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 2921 | #endif |
| 2922 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2923 | |
| 2924 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2925 | This macro was not mandated originally: define only if we know |
| 2926 | we won't break user code: when these are the locations we know. */ |
| 2927 | |
| 2928 | #ifndef YY_LOCATION_PRINT |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 2929 | # if YYLTYPE_IS_TRIVIAL |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2930 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2931 | fprintf (File, "%d.%d-%d.%d", \ |
| 2932 | (Loc).first_line, (Loc).first_column, \ |
| 2933 | (Loc).last_line, (Loc).last_column) |
| 2934 | # else |
| 2935 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2936 | # endif |
| 2937 | #endif |
| 2938 | |
| 2939 | |
| 2940 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2941 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2942 | #ifdef YYLEX_PARAM |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2943 | # define YYLEX yylex (YYLEX_PARAM) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 2944 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2945 | # define YYLEX yylex () |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2946 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2947 | |
| 2948 | /* Enable debugging if requested. */ |
| 2949 | #if YYDEBUG |
| 2950 | |
| 2951 | # ifndef YYFPRINTF |
| 2952 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2953 | # define YYFPRINTF fprintf |
| 2954 | # endif |
| 2955 | |
| 2956 | # define YYDPRINTF(Args) \ |
| 2957 | do { \ |
| 2958 | if (yydebug) \ |
| 2959 | YYFPRINTF Args; \ |
| 2960 | } while (YYID (0)) |
| 2961 | |
| 2962 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2963 | do { \ |
| 2964 | if (yydebug) \ |
| 2965 | { \ |
| 2966 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2967 | yy_symbol_print (stderr, \ |
| 2968 | Type, Value); \ |
| 2969 | YYFPRINTF (stderr, "\n"); \ |
| 2970 | } \ |
| 2971 | } while (YYID (0)) |
| 2972 | |
| 2973 | |
| 2974 | /*--------------------------------. |
| 2975 | | Print this symbol on YYOUTPUT. | |
| 2976 | `--------------------------------*/ |
| 2977 | |
| 2978 | /*ARGSUSED*/ |
| 2979 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2980 | || defined __cplusplus || defined _MSC_VER) |
| 2981 | static void |
| 2982 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2983 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2984 | static void |
| 2985 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 2986 | FILE *yyoutput; |
| 2987 | int yytype; |
| 2988 | YYSTYPE const * const yyvaluep; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2989 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2990 | { |
| 2991 | if (!yyvaluep) |
| 2992 | return; |
| 2993 | # ifdef YYPRINT |
| 2994 | if (yytype < YYNTOKENS) |
| 2995 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2996 | # else |
| 2997 | YYUSE (yyoutput); |
| 2998 | # endif |
| 2999 | switch (yytype) |
| 3000 | { |
| 3001 | default: |
| 3002 | break; |
| 3003 | } |
| 3004 | } |
| 3005 | |
| 3006 | |
| 3007 | /*--------------------------------. |
| 3008 | | Print this symbol on YYOUTPUT. | |
| 3009 | `--------------------------------*/ |
| 3010 | |
| 3011 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3012 | || defined __cplusplus || defined _MSC_VER) |
| 3013 | static void |
| 3014 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 3015 | #else |
| 3016 | static void |
| 3017 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 3018 | FILE *yyoutput; |
| 3019 | int yytype; |
| 3020 | YYSTYPE const * const yyvaluep; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3021 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3022 | { |
| 3023 | if (yytype < YYNTOKENS) |
| 3024 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 3025 | else |
| 3026 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3027 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3028 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 3029 | YYFPRINTF (yyoutput, ")"); |
| 3030 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3031 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3032 | /*------------------------------------------------------------------. |
| 3033 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 3034 | | TOP (included). | |
| 3035 | `------------------------------------------------------------------*/ |
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 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3038 | || defined __cplusplus || defined _MSC_VER) |
| 3039 | static void |
| 3040 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
| 3041 | #else |
| 3042 | static void |
| 3043 | yy_stack_print (bottom, top) |
| 3044 | yytype_int16 *bottom; |
| 3045 | yytype_int16 *top; |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3046 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3047 | { |
| 3048 | YYFPRINTF (stderr, "Stack now"); |
| 3049 | for (; bottom <= top; ++bottom) |
| 3050 | YYFPRINTF (stderr, " %d", *bottom); |
| 3051 | YYFPRINTF (stderr, "\n"); |
| 3052 | } |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3053 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3054 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 3055 | do { \ |
| 3056 | if (yydebug) \ |
| 3057 | yy_stack_print ((Bottom), (Top)); \ |
| 3058 | } while (YYID (0)) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3059 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3060 | |
| 3061 | /*------------------------------------------------. |
| 3062 | | Report that the YYRULE is going to be reduced. | |
| 3063 | `------------------------------------------------*/ |
| 3064 | |
| 3065 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3066 | || defined __cplusplus || defined _MSC_VER) |
| 3067 | static void |
| 3068 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 3069 | #else |
| 3070 | static void |
| 3071 | yy_reduce_print (yyvsp, yyrule) |
| 3072 | YYSTYPE *yyvsp; |
| 3073 | int yyrule; |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 3074 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3075 | { |
| 3076 | int yynrhs = yyr2[yyrule]; |
| 3077 | int yyi; |
| 3078 | unsigned long int yylno = yyrline[yyrule]; |
| 3079 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 3080 | yyrule - 1, yylno); |
| 3081 | /* The symbols being reduced. */ |
| 3082 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 3083 | { |
| 3084 | fprintf (stderr, " $%d = ", yyi + 1); |
| 3085 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 3086 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 3087 | ); |
| 3088 | fprintf (stderr, "\n"); |
| 3089 | } |
| 3090 | } |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3091 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3092 | # define YY_REDUCE_PRINT(Rule) \ |
| 3093 | do { \ |
| 3094 | if (yydebug) \ |
| 3095 | yy_reduce_print (yyvsp, Rule); \ |
| 3096 | } while (YYID (0)) |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3097 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3098 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 3099 | multiple parsers can coexist. */ |
| 3100 | int yydebug; |
| 3101 | #else /* !YYDEBUG */ |
| 3102 | # define YYDPRINTF(Args) |
| 3103 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 3104 | # define YY_STACK_PRINT(Bottom, Top) |
| 3105 | # define YY_REDUCE_PRINT(Rule) |
| 3106 | #endif /* !YYDEBUG */ |
| 3107 | |
| 3108 | |
| 3109 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3110 | #ifndef YYINITDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3111 | # define YYINITDEPTH 200 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3112 | #endif |
| 3113 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3114 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 3115 | if the built-in stack extension method is used). |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3116 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3117 | Do not make this value too large; the results are undefined if |
| 3118 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 3119 | evaluated with infinite-precision integer arithmetic. */ |
David Greene | 718fda3 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 3120 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3121 | #ifndef YYMAXDEPTH |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3122 | # define YYMAXDEPTH 10000 |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3123 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3124 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3125 | |
| 3126 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3127 | #if YYERROR_VERBOSE |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3128 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3129 | # ifndef yystrlen |
| 3130 | # if defined __GLIBC__ && defined _STRING_H |
| 3131 | # define yystrlen strlen |
| 3132 | # else |
| 3133 | /* Return the length of YYSTR. */ |
| 3134 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3135 | || defined __cplusplus || defined _MSC_VER) |
| 3136 | static YYSIZE_T |
| 3137 | yystrlen (const char *yystr) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3138 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3139 | static YYSIZE_T |
| 3140 | yystrlen (yystr) |
| 3141 | const char *yystr; |
| 3142 | #endif |
| 3143 | { |
| 3144 | YYSIZE_T yylen; |
| 3145 | for (yylen = 0; yystr[yylen]; yylen++) |
| 3146 | continue; |
| 3147 | return yylen; |
| 3148 | } |
| 3149 | # endif |
| 3150 | # endif |
| 3151 | |
| 3152 | # ifndef yystpcpy |
| 3153 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 3154 | # define yystpcpy stpcpy |
| 3155 | # else |
| 3156 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 3157 | YYDEST. */ |
| 3158 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3159 | || defined __cplusplus || defined _MSC_VER) |
| 3160 | static char * |
| 3161 | yystpcpy (char *yydest, const char *yysrc) |
| 3162 | #else |
| 3163 | static char * |
| 3164 | yystpcpy (yydest, yysrc) |
| 3165 | char *yydest; |
| 3166 | const char *yysrc; |
| 3167 | #endif |
| 3168 | { |
| 3169 | char *yyd = yydest; |
| 3170 | const char *yys = yysrc; |
| 3171 | |
| 3172 | while ((*yyd++ = *yys++) != '\0') |
| 3173 | continue; |
| 3174 | |
| 3175 | return yyd - 1; |
| 3176 | } |
| 3177 | # endif |
| 3178 | # endif |
| 3179 | |
| 3180 | # ifndef yytnamerr |
| 3181 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 3182 | quotes and backslashes, so that it's suitable for yyerror. The |
| 3183 | heuristic is that double-quoting is unnecessary unless the string |
| 3184 | contains an apostrophe, a comma, or backslash (other than |
| 3185 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 3186 | null, do not copy; instead, return the length of what the result |
| 3187 | would have been. */ |
| 3188 | static YYSIZE_T |
| 3189 | yytnamerr (char *yyres, const char *yystr) |
| 3190 | { |
| 3191 | if (*yystr == '"') |
| 3192 | { |
| 3193 | YYSIZE_T yyn = 0; |
| 3194 | char const *yyp = yystr; |
| 3195 | |
| 3196 | for (;;) |
| 3197 | switch (*++yyp) |
| 3198 | { |
| 3199 | case '\'': |
| 3200 | case ',': |
| 3201 | goto do_not_strip_quotes; |
| 3202 | |
| 3203 | case '\\': |
| 3204 | if (*++yyp != '\\') |
| 3205 | goto do_not_strip_quotes; |
| 3206 | /* Fall through. */ |
| 3207 | default: |
| 3208 | if (yyres) |
| 3209 | yyres[yyn] = *yyp; |
| 3210 | yyn++; |
| 3211 | break; |
| 3212 | |
| 3213 | case '"': |
| 3214 | if (yyres) |
| 3215 | yyres[yyn] = '\0'; |
| 3216 | return yyn; |
| 3217 | } |
| 3218 | do_not_strip_quotes: ; |
| 3219 | } |
| 3220 | |
| 3221 | if (! yyres) |
| 3222 | return yystrlen (yystr); |
| 3223 | |
| 3224 | return yystpcpy (yyres, yystr) - yyres; |
| 3225 | } |
| 3226 | # endif |
| 3227 | |
| 3228 | /* Copy into YYRESULT an error message about the unexpected token |
| 3229 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 3230 | including the terminating null byte. If YYRESULT is null, do not |
| 3231 | copy anything; just return the number of bytes that would be |
| 3232 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 3233 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 3234 | size calculation. */ |
| 3235 | static YYSIZE_T |
| 3236 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 3237 | { |
| 3238 | int yyn = yypact[yystate]; |
| 3239 | |
| 3240 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 3241 | return 0; |
| 3242 | else |
| 3243 | { |
| 3244 | int yytype = YYTRANSLATE (yychar); |
| 3245 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 3246 | YYSIZE_T yysize = yysize0; |
| 3247 | YYSIZE_T yysize1; |
| 3248 | int yysize_overflow = 0; |
| 3249 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 3250 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 3251 | int yyx; |
| 3252 | |
| 3253 | # if 0 |
| 3254 | /* This is so xgettext sees the translatable formats that are |
| 3255 | constructed on the fly. */ |
| 3256 | YY_("syntax error, unexpected %s"); |
| 3257 | YY_("syntax error, unexpected %s, expecting %s"); |
| 3258 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 3259 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 3260 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 3261 | # endif |
| 3262 | char *yyfmt; |
| 3263 | char const *yyf; |
| 3264 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 3265 | static char const yyexpecting[] = ", expecting %s"; |
| 3266 | static char const yyor[] = " or %s"; |
| 3267 | char yyformat[sizeof yyunexpected |
| 3268 | + sizeof yyexpecting - 1 |
| 3269 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 3270 | * (sizeof yyor - 1))]; |
| 3271 | char const *yyprefix = yyexpecting; |
| 3272 | |
| 3273 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 3274 | YYCHECK. */ |
| 3275 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 3276 | |
| 3277 | /* Stay within bounds of both yycheck and yytname. */ |
| 3278 | int yychecklim = YYLAST - yyn + 1; |
| 3279 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 3280 | int yycount = 1; |
| 3281 | |
| 3282 | yyarg[0] = yytname[yytype]; |
| 3283 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 3284 | |
| 3285 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 3286 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 3287 | { |
| 3288 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 3289 | { |
| 3290 | yycount = 1; |
| 3291 | yysize = yysize0; |
| 3292 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 3293 | break; |
| 3294 | } |
| 3295 | yyarg[yycount++] = yytname[yyx]; |
| 3296 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 3297 | yysize_overflow |= (yysize1 < yysize); |
| 3298 | yysize = yysize1; |
| 3299 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 3300 | yyprefix = yyor; |
| 3301 | } |
| 3302 | |
| 3303 | yyf = YY_(yyformat); |
| 3304 | yysize1 = yysize + yystrlen (yyf); |
| 3305 | yysize_overflow |= (yysize1 < yysize); |
| 3306 | yysize = yysize1; |
| 3307 | |
| 3308 | if (yysize_overflow) |
| 3309 | return YYSIZE_MAXIMUM; |
| 3310 | |
| 3311 | if (yyresult) |
| 3312 | { |
| 3313 | /* Avoid sprintf, as that infringes on the user's name space. |
| 3314 | Don't have undefined behavior even if the translation |
| 3315 | produced a string with the wrong number of "%s"s. */ |
| 3316 | char *yyp = yyresult; |
| 3317 | int yyi = 0; |
| 3318 | while ((*yyp = *yyf) != '\0') |
| 3319 | { |
| 3320 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 3321 | { |
| 3322 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 3323 | yyf += 2; |
| 3324 | } |
| 3325 | else |
| 3326 | { |
| 3327 | yyp++; |
| 3328 | yyf++; |
| 3329 | } |
| 3330 | } |
| 3331 | } |
| 3332 | return yysize; |
| 3333 | } |
| 3334 | } |
| 3335 | #endif /* YYERROR_VERBOSE */ |
| 3336 | |
| 3337 | |
| 3338 | /*-----------------------------------------------. |
| 3339 | | Release the memory associated to this symbol. | |
| 3340 | `-----------------------------------------------*/ |
| 3341 | |
| 3342 | /*ARGSUSED*/ |
| 3343 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3344 | || defined __cplusplus || defined _MSC_VER) |
| 3345 | static void |
| 3346 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 3347 | #else |
| 3348 | static void |
| 3349 | yydestruct (yymsg, yytype, yyvaluep) |
| 3350 | const char *yymsg; |
| 3351 | int yytype; |
| 3352 | YYSTYPE *yyvaluep; |
| 3353 | #endif |
| 3354 | { |
| 3355 | YYUSE (yyvaluep); |
| 3356 | |
| 3357 | if (!yymsg) |
| 3358 | yymsg = "Deleting"; |
| 3359 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 3360 | |
| 3361 | switch (yytype) |
| 3362 | { |
| 3363 | |
| 3364 | default: |
| 3365 | break; |
| 3366 | } |
| 3367 | } |
| 3368 | |
| 3369 | |
| 3370 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 3371 | |
| 3372 | #ifdef YYPARSE_PARAM |
| 3373 | #if defined __STDC__ || defined __cplusplus |
| 3374 | int yyparse (void *YYPARSE_PARAM); |
| 3375 | #else |
| 3376 | int yyparse (); |
| 3377 | #endif |
| 3378 | #else /* ! YYPARSE_PARAM */ |
| 3379 | #if defined __STDC__ || defined __cplusplus |
David Greene | 5fd22a8 | 2007-09-04 18:46:50 +0000 | [diff] [blame] | 3380 | int yyparse (void); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3381 | #else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3382 | int yyparse (); |
Scott Michel | 15dcd8e | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3383 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3384 | #endif /* ! YYPARSE_PARAM */ |
Scott Michel | 7f9ba9b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3385 | |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3386 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3387 | |
| 3388 | /* The look-ahead symbol. */ |
| 3389 | int yychar; |
| 3390 | |
| 3391 | /* The semantic value of the look-ahead symbol. */ |
| 3392 | YYSTYPE yylval; |
| 3393 | |
| 3394 | /* Number of syntax errors so far. */ |
| 3395 | int yynerrs; |
| 3396 | |
| 3397 | |
| 3398 | |
| 3399 | /*----------. |
| 3400 | | yyparse. | |
| 3401 | `----------*/ |
| 3402 | |
| 3403 | #ifdef YYPARSE_PARAM |
| 3404 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3405 | || defined __cplusplus || defined _MSC_VER) |
| 3406 | int |
| 3407 | yyparse (void *YYPARSE_PARAM) |
| 3408 | #else |
| 3409 | int |
| 3410 | yyparse (YYPARSE_PARAM) |
| 3411 | void *YYPARSE_PARAM; |
| 3412 | #endif |
| 3413 | #else /* ! YYPARSE_PARAM */ |
| 3414 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3415 | || defined __cplusplus || defined _MSC_VER) |
| 3416 | int |
| 3417 | yyparse (void) |
| 3418 | #else |
| 3419 | int |
| 3420 | yyparse () |
| 3421 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3422 | #endif |
| 3423 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3424 | { |
| 3425 | |
| 3426 | int yystate; |
| 3427 | int yyn; |
| 3428 | int yyresult; |
| 3429 | /* Number of tokens to shift before error messages enabled. */ |
| 3430 | int yyerrstatus; |
| 3431 | /* Look-ahead token as an internal (translated) token number. */ |
| 3432 | int yytoken = 0; |
| 3433 | #if YYERROR_VERBOSE |
| 3434 | /* Buffer for error messages, and its allocated size. */ |
| 3435 | char yymsgbuf[128]; |
| 3436 | char *yymsg = yymsgbuf; |
| 3437 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3438 | #endif |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3439 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3440 | /* Three stacks and their tools: |
| 3441 | `yyss': related to states, |
| 3442 | `yyvs': related to semantic values, |
| 3443 | `yyls': related to locations. |
| 3444 | |
| 3445 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3446 | to reallocate them elsewhere. */ |
| 3447 | |
| 3448 | /* The state stack. */ |
| 3449 | yytype_int16 yyssa[YYINITDEPTH]; |
| 3450 | yytype_int16 *yyss = yyssa; |
| 3451 | yytype_int16 *yyssp; |
| 3452 | |
| 3453 | /* The semantic value stack. */ |
| 3454 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3455 | YYSTYPE *yyvs = yyvsa; |
| 3456 | YYSTYPE *yyvsp; |
| 3457 | |
| 3458 | |
| 3459 | |
| 3460 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 3461 | |
| 3462 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 3463 | |
| 3464 | /* The variables used to return semantic value and location from the |
| 3465 | action routines. */ |
| 3466 | YYSTYPE yyval; |
| 3467 | |
| 3468 | |
| 3469 | /* The number of symbols on the RHS of the reduced rule. |
| 3470 | Keep to zero when no symbol should be popped. */ |
| 3471 | int yylen = 0; |
| 3472 | |
| 3473 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 3474 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3475 | yystate = 0; |
| 3476 | yyerrstatus = 0; |
| 3477 | yynerrs = 0; |
| 3478 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3479 | |
| 3480 | /* Initialize stack pointers. |
| 3481 | Waste one element of value and location stack |
| 3482 | so that they stay on the same level as the state stack. |
| 3483 | The wasted elements are never initialized. */ |
| 3484 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3485 | yyssp = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3486 | yyvsp = yyvs; |
| 3487 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3488 | goto yysetstate; |
Jeff Cohen | 66c5fd6 | 2005-10-23 04:37:20 +0000 | [diff] [blame] | 3489 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3490 | /*------------------------------------------------------------. |
| 3491 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3492 | `------------------------------------------------------------*/ |
| 3493 | yynewstate: |
| 3494 | /* In all cases, when you get here, the value and location stacks |
| 3495 | have just been pushed. So pushing a state here evens the stacks. */ |
| 3496 | yyssp++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3497 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3498 | yysetstate: |
| 3499 | *yyssp = yystate; |
| 3500 | |
| 3501 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3502 | { |
| 3503 | /* Get the current used size of the three stacks, in elements. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3504 | YYSIZE_T yysize = yyssp - yyss + 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3505 | |
| 3506 | #ifdef yyoverflow |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3507 | { |
| 3508 | /* Give user a chance to reallocate the stack. Use copies of |
| 3509 | these so that the &'s don't force the real ones into |
| 3510 | memory. */ |
| 3511 | YYSTYPE *yyvs1 = yyvs; |
| 3512 | yytype_int16 *yyss1 = yyss; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3513 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3514 | |
| 3515 | /* Each stack pointer address is followed by the size of the |
| 3516 | data in use in that stack, in bytes. This used to be a |
| 3517 | conditional around just the two extra args, but that might |
| 3518 | be undefined if yyoverflow is a macro. */ |
| 3519 | yyoverflow (YY_("memory exhausted"), |
| 3520 | &yyss1, yysize * sizeof (*yyssp), |
| 3521 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3522 | |
| 3523 | &yystacksize); |
| 3524 | |
| 3525 | yyss = yyss1; |
| 3526 | yyvs = yyvs1; |
| 3527 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3528 | #else /* no yyoverflow */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3529 | # ifndef YYSTACK_RELOCATE |
| 3530 | goto yyexhaustedlab; |
| 3531 | # else |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3532 | /* Extend the stack our own way. */ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3533 | if (YYMAXDEPTH <= yystacksize) |
| 3534 | goto yyexhaustedlab; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3535 | yystacksize *= 2; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3536 | if (YYMAXDEPTH < yystacksize) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3537 | yystacksize = YYMAXDEPTH; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3538 | |
| 3539 | { |
| 3540 | yytype_int16 *yyss1 = yyss; |
| 3541 | union yyalloc *yyptr = |
| 3542 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3543 | if (! yyptr) |
| 3544 | goto yyexhaustedlab; |
| 3545 | YYSTACK_RELOCATE (yyss); |
| 3546 | YYSTACK_RELOCATE (yyvs); |
| 3547 | |
| 3548 | # undef YYSTACK_RELOCATE |
| 3549 | if (yyss1 != yyssa) |
| 3550 | YYSTACK_FREE (yyss1); |
| 3551 | } |
| 3552 | # endif |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3553 | #endif /* no yyoverflow */ |
| 3554 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3555 | yyssp = yyss + yysize - 1; |
| 3556 | yyvsp = yyvs + yysize - 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3557 | |
| 3558 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3559 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3560 | (unsigned long int) yystacksize)); |
| 3561 | |
| 3562 | if (yyss + yystacksize - 1 <= yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3563 | YYABORT; |
| 3564 | } |
| 3565 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3566 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3567 | |
| 3568 | goto yybackup; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3569 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3570 | /*-----------. |
| 3571 | | yybackup. | |
| 3572 | `-----------*/ |
| 3573 | yybackup: |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 3574 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3575 | /* Do appropriate processing given the current state. Read a |
| 3576 | 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] | 3577 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3578 | /* 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] | 3579 | yyn = yypact[yystate]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3580 | if (yyn == YYPACT_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3581 | goto yydefault; |
| 3582 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3583 | /* 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] | 3584 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3585 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3586 | if (yychar == YYEMPTY) |
| 3587 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3588 | YYDPRINTF ((stderr, "Reading a token: ")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3589 | yychar = YYLEX; |
| 3590 | } |
| 3591 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3592 | if (yychar <= YYEOF) |
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 = yytoken = YYEOF; |
| 3595 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3596 | } |
| 3597 | else |
| 3598 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3599 | yytoken = YYTRANSLATE (yychar); |
| 3600 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3601 | } |
| 3602 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3603 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3604 | detect an error, take that action. */ |
| 3605 | yyn += yytoken; |
| 3606 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3607 | goto yydefault; |
| 3608 | yyn = yytable[yyn]; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3609 | if (yyn <= 0) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3610 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3611 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3612 | goto yyerrlab; |
| 3613 | yyn = -yyn; |
| 3614 | goto yyreduce; |
| 3615 | } |
| 3616 | |
| 3617 | if (yyn == YYFINAL) |
| 3618 | YYACCEPT; |
| 3619 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3620 | /* Count tokens shifted since error; after three, turn off error |
| 3621 | status. */ |
| 3622 | if (yyerrstatus) |
| 3623 | yyerrstatus--; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 3624 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3625 | /* Shift the look-ahead token. */ |
| 3626 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3627 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3628 | /* Discard the shifted token unless it is eof. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 3629 | if (yychar != YYEOF) |
| 3630 | yychar = YYEMPTY; |
| 3631 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3632 | yystate = yyn; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3633 | *++yyvsp = yylval; |
| 3634 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3635 | goto yynewstate; |
| 3636 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3637 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3638 | /*-----------------------------------------------------------. |
| 3639 | | yydefault -- do the default action for the current state. | |
| 3640 | `-----------------------------------------------------------*/ |
| 3641 | yydefault: |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3642 | yyn = yydefact[yystate]; |
| 3643 | if (yyn == 0) |
| 3644 | goto yyerrlab; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3645 | goto yyreduce; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3646 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3647 | |
| 3648 | /*-----------------------------. |
| 3649 | | yyreduce -- Do a reduction. | |
| 3650 | `-----------------------------*/ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3651 | yyreduce: |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3652 | /* yyn is the number of a rule to reduce with. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3653 | yylen = yyr2[yyn]; |
| 3654 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3655 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3656 | `$$ = $1'. |
| 3657 | |
| 3658 | Otherwise, the following line sets YYVAL to garbage. |
| 3659 | This behavior is undocumented and Bison |
| 3660 | users should not rely upon it. Assigning to YYVAL |
| 3661 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3662 | GCC warning that YYVAL may be used uninitialized. */ |
| 3663 | yyval = yyvsp[1-yylen]; |
| 3664 | |
| 3665 | |
| 3666 | YY_REDUCE_PRINT (yyn); |
| 3667 | switch (yyn) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 3668 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3669 | case 29: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3670 | #line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3671 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3672 | break; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3673 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3674 | case 30: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3675 | #line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3676 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3677 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3678 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3679 | case 31: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3680 | #line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3681 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3682 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3683 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3684 | case 32: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3685 | #line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3686 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3687 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3688 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3689 | case 33: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3690 | #line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3691 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3692 | break; |
Reid Spencer | b0fcf8f | 2007-01-17 02:48:45 +0000 | [diff] [blame] | 3693 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3694 | case 34: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3695 | #line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3696 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3697 | break; |
| 3698 | |
| 3699 | case 35: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3700 | #line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3701 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3702 | break; |
| 3703 | |
| 3704 | case 36: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3705 | #line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3706 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3707 | break; |
| 3708 | |
| 3709 | case 37: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3710 | #line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3711 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3712 | break; |
| 3713 | |
| 3714 | case 38: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3715 | #line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3716 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3717 | break; |
| 3718 | |
| 3719 | case 39: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3720 | #line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3721 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3722 | break; |
| 3723 | |
| 3724 | case 40: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3725 | #line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3726 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3727 | break; |
| 3728 | |
| 3729 | case 41: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3730 | #line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3731 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3732 | break; |
| 3733 | |
| 3734 | case 42: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3735 | #line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3736 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3737 | break; |
| 3738 | |
| 3739 | case 43: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3740 | #line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3741 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3742 | break; |
| 3743 | |
| 3744 | case 44: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3745 | #line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3746 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3747 | break; |
| 3748 | |
| 3749 | case 45: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3750 | #line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3751 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3752 | break; |
| 3753 | |
| 3754 | case 46: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3755 | #line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3756 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3757 | break; |
| 3758 | |
| 3759 | case 47: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3760 | #line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3761 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3762 | break; |
| 3763 | |
| 3764 | case 48: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3765 | #line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3766 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3767 | break; |
| 3768 | |
| 3769 | case 49: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3770 | #line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3771 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3772 | break; |
| 3773 | |
| 3774 | case 50: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3775 | #line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3776 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3777 | break; |
| 3778 | |
| 3779 | case 51: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3780 | #line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3781 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3782 | break; |
| 3783 | |
| 3784 | case 52: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3785 | #line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3786 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3787 | break; |
| 3788 | |
| 3789 | case 53: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3790 | #line 1173 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3791 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3792 | break; |
| 3793 | |
| 3794 | case 54: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3795 | #line 1174 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3796 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3797 | break; |
| 3798 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3799 | case 59: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3800 | #line 1178 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3801 | { (yyval.StrVal) = 0; ;} |
| 3802 | break; |
| 3803 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3804 | case 60: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3805 | #line 1180 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3806 | { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} |
| 3807 | break; |
| 3808 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3809 | case 61: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3810 | #line 1181 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3811 | { (yyval.UIntVal)=0; ;} |
| 3812 | break; |
| 3813 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3814 | case 62: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3815 | #line 1185 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3816 | { |
| 3817 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 3818 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3819 | ;} |
| 3820 | break; |
| 3821 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3822 | case 63: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3823 | #line 1189 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3824 | { |
| 3825 | (yyval.StrVal) = 0; |
| 3826 | CHECK_FOR_ERROR |
| 3827 | ;} |
| 3828 | break; |
| 3829 | |
| 3830 | case 64: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3831 | #line 1194 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3832 | { |
| 3833 | (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal); |
| 3834 | CHECK_FOR_ERROR |
| 3835 | ;} |
| 3836 | break; |
| 3837 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3838 | case 68: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3839 | #line 1203 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3840 | { |
| 3841 | (yyval.StrVal) = 0; |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3842 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3843 | ;} |
| 3844 | break; |
| 3845 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3846 | case 69: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3847 | #line 1208 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3848 | { |
| 3849 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3850 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3851 | ;} |
| 3852 | break; |
| 3853 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3854 | case 70: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3855 | #line 1214 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3856 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3857 | break; |
| 3858 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3859 | case 71: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3860 | #line 1215 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3861 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3862 | break; |
| 3863 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3864 | case 72: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3865 | #line 1216 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3866 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3867 | break; |
| 3868 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3869 | case 73: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3870 | #line 1217 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3871 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3872 | break; |
| 3873 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3874 | case 74: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3875 | #line 1218 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3876 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3877 | break; |
| 3878 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3879 | case 75: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3880 | #line 1219 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3881 | { (yyval.Linkage) = GlobalValue::CommonLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3882 | break; |
| 3883 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3884 | case 76: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3885 | #line 1223 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3886 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3887 | break; |
| 3888 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3889 | case 77: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3890 | #line 1224 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3891 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3892 | break; |
| 3893 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3894 | case 78: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3895 | #line 1225 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3896 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3897 | break; |
| 3898 | |
| 3899 | case 79: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3900 | #line 1229 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 3901 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3902 | break; |
| 3903 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3904 | case 80: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3905 | #line 1230 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3906 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3907 | break; |
| 3908 | |
| 3909 | case 81: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3910 | #line 1231 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3911 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3912 | break; |
| 3913 | |
| 3914 | case 82: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3915 | #line 1232 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3916 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
| 3917 | break; |
| 3918 | |
| 3919 | case 83: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3920 | #line 1236 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3921 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3922 | break; |
| 3923 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3924 | case 84: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3925 | #line 1237 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3926 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3927 | break; |
| 3928 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3929 | case 85: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3930 | #line 1238 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3931 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3932 | break; |
| 3933 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3934 | case 86: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3935 | #line 1242 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3936 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3937 | break; |
| 3938 | |
| 3939 | case 87: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3940 | #line 1243 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3941 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3942 | break; |
| 3943 | |
| 3944 | case 88: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3945 | #line 1244 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3946 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3947 | break; |
| 3948 | |
| 3949 | case 89: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3950 | #line 1245 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3951 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3952 | break; |
| 3953 | |
| 3954 | case 90: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3955 | #line 1246 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3956 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3957 | break; |
| 3958 | |
| 3959 | case 91: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3960 | #line 1250 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 3961 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3962 | break; |
| 3963 | |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3964 | case 92: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3965 | #line 1251 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3966 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
Chris Lattner | f9078f9 | 2008-10-15 06:03:48 +0000 | [diff] [blame] | 3967 | break; |
| 3968 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3969 | case 93: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3970 | #line 1252 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3971 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3972 | break; |
| 3973 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3974 | case 94: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3975 | #line 1255 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 3976 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3977 | break; |
| 3978 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3979 | case 95: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3980 | #line 1256 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 3981 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3982 | break; |
| 3983 | |
| 3984 | case 96: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3985 | #line 1257 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3986 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3987 | break; |
| 3988 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3989 | case 97: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3990 | #line 1258 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3991 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3992 | break; |
| 3993 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3994 | case 98: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 3995 | #line 1259 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 3996 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 3997 | break; |
| 3998 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 3999 | case 99: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4000 | #line 1260 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4001 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 4002 | break; |
| 4003 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4004 | case 100: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4005 | #line 1261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4006 | { |
| 4007 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4008 | GEN_ERROR("Calling conv too large"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4009 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4010 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4011 | ;} |
| 4012 | break; |
| 4013 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4014 | case 101: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4015 | #line 1268 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 4016 | { (yyval.Attributes) = Attribute::ZExt; ;} |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4017 | break; |
| 4018 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4019 | case 102: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4020 | #line 1269 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4021 | { (yyval.Attributes) = Attribute::ZExt; ;} |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4022 | break; |
| 4023 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4024 | case 103: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4025 | #line 1270 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 8a5f347 | 2008-10-15 12:05:02 +0000 | [diff] [blame] | 4026 | { (yyval.Attributes) = Attribute::SExt; ;} |
| 4027 | break; |
| 4028 | |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4029 | case 104: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4030 | #line 1271 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nuno Lopes | 1983033 | 2008-11-04 14:28:33 +0000 | [diff] [blame] | 4031 | { (yyval.Attributes) = Attribute::SExt; ;} |
| 4032 | break; |
| 4033 | |
| 4034 | case 105: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4035 | #line 1272 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4036 | { (yyval.Attributes) = Attribute::InReg; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4037 | break; |
| 4038 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4039 | case 106: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4040 | #line 1273 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4041 | { (yyval.Attributes) = Attribute::StructRet; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4042 | break; |
| 4043 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4044 | case 107: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4045 | #line 1274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4046 | { (yyval.Attributes) = Attribute::NoAlias; ;} |
Dale Johannesen | c7071cc | 2008-05-14 20:13:36 +0000 | [diff] [blame] | 4047 | break; |
| 4048 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4049 | case 108: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4050 | #line 1275 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4051 | { (yyval.Attributes) = Attribute::NoCapture; ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 4052 | break; |
| 4053 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4054 | case 109: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4055 | #line 1276 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4056 | { (yyval.Attributes) = Attribute::ByVal; ;} |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4057 | break; |
| 4058 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4059 | case 110: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4060 | #line 1277 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4061 | { (yyval.Attributes) = Attribute::Nest; ;} |
| 4062 | break; |
| 4063 | |
| 4064 | case 111: |
| 4065 | #line 1278 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4066 | { (yyval.Attributes) = |
| 4067 | Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4068 | break; |
| 4069 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4070 | case 112: |
| 4071 | #line 1282 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4072 | { (yyval.Attributes) = Attribute::None; ;} |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4073 | break; |
| 4074 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4075 | case 113: |
| 4076 | #line 1283 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dale Johannesen | dfe8c84 | 2008-09-26 19:32:34 +0000 | [diff] [blame] | 4077 | { |
| 4078 | (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); |
| 4079 | ;} |
| 4080 | break; |
| 4081 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4082 | case 114: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4083 | #line 1288 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4084 | { (yyval.Attributes) = Attribute::InReg; ;} |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4085 | break; |
| 4086 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4087 | case 115: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4088 | #line 1289 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4089 | { (yyval.Attributes) = Attribute::ZExt; ;} |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4090 | break; |
| 4091 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4092 | case 116: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4093 | #line 1290 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4094 | { (yyval.Attributes) = Attribute::SExt; ;} |
Chris Lattner | ccef6b5 | 2008-09-23 21:18:31 +0000 | [diff] [blame] | 4095 | break; |
| 4096 | |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4097 | case 117: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4098 | #line 1291 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4099 | { (yyval.Attributes) = Attribute::NoAlias; ;} |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4100 | break; |
| 4101 | |
| 4102 | case 118: |
| 4103 | #line 1294 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4104 | { (yyval.Attributes) = Attribute::None; ;} |
| 4105 | break; |
| 4106 | |
| 4107 | case 119: |
| 4108 | #line 1295 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4109 | { |
| 4110 | (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); |
| 4111 | ;} |
| 4112 | break; |
| 4113 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4114 | case 120: |
| 4115 | #line 1301 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4116 | { (yyval.Attributes) = Attribute::NoReturn; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4117 | break; |
| 4118 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4119 | case 121: |
| 4120 | #line 1302 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4121 | { (yyval.Attributes) = Attribute::NoUnwind; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4122 | break; |
| 4123 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4124 | case 122: |
| 4125 | #line 1303 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4126 | { (yyval.Attributes) = Attribute::InReg; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4127 | break; |
| 4128 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4129 | case 123: |
| 4130 | #line 1304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4131 | { (yyval.Attributes) = Attribute::ZExt; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4132 | break; |
| 4133 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4134 | case 124: |
| 4135 | #line 1305 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4136 | { (yyval.Attributes) = Attribute::SExt; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4137 | break; |
| 4138 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4139 | case 125: |
| 4140 | #line 1306 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4141 | { (yyval.Attributes) = Attribute::ReadNone; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4142 | break; |
| 4143 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4144 | case 126: |
| 4145 | #line 1307 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4146 | { (yyval.Attributes) = Attribute::ReadOnly; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4147 | break; |
| 4148 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4149 | case 127: |
| 4150 | #line 1308 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4151 | { (yyval.Attributes) = Attribute::NoInline; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4152 | break; |
| 4153 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4154 | case 128: |
| 4155 | #line 1309 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4156 | { (yyval.Attributes) = Attribute::AlwaysInline; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4157 | break; |
| 4158 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4159 | case 129: |
| 4160 | #line 1310 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4161 | { (yyval.Attributes) = Attribute::OptimizeForSize; ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 4162 | break; |
| 4163 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4164 | case 130: |
| 4165 | #line 1311 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4166 | { (yyval.Attributes) = Attribute::StackProtect; ;} |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4167 | break; |
| 4168 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4169 | case 131: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4170 | #line 1312 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4171 | { (yyval.Attributes) = Attribute::StackProtectReq; ;} |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4172 | break; |
| 4173 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4174 | case 132: |
| 4175 | #line 1315 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4176 | { (yyval.Attributes) = Attribute::None; ;} |
| 4177 | break; |
| 4178 | |
| 4179 | case 133: |
| 4180 | #line 1316 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4181 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4182 | (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes); |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 4183 | ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 4184 | break; |
| 4185 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4186 | case 134: |
| 4187 | #line 1322 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Devang Patel | d498081 | 2008-09-02 20:52:40 +0000 | [diff] [blame] | 4188 | { (yyval.StrVal) = 0; ;} |
| 4189 | break; |
| 4190 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4191 | case 135: |
| 4192 | #line 1323 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4193 | { |
| 4194 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
| 4195 | ;} |
| 4196 | break; |
| 4197 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4198 | case 136: |
| 4199 | #line 1330 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4200 | { (yyval.UIntVal) = 0; ;} |
| 4201 | break; |
| 4202 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4203 | case 137: |
| 4204 | #line 1331 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4205 | { |
| 4206 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
| 4207 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4208 | GEN_ERROR("Alignment must be a power of two"); |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4209 | if ((yyval.UIntVal) > 0x40000000) |
| 4210 | GEN_ERROR("Alignment too large"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4211 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4212 | ;} |
| 4213 | break; |
| 4214 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4215 | case 138: |
| 4216 | #line 1339 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4217 | { (yyval.UIntVal) = 0; ;} |
| 4218 | break; |
| 4219 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4220 | case 139: |
| 4221 | #line 1340 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4222 | { |
| 4223 | (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); |
| 4224 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4225 | GEN_ERROR("Alignment must be a power of two"); |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4226 | if ((yyval.UIntVal) > 0x40000000) |
| 4227 | GEN_ERROR("Alignment too large"); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4228 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4229 | ;} |
| 4230 | break; |
| 4231 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4232 | case 140: |
| 4233 | #line 1351 "/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 | |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 4243 | case 141: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4244 | #line 1359 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4245 | { (yyval.StrVal) = 0; ;} |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 4246 | break; |
| 4247 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4248 | case 142: |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4249 | #line 1360 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4250 | { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 4251 | break; |
| 4252 | |
| 4253 | case 143: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4254 | #line 1365 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4255 | {;} |
| 4256 | break; |
| 4257 | |
| 4258 | case 144: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4259 | #line 1366 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4260 | {;} |
| 4261 | break; |
| 4262 | |
| 4263 | case 145: |
| 4264 | #line 1367 "/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 | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4272 | case 146: |
| 4273 | #line 1372 "/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"); |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4277 | if ((yyvsp[(2) - (2)].UInt64Val) > 0x40000000) |
| 4278 | GEN_ERROR("Alignment too large"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4279 | CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4280 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4281 | ;} |
| 4282 | break; |
| 4283 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4284 | case 154: |
| 4285 | #line 1390 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4286 | { |
| 4287 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4288 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4289 | ;} |
| 4290 | break; |
| 4291 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4292 | case 155: |
| 4293 | #line 1394 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4294 | { |
| 4295 | (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4296 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4297 | ;} |
| 4298 | break; |
| 4299 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4300 | case 156: |
| 4301 | #line 1398 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4302 | { // Pointer type? |
| 4303 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4304 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4305 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal)))); |
| 4306 | delete (yyvsp[(1) - (3)].TypeVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4307 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4308 | ;} |
| 4309 | break; |
| 4310 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4311 | case 157: |
| 4312 | #line 1405 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4313 | { // Named types are also simple types... |
| 4314 | const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); |
Christopher Lamb | a8ed9bf | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 4315 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4316 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 4317 | ;} |
| 4318 | break; |
| 4319 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4320 | case 158: |
| 4321 | #line 1410 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4322 | { // Type UpReference |
| 4323 | 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] | 4324 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4325 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... |
| 4326 | (yyval.TypeVal) = new PATypeHolder(OT); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4327 | UR_OUT("New Upreference!\n"); |
| 4328 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4329 | ;} |
| 4330 | break; |
| 4331 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4332 | case 159: |
| 4333 | #line 1418 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4334 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4335 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4336 | // FIXME: remove in LLVM 3.0. |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 4337 | const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal); |
| 4338 | if (!FunctionType::isValidReturnType(RetTy)) |
| 4339 | GEN_ERROR("Invalid result type for LLVM function"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4340 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4341 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4342 | 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] | 4343 | for (; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4344 | const Type *Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4345 | Params.push_back(Ty); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4346 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4347 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4348 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4349 | if (isVarArg) Params.pop_back(); |
| 4350 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4351 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4352 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4353 | GEN_ERROR("Function arguments must be value types!"); |
| 4354 | |
| 4355 | CHECK_FOR_ERROR |
| 4356 | |
Anton Korobeynikov | c36284e | 2007-12-03 19:17:47 +0000 | [diff] [blame] | 4357 | FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4358 | delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4359 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Nuno Lopes | 8a88a37 | 2008-10-05 16:49:34 +0000 | [diff] [blame] | 4360 | |
| 4361 | // Delete the argument list |
| 4362 | for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) { |
| 4363 | delete I->Ty; |
| 4364 | } |
| 4365 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); |
| 4366 | |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 4367 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4368 | ;} |
| 4369 | break; |
| 4370 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4371 | case 160: |
| 4372 | #line 1453 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4373 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4374 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4375 | // FIXME: remove in LLVM 3.0. |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4376 | std::vector<const Type*> Params; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4377 | 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] | 4378 | for ( ; I != E; ++I ) { |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4379 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 4380 | Params.push_back(Ty); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4381 | } |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4382 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4383 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4384 | if (isVarArg) Params.pop_back(); |
| 4385 | |
Anton Korobeynikov | 05e5a74 | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4386 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4387 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4388 | GEN_ERROR("Function arguments must be value types!"); |
| 4389 | |
| 4390 | CHECK_FOR_ERROR |
| 4391 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4392 | FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4393 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Nuno Lopes | 8a88a37 | 2008-10-05 16:49:34 +0000 | [diff] [blame] | 4394 | |
| 4395 | // Delete the argument list |
| 4396 | for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) { |
| 4397 | delete I->Ty; |
| 4398 | } |
| 4399 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); |
| 4400 | |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4401 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4402 | ;} |
| 4403 | break; |
| 4404 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4405 | case 161: |
| 4406 | #line 1484 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4407 | { // Sized array type? |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 4408 | (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] | 4409 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4410 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4411 | ;} |
| 4412 | break; |
| 4413 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4414 | case 162: |
| 4415 | #line 1489 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4416 | { // Vector type? |
| 4417 | const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); |
| 4418 | if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4419 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 4420 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 4421 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4422 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4423 | delete (yyvsp[(4) - (5)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4424 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4425 | ;} |
| 4426 | break; |
| 4427 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4428 | case 163: |
| 4429 | #line 1499 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4430 | { // Structure type? |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4431 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4432 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), |
| 4433 | E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4434 | Elements.push_back(*I); |
| 4435 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4436 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 4437 | delete (yyvsp[(2) - (3)].TypeList); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4438 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4439 | ;} |
| 4440 | break; |
| 4441 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4442 | case 164: |
| 4443 | #line 1509 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4444 | { // Empty structure type? |
| 4445 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4446 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4447 | ;} |
| 4448 | break; |
| 4449 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4450 | case 165: |
| 4451 | #line 1513 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4452 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4453 | std::vector<const Type*> Elements; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4454 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), |
| 4455 | E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4456 | Elements.push_back(*I); |
| 4457 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4458 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 4459 | delete (yyvsp[(3) - (5)].TypeList); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4460 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4461 | ;} |
| 4462 | break; |
| 4463 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4464 | case 166: |
| 4465 | #line 1523 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4466 | { // Empty structure type? |
| 4467 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4468 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4469 | ;} |
| 4470 | break; |
| 4471 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4472 | case 167: |
| 4473 | #line 1530 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4474 | { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4475 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4476 | // FIXME: remove in LLVM 3.0. |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4477 | (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4478 | (yyval.TypeWithAttrs).Attrs = Attribute::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4479 | ;} |
| 4480 | break; |
| 4481 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4482 | case 168: |
| 4483 | #line 1539 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4484 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4485 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4486 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); |
| 4487 | 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] | 4488 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4489 | (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); |
| 4490 | ;} |
| 4491 | break; |
| 4492 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4493 | case 169: |
| 4494 | #line 1546 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4495 | { |
| 4496 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 4497 | ;} |
| 4498 | break; |
| 4499 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4500 | case 170: |
| 4501 | #line 1551 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4502 | { |
| 4503 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 4504 | (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4505 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4506 | ;} |
| 4507 | break; |
| 4508 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4509 | case 171: |
| 4510 | #line 1556 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4511 | { |
| 4512 | ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4513 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4514 | ;} |
| 4515 | break; |
| 4516 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4517 | case 173: |
| 4518 | #line 1564 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4519 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4520 | (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 4521 | TypeWithAttrs TWA; TWA.Attrs = Attribute::None; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4522 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4523 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4524 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4525 | ;} |
| 4526 | break; |
| 4527 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 4528 | case 174: |
| 4529 | #line 1571 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4530 | { |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4531 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
| 4532 | TypeWithAttrs TWA; TWA.Attrs = Attribute::None; |
| 4533 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
| 4534 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Nick Lewycky | fd7eb72 | 2008-12-15 07:31:07 +0000 | [diff] [blame] | 4535 | CHECK_FOR_ERROR |
| 4536 | ;} |
| 4537 | break; |
| 4538 | |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 4539 | case 175: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4540 | #line 1578 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 4541 | { |
| 4542 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 4543 | CHECK_FOR_ERROR |
| 4544 | ;} |
| 4545 | break; |
| 4546 | |
| 4547 | case 176: |
| 4548 | #line 1586 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4549 | { |
| 4550 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4551 | (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4552 | delete (yyvsp[(1) - (1)].TypeVal); |
Reid Spencer | 3da59db | 2006-11-27 01:05:10 +0000 | [diff] [blame] | 4553 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4554 | ;} |
| 4555 | break; |
| 4556 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4557 | case 177: |
| 4558 | #line 1592 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4559 | { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4560 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4561 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4562 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4563 | ;} |
| 4564 | break; |
| 4565 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4566 | case 178: |
| 4567 | #line 1604 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4568 | { // Nonempty unsized arr |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 4569 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4570 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4571 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4572 | if (ATy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4573 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4574 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4575 | const Type *ETy = ATy->getElementType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4576 | uint64_t NumElements = ATy->getNumElements(); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4577 | |
| 4578 | // Verify that we have the correct size... |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4579 | if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4580 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4581 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4582 | utostr(NumElements) + ""); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4583 | |
| 4584 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4585 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4586 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4587 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4588 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4589 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4590 | } |
| 4591 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4592 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4593 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4594 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4595 | ;} |
| 4596 | break; |
| 4597 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4598 | case 179: |
| 4599 | #line 1632 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4600 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4601 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4602 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4603 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4604 | if (ATy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4605 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4606 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4607 | |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4608 | uint64_t NumElements = ATy->getNumElements(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4609 | if (NumElements != uint64_t(-1) && NumElements != 0) |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 4610 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4611 | " arguments, but has size of " + utostr(NumElements) +""); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4612 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 4613 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4614 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4615 | ;} |
| 4616 | break; |
| 4617 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4618 | case 180: |
| 4619 | #line 1648 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4620 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4621 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4622 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4623 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4624 | if (ATy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4625 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4626 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4627 | |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4628 | uint64_t NumElements = ATy->getNumElements(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4629 | const Type *ETy = ATy->getElementType(); |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4630 | if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4631 | GEN_ERROR("Can't build string constant of size " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4632 | utostr((yyvsp[(3) - (3)].StrVal)->length()) + |
| 4633 | " when array has size " + utostr(NumElements) + ""); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4634 | std::vector<Constant*> Vals; |
| 4635 | if (ETy == Type::Int8Ty) { |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4636 | for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4637 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4638 | } else { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4639 | delete (yyvsp[(3) - (3)].StrVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4640 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 4641 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4642 | delete (yyvsp[(3) - (3)].StrVal); |
| 4643 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 4644 | delete (yyvsp[(1) - (3)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4645 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4646 | ;} |
| 4647 | break; |
| 4648 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4649 | case 181: |
| 4650 | #line 1675 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4651 | { // Nonempty unsized arr |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4652 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4653 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4654 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4655 | if (PTy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4656 | GEN_ERROR("Cannot make packed constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4657 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4658 | const Type *ETy = PTy->getElementType(); |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 4659 | unsigned NumElements = PTy->getNumElements(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4660 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4661 | // Verify that we have the correct size... |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4662 | if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size()) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4663 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4664 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Mon P Wang | 2887310 | 2008-06-25 08:15:39 +0000 | [diff] [blame] | 4665 | utostr(NumElements) + ""); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4666 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4667 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4668 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4669 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4670 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4671 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4672 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4673 | } |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4674 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4675 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4676 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4677 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4678 | ;} |
| 4679 | break; |
| 4680 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4681 | case 182: |
| 4682 | #line 1703 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4683 | { |
| 4684 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4685 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4686 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4687 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4688 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4689 | if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4690 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4691 | |
| 4692 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4693 | for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) |
| 4694 | if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4695 | GEN_ERROR("Expected type '" + |
| 4696 | STy->getElementType(i)->getDescription() + |
| 4697 | "' for element #" + utostr(i) + |
| 4698 | " of structure initializer"); |
| 4699 | |
| 4700 | // Check to ensure that Type is not packed |
| 4701 | if (STy->isPacked()) |
| 4702 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4703 | STy->getDescription() + "'"); |
| 4704 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4705 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4706 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4707 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4708 | ;} |
| 4709 | break; |
| 4710 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4711 | case 183: |
| 4712 | #line 1729 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4713 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4714 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4715 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4716 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4717 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4718 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4719 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4720 | |
| 4721 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4722 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4723 | |
| 4724 | // Check to ensure that Type is not packed |
| 4725 | if (STy->isPacked()) |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4726 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4727 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4728 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4729 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4730 | delete (yyvsp[(1) - (3)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4731 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4732 | ;} |
| 4733 | break; |
| 4734 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4735 | case 184: |
| 4736 | #line 1749 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4737 | { |
| 4738 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4739 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4740 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4741 | (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4742 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4743 | if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4744 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4745 | |
| 4746 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4747 | for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) |
| 4748 | if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4749 | GEN_ERROR("Expected type '" + |
| 4750 | STy->getElementType(i)->getDescription() + |
| 4751 | "' for element #" + utostr(i) + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4752 | " of structure initializer"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4753 | |
| 4754 | // Check to ensure that Type is packed |
| 4755 | if (!STy->isPacked()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4756 | GEN_ERROR("Vector initializer to non-vector type '" + |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4757 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4758 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4759 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector)); |
| 4760 | delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4761 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4762 | ;} |
| 4763 | break; |
| 4764 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4765 | case 185: |
| 4766 | #line 1775 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4767 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4768 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4769 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); |
| 4770 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get()); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4771 | if (STy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4772 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4773 | (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4774 | |
| 4775 | if (STy->getNumContainedTypes() != 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 4776 | GEN_ERROR("Illegal number of initializers for structure type"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4777 | |
| 4778 | // Check to ensure that Type is packed |
| 4779 | if (!STy->isPacked()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4780 | GEN_ERROR("Vector initializer to non-vector type '" + |
Chris Lattner | 3298069 | 2007-02-19 07:44:24 +0000 | [diff] [blame] | 4781 | STy->getDescription() + "'"); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4782 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4783 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4784 | delete (yyvsp[(1) - (5)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4785 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4786 | ;} |
| 4787 | break; |
| 4788 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4789 | case 186: |
| 4790 | #line 1795 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4791 | { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4792 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4793 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4794 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4795 | if (PTy == 0) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4796 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4797 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'"); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4798 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4799 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4800 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4801 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4802 | ;} |
| 4803 | break; |
| 4804 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4805 | case 187: |
| 4806 | #line 1807 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4807 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4808 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4809 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4810 | (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); |
| 4811 | delete (yyvsp[(1) - (2)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4812 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4813 | ;} |
| 4814 | break; |
| 4815 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4816 | case 188: |
| 4817 | #line 1814 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4818 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4819 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4820 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4821 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4822 | if (Ty == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4823 | 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] | 4824 | |
| 4825 | // ConstExprs can exist in the body of a function, thus creating |
| 4826 | // GlobalValues whenever they refer to a variable. Because we are in |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4827 | // the context of a function, getExistingVal will search the functions |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4828 | // symbol table instead of the module symbol table for the global symbol, |
| 4829 | // which throws things all off. To get around this, we just tell |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 4830 | // getExistingVal that we are at global scope here. |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4831 | // |
| 4832 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4833 | CurFun.CurrentFunction = 0; |
| 4834 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4835 | Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 4836 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4837 | |
| 4838 | CurFun.CurrentFunction = SavedCurFn; |
| 4839 | |
| 4840 | // If this is an initializer for a constant pointer, which is referencing a |
| 4841 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4842 | // in the future with the right type of variable. |
| 4843 | // |
| 4844 | if (V == 0) { |
Reid Spencer | a9720f5 | 2007-02-05 17:04:00 +0000 | [diff] [blame] | 4845 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4846 | const PointerType *PT = cast<PointerType>(Ty); |
| 4847 | |
| 4848 | // First check to see if the forward references value is already created! |
| 4849 | PerModuleInfo::GlobalRefsType::iterator I = |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4850 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4851 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4852 | if (I != CurModule.GlobalRefs.end()) { |
| 4853 | V = I->second; // Placeholder already exists, use it... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4854 | (yyvsp[(2) - (2)].ValIDVal).destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4855 | } else { |
| 4856 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4857 | if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName) |
| 4858 | Name = (yyvsp[(2) - (2)].ValIDVal).getName(); |
| 4859 | else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID) |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4860 | GEN_ERROR("Invalid reference to global"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4861 | |
| 4862 | // Create the forward referenced global. |
| 4863 | GlobalValue *GV; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4864 | if (const FunctionType *FTy = |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4865 | dyn_cast<FunctionType>(PT->getElementType())) { |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 4866 | GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name, |
| 4867 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4868 | } else { |
| 4869 | GV = new GlobalVariable(PT->getElementType(), false, |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 4870 | GlobalValue::ExternalWeakLinkage, 0, |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 4871 | Name, CurModule.CurrentModule); |
| 4872 | } |
| 4873 | |
| 4874 | // 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] | 4875 | 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] | 4876 | V = GV; |
| 4877 | } |
| 4878 | } |
| 4879 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4880 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4881 | delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 4882 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4883 | ;} |
| 4884 | break; |
| 4885 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4886 | case 189: |
| 4887 | #line 1880 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4888 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 4889 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4890 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4891 | if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 4892 | GEN_ERROR("Mismatched types for constant expression: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4893 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription()); |
| 4894 | (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); |
| 4895 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4896 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4897 | ;} |
| 4898 | break; |
| 4899 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4900 | case 190: |
| 4901 | #line 1890 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4902 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4903 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4904 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4905 | const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 4906 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4907 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4908 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4909 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 4910 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4911 | ;} |
| 4912 | break; |
| 4913 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4914 | case 191: |
| 4915 | #line 1900 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4916 | { // integral constants |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4917 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4918 | if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].SInt64Val))) |
| 4919 | GEN_ERROR("Constant value doesn't fit in type"); |
| 4920 | (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].SInt64Val), true); |
| 4921 | } else { |
| 4922 | GEN_ERROR("integer constant must have integer type"); |
| 4923 | } |
| 4924 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4925 | CHECK_FOR_ERROR |
| 4926 | ;} |
| 4927 | break; |
| 4928 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4929 | case 192: |
| 4930 | #line 1911 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4931 | { // arbitrary precision integer constants |
| 4932 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4933 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth()) |
| 4934 | GEN_ERROR("Constant value does not fit in type"); |
| 4935 | (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(IT->getBitWidth()); |
| 4936 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4937 | } else { |
| 4938 | GEN_ERROR("integer constant must have integer type"); |
| 4939 | } |
| 4940 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4941 | delete (yyvsp[(2) - (2)].APIntVal); |
| 4942 | CHECK_FOR_ERROR |
| 4943 | ;} |
| 4944 | break; |
| 4945 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4946 | case 193: |
| 4947 | #line 1924 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4948 | { // integral constants |
| 4949 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4950 | if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].UInt64Val))) |
| 4951 | GEN_ERROR("Constant value doesn't fit in type"); |
| 4952 | (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].UInt64Val), false); |
| 4953 | } else { |
| 4954 | GEN_ERROR("integer constant must have integer type"); |
| 4955 | } |
| 4956 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4957 | CHECK_FOR_ERROR |
| 4958 | ;} |
| 4959 | break; |
| 4960 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4961 | case 194: |
| 4962 | #line 1935 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4963 | { // arbitrary precision integer constants |
| 4964 | if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) { |
| 4965 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth()) |
| 4966 | GEN_ERROR("Constant value does not fit in type"); |
| 4967 | (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(IT->getBitWidth()); |
| 4968 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4969 | } else { |
| 4970 | GEN_ERROR("integer constant must have integer type"); |
| 4971 | } |
| 4972 | |
| 4973 | delete (yyvsp[(2) - (2)].APIntVal); |
| 4974 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4975 | CHECK_FOR_ERROR |
| 4976 | ;} |
| 4977 | break; |
| 4978 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4979 | case 195: |
| 4980 | #line 1949 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4981 | { // Boolean constants |
| 4982 | if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty) |
| 4983 | GEN_ERROR("Constant true must have type i1"); |
| 4984 | (yyval.ConstVal) = ConstantInt::getTrue(); |
| 4985 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4986 | CHECK_FOR_ERROR |
| 4987 | ;} |
| 4988 | break; |
| 4989 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 4990 | case 196: |
| 4991 | #line 1956 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 4992 | { // Boolean constants |
| 4993 | if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty) |
| 4994 | GEN_ERROR("Constant false must have type i1"); |
| 4995 | (yyval.ConstVal) = ConstantInt::getFalse(); |
| 4996 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 38c91a9 | 2007-02-28 02:24:54 +0000 | [diff] [blame] | 4997 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4998 | ;} |
| 4999 | break; |
| 5000 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5001 | case 197: |
| 5002 | #line 1963 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5003 | { // Floating point constants |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5004 | if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].TypeVal)->get(), *(yyvsp[(2) - (2)].FPVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5005 | GEN_ERROR("Floating point constant invalid for type"); |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5006 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5007 | // 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] | 5008 | // as double. Fix this here. Long double is done right. |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5009 | 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] | 5010 | bool ignored; |
| 5011 | (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven, |
| 5012 | &ignored); |
| 5013 | } |
Chris Lattner | d8eb63f | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 5014 | (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal)); |
Chris Lattner | 740e709 | 2008-10-15 06:16:57 +0000 | [diff] [blame] | 5015 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5016 | delete (yyvsp[(2) - (2)].FPVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5017 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5018 | ;} |
| 5019 | break; |
| 5020 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5021 | case 198: |
| 5022 | #line 1981 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5023 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5024 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5025 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); |
| 5026 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 5027 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 5028 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5029 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5030 | Val->getType()->getDescription() + "' to '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5031 | DestTy->getDescription() + "'"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5032 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
| 5033 | delete (yyvsp[(5) - (6)].TypeVal); |
| 5034 | ;} |
| 5035 | break; |
| 5036 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5037 | case 199: |
| 5038 | #line 1993 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5039 | { |
| 5040 | if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5041 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5042 | |
| 5043 | const Type *IdxTy = |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 5044 | 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] | 5045 | if (!IdxTy) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5046 | GEN_ERROR("Index list invalid for constant getelementptr"); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5047 | |
Chris Lattner | f7469af | 2007-01-31 04:44:08 +0000 | [diff] [blame] | 5048 | SmallVector<Constant*, 8> IdxVec; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5049 | for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) |
| 5050 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5051 | IdxVec.push_back(C); |
| 5052 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 5053 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
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 | delete (yyvsp[(4) - (5)].ValueList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5056 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5057 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size()); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 5058 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5059 | ;} |
| 5060 | break; |
| 5061 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5062 | case 200: |
| 5063 | #line 2014 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5064 | { |
| 5065 | if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5066 | GEN_ERROR("Select condition must be of boolean type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5067 | if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5068 | GEN_ERROR("Select operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5069 | (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] | 5070 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5071 | ;} |
| 5072 | break; |
| 5073 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5074 | case 201: |
| 5075 | #line 2022 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5076 | { |
| 5077 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5078 | GEN_ERROR("Binary operator types must match"); |
| 5079 | CHECK_FOR_ERROR; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5080 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
| 5081 | ;} |
| 5082 | break; |
| 5083 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5084 | case 202: |
| 5085 | #line 2028 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5086 | { |
| 5087 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5088 | GEN_ERROR("Logical operator types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5089 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5090 | if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) || |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5091 | !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5092 | GEN_ERROR("Logical operator requires integral operands"); |
| 5093 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5094 | (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] | 5095 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5096 | ;} |
| 5097 | break; |
| 5098 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5099 | case 203: |
| 5100 | #line 2039 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5101 | { |
| 5102 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5103 | GEN_ERROR("icmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5104 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5105 | ;} |
| 5106 | break; |
| 5107 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5108 | case 204: |
| 5109 | #line 2044 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5110 | { |
| 5111 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5112 | GEN_ERROR("fcmp operand types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5113 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5114 | ;} |
| 5115 | break; |
| 5116 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5117 | case 205: |
| 5118 | #line 2049 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 5119 | { |
| 5120 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 5121 | GEN_ERROR("vicmp operand types must match"); |
| 5122 | (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5123 | ;} |
| 5124 | break; |
| 5125 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5126 | case 206: |
| 5127 | #line 2054 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 5128 | { |
| 5129 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 5130 | GEN_ERROR("vfcmp operand types must match"); |
| 5131 | (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 5132 | ;} |
| 5133 | break; |
| 5134 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5135 | case 207: |
| 5136 | #line 2059 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5137 | { |
| 5138 | if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5139 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5140 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5141 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5142 | ;} |
| 5143 | break; |
| 5144 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5145 | case 208: |
| 5146 | #line 2065 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5147 | { |
| 5148 | 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] | 5149 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5150 | (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] | 5151 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5152 | ;} |
| 5153 | break; |
| 5154 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5155 | case 209: |
| 5156 | #line 2071 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5157 | { |
| 5158 | 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] | 5159 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5160 | (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] | 5161 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5162 | ;} |
| 5163 | break; |
| 5164 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5165 | case 210: |
| 5166 | #line 2077 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5167 | { |
| 5168 | if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
| 5169 | GEN_ERROR("ExtractValue requires an aggregate operand"); |
| 5170 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5171 | (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size()); |
| 5172 | delete (yyvsp[(4) - (5)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5173 | CHECK_FOR_ERROR |
| 5174 | ;} |
| 5175 | break; |
| 5176 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5177 | case 211: |
| 5178 | #line 2085 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5179 | { |
| 5180 | if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType())) |
| 5181 | GEN_ERROR("InsertValue requires an aggregate operand"); |
| 5182 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5183 | (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size()); |
| 5184 | delete (yyvsp[(6) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 5185 | CHECK_FOR_ERROR |
| 5186 | ;} |
| 5187 | break; |
| 5188 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5189 | case 212: |
| 5190 | #line 2096 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5191 | { |
| 5192 | ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5193 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5194 | ;} |
| 5195 | break; |
| 5196 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5197 | case 213: |
| 5198 | #line 2100 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5199 | { |
| 5200 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 5201 | (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5202 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5203 | ;} |
| 5204 | break; |
| 5205 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5206 | case 214: |
| 5207 | #line 2108 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5208 | { (yyval.BoolVal) = false; ;} |
Dale Johannesen | 20ab78b | 2008-08-13 18:41:46 +0000 | [diff] [blame] | 5209 | break; |
| 5210 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5211 | case 215: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5212 | #line 2108 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 5213 | { (yyval.BoolVal) = true; ;} |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5214 | break; |
| 5215 | |
| 5216 | case 216: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5217 | #line 2111 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5218 | { (yyval.BoolVal) = true; ;} |
Nick Lewycky | fd7eb72 | 2008-12-15 07:31:07 +0000 | [diff] [blame] | 5219 | break; |
| 5220 | |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 5221 | case 217: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5222 | #line 2111 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5223 | { (yyval.BoolVal) = false; ;} |
| 5224 | break; |
| 5225 | |
| 5226 | case 218: |
| 5227 | #line 2114 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5228 | { |
| 5229 | const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); |
| 5230 | Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); |
Chris Lattner | 0275cff | 2007-08-06 21:00:46 +0000 | [diff] [blame] | 5231 | CHECK_FOR_ERROR |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5232 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 5233 | if (!Aliasee) |
| 5234 | GEN_ERROR("Aliases can be created only to global values"); |
| 5235 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5236 | (yyval.ConstVal) = Aliasee; |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5237 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5238 | delete (yyvsp[(1) - (2)].TypeVal); |
| 5239 | ;} |
| 5240 | break; |
| 5241 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5242 | case 219: |
| 5243 | #line 2126 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5244 | { |
| 5245 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 5246 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 5247 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 5248 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 5249 | Val->getType()->getDescription() + "' to '" + |
| 5250 | DestTy->getDescription() + "'"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5251 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5252 | (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] | 5253 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5254 | delete (yyvsp[(5) - (6)].TypeVal); |
| 5255 | ;} |
| 5256 | break; |
| 5257 | |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 5258 | case 220: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5259 | #line 2147 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 5260 | { |
| 5261 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 5262 | CurModule.ModuleDone(); |
| 5263 | CHECK_FOR_ERROR; |
| 5264 | ;} |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5265 | break; |
| 5266 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5267 | case 221: |
| 5268 | #line 2152 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5269 | { |
| 5270 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
| 5271 | CurModule.ModuleDone(); |
| 5272 | CHECK_FOR_ERROR; |
| 5273 | ;} |
Nick Lewycky | fd7eb72 | 2008-12-15 07:31:07 +0000 | [diff] [blame] | 5274 | break; |
| 5275 | |
Bill Wendling | 29bc4f0 | 2008-12-17 20:59:57 +0000 | [diff] [blame] | 5276 | case 224: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5277 | #line 2165 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5278 | { CurFun.isDeclare = false; ;} |
| 5279 | break; |
| 5280 | |
| 5281 | case 225: |
| 5282 | #line 2165 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5283 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5284 | CurFun.FunctionDone(); |
| 5285 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5286 | ;} |
| 5287 | break; |
| 5288 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5289 | case 226: |
| 5290 | #line 2169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5291 | { CurFun.isDeclare = true; ;} |
| 5292 | break; |
| 5293 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5294 | case 227: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5295 | #line 2169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 5296 | { |
| 5297 | CHECK_FOR_ERROR |
| 5298 | ;} |
| 5299 | break; |
| 5300 | |
| 5301 | case 228: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5302 | #line 2172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5303 | { |
| 5304 | CHECK_FOR_ERROR |
| 5305 | ;} |
| 5306 | break; |
| 5307 | |
| 5308 | case 229: |
| 5309 | #line 2175 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5310 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5311 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5312 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5313 | // Eagerly resolve types. This is not an optimization, this is a |
| 5314 | // requirement that is due to the fact that we could have this: |
| 5315 | // |
| 5316 | // %list = type { %list * } |
| 5317 | // %list = type { %list * } ; repeated type decl |
| 5318 | // |
| 5319 | // If types are not resolved eagerly, then the two types will not be |
| 5320 | // determined to be the same type! |
| 5321 | // |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5322 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5323 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5324 | 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] | 5325 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5326 | // If this is a named type that is not a redefinition, add it to the slot |
| 5327 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5328 | CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5329 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5330 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5331 | delete (yyvsp[(3) - (3)].TypeVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5332 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5333 | ;} |
| 5334 | break; |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5335 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5336 | case 230: |
| 5337 | #line 2199 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5338 | { |
| 5339 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); |
| 5340 | |
| 5341 | 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] | 5342 | CHECK_FOR_ERROR |
| 5343 | // If this is a named type that is not a redefinition, add it to the slot |
| 5344 | // table. |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5345 | CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5346 | } |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5347 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5348 | ;} |
| 5349 | break; |
| 5350 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5351 | case 231: |
| 5352 | #line 2211 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5353 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5354 | /* "Externally Visible" Linkage */ |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5355 | if ((yyvsp[(5) - (6)].ConstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5356 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5357 | CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage, |
| 5358 | (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] | 5359 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5360 | ;} |
| 5361 | break; |
| 5362 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5363 | case 232: |
| 5364 | #line 2218 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5365 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5366 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5367 | ;} |
| 5368 | break; |
| 5369 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5370 | case 233: |
| 5371 | #line 2222 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5372 | { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5373 | if ((yyvsp[(6) - (7)].ConstVal) == 0) |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5374 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5375 | 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] | 5376 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5377 | ;} |
| 5378 | break; |
| 5379 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5380 | case 234: |
| 5381 | #line 2227 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5382 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5383 | CurGV = 0; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5384 | ;} |
| 5385 | break; |
| 5386 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5387 | case 235: |
| 5388 | #line 2231 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5389 | { |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5390 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5391 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); |
| 5392 | 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] | 5393 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5394 | delete (yyvsp[(6) - (7)].TypeVal); |
| 5395 | ;} |
| 5396 | break; |
| 5397 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5398 | case 236: |
| 5399 | #line 2237 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5400 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5401 | CurGV = 0; |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5402 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5403 | ;} |
| 5404 | break; |
| 5405 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5406 | case 237: |
| 5407 | #line 2241 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5408 | { |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5409 | std::string Name; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5410 | if ((yyvsp[(1) - (5)].StrVal)) { |
| 5411 | Name = *(yyvsp[(1) - (5)].StrVal); |
| 5412 | delete (yyvsp[(1) - (5)].StrVal); |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5413 | } |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5414 | if (Name.empty()) |
| 5415 | GEN_ERROR("Alias name cannot be empty"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5416 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5417 | Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5418 | if (Aliasee == 0) |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5419 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5420 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5421 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee, |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5422 | CurModule.CurrentModule); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5423 | GA->setVisibility((yyvsp[(2) - (5)].Visibility)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5424 | InsertValue(GA, CurModule.Values); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5425 | |
| 5426 | |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5427 | // If there was a forward reference of this alias, resolve it now. |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5428 | |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5429 | ValID ID; |
| 5430 | if (!Name.empty()) |
| 5431 | ID = ValID::createGlobalName(Name); |
| 5432 | else |
| 5433 | ID = ValID::createGlobalID(CurModule.Values.size()-1); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5434 | |
Chris Lattner | 569f737 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5435 | if (GlobalValue *FWGV = |
| 5436 | CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { |
| 5437 | // Replace uses of the fwdref with the actual alias. |
| 5438 | FWGV->replaceAllUsesWith(GA); |
| 5439 | if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV)) |
| 5440 | GV->eraseFromParent(); |
| 5441 | else |
| 5442 | cast<Function>(FWGV)->eraseFromParent(); |
| 5443 | } |
| 5444 | ID.destroy(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5445 | |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5446 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5447 | ;} |
| 5448 | break; |
| 5449 | |
Bill Wendling | 6ff4bfe | 2008-11-13 01:03:00 +0000 | [diff] [blame] | 5450 | case 238: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5451 | #line 2281 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nick Lewycky | 02ff308 | 2008-11-24 03:41:24 +0000 | [diff] [blame] | 5452 | { |
| 5453 | CHECK_FOR_ERROR |
| 5454 | ;} |
| 5455 | break; |
| 5456 | |
| 5457 | case 239: |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5458 | #line 2284 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
| 5459 | { |
| 5460 | CHECK_FOR_ERROR |
| 5461 | ;} |
| 5462 | break; |
| 5463 | |
| 5464 | case 240: |
| 5465 | #line 2290 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5466 | { |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5467 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5468 | if (AsmSoFar.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5469 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal)); |
Chris Lattner | 6631601 | 2006-01-24 04:14:29 +0000 | [diff] [blame] | 5470 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5471 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal)); |
| 5472 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5473 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5474 | ;} |
| 5475 | break; |
| 5476 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5477 | case 241: |
| 5478 | #line 2300 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5479 | { |
| 5480 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); |
| 5481 | delete (yyvsp[(3) - (3)].StrVal); |
| 5482 | ;} |
| 5483 | break; |
| 5484 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5485 | case 242: |
| 5486 | #line 2304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5487 | { |
| 5488 | CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); |
| 5489 | delete (yyvsp[(3) - (3)].StrVal); |
| 5490 | ;} |
| 5491 | break; |
| 5492 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5493 | case 244: |
| 5494 | #line 2311 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5495 | { |
| 5496 | CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); |
| 5497 | delete (yyvsp[(3) - (3)].StrVal); |
Christopher Lamb | bf3348d | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5498 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5499 | ;} |
| 5500 | break; |
| 5501 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5502 | case 245: |
| 5503 | #line 2316 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5504 | { |
| 5505 | CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); |
| 5506 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 1013b4d | 2007-07-31 14:41:17 +0000 | [diff] [blame] | 5507 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5508 | ;} |
| 5509 | break; |
| 5510 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5511 | case 246: |
| 5512 | #line 2321 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5513 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5514 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5515 | ;} |
| 5516 | break; |
| 5517 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5518 | case 247: |
| 5519 | #line 2330 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5520 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5521 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5522 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5523 | if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType()) |
| 5524 | GEN_ERROR("Argument types must be first-class"); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5525 | 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] | 5526 | (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList); |
| 5527 | (yyvsp[(1) - (5)].ArgList)->push_back(E); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 5528 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5529 | ;} |
| 5530 | break; |
| 5531 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5532 | case 248: |
| 5533 | #line 2340 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5534 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5535 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5536 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5537 | if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType()) |
| 5538 | GEN_ERROR("Argument types must be first-class"); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5539 | 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] | 5540 | (yyval.ArgList) = new ArgListType; |
| 5541 | (yyval.ArgList)->push_back(E); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5542 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5543 | ;} |
| 5544 | break; |
| 5545 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5546 | case 249: |
| 5547 | #line 2351 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5548 | { |
| 5549 | (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5550 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5551 | ;} |
| 5552 | break; |
| 5553 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5554 | case 250: |
| 5555 | #line 2355 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5556 | { |
| 5557 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5558 | struct ArgListEntry E; |
| 5559 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5560 | E.Name = 0; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5561 | E.Attrs = Attribute::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5562 | (yyval.ArgList)->push_back(E); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5563 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5564 | ;} |
| 5565 | break; |
| 5566 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5567 | case 251: |
| 5568 | #line 2364 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5569 | { |
| 5570 | (yyval.ArgList) = new ArgListType; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5571 | struct ArgListEntry E; |
| 5572 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5573 | E.Name = 0; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5574 | E.Attrs = Attribute::None; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5575 | (yyval.ArgList)->push_back(E); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5576 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5577 | ;} |
| 5578 | break; |
| 5579 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5580 | case 252: |
| 5581 | #line 2373 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5582 | { |
| 5583 | (yyval.ArgList) = 0; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5584 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5585 | ;} |
| 5586 | break; |
| 5587 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5588 | case 253: |
| 5589 | #line 2379 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5590 | { |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5591 | std::string FunctionName(*(yyvsp[(4) - (11)].StrVal)); |
| 5592 | delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory! |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5593 | |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5594 | // Check the function result for abstractness if this is a define. We should |
| 5595 | // have no abstract types at this point |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5596 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal))) |
| 5597 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription()); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5598 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5599 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal))) |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 5600 | GEN_ERROR("Invalid result type for LLVM function"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5601 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5602 | std::vector<const Type*> ParamTypeList; |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5603 | SmallVector<AttributeWithIndex, 8> Attrs; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5604 | //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function |
| 5605 | //attributes. |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5606 | Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes); |
| 5607 | if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) { |
| 5608 | if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5609 | RetAttrs = RetAttrs | Attribute::ZExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5610 | (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5611 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5612 | if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5613 | RetAttrs = RetAttrs | Attribute::SExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5614 | (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5615 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5616 | if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5617 | RetAttrs = RetAttrs | Attribute::InReg; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5618 | (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5619 | } |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 5620 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5621 | if (RetAttrs != Attribute::None) |
| 5622 | Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); |
| 5623 | if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments... |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5624 | unsigned index = 1; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5625 | 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] | 5626 | const Type* Ty = I->Ty->get(); |
Reid Spencer | 8c8a2dc | 2007-01-02 21:54:12 +0000 | [diff] [blame] | 5627 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 5628 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5629 | ParamTypeList.push_back(Ty); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5630 | if (Ty != Type::VoidTy && I->Attrs != Attribute::None) |
| 5631 | Attrs.push_back(AttributeWithIndex::get(index, I->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5632 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5633 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5634 | if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) |
| 5635 | Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes))); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5636 | |
| 5637 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 5638 | if (isVarArg) ParamTypeList.pop_back(); |
| 5639 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5640 | AttrListPtr PAL; |
Christopher Lamb | 5c10424 | 2007-04-22 20:09:11 +0000 | [diff] [blame] | 5641 | if (!Attrs.empty()) |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5642 | PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); |
Reid Spencer | 7b5d466 | 2007-04-09 06:16:21 +0000 | [diff] [blame] | 5643 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5644 | FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5645 | const PointerType *PFT = PointerType::getUnqual(FT); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5646 | delete (yyvsp[(3) - (11)].TypeVal); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5647 | |
| 5648 | ValID ID; |
| 5649 | if (!FunctionName.empty()) { |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5650 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5651 | } else { |
Reid Spencer | 93c4003 | 2007-03-19 18:40:50 +0000 | [diff] [blame] | 5652 | ID = ValID::createGlobalID(CurModule.Values.size()); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5653 | } |
| 5654 | |
| 5655 | Function *Fn = 0; |
| 5656 | // See if this function was forward referenced. If so, recycle the object. |
| 5657 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5658 | // 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] | 5659 | // previously inserted. |
| 5660 | Fn = cast<Function>(FWRef); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5661 | assert(Fn->getAttributes().isEmpty() && |
Chris Lattner | 58d7491 | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5662 | "Forward reference has parameter attributes!"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5663 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 5664 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 5665 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5666 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5667 | if (Fn->getFunctionType() != FT ) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5668 | // The existing function doesn't have the same type. This is an overload |
| 5669 | // error. |
| 5670 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5671 | } else if (Fn->getAttributes() != PAL) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5672 | // The existing function doesn't have the same parameter attributes. |
| 5673 | // This is an overload error. |
| 5674 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5675 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 5676 | // Neither the existing or the current function is a declaration and they |
| 5677 | // have the same name and same type. Clearly this is a redefinition. |
| 5678 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5679 | } else if (Fn->isDeclaration()) { |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5680 | // 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] | 5681 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 5682 | AI != AE; ++AI) |
| 5683 | AI->setName(""); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5684 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5685 | } else { // Not already defined? |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5686 | Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
| 5687 | CurModule.CurrentModule); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5688 | InsertValue(Fn, CurModule.Values); |
| 5689 | } |
| 5690 | |
Nuno Lopes | 9e9631d | 2008-10-03 15:45:58 +0000 | [diff] [blame] | 5691 | ID.destroy(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5692 | CurFun.FunctionStart(Fn); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5693 | |
| 5694 | if (CurFun.isDeclare) { |
| 5695 | // If we have declaration, always overwrite linkage. This will allow us to |
| 5696 | // correctly handle cases, when pointer to function is passed as argument to |
| 5697 | // another function. |
| 5698 | Fn->setLinkage(CurFun.Linkage); |
Anton Korobeynikov | 178a352 | 2007-01-12 19:22:51 +0000 | [diff] [blame] | 5699 | Fn->setVisibility(CurFun.Visibility); |
Anton Korobeynikov | 93c2b37 | 2006-09-17 13:06:18 +0000 | [diff] [blame] | 5700 | } |
Devang Patel | d498081 | 2008-09-02 20:52:40 +0000 | [diff] [blame] | 5701 | Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal)); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 5702 | Fn->setAttributes(PAL); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5703 | Fn->setAlignment((yyvsp[(10) - (11)].UIntVal)); |
| 5704 | if ((yyvsp[(9) - (11)].StrVal)) { |
| 5705 | Fn->setSection(*(yyvsp[(9) - (11)].StrVal)); |
| 5706 | delete (yyvsp[(9) - (11)].StrVal); |
Gordon Henriksen | 80a75bf | 2007-12-10 03:18:06 +0000 | [diff] [blame] | 5707 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5708 | if ((yyvsp[(11) - (11)].StrVal)) { |
| 5709 | Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str()); |
| 5710 | delete (yyvsp[(11) - (11)].StrVal); |
Chris Lattner | e869eef | 2005-11-12 00:11:49 +0000 | [diff] [blame] | 5711 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5712 | |
| 5713 | // Add all of the arguments we parsed to the function... |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5714 | if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty... |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5715 | if (isVarArg) { // Nuke the last entry |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5716 | 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] | 5717 | "Not a varargs marker!"); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5718 | delete (yyvsp[(6) - (11)].ArgList)->back().Ty; |
| 5719 | (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5720 | } |
| 5721 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 5722 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5723 | unsigned Idx = 1; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5724 | for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); |
| 5725 | I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5726 | delete I->Ty; // Delete the typeholder... |
Reid Spencer | 0a8a16b | 2007-05-22 18:52:55 +0000 | [diff] [blame] | 5727 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 5728 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5729 | InsertValue(ArgIt); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 5730 | Idx++; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5731 | } |
Reid Spencer | a132e04 | 2006-12-03 05:46:11 +0000 | [diff] [blame] | 5732 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 5733 | 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] | 5734 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5735 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5736 | ;} |
| 5737 | break; |
| 5738 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5739 | case 256: |
| 5740 | #line 2529 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5741 | { |
| 5742 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5743 | |
| 5744 | // Make sure that we keep track of the linkage type even if there was a |
| 5745 | // previous "declare". |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5746 | (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); |
| 5747 | (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility)); |
| 5748 | ;} |
| 5749 | break; |
| 5750 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5751 | case 259: |
| 5752 | #line 2540 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5753 | { |
| 5754 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5755 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5756 | ;} |
| 5757 | break; |
| 5758 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5759 | case 260: |
| 5760 | #line 2545 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5761 | { |
| 5762 | CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); |
| 5763 | CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); |
| 5764 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5765 | CurFun.FunctionDone(); |
Reid Spencer | 41dff5e | 2007-01-26 08:05:27 +0000 | [diff] [blame] | 5766 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5767 | ;} |
| 5768 | break; |
| 5769 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5770 | case 261: |
| 5771 | #line 2557 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5772 | { |
| 5773 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5774 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5775 | ;} |
| 5776 | break; |
| 5777 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5778 | case 262: |
| 5779 | #line 2561 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5780 | { |
| 5781 | (yyval.BoolVal) = true; |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 5782 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5783 | ;} |
| 5784 | break; |
| 5785 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5786 | case 263: |
| 5787 | #line 2566 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5788 | { // A reference to a direct constant |
| 5789 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5790 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5791 | ;} |
| 5792 | break; |
| 5793 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5794 | case 264: |
| 5795 | #line 2570 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5796 | { |
| 5797 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 5798 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5799 | ;} |
| 5800 | break; |
| 5801 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5802 | case 265: |
| 5803 | #line 2574 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 5804 | { // arbitrary precision integer constants |
| 5805 | (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true); |
| 5806 | delete (yyvsp[(1) - (1)].APIntVal); |
| 5807 | CHECK_FOR_ERROR |
| 5808 | ;} |
| 5809 | break; |
| 5810 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5811 | case 266: |
| 5812 | #line 2579 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 1913b94 | 2008-07-11 00:30:39 +0000 | [diff] [blame] | 5813 | { // arbitrary precision integer constants |
| 5814 | (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false); |
| 5815 | delete (yyvsp[(1) - (1)].APIntVal); |
| 5816 | CHECK_FOR_ERROR |
| 5817 | ;} |
| 5818 | break; |
| 5819 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5820 | case 267: |
| 5821 | #line 2584 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5822 | { // Perhaps it's an FP constant? |
| 5823 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5824 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5825 | ;} |
| 5826 | break; |
| 5827 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5828 | case 268: |
| 5829 | #line 2588 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5830 | { |
| 5831 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 5832 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5833 | ;} |
| 5834 | break; |
| 5835 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5836 | case 269: |
| 5837 | #line 2592 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5838 | { |
| 5839 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5840 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5841 | ;} |
| 5842 | break; |
| 5843 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5844 | case 270: |
| 5845 | #line 2596 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5846 | { |
| 5847 | (yyval.ValIDVal) = ValID::createNull(); |
Zhou Sheng | 6b6b6ef | 2007-01-11 12:24:14 +0000 | [diff] [blame] | 5848 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5849 | ;} |
| 5850 | break; |
| 5851 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5852 | case 271: |
| 5853 | #line 2600 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5854 | { |
| 5855 | (yyval.ValIDVal) = ValID::createUndef(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 5856 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5857 | ;} |
| 5858 | break; |
| 5859 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5860 | case 272: |
| 5861 | #line 2604 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5862 | { // A vector zero constant. |
| 5863 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 5864 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5865 | ;} |
| 5866 | break; |
| 5867 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5868 | case 273: |
| 5869 | #line 2608 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5870 | { // Nonempty unsized packed vector |
| 5871 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5872 | unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 5873 | |
| 5874 | if (!ETy->isInteger() && !ETy->isFloatingPoint()) |
| 5875 | GEN_ERROR("Invalid vector element type: " + ETy->getDescription()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5876 | |
Reid Spencer | 9d6565a | 2007-02-15 02:26:10 +0000 | [diff] [blame] | 5877 | VectorType* pt = VectorType::get(ETy, NumElements); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5878 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt)); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5879 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5880 | // Verify all elements are correct type! |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5881 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5882 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5883 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5884 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5885 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 5886 | } |
| 5887 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5888 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector))); |
| 5889 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 5890 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5891 | ;} |
| 5892 | break; |
| 5893 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5894 | case 274: |
| 5895 | #line 2630 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5896 | { // Nonempty unsized arr |
| 5897 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5898 | uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5899 | |
| 5900 | if (!ETy->isFirstClassType()) |
| 5901 | GEN_ERROR("Invalid array element type: " + ETy->getDescription()); |
| 5902 | |
| 5903 | ArrayType *ATy = ArrayType::get(ETy, NumElements); |
| 5904 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy)); |
| 5905 | |
| 5906 | // Verify all elements are correct type! |
| 5907 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5908 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 5909 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5910 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
| 5911 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
| 5912 | } |
| 5913 | |
| 5914 | (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector))); |
| 5915 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
| 5916 | CHECK_FOR_ERROR |
| 5917 | ;} |
| 5918 | break; |
| 5919 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5920 | case 275: |
| 5921 | #line 2652 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5922 | { |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5923 | // Use undef instead of an array because it's inconvenient to determine |
| 5924 | // the element type at this point, there being no elements to examine. |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5925 | (yyval.ValIDVal) = ValID::createUndef(); |
| 5926 | CHECK_FOR_ERROR |
| 5927 | ;} |
| 5928 | break; |
| 5929 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5930 | case 276: |
| 5931 | #line 2658 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5932 | { |
Dan Gohman | 180c169 | 2008-06-23 18:43:26 +0000 | [diff] [blame] | 5933 | uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length(); |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5934 | const Type *ETy = Type::Int8Ty; |
| 5935 | |
| 5936 | ArrayType *ATy = ArrayType::get(ETy, NumElements); |
| 5937 | |
| 5938 | std::vector<Constant*> Vals; |
| 5939 | for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i) |
| 5940 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i])); |
| 5941 | delete (yyvsp[(2) - (2)].StrVal); |
| 5942 | (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals)); |
| 5943 | CHECK_FOR_ERROR |
| 5944 | ;} |
| 5945 | break; |
| 5946 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5947 | case 277: |
| 5948 | #line 2671 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5949 | { |
| 5950 | std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size()); |
| 5951 | for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i) |
| 5952 | Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType(); |
| 5953 | |
| 5954 | const StructType *STy = StructType::get(Elements); |
| 5955 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy)); |
| 5956 | |
| 5957 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector))); |
| 5958 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
| 5959 | CHECK_FOR_ERROR |
| 5960 | ;} |
| 5961 | break; |
| 5962 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5963 | case 278: |
| 5964 | #line 2683 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5965 | { |
| 5966 | const StructType *STy = StructType::get(std::vector<const Type*>()); |
| 5967 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>())); |
| 5968 | CHECK_FOR_ERROR |
| 5969 | ;} |
| 5970 | break; |
| 5971 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5972 | case 279: |
| 5973 | #line 2688 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5974 | { |
| 5975 | std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size()); |
| 5976 | for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i) |
| 5977 | Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType(); |
| 5978 | |
| 5979 | const StructType *STy = StructType::get(Elements, /*isPacked=*/true); |
| 5980 | PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy)); |
| 5981 | |
| 5982 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector))); |
| 5983 | delete PTy; delete (yyvsp[(3) - (5)].ConstVector); |
| 5984 | CHECK_FOR_ERROR |
| 5985 | ;} |
| 5986 | break; |
| 5987 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5988 | case 280: |
| 5989 | #line 2700 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f910eaa | 2008-06-09 14:45:02 +0000 | [diff] [blame] | 5990 | { |
| 5991 | const StructType *STy = StructType::get(std::vector<const Type*>(), |
| 5992 | /*isPacked=*/true); |
| 5993 | (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>())); |
| 5994 | CHECK_FOR_ERROR |
| 5995 | ;} |
| 5996 | break; |
| 5997 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 5998 | case 281: |
| 5999 | #line 2706 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6000 | { |
| 6001 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6002 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6003 | ;} |
| 6004 | break; |
| 6005 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6006 | case 282: |
| 6007 | #line 2710 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6008 | { |
| 6009 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); |
| 6010 | delete (yyvsp[(3) - (5)].StrVal); |
| 6011 | delete (yyvsp[(5) - (5)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6012 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6013 | ;} |
| 6014 | break; |
| 6015 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6016 | case 283: |
| 6017 | #line 2720 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6018 | { // Is it an integer reference...? |
| 6019 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6020 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6021 | ;} |
| 6022 | break; |
| 6023 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6024 | case 284: |
| 6025 | #line 2724 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6026 | { |
| 6027 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6028 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6029 | ;} |
| 6030 | break; |
| 6031 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6032 | case 285: |
| 6033 | #line 2728 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6034 | { // Is it a named reference...? |
| 6035 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); |
| 6036 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6037 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6038 | ;} |
| 6039 | break; |
| 6040 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6041 | case 286: |
| 6042 | #line 2733 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6043 | { // Is it a named reference...? |
| 6044 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); |
| 6045 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6046 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6047 | ;} |
| 6048 | break; |
| 6049 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6050 | case 289: |
| 6051 | #line 2746 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6052 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6053 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6054 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6055 | (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6056 | delete (yyvsp[(1) - (2)].TypeVal); |
Reid Spencer | 832254e | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 6057 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6058 | ;} |
| 6059 | break; |
| 6060 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6061 | case 290: |
| 6062 | #line 2755 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6063 | { |
| 6064 | (yyval.ValueList) = new std::vector<Value *>(); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6065 | (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6066 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6067 | ;} |
| 6068 | break; |
| 6069 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6070 | case 291: |
| 6071 | #line 2760 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6072 | { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6073 | ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); |
Devang Patel | 7990dc7 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 6074 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6075 | ;} |
| 6076 | break; |
| 6077 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6078 | case 292: |
| 6079 | #line 2765 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6080 | { |
| 6081 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6082 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6083 | ;} |
| 6084 | break; |
| 6085 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6086 | case 293: |
| 6087 | #line 2769 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6088 | { // Do not allow functions with 0 basic blocks |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6089 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6090 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6091 | ;} |
| 6092 | break; |
| 6093 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6094 | case 294: |
| 6095 | #line 2778 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6096 | { |
| 6097 | setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6098 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6099 | InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 6100 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 6101 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6102 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6103 | ;} |
| 6104 | break; |
| 6105 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6106 | case 295: |
| 6107 | #line 2787 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6108 | { |
| 6109 | CHECK_FOR_ERROR |
| 6110 | int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 6111 | if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal)) |
| 6112 | GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) + |
| 6113 | " is incorrect, expected %" + utostr((unsigned)ValNum)); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6114 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6115 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 6116 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
| 6117 | CHECK_FOR_ERROR |
| 6118 | ;} |
| 6119 | break; |
| 6120 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6121 | case 296: |
| 6122 | #line 2800 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6123 | { |
| 6124 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6125 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 6126 | if (CI2->getParent() == 0) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6127 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); |
| 6128 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); |
| 6129 | (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); |
Anton Korobeynikov | 38e0980 | 2007-04-28 13:48:45 +0000 | [diff] [blame] | 6130 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6131 | ;} |
| 6132 | break; |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6133 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6134 | case 297: |
| 6135 | #line 2809 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6136 | { // Empty space between instruction lists |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 6137 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6138 | CHECK_FOR_ERROR |
| 6139 | ;} |
| 6140 | break; |
| 6141 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6142 | case 298: |
| 6143 | #line 2813 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 6144 | { // Labelled (named) basic block |
| 6145 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); |
| 6146 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6147 | CHECK_FOR_ERROR |
Chris Lattner | cc81d15 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 6148 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6149 | ;} |
| 6150 | break; |
| 6151 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6152 | case 299: |
| 6153 | #line 2821 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6154 | { // Return with a result... |
| 6155 | ValueList &VL = *(yyvsp[(2) - (2)].ValueList); |
| 6156 | assert(!VL.empty() && "Invalid ret operands!"); |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 6157 | const Type *ReturnType = CurFun.CurrentFunction->getReturnType(); |
| 6158 | if (VL.size() > 1 || |
| 6159 | (isa<StructType>(ReturnType) && |
| 6160 | (VL.empty() || VL[0]->getType() != ReturnType))) { |
| 6161 | Value *RV = UndefValue::get(ReturnType); |
| 6162 | for (unsigned i = 0, e = VL.size(); i != e; ++i) { |
| 6163 | Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv"); |
| 6164 | ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I); |
| 6165 | RV = I; |
| 6166 | } |
| 6167 | (yyval.TermInstVal) = ReturnInst::Create(RV); |
| 6168 | } else { |
| 6169 | (yyval.TermInstVal) = ReturnInst::Create(VL[0]); |
| 6170 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6171 | delete (yyvsp[(2) - (2)].ValueList); |
| 6172 | CHECK_FOR_ERROR |
| 6173 | ;} |
| 6174 | break; |
| 6175 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6176 | case 300: |
| 6177 | #line 2841 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6178 | { // Return with no result... |
| 6179 | (yyval.TermInstVal) = ReturnInst::Create(); |
| 6180 | CHECK_FOR_ERROR |
| 6181 | ;} |
| 6182 | break; |
| 6183 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6184 | case 301: |
| 6185 | #line 2845 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6186 | { // Unconditional Branch... |
| 6187 | BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); |
| 6188 | CHECK_FOR_ERROR |
| 6189 | (yyval.TermInstVal) = BranchInst::Create(tmpBB); |
| 6190 | ;} |
| 6191 | break; |
| 6192 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6193 | case 302: |
| 6194 | #line 2850 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6195 | { |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6196 | if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1) |
| 6197 | GEN_ERROR("Branch condition must have type i1"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6198 | BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 6199 | CHECK_FOR_ERROR |
| 6200 | BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); |
| 6201 | CHECK_FOR_ERROR |
| 6202 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); |
| 6203 | CHECK_FOR_ERROR |
| 6204 | (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal); |
| 6205 | ;} |
| 6206 | break; |
| 6207 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6208 | case 303: |
| 6209 | #line 2861 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6210 | { |
| 6211 | Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); |
| 6212 | CHECK_FOR_ERROR |
| 6213 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 6214 | CHECK_FOR_ERROR |
| 6215 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); |
| 6216 | (yyval.TermInstVal) = S; |
| 6217 | |
| 6218 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), |
| 6219 | E = (yyvsp[(8) - (9)].JumpTable)->end(); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6220 | for (; I != E; ++I) { |
| 6221 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 6222 | S->addCase(CI, I->second); |
| 6223 | else |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6224 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6225 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6226 | delete (yyvsp[(8) - (9)].JumpTable); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6227 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6228 | ;} |
| 6229 | break; |
| 6230 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6231 | case 304: |
| 6232 | #line 2880 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6233 | { |
| 6234 | Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6235 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6236 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6237 | CHECK_FOR_ERROR |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6238 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6239 | (yyval.TermInstVal) = S; |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6240 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6241 | ;} |
| 6242 | break; |
| 6243 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6244 | case 305: |
| 6245 | #line 2890 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6246 | { |
Reid Spencer | 3822ff5 | 2006-11-08 06:47:33 +0000 | [diff] [blame] | 6247 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6248 | // Handle the short syntax |
| 6249 | const PointerType *PFTy = 0; |
| 6250 | const FunctionType *Ty = 0; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6251 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) || |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6252 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6253 | // Pull out the types of all of the arguments... |
| 6254 | std::vector<const Type*> ParamTypes; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6255 | 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] | 6256 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6257 | const Type *Ty = I->Val->getType(); |
| 6258 | if (Ty == Type::VoidTy) |
| 6259 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6260 | ParamTypes.push_back(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6261 | } |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6262 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6263 | if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal))) |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6264 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6265 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6266 | Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6267 | PFTy = PointerType::getUnqual(Ty); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6268 | } |
| 6269 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6270 | delete (yyvsp[(4) - (15)].TypeVal); |
Reid Spencer | 66728ef | 2007-03-20 01:13:36 +0000 | [diff] [blame] | 6271 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6272 | 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] | 6273 | CHECK_FOR_ERROR |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6274 | BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6275 | CHECK_FOR_ERROR |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6276 | BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal)); |
Reid Spencer | 5b7e753 | 2006-09-28 19:28:24 +0000 | [diff] [blame] | 6277 | CHECK_FOR_ERROR |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6278 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6279 | SmallVector<AttributeWithIndex, 8> Attrs; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6280 | //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function |
| 6281 | //attributes. |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6282 | Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes); |
| 6283 | if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) { |
| 6284 | if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6285 | RetAttrs = RetAttrs | Attribute::ZExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6286 | (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6287 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6288 | if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6289 | RetAttrs = RetAttrs | Attribute::SExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6290 | (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6291 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6292 | if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6293 | RetAttrs = RetAttrs | Attribute::InReg; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6294 | (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6295 | } |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6296 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6297 | if (RetAttrs != Attribute::None) |
| 6298 | Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6299 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6300 | // Check the arguments |
| 6301 | ValueList Args; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6302 | if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments? |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6303 | // Make sure no arguments is a good thing! |
| 6304 | if (Ty->getNumParams() != 0) |
| 6305 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6306 | "expects arguments"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6307 | } else { // Has arguments? |
| 6308 | // Loop through FunctionType's arguments and ensure they are specified |
| 6309 | // correctly! |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6310 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6311 | FunctionType::param_iterator E = Ty->param_end(); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6312 | 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] | 6313 | unsigned index = 1; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6314 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6315 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6316 | if (ArgI->Val->getType() != *I) |
| 6317 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6318 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6319 | Args.push_back(ArgI->Val); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6320 | if (ArgI->Attrs != Attribute::None) |
| 6321 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6322 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6323 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6324 | if (Ty->isVarArg()) { |
| 6325 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6326 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6327 | Args.push_back(ArgI->Val); // push the remaining varargs |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6328 | if (ArgI->Attrs != Attribute::None) |
| 6329 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6330 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6331 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6332 | GEN_ERROR("Invalid number of parameters detected"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 6333 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6334 | if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) |
| 6335 | Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes))); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6336 | AttrListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6337 | if (!Attrs.empty()) |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6338 | PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6339 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6340 | // Create the InvokeInst |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 6341 | InvokeInst *II = InvokeInst::Create(V, Normal, Except, |
| 6342 | Args.begin(), Args.end()); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6343 | II->setCallingConv((yyvsp[(2) - (15)].UIntVal)); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6344 | II->setAttributes(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6345 | (yyval.TermInstVal) = II; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6346 | delete (yyvsp[(7) - (15)].ParamList); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6347 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6348 | ;} |
| 6349 | break; |
| 6350 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6351 | case 306: |
| 6352 | #line 2993 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6353 | { |
| 6354 | (yyval.TermInstVal) = new UnwindInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6355 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6356 | ;} |
| 6357 | break; |
| 6358 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6359 | case 307: |
| 6360 | #line 2997 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6361 | { |
| 6362 | (yyval.TermInstVal) = new UnreachableInst(); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6363 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6364 | ;} |
| 6365 | break; |
| 6366 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6367 | case 308: |
| 6368 | #line 3004 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6369 | { |
| 6370 | (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); |
| 6371 | 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] | 6372 | CHECK_FOR_ERROR |
| 6373 | if (V == 0) |
| 6374 | GEN_ERROR("May only switch on a constant pool value"); |
| 6375 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6376 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6377 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6378 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 6379 | ;} |
| 6380 | break; |
| 6381 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6382 | case 309: |
| 6383 | #line 3015 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6384 | { |
| 6385 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 6386 | 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] | 6387 | CHECK_FOR_ERROR |
| 6388 | |
| 6389 | if (V == 0) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6390 | GEN_ERROR("May only switch on a constant pool value"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6391 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6392 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6393 | CHECK_FOR_ERROR |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6394 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6395 | ;} |
| 6396 | break; |
| 6397 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6398 | case 310: |
| 6399 | #line 3028 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6400 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6401 | // Is this definition named?? if so, assign the name... |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6402 | setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6403 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6404 | InsertValue((yyvsp[(2) - (2)].InstVal)); |
| 6405 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6406 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6407 | ;} |
| 6408 | break; |
| 6409 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6410 | case 311: |
| 6411 | #line 3037 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6412 | { |
| 6413 | CHECK_FOR_ERROR |
| 6414 | int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal)); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6415 | |
Chris Lattner | 15bd095 | 2008-08-29 17:20:18 +0000 | [diff] [blame] | 6416 | if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal)) |
| 6417 | GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) + |
| 6418 | " is incorrect, expected %" + utostr((unsigned)ValNum)); |
| 6419 | |
| 6420 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
| 6421 | CHECK_FOR_ERROR |
| 6422 | ;} |
| 6423 | break; |
| 6424 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6425 | case 312: |
| 6426 | #line 3050 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6427 | { // Used for PHI nodes |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6428 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6429 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); |
| 6430 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 6431 | Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); |
Reid Spencer | 6f40790 | 2007-01-13 05:00:46 +0000 | [diff] [blame] | 6432 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6433 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6434 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6435 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6436 | delete (yyvsp[(1) - (6)].TypeVal); |
| 6437 | ;} |
| 6438 | break; |
| 6439 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6440 | case 313: |
| 6441 | #line 3061 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6442 | { |
| 6443 | (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); |
| 6444 | 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] | 6445 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6446 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6447 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6448 | (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 6449 | ;} |
| 6450 | break; |
| 6451 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6452 | case 314: |
| 6453 | #line 3071 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6454 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6455 | // 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] | 6456 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6457 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6458 | // Used for call and invoke instructions |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6459 | (yyval.ParamList) = new ParamList(); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6460 | 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] | 6461 | (yyval.ParamList)->push_back(E); |
| 6462 | delete (yyvsp[(1) - (4)].TypeVal); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6463 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6464 | ;} |
| 6465 | break; |
| 6466 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6467 | case 315: |
| 6468 | #line 3082 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6469 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6470 | // 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] | 6471 | // Labels are only valid in ASMs |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6472 | (yyval.ParamList) = new ParamList(); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6473 | 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] | 6474 | (yyval.ParamList)->push_back(E); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6475 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6476 | ;} |
| 6477 | break; |
| 6478 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6479 | case 316: |
| 6480 | #line 3090 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6481 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6482 | // 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] | 6483 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6484 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6485 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6486 | 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] | 6487 | (yyval.ParamList)->push_back(E); |
| 6488 | delete (yyvsp[(3) - (6)].TypeVal); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6489 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6490 | ;} |
| 6491 | break; |
| 6492 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6493 | case 317: |
| 6494 | #line 3100 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6495 | { |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6496 | // 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] | 6497 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6498 | 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] | 6499 | (yyval.ParamList)->push_back(E); |
Dale Johannesen | eb57ea7 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 6500 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6501 | ;} |
| 6502 | break; |
| 6503 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6504 | case 318: |
| 6505 | #line 3107 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6506 | { (yyval.ParamList) = new ParamList(); ;} |
| 6507 | break; |
| 6508 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6509 | case 319: |
| 6510 | #line 3110 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6511 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 6512 | break; |
| 6513 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6514 | case 320: |
| 6515 | #line 3111 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6516 | { |
| 6517 | (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); |
| 6518 | (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6519 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6520 | ;} |
| 6521 | break; |
| 6522 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6523 | case 321: |
| 6524 | #line 3119 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6525 | { |
| 6526 | (yyval.ConstantList) = new std::vector<unsigned>(); |
| 6527 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
| 6528 | GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6529 | (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val)); |
| 6530 | ;} |
| 6531 | break; |
| 6532 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6533 | case 322: |
| 6534 | #line 3125 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6535 | { |
| 6536 | (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList); |
| 6537 | if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val)) |
| 6538 | GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue."); |
| 6539 | (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val)); |
| 6540 | CHECK_FOR_ERROR |
| 6541 | ;} |
| 6542 | break; |
| 6543 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6544 | case 323: |
| 6545 | #line 3134 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6546 | { |
| 6547 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6548 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6549 | ;} |
| 6550 | break; |
| 6551 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6552 | case 324: |
| 6553 | #line 3138 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6554 | { |
| 6555 | (yyval.BoolVal) = false; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6556 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6557 | ;} |
| 6558 | break; |
| 6559 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6560 | case 325: |
| 6561 | #line 3143 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6562 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6563 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6564 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6565 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6566 | !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6567 | GEN_ERROR( |
| 6568 | "Arithmetic operator requires integer, FP, or packed operands"); |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6569 | Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6570 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6571 | Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6572 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6573 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6574 | if ((yyval.InstVal) == 0) |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6575 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6576 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6577 | ;} |
| 6578 | break; |
| 6579 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6580 | case 326: |
| 6581 | #line 3159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6582 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6583 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6584 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6585 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) { |
Nate Begeman | 5bc1ea0 | 2008-07-29 15:49:41 +0000 | [diff] [blame] | 6586 | if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) || |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6587 | !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6588 | GEN_ERROR("Logical operator requires integral operands"); |
| 6589 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6590 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6591 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6592 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6593 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6594 | (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6595 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6596 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6597 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6598 | ;} |
| 6599 | break; |
| 6600 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6601 | case 327: |
| 6602 | #line 3176 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6603 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6604 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6605 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6606 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6607 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6608 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6609 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6610 | (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] | 6611 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6612 | GEN_ERROR("icmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6613 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6614 | ;} |
| 6615 | break; |
| 6616 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6617 | case 328: |
| 6618 | #line 3188 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6619 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6620 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6621 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6622 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6623 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6624 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6625 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6626 | (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] | 6627 | if ((yyval.InstVal) == 0) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6628 | GEN_ERROR("fcmp operator returned null"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6629 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6630 | ;} |
| 6631 | break; |
| 6632 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6633 | case 329: |
| 6634 | #line 3200 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6635 | { |
| 6636 | if (!UpRefs.empty()) |
| 6637 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6638 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6639 | GEN_ERROR("Scalar types not supported by vicmp instruction"); |
| 6640 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6641 | CHECK_FOR_ERROR |
| 6642 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6643 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6644 | (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] | 6645 | if ((yyval.InstVal) == 0) |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6646 | GEN_ERROR("vicmp operator returned null"); |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6647 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6648 | ;} |
| 6649 | break; |
| 6650 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6651 | case 330: |
| 6652 | #line 3214 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6653 | { |
| 6654 | if (!UpRefs.empty()) |
| 6655 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6656 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6657 | GEN_ERROR("Scalar types not supported by vfcmp instruction"); |
| 6658 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6659 | CHECK_FOR_ERROR |
| 6660 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6661 | CHECK_FOR_ERROR |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6662 | (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] | 6663 | if ((yyval.InstVal) == 0) |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6664 | GEN_ERROR("vfcmp operator returned null"); |
Nate Begeman | ac80ade | 2008-05-12 19:01:56 +0000 | [diff] [blame] | 6665 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6666 | ;} |
| 6667 | break; |
| 6668 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6669 | case 331: |
| 6670 | #line 3228 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6671 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6672 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6673 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6674 | Value* Val = (yyvsp[(2) - (4)].ValueVal); |
| 6675 | const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get(); |
| 6676 | if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy)) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6677 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 6678 | Val->getType()->getDescription() + "' to '" + |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6679 | DestTy->getDescription() + "'"); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 6680 | (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6681 | delete (yyvsp[(4) - (4)].TypeVal); |
| 6682 | ;} |
| 6683 | break; |
| 6684 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6685 | case 332: |
| 6686 | #line 3240 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6687 | { |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6688 | if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) { |
| 6689 | // vector select |
| 6690 | if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType()) |
| 6691 | || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) ) |
| 6692 | GEN_ERROR("vector select value types must be vector types"); |
| 6693 | const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType()); |
| 6694 | const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType()); |
| 6695 | if (cond_type->getElementType() != Type::Int1Ty) |
| 6696 | GEN_ERROR("vector select condition element type must be boolean"); |
| 6697 | if (cond_type->getNumElements() != select_type->getNumElements()) |
| 6698 | GEN_ERROR("vector select number of elements must be the same"); |
| 6699 | } else { |
| 6700 | if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) |
| 6701 | GEN_ERROR("select condition must be boolean"); |
| 6702 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6703 | if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) |
Dan Gohman | d8ee59b | 2008-09-09 01:13:24 +0000 | [diff] [blame] | 6704 | GEN_ERROR("select value types must match"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6705 | (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] | 6706 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6707 | ;} |
| 6708 | break; |
| 6709 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6710 | case 333: |
| 6711 | #line 3261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6712 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6713 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6714 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6715 | (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); |
| 6716 | delete (yyvsp[(4) - (4)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6717 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6718 | ;} |
| 6719 | break; |
| 6720 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6721 | case 334: |
| 6722 | #line 3268 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6723 | { |
| 6724 | if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6725 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6726 | (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6727 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6728 | ;} |
| 6729 | break; |
| 6730 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6731 | case 335: |
| 6732 | #line 3274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6733 | { |
| 6734 | 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] | 6735 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6736 | (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] | 6737 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6738 | ;} |
| 6739 | break; |
| 6740 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6741 | case 336: |
| 6742 | #line 3280 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6743 | { |
| 6744 | 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] | 6745 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6746 | (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] | 6747 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6748 | ;} |
| 6749 | break; |
| 6750 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6751 | case 337: |
| 6752 | #line 3286 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6753 | { |
| 6754 | const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6755 | if (!Ty->isFirstClassType()) |
| 6756 | GEN_ERROR("PHI node operands must be of first class type"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6757 | (yyval.InstVal) = PHINode::Create(Ty); |
| 6758 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); |
| 6759 | while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6760 | if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6761 | 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] | 6762 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); |
| 6763 | (yyvsp[(2) - (2)].PHIList)->pop_front(); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6764 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6765 | delete (yyvsp[(2) - (2)].PHIList); // Free the list... |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6766 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6767 | ;} |
| 6768 | break; |
| 6769 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6770 | case 338: |
| 6771 | #line 3302 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6772 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6773 | |
| 6774 | // Handle the short syntax |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6775 | const PointerType *PFTy = 0; |
| 6776 | const FunctionType *Ty = 0; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6777 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) || |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6778 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6779 | // Pull out the types of all of the arguments... |
| 6780 | std::vector<const Type*> ParamTypes; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6781 | 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] | 6782 | for (; I != E; ++I) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6783 | const Type *Ty = I->Val->getType(); |
| 6784 | if (Ty == Type::VoidTy) |
| 6785 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6786 | ParamTypes.push_back(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6787 | } |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6788 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6789 | if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal))) |
Chris Lattner | a925a14 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6790 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6791 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6792 | Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | 4374f8e | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6793 | PFTy = PointerType::getUnqual(Ty); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6794 | } |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6795 | |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6796 | 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] | 6797 | CHECK_FOR_ERROR |
Chris Lattner | 6cdc682 | 2007-04-26 05:31:05 +0000 | [diff] [blame] | 6798 | |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6799 | // Check for call to invalid intrinsic to avoid crashing later. |
| 6800 | if (Function *theF = dyn_cast<Function>(V)) { |
Reid Spencer | ed48de2 | 2007-04-16 22:02:23 +0000 | [diff] [blame] | 6801 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
Reid Spencer | 36fdde1 | 2007-04-16 20:35:38 +0000 | [diff] [blame] | 6802 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 6803 | !theF->getIntrinsicID(true)) |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 6804 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 6805 | theF->getName() + "'"); |
| 6806 | } |
| 6807 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6808 | // Set up the Attributes for the function |
| 6809 | SmallVector<AttributeWithIndex, 8> Attrs; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6810 | //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function |
| 6811 | //attributes. |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6812 | Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes); |
| 6813 | if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) { |
| 6814 | if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6815 | RetAttrs = RetAttrs | Attribute::ZExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6816 | (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6817 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6818 | if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6819 | RetAttrs = RetAttrs | Attribute::SExt; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6820 | (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6821 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6822 | if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) { |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6823 | RetAttrs = RetAttrs | Attribute::InReg; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6824 | (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg; |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6825 | } |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6826 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6827 | if (RetAttrs != Attribute::None) |
| 6828 | Attrs.push_back(AttributeWithIndex::get(0, RetAttrs)); |
Dale Johannesen | e726186 | 2008-09-26 23:46:20 +0000 | [diff] [blame] | 6829 | |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6830 | // Check the arguments |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6831 | ValueList Args; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6832 | if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments? |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6833 | // Make sure no arguments is a good thing! |
| 6834 | if (Ty->getNumParams() != 0) |
| 6835 | GEN_ERROR("No arguments passed to a function that " |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6836 | "expects arguments"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6837 | } else { // Has arguments? |
| 6838 | // Loop through FunctionType's arguments and ensure they are specified |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6839 | // correctly. Also, gather any parameter attributes. |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6840 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6841 | FunctionType::param_iterator E = Ty->param_end(); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6842 | 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] | 6843 | unsigned index = 1; |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6844 | |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6845 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6846 | if (ArgI->Val->getType() != *I) |
| 6847 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6848 | (*I)->getDescription() + "'"); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6849 | Args.push_back(ArgI->Val); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6850 | if (ArgI->Attrs != Attribute::None) |
| 6851 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6852 | } |
| 6853 | if (Ty->isVarArg()) { |
| 6854 | if (I == E) |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6855 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6856 | Args.push_back(ArgI->Val); // push the remaining varargs |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6857 | if (ArgI->Attrs != Attribute::None) |
| 6858 | Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6859 | } |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6860 | } else if (I != E || ArgI != ArgE) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 6861 | GEN_ERROR("Invalid number of parameters detected"); |
Andrew Lenharth | 6353e05 | 2006-12-08 18:07:09 +0000 | [diff] [blame] | 6862 | } |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6863 | if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) |
| 6864 | Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes))); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6865 | |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6866 | // Finish off the Attributes and check them |
| 6867 | AttrListPtr PAL; |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6868 | if (!Attrs.empty()) |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6869 | PAL = AttrListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6870 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6871 | // Create the call node |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6872 | CallInst *CI = CallInst::Create(V, Args.begin(), Args.end()); |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6873 | CI->setTailCall((yyvsp[(1) - (9)].BoolVal)); |
| 6874 | CI->setCallingConv((yyvsp[(2) - (9)].UIntVal)); |
Devang Patel | 0598866 | 2008-09-25 21:00:45 +0000 | [diff] [blame] | 6875 | CI->setAttributes(PAL); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6876 | (yyval.InstVal) = CI; |
Devang Patel | 652203f | 2008-09-29 20:49:50 +0000 | [diff] [blame] | 6877 | delete (yyvsp[(7) - (9)].ParamList); |
| 6878 | delete (yyvsp[(4) - (9)].TypeVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6879 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6880 | ;} |
| 6881 | break; |
| 6882 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6883 | case 339: |
| 6884 | #line 3411 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6885 | { |
| 6886 | (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6887 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6888 | ;} |
| 6889 | break; |
| 6890 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6891 | case 340: |
| 6892 | #line 3416 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6893 | { |
| 6894 | (yyval.BoolVal) = true; |
Reid Spencer | e4d87aa | 2006-12-23 06:05:41 +0000 | [diff] [blame] | 6895 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6896 | ;} |
| 6897 | break; |
| 6898 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6899 | case 341: |
| 6900 | #line 3420 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6901 | { |
| 6902 | (yyval.BoolVal) = false; |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6903 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6904 | ;} |
| 6905 | break; |
| 6906 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6907 | case 342: |
| 6908 | #line 3427 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6909 | { |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6910 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6911 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6912 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6913 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6914 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6915 | ;} |
| 6916 | break; |
| 6917 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6918 | case 343: |
| 6919 | #line 3434 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6920 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6921 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6922 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6923 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6924 | GEN_ERROR("Malloc array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6925 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6926 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6927 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6928 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6929 | ;} |
| 6930 | break; |
| 6931 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6932 | case 344: |
| 6933 | #line 3444 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6934 | { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 6935 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6936 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6937 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6938 | delete (yyvsp[(2) - (3)].TypeVal); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 6939 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6940 | ;} |
| 6941 | break; |
| 6942 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6943 | case 345: |
| 6944 | #line 3451 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6945 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6946 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6947 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 6948 | if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty) |
| 6949 | GEN_ERROR("Alloca array size is not a 32-bit integer!"); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6950 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Anton Korobeynikov | 9adeaa2 | 2007-01-28 13:37:39 +0000 | [diff] [blame] | 6951 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6952 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6953 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6954 | ;} |
| 6955 | break; |
| 6956 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6957 | case 346: |
| 6958 | #line 3461 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6959 | { |
| 6960 | if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 6961 | GEN_ERROR("Trying to free nonpointer type " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6962 | (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + ""); |
| 6963 | (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6964 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6965 | ;} |
| 6966 | break; |
| 6967 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6968 | case 347: |
| 6969 | #line 3469 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6970 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6971 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6972 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6973 | if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6974 | GEN_ERROR("Can't load from nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6975 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6976 | if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType()) |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6977 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6978 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6979 | Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal)); |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6980 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6981 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal)); |
| 6982 | delete (yyvsp[(3) - (5)].TypeVal); |
| 6983 | ;} |
| 6984 | break; |
| 6985 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 6986 | case 348: |
| 6987 | #line 3483 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6988 | { |
Lauro Ramos Venancio | c763552 | 2007-04-12 18:32:50 +0000 | [diff] [blame] | 6989 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6990 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
| 6991 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6992 | if (!PT) |
| 6993 | GEN_ERROR("Can't store to a nonpointer type: " + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6994 | (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6995 | const Type *ElTy = PT->getElementType(); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6996 | if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType()) |
| 6997 | GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() + |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 6998 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 6999 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7000 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7001 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7002 | (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
| 7003 | delete (yyvsp[(5) - (7)].TypeVal); |
| 7004 | ;} |
| 7005 | break; |
| 7006 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 7007 | case 349: |
| 7008 | #line 3500 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7009 | { |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 7010 | if (!UpRefs.empty()) |
| 7011 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 7012 | if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get())) |
| 7013 | GEN_ERROR("getresult insn requires an aggregate operand"); |
| 7014 | if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val))) |
| 7015 | GEN_ERROR("Invalid getresult index for type '" + |
| 7016 | (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'"); |
| 7017 | |
| 7018 | Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Devang Patel | 5a97097 | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 7019 | CHECK_FOR_ERROR |
Dan Gohman | 1a57024 | 2008-07-23 00:54:54 +0000 | [diff] [blame] | 7020 | (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val)); |
| 7021 | delete (yyvsp[(2) - (5)].TypeVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7022 | ;} |
| 7023 | break; |
| 7024 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 7025 | case 350: |
| 7026 | #line 3514 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7027 | { |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7028 | if (!UpRefs.empty()) |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7029 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 7030 | if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) |
Reid Spencer | b5334b0 | 2007-02-05 10:18:06 +0000 | [diff] [blame] | 7031 | GEN_ERROR("getelementptr insn requires pointer operand"); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7032 | |
Dan Gohman | 041e2eb | 2008-05-15 19:50:34 +0000 | [diff] [blame] | 7033 | 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] | 7034 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7035 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 7036 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7037 | CHECK_FOR_ERROR |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7038 | (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] | 7039 | delete (yyvsp[(2) - (4)].TypeVal); |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7040 | delete (yyvsp[(4) - (4)].ValueList); |
| 7041 | ;} |
| 7042 | break; |
Reid Spencer | 7780acb | 2007-04-16 06:56:07 +0000 | [diff] [blame] | 7043 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 7044 | case 351: |
| 7045 | #line 3529 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7046 | { |
| 7047 | if (!UpRefs.empty()) |
| 7048 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 7049 | if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get())) |
| 7050 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 7051 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7052 | 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] | 7053 | GEN_ERROR("Invalid extractvalue indices for type '" + |
| 7054 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 7055 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
| 7056 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7057 | (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] | 7058 | delete (yyvsp[(2) - (4)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7059 | delete (yyvsp[(4) - (4)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7060 | ;} |
| 7061 | break; |
| 7062 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 7063 | case 352: |
| 7064 | #line 3544 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7065 | { |
| 7066 | if (!UpRefs.empty()) |
| 7067 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription()); |
| 7068 | if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get())) |
| 7069 | GEN_ERROR("extractvalue insn requires an aggregate operand"); |
| 7070 | |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7071 | 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] | 7072 | GEN_ERROR("Invalid insertvalue indices for type '" + |
| 7073 | (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'"); |
| 7074 | Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal)); |
| 7075 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
| 7076 | CHECK_FOR_ERROR |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7077 | (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] | 7078 | delete (yyvsp[(2) - (7)].TypeVal); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7079 | delete (yyvsp[(5) - (7)].TypeVal); |
Dan Gohman | 81a0c0b | 2008-05-31 00:58:22 +0000 | [diff] [blame] | 7080 | delete (yyvsp[(7) - (7)].ConstantList); |
Dan Gohman | e4977cf | 2008-05-23 01:55:30 +0000 | [diff] [blame] | 7081 | ;} |
| 7082 | break; |
| 7083 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7084 | |
| 7085 | /* Line 1267 of yacc.c. */ |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 7086 | #line 7087 "llvmAsmParser.tab.c" |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7087 | default: break; |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 7088 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7089 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 7090 | |
| 7091 | YYPOPSTACK (yylen); |
| 7092 | yylen = 0; |
| 7093 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7094 | |
| 7095 | *++yyvsp = yyval; |
| 7096 | |
| 7097 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7098 | /* Now `shift' the result of the reduction. Determine what state |
| 7099 | that goes to, based on the state we popped back to and the rule |
| 7100 | number reduced by. */ |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7101 | |
| 7102 | yyn = yyr1[yyn]; |
| 7103 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7104 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 7105 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7106 | yystate = yytable[yystate]; |
| 7107 | else |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7108 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7109 | |
| 7110 | goto yynewstate; |
| 7111 | |
| 7112 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7113 | /*------------------------------------. |
| 7114 | | yyerrlab -- here on detecting error | |
| 7115 | `------------------------------------*/ |
| 7116 | yyerrlab: |
| 7117 | /* If not already recovering from an error, report this error. */ |
| 7118 | if (!yyerrstatus) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7119 | { |
| 7120 | ++yynerrs; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7121 | #if ! YYERROR_VERBOSE |
| 7122 | yyerror (YY_("syntax error")); |
| 7123 | #else |
| 7124 | { |
| 7125 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 7126 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 7127 | { |
| 7128 | YYSIZE_T yyalloc = 2 * yysize; |
| 7129 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 7130 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 7131 | if (yymsg != yymsgbuf) |
| 7132 | YYSTACK_FREE (yymsg); |
| 7133 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 7134 | if (yymsg) |
| 7135 | yymsg_alloc = yyalloc; |
| 7136 | else |
| 7137 | { |
| 7138 | yymsg = yymsgbuf; |
| 7139 | yymsg_alloc = sizeof yymsgbuf; |
| 7140 | } |
| 7141 | } |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 7142 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7143 | if (0 < yysize && yysize <= yymsg_alloc) |
| 7144 | { |
| 7145 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 7146 | yyerror (yymsg); |
| 7147 | } |
| 7148 | else |
| 7149 | { |
| 7150 | yyerror (YY_("syntax error")); |
| 7151 | if (yysize != 0) |
| 7152 | goto yyexhaustedlab; |
| 7153 | } |
| 7154 | } |
| 7155 | #endif |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7156 | } |
| 7157 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7158 | |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7159 | |
| 7160 | if (yyerrstatus == 3) |
| 7161 | { |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7162 | /* If just tried and failed to reuse look-ahead token after an |
| 7163 | error, discard it. */ |
Anton Korobeynikov | f52e608 | 2007-04-29 18:38:24 +0000 | [diff] [blame] | 7164 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7165 | if (yychar <= YYEOF) |
| 7166 | { |
| 7167 | /* Return failure if at end of input. */ |
| 7168 | if (yychar == YYEOF) |
| 7169 | YYABORT; |
| 7170 | } |
| 7171 | else |
| 7172 | { |
| 7173 | yydestruct ("Error: discarding", |
| 7174 | yytoken, &yylval); |
| 7175 | yychar = YYEMPTY; |
| 7176 | } |
| 7177 | } |
| 7178 | |
| 7179 | /* Else will try to reuse look-ahead token after shifting the error |
| 7180 | token. */ |
| 7181 | goto yyerrlab1; |
| 7182 | |
| 7183 | |
| 7184 | /*---------------------------------------------------. |
| 7185 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 7186 | `---------------------------------------------------*/ |
| 7187 | yyerrorlab: |
| 7188 | |
| 7189 | /* Pacify compilers like GCC when the user code never invokes |
| 7190 | YYERROR and the label yyerrorlab therefore never appears in user |
| 7191 | code. */ |
| 7192 | if (/*CONSTCOND*/ 0) |
| 7193 | goto yyerrorlab; |
| 7194 | |
| 7195 | /* Do not reclaim the symbols of the rule which action triggered |
| 7196 | this YYERROR. */ |
| 7197 | YYPOPSTACK (yylen); |
| 7198 | yylen = 0; |
| 7199 | YY_STACK_PRINT (yyss, yyssp); |
| 7200 | yystate = *yyssp; |
| 7201 | goto yyerrlab1; |
| 7202 | |
| 7203 | |
| 7204 | /*-------------------------------------------------------------. |
| 7205 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 7206 | `-------------------------------------------------------------*/ |
| 7207 | yyerrlab1: |
| 7208 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 7209 | |
| 7210 | for (;;) |
| 7211 | { |
| 7212 | yyn = yypact[yystate]; |
| 7213 | if (yyn != YYPACT_NINF) |
| 7214 | { |
| 7215 | yyn += YYTERROR; |
| 7216 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 7217 | { |
| 7218 | yyn = yytable[yyn]; |
| 7219 | if (0 < yyn) |
| 7220 | break; |
| 7221 | } |
| 7222 | } |
| 7223 | |
| 7224 | /* Pop the current state because it cannot handle the error token. */ |
| 7225 | if (yyssp == yyss) |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7226 | YYABORT; |
| 7227 | |
Dale Johannesen | cdd509a | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 7228 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7229 | yydestruct ("Error: popping", |
| 7230 | yystos[yystate], yyvsp); |
| 7231 | YYPOPSTACK (1); |
| 7232 | yystate = *yyssp; |
| 7233 | YY_STACK_PRINT (yyss, yyssp); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7234 | } |
| 7235 | |
| 7236 | if (yyn == YYFINAL) |
| 7237 | YYACCEPT; |
| 7238 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7239 | *++yyvsp = yylval; |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7240 | |
| 7241 | |
| 7242 | /* Shift the error token. */ |
| 7243 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | b8f8505 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 7244 | |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7245 | yystate = yyn; |
| 7246 | goto yynewstate; |
| 7247 | |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 7248 | |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7249 | /*-------------------------------------. |
| 7250 | | yyacceptlab -- YYACCEPT comes here. | |
| 7251 | `-------------------------------------*/ |
| 7252 | yyacceptlab: |
| 7253 | yyresult = 0; |
| 7254 | goto yyreturn; |
| 7255 | |
| 7256 | /*-----------------------------------. |
| 7257 | | yyabortlab -- YYABORT comes here. | |
| 7258 | `-----------------------------------*/ |
| 7259 | yyabortlab: |
| 7260 | yyresult = 1; |
| 7261 | goto yyreturn; |
| 7262 | |
| 7263 | #ifndef yyoverflow |
| 7264 | /*-------------------------------------------------. |
| 7265 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 7266 | `-------------------------------------------------*/ |
| 7267 | yyexhaustedlab: |
| 7268 | yyerror (YY_("memory exhausted")); |
| 7269 | yyresult = 2; |
| 7270 | /* Fall through. */ |
Chris Lattner | 3890561 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 7271 | #endif |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7272 | |
| 7273 | yyreturn: |
| 7274 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 7275 | yydestruct ("Cleanup: discarding lookahead", |
| 7276 | yytoken, &yylval); |
| 7277 | /* Do not reclaim the symbols of the rule which action triggered |
| 7278 | this YYABORT or YYACCEPT. */ |
| 7279 | YYPOPSTACK (yylen); |
| 7280 | YY_STACK_PRINT (yyss, yyssp); |
| 7281 | while (yyssp != yyss) |
| 7282 | { |
| 7283 | yydestruct ("Cleanup: popping", |
| 7284 | yystos[*yyssp], yyvsp); |
| 7285 | YYPOPSTACK (1); |
Gabor Greif | e64d248 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 7286 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7287 | #ifndef yyoverflow |
| 7288 | if (yyss != yyssa) |
| 7289 | YYSTACK_FREE (yyss); |
| 7290 | #endif |
| 7291 | #if YYERROR_VERBOSE |
| 7292 | if (yymsg != yymsgbuf) |
| 7293 | YYSTACK_FREE (yymsg); |
| 7294 | #endif |
| 7295 | /* Make sure YYID is used. */ |
| 7296 | return YYID (yyresult); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7297 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7298 | |
| 7299 | |
Nick Lewycky | d802be3 | 2008-12-19 09:41:54 +0000 | [diff] [blame^] | 7300 | #line 3563 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y" |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7301 | |
| 7302 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7303 | // common code from the two 'RunVMAsmParser' functions |
| 7304 | static Module* RunParser(Module * M) { |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7305 | CurModule.CurrentModule = M; |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7306 | // Check to make sure the parser succeeded |
| 7307 | if (yyparse()) { |
| 7308 | if (ParserResult) |
| 7309 | delete ParserResult; |
| 7310 | return 0; |
| 7311 | } |
| 7312 | |
Reid Spencer | 0d60b5a | 2007-03-30 01:37:39 +0000 | [diff] [blame] | 7313 | // Emit an error if there are any unresolved types left. |
| 7314 | if (!CurModule.LateResolveTypes.empty()) { |
| 7315 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 7316 | if (DID.Type == ValID::LocalName) { |
| 7317 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 7318 | } else { |
| 7319 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 7320 | } |
| 7321 | if (ParserResult) |
| 7322 | delete ParserResult; |
| 7323 | return 0; |
| 7324 | } |
| 7325 | |
| 7326 | // Emit an error if there are any unresolved values left. |
| 7327 | if (!CurModule.LateResolveValues.empty()) { |
| 7328 | Value *V = CurModule.LateResolveValues.back(); |
| 7329 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 7330 | CurModule.PlaceHolderInfo.find(V); |
| 7331 | |
| 7332 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 7333 | ValID &DID = I->second.first; |
| 7334 | if (DID.Type == ValID::LocalName) { |
| 7335 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 7336 | } else { |
| 7337 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 7338 | } |
| 7339 | if (ParserResult) |
| 7340 | delete ParserResult; |
| 7341 | return 0; |
| 7342 | } |
| 7343 | } |
| 7344 | |
Reid Spencer | 1431061 | 2006-12-31 05:40:51 +0000 | [diff] [blame] | 7345 | // Check to make sure that parsing produced a result |
| 7346 | if (!ParserResult) |
| 7347 | return 0; |
| 7348 | |
| 7349 | // Reset ParserResult variable while saving its value for the result. |
| 7350 | Module *Result = ParserResult; |
| 7351 | ParserResult = 0; |
| 7352 | |
| 7353 | return Result; |
| 7354 | } |
| 7355 | |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7356 | void llvm::GenerateError(const std::string &message, int LineNo) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7357 | if (LineNo == -1) LineNo = LLLgetLineNo(); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7358 | // TODO: column number in exception |
| 7359 | if (TheParseError) |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7360 | TheParseError->setError(LLLgetFilename(), message, LineNo); |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7361 | TriggerError = 1; |
| 7362 | } |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7363 | |
| 7364 | int yyerror(const char *ErrorMsg) { |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7365 | std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; |
Reid Spencer | ef9b9a7 | 2007-02-05 20:47:22 +0000 | [diff] [blame] | 7366 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7367 | if (yychar != YYEMPTY && yychar != 0) { |
| 7368 | errMsg += " while reading token: '"; |
Eric Christopher | 2a5196f | 2008-09-24 04:55:49 +0000 | [diff] [blame] | 7369 | errMsg += std::string(LLLgetTokenStart(), |
Duncan Sands | dc02467 | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 7370 | LLLgetTokenStart()+LLLgetTokenLength()) + "'"; |
| 7371 | } |
Reid Spencer | 61c83e0 | 2006-08-18 08:43:06 +0000 | [diff] [blame] | 7372 | GenerateError(errMsg); |
Reid Spencer | 68a24bd | 2005-08-27 18:50:39 +0000 | [diff] [blame] | 7373 | return 0; |
| 7374 | } |
Dan Gohman | f4423b1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 7375 | |