Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1 | /* A Bison parser, made by GNU Bison 2.3. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4 | |
Dan Gohman | 54392c1 | 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. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | |
Dan Gohman | 54392c1 | 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. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 62 | #define yyparse llvmAsmparse |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 63 | #define yylex llvmAsmlex |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 64 | #define yyerror llvmAsmerror |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 65 | #define yylval llvmAsmlval |
| 66 | #define yychar llvmAsmchar |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 67 | #define yydebug llvmAsmdebug |
| 68 | #define yynerrs llvmAsmnerrs |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 69 | |
Dan Gohman | 54392c1 | 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, |
| 123 | OPAQUE = 304, |
| 124 | EXTERNAL = 305, |
| 125 | TARGET = 306, |
| 126 | TRIPLE = 307, |
| 127 | ALIGN = 308, |
| 128 | ADDRSPACE = 309, |
| 129 | DEPLIBS = 310, |
| 130 | CALL = 311, |
| 131 | TAIL = 312, |
| 132 | ASM_TOK = 313, |
| 133 | MODULE = 314, |
| 134 | SIDEEFFECT = 315, |
| 135 | CC_TOK = 316, |
| 136 | CCC_TOK = 317, |
| 137 | FASTCC_TOK = 318, |
| 138 | COLDCC_TOK = 319, |
| 139 | X86_STDCALLCC_TOK = 320, |
| 140 | X86_FASTCALLCC_TOK = 321, |
| 141 | DATALAYOUT = 322, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 142 | RET = 323, |
| 143 | BR = 324, |
| 144 | SWITCH = 325, |
| 145 | INVOKE = 326, |
| 146 | UNWIND = 327, |
| 147 | UNREACHABLE = 328, |
| 148 | ADD = 329, |
| 149 | SUB = 330, |
| 150 | MUL = 331, |
| 151 | UDIV = 332, |
| 152 | SDIV = 333, |
| 153 | FDIV = 334, |
| 154 | UREM = 335, |
| 155 | SREM = 336, |
| 156 | FREM = 337, |
| 157 | AND = 338, |
| 158 | OR = 339, |
| 159 | XOR = 340, |
| 160 | SHL = 341, |
| 161 | LSHR = 342, |
| 162 | ASHR = 343, |
| 163 | ICMP = 344, |
| 164 | FCMP = 345, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 165 | VICMP = 346, |
| 166 | VFCMP = 347, |
| 167 | EQ = 348, |
| 168 | NE = 349, |
| 169 | SLT = 350, |
| 170 | SGT = 351, |
| 171 | SLE = 352, |
| 172 | SGE = 353, |
| 173 | ULT = 354, |
| 174 | UGT = 355, |
| 175 | ULE = 356, |
| 176 | UGE = 357, |
| 177 | OEQ = 358, |
| 178 | ONE = 359, |
| 179 | OLT = 360, |
| 180 | OGT = 361, |
| 181 | OLE = 362, |
| 182 | OGE = 363, |
| 183 | ORD = 364, |
| 184 | UNO = 365, |
| 185 | UEQ = 366, |
| 186 | UNE = 367, |
| 187 | MALLOC = 368, |
| 188 | ALLOCA = 369, |
| 189 | FREE = 370, |
| 190 | LOAD = 371, |
| 191 | STORE = 372, |
| 192 | GETELEMENTPTR = 373, |
| 193 | TRUNC = 374, |
| 194 | ZEXT = 375, |
| 195 | SEXT = 376, |
| 196 | FPTRUNC = 377, |
| 197 | FPEXT = 378, |
| 198 | BITCAST = 379, |
| 199 | UITOFP = 380, |
| 200 | SITOFP = 381, |
| 201 | FPTOUI = 382, |
| 202 | FPTOSI = 383, |
| 203 | INTTOPTR = 384, |
| 204 | PTRTOINT = 385, |
| 205 | PHI_TOK = 386, |
| 206 | SELECT = 387, |
| 207 | VAARG = 388, |
| 208 | EXTRACTELEMENT = 389, |
| 209 | INSERTELEMENT = 390, |
| 210 | SHUFFLEVECTOR = 391, |
| 211 | GETRESULT = 392, |
| 212 | SIGNEXT = 393, |
| 213 | ZEROEXT = 394, |
| 214 | NORETURN = 395, |
| 215 | INREG = 396, |
| 216 | SRET = 397, |
| 217 | NOUNWIND = 398, |
| 218 | NOALIAS = 399, |
| 219 | BYVAL = 400, |
| 220 | NEST = 401, |
| 221 | READNONE = 402, |
| 222 | READONLY = 403, |
| 223 | GC = 404, |
| 224 | DEFAULT = 405, |
| 225 | HIDDEN = 406, |
| 226 | PROTECTED = 407 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 227 | }; |
| 228 | #endif |
| 229 | /* Tokens. */ |
| 230 | #define ESINT64VAL 258 |
| 231 | #define EUINT64VAL 259 |
| 232 | #define ESAPINTVAL 260 |
| 233 | #define EUAPINTVAL 261 |
| 234 | #define LOCALVAL_ID 262 |
| 235 | #define GLOBALVAL_ID 263 |
| 236 | #define FPVAL 264 |
| 237 | #define VOID 265 |
| 238 | #define INTTYPE 266 |
| 239 | #define FLOAT 267 |
| 240 | #define DOUBLE 268 |
| 241 | #define X86_FP80 269 |
| 242 | #define FP128 270 |
| 243 | #define PPC_FP128 271 |
| 244 | #define LABEL 272 |
| 245 | #define TYPE 273 |
| 246 | #define LOCALVAR 274 |
| 247 | #define GLOBALVAR 275 |
| 248 | #define LABELSTR 276 |
| 249 | #define STRINGCONSTANT 277 |
| 250 | #define ATSTRINGCONSTANT 278 |
| 251 | #define PCTSTRINGCONSTANT 279 |
| 252 | #define ZEROINITIALIZER 280 |
| 253 | #define TRUETOK 281 |
| 254 | #define FALSETOK 282 |
| 255 | #define BEGINTOK 283 |
| 256 | #define ENDTOK 284 |
| 257 | #define DECLARE 285 |
| 258 | #define DEFINE 286 |
| 259 | #define GLOBAL 287 |
| 260 | #define CONSTANT 288 |
| 261 | #define SECTION 289 |
| 262 | #define ALIAS 290 |
| 263 | #define VOLATILE 291 |
| 264 | #define THREAD_LOCAL 292 |
| 265 | #define TO 293 |
| 266 | #define DOTDOTDOT 294 |
| 267 | #define NULL_TOK 295 |
| 268 | #define UNDEF 296 |
| 269 | #define INTERNAL 297 |
| 270 | #define LINKONCE 298 |
| 271 | #define WEAK 299 |
| 272 | #define APPENDING 300 |
| 273 | #define DLLIMPORT 301 |
| 274 | #define DLLEXPORT 302 |
| 275 | #define EXTERN_WEAK 303 |
| 276 | #define OPAQUE 304 |
| 277 | #define EXTERNAL 305 |
| 278 | #define TARGET 306 |
| 279 | #define TRIPLE 307 |
| 280 | #define ALIGN 308 |
| 281 | #define ADDRSPACE 309 |
| 282 | #define DEPLIBS 310 |
| 283 | #define CALL 311 |
| 284 | #define TAIL 312 |
| 285 | #define ASM_TOK 313 |
| 286 | #define MODULE 314 |
| 287 | #define SIDEEFFECT 315 |
| 288 | #define CC_TOK 316 |
| 289 | #define CCC_TOK 317 |
| 290 | #define FASTCC_TOK 318 |
| 291 | #define COLDCC_TOK 319 |
| 292 | #define X86_STDCALLCC_TOK 320 |
| 293 | #define X86_FASTCALLCC_TOK 321 |
| 294 | #define DATALAYOUT 322 |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 295 | #define RET 323 |
| 296 | #define BR 324 |
| 297 | #define SWITCH 325 |
| 298 | #define INVOKE 326 |
| 299 | #define UNWIND 327 |
| 300 | #define UNREACHABLE 328 |
| 301 | #define ADD 329 |
| 302 | #define SUB 330 |
| 303 | #define MUL 331 |
| 304 | #define UDIV 332 |
| 305 | #define SDIV 333 |
| 306 | #define FDIV 334 |
| 307 | #define UREM 335 |
| 308 | #define SREM 336 |
| 309 | #define FREM 337 |
| 310 | #define AND 338 |
| 311 | #define OR 339 |
| 312 | #define XOR 340 |
| 313 | #define SHL 341 |
| 314 | #define LSHR 342 |
| 315 | #define ASHR 343 |
| 316 | #define ICMP 344 |
| 317 | #define FCMP 345 |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 318 | #define VICMP 346 |
| 319 | #define VFCMP 347 |
| 320 | #define EQ 348 |
| 321 | #define NE 349 |
| 322 | #define SLT 350 |
| 323 | #define SGT 351 |
| 324 | #define SLE 352 |
| 325 | #define SGE 353 |
| 326 | #define ULT 354 |
| 327 | #define UGT 355 |
| 328 | #define ULE 356 |
| 329 | #define UGE 357 |
| 330 | #define OEQ 358 |
| 331 | #define ONE 359 |
| 332 | #define OLT 360 |
| 333 | #define OGT 361 |
| 334 | #define OLE 362 |
| 335 | #define OGE 363 |
| 336 | #define ORD 364 |
| 337 | #define UNO 365 |
| 338 | #define UEQ 366 |
| 339 | #define UNE 367 |
| 340 | #define MALLOC 368 |
| 341 | #define ALLOCA 369 |
| 342 | #define FREE 370 |
| 343 | #define LOAD 371 |
| 344 | #define STORE 372 |
| 345 | #define GETELEMENTPTR 373 |
| 346 | #define TRUNC 374 |
| 347 | #define ZEXT 375 |
| 348 | #define SEXT 376 |
| 349 | #define FPTRUNC 377 |
| 350 | #define FPEXT 378 |
| 351 | #define BITCAST 379 |
| 352 | #define UITOFP 380 |
| 353 | #define SITOFP 381 |
| 354 | #define FPTOUI 382 |
| 355 | #define FPTOSI 383 |
| 356 | #define INTTOPTR 384 |
| 357 | #define PTRTOINT 385 |
| 358 | #define PHI_TOK 386 |
| 359 | #define SELECT 387 |
| 360 | #define VAARG 388 |
| 361 | #define EXTRACTELEMENT 389 |
| 362 | #define INSERTELEMENT 390 |
| 363 | #define SHUFFLEVECTOR 391 |
| 364 | #define GETRESULT 392 |
| 365 | #define SIGNEXT 393 |
| 366 | #define ZEROEXT 394 |
| 367 | #define NORETURN 395 |
| 368 | #define INREG 396 |
| 369 | #define SRET 397 |
| 370 | #define NOUNWIND 398 |
| 371 | #define NOALIAS 399 |
| 372 | #define BYVAL 400 |
| 373 | #define NEST 401 |
| 374 | #define READNONE 402 |
| 375 | #define READONLY 403 |
| 376 | #define GC 404 |
| 377 | #define DEFAULT 405 |
| 378 | #define HIDDEN 406 |
| 379 | #define PROTECTED 407 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | /* Copy the first part of user declarations. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 385 | #line 14 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 386 | |
| 387 | #include "ParserInternals.h" |
| 388 | #include "llvm/CallingConv.h" |
| 389 | #include "llvm/InlineAsm.h" |
| 390 | #include "llvm/Instructions.h" |
| 391 | #include "llvm/Module.h" |
| 392 | #include "llvm/ValueSymbolTable.h" |
Chandler Carruth | 563d4a4 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 393 | #include "llvm/AutoUpgrade.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 394 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
| 395 | #include "llvm/Support/CommandLine.h" |
| 396 | #include "llvm/ADT/SmallVector.h" |
| 397 | #include "llvm/ADT/STLExtras.h" |
| 398 | #include "llvm/Support/MathExtras.h" |
| 399 | #include "llvm/Support/Streams.h" |
| 400 | #include <algorithm> |
| 401 | #include <list> |
| 402 | #include <map> |
| 403 | #include <utility> |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 404 | |
| 405 | // The following is a gross hack. In order to rid the libAsmParser library of |
| 406 | // exceptions, we have to have a way of getting the yyparse function to go into |
| 407 | // an error situation. So, whenever we want an error to occur, the GenerateError |
| 408 | // function (see bottom of file) sets TriggerError. Then, at the end of each |
| 409 | // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR |
| 410 | // (a goto) to put YACC in error state. Furthermore, several calls to |
| 411 | // GenerateError are made from inside productions and they must simulate the |
| 412 | // previous exception behavior by exiting the production immediately. We have |
| 413 | // replaced these with the GEN_ERROR macro which calls GeneratError and then |
| 414 | // immediately invokes YYERROR. This would be so much cleaner if it was a |
| 415 | // recursive descent parser. |
| 416 | static bool TriggerError = false; |
| 417 | #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } |
| 418 | #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } |
| 419 | |
| 420 | int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit |
| 421 | int yylex(); // declaration" of xxx warnings. |
| 422 | int yyparse(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 423 | using namespace llvm; |
| 424 | |
| 425 | static Module *ParserResult; |
| 426 | |
| 427 | // DEBUG_UPREFS - Define this symbol if you want to enable debugging output |
| 428 | // relating to upreferences in the input stream. |
| 429 | // |
| 430 | //#define DEBUG_UPREFS 1 |
| 431 | #ifdef DEBUG_UPREFS |
| 432 | #define UR_OUT(X) cerr << X |
| 433 | #else |
| 434 | #define UR_OUT(X) |
| 435 | #endif |
| 436 | |
| 437 | #define YYERROR_VERBOSE 1 |
| 438 | |
| 439 | static GlobalVariable *CurGV; |
| 440 | |
| 441 | |
| 442 | // This contains info used when building the body of a function. It is |
| 443 | // destroyed when the function is completed. |
| 444 | // |
| 445 | typedef std::vector<Value *> ValueList; // Numbered defs |
| 446 | |
| 447 | static void |
| 448 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0); |
| 449 | |
| 450 | static struct PerModuleInfo { |
| 451 | Module *CurrentModule; |
| 452 | ValueList Values; // Module level numbered definitions |
| 453 | ValueList LateResolveValues; |
| 454 | std::vector<PATypeHolder> Types; |
| 455 | std::map<ValID, PATypeHolder> LateResolveTypes; |
| 456 | |
| 457 | /// PlaceHolderInfo - When temporary placeholder objects are created, remember |
| 458 | /// how they were referenced and on which line of the input they came from so |
| 459 | /// that we can resolve them later and print error messages as appropriate. |
| 460 | std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo; |
| 461 | |
| 462 | // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward |
| 463 | // references to global values. Global values may be referenced before they |
| 464 | // are defined, and if so, the temporary object that they represent is held |
| 465 | // here. This is used for forward references of GlobalValues. |
| 466 | // |
| 467 | typedef std::map<std::pair<const PointerType *, |
| 468 | ValID>, GlobalValue*> GlobalRefsType; |
| 469 | GlobalRefsType GlobalRefs; |
| 470 | |
| 471 | void ModuleDone() { |
| 472 | // If we could not resolve some functions at function compilation time |
| 473 | // (calls to functions before they are defined), resolve them now... Types |
| 474 | // are resolved when the constant pool has been completely parsed. |
| 475 | // |
| 476 | ResolveDefinitions(LateResolveValues); |
| 477 | if (TriggerError) |
| 478 | return; |
| 479 | |
| 480 | // Check to make sure that all global value forward references have been |
| 481 | // resolved! |
| 482 | // |
| 483 | if (!GlobalRefs.empty()) { |
| 484 | std::string UndefinedReferences = "Unresolved global references exist:\n"; |
| 485 | |
| 486 | for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); |
| 487 | I != E; ++I) { |
| 488 | UndefinedReferences += " " + I->first.first->getDescription() + " " + |
| 489 | I->first.second.getName() + "\n"; |
| 490 | } |
| 491 | GenerateError(UndefinedReferences); |
| 492 | return; |
| 493 | } |
| 494 | |
Chandler Carruth | 563d4a4 | 2007-08-04 01:56:21 +0000 | [diff] [blame] | 495 | // Look for intrinsic functions and CallInst that need to be upgraded |
| 496 | for (Module::iterator FI = CurrentModule->begin(), |
| 497 | FE = CurrentModule->end(); FI != FE; ) |
| 498 | UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove |
| 499 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 500 | Values.clear(); // Clear out function local definitions |
| 501 | Types.clear(); |
| 502 | CurrentModule = 0; |
| 503 | } |
| 504 | |
| 505 | // GetForwardRefForGlobal - Check to see if there is a forward reference |
| 506 | // for this global. If so, remove it from the GlobalRefs map and return it. |
| 507 | // If not, just return null. |
| 508 | GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { |
| 509 | // Check to see if there is a forward reference to this global variable... |
| 510 | // if there is, eliminate it and patch the reference to use the new def'n. |
| 511 | GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); |
| 512 | GlobalValue *Ret = 0; |
| 513 | if (I != GlobalRefs.end()) { |
| 514 | Ret = I->second; |
| 515 | GlobalRefs.erase(I); |
| 516 | } |
| 517 | return Ret; |
| 518 | } |
| 519 | |
| 520 | bool TypeIsUnresolved(PATypeHolder* PATy) { |
| 521 | // If it isn't abstract, its resolved |
| 522 | const Type* Ty = PATy->get(); |
| 523 | if (!Ty->isAbstract()) |
| 524 | return false; |
| 525 | // Traverse the type looking for abstract types. If it isn't abstract then |
| 526 | // we don't need to traverse that leg of the type. |
| 527 | std::vector<const Type*> WorkList, SeenList; |
| 528 | WorkList.push_back(Ty); |
| 529 | while (!WorkList.empty()) { |
| 530 | const Type* Ty = WorkList.back(); |
| 531 | SeenList.push_back(Ty); |
| 532 | WorkList.pop_back(); |
| 533 | if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) { |
| 534 | // Check to see if this is an unresolved type |
| 535 | std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin(); |
| 536 | std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end(); |
| 537 | for ( ; I != E; ++I) { |
| 538 | if (I->second.get() == OpTy) |
| 539 | return true; |
| 540 | } |
| 541 | } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) { |
| 542 | const Type* TheTy = SeqTy->getElementType(); |
| 543 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 544 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 545 | E = SeenList.end(); |
| 546 | for ( ; I != E; ++I) |
| 547 | if (*I == TheTy) |
| 548 | break; |
| 549 | if (I == E) |
| 550 | WorkList.push_back(TheTy); |
| 551 | } |
| 552 | } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) { |
| 553 | for (unsigned i = 0; i < StrTy->getNumElements(); ++i) { |
| 554 | const Type* TheTy = StrTy->getElementType(i); |
| 555 | if (TheTy->isAbstract() && TheTy != Ty) { |
| 556 | std::vector<const Type*>::iterator I = SeenList.begin(), |
| 557 | E = SeenList.end(); |
| 558 | for ( ; I != E; ++I) |
| 559 | if (*I == TheTy) |
| 560 | break; |
| 561 | if (I == E) |
| 562 | WorkList.push_back(TheTy); |
| 563 | } |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | return false; |
| 568 | } |
| 569 | } CurModule; |
| 570 | |
| 571 | static struct PerFunctionInfo { |
| 572 | Function *CurrentFunction; // Pointer to current function being created |
| 573 | |
| 574 | ValueList Values; // Keep track of #'d definitions |
| 575 | unsigned NextValNum; |
| 576 | ValueList LateResolveValues; |
| 577 | bool isDeclare; // Is this function a forward declararation? |
| 578 | GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. |
| 579 | GlobalValue::VisibilityTypes Visibility; |
| 580 | |
| 581 | /// BBForwardRefs - When we see forward references to basic blocks, keep |
| 582 | /// track of them here. |
| 583 | std::map<ValID, BasicBlock*> BBForwardRefs; |
| 584 | |
| 585 | inline PerFunctionInfo() { |
| 586 | CurrentFunction = 0; |
| 587 | isDeclare = false; |
| 588 | Linkage = GlobalValue::ExternalLinkage; |
| 589 | Visibility = GlobalValue::DefaultVisibility; |
| 590 | } |
| 591 | |
| 592 | inline void FunctionStart(Function *M) { |
| 593 | CurrentFunction = M; |
| 594 | NextValNum = 0; |
| 595 | } |
| 596 | |
| 597 | void FunctionDone() { |
| 598 | // Any forward referenced blocks left? |
| 599 | if (!BBForwardRefs.empty()) { |
| 600 | GenerateError("Undefined reference to label " + |
| 601 | BBForwardRefs.begin()->second->getName()); |
| 602 | return; |
| 603 | } |
| 604 | |
| 605 | // Resolve all forward references now. |
| 606 | ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); |
| 607 | |
| 608 | Values.clear(); // Clear out function local definitions |
| 609 | BBForwardRefs.clear(); |
| 610 | CurrentFunction = 0; |
| 611 | isDeclare = false; |
| 612 | Linkage = GlobalValue::ExternalLinkage; |
| 613 | Visibility = GlobalValue::DefaultVisibility; |
| 614 | } |
| 615 | } CurFun; // Info for the current function... |
| 616 | |
| 617 | static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } |
| 618 | |
| 619 | |
| 620 | //===----------------------------------------------------------------------===// |
| 621 | // Code to handle definitions of all the types |
| 622 | //===----------------------------------------------------------------------===// |
| 623 | |
| 624 | static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) { |
| 625 | // Things that have names or are void typed don't get slot numbers |
| 626 | if (V->hasName() || (V->getType() == Type::VoidTy)) |
| 627 | return; |
| 628 | |
| 629 | // In the case of function values, we have to allow for the forward reference |
| 630 | // of basic blocks, which are included in the numbering. Consequently, we keep |
| 631 | // track of the next insertion location with NextValNum. When a BB gets |
| 632 | // inserted, it could change the size of the CurFun.Values vector. |
| 633 | if (&ValueTab == &CurFun.Values) { |
| 634 | if (ValueTab.size() <= CurFun.NextValNum) |
| 635 | ValueTab.resize(CurFun.NextValNum+1); |
| 636 | ValueTab[CurFun.NextValNum++] = V; |
| 637 | return; |
| 638 | } |
| 639 | // For all other lists, its okay to just tack it on the back of the vector. |
| 640 | ValueTab.push_back(V); |
| 641 | } |
| 642 | |
| 643 | static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { |
| 644 | switch (D.Type) { |
| 645 | case ValID::LocalID: // Is it a numbered definition? |
| 646 | // Module constants occupy the lowest numbered slots... |
| 647 | if (D.Num < CurModule.Types.size()) |
| 648 | return CurModule.Types[D.Num]; |
| 649 | break; |
| 650 | case ValID::LocalName: // Is it a named definition? |
| 651 | if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) { |
| 652 | D.destroy(); // Free old strdup'd memory... |
| 653 | return N; |
| 654 | } |
| 655 | break; |
| 656 | default: |
| 657 | GenerateError("Internal parser error: Invalid symbol type reference"); |
| 658 | return 0; |
| 659 | } |
| 660 | |
| 661 | // If we reached here, we referenced either a symbol that we don't know about |
| 662 | // or an id number that hasn't been read yet. We may be referencing something |
| 663 | // forward, so just create an entry to be resolved later and get to it... |
| 664 | // |
| 665 | if (DoNotImprovise) return 0; // Do we just want a null to be returned? |
| 666 | |
| 667 | |
| 668 | if (inFunctionScope()) { |
| 669 | if (D.Type == ValID::LocalName) { |
| 670 | GenerateError("Reference to an undefined type: '" + D.getName() + "'"); |
| 671 | return 0; |
| 672 | } else { |
| 673 | GenerateError("Reference to an undefined type: #" + utostr(D.Num)); |
| 674 | return 0; |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); |
| 679 | if (I != CurModule.LateResolveTypes.end()) |
| 680 | return I->second; |
| 681 | |
| 682 | Type *Typ = OpaqueType::get(); |
| 683 | CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); |
| 684 | return Typ; |
| 685 | } |
| 686 | |
| 687 | // getExistingVal - Look up the value specified by the provided type and |
| 688 | // the provided ValID. If the value exists and has already been defined, return |
| 689 | // it. Otherwise return null. |
| 690 | // |
| 691 | static Value *getExistingVal(const Type *Ty, const ValID &D) { |
| 692 | if (isa<FunctionType>(Ty)) { |
| 693 | GenerateError("Functions are not values and " |
| 694 | "must be referenced as pointers"); |
| 695 | return 0; |
| 696 | } |
| 697 | |
| 698 | switch (D.Type) { |
| 699 | case ValID::LocalID: { // Is it a numbered definition? |
| 700 | // Check that the number is within bounds. |
| 701 | if (D.Num >= CurFun.Values.size()) |
| 702 | return 0; |
| 703 | Value *Result = CurFun.Values[D.Num]; |
| 704 | if (Ty != Result->getType()) { |
| 705 | GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" + |
| 706 | Result->getType()->getDescription() + "' does not match " |
| 707 | "expected type, '" + Ty->getDescription() + "'"); |
| 708 | return 0; |
| 709 | } |
| 710 | return Result; |
| 711 | } |
| 712 | case ValID::GlobalID: { // Is it a numbered definition? |
| 713 | if (D.Num >= CurModule.Values.size()) |
| 714 | return 0; |
| 715 | Value *Result = CurModule.Values[D.Num]; |
| 716 | if (Ty != Result->getType()) { |
| 717 | GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" + |
| 718 | Result->getType()->getDescription() + "' does not match " |
| 719 | "expected type, '" + Ty->getDescription() + "'"); |
| 720 | return 0; |
| 721 | } |
| 722 | return Result; |
| 723 | } |
| 724 | |
| 725 | case ValID::LocalName: { // Is it a named definition? |
| 726 | if (!inFunctionScope()) |
| 727 | return 0; |
| 728 | ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable(); |
| 729 | Value *N = SymTab.lookup(D.getName()); |
| 730 | if (N == 0) |
| 731 | return 0; |
| 732 | if (N->getType() != Ty) |
| 733 | return 0; |
| 734 | |
| 735 | D.destroy(); // Free old strdup'd memory... |
| 736 | return N; |
| 737 | } |
| 738 | case ValID::GlobalName: { // Is it a named definition? |
| 739 | ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable(); |
| 740 | Value *N = SymTab.lookup(D.getName()); |
| 741 | if (N == 0) |
| 742 | return 0; |
| 743 | if (N->getType() != Ty) |
| 744 | return 0; |
| 745 | |
| 746 | D.destroy(); // Free old strdup'd memory... |
| 747 | return N; |
| 748 | } |
| 749 | |
| 750 | // Check to make sure that "Ty" is an integral type, and that our |
| 751 | // value will fit into the specified type... |
| 752 | case ValID::ConstSIntVal: // Is it a constant pool reference?? |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 753 | if (!isa<IntegerType>(Ty) || |
| 754 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 755 | GenerateError("Signed integral constant '" + |
| 756 | itostr(D.ConstPool64) + "' is invalid for type '" + |
| 757 | Ty->getDescription() + "'"); |
| 758 | return 0; |
| 759 | } |
| 760 | return ConstantInt::get(Ty, D.ConstPool64, true); |
| 761 | |
| 762 | case ValID::ConstUIntVal: // Is it an unsigned const pool reference? |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 763 | if (isa<IntegerType>(Ty) && |
| 764 | ConstantInt::isValueValidForType(Ty, D.UConstPool64)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 765 | return ConstantInt::get(Ty, D.UConstPool64); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 766 | |
| 767 | if (!isa<IntegerType>(Ty) || |
| 768 | !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { |
| 769 | GenerateError("Integral constant '" + utostr(D.UConstPool64) + |
| 770 | "' is invalid or out of range for type '" + |
| 771 | Ty->getDescription() + "'"); |
| 772 | return 0; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 773 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 774 | // This is really a signed reference. Transmogrify. |
| 775 | return ConstantInt::get(Ty, D.ConstPool64, true); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 776 | |
| 777 | case ValID::ConstFPVal: // Is it a floating point const pool reference? |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 778 | if (!Ty->isFloatingPoint() || |
| 779 | !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 780 | GenerateError("FP constant invalid for type"); |
| 781 | return 0; |
| 782 | } |
Chris Lattner | 05ba86e | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 783 | // Lexer has no type info, so builds all float and double FP constants |
Dale Johannesen | 255b8fe | 2007-09-11 18:33:39 +0000 | [diff] [blame] | 784 | // as double. Fix this here. Long double does not need this. |
| 785 | if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && |
| 786 | Ty==Type::FloatTy) |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 787 | D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
Chris Lattner | 05ba86e | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 788 | return ConstantFP::get(*D.ConstPoolFP); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 789 | |
| 790 | case ValID::ConstNullVal: // Is it a null value? |
| 791 | if (!isa<PointerType>(Ty)) { |
| 792 | GenerateError("Cannot create a a non pointer null"); |
| 793 | return 0; |
| 794 | } |
| 795 | return ConstantPointerNull::get(cast<PointerType>(Ty)); |
| 796 | |
| 797 | case ValID::ConstUndefVal: // Is it an undef value? |
| 798 | return UndefValue::get(Ty); |
| 799 | |
| 800 | case ValID::ConstZeroVal: // Is it a zero value? |
| 801 | return Constant::getNullValue(Ty); |
| 802 | |
| 803 | case ValID::ConstantVal: // Fully resolved constant? |
| 804 | if (D.ConstantValue->getType() != Ty) { |
| 805 | GenerateError("Constant expression type different from required type"); |
| 806 | return 0; |
| 807 | } |
| 808 | return D.ConstantValue; |
| 809 | |
| 810 | case ValID::InlineAsmVal: { // Inline asm expression |
| 811 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 812 | const FunctionType *FTy = |
| 813 | PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; |
| 814 | if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { |
| 815 | GenerateError("Invalid type for asm constraint string"); |
| 816 | return 0; |
| 817 | } |
| 818 | InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, |
| 819 | D.IAD->HasSideEffects); |
| 820 | D.destroy(); // Free InlineAsmDescriptor. |
| 821 | return IA; |
| 822 | } |
| 823 | default: |
| 824 | assert(0 && "Unhandled case!"); |
| 825 | return 0; |
| 826 | } // End of switch |
| 827 | |
| 828 | assert(0 && "Unhandled case!"); |
| 829 | return 0; |
| 830 | } |
| 831 | |
| 832 | // getVal - This function is identical to getExistingVal, except that if a |
| 833 | // value is not already defined, it "improvises" by creating a placeholder var |
| 834 | // that looks and acts just like the requested variable. When the value is |
| 835 | // defined later, all uses of the placeholder variable are replaced with the |
| 836 | // real thing. |
| 837 | // |
| 838 | static Value *getVal(const Type *Ty, const ValID &ID) { |
| 839 | if (Ty == Type::LabelTy) { |
| 840 | GenerateError("Cannot use a basic block here"); |
| 841 | return 0; |
| 842 | } |
| 843 | |
| 844 | // See if the value has already been defined. |
| 845 | Value *V = getExistingVal(Ty, ID); |
| 846 | if (V) return V; |
| 847 | if (TriggerError) return 0; |
| 848 | |
| 849 | if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { |
| 850 | GenerateError("Invalid use of a composite type"); |
| 851 | return 0; |
| 852 | } |
| 853 | |
| 854 | // If we reached here, we referenced either a symbol that we don't know about |
| 855 | // or an id number that hasn't been read yet. We may be referencing something |
| 856 | // forward, so just create an entry to be resolved later and get to it... |
| 857 | // |
| 858 | switch (ID.Type) { |
| 859 | case ValID::GlobalName: |
| 860 | case ValID::GlobalID: { |
| 861 | const PointerType *PTy = dyn_cast<PointerType>(Ty); |
| 862 | if (!PTy) { |
| 863 | GenerateError("Invalid type for reference to global" ); |
| 864 | return 0; |
| 865 | } |
| 866 | const Type* ElTy = PTy->getElementType(); |
| 867 | if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy)) |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 868 | V = Function::Create(FTy, GlobalValue::ExternalLinkage); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 869 | else |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 870 | V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "", |
| 871 | (Module*)0, false, PTy->getAddressSpace()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 872 | break; |
| 873 | } |
| 874 | default: |
| 875 | V = new Argument(Ty); |
| 876 | } |
| 877 | |
| 878 | // Remember where this forward reference came from. FIXME, shouldn't we try |
| 879 | // to recycle these things?? |
| 880 | CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 881 | LLLgetLineNo()))); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 882 | |
| 883 | if (inFunctionScope()) |
| 884 | InsertValue(V, CurFun.LateResolveValues); |
| 885 | else |
| 886 | InsertValue(V, CurModule.LateResolveValues); |
| 887 | return V; |
| 888 | } |
| 889 | |
| 890 | /// defineBBVal - This is a definition of a new basic block with the specified |
| 891 | /// identifier which must be the same as CurFun.NextValNum, if its numeric. |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 892 | static BasicBlock *defineBBVal(const ValID &ID) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 893 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 894 | |
| 895 | BasicBlock *BB = 0; |
| 896 | |
| 897 | // First, see if this was forward referenced |
| 898 | |
| 899 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 900 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 901 | BB = BBI->second; |
| 902 | // The forward declaration could have been inserted anywhere in the |
| 903 | // function: insert it into the correct place now. |
| 904 | CurFun.CurrentFunction->getBasicBlockList().remove(BB); |
| 905 | CurFun.CurrentFunction->getBasicBlockList().push_back(BB); |
| 906 | |
| 907 | // We're about to erase the entry, save the key so we can clean it up. |
| 908 | ValID Tmp = BBI->first; |
| 909 | |
| 910 | // Erase the forward ref from the map as its no longer "forward" |
| 911 | CurFun.BBForwardRefs.erase(ID); |
| 912 | |
| 913 | // The key has been removed from the map but so we don't want to leave |
| 914 | // strdup'd memory around so destroy it too. |
| 915 | Tmp.destroy(); |
| 916 | |
| 917 | // If its a numbered definition, bump the number and set the BB value. |
| 918 | if (ID.Type == ValID::LocalID) { |
| 919 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 920 | InsertValue(BB); |
| 921 | } |
Devang Patel | 890cc57 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 922 | } else { |
| 923 | // We haven't seen this BB before and its first mention is a definition. |
| 924 | // Just create it and return it. |
| 925 | std::string Name (ID.Type == ValID::LocalName ? ID.getName() : ""); |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 926 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Devang Patel | 890cc57 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 927 | if (ID.Type == ValID::LocalID) { |
| 928 | assert(ID.Num == CurFun.NextValNum && "Invalid new block number"); |
| 929 | InsertValue(BB); |
| 930 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 931 | } |
| 932 | |
Devang Patel | 890cc57 | 2008-03-03 18:58:47 +0000 | [diff] [blame] | 933 | ID.destroy(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 934 | return BB; |
| 935 | } |
| 936 | |
| 937 | /// getBBVal - get an existing BB value or create a forward reference for it. |
| 938 | /// |
| 939 | static BasicBlock *getBBVal(const ValID &ID) { |
| 940 | assert(inFunctionScope() && "Can't get basic block at global scope!"); |
| 941 | |
| 942 | BasicBlock *BB = 0; |
| 943 | |
| 944 | std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID); |
| 945 | if (BBI != CurFun.BBForwardRefs.end()) { |
| 946 | BB = BBI->second; |
| 947 | } if (ID.Type == ValID::LocalName) { |
| 948 | std::string Name = ID.getName(); |
| 949 | Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name); |
Anton Korobeynikov | 21c1eeb | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 950 | if (N) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 951 | if (N->getType()->getTypeID() == Type::LabelTyID) |
| 952 | BB = cast<BasicBlock>(N); |
| 953 | else |
| 954 | GenerateError("Reference to label '" + Name + "' is actually of type '"+ |
| 955 | N->getType()->getDescription() + "'"); |
Anton Korobeynikov | 21c1eeb | 2008-02-20 12:10:37 +0000 | [diff] [blame] | 956 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 957 | } else if (ID.Type == ValID::LocalID) { |
| 958 | if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) { |
| 959 | if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID) |
| 960 | BB = cast<BasicBlock>(CurFun.Values[ID.Num]); |
| 961 | else |
| 962 | GenerateError("Reference to label '%" + utostr(ID.Num) + |
| 963 | "' is actually of type '"+ |
| 964 | CurFun.Values[ID.Num]->getType()->getDescription() + "'"); |
| 965 | } |
| 966 | } else { |
| 967 | GenerateError("Illegal label reference " + ID.getName()); |
| 968 | return 0; |
| 969 | } |
| 970 | |
| 971 | // If its already been defined, return it now. |
| 972 | if (BB) { |
| 973 | ID.destroy(); // Free strdup'd memory. |
| 974 | return BB; |
| 975 | } |
| 976 | |
| 977 | // Otherwise, this block has not been seen before, create it. |
| 978 | std::string Name; |
| 979 | if (ID.Type == ValID::LocalName) |
| 980 | Name = ID.getName(); |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 981 | BB = BasicBlock::Create(Name, CurFun.CurrentFunction); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 982 | |
| 983 | // Insert it in the forward refs map. |
| 984 | CurFun.BBForwardRefs[ID] = BB; |
| 985 | |
| 986 | return BB; |
| 987 | } |
| 988 | |
| 989 | |
| 990 | //===----------------------------------------------------------------------===// |
| 991 | // Code to handle forward references in instructions |
| 992 | //===----------------------------------------------------------------------===// |
| 993 | // |
| 994 | // This code handles the late binding needed with statements that reference |
| 995 | // values not defined yet... for example, a forward branch, or the PHI node for |
| 996 | // a loop body. |
| 997 | // |
| 998 | // This keeps a table (CurFun.LateResolveValues) of all such forward references |
| 999 | // and back patchs after we are done. |
| 1000 | // |
| 1001 | |
| 1002 | // ResolveDefinitions - If we could not resolve some defs at parsing |
| 1003 | // time (forward branches, phi functions for loops, etc...) resolve the |
| 1004 | // defs now... |
| 1005 | // |
| 1006 | static void |
| 1007 | ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) { |
| 1008 | // Loop over LateResolveDefs fixing up stuff that couldn't be resolved |
| 1009 | while (!LateResolvers.empty()) { |
| 1010 | Value *V = LateResolvers.back(); |
| 1011 | LateResolvers.pop_back(); |
| 1012 | |
| 1013 | std::map<Value*, std::pair<ValID, int> >::iterator PHI = |
| 1014 | CurModule.PlaceHolderInfo.find(V); |
| 1015 | assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); |
| 1016 | |
| 1017 | ValID &DID = PHI->second.first; |
| 1018 | |
| 1019 | Value *TheRealValue = getExistingVal(V->getType(), DID); |
| 1020 | if (TriggerError) |
| 1021 | return; |
| 1022 | if (TheRealValue) { |
| 1023 | V->replaceAllUsesWith(TheRealValue); |
| 1024 | delete V; |
| 1025 | CurModule.PlaceHolderInfo.erase(PHI); |
| 1026 | } else if (FutureLateResolvers) { |
| 1027 | // Functions have their unresolved items forwarded to the module late |
| 1028 | // resolver table |
| 1029 | InsertValue(V, *FutureLateResolvers); |
| 1030 | } else { |
| 1031 | if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) { |
| 1032 | GenerateError("Reference to an invalid definition: '" +DID.getName()+ |
| 1033 | "' of type '" + V->getType()->getDescription() + "'", |
| 1034 | PHI->second.second); |
| 1035 | return; |
| 1036 | } else { |
| 1037 | GenerateError("Reference to an invalid definition: #" + |
| 1038 | itostr(DID.Num) + " of type '" + |
| 1039 | V->getType()->getDescription() + "'", |
| 1040 | PHI->second.second); |
| 1041 | return; |
| 1042 | } |
| 1043 | } |
| 1044 | } |
| 1045 | LateResolvers.clear(); |
| 1046 | } |
| 1047 | |
| 1048 | // ResolveTypeTo - A brand new type was just declared. This means that (if |
| 1049 | // name is not null) things referencing Name can be resolved. Otherwise, things |
| 1050 | // refering to the number can be resolved. Do this now. |
| 1051 | // |
| 1052 | static void ResolveTypeTo(std::string *Name, const Type *ToTy) { |
| 1053 | ValID D; |
| 1054 | if (Name) |
| 1055 | D = ValID::createLocalName(*Name); |
| 1056 | else |
| 1057 | D = ValID::createLocalID(CurModule.Types.size()); |
| 1058 | |
| 1059 | std::map<ValID, PATypeHolder>::iterator I = |
| 1060 | CurModule.LateResolveTypes.find(D); |
| 1061 | if (I != CurModule.LateResolveTypes.end()) { |
| 1062 | ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); |
| 1063 | CurModule.LateResolveTypes.erase(I); |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | // setValueName - Set the specified value to the name given. The name may be |
| 1068 | // null potentially, in which case this is a noop. The string passed in is |
| 1069 | // assumed to be a malloc'd string buffer, and is free'd by this function. |
| 1070 | // |
| 1071 | static void setValueName(Value *V, std::string *NameStr) { |
| 1072 | if (!NameStr) return; |
| 1073 | std::string Name(*NameStr); // Copy string |
| 1074 | delete NameStr; // Free old string |
| 1075 | |
| 1076 | if (V->getType() == Type::VoidTy) { |
| 1077 | GenerateError("Can't assign name '" + Name+"' to value with void type"); |
| 1078 | return; |
| 1079 | } |
| 1080 | |
| 1081 | assert(inFunctionScope() && "Must be in function scope!"); |
| 1082 | ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable(); |
| 1083 | if (ST.lookup(Name)) { |
| 1084 | GenerateError("Redefinition of value '" + Name + "' of type '" + |
| 1085 | V->getType()->getDescription() + "'"); |
| 1086 | return; |
| 1087 | } |
| 1088 | |
| 1089 | // Set the name. |
| 1090 | V->setName(Name); |
| 1091 | } |
| 1092 | |
| 1093 | /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, |
| 1094 | /// this is a declaration, otherwise it is a definition. |
| 1095 | static GlobalVariable * |
| 1096 | ParseGlobalVariable(std::string *NameStr, |
| 1097 | GlobalValue::LinkageTypes Linkage, |
| 1098 | GlobalValue::VisibilityTypes Visibility, |
| 1099 | bool isConstantGlobal, const Type *Ty, |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1100 | Constant *Initializer, bool IsThreadLocal, |
| 1101 | unsigned AddressSpace = 0) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1102 | if (isa<FunctionType>(Ty)) { |
| 1103 | GenerateError("Cannot declare global vars of function type"); |
| 1104 | return 0; |
| 1105 | } |
| 1106 | |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1107 | const PointerType *PTy = PointerType::get(Ty, AddressSpace); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1108 | |
| 1109 | std::string Name; |
| 1110 | if (NameStr) { |
| 1111 | Name = *NameStr; // Copy string |
| 1112 | delete NameStr; // Free old string |
| 1113 | } |
| 1114 | |
| 1115 | // See if this global value was forward referenced. If so, recycle the |
| 1116 | // object. |
| 1117 | ValID ID; |
| 1118 | if (!Name.empty()) { |
| 1119 | ID = ValID::createGlobalName(Name); |
| 1120 | } else { |
| 1121 | ID = ValID::createGlobalID(CurModule.Values.size()); |
| 1122 | } |
| 1123 | |
| 1124 | if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { |
| 1125 | // Move the global to the end of the list, from whereever it was |
| 1126 | // previously inserted. |
| 1127 | GlobalVariable *GV = cast<GlobalVariable>(FWGV); |
| 1128 | CurModule.CurrentModule->getGlobalList().remove(GV); |
| 1129 | CurModule.CurrentModule->getGlobalList().push_back(GV); |
| 1130 | GV->setInitializer(Initializer); |
| 1131 | GV->setLinkage(Linkage); |
| 1132 | GV->setVisibility(Visibility); |
| 1133 | GV->setConstant(isConstantGlobal); |
| 1134 | GV->setThreadLocal(IsThreadLocal); |
| 1135 | InsertValue(GV, CurModule.Values); |
| 1136 | return GV; |
| 1137 | } |
| 1138 | |
| 1139 | // If this global has a name |
| 1140 | if (!Name.empty()) { |
| 1141 | // if the global we're parsing has an initializer (is a definition) and |
| 1142 | // has external linkage. |
| 1143 | if (Initializer && Linkage != GlobalValue::InternalLinkage) |
| 1144 | // If there is already a global with external linkage with this name |
| 1145 | if (CurModule.CurrentModule->getGlobalVariable(Name, false)) { |
| 1146 | // If we allow this GVar to get created, it will be renamed in the |
| 1147 | // symbol table because it conflicts with an existing GVar. We can't |
| 1148 | // allow redefinition of GVars whose linking indicates that their name |
| 1149 | // must stay the same. Issue the error. |
| 1150 | GenerateError("Redefinition of global variable named '" + Name + |
| 1151 | "' of type '" + Ty->getDescription() + "'"); |
| 1152 | return 0; |
| 1153 | } |
| 1154 | } |
| 1155 | |
| 1156 | // Otherwise there is no existing GV to use, create one now. |
| 1157 | GlobalVariable *GV = |
| 1158 | new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 1159 | CurModule.CurrentModule, IsThreadLocal, AddressSpace); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1160 | GV->setVisibility(Visibility); |
| 1161 | InsertValue(GV, CurModule.Values); |
| 1162 | return GV; |
| 1163 | } |
| 1164 | |
| 1165 | // setTypeName - Set the specified type to the name given. The name may be |
| 1166 | // null potentially, in which case this is a noop. The string passed in is |
| 1167 | // assumed to be a malloc'd string buffer, and is freed by this function. |
| 1168 | // |
| 1169 | // This function returns true if the type has already been defined, but is |
| 1170 | // allowed to be redefined in the specified context. If the name is a new name |
| 1171 | // for the type plane, it is inserted and false is returned. |
| 1172 | static bool setTypeName(const Type *T, std::string *NameStr) { |
| 1173 | assert(!inFunctionScope() && "Can't give types function-local names!"); |
| 1174 | if (NameStr == 0) return false; |
| 1175 | |
| 1176 | std::string Name(*NameStr); // Copy string |
| 1177 | delete NameStr; // Free old string |
| 1178 | |
| 1179 | // We don't allow assigning names to void type |
| 1180 | if (T == Type::VoidTy) { |
| 1181 | GenerateError("Can't assign name '" + Name + "' to the void type"); |
| 1182 | return false; |
| 1183 | } |
| 1184 | |
| 1185 | // Set the type name, checking for conflicts as we do so. |
| 1186 | bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); |
| 1187 | |
| 1188 | if (AlreadyExists) { // Inserting a name that is already defined??? |
| 1189 | const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); |
| 1190 | assert(Existing && "Conflict but no matching type?!"); |
| 1191 | |
| 1192 | // There is only one case where this is allowed: when we are refining an |
| 1193 | // opaque type. In this case, Existing will be an opaque type. |
| 1194 | if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) { |
| 1195 | // We ARE replacing an opaque type! |
| 1196 | const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T); |
| 1197 | return true; |
| 1198 | } |
| 1199 | |
| 1200 | // Otherwise, this is an attempt to redefine a type. That's okay if |
| 1201 | // the redefinition is identical to the original. This will be so if |
| 1202 | // Existing and T point to the same Type object. In this one case we |
| 1203 | // allow the equivalent redefinition. |
| 1204 | if (Existing == T) return true; // Yes, it's equal. |
| 1205 | |
| 1206 | // Any other kind of (non-equivalent) redefinition is an error. |
| 1207 | GenerateError("Redefinition of type named '" + Name + "' of type '" + |
| 1208 | T->getDescription() + "'"); |
| 1209 | } |
| 1210 | |
| 1211 | return false; |
| 1212 | } |
| 1213 | |
| 1214 | //===----------------------------------------------------------------------===// |
| 1215 | // Code for handling upreferences in type names... |
| 1216 | // |
| 1217 | |
| 1218 | // TypeContains - Returns true if Ty directly contains E in it. |
| 1219 | // |
| 1220 | static bool TypeContains(const Type *Ty, const Type *E) { |
| 1221 | return std::find(Ty->subtype_begin(), Ty->subtype_end(), |
| 1222 | E) != Ty->subtype_end(); |
| 1223 | } |
| 1224 | |
| 1225 | namespace { |
| 1226 | struct UpRefRecord { |
| 1227 | // NestingLevel - The number of nesting levels that need to be popped before |
| 1228 | // this type is resolved. |
| 1229 | unsigned NestingLevel; |
| 1230 | |
| 1231 | // LastContainedTy - This is the type at the current binding level for the |
| 1232 | // type. Every time we reduce the nesting level, this gets updated. |
| 1233 | const Type *LastContainedTy; |
| 1234 | |
| 1235 | // UpRefTy - This is the actual opaque type that the upreference is |
| 1236 | // represented with. |
| 1237 | OpaqueType *UpRefTy; |
| 1238 | |
| 1239 | UpRefRecord(unsigned NL, OpaqueType *URTy) |
| 1240 | : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} |
| 1241 | }; |
| 1242 | } |
| 1243 | |
| 1244 | // UpRefs - A list of the outstanding upreferences that need to be resolved. |
| 1245 | static std::vector<UpRefRecord> UpRefs; |
| 1246 | |
| 1247 | /// HandleUpRefs - Every time we finish a new layer of types, this function is |
| 1248 | /// called. It loops through the UpRefs vector, which is a list of the |
| 1249 | /// currently active types. For each type, if the up reference is contained in |
| 1250 | /// the newly completed type, we decrement the level count. When the level |
| 1251 | /// count reaches zero, the upreferenced type is the type that is passed in: |
| 1252 | /// thus we can complete the cycle. |
| 1253 | /// |
| 1254 | static PATypeHolder HandleUpRefs(const Type *ty) { |
| 1255 | // If Ty isn't abstract, or if there are no up-references in it, then there is |
| 1256 | // nothing to resolve here. |
| 1257 | if (!ty->isAbstract() || UpRefs.empty()) return ty; |
| 1258 | |
| 1259 | PATypeHolder Ty(ty); |
| 1260 | UR_OUT("Type '" << Ty->getDescription() << |
| 1261 | "' newly formed. Resolving upreferences.\n" << |
| 1262 | UpRefs.size() << " upreferences active!\n"); |
| 1263 | |
| 1264 | // If we find any resolvable upreferences (i.e., those whose NestingLevel goes |
| 1265 | // to zero), we resolve them all together before we resolve them to Ty. At |
| 1266 | // the end of the loop, if there is anything to resolve to Ty, it will be in |
| 1267 | // this variable. |
| 1268 | OpaqueType *TypeToResolve = 0; |
| 1269 | |
| 1270 | for (unsigned i = 0; i != UpRefs.size(); ++i) { |
| 1271 | UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " |
| 1272 | << UpRefs[i].second->getDescription() << ") = " |
| 1273 | << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); |
| 1274 | if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { |
| 1275 | // Decrement level of upreference |
| 1276 | unsigned Level = --UpRefs[i].NestingLevel; |
| 1277 | UpRefs[i].LastContainedTy = Ty; |
| 1278 | UR_OUT(" Uplevel Ref Level = " << Level << "\n"); |
| 1279 | if (Level == 0) { // Upreference should be resolved! |
| 1280 | if (!TypeToResolve) { |
| 1281 | TypeToResolve = UpRefs[i].UpRefTy; |
| 1282 | } else { |
| 1283 | UR_OUT(" * Resolving upreference for " |
| 1284 | << UpRefs[i].second->getDescription() << "\n"; |
| 1285 | std::string OldName = UpRefs[i].UpRefTy->getDescription()); |
| 1286 | UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); |
| 1287 | UR_OUT(" * Type '" << OldName << "' refined upreference to: " |
| 1288 | << (const void*)Ty << ", " << Ty->getDescription() << "\n"); |
| 1289 | } |
| 1290 | UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... |
| 1291 | --i; // Do not skip the next element... |
| 1292 | } |
| 1293 | } |
| 1294 | } |
| 1295 | |
| 1296 | if (TypeToResolve) { |
| 1297 | UR_OUT(" * Resolving upreference for " |
| 1298 | << UpRefs[i].second->getDescription() << "\n"; |
| 1299 | std::string OldName = TypeToResolve->getDescription()); |
| 1300 | TypeToResolve->refineAbstractTypeTo(Ty); |
| 1301 | } |
| 1302 | |
| 1303 | return Ty; |
| 1304 | } |
| 1305 | |
| 1306 | //===----------------------------------------------------------------------===// |
| 1307 | // RunVMAsmParser - Define an interface to this parser |
| 1308 | //===----------------------------------------------------------------------===// |
| 1309 | // |
| 1310 | static Module* RunParser(Module * M); |
| 1311 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 1312 | Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { |
| 1313 | InitLLLexer(MB); |
| 1314 | Module *M = RunParser(new Module(LLLgetFilename())); |
| 1315 | FreeLexer(); |
| 1316 | return M; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1317 | } |
| 1318 | |
| 1319 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1320 | |
| 1321 | /* Enabling traces. */ |
| 1322 | #ifndef YYDEBUG |
| 1323 | # define YYDEBUG 0 |
| 1324 | #endif |
| 1325 | |
| 1326 | /* Enabling verbose error messages. */ |
| 1327 | #ifdef YYERROR_VERBOSE |
| 1328 | # undef YYERROR_VERBOSE |
| 1329 | # define YYERROR_VERBOSE 1 |
| 1330 | #else |
| 1331 | # define YYERROR_VERBOSE 0 |
| 1332 | #endif |
| 1333 | |
| 1334 | /* Enabling the token table. */ |
| 1335 | #ifndef YYTOKEN_TABLE |
| 1336 | # define YYTOKEN_TABLE 0 |
| 1337 | #endif |
| 1338 | |
| 1339 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
| 1340 | typedef union YYSTYPE |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1341 | #line 949 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1342 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1343 | llvm::Module *ModuleVal; |
| 1344 | llvm::Function *FunctionVal; |
| 1345 | llvm::BasicBlock *BasicBlockVal; |
| 1346 | llvm::TerminatorInst *TermInstVal; |
| 1347 | llvm::Instruction *InstVal; |
| 1348 | llvm::Constant *ConstVal; |
| 1349 | |
| 1350 | const llvm::Type *PrimType; |
| 1351 | std::list<llvm::PATypeHolder> *TypeList; |
| 1352 | llvm::PATypeHolder *TypeVal; |
| 1353 | llvm::Value *ValueVal; |
| 1354 | std::vector<llvm::Value*> *ValueList; |
| 1355 | llvm::ArgListType *ArgList; |
| 1356 | llvm::TypeWithAttrs TypeWithAttrs; |
| 1357 | llvm::TypeWithAttrsList *TypeWithAttrsList; |
Dale Johannesen | cfb19e6 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 1358 | llvm::ParamList *ParamList; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1359 | |
| 1360 | // Represent the RHS of PHI node |
| 1361 | std::list<std::pair<llvm::Value*, |
| 1362 | llvm::BasicBlock*> > *PHIList; |
| 1363 | std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable; |
| 1364 | std::vector<llvm::Constant*> *ConstVector; |
| 1365 | |
| 1366 | llvm::GlobalValue::LinkageTypes Linkage; |
| 1367 | llvm::GlobalValue::VisibilityTypes Visibility; |
Dale Johannesen | d915ee5 | 2008-02-19 21:40:51 +0000 | [diff] [blame] | 1368 | llvm::ParameterAttributes ParamAttrs; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1369 | llvm::APInt *APIntVal; |
| 1370 | int64_t SInt64Val; |
| 1371 | uint64_t UInt64Val; |
| 1372 | int SIntVal; |
| 1373 | unsigned UIntVal; |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 1374 | llvm::APFloat *FPVal; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1375 | bool BoolVal; |
| 1376 | |
| 1377 | std::string *StrVal; // This memory must be deleted |
| 1378 | llvm::ValID ValIDVal; |
| 1379 | |
| 1380 | llvm::Instruction::BinaryOps BinaryOpVal; |
| 1381 | llvm::Instruction::TermOps TermOpVal; |
| 1382 | llvm::Instruction::MemoryOps MemOpVal; |
| 1383 | llvm::Instruction::CastOps CastOpVal; |
| 1384 | llvm::Instruction::OtherOps OtherOpVal; |
| 1385 | llvm::ICmpInst::Predicate IPredicate; |
| 1386 | llvm::FCmpInst::Predicate FPredicate; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1387 | } |
| 1388 | /* Line 193 of yacc.c. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1389 | #line 1390 "llvmAsmParser.tab.c" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1390 | YYSTYPE; |
| 1391 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
| 1392 | # define YYSTYPE_IS_DECLARED 1 |
| 1393 | # define YYSTYPE_IS_TRIVIAL 1 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1394 | #endif |
| 1395 | |
| 1396 | |
| 1397 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1398 | /* Copy the second part of user declarations. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1399 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1400 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1401 | /* Line 216 of yacc.c. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1402 | #line 1403 "llvmAsmParser.tab.c" |
Reid Spencer | aa8ae28 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 1403 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1404 | #ifdef short |
| 1405 | # undef short |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1406 | #endif |
| 1407 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1408 | #ifdef YYTYPE_UINT8 |
| 1409 | typedef YYTYPE_UINT8 yytype_uint8; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1410 | #else |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1411 | typedef unsigned char yytype_uint8; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1412 | #endif |
| 1413 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1414 | #ifdef YYTYPE_INT8 |
| 1415 | typedef YYTYPE_INT8 yytype_int8; |
| 1416 | #elif (defined __STDC__ || defined __C99__FUNC__ \ |
| 1417 | || defined __cplusplus || defined _MSC_VER) |
| 1418 | typedef signed char yytype_int8; |
| 1419 | #else |
| 1420 | typedef short int yytype_int8; |
| 1421 | #endif |
| 1422 | |
| 1423 | #ifdef YYTYPE_UINT16 |
| 1424 | typedef YYTYPE_UINT16 yytype_uint16; |
| 1425 | #else |
| 1426 | typedef unsigned short int yytype_uint16; |
| 1427 | #endif |
| 1428 | |
| 1429 | #ifdef YYTYPE_INT16 |
| 1430 | typedef YYTYPE_INT16 yytype_int16; |
| 1431 | #else |
| 1432 | typedef short int yytype_int16; |
| 1433 | #endif |
| 1434 | |
| 1435 | #ifndef YYSIZE_T |
| 1436 | # ifdef __SIZE_TYPE__ |
| 1437 | # define YYSIZE_T __SIZE_TYPE__ |
| 1438 | # elif defined size_t |
| 1439 | # define YYSIZE_T size_t |
| 1440 | # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1441 | || defined __cplusplus || defined _MSC_VER) |
| 1442 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 1443 | # define YYSIZE_T size_t |
| 1444 | # else |
| 1445 | # define YYSIZE_T unsigned int |
| 1446 | # endif |
| 1447 | #endif |
| 1448 | |
| 1449 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
| 1450 | |
| 1451 | #ifndef YY_ |
| 1452 | # if defined YYENABLE_NLS && YYENABLE_NLS |
| 1453 | # if ENABLE_NLS |
| 1454 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
| 1455 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
| 1456 | # endif |
| 1457 | # endif |
| 1458 | # ifndef YY_ |
| 1459 | # define YY_(msgid) msgid |
| 1460 | # endif |
| 1461 | #endif |
| 1462 | |
| 1463 | /* Suppress unused-variable warnings by "using" E. */ |
| 1464 | #if ! defined lint || defined __GNUC__ |
| 1465 | # define YYUSE(e) ((void) (e)) |
| 1466 | #else |
| 1467 | # define YYUSE(e) /* empty */ |
| 1468 | #endif |
| 1469 | |
| 1470 | /* Identity function, used to suppress warnings about constant conditions. */ |
| 1471 | #ifndef lint |
| 1472 | # define YYID(n) (n) |
| 1473 | #else |
| 1474 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 1475 | || defined __cplusplus || defined _MSC_VER) |
| 1476 | static int |
| 1477 | YYID (int i) |
| 1478 | #else |
| 1479 | static int |
| 1480 | YYID (i) |
| 1481 | int i; |
| 1482 | #endif |
| 1483 | { |
| 1484 | return i; |
| 1485 | } |
| 1486 | #endif |
| 1487 | |
| 1488 | #if ! defined yyoverflow || YYERROR_VERBOSE |
| 1489 | |
| 1490 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 1491 | |
| 1492 | # ifdef YYSTACK_USE_ALLOCA |
| 1493 | # if YYSTACK_USE_ALLOCA |
| 1494 | # ifdef __GNUC__ |
| 1495 | # define YYSTACK_ALLOC __builtin_alloca |
| 1496 | # elif defined __BUILTIN_VA_ARG_INCR |
| 1497 | # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ |
| 1498 | # elif defined _AIX |
| 1499 | # define YYSTACK_ALLOC __alloca |
| 1500 | # elif defined _MSC_VER |
| 1501 | # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ |
| 1502 | # define alloca _alloca |
| 1503 | # else |
| 1504 | # define YYSTACK_ALLOC alloca |
| 1505 | # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1506 | || defined __cplusplus || defined _MSC_VER) |
| 1507 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1508 | # ifndef _STDLIB_H |
| 1509 | # define _STDLIB_H 1 |
| 1510 | # endif |
| 1511 | # endif |
| 1512 | # endif |
| 1513 | # endif |
| 1514 | # endif |
| 1515 | |
| 1516 | # ifdef YYSTACK_ALLOC |
| 1517 | /* Pacify GCC's `empty if-body' warning. */ |
| 1518 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) |
| 1519 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1520 | /* The OS might guarantee only one guard page at the bottom of the stack, |
| 1521 | and a page size can be as small as 4096 bytes. So we cannot safely |
| 1522 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
| 1523 | to allow for a few compiler-allocated temporary stack slots. */ |
| 1524 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ |
| 1525 | # endif |
| 1526 | # else |
| 1527 | # define YYSTACK_ALLOC YYMALLOC |
| 1528 | # define YYSTACK_FREE YYFREE |
| 1529 | # ifndef YYSTACK_ALLOC_MAXIMUM |
| 1530 | # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM |
| 1531 | # endif |
| 1532 | # if (defined __cplusplus && ! defined _STDLIB_H \ |
| 1533 | && ! ((defined YYMALLOC || defined malloc) \ |
| 1534 | && (defined YYFREE || defined free))) |
| 1535 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 1536 | # ifndef _STDLIB_H |
| 1537 | # define _STDLIB_H 1 |
| 1538 | # endif |
| 1539 | # endif |
| 1540 | # ifndef YYMALLOC |
| 1541 | # define YYMALLOC malloc |
| 1542 | # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1543 | || defined __cplusplus || defined _MSC_VER) |
| 1544 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ |
| 1545 | # endif |
| 1546 | # endif |
| 1547 | # ifndef YYFREE |
| 1548 | # define YYFREE free |
| 1549 | # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ |
| 1550 | || defined __cplusplus || defined _MSC_VER) |
| 1551 | void free (void *); /* INFRINGES ON USER NAME SPACE */ |
| 1552 | # endif |
| 1553 | # endif |
| 1554 | # endif |
| 1555 | #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ |
| 1556 | |
| 1557 | |
| 1558 | #if (! defined yyoverflow \ |
| 1559 | && (! defined __cplusplus \ |
| 1560 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 1561 | |
| 1562 | /* A type that is properly aligned for any stack member. */ |
| 1563 | union yyalloc |
| 1564 | { |
| 1565 | yytype_int16 yyss; |
| 1566 | YYSTYPE yyvs; |
| 1567 | }; |
| 1568 | |
| 1569 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 1570 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
| 1571 | |
| 1572 | /* The size of an array large to enough to hold all stacks, each with |
| 1573 | N elements. */ |
| 1574 | # define YYSTACK_BYTES(N) \ |
| 1575 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
| 1576 | + YYSTACK_GAP_MAXIMUM) |
| 1577 | |
| 1578 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 1579 | not overlap. */ |
| 1580 | # ifndef YYCOPY |
| 1581 | # if defined __GNUC__ && 1 < __GNUC__ |
| 1582 | # define YYCOPY(To, From, Count) \ |
| 1583 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 1584 | # else |
| 1585 | # define YYCOPY(To, From, Count) \ |
| 1586 | do \ |
| 1587 | { \ |
| 1588 | YYSIZE_T yyi; \ |
| 1589 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 1590 | (To)[yyi] = (From)[yyi]; \ |
| 1591 | } \ |
| 1592 | while (YYID (0)) |
| 1593 | # endif |
| 1594 | # endif |
| 1595 | |
| 1596 | /* Relocate STACK from its old location to the new one. The |
| 1597 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 1598 | elements in the stack, and YYPTR gives the new location of the |
| 1599 | stack. Advance YYPTR to a properly aligned location for the next |
| 1600 | stack. */ |
| 1601 | # define YYSTACK_RELOCATE(Stack) \ |
| 1602 | do \ |
| 1603 | { \ |
| 1604 | YYSIZE_T yynewbytes; \ |
| 1605 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 1606 | Stack = &yyptr->Stack; \ |
| 1607 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
| 1608 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 1609 | } \ |
| 1610 | while (YYID (0)) |
| 1611 | |
| 1612 | #endif |
| 1613 | |
| 1614 | /* YYFINAL -- State number of the termination state. */ |
| 1615 | #define YYFINAL 43 |
| 1616 | /* YYLAST -- Last index in YYTABLE. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1617 | #define YYLAST 2035 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1618 | |
| 1619 | /* YYNTOKENS -- Number of terminals. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1620 | #define YYNTOKENS 167 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1621 | /* YYNNTS -- Number of nonterminals. */ |
| 1622 | #define YYNNTS 85 |
| 1623 | /* YYNRULES -- Number of rules. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1624 | #define YYNRULES 326 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1625 | /* YYNRULES -- Number of states. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1626 | #define YYNSTATES 655 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1627 | |
| 1628 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 1629 | #define YYUNDEFTOK 2 |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1630 | #define YYMAXUTOK 407 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1631 | |
| 1632 | #define YYTRANSLATE(YYX) \ |
| 1633 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
| 1634 | |
| 1635 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 1636 | static const yytype_uint8 yytranslate[] = |
| 1637 | { |
| 1638 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1639 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1640 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1641 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1642 | 153, 154, 157, 2, 156, 2, 2, 2, 2, 2, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1643 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1644 | 162, 155, 163, 2, 2, 2, 2, 2, 2, 2, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1645 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1646 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1647 | 2, 159, 158, 161, 2, 2, 2, 2, 2, 166, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1648 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1649 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1650 | 160, 2, 2, 164, 2, 165, 2, 2, 2, 2, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1651 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1652 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1653 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1654 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1655 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1656 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1657 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1658 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1659 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1660 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1661 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1662 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 1663 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 1664 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 1665 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 1666 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 1667 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 1668 | 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 1669 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, |
| 1670 | 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, |
| 1671 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
| 1672 | 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, |
| 1673 | 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 1674 | 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, |
| 1675 | 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
| 1676 | 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, |
| 1677 | 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1678 | 145, 146, 147, 148, 149, 150, 151, 152 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1679 | }; |
| 1680 | |
| 1681 | #if YYDEBUG |
| 1682 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 1683 | YYRHS. */ |
| 1684 | static const yytype_uint16 yyprhs[] = |
| 1685 | { |
| 1686 | 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, |
| 1687 | 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, |
| 1688 | 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, |
| 1689 | 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, |
| 1690 | 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, |
| 1691 | 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, |
| 1692 | 119, 121, 123, 125, 127, 129, 130, 135, 136, 139, |
| 1693 | 140, 142, 144, 146, 147, 150, 152, 154, 156, 158, |
| 1694 | 160, 162, 164, 166, 167, 169, 171, 173, 174, 176, |
| 1695 | 178, 179, 181, 183, 185, 187, 188, 190, 192, 193, |
| 1696 | 195, 197, 199, 201, 203, 206, 208, 210, 212, 214, |
| 1697 | 216, 218, 220, 222, 224, 227, 228, 231, 233, 235, |
| 1698 | 237, 239, 241, 243, 244, 247, 248, 251, 252, 255, |
| 1699 | 256, 260, 263, 264, 266, 267, 271, 273, 276, 278, |
| 1700 | 280, 282, 284, 286, 288, 290, 292, 294, 298, 300, |
| 1701 | 303, 309, 315, 321, 327, 331, 334, 340, 345, 348, |
| 1702 | 350, 352, 354, 358, 360, 364, 366, 367, 369, 373, |
| 1703 | 378, 382, 386, 391, 396, 400, 407, 413, 416, 419, |
| 1704 | 422, 425, 428, 431, 434, 437, 440, 443, 446, 449, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1705 | 456, 462, 471, 478, 485, 493, 501, 509, 517, 524, |
| 1706 | 533, 542, 546, 548, 550, 552, 554, 555, 558, 565, |
| 1707 | 567, 568, 570, 573, 574, 578, 579, 583, 587, 591, |
| 1708 | 595, 596, 605, 606, 616, 617, 627, 633, 636, 640, |
| 1709 | 642, 646, 650, 654, 658, 660, 661, 667, 671, 673, |
| 1710 | 677, 679, 680, 691, 693, 695, 700, 702, 704, 707, |
| 1711 | 711, 712, 714, 716, 718, 720, 722, 724, 726, 728, |
| 1712 | 730, 734, 736, 742, 744, 746, 748, 750, 752, 754, |
| 1713 | 757, 759, 763, 766, 769, 773, 776, 777, 779, 782, |
| 1714 | 785, 789, 799, 809, 818, 833, 835, 837, 844, 850, |
| 1715 | 853, 860, 868, 873, 878, 885, 892, 893, 894, 898, |
| 1716 | 901, 903, 909, 915, 922, 929, 936, 943, 948, 955, |
| 1717 | 960, 965, 972, 979, 982, 991, 993, 995, 996, 1000, |
| 1718 | 1007, 1011, 1018, 1021, 1027, 1035, 1041 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1719 | }; |
| 1720 | |
| 1721 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 1722 | static const yytype_int16 yyrhs[] = |
| 1723 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1724 | 213, 0, -1, 74, -1, 75, -1, 76, -1, 77, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 1725 | -1, 78, -1, 79, -1, 80, -1, 81, -1, 82, |
| 1726 | -1, 86, -1, 87, -1, 88, -1, 83, -1, 84, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1727 | -1, 85, -1, 119, -1, 120, -1, 121, -1, 122, |
| 1728 | -1, 123, -1, 124, -1, 125, -1, 126, -1, 127, |
| 1729 | -1, 128, -1, 129, -1, 130, -1, 93, -1, 94, |
| 1730 | -1, 95, -1, 96, -1, 97, -1, 98, -1, 99, |
| 1731 | -1, 100, -1, 101, -1, 102, -1, 103, -1, 104, |
| 1732 | -1, 105, -1, 106, -1, 107, -1, 108, -1, 109, |
| 1733 | -1, 110, -1, 111, -1, 112, -1, 99, -1, 100, |
| 1734 | -1, 101, -1, 102, -1, 26, -1, 27, -1, 11, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1735 | -1, 12, -1, 13, -1, 16, -1, 15, -1, 14, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1736 | -1, 19, -1, 22, -1, 24, -1, 175, -1, -1, |
| 1737 | 54, 153, 4, 154, -1, -1, 175, 155, -1, -1, |
| 1738 | 20, -1, 23, -1, 181, -1, -1, 179, 155, -1, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1739 | 42, -1, 44, -1, 43, -1, 45, -1, 47, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1740 | 46, -1, 48, -1, 50, -1, -1, 150, -1, 151, |
| 1741 | -1, 152, -1, -1, 46, -1, 48, -1, -1, 42, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1742 | -1, 43, -1, 44, -1, 47, -1, -1, 44, -1, |
| 1743 | 42, -1, -1, 62, -1, 63, -1, 64, -1, 65, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1744 | -1, 66, -1, 61, 4, -1, 139, -1, 120, -1, |
| 1745 | 138, -1, 121, -1, 141, -1, 142, -1, 144, -1, |
| 1746 | 145, -1, 146, -1, 53, 4, -1, -1, 190, 189, |
| 1747 | -1, 140, -1, 143, -1, 139, -1, 138, -1, 147, |
| 1748 | -1, 148, -1, -1, 192, 191, -1, -1, 149, 22, |
| 1749 | -1, -1, 53, 4, -1, -1, 156, 53, 4, -1, |
| 1750 | 34, 22, -1, -1, 196, -1, -1, 156, 199, 198, |
| 1751 | -1, 196, -1, 53, 4, -1, 11, -1, 12, -1, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1752 | 13, -1, 16, -1, 15, -1, 14, -1, 17, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1753 | 49, -1, 200, -1, 201, 177, 157, -1, 235, -1, |
| 1754 | 158, 4, -1, 201, 153, 205, 154, 192, -1, 10, |
| 1755 | 153, 205, 154, 192, -1, 159, 4, 160, 201, 161, |
| 1756 | -1, 162, 4, 160, 201, 163, -1, 164, 206, 165, |
| 1757 | -1, 164, 165, -1, 162, 164, 206, 165, 163, -1, |
| 1758 | 162, 164, 165, 163, -1, 201, 190, -1, 201, -1, |
| 1759 | 10, -1, 202, -1, 204, 156, 202, -1, 204, -1, |
| 1760 | 204, 156, 39, -1, 39, -1, -1, 201, -1, 206, |
| 1761 | 156, 201, -1, 201, 159, 209, 161, -1, 201, 159, |
| 1762 | 161, -1, 201, 166, 22, -1, 201, 162, 209, 163, |
| 1763 | -1, 201, 164, 209, 165, -1, 201, 164, 165, -1, |
| 1764 | 201, 162, 164, 209, 165, 163, -1, 201, 162, 164, |
| 1765 | 165, 163, -1, 201, 40, -1, 201, 41, -1, 201, |
| 1766 | 235, -1, 201, 208, -1, 201, 25, -1, 173, 3, |
| 1767 | -1, 173, 5, -1, 173, 4, -1, 173, 6, -1, |
| 1768 | 11, 26, -1, 11, 27, -1, 174, 9, -1, 170, |
| 1769 | 153, 207, 38, 201, 154, -1, 118, 153, 207, 247, |
| 1770 | 154, -1, 132, 153, 207, 156, 207, 156, 207, 154, |
| 1771 | -1, 168, 153, 207, 156, 207, 154, -1, 169, 153, |
| 1772 | 207, 156, 207, 154, -1, 89, 171, 153, 207, 156, |
| 1773 | 207, 154, -1, 90, 172, 153, 207, 156, 207, 154, |
| 1774 | -1, 91, 171, 153, 207, 156, 207, 154, -1, 92, |
| 1775 | 172, 153, 207, 156, 207, 154, -1, 134, 153, 207, |
| 1776 | 156, 207, 154, -1, 135, 153, 207, 156, 207, 156, |
| 1777 | 207, 154, -1, 136, 153, 207, 156, 207, 156, 207, |
| 1778 | 154, -1, 209, 156, 207, -1, 207, -1, 32, -1, |
| 1779 | 33, -1, 37, -1, -1, 203, 235, -1, 124, 153, |
| 1780 | 212, 38, 201, 154, -1, 214, -1, -1, 215, -1, |
| 1781 | 214, 215, -1, -1, 31, 216, 231, -1, -1, 30, |
| 1782 | 217, 232, -1, 59, 58, 221, -1, 178, 18, 201, |
| 1783 | -1, 178, 18, 10, -1, -1, 180, 184, 211, 210, |
| 1784 | 207, 177, 218, 198, -1, -1, 180, 182, 184, 211, |
| 1785 | 210, 207, 177, 219, 198, -1, -1, 180, 183, 184, |
| 1786 | 211, 210, 201, 177, 220, 198, -1, 180, 184, 35, |
| 1787 | 187, 212, -1, 51, 222, -1, 55, 155, 223, -1, |
| 1788 | 22, -1, 52, 155, 22, -1, 67, 155, 22, -1, |
| 1789 | 159, 224, 161, -1, 224, 156, 22, -1, 22, -1, |
| 1790 | -1, 225, 156, 201, 190, 176, -1, 201, 190, 176, |
| 1791 | -1, 225, -1, 225, 156, 39, -1, 39, -1, -1, |
| 1792 | 188, 203, 179, 153, 226, 154, 192, 197, 194, 193, |
| 1793 | -1, 28, -1, 164, -1, 186, 184, 227, 228, -1, |
| 1794 | 29, -1, 165, -1, 239, 230, -1, 185, 184, 227, |
| 1795 | -1, -1, 60, -1, 3, -1, 4, -1, 9, -1, |
| 1796 | 26, -1, 27, -1, 40, -1, 41, -1, 25, -1, |
| 1797 | 162, 209, 163, -1, 208, -1, 58, 233, 22, 156, |
| 1798 | 22, -1, 7, -1, 8, -1, 175, -1, 179, -1, |
| 1799 | 235, -1, 234, -1, 201, 236, -1, 237, -1, 238, |
| 1800 | 156, 237, -1, 239, 240, -1, 229, 240, -1, 241, |
| 1801 | 178, 242, -1, 241, 244, -1, -1, 21, -1, 68, |
| 1802 | 238, -1, 68, 10, -1, 69, 17, 236, -1, 69, |
| 1803 | 11, 236, 156, 17, 236, 156, 17, 236, -1, 70, |
| 1804 | 173, 236, 156, 17, 236, 159, 243, 161, -1, 70, |
| 1805 | 173, 236, 156, 17, 236, 159, 161, -1, 71, 188, |
| 1806 | 203, 236, 153, 246, 154, 192, 38, 17, 236, 72, |
| 1807 | 17, 236, -1, 72, -1, 73, -1, 243, 173, 234, |
| 1808 | 156, 17, 236, -1, 173, 234, 156, 17, 236, -1, |
| 1809 | 178, 249, -1, 201, 159, 236, 156, 236, 161, -1, |
| 1810 | 245, 156, 159, 236, 156, 236, 161, -1, 201, 190, |
| 1811 | 236, 190, -1, 17, 190, 236, 190, -1, 246, 156, |
| 1812 | 201, 190, 236, 190, -1, 246, 156, 17, 190, 236, |
| 1813 | 190, -1, -1, -1, 247, 156, 237, -1, 57, 56, |
| 1814 | -1, 56, -1, 168, 201, 236, 156, 236, -1, 169, |
| 1815 | 201, 236, 156, 236, -1, 89, 171, 201, 236, 156, |
| 1816 | 236, -1, 90, 172, 201, 236, 156, 236, -1, 91, |
| 1817 | 171, 201, 236, 156, 236, -1, 92, 172, 201, 236, |
| 1818 | 156, 236, -1, 170, 237, 38, 201, -1, 132, 237, |
| 1819 | 156, 237, 156, 237, -1, 133, 237, 156, 201, -1, |
| 1820 | 134, 237, 156, 237, -1, 135, 237, 156, 237, 156, |
| 1821 | 237, -1, 136, 237, 156, 237, 156, 237, -1, 131, |
| 1822 | 245, -1, 248, 188, 203, 236, 153, 246, 154, 192, |
| 1823 | -1, 251, -1, 36, -1, -1, 113, 201, 195, -1, |
| 1824 | 113, 201, 156, 11, 236, 195, -1, 114, 201, 195, |
| 1825 | -1, 114, 201, 156, 11, 236, 195, -1, 115, 237, |
| 1826 | -1, 250, 116, 201, 236, 195, -1, 250, 117, 237, |
| 1827 | 156, 201, 236, 195, -1, 137, 201, 236, 156, 4, |
| 1828 | -1, 118, 201, 236, 247, -1 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1829 | }; |
| 1830 | |
| 1831 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 1832 | static const yytype_uint16 yyrline[] = |
| 1833 | { |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 1834 | 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, |
| 1835 | 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113, |
| 1836 | 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1117, |
| 1837 | 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125, |
| 1838 | 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, |
| 1839 | 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1139, 1139, |
| 1840 | 1139, 1141, 1141, 1141, 1142, 1142, 1144, 1145, 1149, 1153, |
| 1841 | 1158, 1158, 1160, 1161, 1166, 1172, 1173, 1174, 1175, 1176, |
| 1842 | 1180, 1181, 1182, 1186, 1187, 1188, 1189, 1193, 1194, 1195, |
| 1843 | 1199, 1200, 1201, 1202, 1203, 1207, 1208, 1209, 1212, 1213, |
| 1844 | 1214, 1215, 1216, 1217, 1218, 1225, 1226, 1227, 1228, 1229, |
| 1845 | 1230, 1231, 1232, 1233, 1234, 1238, 1239, 1244, 1245, 1246, |
| 1846 | 1247, 1248, 1249, 1252, 1253, 1258, 1259, 1266, 1267, 1273, |
| 1847 | 1274, 1283, 1291, 1292, 1297, 1298, 1299, 1304, 1317, 1317, |
| 1848 | 1317, 1317, 1317, 1317, 1317, 1320, 1324, 1328, 1335, 1340, |
| 1849 | 1348, 1377, 1402, 1407, 1417, 1427, 1431, 1441, 1448, 1457, |
| 1850 | 1464, 1469, 1474, 1481, 1482, 1489, 1496, 1504, 1510, 1522, |
| 1851 | 1550, 1566, 1593, 1621, 1647, 1667, 1693, 1713, 1725, 1732, |
| 1852 | 1798, 1808, 1818, 1824, 1834, 1840, 1850, 1855, 1860, 1873, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1853 | 1885, 1907, 1915, 1921, 1932, 1937, 1942, 1947, 1952, 1958, |
| 1854 | 1964, 1973, 1977, 1985, 1985, 1988, 1988, 1991, 2003, 2024, |
| 1855 | 2029, 2037, 2038, 2042, 2042, 2046, 2046, 2049, 2052, 2076, |
| 1856 | 2088, 2087, 2099, 2098, 2108, 2107, 2118, 2158, 2161, 2167, |
| 1857 | 2177, 2181, 2186, 2188, 2193, 2198, 2207, 2217, 2228, 2232, |
| 1858 | 2241, 2250, 2255, 2384, 2384, 2386, 2395, 2395, 2397, 2402, |
| 1859 | 2414, 2418, 2423, 2427, 2431, 2435, 2439, 2443, 2447, 2451, |
| 1860 | 2455, 2480, 2484, 2494, 2498, 2502, 2507, 2514, 2514, 2520, |
| 1861 | 2529, 2534, 2539, 2543, 2552, 2561, 2570, 2574, 2582, 2589, |
| 1862 | 2593, 2598, 2608, 2627, 2636, 2721, 2725, 2732, 2743, 2756, |
| 1863 | 2766, 2777, 2787, 2798, 2806, 2816, 2823, 2826, 2827, 2834, |
| 1864 | 2838, 2843, 2859, 2876, 2890, 2904, 2918, 2932, 2944, 2952, |
| 1865 | 2959, 2965, 2971, 2977, 2992, 3082, 3087, 3091, 3098, 3105, |
| 1866 | 3113, 3120, 3128, 3136, 3150, 3167, 3175 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1867 | }; |
| 1868 | #endif |
| 1869 | |
| 1870 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
| 1871 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 1872 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 1873 | static const char *const yytname[] = |
| 1874 | { |
| 1875 | "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL", |
| 1876 | "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", |
| 1877 | "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE", |
| 1878 | "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT", |
| 1879 | "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK", |
| 1880 | "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL", |
| 1881 | "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO", |
| 1882 | "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK", |
| 1883 | "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", |
| 1884 | "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL", |
| 1885 | "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", |
| 1886 | "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 1887 | "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", |
| 1888 | "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1889 | "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP", |
| 1890 | "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", |
| 1891 | "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", |
| 1892 | "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", |
| 1893 | "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", |
| 1894 | "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", |
| 1895 | "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", |
| 1896 | "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", |
| 1897 | "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC", |
| 1898 | "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'", |
| 1899 | "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'", |
| 1900 | "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates", |
| 1901 | "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName", |
| 1902 | "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign", |
| 1903 | "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage", |
| 1904 | "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage", |
| 1905 | "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs", |
| 1906 | "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign", |
| 1907 | "SectionString", "OptSection", "GlobalVarAttributes", |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1908 | "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes", |
| 1909 | "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr", |
| 1910 | "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module", |
| 1911 | "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock", |
| 1912 | "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH", |
| 1913 | "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", |
| 1914 | "Function", "FunctionProto", "OptSideEffect", "ConstValueRef", |
| 1915 | "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal", |
| 1916 | "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst", |
| 1917 | "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall", |
| 1918 | "InstVal", "OptVolatile", "MemoryInst", 0 |
| 1919 | }; |
| 1920 | #endif |
| 1921 | |
| 1922 | # ifdef YYPRINT |
| 1923 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 1924 | token YYLEX-NUM. */ |
| 1925 | static const yytype_uint16 yytoknum[] = |
| 1926 | { |
| 1927 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 1928 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 1929 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 1930 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 1931 | 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, |
| 1932 | 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, |
| 1933 | 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, |
| 1934 | 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, |
| 1935 | 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, |
| 1936 | 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, |
| 1937 | 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, |
| 1938 | 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, |
| 1939 | 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, |
| 1940 | 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, |
| 1941 | 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1942 | 405, 406, 407, 40, 41, 61, 44, 42, 92, 91, |
| 1943 | 120, 93, 60, 62, 123, 125, 99 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1944 | }; |
| 1945 | # endif |
| 1946 | |
| 1947 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 1948 | static const yytype_uint8 yyr1[] = |
| 1949 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 1950 | 0, 167, 168, 168, 168, 168, 168, 168, 168, 168, |
| 1951 | 168, 169, 169, 169, 169, 169, 169, 170, 170, 170, |
| 1952 | 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, |
| 1953 | 171, 171, 171, 171, 171, 171, 171, 171, 171, 172, |
| 1954 | 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, |
| 1955 | 172, 172, 172, 172, 172, 173, 174, 174, 174, 174, |
| 1956 | 174, 175, 175, 175, 176, 176, 177, 177, 178, 178, |
| 1957 | 179, 179, 180, 180, 181, 182, 182, 182, 182, 182, |
| 1958 | 183, 183, 183, 184, 184, 184, 184, 185, 185, 185, |
| 1959 | 186, 186, 186, 186, 186, 187, 187, 187, 188, 188, |
| 1960 | 188, 188, 188, 188, 188, 189, 189, 189, 189, 189, |
| 1961 | 189, 189, 189, 189, 189, 190, 190, 191, 191, 191, |
| 1962 | 191, 191, 191, 192, 192, 193, 193, 194, 194, 195, |
| 1963 | 195, 196, 197, 197, 198, 198, 199, 199, 200, 200, |
| 1964 | 200, 200, 200, 200, 200, 201, 201, 201, 201, 201, |
| 1965 | 201, 201, 201, 201, 201, 201, 201, 201, 202, 203, |
| 1966 | 203, 204, 204, 205, 205, 205, 205, 206, 206, 207, |
| 1967 | 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, |
| 1968 | 207, 207, 207, 207, 207, 207, 207, 207, 207, 208, |
| 1969 | 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, |
| 1970 | 208, 209, 209, 210, 210, 211, 211, 212, 212, 213, |
| 1971 | 213, 214, 214, 216, 215, 217, 215, 215, 215, 215, |
| 1972 | 218, 215, 219, 215, 220, 215, 215, 215, 215, 221, |
| 1973 | 222, 222, 223, 224, 224, 224, 225, 225, 226, 226, |
| 1974 | 226, 226, 227, 228, 228, 229, 230, 230, 231, 232, |
| 1975 | 233, 233, 234, 234, 234, 234, 234, 234, 234, 234, |
| 1976 | 234, 234, 234, 235, 235, 235, 235, 236, 236, 237, |
| 1977 | 238, 238, 239, 239, 240, 241, 241, 241, 242, 242, |
| 1978 | 242, 242, 242, 242, 242, 242, 242, 243, 243, 244, |
| 1979 | 245, 245, 246, 246, 246, 246, 246, 247, 247, 248, |
| 1980 | 248, 249, 249, 249, 249, 249, 249, 249, 249, 249, |
| 1981 | 249, 249, 249, 249, 249, 249, 250, 250, 251, 251, |
| 1982 | 251, 251, 251, 251, 251, 251, 251 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 1983 | }; |
| 1984 | |
| 1985 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 1986 | static const yytype_uint8 yyr2[] = |
| 1987 | { |
| 1988 | 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1989 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1990 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1991 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1992 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1993 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 1994 | 1, 1, 1, 1, 1, 0, 4, 0, 2, 0, |
| 1995 | 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, |
| 1996 | 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, |
| 1997 | 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, |
| 1998 | 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, |
| 1999 | 1, 1, 1, 1, 2, 0, 2, 1, 1, 1, |
| 2000 | 1, 1, 1, 0, 2, 0, 2, 0, 2, 0, |
| 2001 | 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, |
| 2002 | 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, |
| 2003 | 5, 5, 5, 5, 3, 2, 5, 4, 2, 1, |
| 2004 | 1, 1, 3, 1, 3, 1, 0, 1, 3, 4, |
| 2005 | 3, 3, 4, 4, 3, 6, 5, 2, 2, 2, |
| 2006 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2007 | 5, 8, 6, 6, 7, 7, 7, 7, 6, 8, |
| 2008 | 8, 3, 1, 1, 1, 1, 0, 2, 6, 1, |
| 2009 | 0, 1, 2, 0, 3, 0, 3, 3, 3, 3, |
| 2010 | 0, 8, 0, 9, 0, 9, 5, 2, 3, 1, |
| 2011 | 3, 3, 3, 3, 1, 0, 5, 3, 1, 3, |
| 2012 | 1, 0, 10, 1, 1, 4, 1, 1, 2, 3, |
| 2013 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 2014 | 3, 1, 5, 1, 1, 1, 1, 1, 1, 2, |
| 2015 | 1, 3, 2, 2, 3, 2, 0, 1, 2, 2, |
| 2016 | 3, 9, 9, 8, 14, 1, 1, 6, 5, 2, |
| 2017 | 6, 7, 4, 4, 6, 6, 0, 0, 3, 2, |
| 2018 | 1, 5, 5, 6, 6, 6, 6, 4, 6, 4, |
| 2019 | 4, 6, 6, 2, 8, 1, 1, 0, 3, 6, |
| 2020 | 3, 6, 2, 5, 7, 5, 4 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2021 | }; |
| 2022 | |
| 2023 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 2024 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 2025 | means the default is an error. */ |
| 2026 | static const yytype_uint16 yydefact[] = |
| 2027 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2028 | 73, 61, 70, 62, 71, 63, 215, 213, 0, 0, |
| 2029 | 0, 0, 0, 0, 83, 72, 0, 73, 211, 87, |
| 2030 | 90, 0, 0, 227, 0, 0, 68, 0, 74, 75, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2031 | 77, 76, 78, 80, 79, 81, 82, 84, 85, 86, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2032 | 83, 83, 206, 1, 212, 88, 89, 83, 216, 91, |
| 2033 | 92, 93, 94, 83, 276, 214, 276, 0, 0, 235, |
| 2034 | 228, 229, 217, 263, 264, 219, 138, 139, 140, 143, |
| 2035 | 142, 141, 144, 145, 0, 0, 0, 0, 265, 266, |
| 2036 | 146, 218, 148, 206, 206, 95, 205, 0, 98, 98, |
| 2037 | 277, 273, 69, 246, 247, 248, 272, 230, 231, 234, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2038 | 0, 166, 149, 0, 0, 0, 0, 155, 167, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2039 | 0, 166, 0, 0, 0, 97, 96, 0, 203, 204, |
| 2040 | 0, 0, 99, 100, 101, 102, 103, 0, 249, 0, |
| 2041 | 317, 275, 0, 232, 165, 115, 161, 163, 0, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2042 | 0, 0, 0, 0, 154, 0, 0, 147, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2043 | 160, 0, 159, 0, 226, 138, 139, 140, 143, 142, |
| 2044 | 141, 0, 0, 67, 67, 104, 0, 243, 244, 245, |
| 2045 | 316, 300, 0, 0, 0, 0, 98, 285, 286, 2, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2046 | 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, |
| 2047 | 16, 11, 12, 13, 0, 0, 0, 0, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2048 | 0, 0, 17, 18, 19, 20, 21, 22, 23, 24, |
| 2049 | 25, 26, 27, 28, 0, 0, 0, 0, 0, 0, |
| 2050 | 0, 0, 0, 0, 274, 98, 289, 0, 315, 233, |
| 2051 | 158, 0, 123, 67, 67, 157, 0, 168, 0, 123, |
| 2052 | 67, 67, 0, 207, 186, 187, 182, 184, 183, 185, |
| 2053 | 188, 181, 177, 178, 0, 0, 0, 0, 0, 0, |
| 2054 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2055 | 180, 179, 220, 0, 299, 279, 67, 270, 278, 0, |
| 2056 | 0, 55, 0, 0, 29, 30, 31, 32, 33, 34, |
| 2057 | 35, 36, 37, 38, 0, 53, 54, 49, 50, 51, |
| 2058 | 52, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
| 2059 | 48, 0, 0, 0, 129, 129, 322, 67, 67, 313, |
| 2060 | 0, 0, 0, 0, 0, 67, 67, 67, 0, 0, |
| 2061 | 0, 0, 0, 106, 108, 107, 105, 109, 110, 111, |
| 2062 | 112, 113, 116, 164, 162, 151, 152, 153, 156, 66, |
| 2063 | 150, 222, 224, 0, 0, 0, 0, 0, 0, 0, |
| 2064 | 0, 0, 0, 170, 202, 0, 0, 0, 174, 0, |
| 2065 | 171, 0, 0, 0, 134, 241, 252, 253, 254, 259, |
| 2066 | 255, 256, 257, 258, 250, 0, 261, 268, 267, 269, |
| 2067 | 0, 0, 280, 0, 0, 67, 67, 67, 67, 0, |
| 2068 | 318, 0, 320, 297, 0, 0, 0, 0, 0, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2069 | 0, 0, 0, 0, 0, 0, 67, 0, 114, 120, |
| 2070 | 119, 117, 118, 121, 122, 124, 134, 134, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2071 | 0, 0, 0, 297, 0, 0, 0, 0, 0, 169, |
| 2072 | 155, 167, 0, 172, 173, 0, 0, 0, 0, 221, |
| 2073 | 240, 115, 238, 0, 251, 0, 0, 271, 0, 0, |
| 2074 | 0, 0, 0, 0, 0, 0, 0, 0, 326, 0, |
| 2075 | 0, 0, 309, 310, 0, 0, 0, 0, 0, 307, |
| 2076 | 0, 129, 0, 223, 225, 67, 0, 0, 0, 0, |
| 2077 | 0, 0, 0, 0, 0, 201, 176, 0, 0, 0, |
| 2078 | 0, 0, 0, 136, 134, 65, 0, 123, 0, 260, |
| 2079 | 0, 0, 296, 0, 0, 0, 0, 129, 130, 129, |
| 2080 | 0, 0, 0, 0, 0, 0, 325, 301, 302, 296, |
| 2081 | 0, 323, 67, 208, 0, 0, 0, 0, 190, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2082 | 0, 0, 0, 175, 0, 0, 67, 131, 137, 135, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2083 | 64, 237, 239, 115, 132, 0, 0, 0, 115, 115, |
| 2084 | 0, 303, 304, 305, 306, 319, 321, 298, 0, 0, |
| 2085 | 308, 311, 312, 0, 129, 0, 0, 0, 0, 0, |
| 2086 | 198, 0, 0, 192, 193, 189, 65, 133, 127, 262, |
| 2087 | 0, 0, 0, 0, 123, 0, 290, 0, 123, 324, |
| 2088 | 194, 195, 196, 197, 0, 0, 0, 236, 0, 125, |
| 2089 | 0, 283, 0, 0, 106, 108, 115, 115, 0, 115, |
| 2090 | 115, 291, 314, 191, 199, 200, 128, 0, 242, 281, |
| 2091 | 0, 282, 0, 293, 292, 0, 0, 0, 126, 0, |
| 2092 | 0, 0, 115, 115, 0, 0, 0, 295, 294, 288, |
| 2093 | 0, 0, 287, 0, 284 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2094 | }; |
| 2095 | |
| 2096 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 2097 | static const yytype_int16 yydefgoto[] = |
| 2098 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2099 | -1, 267, 268, 269, 294, 311, 161, 162, 78, 551, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2100 | 112, 12, 79, 14, 15, 40, 41, 42, 47, 53, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2101 | 117, 127, 342, 230, 425, 345, 628, 609, 400, 503, |
| 2102 | 588, 449, 504, 80, 163, 136, 153, 137, 138, 109, |
| 2103 | 364, 386, 365, 120, 87, 154, 16, 17, 18, 20, |
| 2104 | 19, 374, 426, 427, 62, 23, 60, 100, 452, 453, |
| 2105 | 128, 169, 54, 95, 55, 48, 455, 387, 82, 389, |
| 2106 | 277, 278, 56, 91, 92, 224, 613, 131, 319, 560, |
| 2107 | 468, 225, 226, 227, 228 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2108 | }; |
| 2109 | |
| 2110 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 2111 | STATE-NUM. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2112 | #define YYPACT_NINF -572 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2113 | static const yytype_int16 yypact[] = |
| 2114 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2115 | 445, -572, -572, -572, -572, -572, -572, -572, -2, -122, |
| 2116 | 19, -58, 90, -40, 26, -572, 112, 855, -572, 52, |
| 2117 | 217, -28, 4, -572, 12, 146, -572, 1594, -572, -572, |
| 2118 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2119 | 70, 70, 125, -572, -572, -572, -572, 70, -572, -572, |
| 2120 | -572, -572, -572, 70, 166, -572, -8, 176, 185, 201, |
| 2121 | -572, -572, -572, -572, -572, 80, -572, -572, -572, -572, |
| 2122 | -572, -572, -572, -572, 232, 241, 2, 227, -572, -572, |
| 2123 | -572, -1, -572, 211, 211, 137, -572, 118, 258, 258, |
| 2124 | -572, -572, 87, -572, -572, -572, -572, -572, -572, -572, |
| 2125 | -57, 1357, -572, 105, 139, 1020, 80, -572, -1, -107, |
| 2126 | 109, 1357, 145, 118, 118, -572, -572, 1400, -572, -572, |
| 2127 | 1634, 302, -572, -572, -572, -572, -572, 1677, -572, -16, |
| 2128 | 1856, -572, 290, -572, -572, -1, -572, 159, 177, 1695, |
| 2129 | 1695, 179, -102, 1695, -572, 331, 189, -572, 1634, 1695, |
| 2130 | 80, 186, -1, 247, -572, 226, 335, 338, 339, 342, |
| 2131 | 344, 269, 345, 1123, 303, -572, 24, -572, -572, -572, |
| 2132 | -572, -572, 300, 1752, 76, 347, 258, -572, -572, -572, |
| 2133 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2134 | -572, -572, -572, -572, 314, 845, 314, 845, 1695, 1695, |
| 2135 | 1695, 1695, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2136 | -572, -572, -572, -572, 1695, 1695, 1695, 1695, 1695, 1695, |
| 2137 | 1695, 1695, 1695, 1695, -572, 258, -572, 97, -572, -572, |
| 2138 | 172, 1418, -572, -43, -31, -572, 196, -1, 206, -572, |
| 2139 | 303, -12, 1400, -572, -572, -572, -572, -572, -572, -572, |
| 2140 | -572, -572, -572, -572, 314, 845, 314, 845, 208, 216, |
| 2141 | 219, 220, 223, 1473, 1795, 1063, 348, 224, 225, 234, |
| 2142 | -572, -572, -572, 237, -572, 80, 843, -572, 238, 524, |
| 2143 | 524, -572, 524, 1677, -572, -572, -572, -572, -572, -572, |
| 2144 | -572, -572, -572, -572, 1695, -572, -572, -572, -572, -572, |
| 2145 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2146 | -572, 1695, 1695, 1695, 27, 29, -572, 843, -23, 248, |
| 2147 | 249, 263, 264, 265, 266, 843, 843, 843, 341, 1677, |
| 2148 | 1695, 1695, 389, -572, -572, -572, -572, -572, -572, -572, |
| 2149 | -572, -572, -572, -572, -572, 198, -572, -572, -572, -572, |
| 2150 | 198, -572, 145, 359, 250, 270, 271, 272, 1634, 1634, |
| 2151 | 1634, 1634, 1634, -572, -572, -30, 1314, -104, -572, -101, |
| 2152 | -572, 1634, 1634, 1634, 275, 1518, -572, -572, -572, -572, |
| 2153 | -572, -572, -572, -572, 366, 1634, -572, -572, -572, -572, |
| 2154 | 1695, 276, -572, 277, 524, 843, 843, 843, 843, 25, |
| 2155 | -572, 35, -572, -572, 524, 278, 1695, 1695, 1695, 1695, |
| 2156 | 1695, 280, 282, 283, 1695, 524, 843, 287, -572, -572, |
| 2157 | -572, -572, -572, -572, -572, -572, 275, 275, 1695, 1634, |
| 2158 | 1634, 1634, 1634, -572, 291, 292, 293, 294, 1634, -572, |
| 2159 | 288, 975, -99, -572, -572, 296, 297, 408, 9, -572, |
| 2160 | -572, -1, 299, 304, -572, 435, -96, -572, 442, 443, |
| 2161 | 308, 306, 310, 325, 326, 524, 479, 524, 328, 329, |
| 2162 | 524, 334, -1, -572, 336, 337, 487, 524, 524, -1, |
| 2163 | 349, 350, 1695, -572, -572, -20, 351, 352, 353, 354, |
| 2164 | 102, 1634, 1634, 1634, 1634, -572, -572, 356, 1634, 1634, |
| 2165 | 1695, 489, 497, -572, 275, 571, 1576, -572, 357, -572, |
| 2166 | 524, 524, 1853, 524, 524, 524, 524, 350, -572, 350, |
| 2167 | 1695, 524, 358, 1695, 1695, 1695, -572, -572, -572, 1853, |
| 2168 | 459, -572, 843, -572, 1634, 1634, 1634, 1634, -572, 360, |
| 2169 | 369, 364, 368, -572, 371, 376, -15, -572, -572, -572, |
| 2170 | -572, -572, -572, -1, 6, 512, 380, 378, 71, -1, |
| 2171 | 171, -572, -572, -572, -572, -572, -572, -572, 379, 524, |
| 2172 | -572, -572, -572, 174, 350, 385, 387, 388, 391, 1634, |
| 2173 | -572, 1634, 1634, -572, -572, -572, 571, -572, 499, -572, |
| 2174 | 536, -6, 699, 699, -572, 1871, -572, 393, -572, -572, |
| 2175 | -572, -572, -572, -572, 401, 407, 409, -572, 558, 418, |
| 2176 | 524, -572, 1265, -3, 415, 417, -572, -572, -19, 71, |
| 2177 | -1, -572, 198, -572, -572, -572, -572, 549, -572, -572, |
| 2178 | 416, -572, 1265, 172, 172, 556, 699, 699, -572, 557, |
| 2179 | 419, 524, -572, -572, 524, 559, 507, 172, 172, -572, |
| 2180 | 524, 563, -572, 524, -572 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2181 | }; |
| 2182 | |
| 2183 | /* YYPGOTO[NTERM-NUM]. */ |
| 2184 | static const yytype_int16 yypgoto[] = |
| 2185 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2186 | -572, 451, 453, 454, -174, -152, -173, -572, 0, 1, |
| 2187 | -146, 493, 3, -572, -572, -572, -572, 49, -572, -572, |
| 2188 | -572, -139, -572, -416, -572, -223, -572, -572, -311, 34, |
| 2189 | -572, -397, -572, -572, -26, 361, -120, -572, 478, 486, |
| 2190 | -64, -153, -250, 164, 207, 355, -572, -572, 577, -572, |
| 2191 | -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, |
| 2192 | 528, -572, -572, -572, -572, -572, -572, -571, -115, 162, |
| 2193 | -191, -572, -572, 540, -572, -572, -572, -572, -572, 89, |
| 2194 | 187, -572, -572, -572, -572 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2195 | }; |
| 2196 | |
| 2197 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 2198 | positive, shift that token. If negative, reduce the rule which |
| 2199 | number is the opposite. If zero, do what YYDEFACT says. |
| 2200 | If YYTABLE_NINF, syntax error. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2201 | #define YYTABLE_NINF -211 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2202 | static const yytype_int16 yytable[] = |
| 2203 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2204 | 11, 81, 282, 13, 402, 281, 104, 166, 281, 316, |
| 2205 | 270, 110, 167, 90, 367, 369, 350, 11, 272, 635, |
| 2206 | 13, 93, 312, 110, 320, 321, 322, 323, 324, 483, |
| 2207 | 484, 110, 328, 24, 110, 505, 465, 283, 243, 110, |
| 2208 | 501, 630, 110, 501, 2, 313, 467, 4, 271, 143, |
| 2209 | 21, 108, 438, 110, 143, 438, 164, 438, 144, 443, |
| 2210 | 438, 640, 502, 236, 444, 22, 497, 509, 29, 30, |
| 2211 | 31, 32, 33, 34, 35, 135, 36, 25, 466, 108, |
| 2212 | 354, 110, 356, 110, 240, 135, 329, 279, 466, 83, |
| 2213 | 84, 152, 11, 280, 351, 352, 88, 26, 45, 132, |
| 2214 | 46, 152, 89, 355, 133, 357, 1, 549, 27, 3, |
| 2215 | 111, 5, 43, 233, 234, 28, 442, 237, 346, 419, |
| 2216 | 420, 421, 111, 241, 422, -144, 438, 57, 423, 424, |
| 2217 | 111, 439, 347, 111, 533, 456, 404, 586, 111, 585, |
| 2218 | 417, 111, 592, 593, 419, 420, 421, 276, 168, 422, |
| 2219 | 118, 119, 111, 423, 424, 611, -67, 94, 631, 58, |
| 2220 | 85, 388, 86, 394, 388, 388, 105, 388, 61, 273, |
| 2221 | 531, 59, 314, 315, 276, 317, 37, 38, 39, 115, |
| 2222 | 111, 116, 111, 399, -67, 401, -67, 90, 318, 276, |
| 2223 | 276, 276, 276, 276, 325, 326, 327, 276, 97, 457, |
| 2224 | 633, 634, 388, 636, 637, 135, 565, 98, 566, 415, |
| 2225 | 388, 388, 388, 330, 331, 471, 152, 473, 474, 475, |
| 2226 | 37, 38, 39, 99, -144, 332, 647, 648, -144, -55, |
| 2227 | -55, -55, -55, 101, 63, 64, 102, 106, 66, 67, |
| 2228 | 68, 69, 70, 71, 72, 103, 1, 2, 86, 3, |
| 2229 | 4, 5, 244, 245, 63, 64, 538, 152, 520, 49, |
| 2230 | 50, 51, 145, 599, 52, 139, 1, 2, 395, 3, |
| 2231 | 4, 5, 246, 247, 248, 249, 73, 148, 149, 388, |
| 2232 | 388, 388, 388, 388, 554, 396, 397, 398, 270, 388, |
| 2233 | 113, 114, 333, 334, 433, 434, 435, 436, 437, 140, |
| 2234 | 388, 388, 147, 152, 416, 276, 165, 445, 446, 447, |
| 2235 | 335, 336, 229, 337, 338, 231, 339, 340, 341, 121, |
| 2236 | 122, 123, 124, 125, 126, 594, 271, 595, 598, 567, |
| 2237 | 595, 232, 570, 571, 572, 238, 419, 420, 421, 242, |
| 2238 | 441, 422, 235, 239, -56, 423, 424, -57, -60, 451, |
| 2239 | 388, -59, 388, -58, 250, 388, 274, 110, 281, 348, |
| 2240 | 349, 358, 388, 388, 276, 486, 487, 488, 489, 359, |
| 2241 | 370, 618, 360, 361, 495, 622, 362, 371, 372, 414, |
| 2242 | 276, 472, 276, 276, 276, 74, 75, 373, 479, 76, |
| 2243 | 375, 77, 107, 418, 390, 388, 388, 428, 388, 388, |
| 2244 | 388, 388, 485, 429, 405, 406, 388, 284, 285, 286, |
| 2245 | 287, 288, 289, 290, 291, 292, 293, 388, 612, 407, |
| 2246 | 408, 409, 410, 430, 431, 432, 454, 539, 540, 541, |
| 2247 | 542, 448, 458, 459, 544, 545, 476, 470, 477, 478, |
| 2248 | 632, 391, 392, 482, 393, -210, 500, 491, 492, 493, |
| 2249 | 494, 496, 498, 499, 388, 506, 532, 508, 507, 510, |
| 2250 | 511, 512, 513, -69, 1, 2, 514, 3, 4, 5, |
| 2251 | 575, 576, 577, 578, 546, 6, 7, 388, 388, 403, |
| 2252 | 553, 515, 516, 518, 520, 521, 559, 411, 412, 413, |
| 2253 | 523, 526, 524, 525, 276, 388, 8, 276, 276, 276, |
| 2254 | 9, 548, 529, 559, 10, 550, 530, 534, 535, 536, |
| 2255 | 537, 547, 466, 555, 569, 604, 579, 605, 606, 543, |
| 2256 | 581, 388, 388, 580, 582, 583, 388, 376, 377, 388, |
| 2257 | 584, 63, 64, 378, 589, 388, 590, 591, 388, 600, |
| 2258 | 596, 601, 602, 1, 2, 603, 3, 4, 5, 379, |
| 2259 | 380, 381, 608, 610, 621, 623, 460, 461, 462, 463, |
| 2260 | 464, 624, 626, 625, 382, 383, 469, 627, -18, 620, |
| 2261 | -19, 638, 639, 641, 644, 645, 650, 480, 481, 651, |
| 2262 | 653, 221, 384, 222, 223, 130, 550, 607, 587, 146, |
| 2263 | 1, 142, 344, 3, 44, 5, 96, 353, 179, 180, |
| 2264 | 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, |
| 2265 | 191, 192, 193, 254, 255, 256, 257, 129, 573, 0, |
| 2266 | 490, 0, 0, 0, 332, 0, 0, 517, 0, 519, |
| 2267 | 0, 0, 522, 0, 0, 0, 0, 0, 0, 527, |
| 2268 | 528, 0, 258, 202, 203, 204, 205, 206, 207, 208, |
| 2269 | 209, 210, 211, 212, 213, 0, 259, 0, 260, 261, |
| 2270 | 262, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2271 | 0, 0, 556, 557, 0, 561, 562, 563, 564, 0, |
| 2272 | 0, 0, 0, 568, 0, 0, 385, 0, 0, 0, |
| 2273 | 0, 333, 334, 0, 574, 0, 0, 0, 0, 0, |
| 2274 | 0, 0, 376, 377, 0, 0, 63, 64, 378, 335, |
| 2275 | 336, 0, 337, 338, 0, 339, 340, 341, 1, 2, |
| 2276 | 0, 3, 4, 5, 379, 380, 381, 0, 0, 0, |
| 2277 | 0, 597, 0, 0, 0, 0, 0, 0, 0, 382, |
| 2278 | 383, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2279 | 0, 0, 332, 0, 616, 617, 0, 384, 0, 0, |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2280 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2281 | 0, 0, 629, 179, 180, 181, 182, 183, 184, 185, |
| 2282 | 186, 187, 188, 189, 190, 191, 192, 193, 254, 255, |
| 2283 | 256, 257, 0, 0, 0, 0, 0, 0, 642, 643, |
| 2284 | 0, 0, 0, 646, 0, 0, 649, 0, 0, 0, |
| 2285 | 0, 0, 652, 0, 0, 654, 0, 258, 202, 614, |
| 2286 | 615, 205, 206, 207, 208, 209, 210, 211, 212, 213, |
| 2287 | 0, 259, 0, 260, 261, 262, 0, 335, 336, 0, |
| 2288 | 337, 338, 0, 339, 340, 341, 376, 377, 0, 0, |
| 2289 | 63, 64, 378, 0, 0, -209, 0, 0, 0, 0, |
| 2290 | 0, 385, 1, 2, 0, 3, 4, 5, 379, 380, |
| 2291 | 381, 295, 296, -69, 1, 2, 0, 3, 4, 5, |
| 2292 | 0, 0, 0, 382, 383, 6, 7, 0, 0, 0, |
| 2293 | 0, 0, 0, 0, 0, 0, 0, 110, 0, 0, |
| 2294 | 0, 384, 0, 0, 0, 0, 8, 0, 0, 0, |
| 2295 | 9, 0, 0, 0, 10, 0, 0, 179, 180, 181, |
| 2296 | 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, |
| 2297 | 192, 193, 254, 255, 256, 257, 0, 0, 0, 0, |
| 2298 | 0, 0, 0, 0, 297, 298, 299, 300, 301, 302, |
| 2299 | 303, 304, 305, 306, 307, 308, 309, 310, 0, 0, |
| 2300 | 0, 258, 202, 203, 204, 205, 206, 207, 208, 209, |
| 2301 | 210, 211, 212, 213, 0, 259, 0, 260, 261, 262, |
| 2302 | 0, 0, 63, 64, 0, 0, 0, 0, 0, 0, |
| 2303 | 0, 0, 0, 0, 1, 2, 111, 3, 4, 5, |
| 2304 | 251, 0, 0, 0, 0, 385, 0, 0, 0, 0, |
| 2305 | 0, 0, 0, 0, 0, 252, 253, 0, 0, 0, |
| 2306 | 0, 0, 0, 0, 0, 0, 0, 63, 64, 110, |
| 2307 | 106, 66, 67, 68, 69, 70, 71, 72, 0, 1, |
| 2308 | 2, 0, 3, 4, 5, 0, 0, 0, 0, 179, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2309 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2310 | 190, 191, 192, 193, 254, 255, 256, 257, 0, 73, |
| 2311 | 63, 64, 0, 106, 155, 156, 157, 158, 159, 160, |
| 2312 | 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2313 | 0, 0, 0, 258, 202, 203, 204, 205, 206, 207, |
| 2314 | 208, 209, 210, 211, 212, 213, 0, 259, 0, 260, |
| 2315 | 261, 262, 73, 0, 0, 0, 0, 0, 0, 0, |
| 2316 | 0, 0, 0, 0, 0, 0, 0, 0, 111, 0, |
| 2317 | 63, 64, -67, 0, 263, 0, 0, 264, 0, 265, |
| 2318 | 0, 266, 1, 2, 0, 3, 4, 5, 251, 0, |
| 2319 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2320 | 0, 0, 0, 252, 253, 0, 0, 0, 0, 0, |
| 2321 | 0, 0, 0, 0, 0, 0, 0, 110, 74, 75, |
| 2322 | 0, 0, 76, 0, 77, 141, 0, 0, 0, 0, |
| 2323 | 0, 0, 0, 0, 0, 0, 0, 179, 180, 181, |
| 2324 | 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, |
| 2325 | 192, 193, 254, 255, 256, 257, 0, 0, 0, 0, |
| 2326 | 0, 74, 75, 0, 0, 76, 0, 77, 368, 0, |
| 2327 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2328 | 0, 258, 202, 203, 204, 205, 206, 207, 208, 209, |
| 2329 | 210, 211, 212, 213, 0, 259, 0, 260, 261, 262, |
| 2330 | 0, 0, 0, 0, 0, 0, 0, 0, 376, 377, |
| 2331 | 0, 0, 0, 0, 378, 0, 111, 0, 0, 0, |
| 2332 | 0, 0, 263, 0, 0, 264, 0, 265, 0, 266, |
| 2333 | 379, 380, 381, 0, 0, 0, 0, 0, 0, 0, |
| 2334 | 0, 0, 0, 0, 0, 382, 383, 0, 0, 0, |
| 2335 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2336 | 0, 63, 64, 384, 106, 155, 156, 157, 158, 159, |
| 2337 | 160, 72, 0, 1, 2, 0, 3, 4, 5, 179, |
| 2338 | 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, |
| 2339 | 190, 191, 192, 193, 254, 255, 256, 257, 0, 0, |
| 2340 | 0, 0, 0, 73, 63, 64, 0, 106, 66, 67, |
| 2341 | 68, 69, 70, 71, 72, 0, 1, 2, 0, 3, |
| 2342 | 4, 5, 0, 258, 202, 203, 204, 205, 206, 207, |
| 2343 | 208, 209, 210, 211, 212, 213, 134, 259, 0, 260, |
| 2344 | 261, 262, 0, 0, 0, 0, 73, 63, 64, 0, |
| 2345 | 150, 66, 67, 68, 69, 70, 71, 72, 0, 1, |
| 2346 | 2, 0, 3, 4, 5, 63, 64, 385, 106, 66, |
| 2347 | 67, 68, 69, 70, 71, 72, 0, 1, 2, 0, |
| 2348 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 73, |
| 2349 | 0, 0, 0, 0, 0, 0, 0, 343, 0, 0, |
| 2350 | 0, 0, 0, 0, 0, 0, 0, 73, 0, 0, |
| 2351 | 0, 0, 74, 75, 0, 0, 76, 0, 77, 440, |
| 2352 | 63, 64, 0, 106, 155, 156, 157, 158, 159, 160, |
| 2353 | 72, 0, 1, 2, 0, 3, 4, 5, 0, 0, |
| 2354 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2355 | 0, 0, 0, 0, 0, 74, 75, 0, 0, 76, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2356 | 0, 77, 73, 0, 151, 63, 64, 0, 106, 66, |
| 2357 | 67, 68, 69, 70, 71, 72, 0, 1, 2, 0, |
| 2358 | 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, |
| 2359 | 0, 0, 0, 0, 0, 0, 0, 450, 74, 75, |
| 2360 | 0, 0, 76, 0, 77, 0, 0, 73, 0, 0, |
| 2361 | 0, 0, 0, 0, 0, 0, 74, 75, 0, 0, |
| 2362 | 76, 0, 77, 63, 64, 0, 106, 66, 67, 68, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2363 | 69, 70, 71, 72, 0, 1, 2, 0, 3, 4, |
| 2364 | 5, 63, 64, 0, 65, 66, 67, 68, 69, 70, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2365 | 71, 72, 0, 1, 2, 552, 3, 4, 5, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2366 | 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2367 | 0, 74, 75, 0, 363, 76, 0, 77, 0, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2368 | 0, 63, 64, 73, 106, 155, 156, 157, 158, 159, |
| 2369 | 160, 72, 0, 1, 2, 0, 3, 4, 5, 0, |
| 2370 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2371 | 0, 0, 0, 0, 0, 0, 74, 75, 0, 0, |
| 2372 | 76, 0, 77, 73, 63, 64, 0, 150, 66, 67, |
| 2373 | 68, 69, 70, 71, 72, 0, 1, 2, 0, 3, |
| 2374 | 4, 5, 63, 64, 0, 106, 66, 67, 68, 69, |
| 2375 | 70, 71, 72, 0, 1, 2, 0, 3, 4, 5, |
| 2376 | 0, 0, 0, 0, 0, 0, 73, 0, 0, 0, |
| 2377 | 0, 0, 0, 0, 74, 75, 0, 0, 76, 0, |
| 2378 | 77, 0, 0, 0, 73, 0, 0, 0, 0, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2379 | 0, 0, 74, 75, 0, 0, 76, 0, 77, 63, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2380 | 64, 0, 275, 66, 67, 68, 69, 70, 71, 72, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2381 | 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, |
| 2382 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 2383 | 0, 0, 74, 75, 0, 0, 76, 0, 77, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2384 | 0, 73, 63, 64, 0, 106, 155, 156, 157, 158, |
| 2385 | 159, 160, 72, 0, 1, 2, 0, 3, 4, 5, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2386 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2387 | 0, 0, 0, 0, 0, 74, 75, 0, 0, 76, |
| 2388 | 0, 77, 0, 0, 73, 0, 0, 0, 0, 0, |
| 2389 | 0, 0, 0, 74, 75, 0, 0, 76, 0, 77, |
| 2390 | 63, 64, 0, 106, 66, 67, 68, 69, 70, 71, |
| 2391 | 558, 0, 1, 2, 0, 3, 4, 5, 63, 64, |
| 2392 | 0, 106, 66, 67, 68, 69, 70, 71, 619, 0, |
| 2393 | 1, 2, 170, 3, 4, 5, 0, 0, 0, 0, |
| 2394 | 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, |
| 2395 | 74, 75, 171, 172, 76, 0, 77, 0, 0, 0, |
| 2396 | 73, 0, 0, 0, 173, 174, 175, 176, 177, 178, |
| 2397 | 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, |
| 2398 | 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, |
| 2399 | 0, 0, 0, 74, 75, 0, 0, 76, 0, 366, |
| 2400 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 198, |
| 2401 | 199, 200, 0, 0, 201, 202, 203, 204, 205, 206, |
| 2402 | 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, |
| 2403 | 217, 218, 219, 220, 0, 0, 0, 0, 0, 0, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2404 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2405 | 0, 74, 75, 0, 0, 76, 0, 77, 0, 0, |
| 2406 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, |
| 2407 | 75, 0, 0, 76, 0, 77 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2408 | }; |
| 2409 | |
| 2410 | static const yytype_int16 yycheck[] = |
| 2411 | { |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2412 | 0, 27, 175, 0, 315, 11, 4, 127, 11, 200, |
| 2413 | 163, 54, 28, 21, 264, 265, 239, 17, 164, 38, |
| 2414 | 17, 29, 196, 54, 215, 216, 217, 218, 219, 426, |
| 2415 | 427, 54, 223, 155, 54, 451, 11, 176, 153, 54, |
| 2416 | 34, 612, 54, 34, 20, 197, 11, 23, 163, 156, |
| 2417 | 52, 77, 156, 54, 156, 156, 120, 156, 165, 163, |
| 2418 | 156, 632, 53, 165, 165, 67, 165, 163, 42, 43, |
| 2419 | 44, 45, 46, 47, 48, 101, 50, 58, 53, 105, |
| 2420 | 254, 54, 256, 54, 148, 111, 225, 11, 53, 40, |
| 2421 | 41, 117, 92, 17, 240, 241, 47, 155, 46, 156, |
| 2422 | 48, 127, 53, 255, 161, 257, 19, 504, 18, 22, |
| 2423 | 153, 24, 0, 139, 140, 155, 366, 143, 161, 138, |
| 2424 | 139, 140, 153, 149, 143, 54, 156, 155, 147, 148, |
| 2425 | 153, 161, 163, 153, 154, 385, 159, 553, 153, 154, |
| 2426 | 331, 153, 558, 559, 138, 139, 140, 173, 164, 143, |
| 2427 | 32, 33, 153, 147, 148, 161, 157, 165, 161, 155, |
| 2428 | 35, 276, 37, 283, 279, 280, 164, 282, 22, 166, |
| 2429 | 481, 159, 198, 199, 200, 201, 150, 151, 152, 42, |
| 2430 | 153, 44, 153, 156, 157, 156, 157, 21, 214, 215, |
| 2431 | 216, 217, 218, 219, 220, 221, 222, 223, 22, 390, |
| 2432 | 616, 617, 317, 619, 620, 231, 517, 22, 519, 329, |
| 2433 | 325, 326, 327, 116, 117, 406, 242, 408, 409, 410, |
| 2434 | 150, 151, 152, 22, 153, 53, 642, 643, 157, 3, |
| 2435 | 4, 5, 6, 153, 7, 8, 4, 10, 11, 12, |
| 2436 | 13, 14, 15, 16, 17, 4, 19, 20, 37, 22, |
| 2437 | 23, 24, 26, 27, 7, 8, 154, 283, 156, 42, |
| 2438 | 43, 44, 153, 574, 47, 160, 19, 20, 294, 22, |
| 2439 | 23, 24, 3, 4, 5, 6, 49, 113, 114, 394, |
| 2440 | 395, 396, 397, 398, 507, 311, 312, 313, 441, 404, |
| 2441 | 83, 84, 120, 121, 358, 359, 360, 361, 362, 160, |
| 2442 | 415, 416, 157, 329, 330, 331, 4, 371, 372, 373, |
| 2443 | 138, 139, 22, 141, 142, 156, 144, 145, 146, 61, |
| 2444 | 62, 63, 64, 65, 66, 154, 441, 156, 154, 520, |
| 2445 | 156, 154, 523, 524, 525, 4, 138, 139, 140, 153, |
| 2446 | 366, 143, 163, 154, 9, 147, 148, 9, 9, 375, |
| 2447 | 465, 9, 467, 9, 9, 470, 56, 54, 11, 163, |
| 2448 | 154, 153, 477, 478, 390, 429, 430, 431, 432, 153, |
| 2449 | 22, 594, 153, 153, 438, 598, 153, 153, 153, 38, |
| 2450 | 406, 407, 408, 409, 410, 158, 159, 153, 414, 162, |
| 2451 | 153, 164, 165, 4, 156, 510, 511, 38, 513, 514, |
| 2452 | 515, 516, 428, 153, 156, 156, 521, 93, 94, 95, |
| 2453 | 96, 97, 98, 99, 100, 101, 102, 532, 591, 156, |
| 2454 | 156, 156, 156, 153, 153, 153, 60, 491, 492, 493, |
| 2455 | 494, 156, 156, 156, 498, 499, 156, 159, 156, 156, |
| 2456 | 613, 279, 280, 156, 282, 0, 38, 156, 156, 156, |
| 2457 | 156, 163, 156, 156, 569, 156, 482, 22, 154, 17, |
| 2458 | 17, 153, 156, 18, 19, 20, 156, 22, 23, 24, |
| 2459 | 534, 535, 536, 537, 500, 30, 31, 592, 593, 317, |
| 2460 | 506, 156, 156, 4, 156, 156, 512, 325, 326, 327, |
| 2461 | 156, 4, 156, 156, 520, 610, 51, 523, 524, 525, |
| 2462 | 55, 4, 153, 529, 59, 505, 156, 156, 156, 156, |
| 2463 | 156, 22, 53, 156, 156, 579, 156, 581, 582, 163, |
| 2464 | 156, 636, 637, 154, 156, 154, 641, 3, 4, 644, |
| 2465 | 154, 7, 8, 9, 22, 650, 156, 159, 653, 154, |
| 2466 | 161, 154, 154, 19, 20, 154, 22, 23, 24, 25, |
| 2467 | 26, 27, 53, 17, 161, 154, 394, 395, 396, 397, |
| 2468 | 398, 154, 4, 154, 40, 41, 404, 149, 153, 595, |
| 2469 | 153, 22, 156, 17, 17, 156, 17, 415, 416, 72, |
| 2470 | 17, 130, 58, 130, 130, 92, 586, 586, 554, 111, |
| 2471 | 19, 105, 231, 22, 17, 24, 56, 242, 74, 75, |
| 2472 | 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, |
| 2473 | 86, 87, 88, 89, 90, 91, 92, 89, 529, -1, |
| 2474 | 433, -1, -1, -1, 53, -1, -1, 465, -1, 467, |
| 2475 | -1, -1, 470, -1, -1, -1, -1, -1, -1, 477, |
| 2476 | 478, -1, 118, 119, 120, 121, 122, 123, 124, 125, |
| 2477 | 126, 127, 128, 129, 130, -1, 132, -1, 134, 135, |
| 2478 | 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2479 | -1, -1, 510, 511, -1, 513, 514, 515, 516, -1, |
| 2480 | -1, -1, -1, 521, -1, -1, 162, -1, -1, -1, |
| 2481 | -1, 120, 121, -1, 532, -1, -1, -1, -1, -1, |
| 2482 | -1, -1, 3, 4, -1, -1, 7, 8, 9, 138, |
| 2483 | 139, -1, 141, 142, -1, 144, 145, 146, 19, 20, |
| 2484 | -1, 22, 23, 24, 25, 26, 27, -1, -1, -1, |
| 2485 | -1, 569, -1, -1, -1, -1, -1, -1, -1, 40, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2486 | 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2487 | -1, -1, 53, -1, 592, 593, -1, 58, -1, -1, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2488 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2489 | -1, -1, 610, 74, 75, 76, 77, 78, 79, 80, |
| 2490 | 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, |
| 2491 | 91, 92, -1, -1, -1, -1, -1, -1, 636, 637, |
| 2492 | -1, -1, -1, 641, -1, -1, 644, -1, -1, -1, |
| 2493 | -1, -1, 650, -1, -1, 653, -1, 118, 119, 120, |
| 2494 | 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, |
| 2495 | -1, 132, -1, 134, 135, 136, -1, 138, 139, -1, |
| 2496 | 141, 142, -1, 144, 145, 146, 3, 4, -1, -1, |
| 2497 | 7, 8, 9, -1, -1, 0, -1, -1, -1, -1, |
| 2498 | -1, 162, 19, 20, -1, 22, 23, 24, 25, 26, |
| 2499 | 27, 26, 27, 18, 19, 20, -1, 22, 23, 24, |
| 2500 | -1, -1, -1, 40, 41, 30, 31, -1, -1, -1, |
| 2501 | -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, |
| 2502 | -1, 58, -1, -1, -1, -1, 51, -1, -1, -1, |
| 2503 | 55, -1, -1, -1, 59, -1, -1, 74, 75, 76, |
| 2504 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2505 | 87, 88, 89, 90, 91, 92, -1, -1, -1, -1, |
| 2506 | -1, -1, -1, -1, 99, 100, 101, 102, 103, 104, |
| 2507 | 105, 106, 107, 108, 109, 110, 111, 112, -1, -1, |
| 2508 | -1, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 2509 | 127, 128, 129, 130, -1, 132, -1, 134, 135, 136, |
| 2510 | -1, -1, 7, 8, -1, -1, -1, -1, -1, -1, |
| 2511 | -1, -1, -1, -1, 19, 20, 153, 22, 23, 24, |
| 2512 | 25, -1, -1, -1, -1, 162, -1, -1, -1, -1, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2513 | -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2514 | -1, -1, -1, -1, -1, -1, -1, 7, 8, 54, |
| 2515 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2516 | 20, -1, 22, 23, 24, -1, -1, -1, -1, 74, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2517 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2518 | 85, 86, 87, 88, 89, 90, 91, 92, -1, 49, |
| 2519 | 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, |
| 2520 | 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, |
| 2521 | -1, -1, -1, 118, 119, 120, 121, 122, 123, 124, |
| 2522 | 125, 126, 127, 128, 129, 130, -1, 132, -1, 134, |
| 2523 | 135, 136, 49, -1, -1, -1, -1, -1, -1, -1, |
| 2524 | -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, |
| 2525 | 7, 8, 157, -1, 159, -1, -1, 162, -1, 164, |
| 2526 | -1, 166, 19, 20, -1, 22, 23, 24, 25, -1, |
| 2527 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2528 | -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, |
| 2529 | -1, -1, -1, -1, -1, -1, -1, 54, 158, 159, |
| 2530 | -1, -1, 162, -1, 164, 165, -1, -1, -1, -1, |
| 2531 | -1, -1, -1, -1, -1, -1, -1, 74, 75, 76, |
| 2532 | 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, |
| 2533 | 87, 88, 89, 90, 91, 92, -1, -1, -1, -1, |
| 2534 | -1, 158, 159, -1, -1, 162, -1, 164, 165, -1, |
| 2535 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2536 | -1, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 2537 | 127, 128, 129, 130, -1, 132, -1, 134, 135, 136, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2538 | -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2539 | -1, -1, -1, -1, 9, -1, 153, -1, -1, -1, |
| 2540 | -1, -1, 159, -1, -1, 162, -1, 164, -1, 166, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2541 | 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, |
| 2542 | -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, |
| 2543 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2544 | -1, 7, 8, 58, 10, 11, 12, 13, 14, 15, |
| 2545 | 16, 17, -1, 19, 20, -1, 22, 23, 24, 74, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2546 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2547 | 85, 86, 87, 88, 89, 90, 91, 92, -1, -1, |
| 2548 | -1, -1, -1, 49, 7, 8, -1, 10, 11, 12, |
| 2549 | 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, |
| 2550 | 23, 24, -1, 118, 119, 120, 121, 122, 123, 124, |
| 2551 | 125, 126, 127, 128, 129, 130, 39, 132, -1, 134, |
| 2552 | 135, 136, -1, -1, -1, -1, 49, 7, 8, -1, |
| 2553 | 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, |
| 2554 | 20, -1, 22, 23, 24, 7, 8, 162, 10, 11, |
| 2555 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2556 | 22, 23, 24, -1, -1, -1, -1, -1, -1, 49, |
| 2557 | -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, |
| 2558 | -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, |
| 2559 | -1, -1, 158, 159, -1, -1, 162, -1, 164, 165, |
| 2560 | 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, |
| 2561 | 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, |
| 2562 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 2563 | -1, -1, -1, -1, -1, 158, 159, -1, -1, 162, |
| 2564 | -1, 164, 49, -1, 124, 7, 8, -1, 10, 11, |
| 2565 | 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, |
| 2566 | 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, |
| 2567 | -1, -1, -1, -1, -1, -1, -1, 39, 158, 159, |
| 2568 | -1, -1, 162, -1, 164, -1, -1, 49, -1, -1, |
| 2569 | -1, -1, -1, -1, -1, -1, 158, 159, -1, -1, |
| 2570 | 162, -1, 164, 7, 8, -1, 10, 11, 12, 13, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2571 | 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, |
| 2572 | 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, |
| 2573 | 16, 17, -1, 19, 20, 39, 22, 23, 24, -1, |
| 2574 | -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2575 | -1, 158, 159, -1, 161, 162, -1, 164, -1, -1, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2576 | -1, 7, 8, 49, 10, 11, 12, 13, 14, 15, |
| 2577 | 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, |
| 2578 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2579 | -1, -1, -1, -1, -1, -1, 158, 159, -1, -1, |
| 2580 | 162, -1, 164, 49, 7, 8, -1, 10, 11, 12, |
| 2581 | 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, |
| 2582 | 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2583 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
| 2584 | -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, |
| 2585 | -1, -1, -1, -1, 158, 159, -1, -1, 162, -1, |
| 2586 | 164, -1, -1, -1, 49, -1, -1, -1, -1, -1, |
| 2587 | -1, -1, 158, 159, -1, -1, 162, -1, 164, 7, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2588 | 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, |
| 2589 | -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, |
| 2590 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2591 | -1, -1, 158, 159, -1, -1, 162, -1, 164, -1, |
| 2592 | -1, 49, 7, 8, -1, 10, 11, 12, 13, 14, |
| 2593 | 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2594 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2595 | -1, -1, -1, -1, -1, 158, 159, -1, -1, 162, |
| 2596 | -1, 164, -1, -1, 49, -1, -1, -1, -1, -1, |
| 2597 | -1, -1, -1, 158, 159, -1, -1, 162, -1, 164, |
| 2598 | 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, |
| 2599 | 17, -1, 19, 20, -1, 22, 23, 24, 7, 8, |
| 2600 | -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, |
| 2601 | 19, 20, 36, 22, 23, 24, -1, -1, -1, -1, |
| 2602 | -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, |
| 2603 | 158, 159, 56, 57, 162, -1, 164, -1, -1, -1, |
| 2604 | 49, -1, -1, -1, 68, 69, 70, 71, 72, 73, |
| 2605 | 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, |
| 2606 | 84, 85, 86, 87, 88, 89, 90, 91, 92, -1, |
| 2607 | -1, -1, -1, 158, 159, -1, -1, 162, -1, 164, |
| 2608 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 113, |
| 2609 | 114, 115, -1, -1, 118, 119, 120, 121, 122, 123, |
| 2610 | 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, |
| 2611 | 134, 135, 136, 137, -1, -1, -1, -1, -1, -1, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2612 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2613 | -1, 158, 159, -1, -1, 162, -1, 164, -1, -1, |
| 2614 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 158, |
| 2615 | 159, -1, -1, 162, -1, 164 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2616 | }; |
| 2617 | |
| 2618 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 2619 | symbol of state STATE-NUM. */ |
| 2620 | static const yytype_uint8 yystos[] = |
| 2621 | { |
| 2622 | 0, 19, 20, 22, 23, 24, 30, 31, 51, 55, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2623 | 59, 175, 178, 179, 180, 181, 213, 214, 215, 217, |
| 2624 | 216, 52, 67, 222, 155, 58, 155, 18, 155, 42, |
| 2625 | 43, 44, 45, 46, 47, 48, 50, 150, 151, 152, |
| 2626 | 182, 183, 184, 0, 215, 46, 48, 185, 232, 42, |
| 2627 | 43, 44, 47, 186, 229, 231, 239, 155, 155, 159, |
| 2628 | 223, 22, 221, 7, 8, 10, 11, 12, 13, 14, |
| 2629 | 15, 16, 17, 49, 158, 159, 162, 164, 175, 179, |
| 2630 | 200, 201, 235, 184, 184, 35, 37, 211, 184, 184, |
| 2631 | 21, 240, 241, 29, 165, 230, 240, 22, 22, 22, |
| 2632 | 224, 153, 4, 4, 4, 164, 10, 165, 201, 206, |
| 2633 | 54, 153, 177, 211, 211, 42, 44, 187, 32, 33, |
| 2634 | 210, 61, 62, 63, 64, 65, 66, 188, 227, 227, |
| 2635 | 178, 244, 156, 161, 39, 201, 202, 204, 205, 160, |
| 2636 | 160, 165, 206, 156, 165, 153, 205, 157, 210, 210, |
| 2637 | 10, 124, 201, 203, 212, 11, 12, 13, 14, 15, |
| 2638 | 16, 173, 174, 201, 207, 4, 203, 28, 164, 228, |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 2639 | 36, 56, 57, 68, 69, 70, 71, 72, 73, 74, |
| 2640 | 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 2641 | 85, 86, 87, 88, 89, 90, 91, 92, 113, 114, |
| 2642 | 115, 118, 119, 120, 121, 122, 123, 124, 125, 126, |
| 2643 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, |
| 2644 | 137, 168, 169, 170, 242, 248, 249, 250, 251, 22, |
| 2645 | 190, 156, 154, 201, 201, 163, 165, 201, 4, 154, |
| 2646 | 207, 201, 153, 235, 26, 27, 3, 4, 5, 6, |
| 2647 | 9, 25, 40, 41, 89, 90, 91, 92, 118, 132, |
| 2648 | 134, 135, 136, 159, 162, 164, 166, 168, 169, 170, |
| 2649 | 208, 235, 177, 179, 56, 10, 201, 237, 238, 11, |
| 2650 | 17, 11, 173, 188, 93, 94, 95, 96, 97, 98, |
| 2651 | 99, 100, 101, 102, 171, 26, 27, 99, 100, 101, |
| 2652 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 2653 | 112, 172, 171, 172, 201, 201, 237, 201, 201, 245, |
| 2654 | 237, 237, 237, 237, 237, 201, 201, 201, 237, 188, |
| 2655 | 116, 117, 53, 120, 121, 138, 139, 141, 142, 144, |
| 2656 | 145, 146, 189, 39, 202, 192, 161, 163, 163, 154, |
| 2657 | 192, 177, 177, 212, 171, 172, 171, 172, 153, 153, |
| 2658 | 153, 153, 153, 161, 207, 209, 164, 209, 165, 209, |
| 2659 | 22, 153, 153, 153, 218, 153, 3, 4, 9, 25, |
| 2660 | 26, 27, 40, 41, 58, 162, 208, 234, 235, 236, |
| 2661 | 156, 236, 236, 236, 203, 201, 201, 201, 201, 156, |
| 2662 | 195, 156, 195, 236, 159, 156, 156, 156, 156, 156, |
| 2663 | 156, 236, 236, 236, 38, 203, 201, 237, 4, 138, |
| 2664 | 139, 140, 143, 147, 148, 191, 219, 220, 38, 153, |
| 2665 | 153, 153, 153, 207, 207, 207, 207, 207, 156, 161, |
| 2666 | 165, 201, 209, 163, 165, 207, 207, 207, 156, 198, |
| 2667 | 39, 201, 225, 226, 60, 233, 209, 237, 156, 156, |
| 2668 | 236, 236, 236, 236, 236, 11, 53, 11, 247, 236, |
| 2669 | 159, 237, 201, 237, 237, 237, 156, 156, 156, 201, |
| 2670 | 236, 236, 156, 198, 198, 201, 207, 207, 207, 207, |
| 2671 | 247, 156, 156, 156, 156, 207, 163, 165, 156, 156, |
| 2672 | 38, 34, 53, 196, 199, 190, 156, 154, 22, 163, |
| 2673 | 17, 17, 153, 156, 156, 156, 156, 236, 4, 236, |
| 2674 | 156, 156, 236, 156, 156, 156, 4, 236, 236, 153, |
| 2675 | 156, 195, 201, 154, 156, 156, 156, 156, 154, 207, |
| 2676 | 207, 207, 207, 163, 207, 207, 201, 22, 4, 198, |
| 2677 | 175, 176, 39, 201, 192, 156, 236, 236, 17, 201, |
| 2678 | 246, 236, 236, 236, 236, 195, 195, 237, 236, 156, |
| 2679 | 237, 237, 237, 246, 236, 207, 207, 207, 207, 156, |
| 2680 | 154, 156, 156, 154, 154, 154, 190, 196, 197, 22, |
| 2681 | 156, 159, 190, 190, 154, 156, 161, 236, 154, 195, |
| 2682 | 154, 154, 154, 154, 207, 207, 207, 176, 53, 194, |
| 2683 | 17, 161, 173, 243, 120, 121, 236, 236, 192, 17, |
| 2684 | 201, 161, 192, 154, 154, 154, 4, 149, 193, 236, |
| 2685 | 234, 161, 173, 190, 190, 38, 190, 190, 22, 156, |
| 2686 | 234, 17, 236, 236, 17, 156, 236, 190, 190, 236, |
| 2687 | 17, 72, 236, 17, 236 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2688 | }; |
David Greene | 9145dd2 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2689 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2690 | #define yyerrok (yyerrstatus = 0) |
| 2691 | #define yyclearin (yychar = YYEMPTY) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2692 | #define YYEMPTY (-2) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2693 | #define YYEOF 0 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2694 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2695 | #define YYACCEPT goto yyacceptlab |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2696 | #define YYABORT goto yyabortlab |
| 2697 | #define YYERROR goto yyerrorlab |
| 2698 | |
| 2699 | |
| 2700 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 2701 | to ease the transition to the new meaning of YYERROR, for GCC. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2702 | Once GCC version 2 has supplanted version 1, this can go. */ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2703 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2704 | #define YYFAIL goto yyerrlab |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2705 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2706 | #define YYRECOVERING() (!!yyerrstatus) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2707 | |
| 2708 | #define YYBACKUP(Token, Value) \ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2709 | do \ |
| 2710 | if (yychar == YYEMPTY && yylen == 1) \ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2711 | { \ |
| 2712 | yychar = (Token); \ |
| 2713 | yylval = (Value); \ |
| 2714 | yytoken = YYTRANSLATE (yychar); \ |
| 2715 | YYPOPSTACK (1); \ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2716 | goto yybackup; \ |
| 2717 | } \ |
| 2718 | else \ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2719 | { \ |
| 2720 | yyerror (YY_("syntax error: cannot back up")); \ |
| 2721 | YYERROR; \ |
| 2722 | } \ |
| 2723 | while (YYID (0)) |
| 2724 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2725 | |
| 2726 | #define YYTERROR 1 |
| 2727 | #define YYERRCODE 256 |
| 2728 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2729 | |
| 2730 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 2731 | If N is 0, then set CURRENT to the empty location which ends |
| 2732 | the previous symbol: RHS[0] (always defined). */ |
| 2733 | |
| 2734 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
| 2735 | #ifndef YYLLOC_DEFAULT |
| 2736 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 2737 | do \ |
| 2738 | if (YYID (N)) \ |
| 2739 | { \ |
| 2740 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ |
| 2741 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ |
| 2742 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ |
| 2743 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ |
| 2744 | } \ |
| 2745 | else \ |
| 2746 | { \ |
| 2747 | (Current).first_line = (Current).last_line = \ |
| 2748 | YYRHSLOC (Rhs, 0).last_line; \ |
| 2749 | (Current).first_column = (Current).last_column = \ |
| 2750 | YYRHSLOC (Rhs, 0).last_column; \ |
| 2751 | } \ |
| 2752 | while (YYID (0)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2753 | #endif |
| 2754 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2755 | |
| 2756 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 2757 | This macro was not mandated originally: define only if we know |
| 2758 | we won't break user code: when these are the locations we know. */ |
| 2759 | |
| 2760 | #ifndef YY_LOCATION_PRINT |
| 2761 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
| 2762 | # define YY_LOCATION_PRINT(File, Loc) \ |
| 2763 | fprintf (File, "%d.%d-%d.%d", \ |
| 2764 | (Loc).first_line, (Loc).first_column, \ |
| 2765 | (Loc).last_line, (Loc).last_column) |
| 2766 | # else |
| 2767 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
| 2768 | # endif |
| 2769 | #endif |
| 2770 | |
| 2771 | |
| 2772 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 2773 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2774 | #ifdef YYLEX_PARAM |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2775 | # define YYLEX yylex (YYLEX_PARAM) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2776 | #else |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2777 | # define YYLEX yylex () |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2778 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2779 | |
| 2780 | /* Enable debugging if requested. */ |
| 2781 | #if YYDEBUG |
| 2782 | |
| 2783 | # ifndef YYFPRINTF |
| 2784 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 2785 | # define YYFPRINTF fprintf |
| 2786 | # endif |
| 2787 | |
| 2788 | # define YYDPRINTF(Args) \ |
| 2789 | do { \ |
| 2790 | if (yydebug) \ |
| 2791 | YYFPRINTF Args; \ |
| 2792 | } while (YYID (0)) |
| 2793 | |
| 2794 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
| 2795 | do { \ |
| 2796 | if (yydebug) \ |
| 2797 | { \ |
| 2798 | YYFPRINTF (stderr, "%s ", Title); \ |
| 2799 | yy_symbol_print (stderr, \ |
| 2800 | Type, Value); \ |
| 2801 | YYFPRINTF (stderr, "\n"); \ |
| 2802 | } \ |
| 2803 | } while (YYID (0)) |
| 2804 | |
| 2805 | |
| 2806 | /*--------------------------------. |
| 2807 | | Print this symbol on YYOUTPUT. | |
| 2808 | `--------------------------------*/ |
| 2809 | |
| 2810 | /*ARGSUSED*/ |
| 2811 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2812 | || defined __cplusplus || defined _MSC_VER) |
| 2813 | static void |
| 2814 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2815 | #else |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2816 | static void |
| 2817 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
| 2818 | FILE *yyoutput; |
| 2819 | int yytype; |
| 2820 | YYSTYPE const * const yyvaluep; |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 2821 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2822 | { |
| 2823 | if (!yyvaluep) |
| 2824 | return; |
| 2825 | # ifdef YYPRINT |
| 2826 | if (yytype < YYNTOKENS) |
| 2827 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); |
| 2828 | # else |
| 2829 | YYUSE (yyoutput); |
| 2830 | # endif |
| 2831 | switch (yytype) |
| 2832 | { |
| 2833 | default: |
| 2834 | break; |
| 2835 | } |
| 2836 | } |
| 2837 | |
| 2838 | |
| 2839 | /*--------------------------------. |
| 2840 | | Print this symbol on YYOUTPUT. | |
| 2841 | `--------------------------------*/ |
| 2842 | |
| 2843 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2844 | || defined __cplusplus || defined _MSC_VER) |
| 2845 | static void |
| 2846 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
| 2847 | #else |
| 2848 | static void |
| 2849 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
| 2850 | FILE *yyoutput; |
| 2851 | int yytype; |
| 2852 | YYSTYPE const * const yyvaluep; |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2853 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2854 | { |
| 2855 | if (yytype < YYNTOKENS) |
| 2856 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 2857 | else |
| 2858 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2859 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2860 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
| 2861 | YYFPRINTF (yyoutput, ")"); |
| 2862 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2863 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2864 | /*------------------------------------------------------------------. |
| 2865 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | |
| 2866 | | TOP (included). | |
| 2867 | `------------------------------------------------------------------*/ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2868 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2869 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2870 | || defined __cplusplus || defined _MSC_VER) |
| 2871 | static void |
| 2872 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) |
| 2873 | #else |
| 2874 | static void |
| 2875 | yy_stack_print (bottom, top) |
| 2876 | yytype_int16 *bottom; |
| 2877 | yytype_int16 *top; |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 2878 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2879 | { |
| 2880 | YYFPRINTF (stderr, "Stack now"); |
| 2881 | for (; bottom <= top; ++bottom) |
| 2882 | YYFPRINTF (stderr, " %d", *bottom); |
| 2883 | YYFPRINTF (stderr, "\n"); |
| 2884 | } |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2885 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2886 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 2887 | do { \ |
| 2888 | if (yydebug) \ |
| 2889 | yy_stack_print ((Bottom), (Top)); \ |
| 2890 | } while (YYID (0)) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2891 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2892 | |
| 2893 | /*------------------------------------------------. |
| 2894 | | Report that the YYRULE is going to be reduced. | |
| 2895 | `------------------------------------------------*/ |
| 2896 | |
| 2897 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2898 | || defined __cplusplus || defined _MSC_VER) |
| 2899 | static void |
| 2900 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
| 2901 | #else |
| 2902 | static void |
| 2903 | yy_reduce_print (yyvsp, yyrule) |
| 2904 | YYSTYPE *yyvsp; |
| 2905 | int yyrule; |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 2906 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2907 | { |
| 2908 | int yynrhs = yyr2[yyrule]; |
| 2909 | int yyi; |
| 2910 | unsigned long int yylno = yyrline[yyrule]; |
| 2911 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", |
| 2912 | yyrule - 1, yylno); |
| 2913 | /* The symbols being reduced. */ |
| 2914 | for (yyi = 0; yyi < yynrhs; yyi++) |
| 2915 | { |
| 2916 | fprintf (stderr, " $%d = ", yyi + 1); |
| 2917 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
| 2918 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
| 2919 | ); |
| 2920 | fprintf (stderr, "\n"); |
| 2921 | } |
| 2922 | } |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2923 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2924 | # define YY_REDUCE_PRINT(Rule) \ |
| 2925 | do { \ |
| 2926 | if (yydebug) \ |
| 2927 | yy_reduce_print (yyvsp, Rule); \ |
| 2928 | } while (YYID (0)) |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 2929 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2930 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 2931 | multiple parsers can coexist. */ |
| 2932 | int yydebug; |
| 2933 | #else /* !YYDEBUG */ |
| 2934 | # define YYDPRINTF(Args) |
| 2935 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
| 2936 | # define YY_STACK_PRINT(Bottom, Top) |
| 2937 | # define YY_REDUCE_PRINT(Rule) |
| 2938 | #endif /* !YYDEBUG */ |
| 2939 | |
| 2940 | |
| 2941 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2942 | #ifndef YYINITDEPTH |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2943 | # define YYINITDEPTH 200 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2944 | #endif |
| 2945 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2946 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 2947 | if the built-in stack extension method is used). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2948 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2949 | Do not make this value too large; the results are undefined if |
| 2950 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
| 2951 | evaluated with infinite-precision integer arithmetic. */ |
David Greene | 9145dd2 | 2007-08-01 03:59:32 +0000 | [diff] [blame] | 2952 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2953 | #ifndef YYMAXDEPTH |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2954 | # define YYMAXDEPTH 10000 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2955 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2956 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2957 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2958 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2959 | #if YYERROR_VERBOSE |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2960 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2961 | # ifndef yystrlen |
| 2962 | # if defined __GLIBC__ && defined _STRING_H |
| 2963 | # define yystrlen strlen |
| 2964 | # else |
| 2965 | /* Return the length of YYSTR. */ |
| 2966 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2967 | || defined __cplusplus || defined _MSC_VER) |
| 2968 | static YYSIZE_T |
| 2969 | yystrlen (const char *yystr) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 2970 | #else |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 2971 | static YYSIZE_T |
| 2972 | yystrlen (yystr) |
| 2973 | const char *yystr; |
| 2974 | #endif |
| 2975 | { |
| 2976 | YYSIZE_T yylen; |
| 2977 | for (yylen = 0; yystr[yylen]; yylen++) |
| 2978 | continue; |
| 2979 | return yylen; |
| 2980 | } |
| 2981 | # endif |
| 2982 | # endif |
| 2983 | |
| 2984 | # ifndef yystpcpy |
| 2985 | # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE |
| 2986 | # define yystpcpy stpcpy |
| 2987 | # else |
| 2988 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 2989 | YYDEST. */ |
| 2990 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 2991 | || defined __cplusplus || defined _MSC_VER) |
| 2992 | static char * |
| 2993 | yystpcpy (char *yydest, const char *yysrc) |
| 2994 | #else |
| 2995 | static char * |
| 2996 | yystpcpy (yydest, yysrc) |
| 2997 | char *yydest; |
| 2998 | const char *yysrc; |
| 2999 | #endif |
| 3000 | { |
| 3001 | char *yyd = yydest; |
| 3002 | const char *yys = yysrc; |
| 3003 | |
| 3004 | while ((*yyd++ = *yys++) != '\0') |
| 3005 | continue; |
| 3006 | |
| 3007 | return yyd - 1; |
| 3008 | } |
| 3009 | # endif |
| 3010 | # endif |
| 3011 | |
| 3012 | # ifndef yytnamerr |
| 3013 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary |
| 3014 | quotes and backslashes, so that it's suitable for yyerror. The |
| 3015 | heuristic is that double-quoting is unnecessary unless the string |
| 3016 | contains an apostrophe, a comma, or backslash (other than |
| 3017 | backslash-backslash). YYSTR is taken from yytname. If YYRES is |
| 3018 | null, do not copy; instead, return the length of what the result |
| 3019 | would have been. */ |
| 3020 | static YYSIZE_T |
| 3021 | yytnamerr (char *yyres, const char *yystr) |
| 3022 | { |
| 3023 | if (*yystr == '"') |
| 3024 | { |
| 3025 | YYSIZE_T yyn = 0; |
| 3026 | char const *yyp = yystr; |
| 3027 | |
| 3028 | for (;;) |
| 3029 | switch (*++yyp) |
| 3030 | { |
| 3031 | case '\'': |
| 3032 | case ',': |
| 3033 | goto do_not_strip_quotes; |
| 3034 | |
| 3035 | case '\\': |
| 3036 | if (*++yyp != '\\') |
| 3037 | goto do_not_strip_quotes; |
| 3038 | /* Fall through. */ |
| 3039 | default: |
| 3040 | if (yyres) |
| 3041 | yyres[yyn] = *yyp; |
| 3042 | yyn++; |
| 3043 | break; |
| 3044 | |
| 3045 | case '"': |
| 3046 | if (yyres) |
| 3047 | yyres[yyn] = '\0'; |
| 3048 | return yyn; |
| 3049 | } |
| 3050 | do_not_strip_quotes: ; |
| 3051 | } |
| 3052 | |
| 3053 | if (! yyres) |
| 3054 | return yystrlen (yystr); |
| 3055 | |
| 3056 | return yystpcpy (yyres, yystr) - yyres; |
| 3057 | } |
| 3058 | # endif |
| 3059 | |
| 3060 | /* Copy into YYRESULT an error message about the unexpected token |
| 3061 | YYCHAR while in state YYSTATE. Return the number of bytes copied, |
| 3062 | including the terminating null byte. If YYRESULT is null, do not |
| 3063 | copy anything; just return the number of bytes that would be |
| 3064 | copied. As a special case, return 0 if an ordinary "syntax error" |
| 3065 | message will do. Return YYSIZE_MAXIMUM if overflow occurs during |
| 3066 | size calculation. */ |
| 3067 | static YYSIZE_T |
| 3068 | yysyntax_error (char *yyresult, int yystate, int yychar) |
| 3069 | { |
| 3070 | int yyn = yypact[yystate]; |
| 3071 | |
| 3072 | if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) |
| 3073 | return 0; |
| 3074 | else |
| 3075 | { |
| 3076 | int yytype = YYTRANSLATE (yychar); |
| 3077 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
| 3078 | YYSIZE_T yysize = yysize0; |
| 3079 | YYSIZE_T yysize1; |
| 3080 | int yysize_overflow = 0; |
| 3081 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
| 3082 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
| 3083 | int yyx; |
| 3084 | |
| 3085 | # if 0 |
| 3086 | /* This is so xgettext sees the translatable formats that are |
| 3087 | constructed on the fly. */ |
| 3088 | YY_("syntax error, unexpected %s"); |
| 3089 | YY_("syntax error, unexpected %s, expecting %s"); |
| 3090 | YY_("syntax error, unexpected %s, expecting %s or %s"); |
| 3091 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); |
| 3092 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); |
| 3093 | # endif |
| 3094 | char *yyfmt; |
| 3095 | char const *yyf; |
| 3096 | static char const yyunexpected[] = "syntax error, unexpected %s"; |
| 3097 | static char const yyexpecting[] = ", expecting %s"; |
| 3098 | static char const yyor[] = " or %s"; |
| 3099 | char yyformat[sizeof yyunexpected |
| 3100 | + sizeof yyexpecting - 1 |
| 3101 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) |
| 3102 | * (sizeof yyor - 1))]; |
| 3103 | char const *yyprefix = yyexpecting; |
| 3104 | |
| 3105 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 3106 | YYCHECK. */ |
| 3107 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 3108 | |
| 3109 | /* Stay within bounds of both yycheck and yytname. */ |
| 3110 | int yychecklim = YYLAST - yyn + 1; |
| 3111 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
| 3112 | int yycount = 1; |
| 3113 | |
| 3114 | yyarg[0] = yytname[yytype]; |
| 3115 | yyfmt = yystpcpy (yyformat, yyunexpected); |
| 3116 | |
| 3117 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 3118 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 3119 | { |
| 3120 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
| 3121 | { |
| 3122 | yycount = 1; |
| 3123 | yysize = yysize0; |
| 3124 | yyformat[sizeof yyunexpected - 1] = '\0'; |
| 3125 | break; |
| 3126 | } |
| 3127 | yyarg[yycount++] = yytname[yyx]; |
| 3128 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); |
| 3129 | yysize_overflow |= (yysize1 < yysize); |
| 3130 | yysize = yysize1; |
| 3131 | yyfmt = yystpcpy (yyfmt, yyprefix); |
| 3132 | yyprefix = yyor; |
| 3133 | } |
| 3134 | |
| 3135 | yyf = YY_(yyformat); |
| 3136 | yysize1 = yysize + yystrlen (yyf); |
| 3137 | yysize_overflow |= (yysize1 < yysize); |
| 3138 | yysize = yysize1; |
| 3139 | |
| 3140 | if (yysize_overflow) |
| 3141 | return YYSIZE_MAXIMUM; |
| 3142 | |
| 3143 | if (yyresult) |
| 3144 | { |
| 3145 | /* Avoid sprintf, as that infringes on the user's name space. |
| 3146 | Don't have undefined behavior even if the translation |
| 3147 | produced a string with the wrong number of "%s"s. */ |
| 3148 | char *yyp = yyresult; |
| 3149 | int yyi = 0; |
| 3150 | while ((*yyp = *yyf) != '\0') |
| 3151 | { |
| 3152 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
| 3153 | { |
| 3154 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
| 3155 | yyf += 2; |
| 3156 | } |
| 3157 | else |
| 3158 | { |
| 3159 | yyp++; |
| 3160 | yyf++; |
| 3161 | } |
| 3162 | } |
| 3163 | } |
| 3164 | return yysize; |
| 3165 | } |
| 3166 | } |
| 3167 | #endif /* YYERROR_VERBOSE */ |
| 3168 | |
| 3169 | |
| 3170 | /*-----------------------------------------------. |
| 3171 | | Release the memory associated to this symbol. | |
| 3172 | `-----------------------------------------------*/ |
| 3173 | |
| 3174 | /*ARGSUSED*/ |
| 3175 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3176 | || defined __cplusplus || defined _MSC_VER) |
| 3177 | static void |
| 3178 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
| 3179 | #else |
| 3180 | static void |
| 3181 | yydestruct (yymsg, yytype, yyvaluep) |
| 3182 | const char *yymsg; |
| 3183 | int yytype; |
| 3184 | YYSTYPE *yyvaluep; |
| 3185 | #endif |
| 3186 | { |
| 3187 | YYUSE (yyvaluep); |
| 3188 | |
| 3189 | if (!yymsg) |
| 3190 | yymsg = "Deleting"; |
| 3191 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
| 3192 | |
| 3193 | switch (yytype) |
| 3194 | { |
| 3195 | |
| 3196 | default: |
| 3197 | break; |
| 3198 | } |
| 3199 | } |
| 3200 | |
| 3201 | |
| 3202 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 3203 | |
| 3204 | #ifdef YYPARSE_PARAM |
| 3205 | #if defined __STDC__ || defined __cplusplus |
| 3206 | int yyparse (void *YYPARSE_PARAM); |
| 3207 | #else |
| 3208 | int yyparse (); |
| 3209 | #endif |
| 3210 | #else /* ! YYPARSE_PARAM */ |
| 3211 | #if defined __STDC__ || defined __cplusplus |
David Greene | 4855639 | 2007-09-04 18:46:50 +0000 | [diff] [blame] | 3212 | int yyparse (void); |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3213 | #else |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3214 | int yyparse (); |
Scott Michel | 6d1aba8 | 2008-01-30 03:10:00 +0000 | [diff] [blame] | 3215 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3216 | #endif /* ! YYPARSE_PARAM */ |
Scott Michel | 5a6f17b | 2008-01-30 02:55:46 +0000 | [diff] [blame] | 3217 | |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3218 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3219 | |
| 3220 | /* The look-ahead symbol. */ |
| 3221 | int yychar; |
| 3222 | |
| 3223 | /* The semantic value of the look-ahead symbol. */ |
| 3224 | YYSTYPE yylval; |
| 3225 | |
| 3226 | /* Number of syntax errors so far. */ |
| 3227 | int yynerrs; |
| 3228 | |
| 3229 | |
| 3230 | |
| 3231 | /*----------. |
| 3232 | | yyparse. | |
| 3233 | `----------*/ |
| 3234 | |
| 3235 | #ifdef YYPARSE_PARAM |
| 3236 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3237 | || defined __cplusplus || defined _MSC_VER) |
| 3238 | int |
| 3239 | yyparse (void *YYPARSE_PARAM) |
| 3240 | #else |
| 3241 | int |
| 3242 | yyparse (YYPARSE_PARAM) |
| 3243 | void *YYPARSE_PARAM; |
| 3244 | #endif |
| 3245 | #else /* ! YYPARSE_PARAM */ |
| 3246 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
| 3247 | || defined __cplusplus || defined _MSC_VER) |
| 3248 | int |
| 3249 | yyparse (void) |
| 3250 | #else |
| 3251 | int |
| 3252 | yyparse () |
| 3253 | |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3254 | #endif |
| 3255 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3256 | { |
| 3257 | |
| 3258 | int yystate; |
| 3259 | int yyn; |
| 3260 | int yyresult; |
| 3261 | /* Number of tokens to shift before error messages enabled. */ |
| 3262 | int yyerrstatus; |
| 3263 | /* Look-ahead token as an internal (translated) token number. */ |
| 3264 | int yytoken = 0; |
| 3265 | #if YYERROR_VERBOSE |
| 3266 | /* Buffer for error messages, and its allocated size. */ |
| 3267 | char yymsgbuf[128]; |
| 3268 | char *yymsg = yymsgbuf; |
| 3269 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3270 | #endif |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 3271 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3272 | /* Three stacks and their tools: |
| 3273 | `yyss': related to states, |
| 3274 | `yyvs': related to semantic values, |
| 3275 | `yyls': related to locations. |
| 3276 | |
| 3277 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 3278 | to reallocate them elsewhere. */ |
| 3279 | |
| 3280 | /* The state stack. */ |
| 3281 | yytype_int16 yyssa[YYINITDEPTH]; |
| 3282 | yytype_int16 *yyss = yyssa; |
| 3283 | yytype_int16 *yyssp; |
| 3284 | |
| 3285 | /* The semantic value stack. */ |
| 3286 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 3287 | YYSTYPE *yyvs = yyvsa; |
| 3288 | YYSTYPE *yyvsp; |
| 3289 | |
| 3290 | |
| 3291 | |
| 3292 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) |
| 3293 | |
| 3294 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 3295 | |
| 3296 | /* The variables used to return semantic value and location from the |
| 3297 | action routines. */ |
| 3298 | YYSTYPE yyval; |
| 3299 | |
| 3300 | |
| 3301 | /* The number of symbols on the RHS of the reduced rule. |
| 3302 | Keep to zero when no symbol should be popped. */ |
| 3303 | int yylen = 0; |
| 3304 | |
| 3305 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 3306 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3307 | yystate = 0; |
| 3308 | yyerrstatus = 0; |
| 3309 | yynerrs = 0; |
| 3310 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 3311 | |
| 3312 | /* Initialize stack pointers. |
| 3313 | Waste one element of value and location stack |
| 3314 | so that they stay on the same level as the state stack. |
| 3315 | The wasted elements are never initialized. */ |
| 3316 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3317 | yyssp = yyss; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3318 | yyvsp = yyvs; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3319 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3320 | goto yysetstate; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3321 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3322 | /*------------------------------------------------------------. |
| 3323 | | yynewstate -- Push a new state, which is found in yystate. | |
| 3324 | `------------------------------------------------------------*/ |
| 3325 | yynewstate: |
| 3326 | /* In all cases, when you get here, the value and location stacks |
| 3327 | have just been pushed. So pushing a state here evens the stacks. */ |
| 3328 | yyssp++; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3329 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3330 | yysetstate: |
| 3331 | *yyssp = yystate; |
| 3332 | |
| 3333 | if (yyss + yystacksize - 1 <= yyssp) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3334 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3335 | /* Get the current used size of the three stacks, in elements. */ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3336 | YYSIZE_T yysize = yyssp - yyss + 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3337 | |
| 3338 | #ifdef yyoverflow |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3339 | { |
| 3340 | /* Give user a chance to reallocate the stack. Use copies of |
| 3341 | these so that the &'s don't force the real ones into |
| 3342 | memory. */ |
| 3343 | YYSTYPE *yyvs1 = yyvs; |
| 3344 | yytype_int16 *yyss1 = yyss; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3345 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3346 | |
| 3347 | /* Each stack pointer address is followed by the size of the |
| 3348 | data in use in that stack, in bytes. This used to be a |
| 3349 | conditional around just the two extra args, but that might |
| 3350 | be undefined if yyoverflow is a macro. */ |
| 3351 | yyoverflow (YY_("memory exhausted"), |
| 3352 | &yyss1, yysize * sizeof (*yyssp), |
| 3353 | &yyvs1, yysize * sizeof (*yyvsp), |
| 3354 | |
| 3355 | &yystacksize); |
| 3356 | |
| 3357 | yyss = yyss1; |
| 3358 | yyvs = yyvs1; |
| 3359 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3360 | #else /* no yyoverflow */ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3361 | # ifndef YYSTACK_RELOCATE |
| 3362 | goto yyexhaustedlab; |
| 3363 | # else |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3364 | /* Extend the stack our own way. */ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3365 | if (YYMAXDEPTH <= yystacksize) |
| 3366 | goto yyexhaustedlab; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3367 | yystacksize *= 2; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3368 | if (YYMAXDEPTH < yystacksize) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3369 | yystacksize = YYMAXDEPTH; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3370 | |
| 3371 | { |
| 3372 | yytype_int16 *yyss1 = yyss; |
| 3373 | union yyalloc *yyptr = |
| 3374 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 3375 | if (! yyptr) |
| 3376 | goto yyexhaustedlab; |
| 3377 | YYSTACK_RELOCATE (yyss); |
| 3378 | YYSTACK_RELOCATE (yyvs); |
| 3379 | |
| 3380 | # undef YYSTACK_RELOCATE |
| 3381 | if (yyss1 != yyssa) |
| 3382 | YYSTACK_FREE (yyss1); |
| 3383 | } |
| 3384 | # endif |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3385 | #endif /* no yyoverflow */ |
| 3386 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3387 | yyssp = yyss + yysize - 1; |
| 3388 | yyvsp = yyvs + yysize - 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3389 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3390 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3391 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 3392 | (unsigned long int) yystacksize)); |
| 3393 | |
| 3394 | if (yyss + yystacksize - 1 <= yyssp) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3395 | YYABORT; |
| 3396 | } |
| 3397 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3398 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3399 | |
| 3400 | goto yybackup; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3401 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3402 | /*-----------. |
| 3403 | | yybackup. | |
| 3404 | `-----------*/ |
| 3405 | yybackup: |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3406 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3407 | /* Do appropriate processing given the current state. Read a |
| 3408 | look-ahead token if we need one and don't already have one. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3409 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3410 | /* First try to decide what to do without reference to look-ahead token. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3411 | yyn = yypact[yystate]; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3412 | if (yyn == YYPACT_NINF) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3413 | goto yydefault; |
| 3414 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3415 | /* Not known => get a look-ahead token if don't already have one. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3416 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3417 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3418 | if (yychar == YYEMPTY) |
| 3419 | { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3420 | YYDPRINTF ((stderr, "Reading a token: ")); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3421 | yychar = YYLEX; |
| 3422 | } |
| 3423 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3424 | if (yychar <= YYEOF) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3425 | { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3426 | yychar = yytoken = YYEOF; |
| 3427 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3428 | } |
| 3429 | else |
| 3430 | { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3431 | yytoken = YYTRANSLATE (yychar); |
| 3432 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3433 | } |
| 3434 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3435 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 3436 | detect an error, take that action. */ |
| 3437 | yyn += yytoken; |
| 3438 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3439 | goto yydefault; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3440 | yyn = yytable[yyn]; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3441 | if (yyn <= 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3442 | { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3443 | if (yyn == 0 || yyn == YYTABLE_NINF) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3444 | goto yyerrlab; |
| 3445 | yyn = -yyn; |
| 3446 | goto yyreduce; |
| 3447 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3448 | |
| 3449 | if (yyn == YYFINAL) |
| 3450 | YYACCEPT; |
| 3451 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3452 | /* Count tokens shifted since error; after three, turn off error |
| 3453 | status. */ |
| 3454 | if (yyerrstatus) |
| 3455 | yyerrstatus--; |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 3456 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3457 | /* Shift the look-ahead token. */ |
| 3458 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3459 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3460 | /* Discard the shifted token unless it is eof. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3461 | if (yychar != YYEOF) |
| 3462 | yychar = YYEMPTY; |
| 3463 | |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3464 | yystate = yyn; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3465 | *++yyvsp = yylval; |
| 3466 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3467 | goto yynewstate; |
| 3468 | |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 3469 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3470 | /*-----------------------------------------------------------. |
| 3471 | | yydefault -- do the default action for the current state. | |
| 3472 | `-----------------------------------------------------------*/ |
| 3473 | yydefault: |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3474 | yyn = yydefact[yystate]; |
| 3475 | if (yyn == 0) |
| 3476 | goto yyerrlab; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3477 | goto yyreduce; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3478 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3479 | |
| 3480 | /*-----------------------------. |
| 3481 | | yyreduce -- Do a reduction. | |
| 3482 | `-----------------------------*/ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3483 | yyreduce: |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3484 | /* yyn is the number of a rule to reduce with. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3485 | yylen = yyr2[yyn]; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3486 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3487 | /* If YYLEN is nonzero, implement the default value of the action: |
| 3488 | `$$ = $1'. |
| 3489 | |
| 3490 | Otherwise, the following line sets YYVAL to garbage. |
| 3491 | This behavior is undocumented and Bison |
| 3492 | users should not rely upon it. Assigning to YYVAL |
| 3493 | unconditionally makes the parser a bit smaller, and it avoids a |
| 3494 | GCC warning that YYVAL may be used uninitialized. */ |
| 3495 | yyval = yyvsp[1-yylen]; |
| 3496 | |
| 3497 | |
| 3498 | YY_REDUCE_PRINT (yyn); |
| 3499 | switch (yyn) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3500 | { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3501 | case 29: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3502 | #line 1117 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3503 | { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;} |
| 3504 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3505 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3506 | case 30: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3507 | #line 1117 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3508 | { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;} |
| 3509 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3510 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3511 | case 31: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3512 | #line 1118 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3513 | { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;} |
| 3514 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3515 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3516 | case 32: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3517 | #line 1118 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3518 | { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;} |
| 3519 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3520 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3521 | case 33: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3522 | #line 1119 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3523 | { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;} |
| 3524 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3525 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3526 | case 34: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3527 | #line 1119 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3528 | { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;} |
| 3529 | break; |
| 3530 | |
| 3531 | case 35: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3532 | #line 1120 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3533 | { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;} |
| 3534 | break; |
| 3535 | |
| 3536 | case 36: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3537 | #line 1120 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3538 | { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;} |
| 3539 | break; |
| 3540 | |
| 3541 | case 37: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3542 | #line 1121 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3543 | { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;} |
| 3544 | break; |
| 3545 | |
| 3546 | case 38: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3547 | #line 1121 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3548 | { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;} |
| 3549 | break; |
| 3550 | |
| 3551 | case 39: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3552 | #line 1125 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3553 | { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;} |
| 3554 | break; |
| 3555 | |
| 3556 | case 40: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3557 | #line 1125 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3558 | { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;} |
| 3559 | break; |
| 3560 | |
| 3561 | case 41: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3562 | #line 1126 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3563 | { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;} |
| 3564 | break; |
| 3565 | |
| 3566 | case 42: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3567 | #line 1126 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3568 | { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;} |
| 3569 | break; |
| 3570 | |
| 3571 | case 43: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3572 | #line 1127 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3573 | { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;} |
| 3574 | break; |
| 3575 | |
| 3576 | case 44: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3577 | #line 1127 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3578 | { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;} |
| 3579 | break; |
| 3580 | |
| 3581 | case 45: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3582 | #line 1128 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3583 | { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;} |
| 3584 | break; |
| 3585 | |
| 3586 | case 46: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3587 | #line 1128 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3588 | { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;} |
| 3589 | break; |
| 3590 | |
| 3591 | case 47: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3592 | #line 1129 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3593 | { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;} |
| 3594 | break; |
| 3595 | |
| 3596 | case 48: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3597 | #line 1129 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3598 | { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;} |
| 3599 | break; |
| 3600 | |
| 3601 | case 49: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3602 | #line 1130 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3603 | { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;} |
| 3604 | break; |
| 3605 | |
| 3606 | case 50: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3607 | #line 1130 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3608 | { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;} |
| 3609 | break; |
| 3610 | |
| 3611 | case 51: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3612 | #line 1131 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3613 | { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;} |
| 3614 | break; |
| 3615 | |
| 3616 | case 52: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3617 | #line 1131 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3618 | { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;} |
| 3619 | break; |
| 3620 | |
| 3621 | case 53: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3622 | #line 1132 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3623 | { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;} |
| 3624 | break; |
| 3625 | |
| 3626 | case 54: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3627 | #line 1133 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3628 | { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;} |
| 3629 | break; |
| 3630 | |
| 3631 | case 65: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3632 | #line 1142 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3633 | { (yyval.StrVal) = 0; ;} |
| 3634 | break; |
| 3635 | |
| 3636 | case 66: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3637 | #line 1144 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3638 | { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;} |
| 3639 | break; |
| 3640 | |
| 3641 | case 67: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3642 | #line 1145 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3643 | { (yyval.UIntVal)=0; ;} |
| 3644 | break; |
| 3645 | |
| 3646 | case 68: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3647 | #line 1149 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3648 | { |
| 3649 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3650 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3651 | ;} |
| 3652 | break; |
| 3653 | |
| 3654 | case 69: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3655 | #line 1153 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3656 | { |
| 3657 | (yyval.StrVal) = 0; |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3658 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3659 | ;} |
| 3660 | break; |
| 3661 | |
| 3662 | case 73: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3663 | #line 1161 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3664 | { |
| 3665 | (yyval.StrVal) = 0; |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3666 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3667 | ;} |
| 3668 | break; |
| 3669 | |
| 3670 | case 74: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3671 | #line 1166 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3672 | { |
| 3673 | (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3674 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3675 | ;} |
| 3676 | break; |
| 3677 | |
| 3678 | case 75: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3679 | #line 1172 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3680 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3681 | break; |
| 3682 | |
| 3683 | case 76: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3684 | #line 1173 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3685 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3686 | break; |
| 3687 | |
| 3688 | case 77: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3689 | #line 1174 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3690 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3691 | break; |
| 3692 | |
| 3693 | case 78: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3694 | #line 1175 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3695 | { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} |
| 3696 | break; |
| 3697 | |
| 3698 | case 79: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3699 | #line 1176 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3700 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3701 | break; |
| 3702 | |
| 3703 | case 80: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3704 | #line 1180 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3705 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3706 | break; |
| 3707 | |
| 3708 | case 81: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3709 | #line 1181 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3710 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3711 | break; |
| 3712 | |
| 3713 | case 82: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3714 | #line 1182 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3715 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3716 | break; |
| 3717 | |
| 3718 | case 83: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3719 | #line 1186 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3720 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3721 | break; |
| 3722 | |
| 3723 | case 84: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3724 | #line 1187 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3725 | { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;} |
| 3726 | break; |
| 3727 | |
| 3728 | case 85: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3729 | #line 1188 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3730 | { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;} |
| 3731 | break; |
| 3732 | |
| 3733 | case 86: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3734 | #line 1189 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3735 | { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;} |
| 3736 | break; |
| 3737 | |
| 3738 | case 87: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3739 | #line 1193 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3740 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3741 | break; |
| 3742 | |
| 3743 | case 88: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3744 | #line 1194 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3745 | { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} |
| 3746 | break; |
| 3747 | |
| 3748 | case 89: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3749 | #line 1195 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3750 | { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} |
| 3751 | break; |
| 3752 | |
| 3753 | case 90: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3754 | #line 1199 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3755 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3756 | break; |
| 3757 | |
| 3758 | case 91: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3759 | #line 1200 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3760 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3761 | break; |
| 3762 | |
| 3763 | case 92: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3764 | #line 1201 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3765 | { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} |
| 3766 | break; |
| 3767 | |
| 3768 | case 93: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3769 | #line 1202 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3770 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3771 | break; |
| 3772 | |
| 3773 | case 94: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3774 | #line 1203 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3775 | { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} |
| 3776 | break; |
| 3777 | |
| 3778 | case 95: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3779 | #line 1207 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3780 | { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} |
| 3781 | break; |
| 3782 | |
| 3783 | case 96: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3784 | #line 1208 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3785 | { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} |
| 3786 | break; |
| 3787 | |
| 3788 | case 97: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3789 | #line 1209 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3790 | { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} |
| 3791 | break; |
| 3792 | |
| 3793 | case 98: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3794 | #line 1212 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3795 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3796 | break; |
| 3797 | |
| 3798 | case 99: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3799 | #line 1213 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3800 | { (yyval.UIntVal) = CallingConv::C; ;} |
| 3801 | break; |
| 3802 | |
| 3803 | case 100: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3804 | #line 1214 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3805 | { (yyval.UIntVal) = CallingConv::Fast; ;} |
| 3806 | break; |
| 3807 | |
| 3808 | case 101: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3809 | #line 1215 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3810 | { (yyval.UIntVal) = CallingConv::Cold; ;} |
| 3811 | break; |
| 3812 | |
| 3813 | case 102: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3814 | #line 1216 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3815 | { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} |
| 3816 | break; |
| 3817 | |
| 3818 | case 103: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3819 | #line 1217 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3820 | { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} |
| 3821 | break; |
| 3822 | |
| 3823 | case 104: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3824 | #line 1218 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3825 | { |
| 3826 | if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3827 | GEN_ERROR("Calling conv too large"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3828 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3829 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3830 | ;} |
| 3831 | break; |
| 3832 | |
| 3833 | case 105: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3834 | #line 1225 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3835 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3836 | break; |
| 3837 | |
| 3838 | case 106: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3839 | #line 1226 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3840 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3841 | break; |
| 3842 | |
| 3843 | case 107: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3844 | #line 1227 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3845 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3846 | break; |
| 3847 | |
| 3848 | case 108: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3849 | #line 1228 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3850 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3851 | break; |
| 3852 | |
| 3853 | case 109: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3854 | #line 1229 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3855 | { (yyval.ParamAttrs) = ParamAttr::InReg; ;} |
| 3856 | break; |
| 3857 | |
| 3858 | case 110: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3859 | #line 1230 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3860 | { (yyval.ParamAttrs) = ParamAttr::StructRet; ;} |
| 3861 | break; |
| 3862 | |
| 3863 | case 111: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3864 | #line 1231 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3865 | { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;} |
| 3866 | break; |
| 3867 | |
| 3868 | case 112: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3869 | #line 1232 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3870 | { (yyval.ParamAttrs) = ParamAttr::ByVal; ;} |
| 3871 | break; |
| 3872 | |
| 3873 | case 113: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3874 | #line 1233 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3875 | { (yyval.ParamAttrs) = ParamAttr::Nest; ;} |
| 3876 | break; |
| 3877 | |
| 3878 | case 114: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3879 | #line 1234 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3880 | { (yyval.ParamAttrs) = |
| 3881 | ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;} |
| 3882 | break; |
| 3883 | |
| 3884 | case 115: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3885 | #line 1238 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3886 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3887 | break; |
| 3888 | |
| 3889 | case 116: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3890 | #line 1239 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3891 | { |
| 3892 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 3893 | ;} |
| 3894 | break; |
| 3895 | |
| 3896 | case 117: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3897 | #line 1244 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3898 | { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;} |
| 3899 | break; |
| 3900 | |
| 3901 | case 118: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3902 | #line 1245 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3903 | { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;} |
| 3904 | break; |
| 3905 | |
| 3906 | case 119: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3907 | #line 1246 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3908 | { (yyval.ParamAttrs) = ParamAttr::ZExt; ;} |
| 3909 | break; |
| 3910 | |
| 3911 | case 120: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3912 | #line 1247 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3913 | { (yyval.ParamAttrs) = ParamAttr::SExt; ;} |
| 3914 | break; |
| 3915 | |
| 3916 | case 121: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3917 | #line 1248 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3918 | { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;} |
| 3919 | break; |
| 3920 | |
| 3921 | case 122: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3922 | #line 1249 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3923 | { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;} |
| 3924 | break; |
| 3925 | |
| 3926 | case 123: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3927 | #line 1252 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3928 | { (yyval.ParamAttrs) = ParamAttr::None; ;} |
| 3929 | break; |
| 3930 | |
| 3931 | case 124: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3932 | #line 1253 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3933 | { |
| 3934 | (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs); |
| 3935 | ;} |
| 3936 | break; |
| 3937 | |
| 3938 | case 125: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3939 | #line 1258 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3940 | { (yyval.StrVal) = 0; ;} |
| 3941 | break; |
| 3942 | |
| 3943 | case 126: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3944 | #line 1259 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3945 | { |
| 3946 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
| 3947 | ;} |
| 3948 | break; |
| 3949 | |
| 3950 | case 127: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3951 | #line 1266 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3952 | { (yyval.UIntVal) = 0; ;} |
| 3953 | break; |
| 3954 | |
| 3955 | case 128: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3956 | #line 1267 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3957 | { |
| 3958 | (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); |
| 3959 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3960 | GEN_ERROR("Alignment must be a power of two"); |
| 3961 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3962 | ;} |
| 3963 | break; |
| 3964 | |
| 3965 | case 129: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3966 | #line 1273 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3967 | { (yyval.UIntVal) = 0; ;} |
| 3968 | break; |
| 3969 | |
| 3970 | case 130: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3971 | #line 1274 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3972 | { |
| 3973 | (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); |
| 3974 | if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 3975 | GEN_ERROR("Alignment must be a power of two"); |
| 3976 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3977 | ;} |
| 3978 | break; |
| 3979 | |
| 3980 | case 131: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3981 | #line 1283 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3982 | { |
| 3983 | for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i) |
| 3984 | if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\') |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3985 | GEN_ERROR("Invalid character in section name"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3986 | (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3987 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3988 | ;} |
| 3989 | break; |
| 3990 | |
| 3991 | case 132: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3992 | #line 1291 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3993 | { (yyval.StrVal) = 0; ;} |
| 3994 | break; |
| 3995 | |
| 3996 | case 133: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 3997 | #line 1292 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 3998 | { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} |
| 3999 | break; |
| 4000 | |
| 4001 | case 134: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4002 | #line 1297 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4003 | {;} |
| 4004 | break; |
| 4005 | |
| 4006 | case 135: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4007 | #line 1298 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4008 | {;} |
| 4009 | break; |
| 4010 | |
| 4011 | case 136: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4012 | #line 1299 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4013 | { |
| 4014 | CurGV->setSection(*(yyvsp[(1) - (1)].StrVal)); |
| 4015 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4016 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4017 | ;} |
| 4018 | break; |
| 4019 | |
| 4020 | case 137: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4021 | #line 1304 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4022 | { |
| 4023 | if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4024 | GEN_ERROR("Alignment must be a power of two"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4025 | CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4026 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4027 | ;} |
| 4028 | break; |
| 4029 | |
| 4030 | case 145: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4031 | #line 1320 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4032 | { |
| 4033 | (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4034 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4035 | ;} |
| 4036 | break; |
| 4037 | |
| 4038 | case 146: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4039 | #line 1324 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4040 | { |
| 4041 | (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4042 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4043 | ;} |
| 4044 | break; |
| 4045 | |
| 4046 | case 147: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4047 | #line 1328 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4048 | { // Pointer type? |
| 4049 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy) |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4050 | GEN_ERROR("Cannot form a pointer to a basic block"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4051 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal)))); |
| 4052 | delete (yyvsp[(1) - (3)].TypeVal); |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4053 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4054 | ;} |
| 4055 | break; |
| 4056 | |
| 4057 | case 148: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4058 | #line 1335 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4059 | { // Named types are also simple types... |
| 4060 | const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal)); |
Christopher Lamb | 0a24358 | 2007-12-11 09:02:08 +0000 | [diff] [blame] | 4061 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4062 | (yyval.TypeVal) = new PATypeHolder(tmp); |
| 4063 | ;} |
| 4064 | break; |
| 4065 | |
| 4066 | case 149: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4067 | #line 1340 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4068 | { // Type UpReference |
| 4069 | if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4070 | OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4071 | UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... |
| 4072 | (yyval.TypeVal) = new PATypeHolder(OT); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4073 | UR_OUT("New Upreference!\n"); |
| 4074 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4075 | ;} |
| 4076 | break; |
| 4077 | |
| 4078 | case 150: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4079 | #line 1348 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4080 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4081 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4082 | // FIXME: remove in LLVM 3.0. |
Chris Lattner | 73de3c0 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 4083 | const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal); |
| 4084 | if (!FunctionType::isValidReturnType(RetTy)) |
| 4085 | GEN_ERROR("Invalid result type for LLVM function"); |
| 4086 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4087 | std::vector<const Type*> Params; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4088 | TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4089 | for (; I != E; ++I ) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4090 | const Type *Ty = I->Ty->get(); |
| 4091 | Params.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4092 | } |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4093 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4094 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4095 | if (isVarArg) Params.pop_back(); |
| 4096 | |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4097 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4098 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4099 | GEN_ERROR("Function arguments must be value types!"); |
| 4100 | |
| 4101 | CHECK_FOR_ERROR |
| 4102 | |
Anton Korobeynikov | 0cdd269 | 2007-12-03 19:17:47 +0000 | [diff] [blame] | 4103 | FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4104 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4105 | delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle |
| 4106 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4107 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4108 | ;} |
| 4109 | break; |
| 4110 | |
| 4111 | case 151: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4112 | #line 1377 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4113 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4114 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4115 | // FIXME: remove in LLVM 3.0. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4116 | std::vector<const Type*> Params; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4117 | TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end(); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4118 | for ( ; I != E; ++I ) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4119 | const Type* Ty = I->Ty->get(); |
| 4120 | Params.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4121 | } |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4122 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4123 | bool isVarArg = Params.size() && Params.back() == Type::VoidTy; |
| 4124 | if (isVarArg) Params.pop_back(); |
| 4125 | |
Anton Korobeynikov | e286f6d | 2007-12-03 21:01:29 +0000 | [diff] [blame] | 4126 | for (unsigned i = 0; i != Params.size(); ++i) |
| 4127 | if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i]))) |
| 4128 | GEN_ERROR("Function arguments must be value types!"); |
| 4129 | |
| 4130 | CHECK_FOR_ERROR |
| 4131 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4132 | FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg); |
| 4133 | delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list |
| 4134 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4135 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4136 | ;} |
| 4137 | break; |
| 4138 | |
| 4139 | case 152: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4140 | #line 1402 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4141 | { // Sized array type? |
| 4142 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4143 | delete (yyvsp[(4) - (5)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4144 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4145 | ;} |
| 4146 | break; |
| 4147 | |
| 4148 | case 153: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4149 | #line 1407 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4150 | { // Vector type? |
| 4151 | const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); |
| 4152 | if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4153 | GEN_ERROR("Unsigned result not equal to signed result"); |
| 4154 | if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) |
| 4155 | GEN_ERROR("Element type of a VectorType must be primitive"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4156 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); |
| 4157 | delete (yyvsp[(4) - (5)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4158 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4159 | ;} |
| 4160 | break; |
| 4161 | |
| 4162 | case 154: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4163 | #line 1417 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4164 | { // Structure type? |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4165 | std::vector<const Type*> Elements; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4166 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), |
| 4167 | E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4168 | Elements.push_back(*I); |
| 4169 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4170 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); |
| 4171 | delete (yyvsp[(2) - (3)].TypeList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4172 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4173 | ;} |
| 4174 | break; |
| 4175 | |
| 4176 | case 155: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4177 | #line 1427 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4178 | { // Empty structure type? |
| 4179 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>())); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4180 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4181 | ;} |
| 4182 | break; |
| 4183 | |
| 4184 | case 156: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4185 | #line 1431 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4186 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4187 | std::vector<const Type*> Elements; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4188 | for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), |
| 4189 | E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4190 | Elements.push_back(*I); |
| 4191 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4192 | (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true))); |
| 4193 | delete (yyvsp[(3) - (5)].TypeList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4194 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4195 | ;} |
| 4196 | break; |
| 4197 | |
| 4198 | case 157: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4199 | #line 1441 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4200 | { // Empty structure type? |
| 4201 | (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4202 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4203 | ;} |
| 4204 | break; |
| 4205 | |
| 4206 | case 158: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4207 | #line 1448 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4208 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 4209 | // Allow but ignore attributes on function types; this permits auto-upgrade. |
| 4210 | // FIXME: remove in LLVM 3.0. |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4211 | (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); |
| 4212 | (yyval.TypeWithAttrs).Attrs = ParamAttr::None; |
| 4213 | ;} |
| 4214 | break; |
| 4215 | |
| 4216 | case 159: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4217 | #line 1457 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4218 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4219 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4220 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); |
| 4221 | if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4222 | GEN_ERROR("LLVM functions cannot return aggregate types"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4223 | (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); |
| 4224 | ;} |
| 4225 | break; |
| 4226 | |
| 4227 | case 160: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4228 | #line 1464 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4229 | { |
| 4230 | (yyval.TypeVal) = new PATypeHolder(Type::VoidTy); |
| 4231 | ;} |
| 4232 | break; |
| 4233 | |
| 4234 | case 161: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4235 | #line 1469 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4236 | { |
| 4237 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
| 4238 | (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4239 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4240 | ;} |
| 4241 | break; |
| 4242 | |
| 4243 | case 162: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4244 | #line 1474 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4245 | { |
| 4246 | ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4247 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4248 | ;} |
| 4249 | break; |
| 4250 | |
| 4251 | case 164: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4252 | #line 1482 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4253 | { |
| 4254 | (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4255 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 4256 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4257 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4258 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4259 | ;} |
| 4260 | break; |
| 4261 | |
| 4262 | case 165: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4263 | #line 1489 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4264 | { |
| 4265 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4266 | TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; |
| 4267 | TWA.Ty = new PATypeHolder(Type::VoidTy); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4268 | (yyval.TypeWithAttrsList)->push_back(TWA); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4269 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4270 | ;} |
| 4271 | break; |
| 4272 | |
| 4273 | case 166: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4274 | #line 1496 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4275 | { |
| 4276 | (yyval.TypeWithAttrsList) = new TypeWithAttrsList(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4277 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4278 | ;} |
| 4279 | break; |
| 4280 | |
| 4281 | case 167: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4282 | #line 1504 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4283 | { |
| 4284 | (yyval.TypeList) = new std::list<PATypeHolder>(); |
| 4285 | (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); |
| 4286 | delete (yyvsp[(1) - (1)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4287 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4288 | ;} |
| 4289 | break; |
| 4290 | |
| 4291 | case 168: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4292 | #line 1510 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4293 | { |
| 4294 | ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); |
| 4295 | delete (yyvsp[(3) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4296 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4297 | ;} |
| 4298 | break; |
| 4299 | |
| 4300 | case 169: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4301 | #line 1522 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4302 | { // Nonempty unsized arr |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4303 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4304 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4305 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4306 | if (ATy == 0) |
| 4307 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4308 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4309 | const Type *ETy = ATy->getElementType(); |
| 4310 | int NumElements = ATy->getNumElements(); |
| 4311 | |
| 4312 | // Verify that we have the correct size... |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4313 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4314 | GEN_ERROR("Type mismatch: constant sized array initialized with " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4315 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4316 | itostr(NumElements) + ""); |
| 4317 | |
| 4318 | // Verify all elements are correct type! |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4319 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4320 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4321 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4322 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4323 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4324 | } |
| 4325 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4326 | (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4327 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4328 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4329 | ;} |
| 4330 | break; |
| 4331 | |
| 4332 | case 170: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4333 | #line 1550 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4334 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4335 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4336 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4337 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4338 | if (ATy == 0) |
| 4339 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4340 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4341 | |
| 4342 | int NumElements = ATy->getNumElements(); |
| 4343 | if (NumElements != -1 && NumElements != 0) |
| 4344 | GEN_ERROR("Type mismatch: constant sized array initialized with 0" |
| 4345 | " arguments, but has size of " + itostr(NumElements) +""); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4346 | (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>()); |
| 4347 | delete (yyvsp[(1) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4348 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4349 | ;} |
| 4350 | break; |
| 4351 | |
| 4352 | case 171: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4353 | #line 1566 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4354 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4355 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4356 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4357 | const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4358 | if (ATy == 0) |
| 4359 | GEN_ERROR("Cannot make array constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4360 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4361 | |
| 4362 | int NumElements = ATy->getNumElements(); |
| 4363 | const Type *ETy = ATy->getElementType(); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4364 | if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4365 | GEN_ERROR("Can't build string constant of size " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4366 | itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4367 | " when array has size " + itostr(NumElements) + ""); |
| 4368 | std::vector<Constant*> Vals; |
| 4369 | if (ETy == Type::Int8Ty) { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4370 | for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i) |
| 4371 | Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i])); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4372 | } else { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4373 | delete (yyvsp[(3) - (3)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4374 | GEN_ERROR("Cannot build string arrays of non byte sized elements"); |
| 4375 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4376 | delete (yyvsp[(3) - (3)].StrVal); |
| 4377 | (yyval.ConstVal) = ConstantArray::get(ATy, Vals); |
| 4378 | delete (yyvsp[(1) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4379 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4380 | ;} |
| 4381 | break; |
| 4382 | |
| 4383 | case 172: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4384 | #line 1593 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4385 | { // Nonempty unsized arr |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4386 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4387 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
| 4388 | const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4389 | if (PTy == 0) |
| 4390 | GEN_ERROR("Cannot make packed constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4391 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4392 | const Type *ETy = PTy->getElementType(); |
| 4393 | int NumElements = PTy->getNumElements(); |
| 4394 | |
| 4395 | // Verify that we have the correct size... |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4396 | if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4397 | GEN_ERROR("Type mismatch: constant sized packed initialized with " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4398 | utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4399 | itostr(NumElements) + ""); |
| 4400 | |
| 4401 | // Verify all elements are correct type! |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4402 | for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { |
| 4403 | if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4404 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 4405 | ETy->getDescription() +"' as required!\nIt is of type '"+ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4406 | (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4407 | } |
| 4408 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4409 | (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4410 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4411 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4412 | ;} |
| 4413 | break; |
| 4414 | |
| 4415 | case 173: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4416 | #line 1621 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4417 | { |
| 4418 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4419 | if (STy == 0) |
| 4420 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4421 | (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4422 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4423 | if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4424 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4425 | |
| 4426 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4427 | for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) |
| 4428 | if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4429 | GEN_ERROR("Expected type '" + |
| 4430 | STy->getElementType(i)->getDescription() + |
| 4431 | "' for element #" + utostr(i) + |
| 4432 | " of structure initializer"); |
| 4433 | |
| 4434 | // Check to ensure that Type is not packed |
| 4435 | if (STy->isPacked()) |
| 4436 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4437 | STy->getDescription() + "'"); |
| 4438 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4439 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); |
| 4440 | delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4441 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4442 | ;} |
| 4443 | break; |
| 4444 | |
| 4445 | case 174: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4446 | #line 1647 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4447 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4448 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4449 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 4450 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4451 | if (STy == 0) |
| 4452 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4453 | (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4454 | |
| 4455 | if (STy->getNumContainedTypes() != 0) |
| 4456 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4457 | |
| 4458 | // Check to ensure that Type is not packed |
| 4459 | if (STy->isPacked()) |
| 4460 | GEN_ERROR("Unpacked Initializer to vector type '" + |
| 4461 | STy->getDescription() + "'"); |
| 4462 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4463 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4464 | delete (yyvsp[(1) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4465 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4466 | ;} |
| 4467 | break; |
| 4468 | |
| 4469 | case 175: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4470 | #line 1667 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4471 | { |
| 4472 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4473 | if (STy == 0) |
| 4474 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4475 | (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4476 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4477 | if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4478 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4479 | |
| 4480 | // Check to ensure that constants are compatible with the type initializer! |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4481 | for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) |
| 4482 | if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4483 | GEN_ERROR("Expected type '" + |
| 4484 | STy->getElementType(i)->getDescription() + |
| 4485 | "' for element #" + utostr(i) + |
| 4486 | " of structure initializer"); |
| 4487 | |
| 4488 | // Check to ensure that Type is packed |
| 4489 | if (!STy->isPacked()) |
| 4490 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4491 | STy->getDescription() + "'"); |
| 4492 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4493 | (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector)); |
| 4494 | delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4495 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4496 | ;} |
| 4497 | break; |
| 4498 | |
| 4499 | case 176: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4500 | #line 1693 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4501 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4502 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4503 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription()); |
| 4504 | const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4505 | if (STy == 0) |
| 4506 | GEN_ERROR("Cannot make struct constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4507 | (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4508 | |
| 4509 | if (STy->getNumContainedTypes() != 0) |
| 4510 | GEN_ERROR("Illegal number of initializers for structure type"); |
| 4511 | |
| 4512 | // Check to ensure that Type is packed |
| 4513 | if (!STy->isPacked()) |
| 4514 | GEN_ERROR("Vector initializer to non-vector type '" + |
| 4515 | STy->getDescription() + "'"); |
| 4516 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4517 | (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>()); |
| 4518 | delete (yyvsp[(1) - (5)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4519 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4520 | ;} |
| 4521 | break; |
| 4522 | |
| 4523 | case 177: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4524 | #line 1713 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4525 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4526 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4527 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4528 | const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4529 | if (PTy == 0) |
| 4530 | GEN_ERROR("Cannot make null pointer constant with type: '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4531 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4532 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4533 | (yyval.ConstVal) = ConstantPointerNull::get(PTy); |
| 4534 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4535 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4536 | ;} |
| 4537 | break; |
| 4538 | |
| 4539 | case 178: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4540 | #line 1725 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4541 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4542 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4543 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4544 | (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); |
| 4545 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4546 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4547 | ;} |
| 4548 | break; |
| 4549 | |
| 4550 | case 179: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4551 | #line 1732 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4552 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4553 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4554 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4555 | const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4556 | if (Ty == 0) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4557 | GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4558 | |
| 4559 | // ConstExprs can exist in the body of a function, thus creating |
| 4560 | // GlobalValues whenever they refer to a variable. Because we are in |
| 4561 | // the context of a function, getExistingVal will search the functions |
| 4562 | // symbol table instead of the module symbol table for the global symbol, |
| 4563 | // which throws things all off. To get around this, we just tell |
| 4564 | // getExistingVal that we are at global scope here. |
| 4565 | // |
| 4566 | Function *SavedCurFn = CurFun.CurrentFunction; |
| 4567 | CurFun.CurrentFunction = 0; |
| 4568 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4569 | Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4570 | CHECK_FOR_ERROR |
| 4571 | |
| 4572 | CurFun.CurrentFunction = SavedCurFn; |
| 4573 | |
| 4574 | // If this is an initializer for a constant pointer, which is referencing a |
| 4575 | // (currently) undefined variable, create a stub now that shall be replaced |
| 4576 | // in the future with the right type of variable. |
| 4577 | // |
| 4578 | if (V == 0) { |
| 4579 | assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!"); |
| 4580 | const PointerType *PT = cast<PointerType>(Ty); |
| 4581 | |
| 4582 | // First check to see if the forward references value is already created! |
| 4583 | PerModuleInfo::GlobalRefsType::iterator I = |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4584 | CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4585 | |
| 4586 | if (I != CurModule.GlobalRefs.end()) { |
| 4587 | V = I->second; // Placeholder already exists, use it... |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4588 | (yyvsp[(2) - (2)].ValIDVal).destroy(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4589 | } else { |
| 4590 | std::string Name; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4591 | if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName) |
| 4592 | Name = (yyvsp[(2) - (2)].ValIDVal).getName(); |
| 4593 | else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4594 | GEN_ERROR("Invalid reference to global"); |
| 4595 | |
| 4596 | // Create the forward referenced global. |
| 4597 | GlobalValue *GV; |
| 4598 | if (const FunctionType *FTy = |
| 4599 | dyn_cast<FunctionType>(PT->getElementType())) { |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 4600 | GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name, |
| 4601 | CurModule.CurrentModule); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4602 | } else { |
| 4603 | GV = new GlobalVariable(PT->getElementType(), false, |
| 4604 | GlobalValue::ExternalWeakLinkage, 0, |
| 4605 | Name, CurModule.CurrentModule); |
| 4606 | } |
| 4607 | |
| 4608 | // Keep track of the fact that we have a forward ref to recycle it |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4609 | CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4610 | V = GV; |
| 4611 | } |
| 4612 | } |
| 4613 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4614 | (yyval.ConstVal) = cast<GlobalValue>(V); |
| 4615 | delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4616 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4617 | ;} |
| 4618 | break; |
| 4619 | |
| 4620 | case 180: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4621 | #line 1798 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4622 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4623 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4624 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4625 | if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4626 | GEN_ERROR("Mismatched types for constant expression: " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4627 | (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription()); |
| 4628 | (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); |
| 4629 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4630 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4631 | ;} |
| 4632 | break; |
| 4633 | |
| 4634 | case 181: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4635 | #line 1808 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4636 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4637 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4638 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 4639 | const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4640 | if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty)) |
| 4641 | GEN_ERROR("Cannot create a null initialized value of this type"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4642 | (yyval.ConstVal) = Constant::getNullValue(Ty); |
| 4643 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4644 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4645 | ;} |
| 4646 | break; |
| 4647 | |
| 4648 | case 182: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4649 | #line 1818 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4650 | { // integral constants |
| 4651 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4652 | GEN_ERROR("Constant value doesn't fit in type"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4653 | (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4654 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4655 | ;} |
| 4656 | break; |
| 4657 | |
| 4658 | case 183: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4659 | #line 1824 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4660 | { // arbitrary precision integer constants |
| 4661 | uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); |
| 4662 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4663 | GEN_ERROR("Constant value does not fit in type"); |
| 4664 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4665 | (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth); |
| 4666 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4667 | delete (yyvsp[(2) - (2)].APIntVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4668 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4669 | ;} |
| 4670 | break; |
| 4671 | |
| 4672 | case 184: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4673 | #line 1834 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4674 | { // integral constants |
| 4675 | if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4676 | GEN_ERROR("Constant value doesn't fit in type"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4677 | (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4678 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4679 | ;} |
| 4680 | break; |
| 4681 | |
| 4682 | case 185: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4683 | #line 1840 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4684 | { // arbitrary precision integer constants |
| 4685 | uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth(); |
| 4686 | if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4687 | GEN_ERROR("Constant value does not fit in type"); |
| 4688 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4689 | (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth); |
| 4690 | (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal)); |
| 4691 | delete (yyvsp[(2) - (2)].APIntVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4692 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4693 | ;} |
| 4694 | break; |
| 4695 | |
| 4696 | case 186: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4697 | #line 1850 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4698 | { // Boolean constants |
| 4699 | assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4700 | (yyval.ConstVal) = ConstantInt::getTrue(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4701 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4702 | ;} |
| 4703 | break; |
| 4704 | |
| 4705 | case 187: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4706 | #line 1855 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4707 | { // Boolean constants |
| 4708 | assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 4709 | (yyval.ConstVal) = ConstantInt::getFalse(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4710 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4711 | ;} |
| 4712 | break; |
| 4713 | |
| 4714 | case 188: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4715 | #line 1860 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4716 | { // Floating point constants |
| 4717 | if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4718 | GEN_ERROR("Floating point constant invalid for type"); |
Dale Johannesen | 255b8fe | 2007-09-11 18:33:39 +0000 | [diff] [blame] | 4719 | // Lexer has no type info, so builds all float and double FP constants |
| 4720 | // as double. Fix this here. Long double is done right. |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4721 | if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy) |
| 4722 | (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); |
Chris Lattner | 05ba86e | 2008-04-20 00:41:19 +0000 | [diff] [blame] | 4723 | (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal)); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4724 | delete (yyvsp[(2) - (2)].FPVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4725 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4726 | ;} |
| 4727 | break; |
| 4728 | |
| 4729 | case 189: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4730 | #line 1873 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4731 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4732 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4733 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); |
| 4734 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 4735 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 4736 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4737 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4738 | Val->getType()->getDescription() + "' to '" + |
| 4739 | DestTy->getDescription() + "'"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4740 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
| 4741 | delete (yyvsp[(5) - (6)].TypeVal); |
| 4742 | ;} |
| 4743 | break; |
| 4744 | |
| 4745 | case 190: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4746 | #line 1885 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4747 | { |
| 4748 | if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4749 | GEN_ERROR("GetElementPtr requires a pointer operand"); |
| 4750 | |
| 4751 | const Type *IdxTy = |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4752 | GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4753 | true); |
| 4754 | if (!IdxTy) |
| 4755 | GEN_ERROR("Index list invalid for constant getelementptr"); |
| 4756 | |
| 4757 | SmallVector<Constant*, 8> IdxVec; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4758 | for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) |
| 4759 | if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i])) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4760 | IdxVec.push_back(C); |
| 4761 | else |
| 4762 | GEN_ERROR("Indices to constant getelementptr must be constants"); |
| 4763 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4764 | delete (yyvsp[(4) - (5)].ValueList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4765 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4766 | (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4767 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4768 | ;} |
| 4769 | break; |
| 4770 | |
| 4771 | case 191: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4772 | #line 1907 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4773 | { |
| 4774 | if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4775 | GEN_ERROR("Select condition must be of boolean type"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4776 | if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4777 | GEN_ERROR("Select operand types must match"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4778 | (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4779 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4780 | ;} |
| 4781 | break; |
| 4782 | |
| 4783 | case 192: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4784 | #line 1915 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4785 | { |
| 4786 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4787 | GEN_ERROR("Binary operator types must match"); |
| 4788 | CHECK_FOR_ERROR; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4789 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
| 4790 | ;} |
| 4791 | break; |
| 4792 | |
| 4793 | case 193: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4794 | #line 1921 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4795 | { |
| 4796 | if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4797 | GEN_ERROR("Logical operator types must match"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4798 | if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) { |
| 4799 | if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) || |
| 4800 | !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4801 | GEN_ERROR("Logical operator requires integral operands"); |
| 4802 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4803 | (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4804 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4805 | ;} |
| 4806 | break; |
| 4807 | |
| 4808 | case 194: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4809 | #line 1932 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4810 | { |
| 4811 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4812 | GEN_ERROR("icmp operand types must match"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4813 | (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4814 | ;} |
| 4815 | break; |
| 4816 | |
| 4817 | case 195: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4818 | #line 1937 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4819 | { |
| 4820 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4821 | GEN_ERROR("fcmp operand types must match"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4822 | (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4823 | ;} |
| 4824 | break; |
| 4825 | |
| 4826 | case 196: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4827 | #line 1942 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4828 | { |
| 4829 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 4830 | GEN_ERROR("vicmp operand types must match"); |
| 4831 | (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4832 | ;} |
| 4833 | break; |
| 4834 | |
| 4835 | case 197: |
| 4836 | #line 1947 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4837 | { |
| 4838 | if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType()) |
| 4839 | GEN_ERROR("vfcmp operand types must match"); |
| 4840 | (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal)); |
| 4841 | ;} |
| 4842 | break; |
| 4843 | |
| 4844 | case 198: |
| 4845 | #line 1952 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4846 | { |
| 4847 | if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4848 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4849 | (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4850 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4851 | ;} |
| 4852 | break; |
| 4853 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4854 | case 199: |
| 4855 | #line 1958 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4856 | { |
| 4857 | if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4858 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4859 | (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4860 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4861 | ;} |
| 4862 | break; |
| 4863 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4864 | case 200: |
| 4865 | #line 1964 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4866 | { |
| 4867 | if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4868 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4869 | (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4870 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4871 | ;} |
| 4872 | break; |
| 4873 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4874 | case 201: |
| 4875 | #line 1973 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4876 | { |
| 4877 | ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4878 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4879 | ;} |
| 4880 | break; |
| 4881 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4882 | case 202: |
| 4883 | #line 1977 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4884 | { |
| 4885 | (yyval.ConstVector) = new std::vector<Constant*>(); |
| 4886 | (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4887 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4888 | ;} |
| 4889 | break; |
| 4890 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4891 | case 203: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4892 | #line 1985 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4893 | { (yyval.BoolVal) = false; ;} |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4894 | break; |
| 4895 | |
| 4896 | case 204: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4897 | #line 1985 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4898 | { (yyval.BoolVal) = true; ;} |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4899 | break; |
| 4900 | |
| 4901 | case 205: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4902 | #line 1988 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4903 | { (yyval.BoolVal) = true; ;} |
| 4904 | break; |
| 4905 | |
| 4906 | case 206: |
| 4907 | #line 1988 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4908 | { (yyval.BoolVal) = false; ;} |
| 4909 | break; |
| 4910 | |
| 4911 | case 207: |
| 4912 | #line 1991 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4913 | { |
| 4914 | const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get(); |
| 4915 | Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal)); |
Chris Lattner | bb856a3 | 2007-08-06 21:00:46 +0000 | [diff] [blame] | 4916 | CHECK_FOR_ERROR |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4917 | GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); |
| 4918 | if (!Aliasee) |
| 4919 | GEN_ERROR("Aliases can be created only to global values"); |
| 4920 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4921 | (yyval.ConstVal) = Aliasee; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4922 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4923 | delete (yyvsp[(1) - (2)].TypeVal); |
| 4924 | ;} |
| 4925 | break; |
| 4926 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4927 | case 208: |
| 4928 | #line 2003 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4929 | { |
| 4930 | Constant *Val = (yyvsp[(3) - (6)].ConstVal); |
| 4931 | const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get(); |
| 4932 | if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4933 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 4934 | Val->getType()->getDescription() + "' to '" + |
| 4935 | DestTy->getDescription() + "'"); |
| 4936 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4937 | (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4938 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4939 | delete (yyvsp[(5) - (6)].TypeVal); |
| 4940 | ;} |
| 4941 | break; |
| 4942 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4943 | case 209: |
| 4944 | #line 2024 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4945 | { |
| 4946 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 4947 | CurModule.ModuleDone(); |
| 4948 | CHECK_FOR_ERROR; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4949 | ;} |
| 4950 | break; |
| 4951 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4952 | case 210: |
| 4953 | #line 2029 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4954 | { |
| 4955 | (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule; |
Dale Johannesen | a79ecf3 | 2008-02-20 21:15:43 +0000 | [diff] [blame] | 4956 | CurModule.ModuleDone(); |
| 4957 | CHECK_FOR_ERROR; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4958 | ;} |
| 4959 | break; |
| 4960 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4961 | case 213: |
| 4962 | #line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4963 | { CurFun.isDeclare = false; ;} |
| 4964 | break; |
| 4965 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4966 | case 214: |
| 4967 | #line 2042 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4968 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4969 | CurFun.FunctionDone(); |
| 4970 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4971 | ;} |
| 4972 | break; |
| 4973 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4974 | case 215: |
| 4975 | #line 2046 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4976 | { CurFun.isDeclare = true; ;} |
| 4977 | break; |
| 4978 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4979 | case 216: |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 4980 | #line 2046 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4981 | { |
| 4982 | CHECK_FOR_ERROR |
| 4983 | ;} |
| 4984 | break; |
| 4985 | |
| 4986 | case 217: |
| 4987 | #line 2049 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 4988 | { |
| 4989 | CHECK_FOR_ERROR |
| 4990 | ;} |
| 4991 | break; |
| 4992 | |
| 4993 | case 218: |
| 4994 | #line 2052 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4995 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4996 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 4997 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 4998 | // Eagerly resolve types. This is not an optimization, this is a |
| 4999 | // requirement that is due to the fact that we could have this: |
| 5000 | // |
| 5001 | // %list = type { %list * } |
| 5002 | // %list = type { %list * } ; repeated type decl |
| 5003 | // |
| 5004 | // If types are not resolved eagerly, then the two types will not be |
| 5005 | // determined to be the same type! |
| 5006 | // |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5007 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5008 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5009 | if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5010 | CHECK_FOR_ERROR |
| 5011 | // If this is a named type that is not a redefinition, add it to the slot |
| 5012 | // table. |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5013 | CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5014 | } |
| 5015 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5016 | delete (yyvsp[(3) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5017 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5018 | ;} |
| 5019 | break; |
Reid Spencer | aa8ae28 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 5020 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5021 | case 219: |
| 5022 | #line 2076 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5023 | { |
| 5024 | ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType)); |
| 5025 | |
| 5026 | if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5027 | CHECK_FOR_ERROR |
| 5028 | // If this is a named type that is not a redefinition, add it to the slot |
| 5029 | // table. |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5030 | CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5031 | } |
| 5032 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5033 | ;} |
| 5034 | break; |
| 5035 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5036 | case 220: |
| 5037 | #line 2088 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5038 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5039 | /* "Externally Visible" Linkage */ |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5040 | if ((yyvsp[(5) - (6)].ConstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5041 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5042 | CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage, |
| 5043 | (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)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5044 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5045 | ;} |
| 5046 | break; |
| 5047 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5048 | case 221: |
| 5049 | #line 2095 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5050 | { |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5051 | CurGV = 0; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5052 | ;} |
| 5053 | break; |
| 5054 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5055 | case 222: |
| 5056 | #line 2099 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5057 | { |
| 5058 | if ((yyvsp[(6) - (7)].ConstVal) == 0) |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5059 | GEN_ERROR("Global value initializer is not a constant"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5060 | 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 | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5061 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5062 | ;} |
| 5063 | break; |
| 5064 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5065 | case 223: |
| 5066 | #line 2104 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5067 | { |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5068 | CurGV = 0; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5069 | ;} |
| 5070 | break; |
| 5071 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5072 | case 224: |
| 5073 | #line 2108 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5074 | { |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5075 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5076 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription()); |
| 5077 | 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 | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5078 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5079 | delete (yyvsp[(6) - (7)].TypeVal); |
| 5080 | ;} |
| 5081 | break; |
| 5082 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5083 | case 225: |
| 5084 | #line 2114 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5085 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5086 | CurGV = 0; |
| 5087 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5088 | ;} |
| 5089 | break; |
| 5090 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5091 | case 226: |
| 5092 | #line 2118 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5093 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5094 | std::string Name; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5095 | if ((yyvsp[(1) - (5)].StrVal)) { |
| 5096 | Name = *(yyvsp[(1) - (5)].StrVal); |
| 5097 | delete (yyvsp[(1) - (5)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5098 | } |
| 5099 | if (Name.empty()) |
| 5100 | GEN_ERROR("Alias name cannot be empty"); |
| 5101 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5102 | Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5103 | if (Aliasee == 0) |
| 5104 | GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name); |
| 5105 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5106 | GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5107 | CurModule.CurrentModule); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5108 | GA->setVisibility((yyvsp[(2) - (5)].Visibility)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5109 | InsertValue(GA, CurModule.Values); |
Chris Lattner | 5eefce3 | 2007-09-10 23:24:14 +0000 | [diff] [blame] | 5110 | |
| 5111 | |
| 5112 | // If there was a forward reference of this alias, resolve it now. |
| 5113 | |
| 5114 | ValID ID; |
| 5115 | if (!Name.empty()) |
| 5116 | ID = ValID::createGlobalName(Name); |
| 5117 | else |
| 5118 | ID = ValID::createGlobalID(CurModule.Values.size()-1); |
| 5119 | |
| 5120 | if (GlobalValue *FWGV = |
| 5121 | CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { |
| 5122 | // Replace uses of the fwdref with the actual alias. |
| 5123 | FWGV->replaceAllUsesWith(GA); |
| 5124 | if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV)) |
| 5125 | GV->eraseFromParent(); |
| 5126 | else |
| 5127 | cast<Function>(FWGV)->eraseFromParent(); |
| 5128 | } |
| 5129 | ID.destroy(); |
| 5130 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5131 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5132 | ;} |
| 5133 | break; |
| 5134 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5135 | case 227: |
| 5136 | #line 2158 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5137 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5138 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5139 | ;} |
| 5140 | break; |
| 5141 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5142 | case 228: |
| 5143 | #line 2161 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5144 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5145 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5146 | ;} |
| 5147 | break; |
| 5148 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5149 | case 229: |
| 5150 | #line 2167 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5151 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5152 | const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); |
| 5153 | if (AsmSoFar.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5154 | CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5155 | else |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5156 | CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal)); |
| 5157 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5158 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5159 | ;} |
| 5160 | break; |
| 5161 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5162 | case 230: |
| 5163 | #line 2177 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5164 | { |
| 5165 | CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal)); |
| 5166 | delete (yyvsp[(3) - (3)].StrVal); |
| 5167 | ;} |
| 5168 | break; |
| 5169 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5170 | case 231: |
| 5171 | #line 2181 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5172 | { |
| 5173 | CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal)); |
| 5174 | delete (yyvsp[(3) - (3)].StrVal); |
| 5175 | ;} |
| 5176 | break; |
| 5177 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5178 | case 233: |
| 5179 | #line 2188 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5180 | { |
| 5181 | CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal)); |
| 5182 | delete (yyvsp[(3) - (3)].StrVal); |
Christopher Lamb | 668d9a0 | 2007-12-12 08:45:45 +0000 | [diff] [blame] | 5183 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5184 | ;} |
| 5185 | break; |
| 5186 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5187 | case 234: |
| 5188 | #line 2193 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5189 | { |
| 5190 | CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal)); |
| 5191 | delete (yyvsp[(1) - (1)].StrVal); |
Reid Spencer | 4747002 | 2007-07-31 14:41:17 +0000 | [diff] [blame] | 5192 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5193 | ;} |
| 5194 | break; |
| 5195 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5196 | case 235: |
| 5197 | #line 2198 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5198 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5199 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5200 | ;} |
| 5201 | break; |
| 5202 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5203 | case 236: |
| 5204 | #line 2207 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5205 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5206 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5207 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 5208 | if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5209 | GEN_ERROR("void typed arguments are invalid"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5210 | ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal); |
| 5211 | (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList); |
| 5212 | (yyvsp[(1) - (5)].ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5213 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5214 | ;} |
| 5215 | break; |
| 5216 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5217 | case 237: |
| 5218 | #line 2217 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5219 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5220 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5221 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription()); |
| 5222 | if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5223 | GEN_ERROR("void typed arguments are invalid"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5224 | ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal); |
| 5225 | (yyval.ArgList) = new ArgListType; |
| 5226 | (yyval.ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5227 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5228 | ;} |
| 5229 | break; |
| 5230 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5231 | case 238: |
| 5232 | #line 2228 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5233 | { |
| 5234 | (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5235 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5236 | ;} |
| 5237 | break; |
| 5238 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5239 | case 239: |
| 5240 | #line 2232 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5241 | { |
| 5242 | (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5243 | struct ArgListEntry E; |
| 5244 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5245 | E.Name = 0; |
| 5246 | E.Attrs = ParamAttr::None; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5247 | (yyval.ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5248 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5249 | ;} |
| 5250 | break; |
| 5251 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5252 | case 240: |
| 5253 | #line 2241 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5254 | { |
| 5255 | (yyval.ArgList) = new ArgListType; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5256 | struct ArgListEntry E; |
| 5257 | E.Ty = new PATypeHolder(Type::VoidTy); |
| 5258 | E.Name = 0; |
| 5259 | E.Attrs = ParamAttr::None; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5260 | (yyval.ArgList)->push_back(E); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5261 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5262 | ;} |
| 5263 | break; |
| 5264 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5265 | case 241: |
| 5266 | #line 2250 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5267 | { |
| 5268 | (yyval.ArgList) = 0; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5269 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5270 | ;} |
| 5271 | break; |
| 5272 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5273 | case 242: |
| 5274 | #line 2256 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5275 | { |
| 5276 | std::string FunctionName(*(yyvsp[(3) - (10)].StrVal)); |
| 5277 | delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory! |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5278 | |
| 5279 | // Check the function result for abstractness if this is a define. We should |
| 5280 | // have no abstract types at this point |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5281 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal))) |
| 5282 | GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5283 | |
Chris Lattner | 73de3c0 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 5284 | if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal))) |
| 5285 | GEN_ERROR("Invalid result type for LLVM function"); |
| 5286 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5287 | std::vector<const Type*> ParamTypeList; |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5288 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5289 | if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) |
| 5290 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs))); |
| 5291 | if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5292 | unsigned index = 1; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5293 | for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5294 | const Type* Ty = I->Ty->get(); |
| 5295 | if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty)) |
| 5296 | GEN_ERROR("Reference to abstract argument: " + Ty->getDescription()); |
| 5297 | ParamTypeList.push_back(Ty); |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5298 | if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None) |
| 5299 | Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5300 | } |
| 5301 | } |
| 5302 | |
| 5303 | bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; |
| 5304 | if (isVarArg) ParamTypeList.pop_back(); |
| 5305 | |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5306 | PAListPtr PAL; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5307 | if (!Attrs.empty()) |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5308 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5309 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5310 | FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg); |
Christopher Lamb | fb623c6 | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5311 | const PointerType *PFT = PointerType::getUnqual(FT); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5312 | delete (yyvsp[(2) - (10)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5313 | |
| 5314 | ValID ID; |
| 5315 | if (!FunctionName.empty()) { |
| 5316 | ID = ValID::createGlobalName((char*)FunctionName.c_str()); |
| 5317 | } else { |
| 5318 | ID = ValID::createGlobalID(CurModule.Values.size()); |
| 5319 | } |
| 5320 | |
| 5321 | Function *Fn = 0; |
| 5322 | // See if this function was forward referenced. If so, recycle the object. |
| 5323 | if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { |
| 5324 | // Move the function to the end of the list, from whereever it was |
| 5325 | // previously inserted. |
| 5326 | Fn = cast<Function>(FWRef); |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5327 | assert(Fn->getParamAttrs().isEmpty() && |
| 5328 | "Forward reference has parameter attributes!"); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5329 | CurModule.CurrentModule->getFunctionList().remove(Fn); |
| 5330 | CurModule.CurrentModule->getFunctionList().push_back(Fn); |
| 5331 | } else if (!FunctionName.empty() && // Merge with an earlier prototype? |
| 5332 | (Fn = CurModule.CurrentModule->getFunction(FunctionName))) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5333 | if (Fn->getFunctionType() != FT ) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5334 | // The existing function doesn't have the same type. This is an overload |
| 5335 | // error. |
| 5336 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5337 | } else if (Fn->getParamAttrs() != PAL) { |
| 5338 | // The existing function doesn't have the same parameter attributes. |
| 5339 | // This is an overload error. |
| 5340 | GEN_ERROR("Overload of function '" + FunctionName + "' not permitted."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5341 | } else if (!CurFun.isDeclare && !Fn->isDeclaration()) { |
| 5342 | // Neither the existing or the current function is a declaration and they |
| 5343 | // have the same name and same type. Clearly this is a redefinition. |
| 5344 | GEN_ERROR("Redefinition of function '" + FunctionName + "'"); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5345 | } else if (Fn->isDeclaration()) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5346 | // Make sure to strip off any argument names so we can't get conflicts. |
| 5347 | for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); |
| 5348 | AI != AE; ++AI) |
| 5349 | AI->setName(""); |
| 5350 | } |
| 5351 | } else { // Not already defined? |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5352 | Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName, |
| 5353 | CurModule.CurrentModule); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5354 | InsertValue(Fn, CurModule.Values); |
| 5355 | } |
| 5356 | |
| 5357 | CurFun.FunctionStart(Fn); |
| 5358 | |
| 5359 | if (CurFun.isDeclare) { |
| 5360 | // If we have declaration, always overwrite linkage. This will allow us to |
| 5361 | // correctly handle cases, when pointer to function is passed as argument to |
| 5362 | // another function. |
| 5363 | Fn->setLinkage(CurFun.Linkage); |
| 5364 | Fn->setVisibility(CurFun.Visibility); |
| 5365 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5366 | Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal)); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5367 | Fn->setParamAttrs(PAL); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5368 | Fn->setAlignment((yyvsp[(9) - (10)].UIntVal)); |
| 5369 | if ((yyvsp[(8) - (10)].StrVal)) { |
| 5370 | Fn->setSection(*(yyvsp[(8) - (10)].StrVal)); |
| 5371 | delete (yyvsp[(8) - (10)].StrVal); |
Gordon Henriksen | 13fe5e3 | 2007-12-10 03:18:06 +0000 | [diff] [blame] | 5372 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5373 | if ((yyvsp[(10) - (10)].StrVal)) { |
| 5374 | Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str()); |
| 5375 | delete (yyvsp[(10) - (10)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5376 | } |
| 5377 | |
| 5378 | // Add all of the arguments we parsed to the function... |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5379 | if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5380 | if (isVarArg) { // Nuke the last entry |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5381 | assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 && |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5382 | "Not a varargs marker!"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5383 | delete (yyvsp[(5) - (10)].ArgList)->back().Ty; |
| 5384 | (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5385 | } |
| 5386 | Function::arg_iterator ArgIt = Fn->arg_begin(); |
| 5387 | Function::arg_iterator ArgEnd = Fn->arg_end(); |
| 5388 | unsigned Idx = 1; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5389 | for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); |
| 5390 | I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5391 | delete I->Ty; // Delete the typeholder... |
| 5392 | setValueName(ArgIt, I->Name); // Insert arg into symtab... |
| 5393 | CHECK_FOR_ERROR |
| 5394 | InsertValue(ArgIt); |
| 5395 | Idx++; |
| 5396 | } |
| 5397 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5398 | delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5399 | } |
| 5400 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5401 | ;} |
| 5402 | break; |
| 5403 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5404 | case 245: |
| 5405 | #line 2386 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5406 | { |
| 5407 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5408 | |
| 5409 | // Make sure that we keep track of the linkage type even if there was a |
| 5410 | // previous "declare". |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5411 | (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); |
| 5412 | (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility)); |
| 5413 | ;} |
| 5414 | break; |
| 5415 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5416 | case 248: |
| 5417 | #line 2397 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5418 | { |
| 5419 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5420 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5421 | ;} |
| 5422 | break; |
| 5423 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5424 | case 249: |
| 5425 | #line 2402 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5426 | { |
| 5427 | CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage)); |
| 5428 | CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility)); |
| 5429 | (yyval.FunctionVal) = CurFun.CurrentFunction; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5430 | CurFun.FunctionDone(); |
| 5431 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5432 | ;} |
| 5433 | break; |
| 5434 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5435 | case 250: |
| 5436 | #line 2414 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5437 | { |
| 5438 | (yyval.BoolVal) = false; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5439 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5440 | ;} |
| 5441 | break; |
| 5442 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5443 | case 251: |
| 5444 | #line 2418 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5445 | { |
| 5446 | (yyval.BoolVal) = true; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5447 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5448 | ;} |
| 5449 | break; |
| 5450 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5451 | case 252: |
| 5452 | #line 2423 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5453 | { // A reference to a direct constant |
| 5454 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5455 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5456 | ;} |
| 5457 | break; |
| 5458 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5459 | case 253: |
| 5460 | #line 2427 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5461 | { |
| 5462 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5463 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5464 | ;} |
| 5465 | break; |
| 5466 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5467 | case 254: |
| 5468 | #line 2431 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5469 | { // Perhaps it's an FP constant? |
| 5470 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5471 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5472 | ;} |
| 5473 | break; |
| 5474 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5475 | case 255: |
| 5476 | #line 2435 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5477 | { |
| 5478 | (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5479 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5480 | ;} |
| 5481 | break; |
| 5482 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5483 | case 256: |
| 5484 | #line 2439 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5485 | { |
| 5486 | (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5487 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5488 | ;} |
| 5489 | break; |
| 5490 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5491 | case 257: |
| 5492 | #line 2443 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5493 | { |
| 5494 | (yyval.ValIDVal) = ValID::createNull(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5495 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5496 | ;} |
| 5497 | break; |
| 5498 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5499 | case 258: |
| 5500 | #line 2447 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5501 | { |
| 5502 | (yyval.ValIDVal) = ValID::createUndef(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5503 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5504 | ;} |
| 5505 | break; |
| 5506 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5507 | case 259: |
| 5508 | #line 2451 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5509 | { // A vector zero constant. |
| 5510 | (yyval.ValIDVal) = ValID::createZeroInit(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5511 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5512 | ;} |
| 5513 | break; |
| 5514 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5515 | case 260: |
| 5516 | #line 2455 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5517 | { // Nonempty unsized packed vector |
| 5518 | const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); |
| 5519 | int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5520 | |
| 5521 | VectorType* pt = VectorType::get(ETy, NumElements); |
| 5522 | PATypeHolder* PTy = new PATypeHolder( |
| 5523 | HandleUpRefs( |
| 5524 | VectorType::get( |
| 5525 | ETy, |
| 5526 | NumElements) |
| 5527 | ) |
| 5528 | ); |
| 5529 | |
| 5530 | // Verify all elements are correct type! |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5531 | for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { |
| 5532 | if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5533 | GEN_ERROR("Element #" + utostr(i) + " is not of type '" + |
| 5534 | ETy->getDescription() +"' as required!\nIt is of type '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5535 | (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5536 | } |
| 5537 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5538 | (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector))); |
| 5539 | delete PTy; delete (yyvsp[(2) - (3)].ConstVector); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5540 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5541 | ;} |
| 5542 | break; |
| 5543 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5544 | case 261: |
| 5545 | #line 2480 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5546 | { |
| 5547 | (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5548 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5549 | ;} |
| 5550 | break; |
| 5551 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5552 | case 262: |
| 5553 | #line 2484 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5554 | { |
| 5555 | (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal)); |
| 5556 | delete (yyvsp[(3) - (5)].StrVal); |
| 5557 | delete (yyvsp[(5) - (5)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5558 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5559 | ;} |
| 5560 | break; |
| 5561 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5562 | case 263: |
| 5563 | #line 2494 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5564 | { // Is it an integer reference...? |
| 5565 | (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5566 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5567 | ;} |
| 5568 | break; |
| 5569 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5570 | case 264: |
| 5571 | #line 2498 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5572 | { |
| 5573 | (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5574 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5575 | ;} |
| 5576 | break; |
| 5577 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5578 | case 265: |
| 5579 | #line 2502 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5580 | { // Is it a named reference...? |
| 5581 | (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5582 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5583 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5584 | ;} |
| 5585 | break; |
| 5586 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5587 | case 266: |
| 5588 | #line 2507 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5589 | { // Is it a named reference...? |
| 5590 | (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal)); |
| 5591 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5592 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5593 | ;} |
| 5594 | break; |
| 5595 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5596 | case 269: |
| 5597 | #line 2520 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5598 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5599 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5600 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription()); |
| 5601 | (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); |
| 5602 | delete (yyvsp[(1) - (2)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5603 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5604 | ;} |
| 5605 | break; |
| 5606 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5607 | case 270: |
| 5608 | #line 2529 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5609 | { |
| 5610 | (yyval.ValueList) = new std::vector<Value *>(); |
| 5611 | (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5612 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5613 | ;} |
| 5614 | break; |
| 5615 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5616 | case 271: |
| 5617 | #line 2534 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5618 | { |
| 5619 | ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal)); |
Devang Patel | bf50740 | 2008-02-20 22:40:23 +0000 | [diff] [blame] | 5620 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5621 | ;} |
| 5622 | break; |
| 5623 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5624 | case 272: |
| 5625 | #line 2539 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5626 | { |
| 5627 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5628 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5629 | ;} |
| 5630 | break; |
| 5631 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5632 | case 273: |
| 5633 | #line 2543 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5634 | { // Do not allow functions with 0 basic blocks |
| 5635 | (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5636 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5637 | ;} |
| 5638 | break; |
| 5639 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5640 | case 274: |
| 5641 | #line 2552 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5642 | { |
| 5643 | setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5644 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5645 | InsertValue((yyvsp[(3) - (3)].TermInstVal)); |
| 5646 | (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); |
| 5647 | (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5648 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5649 | ;} |
| 5650 | break; |
| 5651 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5652 | case 275: |
| 5653 | #line 2561 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5654 | { |
| 5655 | if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5656 | if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0))) |
| 5657 | if (CI2->getParent() == 0) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5658 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2); |
| 5659 | (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); |
| 5660 | (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5661 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5662 | ;} |
| 5663 | break; |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5664 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5665 | case 276: |
| 5666 | #line 2570 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5667 | { // Empty space between instruction lists |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5668 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5669 | CHECK_FOR_ERROR |
| 5670 | ;} |
| 5671 | break; |
| 5672 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5673 | case 277: |
| 5674 | #line 2574 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5675 | { // Labelled (named) basic block |
| 5676 | (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal))); |
| 5677 | delete (yyvsp[(1) - (1)].StrVal); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5678 | CHECK_FOR_ERROR |
Chris Lattner | e7e9b60 | 2008-05-04 17:18:47 +0000 | [diff] [blame] | 5679 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5680 | ;} |
| 5681 | break; |
| 5682 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5683 | case 278: |
| 5684 | #line 2582 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5685 | { // Return with a result... |
| 5686 | ValueList &VL = *(yyvsp[(2) - (2)].ValueList); |
| 5687 | assert(!VL.empty() && "Invalid ret operands!"); |
| 5688 | (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size()); |
| 5689 | delete (yyvsp[(2) - (2)].ValueList); |
| 5690 | CHECK_FOR_ERROR |
| 5691 | ;} |
| 5692 | break; |
| 5693 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5694 | case 279: |
| 5695 | #line 2589 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5696 | { // Return with no result... |
| 5697 | (yyval.TermInstVal) = ReturnInst::Create(); |
| 5698 | CHECK_FOR_ERROR |
| 5699 | ;} |
| 5700 | break; |
| 5701 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5702 | case 280: |
| 5703 | #line 2593 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5704 | { // Unconditional Branch... |
| 5705 | BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); |
| 5706 | CHECK_FOR_ERROR |
| 5707 | (yyval.TermInstVal) = BranchInst::Create(tmpBB); |
| 5708 | ;} |
| 5709 | break; |
| 5710 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5711 | case 281: |
| 5712 | #line 2598 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5713 | { |
| 5714 | assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?"); |
| 5715 | BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 5716 | CHECK_FOR_ERROR |
| 5717 | BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); |
| 5718 | CHECK_FOR_ERROR |
| 5719 | Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); |
| 5720 | CHECK_FOR_ERROR |
| 5721 | (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal); |
| 5722 | ;} |
| 5723 | break; |
| 5724 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5725 | case 282: |
| 5726 | #line 2608 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5727 | { |
| 5728 | Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)); |
| 5729 | CHECK_FOR_ERROR |
| 5730 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); |
| 5731 | CHECK_FOR_ERROR |
| 5732 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); |
| 5733 | (yyval.TermInstVal) = S; |
| 5734 | |
| 5735 | std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), |
| 5736 | E = (yyvsp[(8) - (9)].JumpTable)->end(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5737 | for (; I != E; ++I) { |
| 5738 | if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first)) |
| 5739 | S->addCase(CI, I->second); |
| 5740 | else |
| 5741 | GEN_ERROR("Switch case is constant, but not a simple integer"); |
| 5742 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5743 | delete (yyvsp[(8) - (9)].JumpTable); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5744 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5745 | ;} |
| 5746 | break; |
| 5747 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5748 | case 283: |
| 5749 | #line 2627 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5750 | { |
| 5751 | Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5752 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5753 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5754 | CHECK_FOR_ERROR |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5755 | SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5756 | (yyval.TermInstVal) = S; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5757 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5758 | ;} |
| 5759 | break; |
| 5760 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5761 | case 284: |
| 5762 | #line 2637 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5763 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5764 | |
| 5765 | // Handle the short syntax |
| 5766 | const PointerType *PFTy = 0; |
| 5767 | const FunctionType *Ty = 0; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5768 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) || |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5769 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 5770 | // Pull out the types of all of the arguments... |
| 5771 | std::vector<const Type*> ParamTypes; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5772 | ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end(); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5773 | for (; I != E; ++I) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5774 | const Type *Ty = I->Val->getType(); |
| 5775 | if (Ty == Type::VoidTy) |
| 5776 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 5777 | ParamTypes.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5778 | } |
Chris Lattner | 73de3c0 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 5779 | |
| 5780 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal))) |
| 5781 | GEN_ERROR("Invalid result type for LLVM function"); |
| 5782 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5783 | Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | fb623c6 | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 5784 | PFTy = PointerType::getUnqual(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5785 | } |
| 5786 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5787 | delete (yyvsp[(3) - (14)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5788 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5789 | Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5790 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5791 | BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5792 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5793 | BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5794 | CHECK_FOR_ERROR |
| 5795 | |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5796 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5797 | if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) |
| 5798 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs))); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5799 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5800 | // Check the arguments |
| 5801 | ValueList Args; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5802 | if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments? |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5803 | // Make sure no arguments is a good thing! |
| 5804 | if (Ty->getNumParams() != 0) |
| 5805 | GEN_ERROR("No arguments passed to a function that " |
| 5806 | "expects arguments"); |
| 5807 | } else { // Has arguments? |
| 5808 | // Loop through FunctionType's arguments and ensure they are specified |
| 5809 | // correctly! |
| 5810 | FunctionType::param_iterator I = Ty->param_begin(); |
| 5811 | FunctionType::param_iterator E = Ty->param_end(); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5812 | ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end(); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5813 | unsigned index = 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5814 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5815 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5816 | if (ArgI->Val->getType() != *I) |
| 5817 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
| 5818 | (*I)->getDescription() + "'"); |
| 5819 | Args.push_back(ArgI->Val); |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5820 | if (ArgI->Attrs != ParamAttr::None) |
| 5821 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5822 | } |
| 5823 | |
| 5824 | if (Ty->isVarArg()) { |
| 5825 | if (I == E) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5826 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5827 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5828 | if (ArgI->Attrs != ParamAttr::None) |
| 5829 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 5830 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5831 | } else if (I != E || ArgI != ArgE) |
| 5832 | GEN_ERROR("Invalid number of parameters detected"); |
| 5833 | } |
| 5834 | |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5835 | PAListPtr PAL; |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5836 | if (!Attrs.empty()) |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 5837 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5838 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5839 | // Create the InvokeInst |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 5840 | InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end()); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5841 | II->setCallingConv((yyvsp[(2) - (14)].UIntVal)); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5842 | II->setParamAttrs(PAL); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5843 | (yyval.TermInstVal) = II; |
| 5844 | delete (yyvsp[(6) - (14)].ParamList); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5845 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5846 | ;} |
| 5847 | break; |
| 5848 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5849 | case 285: |
| 5850 | #line 2721 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5851 | { |
| 5852 | (yyval.TermInstVal) = new UnwindInst(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5853 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5854 | ;} |
| 5855 | break; |
| 5856 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5857 | case 286: |
| 5858 | #line 2725 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5859 | { |
| 5860 | (yyval.TermInstVal) = new UnreachableInst(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5861 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5862 | ;} |
| 5863 | break; |
| 5864 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5865 | case 287: |
| 5866 | #line 2732 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5867 | { |
| 5868 | (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); |
| 5869 | Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5870 | CHECK_FOR_ERROR |
| 5871 | if (V == 0) |
| 5872 | GEN_ERROR("May only switch on a constant pool value"); |
| 5873 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5874 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5875 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5876 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5877 | ;} |
| 5878 | break; |
| 5879 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5880 | case 288: |
| 5881 | #line 2743 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5882 | { |
| 5883 | (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >(); |
| 5884 | Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5885 | CHECK_FOR_ERROR |
| 5886 | |
| 5887 | if (V == 0) |
| 5888 | GEN_ERROR("May only switch on a constant pool value"); |
| 5889 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5890 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5891 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5892 | (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); |
| 5893 | ;} |
| 5894 | break; |
| 5895 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5896 | case 289: |
| 5897 | #line 2756 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5898 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5899 | // Is this definition named?? if so, assign the name... |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5900 | setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5901 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5902 | InsertValue((yyvsp[(2) - (2)].InstVal)); |
| 5903 | (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5904 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5905 | ;} |
| 5906 | break; |
| 5907 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5908 | case 290: |
| 5909 | #line 2766 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5910 | { // Used for PHI nodes |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5911 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5912 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription()); |
| 5913 | (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >(); |
| 5914 | Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5915 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5916 | BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5917 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5918 | (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5919 | delete (yyvsp[(1) - (6)].TypeVal); |
| 5920 | ;} |
| 5921 | break; |
| 5922 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5923 | case 291: |
| 5924 | #line 2777 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5925 | { |
| 5926 | (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); |
| 5927 | Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5928 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5929 | BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5930 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5931 | (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); |
| 5932 | ;} |
| 5933 | break; |
| 5934 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5935 | case 292: |
| 5936 | #line 2787 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5937 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5938 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5939 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5940 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5941 | // Used for call and invoke instructions |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5942 | (yyval.ParamList) = new ParamList(); |
| 5943 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal)); |
| 5944 | (yyval.ParamList)->push_back(E); |
| 5945 | delete (yyvsp[(1) - (4)].TypeVal); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5946 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5947 | ;} |
| 5948 | break; |
| 5949 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5950 | case 293: |
| 5951 | #line 2798 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5952 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5953 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Dale Johannesen | cfb19e6 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 5954 | // Labels are only valid in ASMs |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5955 | (yyval.ParamList) = new ParamList(); |
| 5956 | ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal)); |
| 5957 | (yyval.ParamList)->push_back(E); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5958 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5959 | ;} |
| 5960 | break; |
| 5961 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5962 | case 294: |
| 5963 | #line 2806 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5964 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5965 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5966 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5967 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 5968 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 5969 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal)); |
| 5970 | (yyval.ParamList)->push_back(E); |
| 5971 | delete (yyvsp[(3) - (6)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5972 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5973 | ;} |
| 5974 | break; |
| 5975 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5976 | case 295: |
| 5977 | #line 2816 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5978 | { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 5979 | // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5980 | (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList); |
| 5981 | ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal)); |
| 5982 | (yyval.ParamList)->push_back(E); |
Dale Johannesen | cfb19e6 | 2007-11-05 21:20:28 +0000 | [diff] [blame] | 5983 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5984 | ;} |
| 5985 | break; |
| 5986 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5987 | case 296: |
| 5988 | #line 2823 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5989 | { (yyval.ParamList) = new ParamList(); ;} |
| 5990 | break; |
| 5991 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5992 | case 297: |
| 5993 | #line 2826 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5994 | { (yyval.ValueList) = new std::vector<Value*>(); ;} |
| 5995 | break; |
| 5996 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 5997 | case 298: |
| 5998 | #line 2827 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 5999 | { |
| 6000 | (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); |
| 6001 | (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6002 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6003 | ;} |
| 6004 | break; |
| 6005 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6006 | case 299: |
| 6007 | #line 2834 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6008 | { |
| 6009 | (yyval.BoolVal) = true; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6010 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6011 | ;} |
| 6012 | break; |
| 6013 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6014 | case 300: |
| 6015 | #line 2838 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6016 | { |
| 6017 | (yyval.BoolVal) = false; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6018 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6019 | ;} |
| 6020 | break; |
| 6021 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6022 | case 301: |
| 6023 | #line 2843 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6024 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6025 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6026 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6027 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && |
| 6028 | !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6029 | GEN_ERROR( |
| 6030 | "Arithmetic operator requires integer, FP, or packed operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6031 | Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6032 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6033 | Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6034 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6035 | (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2); |
| 6036 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6037 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6038 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6039 | ;} |
| 6040 | break; |
| 6041 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6042 | case 302: |
| 6043 | #line 2859 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6044 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6045 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6046 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription()); |
| 6047 | if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) { |
| 6048 | if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) || |
| 6049 | !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6050 | GEN_ERROR("Logical operator requires integral operands"); |
| 6051 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6052 | Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6053 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6054 | Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6055 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6056 | (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2); |
| 6057 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6058 | GEN_ERROR("binary operator returned null"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6059 | delete (yyvsp[(2) - (5)].TypeVal); |
| 6060 | ;} |
| 6061 | break; |
| 6062 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6063 | case 303: |
| 6064 | #line 2876 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6065 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6066 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6067 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6068 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6069 | GEN_ERROR("Vector types not supported by icmp instruction"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6070 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6071 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6072 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6073 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6074 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); |
| 6075 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6076 | GEN_ERROR("icmp operator returned null"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6077 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6078 | ;} |
| 6079 | break; |
| 6080 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6081 | case 304: |
| 6082 | #line 2890 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6083 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6084 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6085 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6086 | if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6087 | GEN_ERROR("Vector types not supported by fcmp instruction"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6088 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6089 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6090 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6091 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6092 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); |
| 6093 | if ((yyval.InstVal) == 0) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6094 | GEN_ERROR("fcmp operator returned null"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6095 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6096 | ;} |
| 6097 | break; |
| 6098 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6099 | case 305: |
| 6100 | #line 2904 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 6101 | { |
| 6102 | if (!UpRefs.empty()) |
| 6103 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6104 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6105 | GEN_ERROR("Scalar types not supported by vicmp instruction"); |
| 6106 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6107 | CHECK_FOR_ERROR |
| 6108 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6109 | CHECK_FOR_ERROR |
| 6110 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2); |
| 6111 | if ((yyval.InstVal) == 0) |
| 6112 | GEN_ERROR("icmp operator returned null"); |
| 6113 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6114 | ;} |
| 6115 | break; |
| 6116 | |
| 6117 | case 306: |
| 6118 | #line 2918 "/llvm/lib/AsmParser/llvmAsmParser.y" |
| 6119 | { |
| 6120 | if (!UpRefs.empty()) |
| 6121 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription()); |
| 6122 | if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get())) |
| 6123 | GEN_ERROR("Scalar types not supported by vfcmp instruction"); |
| 6124 | Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal)); |
| 6125 | CHECK_FOR_ERROR |
| 6126 | Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)); |
| 6127 | CHECK_FOR_ERROR |
| 6128 | (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2); |
| 6129 | if ((yyval.InstVal) == 0) |
| 6130 | GEN_ERROR("fcmp operator returned null"); |
| 6131 | delete (yyvsp[(3) - (6)].TypeVal); |
| 6132 | ;} |
| 6133 | break; |
| 6134 | |
| 6135 | case 307: |
| 6136 | #line 2932 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6137 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6138 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6139 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6140 | Value* Val = (yyvsp[(2) - (4)].ValueVal); |
| 6141 | const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get(); |
| 6142 | if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6143 | GEN_ERROR("invalid cast opcode for cast from '" + |
| 6144 | Val->getType()->getDescription() + "' to '" + |
| 6145 | DestTy->getDescription() + "'"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6146 | (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy); |
| 6147 | delete (yyvsp[(4) - (4)].TypeVal); |
| 6148 | ;} |
| 6149 | break; |
| 6150 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6151 | case 308: |
| 6152 | #line 2944 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6153 | { |
| 6154 | if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6155 | GEN_ERROR("select condition must be boolean"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6156 | if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6157 | GEN_ERROR("select value types should match"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6158 | (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6159 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6160 | ;} |
| 6161 | break; |
| 6162 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6163 | case 309: |
| 6164 | #line 2952 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6165 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6166 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6167 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription()); |
| 6168 | (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); |
| 6169 | delete (yyvsp[(4) - (4)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6170 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6171 | ;} |
| 6172 | break; |
| 6173 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6174 | case 310: |
| 6175 | #line 2959 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6176 | { |
| 6177 | if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6178 | GEN_ERROR("Invalid extractelement operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6179 | (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6180 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6181 | ;} |
| 6182 | break; |
| 6183 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6184 | case 311: |
| 6185 | #line 2965 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6186 | { |
| 6187 | if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6188 | GEN_ERROR("Invalid insertelement operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6189 | (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6190 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6191 | ;} |
| 6192 | break; |
| 6193 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6194 | case 312: |
| 6195 | #line 2971 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6196 | { |
| 6197 | if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6198 | GEN_ERROR("Invalid shufflevector operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6199 | (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6200 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6201 | ;} |
| 6202 | break; |
| 6203 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6204 | case 313: |
| 6205 | #line 2977 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6206 | { |
| 6207 | const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6208 | if (!Ty->isFirstClassType()) |
| 6209 | GEN_ERROR("PHI node operands must be of first class type"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6210 | (yyval.InstVal) = PHINode::Create(Ty); |
| 6211 | ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); |
| 6212 | while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { |
| 6213 | if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6214 | GEN_ERROR("All elements of a PHI node must be of the same type"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6215 | cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); |
| 6216 | (yyvsp[(2) - (2)].PHIList)->pop_front(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6217 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6218 | delete (yyvsp[(2) - (2)].PHIList); // Free the list... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6219 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6220 | ;} |
| 6221 | break; |
| 6222 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6223 | case 314: |
| 6224 | #line 2993 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6225 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6226 | |
| 6227 | // Handle the short syntax |
| 6228 | const PointerType *PFTy = 0; |
| 6229 | const FunctionType *Ty = 0; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6230 | if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) || |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6231 | !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) { |
| 6232 | // Pull out the types of all of the arguments... |
| 6233 | std::vector<const Type*> ParamTypes; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6234 | ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end(); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6235 | for (; I != E; ++I) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6236 | const Type *Ty = I->Val->getType(); |
| 6237 | if (Ty == Type::VoidTy) |
| 6238 | GEN_ERROR("Short call syntax cannot be used with varargs"); |
| 6239 | ParamTypes.push_back(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6240 | } |
Chris Lattner | 73de3c0 | 2008-04-23 05:37:08 +0000 | [diff] [blame] | 6241 | |
| 6242 | if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal))) |
| 6243 | GEN_ERROR("Invalid result type for LLVM function"); |
| 6244 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6245 | Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false); |
Christopher Lamb | fb623c6 | 2007-12-17 01:17:35 +0000 | [diff] [blame] | 6246 | PFTy = PointerType::getUnqual(Ty); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6247 | } |
| 6248 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6249 | Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling... |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6250 | CHECK_FOR_ERROR |
| 6251 | |
| 6252 | // Check for call to invalid intrinsic to avoid crashing later. |
| 6253 | if (Function *theF = dyn_cast<Function>(V)) { |
| 6254 | if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) && |
| 6255 | (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) && |
| 6256 | !theF->getIntrinsicID(true)) |
| 6257 | GEN_ERROR("Call to invalid LLVM intrinsic function '" + |
| 6258 | theF->getName() + "'"); |
| 6259 | } |
| 6260 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6261 | // Set up the ParamAttrs for the function |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6262 | SmallVector<ParamAttrsWithIndex, 8> Attrs; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6263 | if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) |
| 6264 | Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs))); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6265 | // Check the arguments |
| 6266 | ValueList Args; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6267 | if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments? |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6268 | // Make sure no arguments is a good thing! |
| 6269 | if (Ty->getNumParams() != 0) |
| 6270 | GEN_ERROR("No arguments passed to a function that " |
| 6271 | "expects arguments"); |
| 6272 | } else { // Has arguments? |
| 6273 | // Loop through FunctionType's arguments and ensure they are specified |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6274 | // correctly. Also, gather any parameter attributes. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6275 | FunctionType::param_iterator I = Ty->param_begin(); |
| 6276 | FunctionType::param_iterator E = Ty->param_end(); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6277 | ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end(); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6278 | unsigned index = 1; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6279 | |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6280 | for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6281 | if (ArgI->Val->getType() != *I) |
| 6282 | GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" + |
| 6283 | (*I)->getDescription() + "'"); |
| 6284 | Args.push_back(ArgI->Val); |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6285 | if (ArgI->Attrs != ParamAttr::None) |
| 6286 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6287 | } |
| 6288 | if (Ty->isVarArg()) { |
| 6289 | if (I == E) |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6290 | for (; ArgI != ArgE; ++ArgI, ++index) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6291 | Args.push_back(ArgI->Val); // push the remaining varargs |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6292 | if (ArgI->Attrs != ParamAttr::None) |
| 6293 | Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs)); |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6294 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6295 | } else if (I != E || ArgI != ArgE) |
| 6296 | GEN_ERROR("Invalid number of parameters detected"); |
| 6297 | } |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6298 | |
| 6299 | // Finish off the ParamAttrs and check them |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6300 | PAListPtr PAL; |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6301 | if (!Attrs.empty()) |
Chris Lattner | 1c8733e | 2008-03-12 17:45:29 +0000 | [diff] [blame] | 6302 | PAL = PAListPtr::get(Attrs.begin(), Attrs.end()); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6303 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6304 | // Create the call node |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6305 | CallInst *CI = CallInst::Create(V, Args.begin(), Args.end()); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6306 | CI->setTailCall((yyvsp[(1) - (8)].BoolVal)); |
| 6307 | CI->setCallingConv((yyvsp[(2) - (8)].UIntVal)); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6308 | CI->setParamAttrs(PAL); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6309 | (yyval.InstVal) = CI; |
| 6310 | delete (yyvsp[(6) - (8)].ParamList); |
| 6311 | delete (yyvsp[(3) - (8)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6312 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6313 | ;} |
| 6314 | break; |
| 6315 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6316 | case 315: |
| 6317 | #line 3082 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6318 | { |
| 6319 | (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6320 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6321 | ;} |
| 6322 | break; |
| 6323 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6324 | case 316: |
| 6325 | #line 3087 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6326 | { |
| 6327 | (yyval.BoolVal) = true; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6328 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6329 | ;} |
| 6330 | break; |
| 6331 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6332 | case 317: |
| 6333 | #line 3091 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6334 | { |
| 6335 | (yyval.BoolVal) = false; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6336 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6337 | ;} |
| 6338 | break; |
| 6339 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6340 | case 318: |
| 6341 | #line 3098 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6342 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6343 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6344 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6345 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6346 | delete (yyvsp[(2) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6347 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6348 | ;} |
| 6349 | break; |
| 6350 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6351 | case 319: |
| 6352 | #line 3105 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6353 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6354 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6355 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
| 6356 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6357 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6358 | (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6359 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6360 | ;} |
| 6361 | break; |
| 6362 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6363 | case 320: |
| 6364 | #line 3113 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6365 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6366 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6367 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription()); |
| 6368 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); |
| 6369 | delete (yyvsp[(2) - (3)].TypeVal); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6370 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6371 | ;} |
| 6372 | break; |
| 6373 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6374 | case 321: |
| 6375 | #line 3120 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6376 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6377 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6378 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription()); |
| 6379 | Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6380 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6381 | (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal)); |
| 6382 | delete (yyvsp[(2) - (6)].TypeVal); |
| 6383 | ;} |
| 6384 | break; |
| 6385 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6386 | case 322: |
| 6387 | #line 3128 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6388 | { |
| 6389 | if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6390 | GEN_ERROR("Trying to free nonpointer type " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6391 | (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + ""); |
| 6392 | (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6393 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6394 | ;} |
| 6395 | break; |
| 6396 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6397 | case 323: |
| 6398 | #line 3136 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6399 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6400 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6401 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6402 | if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6403 | GEN_ERROR("Can't load from nonpointer type: " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6404 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6405 | if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType()) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6406 | GEN_ERROR("Can't load from pointer of non-first-class type: " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6407 | (*(yyvsp[(3) - (5)].TypeVal))->getDescription()); |
| 6408 | Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6409 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6410 | (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal)); |
| 6411 | delete (yyvsp[(3) - (5)].TypeVal); |
| 6412 | ;} |
| 6413 | break; |
| 6414 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6415 | case 324: |
| 6416 | #line 3150 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6417 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6418 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6419 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
| 6420 | const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6421 | if (!PT) |
| 6422 | GEN_ERROR("Can't store to a nonpointer type: " + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6423 | (*(yyvsp[(5) - (7)].TypeVal))->getDescription()); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6424 | const Type *ElTy = PT->getElementType(); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6425 | if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType()) |
| 6426 | GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() + |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6427 | "' into space of type '" + ElTy->getDescription() + "'"); |
| 6428 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6429 | Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6430 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6431 | (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal)); |
| 6432 | delete (yyvsp[(5) - (7)].TypeVal); |
| 6433 | ;} |
| 6434 | break; |
| 6435 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6436 | case 325: |
| 6437 | #line 3167 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6438 | { |
| 6439 | Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal)); |
| 6440 | if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val))) |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6441 | GEN_ERROR("Invalid getresult operands"); |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6442 | (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val)); |
| 6443 | delete (yyvsp[(2) - (5)].TypeVal); |
Devang Patel | 3b8849c | 2008-02-19 22:27:01 +0000 | [diff] [blame] | 6444 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6445 | ;} |
| 6446 | break; |
| 6447 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6448 | case 326: |
| 6449 | #line 3175 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6450 | { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6451 | if (!UpRefs.empty()) |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6452 | GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription()); |
| 6453 | if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get())) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6454 | GEN_ERROR("getelementptr insn requires pointer operand"); |
| 6455 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6456 | if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true)) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6457 | GEN_ERROR("Invalid getelementptr indices for type '" + |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6458 | (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'"); |
| 6459 | Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6460 | CHECK_FOR_ERROR |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6461 | (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); |
| 6462 | delete (yyvsp[(2) - (4)].TypeVal); |
| 6463 | delete (yyvsp[(4) - (4)].ValueList); |
| 6464 | ;} |
| 6465 | break; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6466 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6467 | |
| 6468 | /* Line 1267 of yacc.c. */ |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6469 | #line 6470 "llvmAsmParser.tab.c" |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6470 | default: break; |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6471 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6472 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
| 6473 | |
| 6474 | YYPOPSTACK (yylen); |
| 6475 | yylen = 0; |
| 6476 | YY_STACK_PRINT (yyss, yyssp); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6477 | |
| 6478 | *++yyvsp = yyval; |
| 6479 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6480 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6481 | /* Now `shift' the result of the reduction. Determine what state |
| 6482 | that goes to, based on the state we popped back to and the rule |
| 6483 | number reduced by. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6484 | |
| 6485 | yyn = yyr1[yyn]; |
| 6486 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6487 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 6488 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6489 | yystate = yytable[yystate]; |
| 6490 | else |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6491 | yystate = yydefgoto[yyn - YYNTOKENS]; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6492 | |
| 6493 | goto yynewstate; |
| 6494 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6495 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6496 | /*------------------------------------. |
| 6497 | | yyerrlab -- here on detecting error | |
| 6498 | `------------------------------------*/ |
| 6499 | yyerrlab: |
| 6500 | /* If not already recovering from an error, report this error. */ |
| 6501 | if (!yyerrstatus) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6502 | { |
| 6503 | ++yynerrs; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6504 | #if ! YYERROR_VERBOSE |
| 6505 | yyerror (YY_("syntax error")); |
| 6506 | #else |
| 6507 | { |
| 6508 | YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); |
| 6509 | if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) |
| 6510 | { |
| 6511 | YYSIZE_T yyalloc = 2 * yysize; |
| 6512 | if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) |
| 6513 | yyalloc = YYSTACK_ALLOC_MAXIMUM; |
| 6514 | if (yymsg != yymsgbuf) |
| 6515 | YYSTACK_FREE (yymsg); |
| 6516 | yymsg = (char *) YYSTACK_ALLOC (yyalloc); |
| 6517 | if (yymsg) |
| 6518 | yymsg_alloc = yyalloc; |
| 6519 | else |
| 6520 | { |
| 6521 | yymsg = yymsgbuf; |
| 6522 | yymsg_alloc = sizeof yymsgbuf; |
| 6523 | } |
| 6524 | } |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6525 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6526 | if (0 < yysize && yysize <= yymsg_alloc) |
| 6527 | { |
| 6528 | (void) yysyntax_error (yymsg, yystate, yychar); |
| 6529 | yyerror (yymsg); |
| 6530 | } |
| 6531 | else |
| 6532 | { |
| 6533 | yyerror (YY_("syntax error")); |
| 6534 | if (yysize != 0) |
| 6535 | goto yyexhaustedlab; |
| 6536 | } |
| 6537 | } |
| 6538 | #endif |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6539 | } |
| 6540 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6541 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6542 | |
| 6543 | if (yyerrstatus == 3) |
| 6544 | { |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6545 | /* If just tried and failed to reuse look-ahead token after an |
| 6546 | error, discard it. */ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6547 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6548 | if (yychar <= YYEOF) |
| 6549 | { |
| 6550 | /* Return failure if at end of input. */ |
| 6551 | if (yychar == YYEOF) |
| 6552 | YYABORT; |
| 6553 | } |
| 6554 | else |
| 6555 | { |
| 6556 | yydestruct ("Error: discarding", |
| 6557 | yytoken, &yylval); |
| 6558 | yychar = YYEMPTY; |
| 6559 | } |
| 6560 | } |
| 6561 | |
| 6562 | /* Else will try to reuse look-ahead token after shifting the error |
| 6563 | token. */ |
| 6564 | goto yyerrlab1; |
| 6565 | |
| 6566 | |
| 6567 | /*---------------------------------------------------. |
| 6568 | | yyerrorlab -- error raised explicitly by YYERROR. | |
| 6569 | `---------------------------------------------------*/ |
| 6570 | yyerrorlab: |
| 6571 | |
| 6572 | /* Pacify compilers like GCC when the user code never invokes |
| 6573 | YYERROR and the label yyerrorlab therefore never appears in user |
| 6574 | code. */ |
| 6575 | if (/*CONSTCOND*/ 0) |
| 6576 | goto yyerrorlab; |
| 6577 | |
| 6578 | /* Do not reclaim the symbols of the rule which action triggered |
| 6579 | this YYERROR. */ |
| 6580 | YYPOPSTACK (yylen); |
| 6581 | yylen = 0; |
| 6582 | YY_STACK_PRINT (yyss, yyssp); |
| 6583 | yystate = *yyssp; |
| 6584 | goto yyerrlab1; |
| 6585 | |
| 6586 | |
| 6587 | /*-------------------------------------------------------------. |
| 6588 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 6589 | `-------------------------------------------------------------*/ |
| 6590 | yyerrlab1: |
| 6591 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 6592 | |
| 6593 | for (;;) |
| 6594 | { |
| 6595 | yyn = yypact[yystate]; |
| 6596 | if (yyn != YYPACT_NINF) |
| 6597 | { |
| 6598 | yyn += YYTERROR; |
| 6599 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 6600 | { |
| 6601 | yyn = yytable[yyn]; |
| 6602 | if (0 < yyn) |
| 6603 | break; |
| 6604 | } |
| 6605 | } |
| 6606 | |
| 6607 | /* Pop the current state because it cannot handle the error token. */ |
| 6608 | if (yyssp == yyss) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6609 | YYABORT; |
| 6610 | |
Dale Johannesen | 3afee19 | 2007-09-07 21:07:57 +0000 | [diff] [blame] | 6611 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6612 | yydestruct ("Error: popping", |
| 6613 | yystos[yystate], yyvsp); |
| 6614 | YYPOPSTACK (1); |
| 6615 | yystate = *yyssp; |
| 6616 | YY_STACK_PRINT (yyss, yyssp); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6617 | } |
| 6618 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6619 | if (yyn == YYFINAL) |
| 6620 | YYACCEPT; |
| 6621 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6622 | *++yyvsp = yylval; |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6623 | |
| 6624 | |
| 6625 | /* Shift the error token. */ |
| 6626 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); |
Reid Spencer | aa8ae28 | 2007-07-31 03:50:36 +0000 | [diff] [blame] | 6627 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6628 | yystate = yyn; |
| 6629 | goto yynewstate; |
| 6630 | |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6631 | |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6632 | /*-------------------------------------. |
| 6633 | | yyacceptlab -- YYACCEPT comes here. | |
| 6634 | `-------------------------------------*/ |
| 6635 | yyacceptlab: |
| 6636 | yyresult = 0; |
| 6637 | goto yyreturn; |
| 6638 | |
| 6639 | /*-----------------------------------. |
| 6640 | | yyabortlab -- YYABORT comes here. | |
| 6641 | `-----------------------------------*/ |
| 6642 | yyabortlab: |
| 6643 | yyresult = 1; |
| 6644 | goto yyreturn; |
| 6645 | |
| 6646 | #ifndef yyoverflow |
| 6647 | /*-------------------------------------------------. |
| 6648 | | yyexhaustedlab -- memory exhaustion comes here. | |
| 6649 | `-------------------------------------------------*/ |
| 6650 | yyexhaustedlab: |
| 6651 | yyerror (YY_("memory exhausted")); |
| 6652 | yyresult = 2; |
| 6653 | /* Fall through. */ |
Chris Lattner | 59363a3 | 2008-02-19 04:36:25 +0000 | [diff] [blame] | 6654 | #endif |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6655 | |
| 6656 | yyreturn: |
| 6657 | if (yychar != YYEOF && yychar != YYEMPTY) |
| 6658 | yydestruct ("Cleanup: discarding lookahead", |
| 6659 | yytoken, &yylval); |
| 6660 | /* Do not reclaim the symbols of the rule which action triggered |
| 6661 | this YYABORT or YYACCEPT. */ |
| 6662 | YYPOPSTACK (yylen); |
| 6663 | YY_STACK_PRINT (yyss, yyssp); |
| 6664 | while (yyssp != yyss) |
| 6665 | { |
| 6666 | yydestruct ("Cleanup: popping", |
| 6667 | yystos[*yyssp], yyvsp); |
| 6668 | YYPOPSTACK (1); |
Gabor Greif | 89f0116 | 2008-04-06 23:07:54 +0000 | [diff] [blame] | 6669 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6670 | #ifndef yyoverflow |
| 6671 | if (yyss != yyssa) |
| 6672 | YYSTACK_FREE (yyss); |
| 6673 | #endif |
| 6674 | #if YYERROR_VERBOSE |
| 6675 | if (yymsg != yymsgbuf) |
| 6676 | YYSTACK_FREE (yymsg); |
| 6677 | #endif |
| 6678 | /* Make sure YYID is used. */ |
| 6679 | return YYID (yyresult); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6680 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6681 | |
| 6682 | |
Nate Begeman | 646fa48 | 2008-05-12 19:01:56 +0000 | [diff] [blame^] | 6683 | #line 3192 "/llvm/lib/AsmParser/llvmAsmParser.y" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6684 | |
| 6685 | |
| 6686 | // common code from the two 'RunVMAsmParser' functions |
| 6687 | static Module* RunParser(Module * M) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6688 | CurModule.CurrentModule = M; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6689 | // Check to make sure the parser succeeded |
| 6690 | if (yyparse()) { |
| 6691 | if (ParserResult) |
| 6692 | delete ParserResult; |
| 6693 | return 0; |
| 6694 | } |
| 6695 | |
| 6696 | // Emit an error if there are any unresolved types left. |
| 6697 | if (!CurModule.LateResolveTypes.empty()) { |
| 6698 | const ValID &DID = CurModule.LateResolveTypes.begin()->first; |
| 6699 | if (DID.Type == ValID::LocalName) { |
| 6700 | GenerateError("Undefined type remains at eof: '"+DID.getName() + "'"); |
| 6701 | } else { |
| 6702 | GenerateError("Undefined type remains at eof: #" + itostr(DID.Num)); |
| 6703 | } |
| 6704 | if (ParserResult) |
| 6705 | delete ParserResult; |
| 6706 | return 0; |
| 6707 | } |
| 6708 | |
| 6709 | // Emit an error if there are any unresolved values left. |
| 6710 | if (!CurModule.LateResolveValues.empty()) { |
| 6711 | Value *V = CurModule.LateResolveValues.back(); |
| 6712 | std::map<Value*, std::pair<ValID, int> >::iterator I = |
| 6713 | CurModule.PlaceHolderInfo.find(V); |
| 6714 | |
| 6715 | if (I != CurModule.PlaceHolderInfo.end()) { |
| 6716 | ValID &DID = I->second.first; |
| 6717 | if (DID.Type == ValID::LocalName) { |
| 6718 | GenerateError("Undefined value remains at eof: "+DID.getName() + "'"); |
| 6719 | } else { |
| 6720 | GenerateError("Undefined value remains at eof: #" + itostr(DID.Num)); |
| 6721 | } |
| 6722 | if (ParserResult) |
| 6723 | delete ParserResult; |
| 6724 | return 0; |
| 6725 | } |
| 6726 | } |
| 6727 | |
| 6728 | // Check to make sure that parsing produced a result |
| 6729 | if (!ParserResult) |
| 6730 | return 0; |
| 6731 | |
| 6732 | // Reset ParserResult variable while saving its value for the result. |
| 6733 | Module *Result = ParserResult; |
| 6734 | ParserResult = 0; |
| 6735 | |
| 6736 | return Result; |
| 6737 | } |
| 6738 | |
| 6739 | void llvm::GenerateError(const std::string &message, int LineNo) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6740 | if (LineNo == -1) LineNo = LLLgetLineNo(); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6741 | // TODO: column number in exception |
| 6742 | if (TheParseError) |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6743 | TheParseError->setError(LLLgetFilename(), message, LineNo); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6744 | TriggerError = 1; |
| 6745 | } |
| 6746 | |
| 6747 | int yyerror(const char *ErrorMsg) { |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6748 | std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": "; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6749 | std::string errMsg = where + "error: " + std::string(ErrorMsg); |
Duncan Sands | f5588dc | 2007-11-27 13:23:08 +0000 | [diff] [blame] | 6750 | if (yychar != YYEMPTY && yychar != 0) { |
| 6751 | errMsg += " while reading token: '"; |
| 6752 | errMsg += std::string(LLLgetTokenStart(), |
| 6753 | LLLgetTokenStart()+LLLgetTokenLength()) + "'"; |
| 6754 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 6755 | GenerateError(errMsg); |
| 6756 | return 0; |
| 6757 | } |
Dan Gohman | 54392c1 | 2008-04-19 00:24:39 +0000 | [diff] [blame] | 6758 | |